1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-29 19:48:19 +00:00

(bs--redisplay): Fix typo in docstring.

(bs--window-config-coming-from): Make frame-local.
(bs--restore-window-config): New function.
(bs-kill, bs-select, bs-select-other-window, bs-select-other-frame): Use it.
(bs--show-with-configuration): Save the window configuration as a frame local
var, and only if *buffer-selection* is not already visible on this frame.
(bs--window-for-buffer): Return as soon as a matching buffer is found.
This commit is contained in:
Juanma Barranquero 2006-11-09 16:35:48 +00:00
parent 85e58334dc
commit ce3ba12c88
2 changed files with 38 additions and 19 deletions

View File

@ -1,3 +1,15 @@
2006-11-09 Juanma Barranquero <lekktu@gmail.com>
* bs.el (bs--redisplay): Fix typo in docstring.
(bs--window-config-coming-from): Make frame-local.
(bs--restore-window-config): New function.
(bs-kill, bs-select, bs-select-other-window)
(bs-select-other-frame): Use it.
(bs--window-for-buffer): Return as soon as a matching buffer is found.
(bs--show-with-configuration): Save the window configuration as a
frame local var, and only if *buffer-selection* is not already
visible on this frame.
2006-11-08 Chong Yidong <cyd@stupidchicken.com>
* vc-svn.el (vc-svn-admin-directory): New var.
@ -5,7 +17,7 @@
(vc-svn-repository-hostname): Use it.
Suggested by arit93@yahoo.com.
2006-11-09 Juanma Barranquero <lekktu@gmail.com>
2006-11-08 Juanma Barranquero <lekktu@gmail.com>
* ldefs-boot.el: Regenerate.

View File

@ -446,6 +446,7 @@ defined by current configuration `bs-current-configuration'.")
(defvar bs--window-config-coming-from nil
"Window configuration before starting Buffer Selection Menu.")
(make-variable-frame-local 'bs--window-config-coming-from)
(defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*"
"Regular expression specifying which buffers never to show.
@ -584,7 +585,7 @@ a special function. SORT-DESCRIPTION is an element of `bs-sort-functions'."
(defun bs--redisplay (&optional keep-line-p sort-description)
"Redisplay whole Buffer Selection Menu.
If KEEP-LINE-P is non-nil the point will stay on current line.
SORT-DESCRIPTION is an element of `bs-sort-functions'"
SORT-DESCRIPTION is an element of `bs-sort-functions'."
(let ((line (1+ (count-lines 1 (point)))))
(bs-show-in-buffer (bs-buffer-list nil sort-description))
(if keep-line-p
@ -661,11 +662,17 @@ to show always.
font-lock-verbose nil)
(run-mode-hooks 'bs-mode-hook))
(defun bs--restore-window-config ()
"Restore window configuration on the current frame."
(when bs--window-config-coming-from
(set-window-configuration bs--window-config-coming-from)
(setq bs--window-config-coming-from nil)))
(defun bs-kill ()
"Let buffer disappear and reset window-configuration."
(interactive)
(bury-buffer (current-buffer))
(set-window-configuration bs--window-config-coming-from))
(bs--restore-window-config))
(defun bs-abort ()
"Ding and leave Buffer Selection Menu without a selection."
@ -689,12 +696,12 @@ Refresh whole Buffer Selection Menu."
"Return a window showing a buffer with name BUFFER-NAME.
Take only windows of current frame into account.
Return nil if there is no such buffer."
(let ((window nil))
(walk-windows (lambda (wind)
(if (string= (buffer-name (window-buffer wind))
buffer-name)
(setq window wind))))
window))
(catch 'window
(walk-windows (lambda (w)
(when (string= (buffer-name (window-buffer w))
buffer-name)
(throw 'window w))))
nil))
(defun bs--set-window-height ()
"Change the height of the selected window to suit the current buffer list."
@ -736,7 +743,7 @@ Leave Buffer Selection Menu."
(interactive)
(let ((buffer (bs--current-buffer)))
(bury-buffer (current-buffer))
(set-window-configuration bs--window-config-coming-from)
(bs--restore-window-config)
(switch-to-buffer buffer)
(if bs--marked-buffers
;; Some marked buffers for selection
@ -760,7 +767,7 @@ Leave Buffer Selection Menu."
(interactive)
(let ((buffer (bs--current-buffer)))
(bury-buffer (current-buffer))
(set-window-configuration bs--window-config-coming-from)
(bs--restore-window-config)
(switch-to-buffer-other-window buffer)))
(defun bs-tmp-select-other-window ()
@ -776,7 +783,7 @@ Leave Buffer Selection Menu."
(interactive)
(let ((buffer (bs--current-buffer)))
(bury-buffer (current-buffer))
(set-window-configuration bs--window-config-coming-from)
(bs--restore-window-config)
(switch-to-buffer-other-frame buffer)))
(defun bs-mouse-select-other-frame (event)
@ -1426,17 +1433,17 @@ for buffer selection."
(unless (string= "*buffer-selection*" (buffer-name))
;; Only when not in buffer *buffer-selection*
;; we have to set the buffer we started the command
(progn
(setq bs--buffer-coming-from (current-buffer))
(setq bs--window-config-coming-from (current-window-configuration))))
(setq bs--buffer-coming-from (current-buffer)))
(let ((liste (bs-buffer-list))
(active-window (bs--window-for-buffer "*buffer-selection*")))
(if active-window
(select-window active-window)
(if (> (window-height (selected-window)) 7)
(progn
(split-window-vertically)
(other-window 1))))
(modify-frame-parameters nil
(list (cons 'bs--window-config-coming-from
(current-window-configuration))))
(when (> (window-height (selected-window)) 7)
(split-window-vertically)
(other-window 1)))
(bs-show-in-buffer liste)
(bs-message-without-log "%s" (bs--current-config-message)))))