diff options
| author | Richard M. Stallman | 1995-12-26 19:43:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-12-26 19:43:51 +0000 |
| commit | f1107960765a3fca32888ddb1c66d96dfb451d74 (patch) | |
| tree | 611a77e637ceb1e93196f8a35f290e1ef25d8220 | |
| parent | d537086b542573bb6efc5cdd13978b1073fb72f7 (diff) | |
| download | emacs-f1107960765a3fca32888ddb1c66d96dfb451d74.tar.gz emacs-f1107960765a3fca32888ddb1c66d96dfb451d74.zip | |
(mouse-menu-buffer-maxlen): New variable.
(mouse-buffer-menu): Use it.
| -rw-r--r-- | lisp/mouse.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index f465f19fdd6..72e2cda261b 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -1152,6 +1152,11 @@ again. If you do this twice in the same position, it kills the selection." | |||
| 1152 | (overlay-start mouse-secondary-overlay) | 1152 | (overlay-start mouse-secondary-overlay) |
| 1153 | (overlay-end mouse-secondary-overlay))))))) | 1153 | (overlay-end mouse-secondary-overlay))))))) |
| 1154 | 1154 | ||
| 1155 | (defvar mouse-menu-buffer-maxlen 20 | ||
| 1156 | "*Number of buffers in one pane (submenu) of the buffer menu. | ||
| 1157 | If we have lots of buffers, divide them into groups of | ||
| 1158 | `mouse-menu-buffer-maxlen' and make a pane (or submenu) for each one.") | ||
| 1159 | |||
| 1155 | (defun mouse-buffer-menu (event) | 1160 | (defun mouse-buffer-menu (event) |
| 1156 | "Pop up a menu of buffers for selection with the mouse. | 1161 | "Pop up a menu of buffers for selection with the mouse. |
| 1157 | This switches buffers in the window that you clicked on, | 1162 | This switches buffers in the window that you clicked on, |
| @@ -1198,15 +1203,16 @@ and selects that window." | |||
| 1198 | (menu | 1203 | (menu |
| 1199 | ;; If we have lots of buffers, divide them into groups of 20 | 1204 | ;; If we have lots of buffers, divide them into groups of 20 |
| 1200 | ;; and make a pane (or submenu) for each one. | 1205 | ;; and make a pane (or submenu) for each one. |
| 1201 | (if (> (length buffers) 30) | 1206 | (if (> (length buffers) (/ (* mouse-menu-buffer-maxlen 3) 2)) |
| 1202 | (let ((buffers (reverse buffers)) sublists next | 1207 | (let ((buffers (reverse buffers)) sublists next |
| 1203 | (i 1)) | 1208 | (i 1)) |
| 1204 | (while buffers | 1209 | (while buffers |
| 1205 | ;; Pull off the next 20 buffers | 1210 | ;; Pull off the next mouse-menu-buffer-maxlen buffers |
| 1206 | ;; and make them the next element of sublist. | 1211 | ;; and make them the next element of sublist. |
| 1207 | (setq next (nthcdr 20 buffers)) | 1212 | (setq next (nthcdr mouse-menu-buffer-maxlen buffers)) |
| 1208 | (if next | 1213 | (if next |
| 1209 | (setcdr (nthcdr 19 buffers) nil)) | 1214 | (setcdr (nthcdr (1- mouse-menu-buffer-maxlen) buffers) |
| 1215 | nil)) | ||
| 1210 | (setq sublists (cons (cons (format "Buffers %d" i) buffers) | 1216 | (setq sublists (cons (cons (format "Buffers %d" i) buffers) |
| 1211 | sublists)) | 1217 | sublists)) |
| 1212 | (setq i (1+ i)) | 1218 | (setq i (1+ i)) |