diff options
| author | Stefan Monnier | 2005-09-06 20:44:41 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-09-06 20:44:41 +0000 |
| commit | 3076c7266f4464fbc0b3531c0d799369ffcc3b50 (patch) | |
| tree | f5845cb626f3fe4c3db94cb63007498930f75e86 | |
| parent | 4cc1468e0b888d56ea06567493ceed01c554503d (diff) | |
| download | emacs-3076c7266f4464fbc0b3531c0d799369ffcc3b50.tar.gz emacs-3076c7266f4464fbc0b3531c0d799369ffcc3b50.zip | |
(Buffer-menu-make-sort-button): Add docstrings, use non-anonymous functions.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/buff-menu.el | 55 |
2 files changed, 37 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 075bd7b3087..2143bc17cf3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,8 +1,12 @@ | |||
| 1 | 2005-09-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * buff-menu.el (Buffer-menu-make-sort-button): Add docstrings, use | ||
| 4 | non-anonymous functions. | ||
| 5 | |||
| 1 | 2005-09-06 Chong Yidong <cyd@stupidchicken.com> | 6 | 2005-09-06 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * buff-menu.el (Buffer-menu-make-sort-button): Allow mouse-1 | 8 | * buff-menu.el (Buffer-menu-make-sort-button): Allow mouse-1 clicks |
| 4 | clicks when using a header line. Otherwise, use | 9 | when using a header line. Otherwise, use mouse-1-click-follows-link. |
| 5 | mouse-1-click-follows-link. | ||
| 6 | 10 | ||
| 7 | * mouse.el (mouse-drag-header-line): Do nothing if the header-line | 11 | * mouse.el (mouse-drag-header-line): Do nothing if the header-line |
| 8 | can't be moved; don't signal an error. | 12 | can't be moved; don't signal an error. |
| @@ -18,8 +22,7 @@ | |||
| 18 | (custom-push-theme): Save old values in the standard theme. | 22 | (custom-push-theme): Save old values in the standard theme. |
| 19 | (disable-theme): Correct typo. | 23 | (disable-theme): Correct typo. |
| 20 | (custom-face-theme-value) Deleted unused function. | 24 | (custom-face-theme-value) Deleted unused function. |
| 21 | (custom-theme-recalc-face): Rewritten to treat enable/disable | 25 | (custom-theme-recalc-face): Rewritten to treat enable/disable properly. |
| 22 | properly. | ||
| 23 | 26 | ||
| 24 | 2005-09-05 Stefan Monnier <monnier@iro.umontreal.ca> | 27 | 2005-09-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 25 | 28 | ||
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 41bc4bb3335..18ba3bf25ca 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -635,32 +635,35 @@ For more information, see the function `buffer-menu'." | |||
| 635 | 635 | ||
| 636 | (defun Buffer-menu-make-sort-button (name column) | 636 | (defun Buffer-menu-make-sort-button (name column) |
| 637 | (if (equal column Buffer-menu-sort-column) (setq column nil)) | 637 | (if (equal column Buffer-menu-sort-column) (setq column nil)) |
| 638 | (propertize name | 638 | (let* ((downname (downcase name)) |
| 639 | 'help-echo (if column | 639 | (map (make-sparse-keymap)) |
| 640 | (if Buffer-menu-use-header-line | 640 | (fun `(lambda (&optional e) |
| 641 | (concat "mouse-1, mouse-2: sort by " | 641 | ,(concat "Sort the buffer menu by " downname ".") |
| 642 | (downcase name)) | 642 | (interactive (list last-input-event)) |
| 643 | (concat "mouse-2, RET: sort by " | 643 | (if e (mouse-select-window e)) |
| 644 | (downcase name))) | 644 | (Buffer-menu-sort ,column))) |
| 645 | (if Buffer-menu-use-header-line | 645 | (sym (intern (format "Buffer-menu-sort-by-%s-%s" name column)))) |
| 646 | "mouse-1, mouse-2: sort by visited order" | 646 | ;; Use a symbol rather than an anonymous function, to make the output of |
| 647 | "mouse-2, RET: sort by visited order")) | 647 | ;; C-h k less intimidating. |
| 648 | 'mouse-face 'highlight | 648 | (fset sym fun) |
| 649 | 'keymap (let ((map (make-sparse-keymap)) | 649 | (setq fun sym) |
| 650 | (fun `(lambda (e) | 650 | ;; This keymap handles both nil and non-nil |
| 651 | (interactive "e") | 651 | ;; values for Buffer-menu-use-header-line. |
| 652 | (if e (mouse-select-window e)) | 652 | (define-key map [header-line mouse-1] fun) |
| 653 | (Buffer-menu-sort ,column)))) | 653 | (define-key map [header-line mouse-2] fun) |
| 654 | ;; This keymap handles both nil and non-nil | 654 | (define-key map [mouse-2] fun) |
| 655 | ;; values for Buffer-menu-use-header-line. | 655 | (define-key map [follow-link] 'mouse-face) |
| 656 | (define-key map [header-line mouse-1] fun) | 656 | (define-key map "\C-m" fun) |
| 657 | (define-key map [header-line mouse-2] fun) | 657 | (propertize name |
| 658 | (define-key map [mouse-2] fun) | 658 | 'help-echo (concat |
| 659 | (define-key map [follow-link] 'mouse-face) | 659 | (if Buffer-menu-use-header-line |
| 660 | (define-key map "\C-m" | 660 | "mouse-1, mouse-2: sort by " |
| 661 | `(lambda () (interactive) | 661 | "mouse-2, RET: sort by ") |
| 662 | (Buffer-menu-sort ,column))) | 662 | ;; No clue what this is for, but I preserved the |
| 663 | map))) | 663 | ;; behavior, just in case. --Stef |
| 664 | (if column downname "visited order")) | ||
| 665 | 'mouse-face 'highlight | ||
| 666 | 'keymap map))) | ||
| 664 | 667 | ||
| 665 | (defun list-buffers-noselect (&optional files-only buffer-list) | 668 | (defun list-buffers-noselect (&optional files-only buffer-list) |
| 666 | "Create and return a buffer with a list of names of existing buffers. | 669 | "Create and return a buffer with a list of names of existing buffers. |