]> git.eshelyaron.com Git - emacs.git/commitdiff
(buffers-menu-max-size): Move its definition down to
authorJuri Linkov <juri@jurta.org>
Tue, 22 Apr 2008 20:36:08 +0000 (20:36 +0000)
committerJuri Linkov <juri@jurta.org>
Tue, 22 Apr 2008 20:36:08 +0000 (20:36 +0000)
the "Buffers Menu" section.  Change group name `mouse' to `menu'.
(yank-menu-length): Change group name `mouse' to `menu'.
(buffers-menu-buffer-name-length): New user option.
(menu-bar-update-buffers): Use buffers-menu-buffer-name-length
instead of the hard-coded number 27.

lisp/ChangeLog
lisp/menu-bar.el

index 7db5250f09c8d1980de359c83ffc0905deb80ad2..fac09bccdb9a9f682c56a0519ee982f129bc2aee 100644 (file)
@@ -1,3 +1,12 @@
+2008-04-22  Juri Linkov  <juri@jurta.org>
+
+       * menu-bar.el (buffers-menu-max-size): Move its definition down to
+       the "Buffers Menu" section.  Change group name `mouse' to `menu'.
+       (yank-menu-length): Change group name `mouse' to `menu'.
+       (buffers-menu-buffer-name-length): New user option.
+       (menu-bar-update-buffers): Use buffers-menu-buffer-name-length
+       instead of the hard-coded number 27.
+
 2008-04-22  Juri Linkov  <juri@jurta.org>
 
        * isearch.el (eval-when-compile): Require `help-macro'.
index 00f76789b348d4a08b2ac35db6ab4c9453978021..fe15c81c17634e08de703980dc26af1c810b7bad 100644 (file)
 
 ;;; Code:
 
-;;; User options:
-
-(defcustom buffers-menu-max-size 10
-  "*Maximum number of entries which may appear on the Buffers menu.
-If this is 10, then only the ten most-recently-selected buffers are shown.
-If this is nil, then all buffers are shown.
-A large number or nil slows down menu responsiveness."
-  :type '(choice integer
-                (const :tag "All" nil))
-  :group 'mouse)
-
 ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
 ;; definitions made in loaddefs.el.
 (or (lookup-key global-map [menu-bar])
@@ -1482,7 +1471,7 @@ using `abort-recursive-edit'."
 (defcustom yank-menu-length 20
   "*Maximum length to display in the yank-menu."
   :type 'integer
-  :group 'mouse)
+  :group 'menu)
 
 (defun menu-bar-update-yank-menu (string old)
   (let ((front (car (cdr yank-menu)))
@@ -1519,6 +1508,26 @@ The menu shows all the killed text sequences stored in `kill-ring'."
   (insert last-command-event))
 
 \f
+;;; Buffers Menu
+
+(defcustom buffers-menu-max-size 10
+  "*Maximum number of entries which may appear on the Buffers menu.
+If this is 10, then only the ten most-recently-selected buffers are shown.
+If this is nil, then all buffers are shown.
+A large number or nil slows down menu responsiveness."
+  :type '(choice integer
+                (const :tag "All" nil))
+  :group 'menu)
+
+(defcustom buffers-menu-buffer-name-length 30
+  "*Maximum length of the buffer name on the Buffers menu.
+If this is a number, then buffer names are truncated to this length.
+If this is nil, then buffer names are shown in full.
+A large number or nil makes the menu too wide."
+  :type '(choice integer
+                (const :tag "Full length" nil))
+  :group 'menu)
+
 (defcustom buffers-menu-show-directories 'unless-uniquify
   "If non-nil, show directories in the Buffers menu for buffers that have them.
 The special value `unless-uniquify' means that directories will be shown
@@ -1606,11 +1615,16 @@ Buffers menu is regenerated."
                      (unless (eq ?\s (aref name 0))
                        (push (menu-bar-update-buffers-1
                               (cons buf
-                                    (if (> (length name) 27)
-                                        (concat (substring name 0 12)
-                                                "..."
-                                                (substring name -12))
-                                      name)))
+                                   (if (and (integerp buffers-menu-buffer-name-length)
+                                            (> (length name) buffers-menu-buffer-name-length))
+                                       (concat
+                                        (substring
+                                         name 0 (/ buffers-menu-buffer-name-length 2))
+                                        "..."
+                                        (substring
+                                         name (- (/ buffers-menu-buffer-name-length 2))))
+                                     name)
+                                    ))
                              alist))))
                 ;; Now make the actual list of items.
                  (let ((buffers-vec (make-vector (length alist) nil))