diff options
| author | Juanma Barranquero | 2006-11-09 16:35:48 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2006-11-09 16:35:48 +0000 |
| commit | ce3ba12c88ef9c0179afee9c1844c25e47088222 (patch) | |
| tree | f04c5ad42544437535e1975ded75aca4ea07625e | |
| parent | 85e58334dcbfb2669bf91be1ad9dba3303e91e8a (diff) | |
| download | emacs-ce3ba12c88ef9c0179afee9c1844c25e47088222.tar.gz emacs-ce3ba12c88ef9c0179afee9c1844c25e47088222.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/bs.el | 43 |
2 files changed, 38 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1aac7cf7e26..e68a6b8a7fe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2006-11-09 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * bs.el (bs--redisplay): Fix typo in docstring. | ||
| 4 | (bs--window-config-coming-from): Make frame-local. | ||
| 5 | (bs--restore-window-config): New function. | ||
| 6 | (bs-kill, bs-select, bs-select-other-window) | ||
| 7 | (bs-select-other-frame): Use it. | ||
| 8 | (bs--window-for-buffer): Return as soon as a matching buffer is found. | ||
| 9 | (bs--show-with-configuration): Save the window configuration as a | ||
| 10 | frame local var, and only if *buffer-selection* is not already | ||
| 11 | visible on this frame. | ||
| 12 | |||
| 1 | 2006-11-08 Chong Yidong <cyd@stupidchicken.com> | 13 | 2006-11-08 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 14 | ||
| 3 | * vc-svn.el (vc-svn-admin-directory): New var. | 15 | * vc-svn.el (vc-svn-admin-directory): New var. |
| @@ -5,7 +17,7 @@ | |||
| 5 | (vc-svn-repository-hostname): Use it. | 17 | (vc-svn-repository-hostname): Use it. |
| 6 | Suggested by arit93@yahoo.com. | 18 | Suggested by arit93@yahoo.com. |
| 7 | 19 | ||
| 8 | 2006-11-09 Juanma Barranquero <lekktu@gmail.com> | 20 | 2006-11-08 Juanma Barranquero <lekktu@gmail.com> |
| 9 | 21 | ||
| 10 | * ldefs-boot.el: Regenerate. | 22 | * ldefs-boot.el: Regenerate. |
| 11 | 23 | ||
diff --git a/lisp/bs.el b/lisp/bs.el index 047996d27c7..cf6ca0c2de3 100644 --- a/lisp/bs.el +++ b/lisp/bs.el | |||
| @@ -446,6 +446,7 @@ defined by current configuration `bs-current-configuration'.") | |||
| 446 | 446 | ||
| 447 | (defvar bs--window-config-coming-from nil | 447 | (defvar bs--window-config-coming-from nil |
| 448 | "Window configuration before starting Buffer Selection Menu.") | 448 | "Window configuration before starting Buffer Selection Menu.") |
| 449 | (make-variable-frame-local 'bs--window-config-coming-from) | ||
| 449 | 450 | ||
| 450 | (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" | 451 | (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" |
| 451 | "Regular expression specifying which buffers never to show. | 452 | "Regular expression specifying which buffers never to show. |
| @@ -584,7 +585,7 @@ a special function. SORT-DESCRIPTION is an element of `bs-sort-functions'." | |||
| 584 | (defun bs--redisplay (&optional keep-line-p sort-description) | 585 | (defun bs--redisplay (&optional keep-line-p sort-description) |
| 585 | "Redisplay whole Buffer Selection Menu. | 586 | "Redisplay whole Buffer Selection Menu. |
| 586 | If KEEP-LINE-P is non-nil the point will stay on current line. | 587 | If KEEP-LINE-P is non-nil the point will stay on current line. |
| 587 | SORT-DESCRIPTION is an element of `bs-sort-functions'" | 588 | SORT-DESCRIPTION is an element of `bs-sort-functions'." |
| 588 | (let ((line (1+ (count-lines 1 (point))))) | 589 | (let ((line (1+ (count-lines 1 (point))))) |
| 589 | (bs-show-in-buffer (bs-buffer-list nil sort-description)) | 590 | (bs-show-in-buffer (bs-buffer-list nil sort-description)) |
| 590 | (if keep-line-p | 591 | (if keep-line-p |
| @@ -661,11 +662,17 @@ to show always. | |||
| 661 | font-lock-verbose nil) | 662 | font-lock-verbose nil) |
| 662 | (run-mode-hooks 'bs-mode-hook)) | 663 | (run-mode-hooks 'bs-mode-hook)) |
| 663 | 664 | ||
| 665 | (defun bs--restore-window-config () | ||
| 666 | "Restore window configuration on the current frame." | ||
| 667 | (when bs--window-config-coming-from | ||
| 668 | (set-window-configuration bs--window-config-coming-from) | ||
| 669 | (setq bs--window-config-coming-from nil))) | ||
| 670 | |||
| 664 | (defun bs-kill () | 671 | (defun bs-kill () |
| 665 | "Let buffer disappear and reset window-configuration." | 672 | "Let buffer disappear and reset window-configuration." |
| 666 | (interactive) | 673 | (interactive) |
| 667 | (bury-buffer (current-buffer)) | 674 | (bury-buffer (current-buffer)) |
| 668 | (set-window-configuration bs--window-config-coming-from)) | 675 | (bs--restore-window-config)) |
| 669 | 676 | ||
| 670 | (defun bs-abort () | 677 | (defun bs-abort () |
| 671 | "Ding and leave Buffer Selection Menu without a selection." | 678 | "Ding and leave Buffer Selection Menu without a selection." |
| @@ -689,12 +696,12 @@ Refresh whole Buffer Selection Menu." | |||
| 689 | "Return a window showing a buffer with name BUFFER-NAME. | 696 | "Return a window showing a buffer with name BUFFER-NAME. |
| 690 | Take only windows of current frame into account. | 697 | Take only windows of current frame into account. |
| 691 | Return nil if there is no such buffer." | 698 | Return nil if there is no such buffer." |
| 692 | (let ((window nil)) | 699 | (catch 'window |
| 693 | (walk-windows (lambda (wind) | 700 | (walk-windows (lambda (w) |
| 694 | (if (string= (buffer-name (window-buffer wind)) | 701 | (when (string= (buffer-name (window-buffer w)) |
| 695 | buffer-name) | 702 | buffer-name) |
| 696 | (setq window wind)))) | 703 | (throw 'window w)))) |
| 697 | window)) | 704 | nil)) |
| 698 | 705 | ||
| 699 | (defun bs--set-window-height () | 706 | (defun bs--set-window-height () |
| 700 | "Change the height of the selected window to suit the current buffer list." | 707 | "Change the height of the selected window to suit the current buffer list." |
| @@ -736,7 +743,7 @@ Leave Buffer Selection Menu." | |||
| 736 | (interactive) | 743 | (interactive) |
| 737 | (let ((buffer (bs--current-buffer))) | 744 | (let ((buffer (bs--current-buffer))) |
| 738 | (bury-buffer (current-buffer)) | 745 | (bury-buffer (current-buffer)) |
| 739 | (set-window-configuration bs--window-config-coming-from) | 746 | (bs--restore-window-config) |
| 740 | (switch-to-buffer buffer) | 747 | (switch-to-buffer buffer) |
| 741 | (if bs--marked-buffers | 748 | (if bs--marked-buffers |
| 742 | ;; Some marked buffers for selection | 749 | ;; Some marked buffers for selection |
| @@ -760,7 +767,7 @@ Leave Buffer Selection Menu." | |||
| 760 | (interactive) | 767 | (interactive) |
| 761 | (let ((buffer (bs--current-buffer))) | 768 | (let ((buffer (bs--current-buffer))) |
| 762 | (bury-buffer (current-buffer)) | 769 | (bury-buffer (current-buffer)) |
| 763 | (set-window-configuration bs--window-config-coming-from) | 770 | (bs--restore-window-config) |
| 764 | (switch-to-buffer-other-window buffer))) | 771 | (switch-to-buffer-other-window buffer))) |
| 765 | 772 | ||
| 766 | (defun bs-tmp-select-other-window () | 773 | (defun bs-tmp-select-other-window () |
| @@ -776,7 +783,7 @@ Leave Buffer Selection Menu." | |||
| 776 | (interactive) | 783 | (interactive) |
| 777 | (let ((buffer (bs--current-buffer))) | 784 | (let ((buffer (bs--current-buffer))) |
| 778 | (bury-buffer (current-buffer)) | 785 | (bury-buffer (current-buffer)) |
| 779 | (set-window-configuration bs--window-config-coming-from) | 786 | (bs--restore-window-config) |
| 780 | (switch-to-buffer-other-frame buffer))) | 787 | (switch-to-buffer-other-frame buffer))) |
| 781 | 788 | ||
| 782 | (defun bs-mouse-select-other-frame (event) | 789 | (defun bs-mouse-select-other-frame (event) |
| @@ -1426,17 +1433,17 @@ for buffer selection." | |||
| 1426 | (unless (string= "*buffer-selection*" (buffer-name)) | 1433 | (unless (string= "*buffer-selection*" (buffer-name)) |
| 1427 | ;; Only when not in buffer *buffer-selection* | 1434 | ;; Only when not in buffer *buffer-selection* |
| 1428 | ;; we have to set the buffer we started the command | 1435 | ;; we have to set the buffer we started the command |
| 1429 | (progn | 1436 | (setq bs--buffer-coming-from (current-buffer))) |
| 1430 | (setq bs--buffer-coming-from (current-buffer)) | ||
| 1431 | (setq bs--window-config-coming-from (current-window-configuration)))) | ||
| 1432 | (let ((liste (bs-buffer-list)) | 1437 | (let ((liste (bs-buffer-list)) |
| 1433 | (active-window (bs--window-for-buffer "*buffer-selection*"))) | 1438 | (active-window (bs--window-for-buffer "*buffer-selection*"))) |
| 1434 | (if active-window | 1439 | (if active-window |
| 1435 | (select-window active-window) | 1440 | (select-window active-window) |
| 1436 | (if (> (window-height (selected-window)) 7) | 1441 | (modify-frame-parameters nil |
| 1437 | (progn | 1442 | (list (cons 'bs--window-config-coming-from |
| 1438 | (split-window-vertically) | 1443 | (current-window-configuration)))) |
| 1439 | (other-window 1)))) | 1444 | (when (> (window-height (selected-window)) 7) |
| 1445 | (split-window-vertically) | ||
| 1446 | (other-window 1))) | ||
| 1440 | (bs-show-in-buffer liste) | 1447 | (bs-show-in-buffer liste) |
| 1441 | (bs-message-without-log "%s" (bs--current-config-message))))) | 1448 | (bs-message-without-log "%s" (bs--current-config-message))))) |
| 1442 | 1449 | ||