]> git.eshelyaron.com Git - emacs.git/commitdiff
(Buffer-menu-make-sort-button): Add docstrings, use non-anonymous functions.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 6 Sep 2005 20:44:41 +0000 (20:44 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 6 Sep 2005 20:44:41 +0000 (20:44 +0000)
lisp/ChangeLog
lisp/buff-menu.el

index 075bd7b3087418ce85903b71e054fa359e35fe48..2143bc17cf301167cd0c894a6dff6ae08bc3e9b5 100644 (file)
@@ -1,8 +1,12 @@
+2005-09-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * buff-menu.el (Buffer-menu-make-sort-button): Add docstrings, use
+       non-anonymous functions.
+
 2005-09-06  Chong Yidong  <cyd@stupidchicken.com>
 
-       * buff-menu.el (Buffer-menu-make-sort-button): Allow mouse-1
-       clicks when using a header line.  Otherwise, use
-       mouse-1-click-follows-link.
+       * buff-menu.el (Buffer-menu-make-sort-button): Allow mouse-1 clicks
+       when using a header line.  Otherwise, use mouse-1-click-follows-link.
 
        * mouse.el (mouse-drag-header-line): Do nothing if the header-line
        can't be moved; don't signal an error.
@@ -18,8 +22,7 @@
        (custom-push-theme): Save old values in the standard theme.
        (disable-theme): Correct typo.
        (custom-face-theme-value) Deleted unused function.
-       (custom-theme-recalc-face): Rewritten to treat enable/disable
-       properly.
+       (custom-theme-recalc-face): Rewritten to treat enable/disable properly.
 
 2005-09-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index 41bc4bb3335101f69a02acb61a0990c738750a11..18ba3bf25cacac920ec4b42907681fd63e8518b4 100644 (file)
@@ -635,32 +635,35 @@ For more information, see the function `buffer-menu'."
 
 (defun Buffer-menu-make-sort-button (name column)
   (if (equal column Buffer-menu-sort-column) (setq column nil))
-  (propertize name
-             'help-echo (if column
-                            (if Buffer-menu-use-header-line
-                                (concat "mouse-1, mouse-2: sort by "
-                                        (downcase name))
-                              (concat "mouse-2, RET: sort by "
-                                      (downcase name)))
-                          (if Buffer-menu-use-header-line
-                              "mouse-1, mouse-2: sort by visited order"
-                            "mouse-2, RET: sort by visited order"))
-             'mouse-face 'highlight
-             'keymap (let ((map (make-sparse-keymap))
-                           (fun `(lambda (e)
-                                   (interactive "e")
-                                   (if e (mouse-select-window e))
-                                   (Buffer-menu-sort ,column))))
-                       ;; This keymap handles both nil and non-nil
-                       ;; values for Buffer-menu-use-header-line.
-                       (define-key map [header-line mouse-1] fun)
-                       (define-key map [header-line mouse-2] fun)
-                       (define-key map [mouse-2] fun)
-                       (define-key map [follow-link] 'mouse-face)
-                       (define-key map "\C-m"
-                         `(lambda () (interactive)
-                            (Buffer-menu-sort ,column)))
-                       map)))
+  (let* ((downname (downcase name))
+         (map (make-sparse-keymap))
+         (fun `(lambda (&optional e)
+                 ,(concat "Sort the buffer menu by " downname ".")
+                 (interactive (list last-input-event))
+                 (if e (mouse-select-window e))
+                 (Buffer-menu-sort ,column)))
+         (sym (intern (format "Buffer-menu-sort-by-%s-%s" name column))))
+    ;; Use a symbol rather than an anonymous function, to make the output of
+    ;; C-h k less intimidating.
+    (fset sym fun)
+    (setq fun sym)
+    ;; This keymap handles both nil and non-nil
+    ;; values for Buffer-menu-use-header-line.
+    (define-key map [header-line mouse-1] fun)
+    (define-key map [header-line mouse-2] fun)
+    (define-key map [mouse-2] fun)
+    (define-key map [follow-link] 'mouse-face)
+    (define-key map "\C-m" fun)
+    (propertize name
+                'help-echo (concat
+                            (if Buffer-menu-use-header-line
+                                "mouse-1, mouse-2: sort by "
+                              "mouse-2, RET: sort by ")
+                            ;; No clue what this is for, but I preserved the
+                            ;; behavior, just in case.  --Stef
+                            (if column downname "visited order"))
+                'mouse-face 'highlight
+                'keymap map)))
 
 (defun list-buffers-noselect (&optional files-only buffer-list)
   "Create and return a buffer with a list of names of existing buffers.