comparison lisp/menu-bar.el @ 91073:4bc33ffdda1a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 902-908) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 131-137) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 261-262) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-278
author Miles Bader <miles@gnu.org>
date Sat, 27 Oct 2007 09:12:07 +0000
parents 14c4a6aac623 b210bba3f477
children 53108e6cea98
comparison
equal deleted inserted replaced
91072:74ab3ea909f9 91073:4bc33ffdda1a
54 54
55 (define-key global-map [menu-bar help-menu] (cons "Help" menu-bar-help-menu)) 55 (define-key global-map [menu-bar help-menu] (cons "Help" menu-bar-help-menu))
56 (defvar menu-bar-tools-menu (make-sparse-keymap "Tools")) 56 (defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
57 (define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu)) 57 (define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
58 ;; This definition is just to show what this looks like. 58 ;; This definition is just to show what this looks like.
59 ;; It gets overridden below when menu-bar-update-buffers is called. 59 ;; It gets modified in place when menu-bar-update-buffers is called.
60 (defvar global-buffers-menu-map (make-sparse-keymap "Buffers"))
60 (define-key global-map [menu-bar buffer] 61 (define-key global-map [menu-bar buffer]
61 (cons "Buffers" (make-sparse-keymap "Buffers"))) 62 (cons "Buffers" global-buffers-menu-map))
62 (defvar menu-bar-options-menu (make-sparse-keymap "Options")) 63 (defvar menu-bar-options-menu (make-sparse-keymap "Options"))
63 (define-key global-map [menu-bar options] 64 (define-key global-map [menu-bar options]
64 (cons "Options" menu-bar-options-menu)) 65 (cons "Options" menu-bar-options-menu))
65 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit")) 66 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
66 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu)) 67 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
1574 ;; If user discards the Buffers item, play along. 1575 ;; If user discards the Buffers item, play along.
1575 (and (lookup-key (current-global-map) [menu-bar buffer]) 1576 (and (lookup-key (current-global-map) [menu-bar buffer])
1576 (or force (frame-or-buffer-changed-p)) 1577 (or force (frame-or-buffer-changed-p))
1577 (let ((buffers (buffer-list)) 1578 (let ((buffers (buffer-list))
1578 (frames (frame-list)) 1579 (frames (frame-list))
1579 buffers-menu frames-menu) 1580 buffers-menu)
1580 ;; If requested, list only the N most recently selected buffers. 1581 ;; If requested, list only the N most recently selected buffers.
1581 (if (and (integerp buffers-menu-max-size) 1582 (if (and (integerp buffers-menu-max-size)
1582 (> buffers-menu-max-size 1)) 1583 (> buffers-menu-max-size 1))
1583 (if (> (length buffers) buffers-menu-max-size) 1584 (if (> (length buffers) buffers-menu-max-size)
1584 (setcdr (nthcdr buffers-menu-max-size buffers) nil))) 1585 (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
1675 :help "Pop up a window listing all Emacs buffers" 1676 :help "Pop up a window listing all Emacs buffers"
1676 )))) 1677 ))))
1677 (setq buffers-menu 1678 (setq buffers-menu
1678 (nconc buffers-menu menu-bar-buffers-menu-command-entries)) 1679 (nconc buffers-menu menu-bar-buffers-menu-command-entries))
1679 1680
1680 (setq buffers-menu (cons 'keymap (cons "Select Buffer" buffers-menu))) 1681 ;; We used to "(define-key (current-global-map) [menu-bar buffer]"
1681 (define-key (current-global-map) [menu-bar buffer] 1682 ;; but that did not do the right thing when the [menu-bar buffer]
1682 ;; Call copy-sequence so the string is not pure. 1683 ;; entry above had been moved (e.g. to a parent keymap).
1683 (cons (copy-sequence "Buffers") buffers-menu))))) 1684 (setcdr global-buffers-menu-map (cons "Select Buffer" buffers-menu)))))
1684 1685
1685 (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers) 1686 (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
1686 1687
1687 (menu-bar-update-buffers) 1688 (menu-bar-update-buffers)
1688 1689
1787 1788
1788 (global-set-key [f10] 'menu-bar-open) 1789 (global-set-key [f10] 'menu-bar-open)
1789 1790
1790 (provide 'menu-bar) 1791 (provide 'menu-bar)
1791 1792
1792 ;;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced 1793 ;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced
1793 ;;; menu-bar.el ends here 1794 ;;; menu-bar.el ends here