1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

(menu-bar-update-buffers): Avoid excessive consing.

This commit is contained in:
Karl Heuer 1994-06-06 05:05:28 +00:00
parent 078b369638
commit 096ec7e78b

View File

@ -258,26 +258,11 @@ A large number or nil slows down menu responsiveness.")
(raise-frame last-command-event)
(select-frame last-command-event))
(defvar menu-bar-update-buffers-last-buffers nil)
(defvar menu-bar-update-buffers-last-frames nil)
(defun menu-bar-update-buffers ()
(if (frame-or-buffer-changed-p)
(let ((buffers (buffer-list))
(frames (frame-list))
buffers-info
buffers-menu frames-menu)
(setq buffers-info
(mapcar (function (lambda (buffer)
(list buffer (buffer-modified-p buffer)
(save-excursion
(set-buffer buffer)
buffer-read-only))))
buffers))
(if (and (equal buffers-info menu-bar-update-buffers-last-buffers)
(equal frames menu-bar-update-buffers-last-frames))
nil
(setq menu-bar-update-buffers-last-buffers buffers-info)
(setq menu-bar-update-buffers-last-frames frames)
;; If requested, list only the N most recently selected buffers.
(if (and (integerp buffers-menu-max-size)
(> buffers-menu-max-size 1))
@ -326,8 +311,8 @@ A large number or nil slows down menu responsiveness.")
(setq alist (nreverse alist))
(nconc (mapcar '(lambda (pair)
;; This is somewhat risque, to use
;; the buffer name itself as the event type
;; to define, but it works.
;; the buffer name itself as the event
;; type to define, but it works.
;; It would not work to use the buffer
;; since a buffer as an event has its
;; own meaning.
@ -336,12 +321,12 @@ A large number or nil slows down menu responsiveness.")
(cons nil nil))
'menu-bar-select-buffer))
alist)
(list (cons 'list-buffers
(list
(cons
(concat (make-string (max (- (/ maxlen
2)
8)
0) ?\ )
'list-buffers
(cons
(concat (make-string (max (- (/ maxlen 2) 8) 0)
?\ )
"List All Buffers")
'list-buffers)))))))