Move keymap initialization into declaration.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 10 Feb 2011 16:56:00 +0000 (11:56 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 10 Feb 2011 16:56:00 +0000 (11:56 -0500)
* lisp/textmodes/enriched.el (enriched-mode-map):
* lisp/textmodes/bib-mode.el (bib-mode-map):
* lisp/term/lk201.el (lk201-function-map):
* lisp/tar-mode.el (tar-mode-map):
* lisp/replace.el (occur-mode-map):
* lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map):
* lisp/progmodes/idlw-help.el (idlwave-help-mode-map):
* lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu):
* lisp/play/solitaire.el (solitaire-mode-map):
* lisp/play/snake.el (snake-mode-map, snake-null-map):
* lisp/play/pong.el (pong-mode-map):
* lisp/play/handwrite.el (menu-bar-handwrite-map):
* lisp/play/gametree.el (gametree-mode-map):
* lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map
(rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map):
* lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map)
(newsticker--url-keymap):
* lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map):
* lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu)
(menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu)
(menu-bar-edit-menu, menu-bar-custom-menu)
(menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu)
(menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu)
(menu-bar-line-wrapping-menu, menu-bar-options-menu)
(menu-bar-games-menu, menu-bar-encryption-decryption-menu)
(menu-bar-tools-menu, menu-bar-describe-menu)
(menu-bar-search-documentation-menu, menu-bar-manuals-menu)
(menu-bar-help-menu):
* lisp/mail/rmailsum.el (rmail-summary-mode-map):
* lisp/kmacro.el (kmacro-step-edit-map):
* lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map)
(ibuffer-mode-operate-map):
* lisp/hi-lock.el (hi-lock-menu, hi-lock-map):
* lisp/emulation/vip.el (vip-mode-map):
* lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map):
* lisp/bookmark.el (bookmark-bmenu-mode-map):
* lisp/help-mode.el (help-mode-map):
* lisp/erc/erc-list.el (erc-list-menu-mode-map):
* lisp/org/org-remember.el (org-remember-mode-map):
* lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.

32 files changed:
lisp/ChangeLog
lisp/bookmark.el
lisp/emacs-lisp/re-builder.el
lisp/emulation/vip.el
lisp/erc/ChangeLog
lisp/erc/erc-list.el
lisp/help-mode.el
lisp/hi-lock.el
lisp/ibuffer.el
lisp/kmacro.el
lisp/mail/rmail.el
lisp/mail/rmailsum.el
lisp/menu-bar.el
lisp/net/net-utils.el
lisp/net/newst-plainview.el
lisp/net/rcirc.el
lisp/org/ChangeLog
lisp/org/org-remember.el
lisp/org/org-src.el
lisp/play/gametree.el
lisp/play/handwrite.el
lisp/play/pong.el
lisp/play/snake.el
lisp/play/solitaire.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/idlw-help.el
lisp/progmodes/idlwave.el
lisp/replace.el
lisp/tar-mode.el
lisp/term/lk201.el
lisp/textmodes/bib-mode.el
lisp/textmodes/enriched.el

index e9e7f62..c942f9c 100644 (file)
@@ -1,3 +1,44 @@
+2011-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Move keymap initialization into declaration.
+       * textmodes/enriched.el (enriched-mode-map):
+       * textmodes/bib-mode.el (bib-mode-map):
+       * term/lk201.el (lk201-function-map):
+       * tar-mode.el (tar-mode-map):
+       * replace.el (occur-mode-map):
+       * progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map):
+       * progmodes/idlw-help.el (idlwave-help-mode-map):
+       * progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu):
+       * play/solitaire.el (solitaire-mode-map):
+       * play/snake.el (snake-mode-map, snake-null-map):
+       * play/pong.el (pong-mode-map):
+       * play/handwrite.el (menu-bar-handwrite-map):
+       * play/gametree.el (gametree-mode-map):
+       * net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map
+       (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map):
+       * net/newst-plainview.el (newsticker-menu, newsticker-mode-map)
+       (newsticker--url-keymap):
+       * net/net-utils.el (nslookup-mode-map, ftp-mode-map):
+       * menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu)
+       (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu)
+       (menu-bar-edit-menu, menu-bar-custom-menu)
+       (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu)
+       (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu)
+       (menu-bar-line-wrapping-menu, menu-bar-options-menu)
+       (menu-bar-games-menu, menu-bar-encryption-decryption-menu)
+       (menu-bar-tools-menu, menu-bar-describe-menu)
+       (menu-bar-search-documentation-menu, menu-bar-manuals-menu)
+       (menu-bar-help-menu):
+       * mail/rmailsum.el (rmail-summary-mode-map):
+       * kmacro.el (kmacro-step-edit-map):
+       * ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map)
+       (ibuffer-mode-operate-map):
+       * hi-lock.el (hi-lock-menu, hi-lock-map):
+       * emulation/vip.el (vip-mode-map):
+       * emacs-lisp/re-builder.el (reb-lisp-mode-map):
+       * bookmark.el (bookmark-bmenu-mode-map):
+       * help-mode.el (help-mode-map): Move initialization into declaration.
+
 2011-02-10  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
 
        * net/rcirc.el: Add PRIVMSG and CTCP functions.
 
 2011-02-07  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/dbus.el (dbus-list-activatable-names): Add optional argument
-       BUS.
+       * net/dbus.el (dbus-list-activatable-names): Add optional argument BUS.
 
 2011-02-07  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
 
 
 2011-02-06  Jay Belanger  <jay.p.belanger@gmail.com>
 
-       * calc/calc.el (calc-logunits-field-reference) Renamed from
+       * calc/calc.el (calc-logunits-field-reference): Rename from
        `calc-default-field-reference-level'.
-       (calc-logunits-power-reference): Renamed from
+       (calc-logunits-power-reference): Rename from
        `calc-default-power-reference-level'
 
-       * calc/calc-units.el (math-logunits-quant):  Renamed from
+       * calc/calc-units.el (math-logunits-quant): Rename from
        `math-logunits-level'
-       (math-logunits-plus):  Renamed from math-logcombine.
+       (math-logunits-plus): Rename from math-logcombine.
        (calcFunc-luplus, calcFunc-luminus calc-luplus, calc-luminus): Remove.
        (calcFunc-lufieldadd, calcFunc-lupoweradd, calcFunc-lufieldsub)
        (calcFunc-lufieldsub,calc-logunits-add calc-logunits-sub):
        New functions.
-       (calcFunc-fieldquant): Renamed from `calcFunc-fieldlevel'.
-       (calcFunc-powerquant): Renamed from `calcFunc-powerlevel'.
-       (calc-logunits-quantity): Renamed from `calc-level'.
+       (calcFunc-fieldquant): Rename from `calcFunc-fieldlevel'.
+       (calcFunc-powerquant): Rename from `calcFunc-powerlevel'.
+       (calc-logunits-quantity): Rename from `calc-level'.
        (calcFunc-dbfieldlevel, calcFunc-dbpowerlevel, calcFunc-npfieldlevel)
        (calcFunc-nppowerlevel,calc-logunits-dblevel, calc-logunits-nplevel)
        (math-logunits-mul, calcFunc-lufieldmul, calcFunc-lupowermul)
        (calcFunc-lupowerdiv,calc-logunits-divide,math-logunits-level):
        New functions.
 
-       * calc/calc-help.el (calc-u-prefix-help): Removed "L" reference.
+       * calc/calc-help.el (calc-u-prefix-help): Remove "L" reference.
        (calc-ul-prefix-help): Remove.
        (calc-l-prefix-help): New function.
        (calc-full-help): Add reference to `calc-l-prefix-help'.
index 503264f..cd946e4 100644 (file)
@@ -1473,6 +1473,43 @@ method buffers use to resolve name collisions."
 (defvar bookmark-bmenu-hidden-bookmarks ())
 
 
+(defvar bookmark-bmenu-mode-map
+  (let ((map (make-keymap)))
+    (set-keymap-parent map special-mode-map)
+    (define-key map "v" 'bookmark-bmenu-select)
+    (define-key map "w" 'bookmark-bmenu-locate)
+    (define-key map "2" 'bookmark-bmenu-2-window)
+    (define-key map "1" 'bookmark-bmenu-1-window)
+    (define-key map "j" 'bookmark-bmenu-this-window)
+    (define-key map "\C-c\C-c" 'bookmark-bmenu-this-window)
+    (define-key map "f" 'bookmark-bmenu-this-window)
+    (define-key map "\C-m" 'bookmark-bmenu-this-window)
+    (define-key map "o" 'bookmark-bmenu-other-window)
+    (define-key map "\C-o" 'bookmark-bmenu-switch-other-window)
+    (define-key map "s" 'bookmark-bmenu-save)
+    (define-key map "k" 'bookmark-bmenu-delete)
+    (define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
+    (define-key map "x" 'bookmark-bmenu-execute-deletions)
+    (define-key map "d" 'bookmark-bmenu-delete)
+    (define-key map " " 'next-line)
+    (define-key map "n" 'next-line)
+    (define-key map "p" 'previous-line)
+    (define-key map "\177" 'bookmark-bmenu-backup-unmark)
+    (define-key map "u" 'bookmark-bmenu-unmark)
+    (define-key map "m" 'bookmark-bmenu-mark)
+    (define-key map "l" 'bookmark-bmenu-load)
+    (define-key map "r" 'bookmark-bmenu-rename)
+    (define-key map "R" 'bookmark-bmenu-relocate)
+    (define-key map "t" 'bookmark-bmenu-toggle-filenames)
+    (define-key map "a" 'bookmark-bmenu-show-annotation)
+    (define-key map "A" 'bookmark-bmenu-show-all-annotations)
+    (define-key map "e" 'bookmark-bmenu-edit-annotation)
+    ;; The original binding of M-g hides the M-g prefix map.
+    ;; If someone has a better idea than M-g s, I'm open to suggestions.
+    (define-key map [?\M-g ?s] 'bookmark-bmenu-search)
+    (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse)
+    map))
+
 ;; Bookmark Buffer Menu mode is suitable only for specially formatted
 ;; data.
 (put 'bookmark-bmenu-mode 'mode-class 'special)
@@ -1583,39 +1620,6 @@ Bookmark names preceded by a \"*\" have annotations.
   (setq truncate-lines t)
   (setq buffer-read-only t))
 
-(define-key bookmark-bmenu-mode-map "q" 'quit-window)
-(define-key bookmark-bmenu-mode-map "v" 'bookmark-bmenu-select)
-(define-key bookmark-bmenu-mode-map "w" 'bookmark-bmenu-locate)
-(define-key bookmark-bmenu-mode-map "2" 'bookmark-bmenu-2-window)
-(define-key bookmark-bmenu-mode-map "1" 'bookmark-bmenu-1-window)
-(define-key bookmark-bmenu-mode-map "j" 'bookmark-bmenu-this-window)
-(define-key bookmark-bmenu-mode-map "\C-c\C-c" 'bookmark-bmenu-this-window)
-(define-key bookmark-bmenu-mode-map "f" 'bookmark-bmenu-this-window)
-(define-key bookmark-bmenu-mode-map "\C-m" 'bookmark-bmenu-this-window)
-(define-key bookmark-bmenu-mode-map "o" 'bookmark-bmenu-other-window)
-(define-key bookmark-bmenu-mode-map "\C-o" 'bookmark-bmenu-switch-other-window)
-(define-key bookmark-bmenu-mode-map "s" 'bookmark-bmenu-save)
-(define-key bookmark-bmenu-mode-map "k" 'bookmark-bmenu-delete)
-(define-key bookmark-bmenu-mode-map "\C-d" 'bookmark-bmenu-delete-backwards)
-(define-key bookmark-bmenu-mode-map "x" 'bookmark-bmenu-execute-deletions)
-(define-key bookmark-bmenu-mode-map "d" 'bookmark-bmenu-delete)
-(define-key bookmark-bmenu-mode-map " " 'next-line)
-(define-key bookmark-bmenu-mode-map "n" 'next-line)
-(define-key bookmark-bmenu-mode-map "p" 'previous-line)
-(define-key bookmark-bmenu-mode-map "\177" 'bookmark-bmenu-backup-unmark)
-(define-key bookmark-bmenu-mode-map "?" 'describe-mode)
-(define-key bookmark-bmenu-mode-map "u" 'bookmark-bmenu-unmark)
-(define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark)
-(define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load)
-(define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename)
-(define-key bookmark-bmenu-mode-map "R" 'bookmark-bmenu-relocate)
-(define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames)
-(define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation)
-(define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations)
-(define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation)
-;; The original binding of M-g hides the M-g prefix map.
-;; If someone has a better idea than M-g s, I'm open to suggestions.
-(define-key bookmark-bmenu-mode-map [?\M-g ?s] 'bookmark-bmenu-search)(define-key bookmark-bmenu-mode-map [mouse-2] 'bookmark-bmenu-other-window-with-mouse)
 
 (defun bookmark-bmenu-toggle-filenames (&optional show)
   "Toggle whether filenames are shown in the bookmark list.
index e3c030b..59a30d6 100644 (file)
@@ -275,6 +275,13 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
   (set (make-local-variable 'blink-matching-paren) nil)
   (reb-mode-common))
 
+(defvar reb-lisp-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from
+    ;; `emacs-lisp-mode'
+    (define-key map "\C-c" (lookup-key reb-mode-map "\C-c"))
+    map))
+
 (define-derived-mode reb-lisp-mode
   emacs-lisp-mode "RE Builder Lisp"
   "Major mode for interactively building symbolic Regular Expressions."
@@ -283,11 +290,6 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
         (require 'rx)))                   ; require rx anyway
   (reb-mode-common))
 
-;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from
-;; `emacs-lisp-mode'
-(define-key reb-lisp-mode-map "\C-c"
-  (lookup-key reb-mode-map "\C-c"))
-
 (defvar reb-subexp-mode-map
   (let ((m (make-keymap)))
     (suppress-keymap m)
index 328fbac..6f4f0ce 100644 (file)
@@ -164,132 +164,133 @@ If nil then it is bound to `delete-backward-char'."
 \f
 ;; key bindings
 
-(defvar vip-mode-map (make-keymap))
-
-(define-key vip-mode-map "\C-a" 'beginning-of-line)
-(define-key vip-mode-map "\C-b" 'vip-scroll-back)
-(define-key vip-mode-map "\C-c" 'vip-ctl-c)
-(define-key vip-mode-map "\C-d" 'vip-scroll-up)
-(define-key vip-mode-map "\C-e" 'vip-scroll-up-one)
-(define-key vip-mode-map "\C-f" 'vip-scroll)
-(define-key vip-mode-map "\C-g" 'vip-keyboard-quit)
-(define-key vip-mode-map "\C-h" 'help-command)
-(define-key vip-mode-map "\C-m" 'vip-scroll-back)
-(define-key vip-mode-map "\C-n" 'vip-other-window)
-(define-key vip-mode-map "\C-o" 'vip-open-line-at-point)
-(define-key vip-mode-map "\C-u" 'vip-scroll-down)
-(define-key vip-mode-map "\C-x" 'vip-ctl-x)
-(define-key vip-mode-map "\C-y" 'vip-scroll-down-one)
-(define-key vip-mode-map "\C-z" 'vip-change-mode-to-emacs)
-(define-key vip-mode-map "\e" 'vip-ESC)
-
-(define-key vip-mode-map " " 'vip-scroll)
-(define-key vip-mode-map "!" 'vip-command-argument)
-(define-key vip-mode-map "\"" 'vip-command-argument)
-(define-key vip-mode-map "#" 'vip-command-argument)
-(define-key vip-mode-map "$" 'vip-goto-eol)
-(define-key vip-mode-map "%" 'vip-paren-match)
-(define-key vip-mode-map "&" 'vip-nil)
-(define-key vip-mode-map "'" 'vip-goto-mark-and-skip-white)
-(define-key vip-mode-map "(" 'vip-backward-sentence)
-(define-key vip-mode-map ")" 'vip-forward-sentence)
-(define-key vip-mode-map "*" 'call-last-kbd-macro)
-(define-key vip-mode-map "+" 'vip-next-line-at-bol)
-(define-key vip-mode-map "," 'vip-repeat-find-opposite)
-(define-key vip-mode-map "-" 'vip-previous-line-at-bol)
-(define-key vip-mode-map "." 'vip-repeat)
-(define-key vip-mode-map "/" 'vip-search-forward)
-
-(define-key vip-mode-map "0" 'vip-beginning-of-line)
-(define-key vip-mode-map "1" 'vip-digit-argument)
-(define-key vip-mode-map "2" 'vip-digit-argument)
-(define-key vip-mode-map "3" 'vip-digit-argument)
-(define-key vip-mode-map "4" 'vip-digit-argument)
-(define-key vip-mode-map "5" 'vip-digit-argument)
-(define-key vip-mode-map "6" 'vip-digit-argument)
-(define-key vip-mode-map "7" 'vip-digit-argument)
-(define-key vip-mode-map "8" 'vip-digit-argument)
-(define-key vip-mode-map "9" 'vip-digit-argument)
-
-(define-key vip-mode-map ":" 'vip-ex)
-(define-key vip-mode-map ";" 'vip-repeat-find)
-(define-key vip-mode-map "<" 'vip-command-argument)
-(define-key vip-mode-map "=" 'vip-command-argument)
-(define-key vip-mode-map ">" 'vip-command-argument)
-(define-key vip-mode-map "?" 'vip-search-backward)
-(define-key vip-mode-map "@" 'vip-nil)
-
-(define-key vip-mode-map "A" 'vip-Append)
-(define-key vip-mode-map "B" 'vip-backward-Word)
-(define-key vip-mode-map "C" 'vip-ctl-c-equivalent)
-(define-key vip-mode-map "D" 'vip-kill-line)
-(define-key vip-mode-map "E" 'vip-end-of-Word)
-(define-key vip-mode-map "F" 'vip-find-char-backward)
-(define-key vip-mode-map "G" 'vip-goto-line)
-(define-key vip-mode-map "H" 'vip-window-top)
-(define-key vip-mode-map "I" 'vip-Insert)
-(define-key vip-mode-map "J" 'vip-join-lines)
-(define-key vip-mode-map "K" 'vip-kill-buffer)
-(define-key vip-mode-map "L" 'vip-window-bottom)
-(define-key vip-mode-map "M" 'vip-window-middle)
-(define-key vip-mode-map "N" 'vip-search-Next)
-(define-key vip-mode-map "O" 'vip-Open-line)
-(define-key vip-mode-map "P" 'vip-Put-back)
-(define-key vip-mode-map "Q" 'vip-query-replace)
-(define-key vip-mode-map "R" 'vip-replace-string)
-(define-key vip-mode-map "S" 'vip-switch-to-buffer-other-window)
-(define-key vip-mode-map "T" 'vip-goto-char-backward)
-(define-key vip-mode-map "U" 'vip-nil)
-(define-key vip-mode-map "V" 'vip-find-file-other-window)
-(define-key vip-mode-map "W" 'vip-forward-Word)
-(define-key vip-mode-map "X" 'vip-ctl-x-equivalent)
-(define-key vip-mode-map "Y" 'vip-yank-line)
-(define-key vip-mode-map "ZZ" 'save-buffers-kill-emacs)
-
-(define-key vip-mode-map "[" 'vip-nil)
-(define-key vip-mode-map "\\" 'vip-escape-to-emacs)
-(define-key vip-mode-map "]" 'vip-nil)
-(define-key vip-mode-map "^" 'vip-bol-and-skip-white)
-(define-key vip-mode-map "_" 'vip-nil)
-(define-key vip-mode-map "`" 'vip-goto-mark)
-
-(define-key vip-mode-map "a" 'vip-append)
-(define-key vip-mode-map "b" 'vip-backward-word)
-(define-key vip-mode-map "c" 'vip-command-argument)
-(define-key vip-mode-map "d" 'vip-command-argument)
-(define-key vip-mode-map "e" 'vip-end-of-word)
-(define-key vip-mode-map "f" 'vip-find-char-forward)
-(define-key vip-mode-map "g" 'vip-info-on-file)
-(define-key vip-mode-map "h" 'vip-backward-char)
-(define-key vip-mode-map "i" 'vip-insert)
-(define-key vip-mode-map "j" 'vip-next-line)
-(define-key vip-mode-map "k" 'vip-previous-line)
-(define-key vip-mode-map "l" 'vip-forward-char)
-(define-key vip-mode-map "m" 'vip-mark-point)
-(define-key vip-mode-map "n" 'vip-search-next)
-(define-key vip-mode-map "o" 'vip-open-line)
-(define-key vip-mode-map "p" 'vip-put-back)
-(define-key vip-mode-map "q" 'vip-nil)
-(define-key vip-mode-map "r" 'vip-replace-char)
-(define-key vip-mode-map "s" 'vip-switch-to-buffer)
-(define-key vip-mode-map "t" 'vip-goto-char-forward)
-(define-key vip-mode-map "u" 'vip-undo)
-(define-key vip-mode-map "v" 'vip-find-file)
-(define-key vip-mode-map "w" 'vip-forward-word)
-(define-key vip-mode-map "x" 'vip-delete-char)
-(define-key vip-mode-map "y" 'vip-command-argument)
-(define-key vip-mode-map "zH" 'vip-line-to-top)
-(define-key vip-mode-map "zM" 'vip-line-to-middle)
-(define-key vip-mode-map "zL" 'vip-line-to-bottom)
-(define-key vip-mode-map "z\C-m" 'vip-line-to-top)
-(define-key vip-mode-map "z." 'vip-line-to-middle)
-(define-key vip-mode-map "z-" 'vip-line-to-bottom)
-
-(define-key vip-mode-map "{" 'vip-backward-paragraph)
-(define-key vip-mode-map "|" 'vip-goto-col)
-(define-key vip-mode-map "}" 'vip-forward-paragraph)
-(define-key vip-mode-map "~" 'vip-nil)
-(define-key vip-mode-map "\177" 'vip-delete-backward-char)
+(defvar vip-mode-map
+  (let ((map (make-keymap)))
+    (define-key map "\C-a" 'beginning-of-line)
+    (define-key map "\C-b" 'vip-scroll-back)
+    (define-key map "\C-c" 'vip-ctl-c)
+    (define-key map "\C-d" 'vip-scroll-up)
+    (define-key map "\C-e" 'vip-scroll-up-one)
+    (define-key map "\C-f" 'vip-scroll)
+    (define-key map "\C-g" 'vip-keyboard-quit)
+    (define-key map "\C-h" 'help-command)
+    (define-key map "\C-m" 'vip-scroll-back)
+    (define-key map "\C-n" 'vip-other-window)
+    (define-key map "\C-o" 'vip-open-line-at-point)
+    (define-key map "\C-u" 'vip-scroll-down)
+    (define-key map "\C-x" 'vip-ctl-x)
+    (define-key map "\C-y" 'vip-scroll-down-one)
+    (define-key map "\C-z" 'vip-change-mode-to-emacs)
+    (define-key map "\e" 'vip-ESC)
+
+    (define-key map " " 'vip-scroll)
+    (define-key map "!" 'vip-command-argument)
+    (define-key map "\"" 'vip-command-argument)
+    (define-key map "#" 'vip-command-argument)
+    (define-key map "$" 'vip-goto-eol)
+    (define-key map "%" 'vip-paren-match)
+    (define-key map "&" 'vip-nil)
+    (define-key map "'" 'vip-goto-mark-and-skip-white)
+    (define-key map "(" 'vip-backward-sentence)
+    (define-key map ")" 'vip-forward-sentence)
+    (define-key map "*" 'call-last-kbd-macro)
+    (define-key map "+" 'vip-next-line-at-bol)
+    (define-key map "," 'vip-repeat-find-opposite)
+    (define-key map "-" 'vip-previous-line-at-bol)
+    (define-key map "." 'vip-repeat)
+    (define-key map "/" 'vip-search-forward)
+
+    (define-key map "0" 'vip-beginning-of-line)
+    (define-key map "1" 'vip-digit-argument)
+    (define-key map "2" 'vip-digit-argument)
+    (define-key map "3" 'vip-digit-argument)
+    (define-key map "4" 'vip-digit-argument)
+    (define-key map "5" 'vip-digit-argument)
+    (define-key map "6" 'vip-digit-argument)
+    (define-key map "7" 'vip-digit-argument)
+    (define-key map "8" 'vip-digit-argument)
+    (define-key map "9" 'vip-digit-argument)
+
+    (define-key map ":" 'vip-ex)
+    (define-key map ";" 'vip-repeat-find)
+    (define-key map "<" 'vip-command-argument)
+    (define-key map "=" 'vip-command-argument)
+    (define-key map ">" 'vip-command-argument)
+    (define-key map "?" 'vip-search-backward)
+    (define-key map "@" 'vip-nil)
+
+    (define-key map "A" 'vip-Append)
+    (define-key map "B" 'vip-backward-Word)
+    (define-key map "C" 'vip-ctl-c-equivalent)
+    (define-key map "D" 'vip-kill-line)
+    (define-key map "E" 'vip-end-of-Word)
+    (define-key map "F" 'vip-find-char-backward)
+    (define-key map "G" 'vip-goto-line)
+    (define-key map "H" 'vip-window-top)
+    (define-key map "I" 'vip-Insert)
+    (define-key map "J" 'vip-join-lines)
+    (define-key map "K" 'vip-kill-buffer)
+    (define-key map "L" 'vip-window-bottom)
+    (define-key map "M" 'vip-window-middle)
+    (define-key map "N" 'vip-search-Next)
+    (define-key map "O" 'vip-Open-line)
+    (define-key map "P" 'vip-Put-back)
+    (define-key map "Q" 'vip-query-replace)
+    (define-key map "R" 'vip-replace-string)
+    (define-key map "S" 'vip-switch-to-buffer-other-window)
+    (define-key map "T" 'vip-goto-char-backward)
+    (define-key map "U" 'vip-nil)
+    (define-key map "V" 'vip-find-file-other-window)
+    (define-key map "W" 'vip-forward-Word)
+    (define-key map "X" 'vip-ctl-x-equivalent)
+    (define-key map "Y" 'vip-yank-line)
+    (define-key map "ZZ" 'save-buffers-kill-emacs)
+
+    (define-key map "[" 'vip-nil)
+    (define-key map "\\" 'vip-escape-to-emacs)
+    (define-key map "]" 'vip-nil)
+    (define-key map "^" 'vip-bol-and-skip-white)
+    (define-key map "_" 'vip-nil)
+    (define-key map "`" 'vip-goto-mark)
+
+    (define-key map "a" 'vip-append)
+    (define-key map "b" 'vip-backward-word)
+    (define-key map "c" 'vip-command-argument)
+    (define-key map "d" 'vip-command-argument)
+    (define-key map "e" 'vip-end-of-word)
+    (define-key map "f" 'vip-find-char-forward)
+    (define-key map "g" 'vip-info-on-file)
+    (define-key map "h" 'vip-backward-char)
+    (define-key map "i" 'vip-insert)
+    (define-key map "j" 'vip-next-line)
+    (define-key map "k" 'vip-previous-line)
+    (define-key map "l" 'vip-forward-char)
+    (define-key map "m" 'vip-mark-point)
+    (define-key map "n" 'vip-search-next)
+    (define-key map "o" 'vip-open-line)
+    (define-key map "p" 'vip-put-back)
+    (define-key map "q" 'vip-nil)
+    (define-key map "r" 'vip-replace-char)
+    (define-key map "s" 'vip-switch-to-buffer)
+    (define-key map "t" 'vip-goto-char-forward)
+    (define-key map "u" 'vip-undo)
+    (define-key map "v" 'vip-find-file)
+    (define-key map "w" 'vip-forward-word)
+    (define-key map "x" 'vip-delete-char)
+    (define-key map "y" 'vip-command-argument)
+    (define-key map "zH" 'vip-line-to-top)
+    (define-key map "zM" 'vip-line-to-middle)
+    (define-key map "zL" 'vip-line-to-bottom)
+    (define-key map "z\C-m" 'vip-line-to-top)
+    (define-key map "z." 'vip-line-to-middle)
+    (define-key map "z-" 'vip-line-to-bottom)
+
+    (define-key map "{" 'vip-backward-paragraph)
+    (define-key map "|" 'vip-goto-col)
+    (define-key map "}" 'vip-forward-paragraph)
+    (define-key map "~" 'vip-nil)
+    (define-key map "\177" 'vip-delete-backward-char)
+    map))
 
 (defun vip-version ()
   (interactive)
index b7cf79c..2996fee 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * erc-list.el (erc-list-menu-mode-map): Move initialization
+       into declaration.
+
 2011-02-07  Julien Danjou  <julien@danjou.info>
 
        * erc-track.el (erc-window-configuration-change): New function.
index ae579db..b8eb5a4 100644 (file)
          (sort-fields col (point-min) (point-max))
        (sort-numeric-fields col (point-min) (point-max))))))
 
+(defvar erc-list-menu-mode-map
+  (let ((map (make-keymap)))
+    (set-keymap-parent map special-mode-map)
+    (define-key map "k" 'erc-list-kill)
+    (define-key map "j" 'erc-list-join)
+    (define-key map "g" 'erc-list-revert)
+    (define-key map "n" 'next-line)
+    (define-key map "p" 'previous-line)
+    map)
+  "Local keymap for `erc-list-mode' buffers.")
+
 (defvar erc-list-menu-sort-button-map
   (let ((map (make-sparse-keymap)))
     (define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column)
 
 (put 'erc-list-menu-mode 'mode-class 'special)
 
-(define-key erc-list-menu-mode-map "k" 'erc-list-kill)
-(define-key erc-list-menu-mode-map "j" 'erc-list-join)
-(define-key erc-list-menu-mode-map "g" 'erc-list-revert)
-(define-key erc-list-menu-mode-map "n" 'next-line)
-(define-key erc-list-menu-mode-map "p" 'previous-line)
-
 ;; Handle a "322" response.  This response tells us about a single
 ;; channel.
 (defun erc-list-handle-322 (proc parsed)
index 826145d..724b018 100644 (file)
 (require 'view)
 (eval-when-compile (require 'easymenu))
 
-(defvar help-mode-map (make-sparse-keymap)
+(defvar help-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map button-buffer-map)
+
+    (define-key map [mouse-2] 'help-follow-mouse)
+    (define-key map "\C-c\C-b" 'help-go-back)
+    (define-key map "\C-c\C-f" 'help-go-forward)
+    (define-key map "\C-c\C-c" 'help-follow-symbol)
+    ;; Documentation only, since we use minor-mode-overriding-map-alist.
+    (define-key map "\r" 'help-follow)
+    map)
   "Keymap for help mode.")
 
-(set-keymap-parent help-mode-map button-buffer-map)
-
-(define-key help-mode-map [mouse-2] 'help-follow-mouse)
-(define-key help-mode-map "\C-c\C-b" 'help-go-back)
-(define-key help-mode-map "\C-c\C-f" 'help-go-forward)
-(define-key help-mode-map "\C-c\C-c" 'help-follow-symbol)
-;; Documentation only, since we use minor-mode-overriding-map-alist.
-(define-key help-mode-map "\r" 'help-follow)
-
 (easy-menu-define help-mode-menu help-mode-map
   "Menu for Help Mode."
   '("Help-Mode"
index d97e6cf..a0b5844 100644 (file)
@@ -238,45 +238,47 @@ a library is being loaded.")
 (make-variable-buffer-local 'hi-lock-file-patterns)
 (put 'hi-lock-file-patterns 'permanent-local t)
 
-(defvar hi-lock-menu (make-sparse-keymap "Hi Lock")
+(defvar hi-lock-menu
+  (let ((map (make-sparse-keymap "Hi Lock")))
+    (define-key-after map [highlight-regexp]
+      '(menu-item "Highlight Regexp..." highlight-regexp
+        :help "Highlight text matching PATTERN (a regexp)."))
+
+    (define-key-after map [highlight-phrase]
+      '(menu-item "Highlight Phrase..." highlight-phrase
+        :help "Highlight text matching PATTERN (a regexp processed to match phrases)."))
+
+    (define-key-after map [highlight-lines-matching-regexp]
+      '(menu-item "Highlight Lines..." highlight-lines-matching-regexp
+        :help "Highlight lines containing match of PATTERN (a regexp)."))
+
+    (define-key-after map [unhighlight-regexp]
+      '(menu-item "Remove Highlighting..." unhighlight-regexp
+        :help "Remove previously entered highlighting pattern."
+        :enable hi-lock-interactive-patterns))
+
+    (define-key-after map [hi-lock-write-interactive-patterns]
+      '(menu-item "Patterns to Buffer" hi-lock-write-interactive-patterns
+        :help "Insert interactively added REGEXPs into buffer at point."
+        :enable hi-lock-interactive-patterns))
+
+    (define-key-after map [hi-lock-find-patterns]
+      '(menu-item "Patterns from Buffer" hi-lock-find-patterns
+        :help "Use patterns (if any) near top of buffer."))
+    map)
   "Menu for hi-lock mode.")
 
-(define-key-after hi-lock-menu [highlight-regexp]
-  '(menu-item "Highlight Regexp..." highlight-regexp
-              :help "Highlight text matching PATTERN (a regexp)."))
-
-(define-key-after hi-lock-menu [highlight-phrase]
-  '(menu-item "Highlight Phrase..." highlight-phrase
-              :help "Highlight text matching PATTERN (a regexp processed to match phrases)."))
-
-(define-key-after hi-lock-menu [highlight-lines-matching-regexp]
-  '(menu-item "Highlight Lines..." highlight-lines-matching-regexp
-              :help "Highlight lines containing match of PATTERN (a regexp)."))
-
-(define-key-after hi-lock-menu [unhighlight-regexp]
-  '(menu-item "Remove Highlighting..." unhighlight-regexp
-              :help "Remove previously entered highlighting pattern."
-              :enable hi-lock-interactive-patterns))
-
-(define-key-after hi-lock-menu [hi-lock-write-interactive-patterns]
-  '(menu-item "Patterns to Buffer" hi-lock-write-interactive-patterns
-              :help "Insert interactively added REGEXPs into buffer at point."
-              :enable hi-lock-interactive-patterns))
-
-(define-key-after hi-lock-menu [hi-lock-find-patterns]
-  '(menu-item "Patterns from Buffer" hi-lock-find-patterns
-              :help "Use patterns (if any) near top of buffer."))
-
-(defvar hi-lock-map (make-sparse-keymap "Hi Lock")
+(defvar hi-lock-map
+  (let ((map (make-sparse-keymap "Hi Lock")))
+    (define-key map "\C-xwi" 'hi-lock-find-patterns)
+    (define-key map "\C-xwl" 'highlight-lines-matching-regexp)
+    (define-key map "\C-xwp" 'highlight-phrase)
+    (define-key map "\C-xwh" 'highlight-regexp)
+    (define-key map "\C-xwr" 'unhighlight-regexp)
+    (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns)
+    map)
   "Key map for hi-lock.")
 
-(define-key hi-lock-map "\C-xwi" 'hi-lock-find-patterns)
-(define-key hi-lock-map "\C-xwl" 'highlight-lines-matching-regexp)
-(define-key hi-lock-map "\C-xwp" 'highlight-phrase)
-(define-key hi-lock-map "\C-xwh" 'highlight-regexp)
-(define-key hi-lock-map "\C-xwr" 'unhighlight-regexp)
-(define-key hi-lock-map "\C-xwb" 'hi-lock-write-interactive-patterns)
-
 ;; Visible Functions
 
 ;;;###autoload
index 04048e0..f7ac24f 100644 (file)
@@ -384,14 +384,66 @@ directory, like `default-directory'."
                       (regexp :tag "To")))
   :group 'ibuffer)
 
+(defvar ibuffer-mode-groups-popup
+  (let ((groups-map (make-sparse-keymap "Filter Groups")))
+    ;; Filter groups
+
+    (define-key-after groups-map [filters-to-filter-group]
+      '(menu-item "Create filter group from current filters..."
+        ibuffer-filters-to-filter-group
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
+    (define-key-after groups-map [forward-filter-group]
+      '(menu-item "Move point to the next filter group"
+        ibuffer-forward-filter-group))
+    (define-key-after groups-map [backward-filter-group]
+      '(menu-item "Move point to the previous filter group"
+        ibuffer-backward-filter-group))
+    (define-key-after groups-map [jump-to-filter-group]
+      '(menu-item "Move point to a specific filter group..."
+        ibuffer-jump-to-filter-group))
+    (define-key-after groups-map [kill-filter-group]
+      '(menu-item "Kill filter group named..."
+        ibuffer-kill-filter-group
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
+    (define-key-after groups-map [yank-filter-group]
+      '(menu-item "Yank last killed filter group before..."
+        ibuffer-yank-filter-group
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-group-kill-ring)))
+    (define-key-after groups-map [pop-filter-group]
+      '(menu-item "Remove top filter group"
+        ibuffer-pop-filter-group
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
+    (define-key-after groups-map [clear-filter-groups]
+      '(menu-item "Remove all filter groups"
+        ibuffer-clear-filter-groups
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
+    (define-key-after groups-map [pop-filter-group]
+      '(menu-item "Decompose filter group..."
+        ibuffer-pop-filter-group
+        :help "\"Unmake\" a filter group"
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
+    (define-key-after groups-map [save-filter-groups]
+      '(menu-item "Save current filter groups permanently..."
+        ibuffer-save-filter-groups
+        :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)
+        :help "Use a mnemnonic name to store current filter groups"))
+    (define-key-after groups-map [switch-to-saved-filter-groups]
+      '(menu-item "Restore permanently saved filters..."
+        ibuffer-switch-to-saved-filter-groups
+        :enable (and (featurep 'ibuf-ext) ibuffer-saved-filter-groups)
+        :help "Replace current filters with a saved stack"))
+    (define-key-after groups-map [delete-saved-filter-groups]
+      '(menu-item "Delete permanently saved filter groups..."
+        ibuffer-delete-saved-filter-groups
+        :enable (and (featurep 'ibuf-ext) ibuffer-saved-filter-groups)))
+    (define-key-after groups-map [set-filter-groups-by-mode]
+      '(menu-item "Set current filter groups to filter by mode"
+        ibuffer-set-filter-groups-by-mode))
+
+    groups-map))
 
-(defvar ibuffer-mode-map nil)
-(defvar ibuffer-mode-operate-map nil)
-(defvar ibuffer-mode-groups-popup nil)
-(unless ibuffer-mode-map
-  (let ((map (make-sparse-keymap))
-       (operate-map (make-sparse-keymap "Operate"))
-       (groups-map (make-sparse-keymap "Filter Groups")))
+(defvar ibuffer-mode-map
+  (let ((map (make-keymap)))
     (define-key map (kbd "0") 'digit-argument)
     (define-key map (kbd "1") 'digit-argument)
     (define-key map (kbd "2") 'digit-argument)
@@ -545,10 +597,10 @@ directory, like `default-directory'."
       '(menu-item "View (other frame)" ibuffer-visit-buffer-other-frame))
     (define-key-after map [menu-bar view ibuffer-update]
       '(menu-item "Update" ibuffer-update
-                 :help "Regenerate the list of buffers"))
+        :help "Regenerate the list of buffers"))
     (define-key-after map [menu-bar view switch-format]
       '(menu-item "Switch display format" ibuffer-switch-format
-                 :help "Toggle between available values of `ibuffer-formats'"))
+        :help "Toggle between available values of `ibuffer-formats'"))
 
     (define-key-after map [menu-bar view dashes]
       '("--"))
@@ -562,28 +614,29 @@ directory, like `default-directory'."
       '(menu-item "Sort by buffer size" ibuffer-do-sort-by-size))
     (define-key-after map [menu-bar view sort do-sort-by-alphabetic]
       '(menu-item "Sort lexicographically" ibuffer-do-sort-by-alphabetic
-                 :help "Sort by the alphabetic order of buffer name"))
+        :help "Sort by the alphabetic order of buffer name"))
     (define-key-after map [menu-bar view sort do-sort-by-recency]
       '(menu-item "Sort by view time" ibuffer-do-sort-by-recency
-                 :help "Sort by the last time the buffer was displayed"))
+        :help "Sort by the last time the buffer was displayed"))
     (define-key-after map [menu-bar view sort dashes]
       '("--"))
     (define-key-after map [menu-bar view sort invert-sorting]
       '(menu-item "Reverse sorting order" ibuffer-invert-sorting))
     (define-key-after map [menu-bar view sort toggle-sorting-mode]
       '(menu-item "Switch sorting mode" ibuffer-toggle-sorting-mode
-                 :help "Switch between the various sorting criteria"))
+        :help "Switch between the various sorting criteria"))
 
     (define-key-after map [menu-bar view filter]
       (cons "Filter" (make-sparse-keymap "Filter")))
 
     (define-key-after map [menu-bar view filter filter-disable]
       '(menu-item "Disable all filtering" ibuffer-filter-disable
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
     (define-key-after map [menu-bar view filter filter-by-mode]
       '(menu-item "Add filter by major mode..." ibuffer-filter-by-mode))
     (define-key-after map [menu-bar view filter filter-by-mode]
-      '(menu-item "Add filter by major mode in use..." ibuffer-filter-by-used-mode))
+      '(menu-item "Add filter by major mode in use..."
+        ibuffer-filter-by-used-mode))
     (define-key-after map [menu-bar view filter filter-by-name]
       '(menu-item "Add filter by buffer name..." ibuffer-filter-by-name))
     (define-key-after map [menu-bar view filter filter-by-filename]
@@ -591,158 +644,112 @@ directory, like `default-directory'."
     (define-key-after map [menu-bar view filter filter-by-size-lt]
       '(menu-item "Add filter by size less than..." ibuffer-filter-by-size-lt))
     (define-key-after map [menu-bar view filter filter-by-size-gt]
-      '(menu-item "Add filter by size greater than..." ibuffer-filter-by-size-gt))
+      '(menu-item "Add filter by size greater than..."
+        ibuffer-filter-by-size-gt))
     (define-key-after map [menu-bar view filter filter-by-content]
-      '(menu-item "Add filter by content (regexp)..." ibuffer-filter-by-content))
+      '(menu-item "Add filter by content (regexp)..."
+        ibuffer-filter-by-content))
     (define-key-after map [menu-bar view filter filter-by-predicate]
-      '(menu-item "Add filter by Lisp predicate..." ibuffer-filter-by-predicate))
+      '(menu-item "Add filter by Lisp predicate..."
+        ibuffer-filter-by-predicate))
     (define-key-after map [menu-bar view filter pop-filter]
       '(menu-item "Remove top filter" ibuffer-pop-filter
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
     (define-key-after map [menu-bar view filter or-filter]
       '(menu-item "OR top two filters" ibuffer-or-filter
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers
-                              (cdr ibuffer-filtering-qualifiers))
-                 :help "Create a new filter which is the logical OR of the top two filters"))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers
+                     (cdr ibuffer-filtering-qualifiers))
+        :help
+        "Create a new filter which is the logical OR of the top two filters"))
     (define-key-after map [menu-bar view filter negate-filter]
       '(menu-item "Negate top filter" ibuffer-negate-filter
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
     (define-key-after map [menu-bar view filter decompose-filter]
       '(menu-item "Decompose top filter" ibuffer-decompose-filter
-                 :enable (and (featurep 'ibuf-ext) (memq (car ibuffer-filtering-qualifiers) '(or saved not)))
-                 :help "Break down a complex filter like OR or NOT"))
+        :enable (and (featurep 'ibuf-ext)
+                     (memq (car ibuffer-filtering-qualifiers) '(or saved not)))
+        :help "Break down a complex filter like OR or NOT"))
     (define-key-after map [menu-bar view filter exchange-filters]
       '(menu-item "Swap top two filters" ibuffer-exchange-filters
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers
-                              (cdr ibuffer-filtering-qualifiers))))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers
+                     (cdr ibuffer-filtering-qualifiers))))
     (define-key-after map [menu-bar view filter save-filters]
       '(menu-item "Save current filters permanently..." ibuffer-save-filters
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)
-                 :help "Use a mnemnonic name to store current filter stack"))
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)
+        :help "Use a mnemnonic name to store current filter stack"))
     (define-key-after map [menu-bar view filter switch-to-saved-filters]
-      '(menu-item "Restore permanently saved filters..." ibuffer-switch-to-saved-filters
-                 :enable (and (featurep 'ibuf-ext) ibuffer-saved-filters)
-                 :help "Replace current filters with a saved stack"))
+      '(menu-item "Restore permanently saved filters..."
+        ibuffer-switch-to-saved-filters
+        :enable (and (featurep 'ibuf-ext) ibuffer-saved-filters)
+        :help "Replace current filters with a saved stack"))
     (define-key-after map [menu-bar view filter add-saved-filters]
-      '(menu-item "Add to permanently saved filters..." ibuffer-add-saved-filters
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)
-                 :help "Include already saved stack with current filters"))
+      '(menu-item "Add to permanently saved filters..."
+        ibuffer-add-saved-filters
+        :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)
+        :help "Include already saved stack with current filters"))
     (define-key-after map [menu-bar view filter delete-saved-filters]
       '(menu-item "Delete permanently saved filters..."
-                 ibuffer-delete-saved-filters
-                 :enable (and (featurep 'ibuf-ext) ibuffer-saved-filters)))
-
-    ;; Filter groups
-
-    (define-key-after groups-map [filters-to-filter-group]
-      '(menu-item "Create filter group from current filters..."
-                 ibuffer-filters-to-filter-group
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers)))
-    (define-key-after groups-map [forward-filter-group]
-      '(menu-item "Move point to the next filter group"
-                 ibuffer-forward-filter-group))
-    (define-key-after groups-map [backward-filter-group]
-      '(menu-item "Move point to the previous filter group"
-                 ibuffer-backward-filter-group))
-    (define-key-after groups-map [jump-to-filter-group]
-      '(menu-item "Move point to a specific filter group..."
-                 ibuffer-jump-to-filter-group))
-    (define-key-after groups-map [kill-filter-group]
-      '(menu-item "Kill filter group named..."
-                 ibuffer-kill-filter-group
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
-    (define-key-after groups-map [yank-filter-group]
-      '(menu-item "Yank last killed filter group before..."
-                 ibuffer-yank-filter-group
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-group-kill-ring)))
-    (define-key-after groups-map [pop-filter-group]
-      '(menu-item "Remove top filter group"
-                 ibuffer-pop-filter-group
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
-    (define-key-after groups-map [clear-filter-groups]
-      '(menu-item "Remove all filter groups"
-                 ibuffer-clear-filter-groups
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
-    (define-key-after groups-map [pop-filter-group]
-      '(menu-item "Decompose filter group..."
-                 ibuffer-pop-filter-group
-                 :help "\"Unmake\" a filter group"
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)))
-    (define-key-after groups-map [save-filter-groups]
-      '(menu-item "Save current filter groups permanently..."
-                 ibuffer-save-filter-groups
-                 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups)
-                 :help "Use a mnemnonic name to store current filter groups"))
-    (define-key-after groups-map [switch-to-saved-filter-groups]
-      '(menu-item "Restore permanently saved filters..."
-                 ibuffer-switch-to-saved-filter-groups
-                 :enable (and (featurep 'ibuf-ext) ibuffer-saved-filter-groups)
-                 :help "Replace current filters with a saved stack"))
-    (define-key-after groups-map [delete-saved-filter-groups]
-      '(menu-item "Delete permanently saved filter groups..."
-                 ibuffer-delete-saved-filter-groups
-                 :enable (and (featurep 'ibuf-ext) ibuffer-saved-filter-groups)))
-    (define-key-after groups-map [set-filter-groups-by-mode]
-      '(menu-item "Set current filter groups to filter by mode"
-                 ibuffer-set-filter-groups-by-mode))
+        ibuffer-delete-saved-filters
+        :enable (and (featurep 'ibuf-ext) ibuffer-saved-filters)))
 
     (define-key-after map [menu-bar view filter-groups]
-      (cons "Filter Groups" groups-map))
+      (cons "Filter Groups" ibuffer-mode-groups-popup))
 
     (define-key-after map [menu-bar view dashes2]
       '("--"))
     (define-key-after map [menu-bar view diff-with-file]
       '(menu-item "Diff with file" ibuffer-diff-with-file
-                 :help "View the differences between this buffer and its file"))
+        :help "View the differences between this buffer and its file"))
     (define-key-after map [menu-bar view auto-mode]
       '(menu-item "Toggle Auto Mode" ibuffer-auto-mode
-                 :help "Attempt to automatically update the Ibuffer buffer"))
+        :help "Attempt to automatically update the Ibuffer buffer"))
     (define-key-after map [menu-bar view customize]
       '(menu-item "Customize Ibuffer" ibuffer-customize
-                 :help "Use Custom to customize Ibuffer"))
+        :help "Use Custom to customize Ibuffer"))
 
     (define-key-after map [menu-bar mark]
       (cons "Mark" (make-sparse-keymap "Mark")))
 
     (define-key-after map [menu-bar mark toggle-marks]
       '(menu-item "Toggle marks" ibuffer-toggle-marks
-                 :help "Unmark marked buffers, and mark unmarked buffers"))
+        :help "Unmark marked buffers, and mark unmarked buffers"))
     (define-key-after map [menu-bar mark mark-forward]
       '(menu-item "Mark" ibuffer-mark-forward
-                 :help "Mark the buffer at point"))
+        :help "Mark the buffer at point"))
     (define-key-after map [menu-bar mark unmark-forward]
       '(menu-item "Unmark" ibuffer-unmark-forward
-                 :help "Unmark the buffer at point"))
+        :help "Unmark the buffer at point"))
     (define-key-after map [menu-bar mark mark-by-mode]
       '(menu-item "Mark by mode..." ibuffer-mark-by-mode
-                 :help "Mark all buffers in a particular major mode"))
+        :help "Mark all buffers in a particular major mode"))
     (define-key-after map [menu-bar mark mark-modified-buffers]
       '(menu-item "Mark modified buffers" ibuffer-mark-modified-buffers
-                 :help "Mark all buffers which have been modified"))
+        :help "Mark all buffers which have been modified"))
     (define-key-after map [menu-bar mark mark-unsaved-buffers]
       '(menu-item "Mark unsaved buffers" ibuffer-mark-unsaved-buffers
-                 :help "Mark all buffers which have a file and are modified"))
+        :help "Mark all buffers which have a file and are modified"))
     (define-key-after map [menu-bar mark mark-read-only-buffers]
       '(menu-item "Mark read-only buffers" ibuffer-mark-read-only-buffers
-                 :help "Mark all buffers which are read-only"))
+        :help "Mark all buffers which are read-only"))
     (define-key-after map [menu-bar mark mark-special-buffers]
       '(menu-item "Mark special buffers" ibuffer-mark-special-buffers
-                 :help "Mark all buffers whose name begins with a *"))
+        :help "Mark all buffers whose name begins with a *"))
     (define-key-after map [menu-bar mark mark-dired-buffers]
       '(menu-item "Mark dired buffers" ibuffer-mark-dired-buffers
-                 :help "Mark buffers in dired-mode"))
+        :help "Mark buffers in dired-mode"))
     (define-key-after map [menu-bar mark mark-dissociated-buffers]
       '(menu-item "Mark dissociated buffers" ibuffer-mark-dissociated-buffers
-                 :help "Mark buffers with a non-existent associated file"))
+        :help "Mark buffers with a non-existent associated file"))
     (define-key-after map [menu-bar mark mark-help-buffers]
       '(menu-item "Mark help buffers" ibuffer-mark-help-buffers
-                 :help "Mark buffers in help-mode"))
+        :help "Mark buffers in help-mode"))
     (define-key-after map [menu-bar mark mark-compressed-file-buffers]
-      '(menu-item "Mark compressed file buffers" ibuffer-mark-compressed-file-buffers
-                 :help "Mark buffers which have a file that is compressed"))
+      '(menu-item "Mark compressed file buffers"
+        ibuffer-mark-compressed-file-buffers
+        :help "Mark buffers which have a file that is compressed"))
     (define-key-after map [menu-bar mark mark-old-buffers]
       '(menu-item "Mark old buffers" ibuffer-mark-old-buffers
-                 :help "Mark buffers which have not been viewed recently"))
+        :help "Mark buffers which have not been viewed recently"))
     (define-key-after map [menu-bar mark unmark-all]
       '(menu-item "Unmark All" ibuffer-unmark-all))
 
@@ -751,16 +758,19 @@ directory, like `default-directory'."
 
     (define-key-after map [menu-bar mark mark-by-name-regexp]
       '(menu-item "Mark by buffer name (regexp)..." ibuffer-mark-by-name-regexp
-                 :help "Mark buffers whose name matches a regexp"))
+        :help "Mark buffers whose name matches a regexp"))
     (define-key-after map [menu-bar mark mark-by-mode-regexp]
       '(menu-item "Mark by major mode (regexp)..." ibuffer-mark-by-mode-regexp
-                 :help "Mark buffers whose major mode name matches a regexp"))
+        :help "Mark buffers whose major mode name matches a regexp"))
     (define-key-after map [menu-bar mark mark-by-file-name-regexp]
-      '(menu-item "Mark by file name (regexp)..." ibuffer-mark-by-file-name-regexp
-                 :help "Mark buffers whose file name matches a regexp"))
+      '(menu-item "Mark by file name (regexp)..."
+        ibuffer-mark-by-file-name-regexp
+        :help "Mark buffers whose file name matches a regexp"))
 
-    ;; Operate map is added later
+    map))
 
+(defvar ibuffer-mode-operate-map
+  (let ((operate-map (make-sparse-keymap "Operate")))
     (define-key-after operate-map [do-view]
       '(menu-item "View" ibuffer-do-view))
     (define-key-after operate-map [do-view-other-frame]
@@ -769,47 +779,45 @@ directory, like `default-directory'."
       '(menu-item "Save" ibuffer-do-save))
     (define-key-after operate-map [do-replace-regexp]
       '(menu-item "Replace (regexp)..." ibuffer-do-replace-regexp
-                 :help "Replace text inside marked buffers"))
+        :help "Replace text inside marked buffers"))
     (define-key-after operate-map [do-query-replace]
       '(menu-item "Query Replace..." ibuffer-do-query-replace
-                 :help "Replace text in marked buffers, asking each time"))
+        :help "Replace text in marked buffers, asking each time"))
     (define-key-after operate-map [do-query-replace-regexp]
       '(menu-item "Query Replace (regexp)..." ibuffer-do-query-replace-regexp
-                 :help "Replace text in marked buffers by regexp, asking each time"))
+        :help "Replace text in marked buffers by regexp, asking each time"))
     (define-key-after operate-map [do-print]
       '(menu-item "Print" ibuffer-do-print))
     (define-key-after operate-map [do-toggle-modified]
       '(menu-item "Toggle modification flag" ibuffer-do-toggle-modified))
     (define-key-after operate-map [do-revert]
       '(menu-item "Revert" ibuffer-do-revert
-                 :help "Revert marked buffers to their associated file"))
+        :help "Revert marked buffers to their associated file"))
     (define-key-after operate-map [do-rename-uniquely]
       '(menu-item "Rename Uniquely" ibuffer-do-rename-uniquely
-                 :help "Rename marked buffers to a new, unique name"))
+        :help "Rename marked buffers to a new, unique name"))
     (define-key-after operate-map [do-delete]
       '(menu-item "Kill" ibuffer-do-delete))
     (define-key-after operate-map [do-occur]
       '(menu-item "List lines matching..." ibuffer-do-occur
-                 :help "View all lines in marked buffers matching a regexp"))
+        :help "View all lines in marked buffers matching a regexp"))
     (define-key-after operate-map [do-shell-command-pipe]
       '(menu-item "Pipe to shell command..." ibuffer-do-shell-command-pipe
-                 :help "For each marked buffer, send its contents to a shell command"))
+        :help "For each marked buffer, send its contents to a shell command"))
     (define-key-after operate-map [do-shell-command-pipe-replace]
       '(menu-item "Pipe to shell command (replace)..." ibuffer-do-shell-command-pipe-replace
-                 :help "For each marked buffer, replace its contents with output of shell command"))
+        :help "For each marked buffer, replace its contents with output of shell command"))
     (define-key-after operate-map [do-shell-command-file]
       '(menu-item "Shell command on buffer's file..." ibuffer-do-shell-command-file
-                 :help "For each marked buffer, run a shell command with its file as argument"))
+        :help "For each marked buffer, run a shell command with its file as argument"))
     (define-key-after operate-map [do-eval]
       '(menu-item "Eval..." ibuffer-do-eval
-                 :help "Evaluate a Lisp form in each marked buffer"))
+        :help "Evaluate a Lisp form in each marked buffer"))
     (define-key-after operate-map [do-view-and-eval]
       '(menu-item "Eval (viewing buffer)..." ibuffer-do-view-and-eval
-                 :help "Evaluate a Lisp form in each marked buffer while viewing it"))
+        :help "Evaluate a Lisp form in each marked buffer while viewing it"))
 
-    (setq ibuffer-mode-map map
-         ibuffer-mode-operate-map operate-map
-         ibuffer-mode-groups-popup (copy-keymap groups-map))))
+    operate-map))
 
 (define-key ibuffer-mode-groups-popup [kill-filter-group]
   '(menu-item "Kill filter group"
@@ -1559,9 +1567,8 @@ If point is on a group name, this function operates on that group."
                                        from-end-p))
                                (setq strlen (length str))
                                (setq str
-                                     ,(ibuffer-compile-make-eliding-form 'str
-                                                                         elide
-                                                                         from-end-p)))))
+                                     ,(ibuffer-compile-make-eliding-form
+                                        'str elide from-end-p)))))
             ;; Now, put these forms together with the rest of the code.
             (let ((callform
                    ;; Is this an "inline" column?  This means we have
@@ -1575,16 +1582,18 @@ If point is on a group name, this function operates on that group."
                   ;; You're not expected to understand this.  Hell, I
                   ;; don't even understand it, and I wrote it five
                   ;; minutes ago.
-                  (insertgenfn (ibuffer-aif (get sym 'ibuffer-column-summarizer)
-                                   ;; I really, really wish Emacs Lisp had closures.
-                                   (lambda (arg sym)
-                                     `(insert
-                                       (let ((ret ,arg))
-                                         (put ',sym 'ibuffer-column-summary
-                                              (cons ret (get ',sym 'ibuffer-column-summary)))
-                                         ret)))
-                                 (lambda (arg sym)
-                                   `(insert ,arg))))
+                  (insertgenfn
+                    (ibuffer-aif (get sym 'ibuffer-column-summarizer)
+                        ;; I really, really wish Emacs Lisp had closures.
+                        (lambda (arg sym)
+                          `(insert
+                            (let ((ret ,arg))
+                              (put ',sym 'ibuffer-column-summary
+                                   (cons ret (get ',sym
+                                                  'ibuffer-column-summary)))
+                              ret)))
+                      (lambda (arg sym)
+                        `(insert ,arg))))
                   (mincompform `(< strlen ,(if (integerp min)
                                                min
                                              'min)))
@@ -1617,7 +1626,8 @@ If point is on a group name, this function operates on that group."
                              `(strlen (length str))))
                           outforms)
                     (setq outforms
-                          (append outforms (list (funcall insertgenfn 'str sym)))))
+                          (append outforms
+                                   (list (funcall insertgenfn 'str sym)))))
                 ;; The simple case; just insert the string.
                 (push (funcall insertgenfn callform sym) outforms))
               ;; Finally, return a `let' form which binds the
index 689120c..6f4bed3 100644 (file)
@@ -916,34 +916,35 @@ without repeating the prefix."
 (defvar kmacro-step-edit-help)          ;; kmacro step edit help enabled
 (defvar kmacro-step-edit-num-input-keys) ;; to ignore duplicate pre-command hook
 
-(defvar kmacro-step-edit-map (make-sparse-keymap)
+(defvar kmacro-step-edit-map
+  (let ((map (make-sparse-keymap)))
+    ;; query-replace-map answers include: `act', `skip', `act-and-show',
+    ;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter',
+    ;; `automatic', `backup', `exit-prefix', and `help'.")
+    ;; Also: `quit', `edit-replacement'
+
+    (set-keymap-parent map query-replace-map)
+
+    (define-key map "\t" 'act-repeat)
+    (define-key map [tab] 'act-repeat)
+    (define-key map "\C-k" 'skip-rest)
+    (define-key map "c" 'automatic)
+    (define-key map "f" 'skip-keep)
+    (define-key map "q" 'quit)
+    (define-key map "d" 'skip)
+    (define-key map "\C-d" 'skip)
+    (define-key map "i" 'insert)
+    (define-key map "I" 'insert-1)
+    (define-key map "r" 'replace)
+    (define-key map "R" 'replace-1)
+    (define-key map "a" 'append)
+    (define-key map "A" 'append-end)
+    map)
   "Keymap that defines the responses to questions in `kmacro-step-edit-macro'.
 This keymap is an extension to the `query-replace-map', allowing the
 following additional answers: `insert', `insert-1', `replace', `replace-1',
 `append', `append-end', `act-repeat', `skip-end', `skip-keep'.")
 
-;; query-replace-map answers include: `act', `skip', `act-and-show',
-;; `exit', `act-and-exit', `edit', `delete-and-edit', `recenter',
-;; `automatic', `backup', `exit-prefix', and `help'.")
-;; Also: `quit', `edit-replacement'
-
-(set-keymap-parent kmacro-step-edit-map query-replace-map)
-
-(define-key kmacro-step-edit-map "\t" 'act-repeat)
-(define-key kmacro-step-edit-map [tab] 'act-repeat)
-(define-key kmacro-step-edit-map "\C-k" 'skip-rest)
-(define-key kmacro-step-edit-map "c" 'automatic)
-(define-key kmacro-step-edit-map "f" 'skip-keep)
-(define-key kmacro-step-edit-map "q" 'quit)
-(define-key kmacro-step-edit-map "d" 'skip)
-(define-key kmacro-step-edit-map "\C-d" 'skip)
-(define-key kmacro-step-edit-map "i" 'insert)
-(define-key kmacro-step-edit-map "I" 'insert-1)
-(define-key kmacro-step-edit-map "r" 'replace)
-(define-key kmacro-step-edit-map "R" 'replace-1)
-(define-key kmacro-step-edit-map "a" 'append)
-(define-key kmacro-step-edit-map "A" 'append-end)
-
 (defvar kmacro-step-edit-prefix-commands
   '(universal-argument universal-argument-more universal-argument-minus
                       digit-argument negative-argument)
index 7e1cbe4..7e44ae2 100644 (file)
@@ -4418,7 +4418,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
 \f
 ;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic
 ;;;;;;  rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels
-;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "76a7ae570a4fa96a9233d0276f52f515")
+;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "adad96c9eb13cae4bae0769f731d8784")
 ;;; Generated autoloads from rmailsum.el
 
 (autoload 'rmail-summary "rmailsum" "\
index e0f40af..1d5e062 100644 (file)
@@ -64,7 +64,196 @@ Setting this option to nil might speed up the generation of summaries."
   "Overlay used to highlight the current message in the Rmail summary.")
 (put 'rmail-summary-overlay 'permanent-local t)
 
-(defvar rmail-summary-mode-map nil
+(defvar rmail-summary-mode-map
+  (let ((map (make-keymap)))
+    (suppress-keymap map)
+    (define-key map [mouse-2] 'rmail-summary-mouse-goto-message)
+    (define-key map "a"      'rmail-summary-add-label)
+    (define-key map "b"      'rmail-summary-bury)
+    (define-key map "c"      'rmail-summary-continue)
+    (define-key map "d"      'rmail-summary-delete-forward)
+    (define-key map "\C-d"   'rmail-summary-delete-backward)
+    (define-key map "e"      'rmail-summary-edit-current-message)
+    (define-key map "f"      'rmail-summary-forward)
+    (define-key map "g"      'rmail-summary-get-new-mail)
+    (define-key map "h"      'rmail-summary)
+    (define-key map "i"      'rmail-summary-input)
+    (define-key map "j"      'rmail-summary-goto-msg)
+    (define-key map "\C-m"   'rmail-summary-goto-msg)
+    (define-key map "k"      'rmail-summary-kill-label)
+    (define-key map "l"      'rmail-summary-by-labels)
+    (define-key map "\e\C-h" 'rmail-summary)
+    (define-key map "\e\C-l" 'rmail-summary-by-labels)
+    (define-key map "\e\C-r" 'rmail-summary-by-recipients)
+    (define-key map "\e\C-s" 'rmail-summary-by-regexp)
+    ;; `f' for "from".
+    (define-key map "\e\C-f" 'rmail-summary-by-senders)
+    (define-key map "\e\C-t" 'rmail-summary-by-topic)
+    (define-key map "m"      'rmail-summary-mail)
+    (define-key map "\M-m"   'rmail-summary-retry-failure)
+    (define-key map "n"      'rmail-summary-next-msg)
+    (define-key map "\en"    'rmail-summary-next-all)
+    (define-key map "\e\C-n" 'rmail-summary-next-labeled-message)
+    (define-key map "o"      'rmail-summary-output)
+    (define-key map "\C-o"   'rmail-summary-output-as-seen)
+    (define-key map "p"      'rmail-summary-previous-msg)
+    (define-key map "\ep"    'rmail-summary-previous-all)
+    (define-key map "\e\C-p" 'rmail-summary-previous-labeled-message)
+    (define-key map "q"      'rmail-summary-quit)
+    (define-key map "Q"      'rmail-summary-wipe)
+    (define-key map "r"      'rmail-summary-reply)
+    (define-key map "s"      'rmail-summary-expunge-and-save)
+    ;; See rms's comment in rmail.el
+    ;; (define-key map "\er"    'rmail-summary-search-backward)
+    (define-key map "\es"    'rmail-summary-search)
+    (define-key map "t"      'rmail-summary-toggle-header)
+    (define-key map "u"      'rmail-summary-undelete)
+    (define-key map "\M-u"   'rmail-summary-undelete-many)
+    (define-key map "x"      'rmail-summary-expunge)
+    (define-key map "w"      'rmail-summary-output-body)
+    (define-key map "v"      'rmail-mime)
+    (define-key map "."      'rmail-summary-beginning-of-message)
+    (define-key map "/"      'rmail-summary-end-of-message)
+    (define-key map "<"      'rmail-summary-first-message)
+    (define-key map ">"      'rmail-summary-last-message)
+    (define-key map " "      'rmail-summary-scroll-msg-up)
+    (define-key map "\177"   'rmail-summary-scroll-msg-down)
+    (define-key map "?"      'describe-mode)
+    (define-key map "\C-c\C-n" 'rmail-summary-next-same-subject)
+    (define-key map "\C-c\C-p" 'rmail-summary-previous-same-subject)
+    (define-key map "\C-c\C-s\C-d" 'rmail-summary-sort-by-date)
+    (define-key map "\C-c\C-s\C-s" 'rmail-summary-sort-by-subject)
+    (define-key map "\C-c\C-s\C-a" 'rmail-summary-sort-by-author)
+    (define-key map "\C-c\C-s\C-r" 'rmail-summary-sort-by-recipient)
+    (define-key map "\C-c\C-s\C-c" 'rmail-summary-sort-by-correspondent)
+    (define-key map "\C-c\C-s\C-l" 'rmail-summary-sort-by-lines)
+    (define-key map "\C-c\C-s\C-k" 'rmail-summary-sort-by-labels)
+    (define-key map "\C-x\C-s" 'rmail-summary-save-buffer)
+
+    ;; Menu bar bindings.
+
+    (define-key map [menu-bar] (make-sparse-keymap))
+
+    (define-key map [menu-bar classify]
+      (cons "Classify" (make-sparse-keymap "Classify")))
+
+    (define-key map [menu-bar classify output-menu]
+      '("Output (Rmail Menu)..." . rmail-summary-output-menu))
+
+    (define-key map [menu-bar classify input-menu]
+      '("Input Rmail File (menu)..." . rmail-input-menu))
+
+    (define-key map [menu-bar classify input-menu]
+      '(nil))
+
+    (define-key map [menu-bar classify output-menu]
+      '(nil))
+
+    (define-key map [menu-bar classify output-body]
+      '("Output body..." . rmail-summary-output-body))
+
+    (define-key map [menu-bar classify output-inbox]
+      '("Output..." . rmail-summary-output))
+
+    (define-key map [menu-bar classify output]
+      '("Output as seen..." . rmail-summary-output-as-seen))
+
+    (define-key map [menu-bar classify kill-label]
+      '("Kill Label..." . rmail-summary-kill-label))
+
+    (define-key map [menu-bar classify add-label]
+      '("Add Label..." . rmail-summary-add-label))
+
+    (define-key map [menu-bar summary]
+      (cons "Summary" (make-sparse-keymap "Summary")))
+
+    (define-key map [menu-bar summary senders]
+      '("By Senders..." . rmail-summary-by-senders))
+
+    (define-key map [menu-bar summary labels]
+      '("By Labels..." . rmail-summary-by-labels))
+
+    (define-key map [menu-bar summary recipients]
+      '("By Recipients..." . rmail-summary-by-recipients))
+
+    (define-key map [menu-bar summary topic]
+      '("By Topic..." . rmail-summary-by-topic))
+
+    (define-key map [menu-bar summary regexp]
+      '("By Regexp..." . rmail-summary-by-regexp))
+
+    (define-key map [menu-bar summary all]
+      '("All" . rmail-summary))
+
+    (define-key map [menu-bar mail]
+      (cons "Mail" (make-sparse-keymap "Mail")))
+
+    (define-key map [menu-bar mail rmail-summary-get-new-mail]
+      '("Get New Mail" . rmail-summary-get-new-mail))
+
+    (define-key map [menu-bar mail lambda]
+      '("----"))
+
+    (define-key map [menu-bar mail continue]
+      '("Continue" . rmail-summary-continue))
+
+    (define-key map [menu-bar mail resend]
+      '("Re-send..." . rmail-summary-resend))
+
+    (define-key map [menu-bar mail forward]
+      '("Forward" . rmail-summary-forward))
+
+    (define-key map [menu-bar mail retry]
+      '("Retry" . rmail-summary-retry-failure))
+
+    (define-key map [menu-bar mail reply]
+      '("Reply" . rmail-summary-reply))
+
+    (define-key map [menu-bar mail mail]
+      '("Mail" . rmail-summary-mail))
+
+    (define-key map [menu-bar delete]
+      (cons "Delete" (make-sparse-keymap "Delete")))
+
+    (define-key map [menu-bar delete expunge/save]
+      '("Expunge/Save" . rmail-summary-expunge-and-save))
+
+    (define-key map [menu-bar delete expunge]
+      '("Expunge" . rmail-summary-expunge))
+
+    (define-key map [menu-bar delete undelete]
+      '("Undelete" . rmail-summary-undelete))
+
+    (define-key map [menu-bar delete delete]
+      '("Delete" . rmail-summary-delete-forward))
+
+    (define-key map [menu-bar move]
+      (cons "Move" (make-sparse-keymap "Move")))
+
+    (define-key map [menu-bar move search-back]
+      '("Search Back..." . rmail-summary-search-backward))
+
+    (define-key map [menu-bar move search]
+      '("Search..." . rmail-summary-search))
+
+    (define-key map [menu-bar move previous]
+      '("Previous Nondeleted" . rmail-summary-previous-msg))
+
+    (define-key map [menu-bar move next]
+      '("Next Nondeleted" . rmail-summary-next-msg))
+
+    (define-key map [menu-bar move last]
+      '("Last" . rmail-summary-last-message))
+
+    (define-key map [menu-bar move first]
+      '("First" . rmail-summary-first-message))
+
+    (define-key map [menu-bar move previous]
+      '("Previous" . rmail-summary-previous-all))
+
+    (define-key map [menu-bar move next]
+      '("Next" . rmail-summary-next-all))
+    map)
   "Keymap used in Rmail summary mode.")
 
 ;; Entry points for making a summary buffer.
@@ -990,207 +1179,6 @@ Search, the `unseen' attribute is restored.")
     (save-excursion
       (switch-to-buffer rmail-buffer)
       (save-buffer))))
-
-\f
-(if rmail-summary-mode-map
-    nil
-  (setq rmail-summary-mode-map (make-keymap))
-  (suppress-keymap rmail-summary-mode-map)
-
-  (define-key rmail-summary-mode-map [mouse-2] 'rmail-summary-mouse-goto-message)
-  (define-key rmail-summary-mode-map "a"      'rmail-summary-add-label)
-  (define-key rmail-summary-mode-map "b"      'rmail-summary-bury)
-  (define-key rmail-summary-mode-map "c"      'rmail-summary-continue)
-  (define-key rmail-summary-mode-map "d"      'rmail-summary-delete-forward)
-  (define-key rmail-summary-mode-map "\C-d"   'rmail-summary-delete-backward)
-  (define-key rmail-summary-mode-map "e"      'rmail-summary-edit-current-message)
-  (define-key rmail-summary-mode-map "f"      'rmail-summary-forward)
-  (define-key rmail-summary-mode-map "g"      'rmail-summary-get-new-mail)
-  (define-key rmail-summary-mode-map "h"      'rmail-summary)
-  (define-key rmail-summary-mode-map "i"      'rmail-summary-input)
-  (define-key rmail-summary-mode-map "j"      'rmail-summary-goto-msg)
-  (define-key rmail-summary-mode-map "\C-m"   'rmail-summary-goto-msg)
-  (define-key rmail-summary-mode-map "k"      'rmail-summary-kill-label)
-  (define-key rmail-summary-mode-map "l"      'rmail-summary-by-labels)
-  (define-key rmail-summary-mode-map "\e\C-h" 'rmail-summary)
-  (define-key rmail-summary-mode-map "\e\C-l" 'rmail-summary-by-labels)
-  (define-key rmail-summary-mode-map "\e\C-r" 'rmail-summary-by-recipients)
-  (define-key rmail-summary-mode-map "\e\C-s" 'rmail-summary-by-regexp)
-  ;; `f' for "from".
-  (define-key rmail-summary-mode-map "\e\C-f" 'rmail-summary-by-senders)
-  (define-key rmail-summary-mode-map "\e\C-t" 'rmail-summary-by-topic)
-  (define-key rmail-summary-mode-map "m"      'rmail-summary-mail)
-  (define-key rmail-summary-mode-map "\M-m"   'rmail-summary-retry-failure)
-  (define-key rmail-summary-mode-map "n"      'rmail-summary-next-msg)
-  (define-key rmail-summary-mode-map "\en"    'rmail-summary-next-all)
-  (define-key rmail-summary-mode-map "\e\C-n" 'rmail-summary-next-labeled-message)
-  (define-key rmail-summary-mode-map "o"      'rmail-summary-output)
-  (define-key rmail-summary-mode-map "\C-o"   'rmail-summary-output-as-seen)
-  (define-key rmail-summary-mode-map "p"      'rmail-summary-previous-msg)
-  (define-key rmail-summary-mode-map "\ep"    'rmail-summary-previous-all)
-  (define-key rmail-summary-mode-map "\e\C-p" 'rmail-summary-previous-labeled-message)
-  (define-key rmail-summary-mode-map "q"      'rmail-summary-quit)
-  (define-key rmail-summary-mode-map "Q"      'rmail-summary-wipe)
-  (define-key rmail-summary-mode-map "r"      'rmail-summary-reply)
-  (define-key rmail-summary-mode-map "s"      'rmail-summary-expunge-and-save)
-  ;; See rms's comment in rmail.el
-;;;  (define-key rmail-summary-mode-map "\er"    'rmail-summary-search-backward)
-  (define-key rmail-summary-mode-map "\es"    'rmail-summary-search)
-  (define-key rmail-summary-mode-map "t"      'rmail-summary-toggle-header)
-  (define-key rmail-summary-mode-map "u"      'rmail-summary-undelete)
-  (define-key rmail-summary-mode-map "\M-u"   'rmail-summary-undelete-many)
-  (define-key rmail-summary-mode-map "x"      'rmail-summary-expunge)
-  (define-key rmail-summary-mode-map "w"      'rmail-summary-output-body)
-  (define-key rmail-summary-mode-map "v"      'rmail-mime)
-  (define-key rmail-summary-mode-map "."      'rmail-summary-beginning-of-message)
-  (define-key rmail-summary-mode-map "/"      'rmail-summary-end-of-message)
-  (define-key rmail-summary-mode-map "<"      'rmail-summary-first-message)
-  (define-key rmail-summary-mode-map ">"      'rmail-summary-last-message)
-  (define-key rmail-summary-mode-map " "      'rmail-summary-scroll-msg-up)
-  (define-key rmail-summary-mode-map "\177"   'rmail-summary-scroll-msg-down)
-  (define-key rmail-summary-mode-map "?"      'describe-mode)
-  (define-key rmail-summary-mode-map "\C-c\C-n" 'rmail-summary-next-same-subject)
-  (define-key rmail-summary-mode-map "\C-c\C-p" 'rmail-summary-previous-same-subject)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-d"
-    'rmail-summary-sort-by-date)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-s"
-    'rmail-summary-sort-by-subject)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-a"
-    'rmail-summary-sort-by-author)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-r"
-    'rmail-summary-sort-by-recipient)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-c"
-    'rmail-summary-sort-by-correspondent)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-l"
-    'rmail-summary-sort-by-lines)
-  (define-key rmail-summary-mode-map "\C-c\C-s\C-k"
-    'rmail-summary-sort-by-labels)
-  (define-key rmail-summary-mode-map "\C-x\C-s" 'rmail-summary-save-buffer)
-  )
-\f
-;;; Menu bar bindings.
-
-(define-key rmail-summary-mode-map [menu-bar] (make-sparse-keymap))
-
-(define-key rmail-summary-mode-map [menu-bar classify]
-  (cons "Classify" (make-sparse-keymap "Classify")))
-
-(define-key rmail-summary-mode-map [menu-bar classify output-menu]
-  '("Output (Rmail Menu)..." . rmail-summary-output-menu))
-
-(define-key rmail-summary-mode-map [menu-bar classify input-menu]
-  '("Input Rmail File (menu)..." . rmail-input-menu))
-
-(define-key rmail-summary-mode-map [menu-bar classify input-menu]
-  '(nil))
-
-(define-key rmail-summary-mode-map [menu-bar classify output-menu]
-  '(nil))
-
-(define-key rmail-summary-mode-map [menu-bar classify output-body]
-  '("Output body..." . rmail-summary-output-body))
-
-(define-key rmail-summary-mode-map [menu-bar classify output-inbox]
-  '("Output..." . rmail-summary-output))
-
-(define-key rmail-summary-mode-map [menu-bar classify output]
-  '("Output as seen..." . rmail-summary-output-as-seen))
-
-(define-key rmail-summary-mode-map [menu-bar classify kill-label]
-  '("Kill Label..." . rmail-summary-kill-label))
-
-(define-key rmail-summary-mode-map [menu-bar classify add-label]
-  '("Add Label..." . rmail-summary-add-label))
-
-(define-key rmail-summary-mode-map [menu-bar summary]
-  (cons "Summary" (make-sparse-keymap "Summary")))
-
-(define-key rmail-summary-mode-map [menu-bar summary senders]
-  '("By Senders..." . rmail-summary-by-senders))
-
-(define-key rmail-summary-mode-map [menu-bar summary labels]
-  '("By Labels..." . rmail-summary-by-labels))
-
-(define-key rmail-summary-mode-map [menu-bar summary recipients]
-  '("By Recipients..." . rmail-summary-by-recipients))
-
-(define-key rmail-summary-mode-map [menu-bar summary topic]
-  '("By Topic..." . rmail-summary-by-topic))
-
-(define-key rmail-summary-mode-map [menu-bar summary regexp]
-  '("By Regexp..." . rmail-summary-by-regexp))
-
-(define-key rmail-summary-mode-map [menu-bar summary all]
-  '("All" . rmail-summary))
-
-(define-key rmail-summary-mode-map [menu-bar mail]
-  (cons "Mail" (make-sparse-keymap "Mail")))
-
-(define-key rmail-summary-mode-map [menu-bar mail rmail-summary-get-new-mail]
-  '("Get New Mail" . rmail-summary-get-new-mail))
-
-(define-key rmail-summary-mode-map [menu-bar mail lambda]
-  '("----"))
-
-(define-key rmail-summary-mode-map [menu-bar mail continue]
-  '("Continue" . rmail-summary-continue))
-
-(define-key rmail-summary-mode-map [menu-bar mail resend]
-  '("Re-send..." . rmail-summary-resend))
-
-(define-key rmail-summary-mode-map [menu-bar mail forward]
-  '("Forward" . rmail-summary-forward))
-
-(define-key rmail-summary-mode-map [menu-bar mail retry]
-  '("Retry" . rmail-summary-retry-failure))
-
-(define-key rmail-summary-mode-map [menu-bar mail reply]
-  '("Reply" . rmail-summary-reply))
-
-(define-key rmail-summary-mode-map [menu-bar mail mail]
-  '("Mail" . rmail-summary-mail))
-
-(define-key rmail-summary-mode-map [menu-bar delete]
-  (cons "Delete" (make-sparse-keymap "Delete")))
-
-(define-key rmail-summary-mode-map [menu-bar delete expunge/save]
-  '("Expunge/Save" . rmail-summary-expunge-and-save))
-
-(define-key rmail-summary-mode-map [menu-bar delete expunge]
-  '("Expunge" . rmail-summary-expunge))
-
-(define-key rmail-summary-mode-map [menu-bar delete undelete]
-  '("Undelete" . rmail-summary-undelete))
-
-(define-key rmail-summary-mode-map [menu-bar delete delete]
-  '("Delete" . rmail-summary-delete-forward))
-
-(define-key rmail-summary-mode-map [menu-bar move]
-  (cons "Move" (make-sparse-keymap "Move")))
-
-(define-key rmail-summary-mode-map [menu-bar move search-back]
-  '("Search Back..." . rmail-summary-search-backward))
-
-(define-key rmail-summary-mode-map [menu-bar move search]
-  '("Search..." . rmail-summary-search))
-
-(define-key rmail-summary-mode-map [menu-bar move previous]
-  '("Previous Nondeleted" . rmail-summary-previous-msg))
-
-(define-key rmail-summary-mode-map [menu-bar move next]
-  '("Next Nondeleted" . rmail-summary-next-msg))
-
-(define-key rmail-summary-mode-map [menu-bar move last]
-  '("Last" . rmail-summary-last-message))
-
-(define-key rmail-summary-mode-map [menu-bar move first]
-  '("First" . rmail-summary-first-message))
-
-(define-key rmail-summary-mode-map [menu-bar move previous]
-  '("Previous" . rmail-summary-previous-all))
-
-(define-key rmail-summary-mode-map [menu-bar move next]
-  '("Next" . rmail-summary-next-all))
 \f
 (defun rmail-summary-mouse-goto-message (event)
   "Select the message whose summary line you click on."
dissimilarity index 60%
index 42caeee..8a33381 100644 (file)
-;;; menu-bar.el --- define a default menu bar
-
-;; Copyright (C) 1993-1995, 2000-2011  Free Software Foundation, Inc.
-
-;; Author: RMS
-;; Maintainer: FSF
-;; Keywords: internal, mouse
-;; Package: emacs
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;; Avishai Yacobi suggested some menu rearrangements.
-
-;;; Commentary:
-
-;;; Code:
-
-;; 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])
-    (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
-(defvar menu-bar-help-menu (make-sparse-keymap "Help"))
-
-(if (not (featurep 'ns))
-    ;; Force Help item to come last, after the major mode's own items.
-    ;; The symbol used to be called `help', but that gets confused with the
-    ;; help key.
-    (setq menu-bar-final-items '(help-menu))
-  (if (eq system-type 'darwin)
-      (setq menu-bar-final-items '(buffer services help-menu))
-    (setq menu-bar-final-items '(buffer services hide-app quit))
-    ;; Add standard top-level items to GNUstep menu.
-    (define-key global-map [menu-bar quit]
-      `(menu-item ,(purecopy "Quit") save-buffers-kill-emacs
-                  :help ,(purecopy "Save unsaved buffers, then exit")))
-    (define-key global-map [menu-bar hide-app]
-      `(menu-item ,(purecopy "Hide") ns-do-hide-emacs
-                  :help ,(purecopy "Hide Emacs"))))
-  (define-key global-map [menu-bar services] ; set-up in ns-win
-    (cons (purecopy "Services") (make-sparse-keymap "Services"))))
-
-;; If running under GNUstep, "Help" is moved and renamed "Info" (see below).
-(or (and (featurep 'ns)
-         (not (eq system-type 'darwin)))
-    (define-key global-map [menu-bar help-menu]
-      (cons (purecopy "Help") menu-bar-help-menu)))
-
-(defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
-(define-key global-map [menu-bar tools]
-  (cons (purecopy "Tools") menu-bar-tools-menu))
-;; This definition is just to show what this looks like.
-;; It gets modified in place when menu-bar-update-buffers is called.
-(defvar global-buffers-menu-map (make-sparse-keymap "Buffers"))
-(define-key global-map [menu-bar buffer]
-  (cons (purecopy "Buffers") global-buffers-menu-map))
-(defvar menu-bar-options-menu (make-sparse-keymap "Options"))
-(define-key global-map [menu-bar options]
-  (cons (purecopy "Options") menu-bar-options-menu))
-(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
-(define-key global-map [menu-bar edit]
-  (cons (purecopy "Edit") menu-bar-edit-menu))
-(defvar menu-bar-file-menu (make-sparse-keymap "File"))
-(define-key global-map [menu-bar file]
-  (cons (purecopy "File") menu-bar-file-menu))
-
-;; Put "Help" menu at the front, called "Info".
-(and (featurep 'ns)
-     (not (eq system-type 'darwin))
-     (define-key global-map [menu-bar help-menu]
-       (cons (purecopy "Info") menu-bar-help-menu)))
-
-;; Only declared obsolete (and only made a proper alias) in 23.3.
-(define-obsolete-variable-alias 'menu-bar-files-menu 'menu-bar-file-menu "22.1")
-
-;; This is referenced by some code below; it is defined in uniquify.el
-(defvar uniquify-buffer-name-style)
-
-;; From emulation/cua-base.el; used below
-(defvar cua-enable-cua-keys)
-
-\f
-;; The "File" menu items
-(define-key menu-bar-file-menu [exit-emacs]
-  `(menu-item ,(purecopy "Quit") save-buffers-kill-terminal
-             :help ,(purecopy "Save unsaved buffers, then exit")))
-
-(define-key menu-bar-file-menu [separator-exit]
-  menu-bar-separator)
-
-;; Don't use delete-frame as event name because that is a special
-;; event.
-(define-key menu-bar-file-menu [delete-this-frame]
-  `(menu-item ,(purecopy "Delete Frame") delete-frame
-             :visible (fboundp 'delete-frame)
-             :enable (delete-frame-enabled-p)
-             :help ,(purecopy "Delete currently selected frame")))
-(define-key menu-bar-file-menu [make-frame-on-display]
-  `(menu-item ,(purecopy "New Frame on Display...") make-frame-on-display
-             :visible (fboundp 'make-frame-on-display)
-             :help ,(purecopy "Open a new frame on another display")))
-(define-key menu-bar-file-menu [make-frame]
-  `(menu-item ,(purecopy "New Frame") make-frame-command
-             :visible (fboundp 'make-frame-command)
-             :help ,(purecopy "Open a new frame")))
-
-(define-key menu-bar-file-menu [one-window]
-  `(menu-item ,(purecopy "Remove Splits") delete-other-windows
-             :enable (not (one-window-p t nil))
-             :help ,(purecopy "Selected window grows to fill the whole frame")))
-
-(define-key menu-bar-file-menu [split-window]
-  `(menu-item ,(purecopy "Split Window") split-window-vertically
-             :enable (and (menu-bar-menu-frame-live-and-visible-p)
-                          (menu-bar-non-minibuffer-window-p))
-             :help ,(purecopy "Split selected window in two windows")))
-
-(define-key menu-bar-file-menu [separator-window]
-  menu-bar-separator)
-
-(define-key menu-bar-file-menu [ps-print-region]
-  `(menu-item ,(purecopy "Postscript Print Region (B+W)") ps-print-region
-             :enable mark-active
-             :help ,(purecopy "Pretty-print marked region in black and white to PostScript printer")))
-(define-key menu-bar-file-menu [ps-print-buffer]
-  `(menu-item ,(purecopy "Postscript Print Buffer (B+W)") ps-print-buffer
-             :enable (menu-bar-menu-frame-live-and-visible-p)
-             :help ,(purecopy "Pretty-print current buffer in black and white to PostScript printer")))
-(define-key menu-bar-file-menu [ps-print-region-faces]
-  `(menu-item ,(purecopy "Postscript Print Region") ps-print-region-with-faces
-             :enable mark-active
-             :help ,(purecopy "Pretty-print marked region to PostScript printer")))
-(define-key menu-bar-file-menu [ps-print-buffer-faces]
-  `(menu-item ,(purecopy "Postscript Print Buffer") ps-print-buffer-with-faces
-             :enable (menu-bar-menu-frame-live-and-visible-p)
-             :help ,(purecopy "Pretty-print current buffer to PostScript printer")))
-(define-key menu-bar-file-menu [print-region]
-  `(menu-item ,(purecopy "Print Region") print-region
-             :enable mark-active
-             :help ,(purecopy "Print region between mark and current position")))
-(define-key menu-bar-file-menu [print-buffer]
-  `(menu-item ,(purecopy "Print Buffer") print-buffer
-             :enable (menu-bar-menu-frame-live-and-visible-p)
-             :help ,(purecopy "Print current buffer with page headings")))
-
-(define-key menu-bar-file-menu [separator-print]
-  menu-bar-separator)
-
-(define-key menu-bar-file-menu [recover-session]
-  `(menu-item ,(purecopy "Recover Crashed Session") recover-session
-             :enable (and auto-save-list-file-prefix
-                          (file-directory-p
-                            (file-name-directory auto-save-list-file-prefix))
-                           (directory-files
-                           (file-name-directory auto-save-list-file-prefix)
-                           nil
-                           (concat "\\`"
-                                   (regexp-quote
-                                    (file-name-nondirectory
-                                     auto-save-list-file-prefix)))
-                           t))
-             :help ,(purecopy "Recover edits from a crashed session")))
-(define-key menu-bar-file-menu [revert-buffer]
-  `(menu-item ,(purecopy "Revert Buffer") revert-buffer
-             :enable (or revert-buffer-function
-                         revert-buffer-insert-file-contents-function
-                         (and buffer-file-number
-                              (or (buffer-modified-p)
-                                  (not (verify-visited-file-modtime
-                                        (current-buffer))))))
-             :help ,(purecopy "Re-read current buffer from its file")))
-(define-key menu-bar-file-menu [write-file]
-  `(menu-item ,(purecopy "Save As...") write-file
-             :enable (and (menu-bar-menu-frame-live-and-visible-p)
-                          (menu-bar-non-minibuffer-window-p))
-             :help ,(purecopy "Write current buffer to another file")))
-(define-key menu-bar-file-menu [save-buffer]
-  `(menu-item ,(purecopy "Save") save-buffer
-             :enable (and (buffer-modified-p)
-                          (buffer-file-name)
-                          (menu-bar-non-minibuffer-window-p))
-             :help ,(purecopy "Save current buffer to its file")))
-
-(define-key menu-bar-file-menu [separator-save]
-  menu-bar-separator)
-
-(defun menu-find-file-existing ()
-  "Edit the existing file FILENAME."
-  (interactive)
-  (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
-                             (x-uses-old-gtk-dialog))))
-        (filename (car (find-file-read-args "Find file: " mustmatch))))
-    (if mustmatch
-       (find-file-existing filename)
-      (find-file filename))))
-
-
-(define-key menu-bar-file-menu [kill-buffer]
-  `(menu-item ,(purecopy "Close") kill-this-buffer
-             :enable (kill-this-buffer-enabled-p)
-             :help ,(purecopy "Discard (kill) current buffer")))
-(define-key menu-bar-file-menu [insert-file]
-  `(menu-item ,(purecopy "Insert File...") insert-file
-             :enable (menu-bar-non-minibuffer-window-p)
-             :help ,(purecopy "Insert another file into current buffer")))
-(define-key menu-bar-file-menu [dired]
-  `(menu-item ,(purecopy "Open Directory...") dired
-             :enable (menu-bar-non-minibuffer-window-p)
-             :help ,(purecopy "Read a directory, to operate on its files")))
-(define-key menu-bar-file-menu [open-file]
-  `(menu-item ,(purecopy "Open File...") menu-find-file-existing
-             :enable (menu-bar-non-minibuffer-window-p)
-             :help ,(purecopy "Read an existing file into an Emacs buffer")))
-(define-key menu-bar-file-menu [new-file]
-  `(menu-item ,(purecopy "Visit New File...") find-file
-             :enable (menu-bar-non-minibuffer-window-p)
-             :help ,(purecopy "Specify a new file's name, to edit the file")))
-
-\f
-;; The "Edit" menu items
-
-;; The "Edit->Search" submenu
-(defvar menu-bar-last-search-type nil
-  "Type of last non-incremental search command called from the menu.")
-
-(defun nonincremental-repeat-search-forward ()
-  "Search forward for the previous search string or regexp."
-  (interactive)
-  (cond
-   ((and (eq menu-bar-last-search-type 'string)
-        search-ring)
-    (search-forward (car search-ring)))
-   ((and (eq menu-bar-last-search-type 'regexp)
-        regexp-search-ring)
-    (re-search-forward (car regexp-search-ring)))
-   (t
-    (error "No previous search"))))
-
-(defun nonincremental-repeat-search-backward ()
-  "Search backward for the previous search string or regexp."
-  (interactive)
-  (cond
-   ((and (eq menu-bar-last-search-type 'string)
-        search-ring)
-    (search-backward (car search-ring)))
-   ((and (eq menu-bar-last-search-type 'regexp)
-        regexp-search-ring)
-    (re-search-backward (car regexp-search-ring)))
-   (t
-    (error "No previous search"))))
-
-(defun nonincremental-search-forward (string)
-  "Read a string and search for it nonincrementally."
-  (interactive "sSearch for string: ")
-  (setq menu-bar-last-search-type 'string)
-  (if (equal string "")
-      (search-forward (car search-ring))
-    (isearch-update-ring string nil)
-    (search-forward string)))
-
-(defun nonincremental-search-backward (string)
-  "Read a string and search backward for it nonincrementally."
-  (interactive "sSearch for string: ")
-  (setq menu-bar-last-search-type 'string)
-  (if (equal string "")
-      (search-backward (car search-ring))
-    (isearch-update-ring string nil)
-    (search-backward string)))
-
-(defun nonincremental-re-search-forward (string)
-  "Read a regular expression and search for it nonincrementally."
-  (interactive "sSearch for regexp: ")
-  (setq menu-bar-last-search-type 'regexp)
-  (if (equal string "")
-      (re-search-forward (car regexp-search-ring))
-    (isearch-update-ring string t)
-    (re-search-forward string)))
-
-(defun nonincremental-re-search-backward (string)
-  "Read a regular expression and search backward for it nonincrementally."
-  (interactive "sSearch for regexp: ")
-  (setq menu-bar-last-search-type 'regexp)
-  (if (equal string "")
-      (re-search-backward (car regexp-search-ring))
-    (isearch-update-ring string t)
-    (re-search-backward string)))
-
-(defvar menu-bar-search-menu (make-sparse-keymap "Search"))
-
-;; The Edit->Search->Incremental Search menu
-(defvar menu-bar-i-search-menu
-  (make-sparse-keymap "Incremental Search"))
-
-(define-key menu-bar-i-search-menu [isearch-backward-regexp]
-  `(menu-item ,(purecopy "Backward Regexp...") isearch-backward-regexp
-             :help ,(purecopy "Search backwards for a regular expression as you type it")))
-(define-key menu-bar-i-search-menu [isearch-forward-regexp]
-  `(menu-item ,(purecopy "Forward Regexp...") isearch-forward-regexp
-             :help ,(purecopy "Search forward for a regular expression as you type it")))
-(define-key menu-bar-i-search-menu [isearch-backward]
-  `(menu-item ,(purecopy "Backward String...") isearch-backward
-             :help ,(purecopy "Search backwards for a string as you type it")))
-(define-key menu-bar-i-search-menu [isearch-forward]
-  `(menu-item ,(purecopy "Forward String...") isearch-forward
-             :help ,(purecopy "Search forward for a string as you type it")))
-
-(define-key menu-bar-search-menu [i-search]
-  `(menu-item ,(purecopy "Incremental Search") ,menu-bar-i-search-menu))
-(define-key menu-bar-search-menu [separator-tag-isearch]
-  menu-bar-separator)
-
-(define-key menu-bar-search-menu [tags-continue]
-  `(menu-item ,(purecopy "Continue Tags Search") tags-loop-continue
-             :help ,(purecopy "Continue last tags search operation")))
-(define-key menu-bar-search-menu [tags-srch]
-  `(menu-item ,(purecopy "Search Tagged Files...") tags-search
-             :help ,(purecopy "Search for a regexp in all tagged files")))
-(define-key menu-bar-search-menu [separator-tag-search]
-  menu-bar-separator)
-
-(define-key menu-bar-search-menu [repeat-search-back]
-  `(menu-item ,(purecopy "Repeat Backwards") nonincremental-repeat-search-backward
-             :enable (or (and (eq menu-bar-last-search-type 'string)
-                              search-ring)
-                         (and (eq menu-bar-last-search-type 'regexp)
-                              regexp-search-ring))
-             :help ,(purecopy "Repeat last search backwards")))
-(define-key menu-bar-search-menu [repeat-search-fwd]
-  `(menu-item ,(purecopy "Repeat Forward") nonincremental-repeat-search-forward
-             :enable (or (and (eq menu-bar-last-search-type 'string)
-                              search-ring)
-                         (and (eq menu-bar-last-search-type 'regexp)
-                              regexp-search-ring))
-             :help ,(purecopy "Repeat last search forward")))
-(define-key menu-bar-search-menu [separator-repeat-search]
-  menu-bar-separator)
-
-(define-key menu-bar-search-menu [re-search-backward]
-  `(menu-item ,(purecopy "Regexp Backwards...") nonincremental-re-search-backward
-             :help ,(purecopy "Search backwards for a regular expression")))
-(define-key menu-bar-search-menu [re-search-forward]
-  `(menu-item ,(purecopy "Regexp Forward...") nonincremental-re-search-forward
-             :help ,(purecopy "Search forward for a regular expression")))
-
-(define-key menu-bar-search-menu [search-backward]
-  `(menu-item ,(purecopy "String Backwards...") nonincremental-search-backward
-             :help ,(purecopy "Search backwards for a string")))
-(define-key menu-bar-search-menu [search-forward]
-  `(menu-item ,(purecopy "String Forward...") nonincremental-search-forward
-             :help ,(purecopy "Search forward for a string")))
-
-;; The Edit->Replace submenu
-
-(defvar menu-bar-replace-menu (make-sparse-keymap "Replace"))
-
-(define-key menu-bar-replace-menu [tags-repl-continue]
-  `(menu-item ,(purecopy "Continue Replace") tags-loop-continue
-             :help ,(purecopy "Continue last tags replace operation")))
-(define-key menu-bar-replace-menu [tags-repl]
-  `(menu-item ,(purecopy "Replace in Tagged Files...") tags-query-replace
-             :help ,(purecopy "Interactively replace a regexp in all tagged files")))
-(define-key menu-bar-replace-menu [separator-replace-tags]
-  menu-bar-separator)
-
-(define-key menu-bar-replace-menu [query-replace-regexp]
-  `(menu-item ,(purecopy "Replace Regexp...") query-replace-regexp
-             :enable (not buffer-read-only)
-             :help ,(purecopy "Replace regular expression interactively, ask about each occurrence")))
-(define-key menu-bar-replace-menu [query-replace]
-  `(menu-item ,(purecopy "Replace String...") query-replace
-             :enable (not buffer-read-only)
-             :help ,(purecopy "Replace string interactively, ask about each occurrence")))
-
-;;; Assemble the top-level Edit menu items.
-(define-key menu-bar-edit-menu [props]
-  `(menu-item ,(purecopy "Text Properties") facemenu-menu))
-
-;; ns-win.el said: Add spell for platorm consistency.
-(if (featurep 'ns)
-    (define-key menu-bar-edit-menu [spell]
-      `(menu-item ,(purecopy "Spell") ispell-menu-map)))
-
-(define-key menu-bar-edit-menu [fill]
-  `(menu-item ,(purecopy "Fill") fill-region
-             :enable (and mark-active (not buffer-read-only))
-             :help
-             ,(purecopy "Fill text in region to fit between left and right margin")))
-
-(define-key menu-bar-edit-menu [separator-bookmark]
-  menu-bar-separator)
-
-(define-key menu-bar-edit-menu [bookmark]
-  `(menu-item ,(purecopy "Bookmarks") menu-bar-bookmark-map))
-
-(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
-
-(define-key menu-bar-goto-menu [set-tags-name]
-  `(menu-item ,(purecopy "Set Tags File Name...") visit-tags-table
-             :help ,(purecopy "Tell Tags commands which tag table file to use")))
-
-(define-key menu-bar-goto-menu [separator-tag-file]
-  menu-bar-separator)
-
-(define-key menu-bar-goto-menu [apropos-tags]
-  `(menu-item ,(purecopy "Tags Apropos...") tags-apropos
-             :help ,(purecopy "Find function/variables whose names match regexp")))
-(define-key menu-bar-goto-menu [next-tag-otherw]
-  `(menu-item ,(purecopy "Next Tag in Other Window")
-             menu-bar-next-tag-other-window
-             :enable (and (boundp 'tags-location-ring)
-                          (not (ring-empty-p tags-location-ring)))
-             :help ,(purecopy "Find next function/variable matching last tag name in another window")))
-
-(defun menu-bar-next-tag-other-window ()
-  "Find the next definition of the tag already specified."
-  (interactive)
-  (find-tag-other-window nil t))
-
-(defun menu-bar-next-tag ()
-  "Find the next definition of the tag already specified."
-  (interactive)
-  (find-tag nil t))
-
-(define-key menu-bar-goto-menu [next-tag]
-  `(menu-item ,(purecopy "Find Next Tag")
-             menu-bar-next-tag
-             :enable (and (boundp 'tags-location-ring)
-                          (not (ring-empty-p tags-location-ring)))
-             :help ,(purecopy "Find next function/variable matching last tag name")))
-(define-key menu-bar-goto-menu [find-tag-otherw]
-  `(menu-item ,(purecopy "Find Tag in Other Window...") find-tag-other-window
-             :help ,(purecopy "Find function/variable definition in another window")))
-(define-key menu-bar-goto-menu [find-tag]
-  `(menu-item ,(purecopy "Find Tag...") find-tag
-             :help ,(purecopy "Find definition of function or variable")))
-
-(define-key menu-bar-goto-menu [separator-tags]
-  menu-bar-separator)
-
-(define-key menu-bar-goto-menu [end-of-buf]
-  `(menu-item ,(purecopy "Goto End of Buffer") end-of-buffer))
-(define-key menu-bar-goto-menu [beg-of-buf]
-  `(menu-item ,(purecopy "Goto Beginning of Buffer") beginning-of-buffer))
-(define-key menu-bar-goto-menu [go-to-pos]
-  `(menu-item ,(purecopy "Goto Buffer Position...") goto-char
-             :help ,(purecopy "Read a number N and go to buffer position N")))
-(define-key menu-bar-goto-menu [go-to-line]
-  `(menu-item ,(purecopy "Goto Line...") goto-line
-             :help ,(purecopy "Read a line number and go to that line")))
-
-(define-key menu-bar-edit-menu [goto]
-  `(menu-item ,(purecopy "Go To") ,menu-bar-goto-menu))
-
-(define-key menu-bar-edit-menu [replace]
-  `(menu-item ,(purecopy "Replace") ,menu-bar-replace-menu))
-
-(define-key menu-bar-edit-menu [search]
-  `(menu-item ,(purecopy "Search") ,menu-bar-search-menu))
-
-(define-key menu-bar-edit-menu [separator-search]
-  menu-bar-separator)
-
-(define-key menu-bar-edit-menu [mark-whole-buffer]
-  `(menu-item ,(purecopy "Select All") mark-whole-buffer
-             :help ,(purecopy "Mark the whole buffer for a subsequent cut/copy")))
-(define-key menu-bar-edit-menu [clear]
-  `(menu-item ,(purecopy "Clear") delete-region
-             :enable (and mark-active
-                          (not buffer-read-only))
-             :help
-             ,(purecopy "Delete the text in region between mark and current position")))
-(defvar yank-menu (cons (purecopy "Select Yank") nil))
-(fset 'yank-menu (cons 'keymap yank-menu))
-(define-key menu-bar-edit-menu (if (featurep 'ns) [select-paste]
-                                 [paste-from-menu])
-  ;; ns-win.el said: Change text to be more consistent with
-  ;; surrounding menu items `paste', etc."
-  `(menu-item ,(purecopy (if (featurep 'ns) "Select and Paste"
-                           "Paste from Kill Menu")) yank-menu
-             :enable (and (cdr yank-menu) (not buffer-read-only))
-             :help ,(purecopy "Choose a string from the kill ring and paste it")))
-(define-key menu-bar-edit-menu [paste]
-  `(menu-item ,(purecopy "Paste") yank
-             :enable (and (or
-                           ;; Emacs compiled --without-x (or --with-ns)
-                           ;; doesn't have x-selection-exists-p.
-                           (and (fboundp 'x-selection-exists-p)
-                                (x-selection-exists-p 'CLIPBOARD))
-                           (if (featurep 'ns) ; like paste-from-menu
-                               (cdr yank-menu)
-                             kill-ring))
-                          (not buffer-read-only))
-             :help ,(purecopy "Paste (yank) text most recently cut/copied")))
-(define-key menu-bar-edit-menu [copy]
-  ;; ns-win.el said: Substitute a Copy function that works better
-  ;; under X (for GNUstep).
-  `(menu-item ,(purecopy "Copy") ,(if (featurep 'ns)
-                                      'ns-copy-including-secondary
-                                    'kill-ring-save)
-              :enable mark-active
-              :help ,(purecopy "Copy text in region between mark and current position")
-              :keys ,(purecopy (if (featurep 'ns)
-                                   "\\[ns-copy-including-secondary]"
-                                 "\\[kill-ring-save]"))))
-(define-key menu-bar-edit-menu [cut]
-  `(menu-item ,(purecopy "Cut") kill-region
-             :enable (and mark-active (not buffer-read-only))
-             :help
-             ,(purecopy "Cut (kill) text in region between mark and current position")))
-;; ns-win.el said: Separate undo from cut/paste section.
-(if (featurep 'ns)
-    (define-key menu-bar-edit-menu [separator-undo] menu-bar-separator))
-
-(define-key menu-bar-edit-menu [undo]
-  `(menu-item ,(purecopy "Undo") undo
-             :enable (and (not buffer-read-only)
-                          (not (eq t buffer-undo-list))
-                          (if (eq last-command 'undo)
-                              (listp pending-undo-list)
-                            (consp buffer-undo-list)))
-             :help ,(purecopy "Undo last operation")))
-
-(define-obsolete-function-alias
-  'menu-bar-kill-ring-save 'kill-ring-save "24.1")
-
-;; These are alternative definitions for the cut, paste and copy
-;; menu items.  Use them if your system expects these to use the clipboard.
-
-(put 'clipboard-kill-region 'menu-enable
-     '(and mark-active (not buffer-read-only)))
-(put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
-(put 'clipboard-yank 'menu-enable
-     '(and (or (not (fboundp 'x-selection-exists-p))
-              (x-selection-exists-p)
-              (x-selection-exists-p 'CLIPBOARD))
-          (not buffer-read-only)))
-
-(defun clipboard-yank ()
-  "Insert the clipboard contents, or the last stretch of killed text."
-  (interactive "*")
-  (let ((x-select-enable-clipboard t))
-    (yank)))
-
-(defun clipboard-kill-ring-save (beg end)
-  "Copy region to kill ring, and save in the X clipboard."
-  (interactive "r")
-  (let ((x-select-enable-clipboard t))
-    (kill-ring-save beg end)))
-
-(defun clipboard-kill-region (beg end)
-  "Kill the region, and save it in the X clipboard."
-  (interactive "r")
-  (let ((x-select-enable-clipboard t))
-    (kill-region beg end)))
-
-(defun menu-bar-enable-clipboard ()
-  "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
-Do the same for the keys of the same name."
-  (interactive)
-  ;; These are Sun server keysyms for the Cut, Copy and Paste keys
-  ;; (also for XFree86 on Sun keyboard):
-  (define-key global-map [f20] 'clipboard-kill-region)
-  (define-key global-map [f16] 'clipboard-kill-ring-save)
-  (define-key global-map [f18] 'clipboard-yank)
-  ;; X11R6 versions:
-  (define-key global-map [cut] 'clipboard-kill-region)
-  (define-key global-map [copy] 'clipboard-kill-ring-save)
-  (define-key global-map [paste] 'clipboard-yank))
-\f
-;; The "Options" menu items
-
-(defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))
-
-(define-key menu-bar-custom-menu [customize-apropos-faces]
-  `(menu-item ,(purecopy "Faces Matching...") customize-apropos-faces
-             :help ,(purecopy "Browse faces matching a regexp or word list")))
-(define-key menu-bar-custom-menu [customize-apropos-options]
-  `(menu-item ,(purecopy "Options Matching...") customize-apropos-options
-             :help ,(purecopy "Browse options matching a regexp or word list")))
-(define-key menu-bar-custom-menu [customize-apropos]
-  `(menu-item ,(purecopy "All Settings Matching...") customize-apropos
-             :help ,(purecopy "Browse customizable settings matching a regexp or word list")))
-(define-key menu-bar-custom-menu [separator-1]
-  menu-bar-separator)
-(define-key menu-bar-custom-menu [customize-group]
-  `(menu-item ,(purecopy "Specific Group...") customize-group
-             :help ,(purecopy "Customize settings of specific group")))
-(define-key menu-bar-custom-menu [customize-face]
-  `(menu-item ,(purecopy "Specific Face...") customize-face
-             :help ,(purecopy "Customize attributes of specific face")))
-(define-key menu-bar-custom-menu [customize-option]
-  `(menu-item ,(purecopy "Specific Option...") customize-option
-             :help ,(purecopy "Customize value of specific option")))
-(define-key menu-bar-custom-menu [separator-2]
-  menu-bar-separator)
-(define-key menu-bar-custom-menu [customize-changed-options]
-  `(menu-item ,(purecopy "New Options...") customize-changed-options
-             :help ,(purecopy "Options added or changed in recent Emacs versions")))
-(define-key menu-bar-custom-menu [customize-saved]
-  `(menu-item ,(purecopy "Saved Options") customize-saved
-             :help ,(purecopy "Customize previously saved options")))
-(define-key menu-bar-custom-menu [separator-3]
-  menu-bar-separator)
-(define-key menu-bar-custom-menu [customize-browse]
-  `(menu-item ,(purecopy "Browse Customization Groups") customize-browse
-             :help ,(purecopy "Browse all customization groups")))
-(define-key menu-bar-custom-menu [customize]
-  `(menu-item ,(purecopy "Top-level Customization Group") customize
-             :help ,(purecopy "The master group called `Emacs'")))
-(define-key menu-bar-custom-menu [customize-themes]
-  `(menu-item ,(purecopy "Custom Themes") customize-themes
-             :help ,(purecopy "Choose a pre-defined customization theme")))
-
-;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
-
-(defmacro menu-bar-make-mm-toggle (fname doc help &optional props)
-  "Make a menu-item for a global minor mode toggle.
-FNAME is the minor mode's name (variable and function).
-DOC is the text to use for the menu entry.
-HELP is the text to use for the tooltip.
-PROPS are additional properties."
-  `(list 'menu-item  (purecopy ,doc) ',fname
-        ,@(mapcar (lambda (p) (list 'quote p)) props)
-        :help (purecopy ,help)
-        :button '(:toggle . (and (default-boundp ',fname)
-                                 (default-value ',fname)))))
-
-(defmacro menu-bar-make-toggle (name variable doc message help &rest body)
-  `(progn
-     (defun ,name (&optional interactively)
-       ,(concat "Toggle whether to " (downcase (substring help 0 1))
-               (substring help 1) ".
-In an interactive call, record this option as a candidate for saving
-by \"Save Options\" in Custom buffers.")
-       (interactive "p")
-       (if ,(if body `(progn . ,body)
-             `(progn
-                (custom-load-symbol ',variable)
-                (let ((set (or (get ',variable 'custom-set) 'set-default))
-                      (get (or (get ',variable 'custom-get) 'default-value)))
-                  (funcall set ',variable (not (funcall get ',variable))))))
-          (message ,message "enabled globally")
-        (message ,message "disabled globally"))
-       ;; The function `customize-mark-as-set' must only be called when
-       ;; a variable is set interactively, as the purpose is to mark it as
-       ;; a candidate for "Save Options", and we do not want to save options
-       ;; the user have already set explicitly in his init file.
-       (if interactively (customize-mark-as-set ',variable)))
-     (list 'menu-item (purecopy ,doc) ',name
-          :help (purecopy ,help)
-          :button '(:toggle . (and (default-boundp ',variable)
-                                   (default-value ',variable))))))
-
-;; Function for setting/saving default font.
-
-(defun menu-set-font ()
-  "Interactively select a font and make it the default."
-  (interactive)
-  (let ((font (if (fboundp 'x-select-font)
-                 (x-select-font)
-               (mouse-select-font)))
-       spec)
-    (when font
-      ;; Be careful here: when set-face-attribute is called for the
-      ;; :font attribute, Emacs tries to guess the best matching font
-      ;; by examining the other face attributes (Bug#2476).
-      (set-face-attribute 'default (selected-frame)
-                         :width 'normal
-                         :weight 'normal
-                         :slant 'normal
-                         :font font)
-      (let ((font-object (face-attribute 'default :font)))
-       (dolist (f (frame-list))
-         (and (not (eq f (selected-frame)))
-              (display-graphic-p f)
-              (set-face-attribute 'default f :font font-object)))
-       (set-face-attribute 'default t :font font-object))
-      (setq spec (list (list t (face-attr-construct 'default))))
-      (put 'default 'customized-face spec)
-      (custom-push-theme 'theme-face 'default 'user 'set spec)
-      (put 'default 'face-modified nil))))
-
-
-
-;;; Assemble all the top-level items of the "Options" menu
-(define-key menu-bar-options-menu [customize]
-  `(menu-item ,(purecopy "Customize Emacs") ,menu-bar-custom-menu))
-
-(defun menu-bar-options-save ()
-  "Save current values of Options menu items using Custom."
-  (interactive)
-  (let ((need-save nil))
-    ;; These are set with menu-bar-make-mm-toggle, which does not
-    ;; put on a customized-value property.
-    (dolist (elt '(line-number-mode column-number-mode size-indication-mode
-                  cua-mode show-paren-mode transient-mark-mode
-                  blink-cursor-mode display-time-mode display-battery-mode
-                  ;; These are set by other functions that don't set
-                  ;; the customized state.  Having them here has the
-                  ;; side-effect that turning them off via X
-                  ;; resources acts like having customized them, but
-                  ;; that seems harmless.
-                  menu-bar-mode tool-bar-mode))
-      ;; FIXME ? It's a little annoying that running this command
-      ;; always loads cua-base, paren, time, and battery, even if they
-      ;; have not been customized in any way.  (Due to custom-load-symbol.)
-      (and (customize-mark-to-save elt)
-          (setq need-save t)))
-    ;; These are set with `customize-set-variable'.
-    (dolist (elt '(scroll-bar-mode
-                  debug-on-quit debug-on-error
-                  ;; Somehow this works, when tool-bar and menu-bar don't.
-                  tooltip-mode
-                  save-place uniquify-buffer-name-style fringe-mode
-                  indicate-empty-lines indicate-buffer-boundaries
-                  case-fold-search font-use-system-font
-                  current-language-environment default-input-method
-                  ;; Saving `text-mode-hook' is somewhat questionable,
-                  ;; as we might get more than we bargain for, if
-                  ;; other code may has added hooks as well.
-                  ;; Nonetheless, not saving it would like be confuse
-                  ;; more often.
-                  ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
-                  text-mode-hook tool-bar-position))
-      (and (get elt 'customized-value)
-          (customize-mark-to-save elt)
-          (setq need-save t)))
-    (when (get 'default 'customized-face)
-      (put 'default 'saved-face (get 'default 'customized-face))
-      (put 'default 'customized-face nil)
-      (setq need-save t))
-    ;; Save if we changed anything.
-    (when need-save
-      (custom-save-all))))
-
-(define-key menu-bar-options-menu [package]
-  '(menu-item "Manage Emacs Packages" package-list-packages
-             :help "Install or uninstall additional Emacs packages"))
-
-(define-key menu-bar-options-menu [save]
-  `(menu-item ,(purecopy "Save Options") menu-bar-options-save
-             :help ,(purecopy "Save options set from the menu above")))
-
-(define-key menu-bar-options-menu [custom-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-options-menu [menu-set-font]
-  `(menu-item ,(purecopy "Set Default Font...") menu-set-font
-             :visible (display-multi-font-p)
-             :help ,(purecopy "Select a default font")))
-
-(if (featurep 'system-font-setting)
-    (define-key menu-bar-options-menu [menu-system-font]
-      (menu-bar-make-toggle toggle-use-system-font font-use-system-font
-                           "Use system font"
-                           "Use system font: %s"
-                           "Use the monospaced font defined by the system")))
-
-
-;; The "Show/Hide" submenu of menu "Options"
-
-(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
-
-(define-key menu-bar-showhide-menu [column-number-mode]
-  (menu-bar-make-mm-toggle column-number-mode
-                          "Column Numbers"
-                          "Show the current column number in the mode line"))
-
-(define-key menu-bar-showhide-menu [line-number-mode]
-  (menu-bar-make-mm-toggle line-number-mode
-                          "Line Numbers"
-                          "Show the current line number in the mode line"))
-
-(define-key menu-bar-showhide-menu [size-indication-mode]
-  (menu-bar-make-mm-toggle size-indication-mode
-                          "Size Indication"
-                          "Show the size of the buffer in the mode line"))
-
-(define-key menu-bar-showhide-menu [linecolumn-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-showhide-menu [showhide-battery]
-  (menu-bar-make-mm-toggle display-battery-mode
-                          "Battery Status"
-                          "Display battery status information in mode line"))
-
-(define-key menu-bar-showhide-menu [showhide-date-time]
-  (menu-bar-make-mm-toggle display-time-mode
-                          "Time, Load and Mail"
-                          "Display time, system load averages and \
-mail status in mode line"))
-
-(define-key menu-bar-showhide-menu [datetime-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-showhide-menu [showhide-speedbar]
-  `(menu-item ,(purecopy "Speedbar") speedbar-frame-mode
-             :help ,(purecopy "Display a Speedbar quick-navigation frame")
-             :button (:toggle
-                      . (and (boundp 'speedbar-frame)
-                             (frame-live-p (symbol-value 'speedbar-frame))
-                             (frame-visible-p
-                              (symbol-value 'speedbar-frame))))))
-
-(defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
-
-(defvar menu-bar-showhide-fringe-ind-menu
-  (make-sparse-keymap "Buffer boundaries"))
-
-(defun menu-bar-showhide-fringe-ind-customize ()
-  "Show customization buffer for `indicate-buffer-boundaries'."
-  (interactive)
-  (customize-variable 'indicate-buffer-boundaries))
-
-(define-key menu-bar-showhide-fringe-ind-menu [customize]
-  `(menu-item ,(purecopy "Other (Customize)")
-             menu-bar-showhide-fringe-ind-customize
-             :help ,(purecopy "Additional choices available through Custom buffer")
-             :visible (display-graphic-p)
-             :button (:radio . (not (member indicate-buffer-boundaries
-                                            '(nil left right
-                                              ((top . left) (bottom . right))
-                                              ((t . right) (top . left))))))))
-
-(defun menu-bar-showhide-fringe-ind-mixed ()
-  "Display top and bottom indicators in opposite fringes, arrows in right."
-  (interactive)
-  (customize-set-variable 'indicate-buffer-boundaries
-                         '((t . right) (top . left))))
-
-(define-key menu-bar-showhide-fringe-ind-menu [mixed]
-  `(menu-item ,(purecopy "Opposite, Arrows Right") menu-bar-showhide-fringe-ind-mixed
-             :help
-             ,(purecopy "Show top/bottom indicators in opposite fringes, arrows in right")
-             :visible (display-graphic-p)
-             :button (:radio . (equal indicate-buffer-boundaries
-                                      '((t . right) (top . left))))))
-
-(defun menu-bar-showhide-fringe-ind-box ()
-  "Display top and bottom indicators in opposite fringes."
-  (interactive)
-  (customize-set-variable 'indicate-buffer-boundaries
-                         '((top . left) (bottom . right))))
-
-(define-key menu-bar-showhide-fringe-ind-menu [box]
-  `(menu-item ,(purecopy "Opposite, No Arrows") menu-bar-showhide-fringe-ind-box
-             :help ,(purecopy "Show top/bottom indicators in opposite fringes, no arrows")
-             :visible (display-graphic-p)
-             :button (:radio . (equal indicate-buffer-boundaries
-                                      '((top . left) (bottom . right))))))
-
-(defun menu-bar-showhide-fringe-ind-right ()
-  "Display buffer boundaries and arrows in the right fringe."
-  (interactive)
-  (customize-set-variable 'indicate-buffer-boundaries 'right))
-
-(define-key menu-bar-showhide-fringe-ind-menu [right]
-  `(menu-item ,(purecopy "In Right Fringe") menu-bar-showhide-fringe-ind-right
-             :help ,(purecopy "Show buffer boundaries and arrows in right fringe")
-             :visible (display-graphic-p)
-             :button (:radio . (eq indicate-buffer-boundaries 'right))))
-
-(defun menu-bar-showhide-fringe-ind-left ()
-  "Display buffer boundaries and arrows in the left fringe."
-  (interactive)
-  (customize-set-variable 'indicate-buffer-boundaries 'left))
-
-(define-key menu-bar-showhide-fringe-ind-menu [left]
-  `(menu-item ,(purecopy "In Left Fringe") menu-bar-showhide-fringe-ind-left
-             :help ,(purecopy "Show buffer boundaries and arrows in left fringe")
-             :visible (display-graphic-p)
-             :button (:radio . (eq indicate-buffer-boundaries 'left))))
-
-(defun menu-bar-showhide-fringe-ind-none ()
-  "Do not display any buffer boundary indicators."
-  (interactive)
-  (customize-set-variable 'indicate-buffer-boundaries nil))
-
-(define-key menu-bar-showhide-fringe-ind-menu [none]
-  `(menu-item ,(purecopy "No Indicators") menu-bar-showhide-fringe-ind-none
-             :help ,(purecopy "Hide all buffer boundary indicators and arrows")
-             :visible (display-graphic-p)
-             :button (:radio . (eq indicate-buffer-boundaries nil))))
-
-(define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind]
-  `(menu-item ,(purecopy "Buffer Boundaries") ,menu-bar-showhide-fringe-ind-menu
-             :visible (display-graphic-p)
-             :help ,(purecopy "Indicate buffer boundaries in fringe")))
-
-(define-key menu-bar-showhide-fringe-menu [indicate-empty-lines]
-  (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines
-                       "Empty Line Indicators"
-                       "Indicating of empty lines %s"
-                       "Indicate trailing empty lines in fringe, globally"))
-
-(defun menu-bar-showhide-fringe-menu-customize ()
-  "Show customization buffer for `fringe-mode'."
-  (interactive)
-  (customize-variable 'fringe-mode))
-
-(define-key menu-bar-showhide-fringe-menu [customize]
-  `(menu-item ,(purecopy "Customize Fringe") menu-bar-showhide-fringe-menu-customize
-             :help ,(purecopy "Detailed customization of fringe")
-             :visible (display-graphic-p)))
-
-(defun menu-bar-showhide-fringe-menu-customize-reset ()
-  "Reset the fringe mode: display fringes on both sides of a window."
-  (interactive)
-  (customize-set-variable 'fringe-mode nil))
-
-(define-key menu-bar-showhide-fringe-menu [default]
-  `(menu-item ,(purecopy "Default") menu-bar-showhide-fringe-menu-customize-reset
-             :help ,(purecopy "Default width fringe on both left and right side")
-             :visible (display-graphic-p)
-             :button (:radio . (eq fringe-mode nil))))
-
-(defun menu-bar-showhide-fringe-menu-customize-right ()
-  "Display fringes only on the right of each window."
-  (interactive)
-  (require 'fringe)
-  (customize-set-variable 'fringe-mode '(0 . nil)))
-
-(define-key menu-bar-showhide-fringe-menu [right]
-  `(menu-item ,(purecopy "On the Right") menu-bar-showhide-fringe-menu-customize-right
-             :help ,(purecopy "Fringe only on the right side")
-             :visible (display-graphic-p)
-             :button (:radio . (equal fringe-mode '(0 . nil)))))
-
-(defun menu-bar-showhide-fringe-menu-customize-left ()
-  "Display fringes only on the left of each window."
-  (interactive)
-  (require 'fringe)
-  (customize-set-variable 'fringe-mode '(nil . 0)))
-
-(define-key menu-bar-showhide-fringe-menu [left]
-  `(menu-item ,(purecopy "On the Left") menu-bar-showhide-fringe-menu-customize-left
-             :help ,(purecopy "Fringe only on the left side")
-             :visible (display-graphic-p)
-             :button (:radio . (equal fringe-mode '(nil . 0)))))
-
-(defun menu-bar-showhide-fringe-menu-customize-disable ()
-  "Do not display window fringes."
-  (interactive)
-  (require 'fringe)
-  (customize-set-variable 'fringe-mode 0))
-
-(define-key menu-bar-showhide-fringe-menu [none]
-  `(menu-item ,(purecopy "None") menu-bar-showhide-fringe-menu-customize-disable
-             :help ,(purecopy "Turn off fringe")
-             :visible (display-graphic-p)
-             :button (:radio . (eq fringe-mode 0))))
-
-(define-key menu-bar-showhide-menu [showhide-fringe]
-  `(menu-item ,(purecopy "Fringe") ,menu-bar-showhide-fringe-menu
-             :visible (display-graphic-p)))
-
-(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
-
-(define-key menu-bar-showhide-scroll-bar-menu [right]
-  `(menu-item ,(purecopy "On the Right")
-             menu-bar-right-scroll-bar
-             :help ,(purecopy "Scroll-bar on the right side")
-             :visible (display-graphic-p)
-             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
-                                              (frame-parameters))) 'right))))
-(defun menu-bar-right-scroll-bar ()
-  "Display scroll bars on the right of each window."
-  (interactive)
-  (customize-set-variable 'scroll-bar-mode 'right))
-
-(define-key menu-bar-showhide-scroll-bar-menu [left]
-  `(menu-item ,(purecopy "On the Left")
-             menu-bar-left-scroll-bar
-             :help ,(purecopy "Scroll-bar on the left side")
-             :visible (display-graphic-p)
-             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
-                                              (frame-parameters))) 'left))))
-
-(defun menu-bar-left-scroll-bar ()
-  "Display scroll bars on the left of each window."
-  (interactive)
-  (customize-set-variable 'scroll-bar-mode 'left))
-
-(define-key menu-bar-showhide-scroll-bar-menu [none]
-  `(menu-item ,(purecopy "None")
-             menu-bar-no-scroll-bar
-             :help ,(purecopy "Turn off scroll-bar")
-             :visible (display-graphic-p)
-             :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
-                                              (frame-parameters))) nil))))
-
-(defun menu-bar-no-scroll-bar ()
-  "Turn off scroll bars."
-  (interactive)
-  (customize-set-variable 'scroll-bar-mode nil))
-
-(define-key menu-bar-showhide-menu [showhide-scroll-bar]
-  `(menu-item ,(purecopy "Scroll-bar") ,menu-bar-showhide-scroll-bar-menu
-             :visible (display-graphic-p)))
-
-(define-key menu-bar-showhide-menu [showhide-tooltip-mode]
-  `(menu-item ,(purecopy "Tooltips") tooltip-mode
-             :help ,(purecopy "Turn tooltips on/off")
-             :visible (and (display-graphic-p) (fboundp 'x-show-tip))
-             :button (:toggle . tooltip-mode)))
-
-(defun menu-bar-frame-for-menubar ()
-  "Return the frame suitable for updating the menu bar."
-  (or (and (framep menu-updating-frame)
-          menu-updating-frame)
-      (selected-frame)))
-
-(defun menu-bar-positive-p (val)
-  "Return non-nil iff VAL is a positive number."
-  (and (numberp val)
-       (> val 0)))
-
-(define-key menu-bar-showhide-menu [menu-bar-mode]
-  `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
-             :help ,(purecopy "Turn menu-bar on/off")
-             :button
-             (:toggle . (menu-bar-positive-p
-                         (frame-parameter (menu-bar-frame-for-menubar)
-                                          'menu-bar-lines)))))
-
-(defun menu-bar-set-tool-bar-position (position)
-  (customize-set-variable 'tool-bar-mode t)
-  (customize-set-variable 'tool-bar-position position))
-(defun menu-bar-showhide-tool-bar-menu-customize-disable ()
-  "Do not display tool bars."
-  (interactive)
-  (customize-set-variable 'tool-bar-mode nil))
-(defun menu-bar-showhide-tool-bar-menu-customize-enable-left ()
-  "Display tool bars on the left side."
-  (interactive)
-  (menu-bar-set-tool-bar-position 'left))
-(defun menu-bar-showhide-tool-bar-menu-customize-enable-right ()
-  "Display tool bars on the right side."
-  (interactive)
-  (menu-bar-set-tool-bar-position 'right))
-(defun menu-bar-showhide-tool-bar-menu-customize-enable-top ()
-  "Display tool bars on the top side."
-  (interactive)
-  (menu-bar-set-tool-bar-position 'top))
-(defun menu-bar-showhide-tool-bar-menu-customize-enable-bottom ()
-  "Display tool bars on the bottom side."
-  (interactive)
-  (menu-bar-set-tool-bar-position 'bottom))
-
-(if (featurep 'move-toolbar)
-    (progn
-      (defvar menu-bar-showhide-tool-bar-menu (make-sparse-keymap "Tool-bar"))
-
-      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-left]
-       `(menu-item ,(purecopy "On the left")
-                   menu-bar-showhide-tool-bar-menu-customize-enable-left
-                   :help ,(purecopy "Tool-bar at the left side")
-                   :visible (display-graphic-p)
-                   :button
-                   (:radio . (and tool-bar-mode
-                                  (eq (frame-parameter
-                                       (menu-bar-frame-for-menubar)
-                                       'tool-bar-position)
-                                      'left)))))
-
-      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right]
-       `(menu-item ,(purecopy "On the right")
-                   menu-bar-showhide-tool-bar-menu-customize-enable-right
-                   :help ,(purecopy "Tool-bar at the right side")
-                   :visible (display-graphic-p)
-                   :button
-                   (:radio . (and tool-bar-mode
-                                  (eq (frame-parameter
-                                       (menu-bar-frame-for-menubar)
-                                       'tool-bar-position)
-                                      'right)))))
-
-      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom]
-       `(menu-item ,(purecopy "On the bottom")
-                   menu-bar-showhide-tool-bar-menu-customize-enable-bottom
-                   :help ,(purecopy "Tool-bar at the bottom")
-                   :visible (display-graphic-p)
-                   :button
-                   (:radio . (and tool-bar-mode
-                                  (eq (frame-parameter
-                                       (menu-bar-frame-for-menubar)
-                                       'tool-bar-position)
-                                      'bottom)))))
-
-      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top]
-       `(menu-item ,(purecopy "On the top")
-                   menu-bar-showhide-tool-bar-menu-customize-enable-top
-                   :help ,(purecopy "Tool-bar at the top")
-                   :visible (display-graphic-p)
-                   :button
-                   (:radio . (and tool-bar-mode
-                                  (eq (frame-parameter
-                                       (menu-bar-frame-for-menubar)
-                                       'tool-bar-position)
-                                      'top)))))
-
-      (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none]
-       `(menu-item ,(purecopy "None")
-                   menu-bar-showhide-tool-bar-menu-customize-disable
-                   :help ,(purecopy "Turn tool-bar off")
-                   :visible (display-graphic-p)
-                   :button (:radio . (eq tool-bar-mode nil))))
-
-      (define-key menu-bar-showhide-menu [showhide-tool-bar]
-       `(menu-item ,(purecopy "Tool-bar") ,menu-bar-showhide-tool-bar-menu
-                   :visible (display-graphic-p)))
-
-      )
-  ;; else not tool bar that can move.
-  (define-key menu-bar-showhide-menu [showhide-tool-bar]
-    `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
-               :help ,(purecopy "Turn tool-bar on/off")
-               :visible (display-graphic-p)
-               :button
-               (:toggle . (menu-bar-positive-p
-                           (frame-parameter (menu-bar-frame-for-menubar)
-                                            'tool-bar-lines))))))
-
-(define-key menu-bar-options-menu [showhide]
-  `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))
-
-(define-key menu-bar-options-menu [showhide-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-options-menu [mule]
-  ;; It is better not to use backquote here,
-  ;; because that makes a bootstrapping problem
-  ;; if you need to recompile all the Lisp files using interpreted code.
-  `(menu-item ,(purecopy "Multilingual Environment") ,mule-menu-keymap
-;; Most of the MULE menu actually does make sense in unibyte mode,
-;; e.g. language selection.
-;;;    :visible '(default-value 'enable-multibyte-characters)
-       ))
-;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
-;(define-key menu-bar-options-menu [preferences]
-;  `(menu-item ,(purecopy "Preferences") ,menu-bar-preferences-menu
-;            :help ,(purecopy "Toggle important global options")))
-
-(define-key menu-bar-options-menu [mule-separator]
-   menu-bar-separator)
-
-(define-key menu-bar-options-menu [debug-on-quit]
-  (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
-                       "Enter Debugger on Quit/C-g" "Debug on Quit %s"
-                       "Enter Lisp debugger when C-g is pressed"))
-(define-key menu-bar-options-menu [debug-on-error]
-  (menu-bar-make-toggle toggle-debug-on-error debug-on-error
-                       "Enter Debugger on Error" "Debug on Error %s"
-                       "Enter Lisp debugger when an error is signaled"))
-(define-key menu-bar-options-menu [debugger-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-options-menu [blink-cursor-mode]
-  (menu-bar-make-mm-toggle blink-cursor-mode
-                          "Blinking Cursor"
-                          "Whether the cursor blinks (Blink Cursor mode)"))
-(define-key menu-bar-options-menu [cursor-separator]
-  menu-bar-separator)
-
-(define-key menu-bar-options-menu [save-place]
-  (menu-bar-make-toggle toggle-save-place-globally save-place
-                       "Save Place in Files between Sessions"
-                       "Saving place in files %s"
-                       "Visit files of previous session when restarting Emacs"
-                        (require 'saveplace)
-                        ;; Do it by name, to avoid a free-variable
-                        ;; warning during byte compilation.
-                        (set-default
-                         'save-place (not (symbol-value 'save-place)))))
-
-(define-key menu-bar-options-menu [uniquify]
-  (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
-                       "Use Directory Names in Buffer Names"
-                       "Directory name in buffer names (uniquify) %s"
-                       "Uniquify buffer names by adding parent directory names"
-                       (require 'uniquify)
-                       (setq uniquify-buffer-name-style
-                             (if (not uniquify-buffer-name-style)
-                                 'forward))))
-
-(define-key menu-bar-options-menu [edit-options-separator]
-  menu-bar-separator)
-(define-key menu-bar-options-menu [cua-mode]
-  (menu-bar-make-mm-toggle cua-mode
-                          "C-x/C-c/C-v Cut and Paste (CUA)"
-                          "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
-                          (:visible (or (not (boundp 'cua-enable-cua-keys))
-                                        cua-enable-cua-keys))))
-
-(define-key menu-bar-options-menu [cua-emulation-mode]
-  (menu-bar-make-mm-toggle cua-mode
-                          "Shift movement mark region (CUA)"
-                          "Use shifted movement keys to set and extend the region"
-                          (:visible (and (boundp 'cua-enable-cua-keys)
-                                         (not cua-enable-cua-keys)))))
-
-(define-key menu-bar-options-menu [case-fold-search]
-  (menu-bar-make-toggle toggle-case-fold-search case-fold-search
-           "Case-Insensitive Search"
-           "Case-Insensitive Search %s"
-           "Ignore letter-case in search commands"))
-
-(defun menu-bar-text-mode-auto-fill ()
-  (interactive)
-  (toggle-text-mode-auto-fill)
-  ;; This is somewhat questionable, as `text-mode-hook'
-  ;; might have changed outside customize.
-  ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
-  (customize-mark-as-set 'text-mode-hook))
-
-(define-key menu-bar-options-menu [auto-fill-mode]
-  `(menu-item ,(purecopy "Auto Fill in Text Modes")
-              menu-bar-text-mode-auto-fill
-             :help ,(purecopy "Automatically fill text while typing (Auto Fill mode)")
-              :button (:toggle . (if (listp text-mode-hook)
-                                    (member 'turn-on-auto-fill text-mode-hook)
-                                  (eq 'turn-on-auto-fill text-mode-hook)))))
-
-
-(defvar menu-bar-line-wrapping-menu (make-sparse-keymap "Line Wrapping"))
-
-(define-key menu-bar-line-wrapping-menu [word-wrap]
-  `(menu-item ,(purecopy "Word Wrap (Visual Line mode)")
-             (lambda ()
-               (interactive)
-               (unless visual-line-mode
-                 (visual-line-mode 1))
-               (message ,(purecopy "Visual-Line mode enabled")))
-             :help ,(purecopy "Wrap long lines at word boundaries")
-             :button (:radio . (and (null truncate-lines)
-                                    (not (truncated-partial-width-window-p))
-                                    word-wrap))
-             :visible (menu-bar-menu-frame-live-and-visible-p)))
-
-(define-key menu-bar-line-wrapping-menu [truncate]
-  `(menu-item ,(purecopy "Truncate Long Lines")
-             (lambda ()
-               (interactive)
-               (if visual-line-mode (visual-line-mode 0))
-               (setq word-wrap nil)
-               (toggle-truncate-lines 1))
-             :help ,(purecopy "Truncate long lines at window edge")
-             :button (:radio . (or truncate-lines
-                                   (truncated-partial-width-window-p)))
-             :visible (menu-bar-menu-frame-live-and-visible-p)
-             :enable (not (truncated-partial-width-window-p))))
-
-(define-key menu-bar-line-wrapping-menu [window-wrap]
-  `(menu-item ,(purecopy "Wrap at Window Edge")
-             (lambda () (interactive)
-               (if visual-line-mode (visual-line-mode 0))
-               (setq word-wrap nil)
-               (if truncate-lines (toggle-truncate-lines -1)))
-             :help ,(purecopy "Wrap long lines at window edge")
-             :button (:radio . (and (null truncate-lines)
-                                    (not (truncated-partial-width-window-p))
-                                    (not word-wrap)))
-             :visible (menu-bar-menu-frame-live-and-visible-p)
-             :enable (not (truncated-partial-width-window-p))))
-
-(define-key menu-bar-options-menu [line-wrapping]
-  `(menu-item ,(purecopy "Line Wrapping in this Buffer") ,menu-bar-line-wrapping-menu))
-
-
-(define-key menu-bar-options-menu [highlight-separator]
-  menu-bar-separator)
-(define-key menu-bar-options-menu [highlight-paren-mode]
-  (menu-bar-make-mm-toggle show-paren-mode
-                          "Paren Match Highlighting"
-                          "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
-(define-key menu-bar-options-menu [transient-mark-mode]
-  (menu-bar-make-mm-toggle transient-mark-mode
-                          "Active Region Highlighting"
-                          "Make text in active region stand out in color (Transient Mark mode)"
-                          (:enable (not cua-mode))))
-
-\f
-;; The "Tools" menu items
-
-(defun send-mail-item-name ()
-  (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
-                                    (mh-e-user-agent . "MH")
-                                    (message-user-agent . "Gnus Message")
-                                    (gnus-user-agent . "Gnus")))
-        (name (assq mail-user-agent known-send-mail-commands)))
-    (if name
-       (setq name (cdr name))
-      (setq name (symbol-name mail-user-agent))
-      (if (string-match "\\(.+\\)-user-agent" name)
-         (setq name (match-string 1 name))))
-    name))
-
-(defun read-mail-item-name ()
-  (let* ((known-rmail-commands '((rmail . "RMAIL")
-                                (mh-rmail . "MH")
-                                (gnus . "Gnus")))
-        (known (assq read-mail-command known-rmail-commands)))
-    (if known (cdr known) (symbol-name read-mail-command))))
-
-(defvar menu-bar-games-menu (make-sparse-keymap "Games"))
-
-(define-key menu-bar-tools-menu [games]
-  `(menu-item ,(purecopy "Games") ,menu-bar-games-menu))
-
-(define-key menu-bar-tools-menu [separator-games]
-  menu-bar-separator)
-
-(define-key menu-bar-games-menu [zone]
-  `(menu-item ,(purecopy "Zone Out")  zone
-             :help ,(purecopy "Play tricks with Emacs display when Emacs is idle")))
-(define-key menu-bar-games-menu [tetris]
-  `(menu-item ,(purecopy "Tetris")  tetris
-              :help ,(purecopy "Falling blocks game")))
-(define-key menu-bar-games-menu [solitaire]
-  `(menu-item ,(purecopy "Solitaire")  solitaire
-              :help ,(purecopy "Get rid of all the stones")))
-(define-key menu-bar-games-menu [snake]
-  `(menu-item ,(purecopy "Snake")  snake
-             :help ,(purecopy "Move snake around avoiding collisions")))
-(define-key menu-bar-games-menu [pong]
-  `(menu-item ,(purecopy "Pong") pong
-             :help ,(purecopy "Bounce the ball to your opponent")))
-(define-key menu-bar-games-menu [mult]
-  `(menu-item ,(purecopy "Multiplication Puzzle")  mpuz
-             :help ,(purecopy "Exercise brain with multiplication")))
-(define-key menu-bar-games-menu [life]
-  `(menu-item ,(purecopy "Life")  life
-             :help ,(purecopy "Watch how John Conway's cellular automaton evolves")))
-(define-key menu-bar-games-menu [land]
-  `(menu-item ,(purecopy "Landmark") landmark
-             :help ,(purecopy "Watch a neural-network robot learn landmarks")))
-(define-key menu-bar-games-menu [hanoi]
-  `(menu-item ,(purecopy "Towers of Hanoi") hanoi
-             :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs")))
-(define-key menu-bar-games-menu [gomoku]
-  `(menu-item ,(purecopy "Gomoku")  gomoku
-             :help ,(purecopy "Mark 5 contiguous squares (like tic-tac-toe)")))
-(define-key menu-bar-games-menu [bubbles]
-  `(menu-item ,(purecopy "Bubbles") bubbles
-             :help ,(purecopy "Remove all bubbles using the fewest moves")))
-(define-key menu-bar-games-menu [black-box]
-  `(menu-item ,(purecopy "Blackbox")  blackbox
-             :help ,(purecopy "Find balls in a black box by shooting rays")))
-(define-key menu-bar-games-menu [adventure]
-  `(menu-item ,(purecopy "Adventure")  dunnet
-             :help ,(purecopy "Dunnet, a text Adventure game for Emacs")))
-(define-key menu-bar-games-menu [5x5]
-  `(menu-item ,(purecopy "5x5") 5x5
-             :help ,(purecopy "Fill in all the squares on a 5x5 board")))
-
-(defvar menu-bar-encryption-decryption-menu
-  (make-sparse-keymap "Encryption/Decryption"))
-
-(define-key menu-bar-tools-menu [encryption-decryption]
-  `(menu-item ,(purecopy "Encryption/Decryption") ,menu-bar-encryption-decryption-menu))
-
-(define-key menu-bar-tools-menu [separator-encryption-decryption]
-  menu-bar-separator)
-
-(define-key menu-bar-encryption-decryption-menu [insert-keys]
-  `(menu-item ,(purecopy "Insert Keys") epa-insert-keys
-             :help ,(purecopy "Insert public keys after the current point")))
-
-(define-key menu-bar-encryption-decryption-menu [export-keys]
-  `(menu-item ,(purecopy "Export Keys") epa-export-keys
-             :help ,(purecopy "Export public keys to a file")))
-
-(define-key menu-bar-encryption-decryption-menu [import-keys-region]
-  `(menu-item ,(purecopy "Import Keys from Region") epa-import-keys-region
-             :help ,(purecopy "Import public keys from the current region")))
-
-(define-key menu-bar-encryption-decryption-menu [import-keys]
-  `(menu-item ,(purecopy "Import Keys from File...") epa-import-keys
-             :help ,(purecopy "Import public keys from a file")))
-
-(define-key menu-bar-encryption-decryption-menu [list-keys]
-  `(menu-item ,(purecopy "List Keys") epa-list-keys
-             :help ,(purecopy "Browse your public keyring")))
-
-(define-key menu-bar-encryption-decryption-menu [separator-keys]
-  menu-bar-separator)
-
-(define-key menu-bar-encryption-decryption-menu [sign-region]
-  `(menu-item ,(purecopy "Sign Region") epa-sign-region
-             :help ,(purecopy "Create digital signature of the current region")))
-
-(define-key menu-bar-encryption-decryption-menu [verify-region]
-  `(menu-item ,(purecopy "Verify Region") epa-verify-region
-             :help ,(purecopy "Verify digital signature of the current region")))
-
-(define-key menu-bar-encryption-decryption-menu [encrypt-region]
-  `(menu-item ,(purecopy "Encrypt Region") epa-encrypt-region
-             :help ,(purecopy "Encrypt the current region")))
-
-(define-key menu-bar-encryption-decryption-menu [decrypt-region]
-  `(menu-item ,(purecopy "Decrypt Region") epa-decrypt-region
-             :help ,(purecopy "Decrypt the current region")))
-
-(define-key menu-bar-encryption-decryption-menu [separator-file]
-  menu-bar-separator)
-
-(define-key menu-bar-encryption-decryption-menu [sign-file]
-  `(menu-item ,(purecopy "Sign File...") epa-sign-file
-             :help ,(purecopy "Create digital signature of a file")))
-
-(define-key menu-bar-encryption-decryption-menu [verify-file]
-  `(menu-item ,(purecopy "Verify File...") epa-verify-file
-             :help ,(purecopy "Verify digital signature of a file")))
-
-(define-key menu-bar-encryption-decryption-menu [encrypt-file]
-  `(menu-item ,(purecopy "Encrypt File...") epa-encrypt-file
-             :help ,(purecopy "Encrypt a file")))
-
-(define-key menu-bar-encryption-decryption-menu [decrypt-file]
-  `(menu-item ,(purecopy "Decrypt File...") epa-decrypt-file
-             :help ,(purecopy "Decrypt a file")))
-
-(define-key menu-bar-tools-menu [simple-calculator]
-  `(menu-item ,(purecopy "Simple Calculator") calculator
-             :help ,(purecopy "Invoke the Emacs built-in quick calculator")))
-(define-key menu-bar-tools-menu [calc]
-  `(menu-item ,(purecopy "Programmable Calculator") calc
-             :help ,(purecopy "Invoke the Emacs built-in full scientific calculator")))
-(define-key menu-bar-tools-menu [calendar]
-  `(menu-item ,(purecopy "Calendar") calendar
-             :help ,(purecopy "Invoke the Emacs built-in calendar")))
-
-(define-key menu-bar-tools-menu [separator-net]
-  menu-bar-separator)
-
-(define-key menu-bar-tools-menu [directory-search]
-  `(menu-item ,(purecopy "Directory Search") eudc-tools-menu))
-(define-key menu-bar-tools-menu [compose-mail]
-  `(menu-item (format "Send Mail (with %s)" (send-mail-item-name)) compose-mail
-             :visible (and mail-user-agent (not (eq mail-user-agent 'ignore)))
-             :help ,(purecopy "Send a mail message")))
-(define-key menu-bar-tools-menu [rmail]
-  `(menu-item (format "Read Mail (with %s)" (read-mail-item-name))
-              menu-bar-read-mail
-             :visible (and read-mail-command
-                            (not (eq read-mail-command 'ignore)))
-             :help ,(purecopy "Read your mail and reply to it")))
-
-(defun menu-bar-read-mail ()
-  "Read mail using `read-mail-command'."
-  (interactive)
-  (call-interactively read-mail-command))
-
-(define-key menu-bar-tools-menu [gnus]
-  `(menu-item ,(purecopy "Read Net News (Gnus)") gnus
-             :help ,(purecopy "Read network news groups")))
-
-(define-key menu-bar-tools-menu [separator-vc]
-  menu-bar-separator)
-
-(define-key menu-bar-tools-menu [pcl-cvs]
-  `(menu-item ,(purecopy "PCL-CVS") cvs-global-menu))
-(define-key menu-bar-tools-menu [vc] nil) ;Create the place for the VC menu.
-
-(define-key menu-bar-tools-menu [separator-compare]
-  menu-bar-separator)
-
-(define-key menu-bar-tools-menu [epatch]
-  `(menu-item ,(purecopy "Apply Patch") menu-bar-epatch-menu))
-(define-key menu-bar-tools-menu [ediff-merge]
-  `(menu-item ,(purecopy "Merge") menu-bar-ediff-merge-menu))
-(define-key menu-bar-tools-menu [compare]
-  `(menu-item ,(purecopy "Compare (Ediff)") menu-bar-ediff-menu))
-
-(define-key menu-bar-tools-menu [separator-spell]
-  menu-bar-separator)
-
-(define-key menu-bar-tools-menu [spell]
-  `(menu-item ,(purecopy "Spell Checking") ispell-menu-map))
-
-(define-key menu-bar-tools-menu [separator-prog]
-  menu-bar-separator)
-
-(define-key menu-bar-tools-menu [semantic]
-  `(menu-item ,(purecopy "Source Code Parsers (Semantic)")
-             semantic-mode
-             :help ,(purecopy "Toggle automatic parsing in source code buffers (Semantic mode)")
-             :button (:toggle . (bound-and-true-p semantic-mode))))
-
-(define-key menu-bar-tools-menu [ede]
-  `(menu-item ,(purecopy "Project support (EDE)")
-             global-ede-mode
-             :help ,(purecopy "Toggle the Emacs Development Environment (Global EDE mode)")
-             :button (:toggle . (bound-and-true-p global-ede-mode))))
-
-(define-key menu-bar-tools-menu [gdb]
-  `(menu-item ,(purecopy "Debugger (GDB)...") gdb
-             :help ,(purecopy "Debug a program from within Emacs with GDB")))
-(define-key menu-bar-tools-menu [shell-on-region]
-  `(menu-item ,(purecopy "Shell Command on Region...") shell-command-on-region
-             :enable mark-active
-             :help ,(purecopy "Pass marked region to a shell command")))
-(define-key menu-bar-tools-menu [shell]
-  `(menu-item ,(purecopy "Shell Command...") shell-command
-             :help ,(purecopy "Invoke a shell command and catch its output")))
-(define-key menu-bar-tools-menu [compile]
-  `(menu-item ,(purecopy "Compile...") compile
-             :help ,(purecopy "Invoke compiler or Make, view compilation errors")))
-(define-key menu-bar-tools-menu [grep]
-  `(menu-item ,(purecopy "Search Files (Grep)...") grep
-             :help ,(purecopy "Search files for strings or regexps (with Grep)")))
-
-\f
-;; The "Help" menu items
-
-(defvar menu-bar-describe-menu (make-sparse-keymap "Describe"))
-
-(define-key menu-bar-describe-menu [mule-diag]
-  `(menu-item ,(purecopy "Show All of Mule Status") mule-diag
-             :visible (default-value 'enable-multibyte-characters)
-             :help ,(purecopy "Display multilingual environment settings")))
-(define-key menu-bar-describe-menu [describe-coding-system-briefly]
-  `(menu-item ,(purecopy "Describe Coding System (Briefly)")
-              describe-current-coding-system-briefly
-              :visible (default-value 'enable-multibyte-characters)))
-(define-key menu-bar-describe-menu [describe-coding-system]
-  `(menu-item ,(purecopy "Describe Coding System...") describe-coding-system
-             :visible (default-value 'enable-multibyte-characters)))
-(define-key menu-bar-describe-menu [describe-input-method]
-  `(menu-item ,(purecopy "Describe Input Method...") describe-input-method
-             :visible (default-value 'enable-multibyte-characters)
-             :help ,(purecopy "Keyboard layout for specific input method")))
-(define-key menu-bar-describe-menu [describe-language-environment]
-  `(menu-item ,(purecopy "Describe Language Environment")
-             ,describe-language-environment-map))
-
-(define-key menu-bar-describe-menu [separator-desc-mule]
-  menu-bar-separator)
-
-(define-key menu-bar-describe-menu [list-keybindings]
-  `(menu-item ,(purecopy "List Key Bindings") describe-bindings
-             :help ,(purecopy "Display all current key bindings (keyboard shortcuts)")))
-(define-key menu-bar-describe-menu [describe-current-display-table]
-  `(menu-item ,(purecopy "Describe Display Table") describe-current-display-table
-             :help ,(purecopy "Describe the current display table")))
-(define-key menu-bar-describe-menu [describe-package]
-  `(menu-item ,(purecopy "Describe Package...") describe-package
-              :help ,(purecopy "Display documentation of a Lisp package")))
-(define-key menu-bar-describe-menu [describe-face]
-  `(menu-item ,(purecopy "Describe Face...") describe-face
-              :help ,(purecopy "Display the properties of a face")))
-(define-key menu-bar-describe-menu [describe-variable]
-  `(menu-item ,(purecopy "Describe Variable...") describe-variable
-             :help ,(purecopy "Display documentation of variable/option")))
-(define-key menu-bar-describe-menu [describe-function]
-  `(menu-item ,(purecopy "Describe Function...") describe-function
-             :help ,(purecopy "Display documentation of function/command")))
-(define-key menu-bar-describe-menu [describe-key-1]
-  `(menu-item ,(purecopy "Describe Key or Mouse Operation...") describe-key
-             ;; Users typically don't identify keys and menu items...
-             :help ,(purecopy "Display documentation of command bound to a \
-key, a click, or a menu-item")))
-(define-key menu-bar-describe-menu [describe-mode]
-  `(menu-item ,(purecopy "Describe Buffer Modes") describe-mode
-             :help ,(purecopy "Describe this buffer's major and minor mode")))
-
-(defvar menu-bar-search-documentation-menu
-  (make-sparse-keymap "Search Documentation"))
-(defun menu-bar-read-lispref ()
-  "Display the Emacs Lisp Reference manual in Info mode."
-  (interactive)
-  (info "elisp"))
-
-(defun menu-bar-read-lispintro ()
-  "Display the Introduction to Emacs Lisp Programming in Info mode."
-  (interactive)
-  (info "eintr"))
-
-(defun search-emacs-glossary ()
-  "Display the Glossary node of the Emacs manual in Info mode."
-  (interactive)
-  (info "(emacs)Glossary"))
-
-(defun emacs-index-search (topic)
-  "Look up TOPIC in the indices of the Emacs User Manual."
-  (interactive "sSubject to look up: ")
-  (info "emacs")
-  (Info-index topic))
-
-(defun elisp-index-search (topic)
-  "Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
-  (interactive "sSubject to look up: ")
-  (info "elisp")
-  (Info-index topic))
-
-(define-key menu-bar-search-documentation-menu [search-documentation-strings]
-  `(menu-item ,(purecopy "Search Documentation Strings...") apropos-documentation
-              :help
-             ,(purecopy "Find functions and variables whose doc strings match a regexp")))
-(define-key menu-bar-search-documentation-menu [find-any-object-by-name]
-  `(menu-item ,(purecopy "Find Any Object by Name...") apropos
-              :help ,(purecopy "Find symbols of any kind whose names match a regexp")))
-(define-key menu-bar-search-documentation-menu [find-option-by-value]
-  `(menu-item ,(purecopy "Find Options by Value...") apropos-value
-              :help ,(purecopy "Find variables whose values match a regexp")))
-(define-key menu-bar-search-documentation-menu [find-options-by-name]
-  `(menu-item ,(purecopy "Find Options by Name...") apropos-variable
-             :help ,(purecopy "Find variables whose names match a regexp")))
-(define-key menu-bar-search-documentation-menu [find-commands-by-name]
-  `(menu-item ,(purecopy "Find Commands by Name...") apropos-command
-             :help ,(purecopy "Find commands whose names match a regexp")))
-(define-key menu-bar-search-documentation-menu [sep1]
-  menu-bar-separator)
-(define-key menu-bar-search-documentation-menu [lookup-command-in-manual]
-  `(menu-item ,(purecopy "Look Up Command in User Manual...") Info-goto-emacs-command-node
-             :help ,(purecopy "Display manual section that describes a command")))
-(define-key menu-bar-search-documentation-menu [lookup-key-in-manual]
-  `(menu-item ,(purecopy "Look Up Key in User Manual...") Info-goto-emacs-key-command-node
-             :help ,(purecopy "Display manual section that describes a key")))
-(define-key menu-bar-search-documentation-menu [lookup-subject-in-elisp-manual]
-  `(menu-item ,(purecopy "Look Up Subject in ELisp Manual...") elisp-index-search
-             :help ,(purecopy "Find description of a subject in Emacs Lisp manual")))
-(define-key menu-bar-search-documentation-menu [lookup-subject-in-emacs-manual]
-  `(menu-item ,(purecopy "Look Up Subject in User Manual...") emacs-index-search
-             :help ,(purecopy "Find description of a subject in Emacs User manual")))
-(define-key menu-bar-search-documentation-menu [emacs-terminology]
-  `(menu-item ,(purecopy "Emacs Terminology") search-emacs-glossary
-             :help ,(purecopy "Display the Glossary section of the Emacs manual")))
-
-(defvar menu-bar-manuals-menu (make-sparse-keymap "More Manuals"))
-
-(define-key menu-bar-manuals-menu [man]
-  `(menu-item ,(purecopy "Read Man Page...") manual-entry
-             :help ,(purecopy "Man-page docs for external commands and libraries")))
-(define-key menu-bar-manuals-menu [sep2]
-  menu-bar-separator)
-(define-key menu-bar-manuals-menu [order-emacs-manuals]
-  `(menu-item ,(purecopy "Ordering Manuals") view-order-manuals
-             :help ,(purecopy "How to order manuals from the Free Software Foundation")))
-(define-key menu-bar-manuals-menu [lookup-subject-in-all-manuals]
-  `(menu-item ,(purecopy "Lookup Subject in all Manuals...") info-apropos
-             :help ,(purecopy "Find description of a subject in all installed manuals")))
-(define-key menu-bar-manuals-menu [other-manuals]
-  `(menu-item ,(purecopy "All Other Manuals (Info)") Info-directory
-             :help ,(purecopy "Read any of the installed manuals")))
-(define-key menu-bar-manuals-menu [emacs-lisp-reference]
-  `(menu-item ,(purecopy "Emacs Lisp Reference") menu-bar-read-lispref
-             :help ,(purecopy "Read the Emacs Lisp Reference manual")))
-(define-key menu-bar-manuals-menu [emacs-lisp-intro]
-  `(menu-item ,(purecopy "Introduction to Emacs Lisp") menu-bar-read-lispintro
-             :help ,(purecopy "Read the Introduction to Emacs Lisp Programming")))
-
-(define-key menu-bar-help-menu [about-gnu-project]
-  `(menu-item ,(purecopy "About GNU") describe-gnu-project
-             :help ,(purecopy "About the GNU System, GNU Project, and GNU/Linux")))
-(define-key menu-bar-help-menu [about-emacs]
-  `(menu-item ,(purecopy "About Emacs") about-emacs
-             :help ,(purecopy "Display version number, copyright info, and basic help")))
-(define-key menu-bar-help-menu [sep4]
-  menu-bar-separator)
-(define-key menu-bar-help-menu [describe-no-warranty]
-  `(menu-item ,(purecopy "(Non)Warranty") describe-no-warranty
-             :help ,(purecopy "Explain that Emacs has NO WARRANTY")))
-(define-key menu-bar-help-menu [describe-copying]
-  `(menu-item ,(purecopy "Copying Conditions") describe-copying
-             :help ,(purecopy "Show the Emacs license (GPL)")))
-(define-key menu-bar-help-menu [getting-new-versions]
-  `(menu-item ,(purecopy "Getting New Versions") describe-distribution
-             :help ,(purecopy "How to get the latest version of Emacs")))
-(defun menu-bar-help-extra-packages ()
-  "Display help about some additional packages available for Emacs."
-  (interactive)
-  (let (enable-local-variables)
-    (view-file (expand-file-name "MORE.STUFF"
-                                data-directory))
-    (goto-address-mode 1)))
-(define-key menu-bar-help-menu [sep2]
-  menu-bar-separator)
-(define-key menu-bar-help-menu [external-packages]
-  `(menu-item ,(purecopy "Finding Extra Packages") menu-bar-help-extra-packages
-             :help ,(purecopy "Lisp packages distributed separately for use in Emacs")))
-(define-key menu-bar-help-menu [find-emacs-packages]
-  `(menu-item ,(purecopy "Search Built-in Packages") finder-by-keyword
-             :help ,(purecopy "Find built-in packages and features by keyword")))
-(define-key menu-bar-help-menu [more-manuals]
-  `(menu-item ,(purecopy "More Manuals") ,menu-bar-manuals-menu))
-(define-key menu-bar-help-menu [emacs-manual]
-  `(menu-item ,(purecopy "Read the Emacs Manual") info-emacs-manual
-             :help ,(purecopy "Full documentation of Emacs features")))
-(define-key menu-bar-help-menu [describe]
-  `(menu-item ,(purecopy "Describe") ,menu-bar-describe-menu))
-(define-key menu-bar-help-menu [search-documentation]
-  `(menu-item ,(purecopy "Search Documentation") ,menu-bar-search-documentation-menu))
-(define-key menu-bar-help-menu [sep1]
-  menu-bar-separator)
-(define-key menu-bar-help-menu [emacs-psychotherapist]
-  `(menu-item ,(purecopy "Emacs Psychotherapist") doctor
-             :help ,(purecopy "Our doctor will help you feel better")))
-(define-key menu-bar-help-menu [send-emacs-bug-report]
-  `(menu-item ,(purecopy "Send Bug Report...") report-emacs-bug
-             :help ,(purecopy "Send e-mail to Emacs maintainers")))
-(define-key menu-bar-help-menu [emacs-known-problems]
-  `(menu-item ,(purecopy "Emacs Known Problems") view-emacs-problems
-             :help ,(purecopy "Read about known problems with Emacs")))
-(define-key menu-bar-help-menu [emacs-news]
-  `(menu-item ,(purecopy "Emacs News") view-emacs-news
-             :help ,(purecopy "New features of this version")))
-(define-key menu-bar-help-menu [emacs-faq]
-  `(menu-item ,(purecopy "Emacs FAQ") view-emacs-FAQ
-             :help ,(purecopy "Frequently asked (and answered) questions about Emacs")))
-
-(defun help-with-tutorial-spec-language ()
-  "Use the Emacs tutorial, specifying which language you want."
-  (interactive)
-  (help-with-tutorial t))
-
-(define-key menu-bar-help-menu [emacs-tutorial-language-specific]
-  `(menu-item ,(purecopy "Emacs Tutorial (choose language)...")
-             help-with-tutorial-spec-language
-             :help ,(purecopy "Learn how to use Emacs (choose a language)")))
-(define-key menu-bar-help-menu [emacs-tutorial]
-  `(menu-item ,(purecopy "Emacs Tutorial") help-with-tutorial
-             :help ,(purecopy "Learn how to use Emacs")))
-
-;; In OS X it's in the app menu already.
-;; FIXME? There already is an "About Emacs" (sans ...) entry in the Help menu.
-(and (featurep 'ns)
-     (not (eq system-type 'darwin))
-     (define-key menu-bar-help-menu [info-panel]
-       `(menu-item ,(purecopy "About Emacs...") ns-do-emacs-info-panel)))
-
-(defun menu-bar-menu-frame-live-and-visible-p ()
-  "Return non-nil if the menu frame is alive and visible.
-The menu frame is the frame for which we are updating the menu."
-  (let ((menu-frame (or menu-updating-frame (selected-frame))))
-    (and (frame-live-p menu-frame)
-        (frame-visible-p menu-frame))))
-
-(defun menu-bar-non-minibuffer-window-p ()
-  "Return non-nil if selected window of the menu frame is not a minibuf window.
-
-See the documentation of `menu-bar-menu-frame-live-and-visible-p'
-for the definition of the menu frame."
-  (let ((menu-frame (or menu-updating-frame (selected-frame))))
-    (not (window-minibuffer-p (frame-selected-window menu-frame)))))
-
-(defun kill-this-buffer ()     ; for the menu bar
-  "Kill the current buffer.
-When called in the minibuffer, get out of the minibuffer
-using `abort-recursive-edit'."
-  (interactive)
-  (if (menu-bar-non-minibuffer-window-p)
-      (kill-buffer (current-buffer))
-    (abort-recursive-edit)))
-
-(defun kill-this-buffer-enabled-p ()
-  (let ((count 0)
-       (buffers (buffer-list)))
-    (while buffers
-      (or (string-match "^ " (buffer-name (car buffers)))
-         (setq count (1+ count)))
-      (setq buffers (cdr buffers)))
-    (or (not (menu-bar-non-minibuffer-window-p))
-       (> count 1))))
-
-(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
-
-;; Permit deleting frame if it would leave a visible or iconified frame.
-(defun delete-frame-enabled-p ()
-  "Return non-nil if `delete-frame' should be enabled in the menu bar."
-  (let ((frames (frame-list))
-       (count 0))
-    (while frames
-      (if (frame-visible-p (car frames))
-         (setq count (1+ count)))
-      (setq frames (cdr frames)))
-    (> count 1)))
-
-(defcustom yank-menu-length 20
-  "Maximum length to display in the yank-menu."
-  :type 'integer
-  :group 'menu)
-
-(defun menu-bar-update-yank-menu (string old)
-  (let ((front (car (cdr yank-menu)))
-       (menu-string (if (<= (length string) yank-menu-length)
-                        string
-                      (concat
-                       (substring string 0 (/ yank-menu-length 2))
-                       "..."
-                       (substring string (- (/ yank-menu-length 2)))))))
-    ;; Don't let the menu string be all dashes
-    ;; because that has a special meaning in a menu.
-    (if (string-match "\\`-+\\'" menu-string)
-       (setq menu-string (concat menu-string " ")))
-    ;; If we're supposed to be extending an existing string, and that
-    ;; string really is at the front of the menu, then update it in place.
-    (if (and old (or (eq old (car front))
-                    (string= old (car front))))
-       (progn
-         (setcar front string)
-         (setcar (cdr front) menu-string))
-      (setcdr yank-menu
-             (cons
-              (cons string (cons menu-string 'menu-bar-select-yank))
-              (cdr yank-menu)))))
-  (if (> (length (cdr yank-menu)) kill-ring-max)
-      (setcdr (nthcdr kill-ring-max yank-menu) nil)))
-
-(put 'menu-bar-select-yank 'apropos-inhibit t)
-(defun menu-bar-select-yank ()
-  "Insert the stretch of previously-killed text selected from menu.
-The menu shows all the killed text sequences stored in `kill-ring'."
-  (interactive "*")
-  (push-mark (point))
-  (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
-unless `uniquify-buffer-name-style' is non-nil (in which case, buffer
-names should include enough of a buffer's directory to distinguish it
-from other buffers).
-
-Setting this variable directly does not take effect until next time the
-Buffers menu is regenerated."
-  :set (lambda (symbol value)
-        (set symbol value)
-        (menu-bar-update-buffers t))
-  :initialize 'custom-initialize-default
-  :type '(choice (const :tag "Never" nil)
-                (const :tag "Unless uniquify is enabled" unless-uniquify)
-                (const :tag "Always" t))
-  :group 'menu)
-
-(defcustom buffers-menu-show-status t
-  "If non-nil, show modified/read-only status of buffers in the Buffers menu.
-Setting this variable directly does not take effect until next time the
-Buffers menu is regenerated."
-  :set (lambda (symbol value)
-        (set symbol value)
-        (menu-bar-update-buffers t))
-  :initialize 'custom-initialize-default
-  :type 'boolean
-  :group 'menu)
-
-(defvar list-buffers-directory nil
-  "String to display in buffer listings for buffers not visiting a file.")
-(make-variable-buffer-local 'list-buffers-directory)
-
-(defun menu-bar-select-buffer ()
-  (interactive)
-  (switch-to-buffer last-command-event))
-
-(defun menu-bar-select-frame (frame)
-  (make-frame-visible frame)
-  (raise-frame frame)
-  (select-frame frame))
-
-(defun menu-bar-update-buffers-1 (elt)
-  (let* ((buf (car elt))
-        (file
-         (and (if (eq buffers-menu-show-directories 'unless-uniquify)
-                  (or (not (boundp 'uniquify-buffer-name-style))
-                      (null uniquify-buffer-name-style))
-                buffers-menu-show-directories)
-              (or (buffer-file-name buf)
-                  (buffer-local-value 'list-buffers-directory buf)))))
-    (when file
-      (setq file (file-name-directory file)))
-    (when (and file (> (length file) 20))
-      (setq file (concat "..." (substring file -17))))
-    (cons (if buffers-menu-show-status
-             (let ((mod (if (buffer-modified-p buf) "*" ""))
-                   (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
-               (if file
-                   (format "%s  %s%s  --  %s" (cdr elt) mod ro file)
-                 (format "%s  %s%s" (cdr elt) mod ro)))
-           (if file
-               (format "%s  --  %s"  (cdr elt) file)
-             (cdr elt)))
-         buf)))
-
-;; Used to cache the menu entries for commands in the Buffers menu
-(defvar menu-bar-buffers-menu-command-entries nil)
-
-(defun menu-bar-update-buffers (&optional force)
-  ;; If user discards the Buffers item, play along.
-  (and (lookup-key (current-global-map) [menu-bar buffer])
-       (or force (frame-or-buffer-changed-p))
-       (let ((buffers (buffer-list))
-            (frames (frame-list))
-            buffers-menu)
-        ;; If requested, list only the N most recently selected buffers.
-        (if (and (integerp buffers-menu-max-size)
-                 (> buffers-menu-max-size 1))
-            (if (> (length buffers) buffers-menu-max-size)
-                (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
-
-        ;; Make the menu of buffers proper.
-        (setq buffers-menu
-              (let (alist)
-                ;; Put into each element of buffer-list
-                ;; the name for actual display,
-                ;; perhaps truncated in the middle.
-                (dolist (buf buffers)
-                  (let ((name (buffer-name buf)))
-                     (unless (eq ?\s (aref name 0))
-                       (push (menu-bar-update-buffers-1
-                              (cons buf
-                                   (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))
-                       (i (length alist)))
-                   (dolist (pair alist)
-                     (setq i (1- i))
-                     (aset buffers-vec i
-                          (nconc (list (car pair)
-                                       (cons nil nil))
-                                 `(lambda ()
-                                     (interactive)
-                                     (switch-to-buffer ,(cdr pair))))))
-                   (list buffers-vec))))
-
-        ;; Make a Frames menu if we have more than one frame.
-        (when (cdr frames)
-          (let* ((frames-vec (make-vector (length frames) nil))
-                  (frames-menu
-                   (cons 'keymap
-                         (list "Select Frame" frames-vec)))
-                  (i 0))
-             (dolist (frame frames)
-               (aset frames-vec i
-                     (nconc
-                      (list
-                       (frame-parameter frame 'name)
-                       (cons nil nil))
-                      `(lambda ()
-                         (interactive) (menu-bar-select-frame ,frame))))
-               (setq i (1+ i)))
-            ;; Put it after the normal buffers
-            (setq buffers-menu
-                  (nconc buffers-menu
-                         `((frames-separator "--")
-                           (frames menu-item "Frames" ,frames-menu))))))
-
-        ;; Add in some normal commands at the end of the menu.  We use
-        ;; the copy cached in `menu-bar-buffers-menu-command-entries'
-        ;; if it's been set already.  Note that we can't use constant
-        ;; lists for the menu-entries, because the low-level menu-code
-        ;; modifies them.
-        (unless menu-bar-buffers-menu-command-entries
-          (setq menu-bar-buffers-menu-command-entries
-                (list '(command-separator "--")
-                      (list 'next-buffer
-                            'menu-item
-                            "Next Buffer"
-                            'next-buffer
-                            :help "Switch to the \"next\" buffer in a cyclic order")
-                      (list 'previous-buffer
-                            'menu-item
-                            "Previous Buffer"
-                            'previous-buffer
-                            :help "Switch to the \"previous\" buffer in a cyclic order")
-                      (list 'select-named-buffer
-                            'menu-item
-                            "Select Named Buffer..."
-                            'switch-to-buffer
-                            :help "Prompt for a buffer name, and select that buffer in the current window")
-                      (list 'list-all-buffers
-                            'menu-item
-                            "List All Buffers"
-                            'list-buffers
-                            :help "Pop up a window listing all Emacs buffers"
-                            ))))
-        (setq buffers-menu
-              (nconc buffers-menu menu-bar-buffers-menu-command-entries))
-
-         ;; We used to "(define-key (current-global-map) [menu-bar buffer]"
-         ;; but that did not do the right thing when the [menu-bar buffer]
-         ;; entry above had been moved (e.g. to a parent keymap).
-        (setcdr global-buffers-menu-map (cons "Select Buffer" buffers-menu)))))
-
-(add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
-
-(menu-bar-update-buffers)
-
-;; this version is too slow
-;;(defun format-buffers-menu-line (buffer)
-;;  "Returns a string to represent the given buffer in the Buffer menu.
-;;nil means the buffer shouldn't be listed.  You can redefine this."
-;;  (if (string-match "\\` " (buffer-name buffer))
-;;      nil
-;;    (with-current-buffer buffer
-;;     (let ((size (buffer-size)))
-;;       (format "%s%s %-19s %6s %-15s %s"
-;;            (if (buffer-modified-p) "*" " ")
-;;            (if buffer-read-only "%" " ")
-;;            (buffer-name)
-;;            size
-;;            mode-name
-;;            (or (buffer-file-name) ""))))))
-\f
-;;; Set up a menu bar menu for the minibuffer.
-
-(dolist (map (list minibuffer-local-map
-                  ;; This shouldn't be necessary, but there's a funny
-                  ;; bug in keymap.c that I don't understand yet.  -stef
-                  minibuffer-local-completion-map))
-  (define-key map [menu-bar minibuf]
-    (cons (purecopy "Minibuf") (make-sparse-keymap "Minibuf"))))
-
-(let ((map minibuffer-local-completion-map))
-  (define-key map [menu-bar minibuf ?\?]
-    `(menu-item ,(purecopy "List Completions") minibuffer-completion-help
-               :help ,(purecopy "Display all possible completions")))
-  (define-key map [menu-bar minibuf space]
-    `(menu-item ,(purecopy "Complete Word") minibuffer-complete-word
-               :help ,(purecopy "Complete at most one word")))
-  (define-key map [menu-bar minibuf tab]
-    `(menu-item ,(purecopy "Complete") minibuffer-complete
-               :help ,(purecopy "Complete as far as possible"))))
-
-(let ((map minibuffer-local-map))
-  (define-key map [menu-bar minibuf quit]
-    `(menu-item ,(purecopy "Quit") abort-recursive-edit
-               :help ,(purecopy "Abort input and exit minibuffer")))
-  (define-key map [menu-bar minibuf return]
-    `(menu-item ,(purecopy "Enter") exit-minibuffer
-               :key-sequence ,(purecopy "\r")
-               :help ,(purecopy "Terminate input and exit minibuffer")))
-  (define-key map [menu-bar minibuf isearch-forward]
-    `(menu-item ,(purecopy "Isearch History Forward") isearch-forward
-               :help ,(purecopy "Incrementally search minibuffer history forward")))
-  (define-key map [menu-bar minibuf isearch-backward]
-    `(menu-item ,(purecopy "Isearch History Backward") isearch-backward
-               :help ,(purecopy "Incrementally search minibuffer history backward")))
-  (define-key map [menu-bar minibuf next]
-    `(menu-item ,(purecopy "Next History Item") next-history-element
-               :help ,(purecopy "Put next minibuffer history element in the minibuffer")))
-  (define-key map [menu-bar minibuf previous]
-    `(menu-item ,(purecopy "Previous History Item") previous-history-element
-               :help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
-\f
-(define-minor-mode menu-bar-mode
-  "Toggle display of a menu bar on each frame.
-This command applies to all frames that exist and frames to be
-created in the future.
-With a numeric argument, if the argument is positive,
-turn on menu bars; otherwise, turn off menu bars."
-  :init-value t
-  :global t
-  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
-  :variable menu-bar-mode
-
-  ;; Turn the menu-bars on all frames on or off.
-  (let ((val (if menu-bar-mode 1 0)))
-    (dolist (frame (frame-list))
-      (set-frame-parameter frame 'menu-bar-lines val))
-    ;; If the user has given `default-frame-alist' a `menu-bar-lines'
-    ;; parameter, replace it.
-    (if (assq 'menu-bar-lines default-frame-alist)
-       (setq default-frame-alist
-             (cons (cons 'menu-bar-lines val)
-                   (assq-delete-all 'menu-bar-lines
-                                    default-frame-alist)))))
-  ;; Make the message appear when Emacs is idle.  We can not call message
-  ;; directly.  The minor-mode message "Menu-bar mode disabled" comes
-  ;; after this function returns, overwriting any message we do here.
-  (when (and (called-interactively-p 'interactive) (not menu-bar-mode))
-    (run-with-idle-timer 0 nil 'message
-                        "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear.")))
-
-;;;###autoload
-;; (This does not work right unless it comes after the above definition.)
-;; This comment is taken from tool-bar.el near
-;; (put 'tool-bar-mode ...)
-;; We want to pretend the menu bar by standard is on, as this will make
-;; customize consider disabling the menu bar a customization, and save
-;; that.  We could do this for real by setting :init-value above, but
-;; that would overwrite disabling the menu bar from X resources.
-(put 'menu-bar-mode 'standard-value '(t))
-
-(defun toggle-menu-bar-mode-from-frame (&optional arg)
-  "Toggle menu bar on or off, based on the status of the current frame.
-See `menu-bar-mode' for more information."
-  (interactive (list (or current-prefix-arg 'toggle)))
-  (if (eq arg 'toggle)
-      (menu-bar-mode
-       (if (menu-bar-positive-p
-           (frame-parameter (menu-bar-frame-for-menubar) 'menu-bar-lines))
-           0 1))
-    (menu-bar-mode arg)))
-
-(declare-function x-menu-bar-open "term/x-win" (&optional frame))
-(declare-function w32-menu-bar-open "term/w32-win" (&optional frame))
-
-(defun menu-bar-open (&optional frame)
-  "Start key navigation of the menu bar in FRAME.
-
-This function decides which method to use to access the menu
-depending on FRAME's terminal device.  On X displays, it calls
-`x-menu-bar-open'; on Windows, `w32-menu-bar-open' otherwise it
-calls `tmm-menubar'.
-
-If FRAME is nil or not given, use the selected frame."
-  (interactive)
-  (let ((type (framep (or frame (selected-frame)))))
-    (cond
-     ((eq type 'x) (x-menu-bar-open frame))
-     ((eq type 'w32) (w32-menu-bar-open frame))
-     (t (with-selected-frame (or frame (selected-frame))
-          (tmm-menubar))))))
-
-(global-set-key [f10] 'menu-bar-open)
-
-(provide 'menu-bar)
-
-;;; menu-bar.el ends here
+;;; menu-bar.el --- define a default menu bar
+
+;; Copyright (C) 1993-1995, 2000-2011  Free Software Foundation, Inc.
+
+;; Author: RMS
+;; Maintainer: FSF
+;; Keywords: internal, mouse
+;; Package: emacs
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;; Avishai Yacobi suggested some menu rearrangements.
+
+;;; Commentary:
+
+;;; Code:
+
+;; This is referenced by some code below; it is defined in uniquify.el
+(defvar uniquify-buffer-name-style)
+
+;; From emulation/cua-base.el; used below
+(defvar cua-enable-cua-keys)
+
+
+;; 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])
+    (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
+
+(if (not (featurep 'ns))
+    ;; Force Help item to come last, after the major mode's own items.
+    ;; The symbol used to be called `help', but that gets confused with the
+    ;; help key.
+    (setq menu-bar-final-items '(help-menu))
+  (if (eq system-type 'darwin)
+      (setq menu-bar-final-items '(buffer services help-menu))
+    (setq menu-bar-final-items '(buffer services hide-app quit))
+    ;; Add standard top-level items to GNUstep menu.
+    (define-key global-map [menu-bar quit]
+      `(menu-item ,(purecopy "Quit") save-buffers-kill-emacs
+                  :help ,(purecopy "Save unsaved buffers, then exit")))
+    (define-key global-map [menu-bar hide-app]
+      `(menu-item ,(purecopy "Hide") ns-do-hide-emacs
+                  :help ,(purecopy "Hide Emacs"))))
+  (define-key global-map [menu-bar services] ; set-up in ns-win
+    (cons (purecopy "Services") (make-sparse-keymap "Services"))))
+
+;; This definition is just to show what this looks like.
+;; It gets modified in place when menu-bar-update-buffers is called.
+(defvar global-buffers-menu-map (make-sparse-keymap "Buffers"))
+
+;; Only declared obsolete (and only made a proper alias) in 23.3.
+(define-obsolete-variable-alias
+  'menu-bar-files-menu 'menu-bar-file-menu "22.1")
+(defvar menu-bar-file-menu
+  (let ((menu (make-sparse-keymap "File")))
+
+    ;; The "File" menu items
+    (define-key menu [exit-emacs]
+      `(menu-item ,(purecopy "Quit") save-buffers-kill-terminal
+                  :help ,(purecopy "Save unsaved buffers, then exit")))
+
+    (define-key menu [separator-exit]
+      menu-bar-separator)
+
+    ;; Don't use delete-frame as event name because that is a special
+    ;; event.
+    (define-key menu [delete-this-frame]
+      `(menu-item ,(purecopy "Delete Frame") delete-frame
+                  :visible (fboundp 'delete-frame)
+                  :enable (delete-frame-enabled-p)
+                  :help ,(purecopy "Delete currently selected frame")))
+    (define-key menu [make-frame-on-display]
+      `(menu-item ,(purecopy "New Frame on Display...") make-frame-on-display
+                  :visible (fboundp 'make-frame-on-display)
+                  :help ,(purecopy "Open a new frame on another display")))
+    (define-key menu [make-frame]
+      `(menu-item ,(purecopy "New Frame") make-frame-command
+                  :visible (fboundp 'make-frame-command)
+                  :help ,(purecopy "Open a new frame")))
+
+    (define-key menu [one-window]
+      `(menu-item ,(purecopy "Remove Splits") delete-other-windows
+                  :enable (not (one-window-p t nil))
+                  :help ,(purecopy
+                          "Selected window grows to fill the whole frame")))
+
+    (define-key menu [split-window]
+      `(menu-item ,(purecopy "Split Window") split-window-vertically
+                  :enable (and (menu-bar-menu-frame-live-and-visible-p)
+                               (menu-bar-non-minibuffer-window-p))
+                  :help ,(purecopy "Split selected window in two windows")))
+
+    (define-key menu [separator-window]
+      menu-bar-separator)
+
+    (define-key menu [ps-print-region]
+      `(menu-item ,(purecopy "Postscript Print Region (B+W)") ps-print-region
+                  :enable mark-active
+                  :help ,(purecopy "Pretty-print marked region in black and white to PostScript printer")))
+    (define-key menu [ps-print-buffer]
+      `(menu-item ,(purecopy "Postscript Print Buffer (B+W)") ps-print-buffer
+                  :enable (menu-bar-menu-frame-live-and-visible-p)
+                  :help ,(purecopy "Pretty-print current buffer in black and white to PostScript printer")))
+    (define-key menu [ps-print-region-faces]
+      `(menu-item ,(purecopy "Postscript Print Region")
+                  ps-print-region-with-faces
+                  :enable mark-active
+                  :help ,(purecopy
+                          "Pretty-print marked region to PostScript printer")))
+    (define-key menu [ps-print-buffer-faces]
+      `(menu-item ,(purecopy "Postscript Print Buffer")
+                  ps-print-buffer-with-faces
+                  :enable (menu-bar-menu-frame-live-and-visible-p)
+                  :help ,(purecopy "Pretty-print current buffer to PostScript printer")))
+    (define-key menu [print-region]
+      `(menu-item ,(purecopy "Print Region") print-region
+                  :enable mark-active
+                  :help ,(purecopy "Print region between mark and current position")))
+    (define-key menu [print-buffer]
+      `(menu-item ,(purecopy "Print Buffer") print-buffer
+                  :enable (menu-bar-menu-frame-live-and-visible-p)
+                  :help ,(purecopy "Print current buffer with page headings")))
+
+    (define-key menu [separator-print]
+      menu-bar-separator)
+
+    (define-key menu [recover-session]
+      `(menu-item ,(purecopy "Recover Crashed Session") recover-session
+                  :enable
+                  (and auto-save-list-file-prefix
+                       (file-directory-p
+                        (file-name-directory auto-save-list-file-prefix))
+                       (directory-files
+                        (file-name-directory auto-save-list-file-prefix)
+                        nil
+                        (concat "\\`"
+                                (regexp-quote
+                                 (file-name-nondirectory
+                                  auto-save-list-file-prefix)))
+                        t))
+                  :help ,(purecopy "Recover edits from a crashed session")))
+    (define-key menu [revert-buffer]
+      `(menu-item ,(purecopy "Revert Buffer") revert-buffer
+                  :enable (or revert-buffer-function
+                              revert-buffer-insert-file-contents-function
+                              (and buffer-file-number
+                                   (or (buffer-modified-p)
+                                       (not (verify-visited-file-modtime
+                                             (current-buffer))))))
+                  :help ,(purecopy "Re-read current buffer from its file")))
+    (define-key menu [write-file]
+      `(menu-item ,(purecopy "Save As...") write-file
+                  :enable (and (menu-bar-menu-frame-live-and-visible-p)
+                               (menu-bar-non-minibuffer-window-p))
+                  :help ,(purecopy "Write current buffer to another file")))
+    (define-key menu [save-buffer]
+      `(menu-item ,(purecopy "Save") save-buffer
+                  :enable (and (buffer-modified-p)
+                               (buffer-file-name)
+                               (menu-bar-non-minibuffer-window-p))
+                  :help ,(purecopy "Save current buffer to its file")))
+
+    (define-key menu [separator-save]
+      menu-bar-separator)
+
+
+    (define-key menu [kill-buffer]
+      `(menu-item ,(purecopy "Close") kill-this-buffer
+                  :enable (kill-this-buffer-enabled-p)
+                  :help ,(purecopy "Discard (kill) current buffer")))
+    (define-key menu [insert-file]
+      `(menu-item ,(purecopy "Insert File...") insert-file
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help ,(purecopy "Insert another file into current buffer")))
+    (define-key menu [dired]
+      `(menu-item ,(purecopy "Open Directory...") dired
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help ,(purecopy
+                          "Read a directory, to operate on its files")))
+    (define-key menu [open-file]
+      `(menu-item ,(purecopy "Open File...") menu-find-file-existing
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help ,(purecopy
+                          "Read an existing file into an Emacs buffer")))
+    (define-key menu [new-file]
+      `(menu-item ,(purecopy "Visit New File...") find-file
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help ,(purecopy
+                          "Specify a new file's name, to edit the file")))
+
+    menu))
+
+(defun menu-find-file-existing ()
+  "Edit the existing file FILENAME."
+  (interactive)
+  (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
+                             (x-uses-old-gtk-dialog))))
+        (filename (car (find-file-read-args "Find file: " mustmatch))))
+    (if mustmatch
+       (find-file-existing filename)
+      (find-file filename))))
+
+;; The "Edit->Search" submenu
+(defvar menu-bar-last-search-type nil
+  "Type of last non-incremental search command called from the menu.")
+
+(defun nonincremental-repeat-search-forward ()
+  "Search forward for the previous search string or regexp."
+  (interactive)
+  (cond
+   ((and (eq menu-bar-last-search-type 'string)
+        search-ring)
+    (search-forward (car search-ring)))
+   ((and (eq menu-bar-last-search-type 'regexp)
+        regexp-search-ring)
+    (re-search-forward (car regexp-search-ring)))
+   (t
+    (error "No previous search"))))
+
+(defun nonincremental-repeat-search-backward ()
+  "Search backward for the previous search string or regexp."
+  (interactive)
+  (cond
+   ((and (eq menu-bar-last-search-type 'string)
+        search-ring)
+    (search-backward (car search-ring)))
+   ((and (eq menu-bar-last-search-type 'regexp)
+        regexp-search-ring)
+    (re-search-backward (car regexp-search-ring)))
+   (t
+    (error "No previous search"))))
+
+(defun nonincremental-search-forward (string)
+  "Read a string and search for it nonincrementally."
+  (interactive "sSearch for string: ")
+  (setq menu-bar-last-search-type 'string)
+  (if (equal string "")
+      (search-forward (car search-ring))
+    (isearch-update-ring string nil)
+    (search-forward string)))
+
+(defun nonincremental-search-backward (string)
+  "Read a string and search backward for it nonincrementally."
+  (interactive "sSearch for string: ")
+  (setq menu-bar-last-search-type 'string)
+  (if (equal string "")
+      (search-backward (car search-ring))
+    (isearch-update-ring string nil)
+    (search-backward string)))
+
+(defun nonincremental-re-search-forward (string)
+  "Read a regular expression and search for it nonincrementally."
+  (interactive "sSearch for regexp: ")
+  (setq menu-bar-last-search-type 'regexp)
+  (if (equal string "")
+      (re-search-forward (car regexp-search-ring))
+    (isearch-update-ring string t)
+    (re-search-forward string)))
+
+(defun nonincremental-re-search-backward (string)
+  "Read a regular expression and search backward for it nonincrementally."
+  (interactive "sSearch for regexp: ")
+  (setq menu-bar-last-search-type 'regexp)
+  (if (equal string "")
+      (re-search-backward (car regexp-search-ring))
+    (isearch-update-ring string t)
+    (re-search-backward string)))
+
+;; The Edit->Search->Incremental Search menu
+(defvar menu-bar-i-search-menu
+  (let ((menu (make-sparse-keymap "Incremental Search")))
+    (define-key menu [isearch-backward-regexp]
+      `(menu-item ,(purecopy "Backward Regexp...") isearch-backward-regexp
+        :help ,(purecopy
+                "Search backwards for a regular expression as you type it")))
+    (define-key menu [isearch-forward-regexp]
+      `(menu-item ,(purecopy "Forward Regexp...") isearch-forward-regexp
+        :help ,(purecopy
+                "Search forward for a regular expression as you type it")))
+    (define-key menu [isearch-backward]
+      `(menu-item ,(purecopy "Backward String...") isearch-backward
+        :help ,(purecopy "Search backwards for a string as you type it")))
+    (define-key menu [isearch-forward]
+      `(menu-item ,(purecopy "Forward String...") isearch-forward
+        :help ,(purecopy "Search forward for a string as you type it")))
+    menu))
+
+(defvar menu-bar-search-menu
+  (let ((menu (make-sparse-keymap "Search")))
+
+    (define-key menu [i-search]
+      `(menu-item ,(purecopy "Incremental Search") ,menu-bar-i-search-menu))
+    (define-key menu [separator-tag-isearch]
+      menu-bar-separator)
+
+    (define-key menu [tags-continue]
+      `(menu-item ,(purecopy "Continue Tags Search") tags-loop-continue
+                  :help ,(purecopy "Continue last tags search operation")))
+    (define-key menu [tags-srch]
+      `(menu-item ,(purecopy "Search Tagged Files...") tags-search
+                  :help ,(purecopy "Search for a regexp in all tagged files")))
+    (define-key menu [separator-tag-search] menu-bar-separator)
+
+    (define-key menu [repeat-search-back]
+      `(menu-item ,(purecopy "Repeat Backwards")
+                  nonincremental-repeat-search-backward
+                  :enable (or (and (eq menu-bar-last-search-type 'string)
+                                   search-ring)
+                              (and (eq menu-bar-last-search-type 'regexp)
+                                   regexp-search-ring))
+                  :help ,(purecopy "Repeat last search backwards")))
+    (define-key menu [repeat-search-fwd]
+      `(menu-item ,(purecopy "Repeat Forward")
+                  nonincremental-repeat-search-forward
+                  :enable (or (and (eq menu-bar-last-search-type 'string)
+                                   search-ring)
+                              (and (eq menu-bar-last-search-type 'regexp)
+                                   regexp-search-ring))
+                  :help ,(purecopy "Repeat last search forward")))
+    (define-key menu [separator-repeat-search]
+      menu-bar-separator)
+
+    (define-key menu [re-search-backward]
+      `(menu-item ,(purecopy "Regexp Backwards...")
+                  nonincremental-re-search-backward
+                  :help ,(purecopy
+                          "Search backwards for a regular expression")))
+    (define-key menu [re-search-forward]
+      `(menu-item ,(purecopy "Regexp Forward...")
+                  nonincremental-re-search-forward
+                  :help ,(purecopy "Search forward for a regular expression")))
+
+    (define-key menu [search-backward]
+      `(menu-item ,(purecopy "String Backwards...")
+                  nonincremental-search-backward
+                  :help ,(purecopy "Search backwards for a string")))
+    (define-key menu [search-forward]
+      `(menu-item ,(purecopy "String Forward...") nonincremental-search-forward
+                  :help ,(purecopy "Search forward for a string")))
+    menu))
+
+;; The Edit->Replace submenu
+
+(defvar menu-bar-replace-menu
+  (let ((menu (make-sparse-keymap "Replace")))
+    (define-key menu [tags-repl-continue]
+      `(menu-item ,(purecopy "Continue Replace") tags-loop-continue
+                  :help ,(purecopy "Continue last tags replace operation")))
+    (define-key menu [tags-repl]
+      `(menu-item ,(purecopy "Replace in Tagged Files...") tags-query-replace
+        :help ,(purecopy
+                "Interactively replace a regexp in all tagged files")))
+    (define-key menu [separator-replace-tags]
+      menu-bar-separator)
+
+    (define-key menu [query-replace-regexp]
+      `(menu-item ,(purecopy "Replace Regexp...") query-replace-regexp
+                  :enable (not buffer-read-only)
+                  :help ,(purecopy "Replace regular expression interactively, ask about each occurrence")))
+    (define-key menu [query-replace]
+      `(menu-item ,(purecopy "Replace String...") query-replace
+        :enable (not buffer-read-only)
+        :help ,(purecopy
+                "Replace string interactively, ask about each occurrence")))
+    menu))
+
+;;; Assemble the top-level Edit menu items.
+(defvar menu-bar-goto-menu
+  (let ((menu (make-sparse-keymap "Go To")))
+
+    (define-key menu [set-tags-name]
+      `(menu-item ,(purecopy "Set Tags File Name...") visit-tags-table
+                  :help ,(purecopy "Tell Tags commands which tag table file to use")))
+
+    (define-key menu [separator-tag-file]
+      menu-bar-separator)
+
+    (define-key menu [apropos-tags]
+      `(menu-item ,(purecopy "Tags Apropos...") tags-apropos
+                  :help ,(purecopy "Find function/variables whose names match regexp")))
+    (define-key menu [next-tag-otherw]
+      `(menu-item ,(purecopy "Next Tag in Other Window")
+                  menu-bar-next-tag-other-window
+                  :enable (and (boundp 'tags-location-ring)
+                               (not (ring-empty-p tags-location-ring)))
+                  :help ,(purecopy "Find next function/variable matching last tag name in another window")))
+
+    (define-key menu [next-tag]
+      `(menu-item ,(purecopy "Find Next Tag")
+                  menu-bar-next-tag
+                  :enable (and (boundp 'tags-location-ring)
+                               (not (ring-empty-p tags-location-ring)))
+                  :help ,(purecopy "Find next function/variable matching last tag name")))
+    (define-key menu [find-tag-otherw]
+      `(menu-item ,(purecopy "Find Tag in Other Window...") find-tag-other-window
+                  :help ,(purecopy "Find function/variable definition in another window")))
+    (define-key menu [find-tag]
+      `(menu-item ,(purecopy "Find Tag...") find-tag
+                  :help ,(purecopy "Find definition of function or variable")))
+
+    (define-key menu [separator-tags]
+      menu-bar-separator)
+
+    (define-key menu [end-of-buf]
+      `(menu-item ,(purecopy "Goto End of Buffer") end-of-buffer))
+    (define-key menu [beg-of-buf]
+      `(menu-item ,(purecopy "Goto Beginning of Buffer") beginning-of-buffer))
+    (define-key menu [go-to-pos]
+      `(menu-item ,(purecopy "Goto Buffer Position...") goto-char
+                  :help ,(purecopy "Read a number N and go to buffer position N")))
+    (define-key menu [go-to-line]
+      `(menu-item ,(purecopy "Goto Line...") goto-line
+                  :help ,(purecopy "Read a line number and go to that line")))
+    menu))
+
+
+(defvar yank-menu (cons (purecopy "Select Yank") nil))
+(fset 'yank-menu (cons 'keymap yank-menu))
+
+(defvar menu-bar-edit-menu
+  (let ((menu (make-sparse-keymap "Edit")))
+    
+    (define-key menu [props]
+      `(menu-item ,(purecopy "Text Properties") facemenu-menu))
+
+    ;; ns-win.el said: Add spell for platorm consistency.
+    (if (featurep 'ns)
+        (define-key menu [spell]
+          `(menu-item ,(purecopy "Spell") ispell-menu-map)))
+
+    (define-key menu [fill]
+      `(menu-item ,(purecopy "Fill") fill-region
+                  :enable (and mark-active (not buffer-read-only))
+                  :help
+                  ,(purecopy "Fill text in region to fit between left and right margin")))
+
+    (define-key menu [separator-bookmark]
+      menu-bar-separator)
+
+    (define-key menu [bookmark]
+      `(menu-item ,(purecopy "Bookmarks") menu-bar-bookmark-map))
+
+    (define-key menu [goto]
+      `(menu-item ,(purecopy "Go To") ,menu-bar-goto-menu))
+
+    (define-key menu [replace]
+      `(menu-item ,(purecopy "Replace") ,menu-bar-replace-menu))
+
+    (define-key menu [search]
+      `(menu-item ,(purecopy "Search") ,menu-bar-search-menu))
+
+    (define-key menu [separator-search]
+      menu-bar-separator)
+
+    (define-key menu [mark-whole-buffer]
+      `(menu-item ,(purecopy "Select All") mark-whole-buffer
+                  :help ,(purecopy "Mark the whole buffer for a subsequent cut/copy")))
+    (define-key menu [clear]
+      `(menu-item ,(purecopy "Clear") delete-region
+                  :enable (and mark-active
+                               (not buffer-read-only))
+                  :help
+                  ,(purecopy "Delete the text in region between mark and current position")))
+
+
+    (define-key menu (if (featurep 'ns) [select-paste]
+                       [paste-from-menu])
+      ;; ns-win.el said: Change text to be more consistent with
+      ;; surrounding menu items `paste', etc."
+      `(menu-item ,(purecopy (if (featurep 'ns) "Select and Paste"
+                               "Paste from Kill Menu")) yank-menu
+                               :enable (and (cdr yank-menu) (not buffer-read-only))
+                               :help ,(purecopy "Choose a string from the kill ring and paste it")))
+    (define-key menu [paste]
+      `(menu-item ,(purecopy "Paste") yank
+                  :enable (and (or
+                                ;; Emacs compiled --without-x (or --with-ns)
+                                ;; doesn't have x-selection-exists-p.
+                                (and (fboundp 'x-selection-exists-p)
+                                     (x-selection-exists-p 'CLIPBOARD))
+                                (if (featurep 'ns) ; like paste-from-menu
+                                    (cdr yank-menu)
+                                  kill-ring))
+                               (not buffer-read-only))
+                  :help ,(purecopy "Paste (yank) text most recently cut/copied")))
+    (define-key menu [copy]
+      ;; ns-win.el said: Substitute a Copy function that works better
+      ;; under X (for GNUstep).
+      `(menu-item ,(purecopy "Copy") ,(if (featurep 'ns)
+                                          'ns-copy-including-secondary
+                                        'kill-ring-save)
+                  :enable mark-active
+                  :help ,(purecopy "Copy text in region between mark and current position")
+                  :keys ,(purecopy (if (featurep 'ns)
+                                       "\\[ns-copy-including-secondary]"
+                                     "\\[kill-ring-save]"))))
+    (define-key menu [cut]
+      `(menu-item ,(purecopy "Cut") kill-region
+                  :enable (and mark-active (not buffer-read-only))
+                  :help
+                  ,(purecopy "Cut (kill) text in region between mark and current position")))
+    ;; ns-win.el said: Separate undo from cut/paste section.
+    (if (featurep 'ns)
+        (define-key menu [separator-undo] menu-bar-separator))
+
+    (define-key menu [undo]
+      `(menu-item ,(purecopy "Undo") undo
+                  :enable (and (not buffer-read-only)
+                               (not (eq t buffer-undo-list))
+                               (if (eq last-command 'undo)
+                                   (listp pending-undo-list)
+                                 (consp buffer-undo-list)))
+                  :help ,(purecopy "Undo last operation")))
+
+    menu))
+
+(defun menu-bar-next-tag-other-window ()
+  "Find the next definition of the tag already specified."
+  (interactive)
+  (find-tag-other-window nil t))
+
+(defun menu-bar-next-tag ()
+  "Find the next definition of the tag already specified."
+  (interactive)
+  (find-tag nil t))
+
+(define-obsolete-function-alias
+  'menu-bar-kill-ring-save 'kill-ring-save "24.1")
+
+;; These are alternative definitions for the cut, paste and copy
+;; menu items.  Use them if your system expects these to use the clipboard.
+
+(put 'clipboard-kill-region 'menu-enable
+     '(and mark-active (not buffer-read-only)))
+(put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
+(put 'clipboard-yank 'menu-enable
+     '(and (or (not (fboundp 'x-selection-exists-p))
+              (x-selection-exists-p)
+              (x-selection-exists-p 'CLIPBOARD))
+          (not buffer-read-only)))
+
+(defun clipboard-yank ()
+  "Insert the clipboard contents, or the last stretch of killed text."
+  (interactive "*")
+  (let ((x-select-enable-clipboard t))
+    (yank)))
+
+(defun clipboard-kill-ring-save (beg end)
+  "Copy region to kill ring, and save in the X clipboard."
+  (interactive "r")
+  (let ((x-select-enable-clipboard t))
+    (kill-ring-save beg end)))
+
+(defun clipboard-kill-region (beg end)
+  "Kill the region, and save it in the X clipboard."
+  (interactive "r")
+  (let ((x-select-enable-clipboard t))
+    (kill-region beg end)))
+
+(defun menu-bar-enable-clipboard ()
+  "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
+Do the same for the keys of the same name."
+  (interactive)
+  ;; These are Sun server keysyms for the Cut, Copy and Paste keys
+  ;; (also for XFree86 on Sun keyboard):
+  (define-key global-map [f20] 'clipboard-kill-region)
+  (define-key global-map [f16] 'clipboard-kill-ring-save)
+  (define-key global-map [f18] 'clipboard-yank)
+  ;; X11R6 versions:
+  (define-key global-map [cut] 'clipboard-kill-region)
+  (define-key global-map [copy] 'clipboard-kill-ring-save)
+  (define-key global-map [paste] 'clipboard-yank))
+\f
+;; The "Options" menu items
+
+(defvar menu-bar-custom-menu
+  (let ((menu (make-sparse-keymap "Customize")))
+
+    (define-key menu [customize-apropos-faces]
+      `(menu-item ,(purecopy "Faces Matching...") customize-apropos-faces
+                  :help ,(purecopy "Browse faces matching a regexp or word list")))
+    (define-key menu [customize-apropos-options]
+      `(menu-item ,(purecopy "Options Matching...") customize-apropos-options
+                  :help ,(purecopy "Browse options matching a regexp or word list")))
+    (define-key menu [customize-apropos]
+      `(menu-item ,(purecopy "All Settings Matching...") customize-apropos
+                  :help ,(purecopy "Browse customizable settings matching a regexp or word list")))
+    (define-key menu [separator-1]
+      menu-bar-separator)
+    (define-key menu [customize-group]
+      `(menu-item ,(purecopy "Specific Group...") customize-group
+                  :help ,(purecopy "Customize settings of specific group")))
+    (define-key menu [customize-face]
+      `(menu-item ,(purecopy "Specific Face...") customize-face
+                  :help ,(purecopy "Customize attributes of specific face")))
+    (define-key menu [customize-option]
+      `(menu-item ,(purecopy "Specific Option...") customize-option
+                  :help ,(purecopy "Customize value of specific option")))
+    (define-key menu [separator-2]
+      menu-bar-separator)
+    (define-key menu [customize-changed-options]
+      `(menu-item ,(purecopy "New Options...") customize-changed-options
+                  :help ,(purecopy "Options added or changed in recent Emacs versions")))
+    (define-key menu [customize-saved]
+      `(menu-item ,(purecopy "Saved Options") customize-saved
+                  :help ,(purecopy "Customize previously saved options")))
+    (define-key menu [separator-3]
+      menu-bar-separator)
+    (define-key menu [customize-browse]
+      `(menu-item ,(purecopy "Browse Customization Groups") customize-browse
+                  :help ,(purecopy "Browse all customization groups")))
+    (define-key menu [customize]
+      `(menu-item ,(purecopy "Top-level Customization Group") customize
+                  :help ,(purecopy "The master group called `Emacs'")))
+    (define-key menu [customize-themes]
+      `(menu-item ,(purecopy "Custom Themes") customize-themes
+                  :help ,(purecopy "Choose a pre-defined customization theme")))
+    menu))
+;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
+
+(defmacro menu-bar-make-mm-toggle (fname doc help &optional props)
+  "Make a menu-item for a global minor mode toggle.
+FNAME is the minor mode's name (variable and function).
+DOC is the text to use for the menu entry.
+HELP is the text to use for the tooltip.
+PROPS are additional properties."
+  `(list 'menu-item  (purecopy ,doc) ',fname
+        ,@(mapcar (lambda (p) (list 'quote p)) props)
+        :help (purecopy ,help)
+        :button '(:toggle . (and (default-boundp ',fname)
+                                 (default-value ',fname)))))
+
+(defmacro menu-bar-make-toggle (name variable doc message help &rest body)
+  `(progn
+     (defun ,name (&optional interactively)
+       ,(concat "Toggle whether to " (downcase (substring help 0 1))
+               (substring help 1) ".
+In an interactive call, record this option as a candidate for saving
+by \"Save Options\" in Custom buffers.")
+       (interactive "p")
+       (if ,(if body `(progn . ,body)
+             `(progn
+                (custom-load-symbol ',variable)
+                (let ((set (or (get ',variable 'custom-set) 'set-default))
+                      (get (or (get ',variable 'custom-get) 'default-value)))
+                  (funcall set ',variable (not (funcall get ',variable))))))
+          (message ,message "enabled globally")
+        (message ,message "disabled globally"))
+       ;; The function `customize-mark-as-set' must only be called when
+       ;; a variable is set interactively, as the purpose is to mark it as
+       ;; a candidate for "Save Options", and we do not want to save options
+       ;; the user have already set explicitly in his init file.
+       (if interactively (customize-mark-as-set ',variable)))
+     (list 'menu-item (purecopy ,doc) ',name
+          :help (purecopy ,help)
+          :button '(:toggle . (and (default-boundp ',variable)
+                                   (default-value ',variable))))))
+
+;; Function for setting/saving default font.
+
+(defun menu-set-font ()
+  "Interactively select a font and make it the default."
+  (interactive)
+  (let ((font (if (fboundp 'x-select-font)
+                 (x-select-font)
+               (mouse-select-font)))
+       spec)
+    (when font
+      ;; Be careful here: when set-face-attribute is called for the
+      ;; :font attribute, Emacs tries to guess the best matching font
+      ;; by examining the other face attributes (Bug#2476).
+      (set-face-attribute 'default (selected-frame)
+                         :width 'normal
+                         :weight 'normal
+                         :slant 'normal
+                         :font font)
+      (let ((font-object (face-attribute 'default :font)))
+       (dolist (f (frame-list))
+         (and (not (eq f (selected-frame)))
+              (display-graphic-p f)
+              (set-face-attribute 'default f :font font-object)))
+       (set-face-attribute 'default t :font font-object))
+      (setq spec (list (list t (face-attr-construct 'default))))
+      (put 'default 'customized-face spec)
+      (custom-push-theme 'theme-face 'default 'user 'set spec)
+      (put 'default 'face-modified nil))))
+
+(defun menu-bar-options-save ()
+  "Save current values of Options menu items using Custom."
+  (interactive)
+  (let ((need-save nil))
+    ;; These are set with menu-bar-make-mm-toggle, which does not
+    ;; put on a customized-value property.
+    (dolist (elt '(line-number-mode column-number-mode size-indication-mode
+                  cua-mode show-paren-mode transient-mark-mode
+                  blink-cursor-mode display-time-mode display-battery-mode
+                  ;; These are set by other functions that don't set
+                  ;; the customized state.  Having them here has the
+                  ;; side-effect that turning them off via X
+                  ;; resources acts like having customized them, but
+                  ;; that seems harmless.
+                  menu-bar-mode tool-bar-mode))
+      ;; FIXME ? It's a little annoying that running this command
+      ;; always loads cua-base, paren, time, and battery, even if they
+      ;; have not been customized in any way.  (Due to custom-load-symbol.)
+      (and (customize-mark-to-save elt)
+          (setq need-save t)))
+    ;; These are set with `customize-set-variable'.
+    (dolist (elt '(scroll-bar-mode
+                  debug-on-quit debug-on-error
+                  ;; Somehow this works, when tool-bar and menu-bar don't.
+                  tooltip-mode
+                  save-place uniquify-buffer-name-style fringe-mode
+                  indicate-empty-lines indicate-buffer-boundaries
+                  case-fold-search font-use-system-font
+                  current-language-environment default-input-method
+                  ;; Saving `text-mode-hook' is somewhat questionable,
+                  ;; as we might get more than we bargain for, if
+                  ;; other code may has added hooks as well.
+                  ;; Nonetheless, not saving it would like be confuse
+                  ;; more often.
+                  ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
+                  text-mode-hook tool-bar-position))
+      (and (get elt 'customized-value)
+          (customize-mark-to-save elt)
+          (setq need-save t)))
+    (when (get 'default 'customized-face)
+      (put 'default 'saved-face (get 'default 'customized-face))
+      (put 'default 'customized-face nil)
+      (setq need-save t))
+    ;; Save if we changed anything.
+    (when need-save
+      (custom-save-all))))
+
+
+;;; Assemble all the top-level items of the "Options" menu
+
+;; The "Show/Hide" submenu of menu "Options"
+
+(defun menu-bar-showhide-fringe-ind-customize ()
+  "Show customization buffer for `indicate-buffer-boundaries'."
+  (interactive)
+  (customize-variable 'indicate-buffer-boundaries))
+
+(defun menu-bar-showhide-fringe-ind-mixed ()
+  "Display top and bottom indicators in opposite fringes, arrows in right."
+  (interactive)
+  (customize-set-variable 'indicate-buffer-boundaries
+                         '((t . right) (top . left))))
+
+(defun menu-bar-showhide-fringe-ind-box ()
+  "Display top and bottom indicators in opposite fringes."
+  (interactive)
+  (customize-set-variable 'indicate-buffer-boundaries
+                         '((top . left) (bottom . right))))
+
+(defun menu-bar-showhide-fringe-ind-right ()
+  "Display buffer boundaries and arrows in the right fringe."
+  (interactive)
+  (customize-set-variable 'indicate-buffer-boundaries 'right))
+
+(defun menu-bar-showhide-fringe-ind-left ()
+  "Display buffer boundaries and arrows in the left fringe."
+  (interactive)
+  (customize-set-variable 'indicate-buffer-boundaries 'left))
+
+(defun menu-bar-showhide-fringe-ind-none ()
+  "Do not display any buffer boundary indicators."
+  (interactive)
+  (customize-set-variable 'indicate-buffer-boundaries nil))
+
+(defvar menu-bar-showhide-fringe-ind-menu
+  (let ((menu (make-sparse-keymap "Buffer boundaries")))
+
+    (define-key menu [customize]
+      `(menu-item ,(purecopy "Other (Customize)")
+                  menu-bar-showhide-fringe-ind-customize
+                  :help ,(purecopy "Additional choices available through Custom buffer")
+                  :visible (display-graphic-p)
+                  :button (:radio . (not (member indicate-buffer-boundaries
+                                                 '(nil left right
+                                                   ((top . left) (bottom . right))
+                                                   ((t . right) (top . left))))))))
+
+    (define-key menu [mixed]
+      `(menu-item ,(purecopy "Opposite, Arrows Right") menu-bar-showhide-fringe-ind-mixed
+                  :help
+                  ,(purecopy "Show top/bottom indicators in opposite fringes, arrows in right")
+                  :visible (display-graphic-p)
+                  :button (:radio . (equal indicate-buffer-boundaries
+                                           '((t . right) (top . left))))))
+
+    (define-key menu [box]
+      `(menu-item ,(purecopy "Opposite, No Arrows") menu-bar-showhide-fringe-ind-box
+                  :help ,(purecopy "Show top/bottom indicators in opposite fringes, no arrows")
+                  :visible (display-graphic-p)
+                  :button (:radio . (equal indicate-buffer-boundaries
+                                           '((top . left) (bottom . right))))))
+
+    (define-key menu [right]
+      `(menu-item ,(purecopy "In Right Fringe") menu-bar-showhide-fringe-ind-right
+                  :help ,(purecopy "Show buffer boundaries and arrows in right fringe")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq indicate-buffer-boundaries 'right))))
+
+    (define-key menu [left]
+      `(menu-item ,(purecopy "In Left Fringe") menu-bar-showhide-fringe-ind-left
+                  :help ,(purecopy "Show buffer boundaries and arrows in left fringe")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq indicate-buffer-boundaries 'left))))
+
+    (define-key menu [none]
+      `(menu-item ,(purecopy "No Indicators") menu-bar-showhide-fringe-ind-none
+                  :help ,(purecopy "Hide all buffer boundary indicators and arrows")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq indicate-buffer-boundaries nil))))
+    menu))
+
+(defun menu-bar-showhide-fringe-menu-customize ()
+  "Show customization buffer for `fringe-mode'."
+  (interactive)
+  (customize-variable 'fringe-mode))
+
+(defun menu-bar-showhide-fringe-menu-customize-reset ()
+  "Reset the fringe mode: display fringes on both sides of a window."
+  (interactive)
+  (customize-set-variable 'fringe-mode nil))
+
+(defun menu-bar-showhide-fringe-menu-customize-right ()
+  "Display fringes only on the right of each window."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-mode '(0 . nil)))
+
+(defun menu-bar-showhide-fringe-menu-customize-left ()
+  "Display fringes only on the left of each window."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-mode '(nil . 0)))
+
+(defun menu-bar-showhide-fringe-menu-customize-disable ()
+  "Do not display window fringes."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-mode 0))
+
+(defvar menu-bar-showhide-fringe-menu
+  (let ((menu (make-sparse-keymap "Fringe")))
+
+    (define-key menu [showhide-fringe-ind]
+      `(menu-item ,(purecopy "Buffer Boundaries") ,menu-bar-showhide-fringe-ind-menu
+                  :visible (display-graphic-p)
+                  :help ,(purecopy "Indicate buffer boundaries in fringe")))
+
+    (define-key menu [indicate-empty-lines]
+      (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines
+                            "Empty Line Indicators"
+                            "Indicating of empty lines %s"
+                            "Indicate trailing empty lines in fringe, globally"))
+
+    (define-key menu [customize]
+      `(menu-item ,(purecopy "Customize Fringe") menu-bar-showhide-fringe-menu-customize
+                  :help ,(purecopy "Detailed customization of fringe")
+                  :visible (display-graphic-p)))
+
+    (define-key menu [default]
+      `(menu-item ,(purecopy "Default") menu-bar-showhide-fringe-menu-customize-reset
+                  :help ,(purecopy "Default width fringe on both left and right side")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq fringe-mode nil))))
+
+    (define-key menu [right]
+      `(menu-item ,(purecopy "On the Right") menu-bar-showhide-fringe-menu-customize-right
+                  :help ,(purecopy "Fringe only on the right side")
+                  :visible (display-graphic-p)
+                  :button (:radio . (equal fringe-mode '(0 . nil)))))
+
+    (define-key menu [left]
+      `(menu-item ,(purecopy "On the Left") menu-bar-showhide-fringe-menu-customize-left
+                  :help ,(purecopy "Fringe only on the left side")
+                  :visible (display-graphic-p)
+                  :button (:radio . (equal fringe-mode '(nil . 0)))))
+
+    (define-key menu [none]
+      `(menu-item ,(purecopy "None") menu-bar-showhide-fringe-menu-customize-disable
+                  :help ,(purecopy "Turn off fringe")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq fringe-mode 0))))
+    menu))
+
+(defun menu-bar-right-scroll-bar ()
+  "Display scroll bars on the right of each window."
+  (interactive)
+  (customize-set-variable 'scroll-bar-mode 'right))
+
+(defun menu-bar-left-scroll-bar ()
+  "Display scroll bars on the left of each window."
+  (interactive)
+  (customize-set-variable 'scroll-bar-mode 'left))
+
+(defun menu-bar-no-scroll-bar ()
+  "Turn off scroll bars."
+  (interactive)
+  (customize-set-variable 'scroll-bar-mode nil))
+
+(defvar menu-bar-showhide-scroll-bar-menu
+  (let ((menu (make-sparse-keymap "Scroll-bar")))
+
+    (define-key menu [right]
+      `(menu-item ,(purecopy "On the Right")
+                  menu-bar-right-scroll-bar
+                  :help ,(purecopy "Scroll-bar on the right side")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
+                                                   (frame-parameters))) 'right))))
+
+    (define-key menu [left]
+      `(menu-item ,(purecopy "On the Left")
+                  menu-bar-left-scroll-bar
+                  :help ,(purecopy "Scroll-bar on the left side")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
+                                                   (frame-parameters))) 'left))))
+
+    (define-key menu [none]
+      `(menu-item ,(purecopy "None")
+                  menu-bar-no-scroll-bar
+                  :help ,(purecopy "Turn off scroll-bar")
+                  :visible (display-graphic-p)
+                  :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
+                                                   (frame-parameters))) nil))))
+    menu))
+
+(defun menu-bar-frame-for-menubar ()
+  "Return the frame suitable for updating the menu bar."
+  (or (and (framep menu-updating-frame)
+          menu-updating-frame)
+      (selected-frame)))
+
+(defun menu-bar-positive-p (val)
+  "Return non-nil iff VAL is a positive number."
+  (and (numberp val)
+       (> val 0)))
+
+(defun menu-bar-set-tool-bar-position (position)
+  (customize-set-variable 'tool-bar-mode t)
+  (customize-set-variable 'tool-bar-position position))
+(defun menu-bar-showhide-tool-bar-menu-customize-disable ()
+  "Do not display tool bars."
+  (interactive)
+  (customize-set-variable 'tool-bar-mode nil))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-left ()
+  "Display tool bars on the left side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'left))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-right ()
+  "Display tool bars on the right side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'right))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-top ()
+  "Display tool bars on the top side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'top))
+(defun menu-bar-showhide-tool-bar-menu-customize-enable-bottom ()
+  "Display tool bars on the bottom side."
+  (interactive)
+  (menu-bar-set-tool-bar-position 'bottom))
+
+(when (featurep 'move-toolbar)
+  (defvar menu-bar-showhide-tool-bar-menu
+    (let ((menu (make-sparse-keymap "Tool-bar")))
+
+      (define-key menu [showhide-tool-bar-left]
+        `(menu-item ,(purecopy "On the left")
+                    menu-bar-showhide-tool-bar-menu-customize-enable-left
+                    :help ,(purecopy "Tool-bar at the left side")
+                    :visible (display-graphic-p)
+                    :button
+                    (:radio . (and tool-bar-mode
+                                   (eq (frame-parameter
+                                        (menu-bar-frame-for-menubar)
+                                        'tool-bar-position)
+                                       'left)))))
+
+      (define-key menu [showhide-tool-bar-right]
+        `(menu-item ,(purecopy "On the right")
+                    menu-bar-showhide-tool-bar-menu-customize-enable-right
+                    :help ,(purecopy "Tool-bar at the right side")
+                    :visible (display-graphic-p)
+                    :button
+                    (:radio . (and tool-bar-mode
+                                   (eq (frame-parameter
+                                        (menu-bar-frame-for-menubar)
+                                        'tool-bar-position)
+                                       'right)))))
+
+      (define-key menu [showhide-tool-bar-bottom]
+        `(menu-item ,(purecopy "On the bottom")
+                    menu-bar-showhide-tool-bar-menu-customize-enable-bottom
+                    :help ,(purecopy "Tool-bar at the bottom")
+                    :visible (display-graphic-p)
+                    :button
+                    (:radio . (and tool-bar-mode
+                                   (eq (frame-parameter
+                                        (menu-bar-frame-for-menubar)
+                                        'tool-bar-position)
+                                       'bottom)))))
+
+      (define-key menu [showhide-tool-bar-top]
+        `(menu-item ,(purecopy "On the top")
+                    menu-bar-showhide-tool-bar-menu-customize-enable-top
+                    :help ,(purecopy "Tool-bar at the top")
+                    :visible (display-graphic-p)
+                    :button
+                    (:radio . (and tool-bar-mode
+                                   (eq (frame-parameter
+                                        (menu-bar-frame-for-menubar)
+                                        'tool-bar-position)
+                                       'top)))))
+
+      (define-key menu [showhide-tool-bar-none]
+        `(menu-item ,(purecopy "None")
+                    menu-bar-showhide-tool-bar-menu-customize-disable
+                    :help ,(purecopy "Turn tool-bar off")
+                    :visible (display-graphic-p)
+                    :button (:radio . (eq tool-bar-mode nil))))
+      menu)))
+
+(defvar menu-bar-showhide-menu
+  (let ((menu (make-sparse-keymap "Show/Hide")))
+
+    (define-key menu [column-number-mode]
+      (menu-bar-make-mm-toggle column-number-mode
+                               "Column Numbers"
+                               "Show the current column number in the mode line"))
+
+    (define-key menu [line-number-mode]
+      (menu-bar-make-mm-toggle line-number-mode
+                               "Line Numbers"
+                               "Show the current line number in the mode line"))
+
+    (define-key menu [size-indication-mode]
+      (menu-bar-make-mm-toggle size-indication-mode
+                               "Size Indication"
+                               "Show the size of the buffer in the mode line"))
+
+    (define-key menu [linecolumn-separator]
+      menu-bar-separator)
+
+    (define-key menu [showhide-battery]
+      (menu-bar-make-mm-toggle display-battery-mode
+                               "Battery Status"
+                               "Display battery status information in mode line"))
+
+    (define-key menu [showhide-date-time]
+      (menu-bar-make-mm-toggle display-time-mode
+                               "Time, Load and Mail"
+                               "Display time, system load averages and \
+mail status in mode line"))
+
+    (define-key menu [datetime-separator]
+      menu-bar-separator)
+
+    (define-key menu [showhide-speedbar]
+      `(menu-item ,(purecopy "Speedbar") speedbar-frame-mode
+                  :help ,(purecopy "Display a Speedbar quick-navigation frame")
+                  :button (:toggle
+                           . (and (boundp 'speedbar-frame)
+                                  (frame-live-p (symbol-value 'speedbar-frame))
+                                  (frame-visible-p
+                                   (symbol-value 'speedbar-frame))))))
+
+    (define-key menu [showhide-fringe]
+      `(menu-item ,(purecopy "Fringe") ,menu-bar-showhide-fringe-menu
+                  :visible (display-graphic-p)))
+
+    (define-key menu [showhide-scroll-bar]
+      `(menu-item ,(purecopy "Scroll-bar") ,menu-bar-showhide-scroll-bar-menu
+                  :visible (display-graphic-p)))
+
+    (define-key menu [showhide-tooltip-mode]
+      `(menu-item ,(purecopy "Tooltips") tooltip-mode
+                  :help ,(purecopy "Turn tooltips on/off")
+                  :visible (and (display-graphic-p) (fboundp 'x-show-tip))
+                  :button (:toggle . tooltip-mode)))
+
+    (define-key menu [menu-bar-mode]
+      `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
+                  :help ,(purecopy "Turn menu-bar on/off")
+                  :button
+                  (:toggle . (menu-bar-positive-p
+                              (frame-parameter (menu-bar-frame-for-menubar)
+                                               'menu-bar-lines)))))
+
+    (if (and (boundp 'menu-bar-showhide-tool-bar-menu)
+             (keymapp menu-bar-showhide-tool-bar-menu))
+        (define-key menu [showhide-tool-bar]
+          `(menu-item ,(purecopy "Tool-bar") ,menu-bar-showhide-tool-bar-menu
+                      :visible (display-graphic-p)))
+      ;; else not tool bar that can move.
+      (define-key menu [showhide-tool-bar]
+        `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
+                    :help ,(purecopy "Turn tool-bar on/off")
+                    :visible (display-graphic-p)
+                    :button
+                    (:toggle . (menu-bar-positive-p
+                                (frame-parameter (menu-bar-frame-for-menubar)
+                                                 'tool-bar-lines))))))
+    menu))
+
+(defun menu-bar-text-mode-auto-fill ()
+  (interactive)
+  (toggle-text-mode-auto-fill)
+  ;; This is somewhat questionable, as `text-mode-hook'
+  ;; might have changed outside customize.
+  ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
+  (customize-mark-as-set 'text-mode-hook))
+
+
+(defvar menu-bar-line-wrapping-menu
+  (let ((menu (make-sparse-keymap "Line Wrapping")))
+
+    (define-key menu [word-wrap]
+      `(menu-item ,(purecopy "Word Wrap (Visual Line mode)")
+                  (lambda ()
+                    (interactive)
+                    (unless visual-line-mode
+                      (visual-line-mode 1))
+                    (message ,(purecopy "Visual-Line mode enabled")))
+                  :help ,(purecopy "Wrap long lines at word boundaries")
+                  :button (:radio . (and (null truncate-lines)
+                                         (not (truncated-partial-width-window-p))
+                                         word-wrap))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+
+    (define-key menu [truncate]
+      `(menu-item ,(purecopy "Truncate Long Lines")
+                  (lambda ()
+                    (interactive)
+                    (if visual-line-mode (visual-line-mode 0))
+                    (setq word-wrap nil)
+                    (toggle-truncate-lines 1))
+                  :help ,(purecopy "Truncate long lines at window edge")
+                  :button (:radio . (or truncate-lines
+                                        (truncated-partial-width-window-p)))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)
+                  :enable (not (truncated-partial-width-window-p))))
+
+    (define-key menu [window-wrap]
+      `(menu-item ,(purecopy "Wrap at Window Edge")
+                  (lambda () (interactive)
+                    (if visual-line-mode (visual-line-mode 0))
+                    (setq word-wrap nil)
+                    (if truncate-lines (toggle-truncate-lines -1)))
+                  :help ,(purecopy "Wrap long lines at window edge")
+                  :button (:radio . (and (null truncate-lines)
+                                         (not (truncated-partial-width-window-p))
+                                         (not word-wrap)))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)
+                  :enable (not (truncated-partial-width-window-p))))
+    menu))
+
+(defvar menu-bar-options-menu
+  (let ((menu (make-sparse-keymap "Options")))
+    (define-key menu [customize]
+      `(menu-item ,(purecopy "Customize Emacs") ,menu-bar-custom-menu))
+
+    (define-key menu [package]
+      '(menu-item "Manage Emacs Packages" package-list-packages
+        :help "Install or uninstall additional Emacs packages"))
+
+    (define-key menu [save]
+      `(menu-item ,(purecopy "Save Options") menu-bar-options-save
+                  :help ,(purecopy "Save options set from the menu above")))
+
+    (define-key menu [custom-separator]
+      menu-bar-separator)
+
+    (define-key menu [menu-set-font]
+      `(menu-item ,(purecopy "Set Default Font...") menu-set-font
+                  :visible (display-multi-font-p)
+                  :help ,(purecopy "Select a default font")))
+
+    (if (featurep 'system-font-setting)
+        (define-key menu [menu-system-font]
+          (menu-bar-make-toggle
+           toggle-use-system-font font-use-system-font
+           "Use system font"
+           "Use system font: %s"
+           "Use the monospaced font defined by the system")))
+
+    (define-key menu [showhide]
+      `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))
+
+    (define-key menu [showhide-separator]
+      menu-bar-separator)
+
+    (define-key menu [mule]
+      ;; It is better not to use backquote here,
+      ;; because that makes a bootstrapping problem
+      ;; if you need to recompile all the Lisp files using interpreted code.
+      `(menu-item ,(purecopy "Multilingual Environment") ,mule-menu-keymap
+                  ;; Most of the MULE menu actually does make sense in
+                  ;; unibyte mode, e.g. language selection.
+                  ;; :visible '(default-value 'enable-multibyte-characters)
+                  ))
+    ;;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
+    ;;(define-key menu [preferences]
+    ;;  `(menu-item ,(purecopy "Preferences") ,menu-bar-preferences-menu
+    ;;       :help ,(purecopy "Toggle important global options")))
+
+    (define-key menu [mule-separator]
+      menu-bar-separator)
+
+    (define-key menu [debug-on-quit]
+      (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
+                            "Enter Debugger on Quit/C-g" "Debug on Quit %s"
+                            "Enter Lisp debugger when C-g is pressed"))
+    (define-key menu [debug-on-error]
+      (menu-bar-make-toggle toggle-debug-on-error debug-on-error
+                            "Enter Debugger on Error" "Debug on Error %s"
+                            "Enter Lisp debugger when an error is signaled"))
+    (define-key menu [debugger-separator]
+      menu-bar-separator)
+
+    (define-key menu [blink-cursor-mode]
+      (menu-bar-make-mm-toggle blink-cursor-mode
+                               "Blinking Cursor"
+                               "Whether the cursor blinks (Blink Cursor mode)"))
+    (define-key menu [cursor-separator]
+      menu-bar-separator)
+
+    (define-key menu [save-place]
+      (menu-bar-make-toggle toggle-save-place-globally save-place
+                            "Save Place in Files between Sessions"
+                            "Saving place in files %s"
+                            "Visit files of previous session when restarting Emacs"
+                            (require 'saveplace)
+                            ;; Do it by name, to avoid a free-variable
+                            ;; warning during byte compilation.
+                            (set-default
+                             'save-place (not (symbol-value 'save-place)))))
+
+    (define-key menu [uniquify]
+      (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
+                            "Use Directory Names in Buffer Names"
+                            "Directory name in buffer names (uniquify) %s"
+                            "Uniquify buffer names by adding parent directory names"
+                            (require 'uniquify)
+                            (setq uniquify-buffer-name-style
+                                  (if (not uniquify-buffer-name-style)
+                                      'forward))))
+
+    (define-key menu [edit-options-separator]
+      menu-bar-separator)
+    (define-key menu [cua-mode]
+      (menu-bar-make-mm-toggle cua-mode
+                               "C-x/C-c/C-v Cut and Paste (CUA)"
+                               "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
+                               (:visible (or (not (boundp 'cua-enable-cua-keys))
+                                             cua-enable-cua-keys))))
+
+    (define-key menu [cua-emulation-mode]
+      (menu-bar-make-mm-toggle cua-mode
+                               "Shift movement mark region (CUA)"
+                               "Use shifted movement keys to set and extend the region"
+                               (:visible (and (boundp 'cua-enable-cua-keys)
+                                              (not cua-enable-cua-keys)))))
+
+    (define-key menu [case-fold-search]
+      (menu-bar-make-toggle toggle-case-fold-search case-fold-search
+                            "Case-Insensitive Search"
+                            "Case-Insensitive Search %s"
+                            "Ignore letter-case in search commands"))
+
+    (define-key menu [auto-fill-mode]
+      `(menu-item ,(purecopy "Auto Fill in Text Modes")
+                  menu-bar-text-mode-auto-fill
+                  :help ,(purecopy "Automatically fill text while typing (Auto Fill mode)")
+                  :button (:toggle . (if (listp text-mode-hook)
+                                         (member 'turn-on-auto-fill text-mode-hook)
+                                       (eq 'turn-on-auto-fill text-mode-hook)))))
+
+    (define-key menu [line-wrapping]
+      `(menu-item ,(purecopy "Line Wrapping in this Buffer") ,menu-bar-line-wrapping-menu))
+
+
+    (define-key menu [highlight-separator]
+      menu-bar-separator)
+    (define-key menu [highlight-paren-mode]
+      (menu-bar-make-mm-toggle show-paren-mode
+                               "Paren Match Highlighting"
+                               "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
+    (define-key menu [transient-mark-mode]
+      (menu-bar-make-mm-toggle transient-mark-mode
+                               "Active Region Highlighting"
+                               "Make text in active region stand out in color (Transient Mark mode)"
+                               (:enable (not cua-mode))))
+    menu))
+
+\f
+;; The "Tools" menu items
+
+(defun send-mail-item-name ()
+  (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
+                                    (mh-e-user-agent . "MH")
+                                    (message-user-agent . "Gnus Message")
+                                    (gnus-user-agent . "Gnus")))
+        (name (assq mail-user-agent known-send-mail-commands)))
+    (if name
+       (setq name (cdr name))
+      (setq name (symbol-name mail-user-agent))
+      (if (string-match "\\(.+\\)-user-agent" name)
+         (setq name (match-string 1 name))))
+    name))
+
+(defun read-mail-item-name ()
+  (let* ((known-rmail-commands '((rmail . "RMAIL")
+                                (mh-rmail . "MH")
+                                (gnus . "Gnus")))
+        (known (assq read-mail-command known-rmail-commands)))
+    (if known (cdr known) (symbol-name read-mail-command))))
+
+(defvar menu-bar-games-menu
+  (let ((menu (make-sparse-keymap "Games")))
+
+    (define-key menu [zone]
+      `(menu-item ,(purecopy "Zone Out")  zone
+                  :help ,(purecopy "Play tricks with Emacs display when Emacs is idle")))
+    (define-key menu [tetris]
+      `(menu-item ,(purecopy "Tetris")  tetris
+                  :help ,(purecopy "Falling blocks game")))
+    (define-key menu [solitaire]
+      `(menu-item ,(purecopy "Solitaire")  solitaire
+                  :help ,(purecopy "Get rid of all the stones")))
+    (define-key menu [snake]
+      `(menu-item ,(purecopy "Snake")  snake
+                  :help ,(purecopy "Move snake around avoiding collisions")))
+    (define-key menu [pong]
+      `(menu-item ,(purecopy "Pong") pong
+                  :help ,(purecopy "Bounce the ball to your opponent")))
+    (define-key menu [mult]
+      `(menu-item ,(purecopy "Multiplication Puzzle")  mpuz
+                  :help ,(purecopy "Exercise brain with multiplication")))
+    (define-key menu [life]
+      `(menu-item ,(purecopy "Life")  life
+                  :help ,(purecopy "Watch how John Conway's cellular automaton evolves")))
+    (define-key menu [land]
+      `(menu-item ,(purecopy "Landmark") landmark
+                  :help ,(purecopy "Watch a neural-network robot learn landmarks")))
+    (define-key menu [hanoi]
+      `(menu-item ,(purecopy "Towers of Hanoi") hanoi
+                  :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs")))
+    (define-key menu [gomoku]
+      `(menu-item ,(purecopy "Gomoku")  gomoku
+                  :help ,(purecopy "Mark 5 contiguous squares (like tic-tac-toe)")))
+    (define-key menu [bubbles]
+      `(menu-item ,(purecopy "Bubbles") bubbles
+                  :help ,(purecopy "Remove all bubbles using the fewest moves")))
+    (define-key menu [black-box]
+      `(menu-item ,(purecopy "Blackbox")  blackbox
+                  :help ,(purecopy "Find balls in a black box by shooting rays")))
+    (define-key menu [adventure]
+      `(menu-item ,(purecopy "Adventure")  dunnet
+                  :help ,(purecopy "Dunnet, a text Adventure game for Emacs")))
+    (define-key menu [5x5]
+      `(menu-item ,(purecopy "5x5") 5x5
+                  :help ,(purecopy "Fill in all the squares on a 5x5 board")))
+    menu))
+
+(defvar menu-bar-encryption-decryption-menu
+  (let ((menu (make-sparse-keymap "Encryption/Decryption")))
+    (define-key menu [insert-keys]
+      `(menu-item ,(purecopy "Insert Keys") epa-insert-keys
+                  :help ,(purecopy "Insert public keys after the current point")))
+
+    (define-key menu [export-keys]
+      `(menu-item ,(purecopy "Export Keys") epa-export-keys
+                  :help ,(purecopy "Export public keys to a file")))
+
+    (define-key menu [import-keys-region]
+      `(menu-item ,(purecopy "Import Keys from Region") epa-import-keys-region
+                  :help ,(purecopy "Import public keys from the current region")))
+
+    (define-key menu [import-keys]
+      `(menu-item ,(purecopy "Import Keys from File...") epa-import-keys
+                  :help ,(purecopy "Import public keys from a file")))
+
+    (define-key menu [list-keys]
+      `(menu-item ,(purecopy "List Keys") epa-list-keys
+                  :help ,(purecopy "Browse your public keyring")))
+
+    (define-key menu [separator-keys]
+      menu-bar-separator)
+
+    (define-key menu [sign-region]
+      `(menu-item ,(purecopy "Sign Region") epa-sign-region
+                  :help ,(purecopy "Create digital signature of the current region")))
+
+    (define-key menu [verify-region]
+      `(menu-item ,(purecopy "Verify Region") epa-verify-region
+                  :help ,(purecopy "Verify digital signature of the current region")))
+
+    (define-key menu [encrypt-region]
+      `(menu-item ,(purecopy "Encrypt Region") epa-encrypt-region
+                  :help ,(purecopy "Encrypt the current region")))
+
+    (define-key menu [decrypt-region]
+      `(menu-item ,(purecopy "Decrypt Region") epa-decrypt-region
+                  :help ,(purecopy "Decrypt the current region")))
+
+    (define-key menu [separator-file]
+      menu-bar-separator)
+
+    (define-key menu [sign-file]
+      `(menu-item ,(purecopy "Sign File...") epa-sign-file
+                  :help ,(purecopy "Create digital signature of a file")))
+
+    (define-key menu [verify-file]
+      `(menu-item ,(purecopy "Verify File...") epa-verify-file
+                  :help ,(purecopy "Verify digital signature of a file")))
+
+    (define-key menu [encrypt-file]
+      `(menu-item ,(purecopy "Encrypt File...") epa-encrypt-file
+                  :help ,(purecopy "Encrypt a file")))
+
+    (define-key menu [decrypt-file]
+      `(menu-item ,(purecopy "Decrypt File...") epa-decrypt-file
+                  :help ,(purecopy "Decrypt a file")))
+
+    menu))
+
+(defun menu-bar-read-mail ()
+  "Read mail using `read-mail-command'."
+  (interactive)
+  (call-interactively read-mail-command))
+
+(defvar menu-bar-tools-menu
+  (let ((menu (make-sparse-keymap "Tools")))
+
+    (define-key menu [games]
+      `(menu-item ,(purecopy "Games") ,menu-bar-games-menu))
+
+    (define-key menu [separator-games]
+      menu-bar-separator)
+
+    (define-key menu [encryption-decryption]
+      `(menu-item ,(purecopy "Encryption/Decryption") ,menu-bar-encryption-decryption-menu))
+
+    (define-key menu [separator-encryption-decryption]
+      menu-bar-separator)
+
+    (define-key menu [simple-calculator]
+      `(menu-item ,(purecopy "Simple Calculator") calculator
+                  :help ,(purecopy "Invoke the Emacs built-in quick calculator")))
+    (define-key menu [calc]
+      `(menu-item ,(purecopy "Programmable Calculator") calc
+                  :help ,(purecopy "Invoke the Emacs built-in full scientific calculator")))
+    (define-key menu [calendar]
+      `(menu-item ,(purecopy "Calendar") calendar
+                  :help ,(purecopy "Invoke the Emacs built-in calendar")))
+
+    (define-key menu [separator-net]
+      menu-bar-separator)
+
+    (define-key menu [directory-search]
+      `(menu-item ,(purecopy "Directory Search") eudc-tools-menu))
+    (define-key menu [compose-mail]
+      `(menu-item (format "Send Mail (with %s)" (send-mail-item-name)) compose-mail
+                  :visible (and mail-user-agent (not (eq mail-user-agent 'ignore)))
+                  :help ,(purecopy "Send a mail message")))
+    (define-key menu [rmail]
+      `(menu-item (format "Read Mail (with %s)" (read-mail-item-name))
+                  menu-bar-read-mail
+                  :visible (and read-mail-command
+                                (not (eq read-mail-command 'ignore)))
+                  :help ,(purecopy "Read your mail and reply to it")))
+
+    (define-key menu [gnus]
+      `(menu-item ,(purecopy "Read Net News (Gnus)") gnus
+                  :help ,(purecopy "Read network news groups")))
+
+    (define-key menu [separator-vc]
+      menu-bar-separator)
+
+    (define-key menu [pcl-cvs]
+      `(menu-item ,(purecopy "PCL-CVS") cvs-global-menu))
+    (define-key menu [vc] nil) ;Create the place for the VC menu.
+
+    (define-key menu [separator-compare]
+      menu-bar-separator)
+
+    (define-key menu [epatch]
+      `(menu-item ,(purecopy "Apply Patch") menu-bar-epatch-menu))
+    (define-key menu [ediff-merge]
+      `(menu-item ,(purecopy "Merge") menu-bar-ediff-merge-menu))
+    (define-key menu [compare]
+      `(menu-item ,(purecopy "Compare (Ediff)") menu-bar-ediff-menu))
+
+    (define-key menu [separator-spell]
+      menu-bar-separator)
+
+    (define-key menu [spell]
+      `(menu-item ,(purecopy "Spell Checking") ispell-menu-map))
+
+    (define-key menu [separator-prog]
+      menu-bar-separator)
+
+    (define-key menu [semantic]
+      `(menu-item ,(purecopy "Source Code Parsers (Semantic)")
+                  semantic-mode
+                  :help ,(purecopy "Toggle automatic parsing in source code buffers (Semantic mode)")
+                  :button (:toggle . (bound-and-true-p semantic-mode))))
+
+    (define-key menu [ede]
+      `(menu-item ,(purecopy "Project support (EDE)")
+                  global-ede-mode
+                  :help ,(purecopy "Toggle the Emacs Development Environment (Global EDE mode)")
+                  :button (:toggle . (bound-and-true-p global-ede-mode))))
+
+    (define-key menu [gdb]
+      `(menu-item ,(purecopy "Debugger (GDB)...") gdb
+                  :help ,(purecopy "Debug a program from within Emacs with GDB")))
+    (define-key menu [shell-on-region]
+      `(menu-item ,(purecopy "Shell Command on Region...") shell-command-on-region
+                  :enable mark-active
+                  :help ,(purecopy "Pass marked region to a shell command")))
+    (define-key menu [shell]
+      `(menu-item ,(purecopy "Shell Command...") shell-command
+                  :help ,(purecopy "Invoke a shell command and catch its output")))
+    (define-key menu [compile]
+      `(menu-item ,(purecopy "Compile...") compile
+                  :help ,(purecopy "Invoke compiler or Make, view compilation errors")))
+    (define-key menu [grep]
+      `(menu-item ,(purecopy "Search Files (Grep)...") grep
+                  :help ,(purecopy "Search files for strings or regexps (with Grep)")))
+    menu))
+\f
+;; The "Help" menu items
+
+(defvar menu-bar-describe-menu
+  (let ((menu (make-sparse-keymap "Describe")))
+
+    (define-key menu [mule-diag]
+      `(menu-item ,(purecopy "Show All of Mule Status") mule-diag
+                  :visible (default-value 'enable-multibyte-characters)
+                  :help ,(purecopy "Display multilingual environment settings")))
+    (define-key menu [describe-coding-system-briefly]
+      `(menu-item ,(purecopy "Describe Coding System (Briefly)")
+                  describe-current-coding-system-briefly
+                  :visible (default-value 'enable-multibyte-characters)))
+    (define-key menu [describe-coding-system]
+      `(menu-item ,(purecopy "Describe Coding System...") describe-coding-system
+                  :visible (default-value 'enable-multibyte-characters)))
+    (define-key menu [describe-input-method]
+      `(menu-item ,(purecopy "Describe Input Method...") describe-input-method
+                  :visible (default-value 'enable-multibyte-characters)
+                  :help ,(purecopy "Keyboard layout for specific input method")))
+    (define-key menu [describe-language-environment]
+      `(menu-item ,(purecopy "Describe Language Environment")
+                  ,describe-language-environment-map))
+
+    (define-key menu [separator-desc-mule]
+      menu-bar-separator)
+
+    (define-key menu [list-keybindings]
+      `(menu-item ,(purecopy "List Key Bindings") describe-bindings
+                  :help ,(purecopy "Display all current key bindings (keyboard shortcuts)")))
+    (define-key menu [describe-current-display-table]
+      `(menu-item ,(purecopy "Describe Display Table") describe-current-display-table
+                  :help ,(purecopy "Describe the current display table")))
+    (define-key menu [describe-package]
+      `(menu-item ,(purecopy "Describe Package...") describe-package
+                  :help ,(purecopy "Display documentation of a Lisp package")))
+    (define-key menu [describe-face]
+      `(menu-item ,(purecopy "Describe Face...") describe-face
+                  :help ,(purecopy "Display the properties of a face")))
+    (define-key menu [describe-variable]
+      `(menu-item ,(purecopy "Describe Variable...") describe-variable
+                  :help ,(purecopy "Display documentation of variable/option")))
+    (define-key menu [describe-function]
+      `(menu-item ,(purecopy "Describe Function...") describe-function
+                  :help ,(purecopy "Display documentation of function/command")))
+    (define-key menu [describe-key-1]
+      `(menu-item ,(purecopy "Describe Key or Mouse Operation...") describe-key
+                  ;; Users typically don't identify keys and menu items...
+                  :help ,(purecopy "Display documentation of command bound to a \
+key, a click, or a menu-item")))
+    (define-key menu [describe-mode]
+      `(menu-item ,(purecopy "Describe Buffer Modes") describe-mode
+                  :help ,(purecopy "Describe this buffer's major and minor mode")))
+    menu))
+
+(defun menu-bar-read-lispref ()
+  "Display the Emacs Lisp Reference manual in Info mode."
+  (interactive)
+  (info "elisp"))
+
+(defun menu-bar-read-lispintro ()
+  "Display the Introduction to Emacs Lisp Programming in Info mode."
+  (interactive)
+  (info "eintr"))
+
+(defun search-emacs-glossary ()
+  "Display the Glossary node of the Emacs manual in Info mode."
+  (interactive)
+  (info "(emacs)Glossary"))
+
+(defun emacs-index-search (topic)
+  "Look up TOPIC in the indices of the Emacs User Manual."
+  (interactive "sSubject to look up: ")
+  (info "emacs")
+  (Info-index topic))
+
+(defun elisp-index-search (topic)
+  "Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
+  (interactive "sSubject to look up: ")
+  (info "elisp")
+  (Info-index topic))
+
+(defvar menu-bar-search-documentation-menu
+  (let ((menu (make-sparse-keymap "Search Documentation")))
+    
+    (define-key menu [search-documentation-strings]
+      `(menu-item ,(purecopy "Search Documentation Strings...") apropos-documentation
+                  :help
+                  ,(purecopy "Find functions and variables whose doc strings match a regexp")))
+    (define-key menu [find-any-object-by-name]
+      `(menu-item ,(purecopy "Find Any Object by Name...") apropos
+                  :help ,(purecopy "Find symbols of any kind whose names match a regexp")))
+    (define-key menu [find-option-by-value]
+      `(menu-item ,(purecopy "Find Options by Value...") apropos-value
+                  :help ,(purecopy "Find variables whose values match a regexp")))
+    (define-key menu [find-options-by-name]
+      `(menu-item ,(purecopy "Find Options by Name...") apropos-variable
+                  :help ,(purecopy "Find variables whose names match a regexp")))
+    (define-key menu [find-commands-by-name]
+      `(menu-item ,(purecopy "Find Commands by Name...") apropos-command
+                  :help ,(purecopy "Find commands whose names match a regexp")))
+    (define-key menu [sep1]
+      menu-bar-separator)
+    (define-key menu [lookup-command-in-manual]
+      `(menu-item ,(purecopy "Look Up Command in User Manual...") Info-goto-emacs-command-node
+                  :help ,(purecopy "Display manual section that describes a command")))
+    (define-key menu [lookup-key-in-manual]
+      `(menu-item ,(purecopy "Look Up Key in User Manual...") Info-goto-emacs-key-command-node
+                  :help ,(purecopy "Display manual section that describes a key")))
+    (define-key menu [lookup-subject-in-elisp-manual]
+      `(menu-item ,(purecopy "Look Up Subject in ELisp Manual...") elisp-index-search
+                  :help ,(purecopy "Find description of a subject in Emacs Lisp manual")))
+    (define-key menu [lookup-subject-in-emacs-manual]
+      `(menu-item ,(purecopy "Look Up Subject in User Manual...") emacs-index-search
+                  :help ,(purecopy "Find description of a subject in Emacs User manual")))
+    (define-key menu [emacs-terminology]
+      `(menu-item ,(purecopy "Emacs Terminology") search-emacs-glossary
+                  :help ,(purecopy "Display the Glossary section of the Emacs manual")))
+    menu))
+
+(defvar menu-bar-manuals-menu
+  (let ((menu (make-sparse-keymap "More Manuals")))
+
+    (define-key menu [man]
+      `(menu-item ,(purecopy "Read Man Page...") manual-entry
+                  :help ,(purecopy "Man-page docs for external commands and libraries")))
+    (define-key menu [sep2]
+      menu-bar-separator)
+    (define-key menu [order-emacs-manuals]
+      `(menu-item ,(purecopy "Ordering Manuals") view-order-manuals
+                  :help ,(purecopy "How to order manuals from the Free Software Foundation")))
+    (define-key menu [lookup-subject-in-all-manuals]
+      `(menu-item ,(purecopy "Lookup Subject in all Manuals...") info-apropos
+                  :help ,(purecopy "Find description of a subject in all installed manuals")))
+    (define-key menu [other-manuals]
+      `(menu-item ,(purecopy "All Other Manuals (Info)") Info-directory
+                  :help ,(purecopy "Read any of the installed manuals")))
+    (define-key menu [emacs-lisp-reference]
+      `(menu-item ,(purecopy "Emacs Lisp Reference") menu-bar-read-lispref
+                  :help ,(purecopy "Read the Emacs Lisp Reference manual")))
+    (define-key menu [emacs-lisp-intro]
+      `(menu-item ,(purecopy "Introduction to Emacs Lisp") menu-bar-read-lispintro
+                  :help ,(purecopy "Read the Introduction to Emacs Lisp Programming")))
+    menu))
+
+(defun menu-bar-help-extra-packages ()
+  "Display help about some additional packages available for Emacs."
+  (interactive)
+  (let (enable-local-variables)
+    (view-file (expand-file-name "MORE.STUFF"
+                                data-directory))
+    (goto-address-mode 1)))
+
+(defun help-with-tutorial-spec-language ()
+  "Use the Emacs tutorial, specifying which language you want."
+  (interactive)
+  (help-with-tutorial t))
+
+(defvar menu-bar-help-menu
+  (let ((menu (make-sparse-keymap "Help")))
+    (define-key menu [about-gnu-project]
+      `(menu-item ,(purecopy "About GNU") describe-gnu-project
+                  :help ,(purecopy "About the GNU System, GNU Project, and GNU/Linux")))
+    (define-key menu [about-emacs]
+      `(menu-item ,(purecopy "About Emacs") about-emacs
+                  :help ,(purecopy "Display version number, copyright info, and basic help")))
+    (define-key menu [sep4]
+      menu-bar-separator)
+    (define-key menu [describe-no-warranty]
+      `(menu-item ,(purecopy "(Non)Warranty") describe-no-warranty
+                  :help ,(purecopy "Explain that Emacs has NO WARRANTY")))
+    (define-key menu [describe-copying]
+      `(menu-item ,(purecopy "Copying Conditions") describe-copying
+                  :help ,(purecopy "Show the Emacs license (GPL)")))
+    (define-key menu [getting-new-versions]
+      `(menu-item ,(purecopy "Getting New Versions") describe-distribution
+                  :help ,(purecopy "How to get the latest version of Emacs")))
+    (define-key menu [sep2]
+      menu-bar-separator)
+    (define-key menu [external-packages]
+      `(menu-item ,(purecopy "Finding Extra Packages") menu-bar-help-extra-packages
+                  :help ,(purecopy "Lisp packages distributed separately for use in Emacs")))
+    (define-key menu [find-emacs-packages]
+      `(menu-item ,(purecopy "Search Built-in Packages") finder-by-keyword
+                  :help ,(purecopy "Find built-in packages and features by keyword")))
+    (define-key menu [more-manuals]
+      `(menu-item ,(purecopy "More Manuals") ,menu-bar-manuals-menu))
+    (define-key menu [emacs-manual]
+      `(menu-item ,(purecopy "Read the Emacs Manual") info-emacs-manual
+                  :help ,(purecopy "Full documentation of Emacs features")))
+    (define-key menu [describe]
+      `(menu-item ,(purecopy "Describe") ,menu-bar-describe-menu))
+    (define-key menu [search-documentation]
+      `(menu-item ,(purecopy "Search Documentation") ,menu-bar-search-documentation-menu))
+    (define-key menu [sep1]
+      menu-bar-separator)
+    (define-key menu [emacs-psychotherapist]
+      `(menu-item ,(purecopy "Emacs Psychotherapist") doctor
+                  :help ,(purecopy "Our doctor will help you feel better")))
+    (define-key menu [send-emacs-bug-report]
+      `(menu-item ,(purecopy "Send Bug Report...") report-emacs-bug
+                  :help ,(purecopy "Send e-mail to Emacs maintainers")))
+    (define-key menu [emacs-known-problems]
+      `(menu-item ,(purecopy "Emacs Known Problems") view-emacs-problems
+                  :help ,(purecopy "Read about known problems with Emacs")))
+    (define-key menu [emacs-news]
+      `(menu-item ,(purecopy "Emacs News") view-emacs-news
+                  :help ,(purecopy "New features of this version")))
+    (define-key menu [emacs-faq]
+      `(menu-item ,(purecopy "Emacs FAQ") view-emacs-FAQ
+                  :help ,(purecopy "Frequently asked (and answered) questions about Emacs")))
+
+    (define-key menu [emacs-tutorial-language-specific]
+      `(menu-item ,(purecopy "Emacs Tutorial (choose language)...")
+                  help-with-tutorial-spec-language
+                  :help ,(purecopy "Learn how to use Emacs (choose a language)")))
+    (define-key menu [emacs-tutorial]
+      `(menu-item ,(purecopy "Emacs Tutorial") help-with-tutorial
+                  :help ,(purecopy "Learn how to use Emacs")))
+
+    ;; In OS X it's in the app menu already.
+    ;; FIXME? There already is an "About Emacs" (sans ...) entry in the Help menu.
+    (and (featurep 'ns)
+         (not (eq system-type 'darwin))
+         (define-key menu [info-panel]
+           `(menu-item ,(purecopy "About Emacs...") ns-do-emacs-info-panel)))
+    menu))
+
+(define-key global-map [menu-bar tools]
+  (cons (purecopy "Tools") menu-bar-tools-menu))
+(define-key global-map [menu-bar buffer]
+  (cons (purecopy "Buffers") global-buffers-menu-map))
+(define-key global-map [menu-bar options]
+  (cons (purecopy "Options") menu-bar-options-menu))
+(define-key global-map [menu-bar edit]
+  (cons (purecopy "Edit") menu-bar-edit-menu))
+(define-key global-map [menu-bar file]
+  (cons (purecopy "File") menu-bar-file-menu))
+
+;; Put "Help" menu at the end, or Info at the front.
+;; If running under GNUstep, "Help" is moved and renamed "Info" (see below).
+(if (and (featurep 'ns)
+         (not (eq system-type 'darwin)))
+    (define-key global-map [menu-bar help-menu]
+      (cons (purecopy "Info") menu-bar-help-menu))
+  (define-key-after global-map [menu-bar help-menu]
+    (cons (purecopy "Help") menu-bar-help-menu)))
+
+(defun menu-bar-menu-frame-live-and-visible-p ()
+  "Return non-nil if the menu frame is alive and visible.
+The menu frame is the frame for which we are updating the menu."
+  (let ((menu-frame (or menu-updating-frame (selected-frame))))
+    (and (frame-live-p menu-frame)
+        (frame-visible-p menu-frame))))
+
+(defun menu-bar-non-minibuffer-window-p ()
+  "Return non-nil if selected window of the menu frame is not a minibuf window.
+
+See the documentation of `menu-bar-menu-frame-live-and-visible-p'
+for the definition of the menu frame."
+  (let ((menu-frame (or menu-updating-frame (selected-frame))))
+    (not (window-minibuffer-p (frame-selected-window menu-frame)))))
+
+(defun kill-this-buffer ()     ; for the menu bar
+  "Kill the current buffer.
+When called in the minibuffer, get out of the minibuffer
+using `abort-recursive-edit'."
+  (interactive)
+  (if (menu-bar-non-minibuffer-window-p)
+      (kill-buffer (current-buffer))
+    (abort-recursive-edit)))
+
+(defun kill-this-buffer-enabled-p ()
+  (let ((count 0)
+       (buffers (buffer-list)))
+    (while buffers
+      (or (string-match "^ " (buffer-name (car buffers)))
+         (setq count (1+ count)))
+      (setq buffers (cdr buffers)))
+    (or (not (menu-bar-non-minibuffer-window-p))
+       (> count 1))))
+
+(put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
+
+;; Permit deleting frame if it would leave a visible or iconified frame.
+(defun delete-frame-enabled-p ()
+  "Return non-nil if `delete-frame' should be enabled in the menu bar."
+  (let ((frames (frame-list))
+       (count 0))
+    (while frames
+      (if (frame-visible-p (car frames))
+         (setq count (1+ count)))
+      (setq frames (cdr frames)))
+    (> count 1)))
+
+(defcustom yank-menu-length 20
+  "Maximum length to display in the yank-menu."
+  :type 'integer
+  :group 'menu)
+
+(defun menu-bar-update-yank-menu (string old)
+  (let ((front (car (cdr yank-menu)))
+       (menu-string (if (<= (length string) yank-menu-length)
+                        string
+                      (concat
+                       (substring string 0 (/ yank-menu-length 2))
+                       "..."
+                       (substring string (- (/ yank-menu-length 2)))))))
+    ;; Don't let the menu string be all dashes
+    ;; because that has a special meaning in a menu.
+    (if (string-match "\\`-+\\'" menu-string)
+       (setq menu-string (concat menu-string " ")))
+    ;; If we're supposed to be extending an existing string, and that
+    ;; string really is at the front of the menu, then update it in place.
+    (if (and old (or (eq old (car front))
+                    (string= old (car front))))
+       (progn
+         (setcar front string)
+         (setcar (cdr front) menu-string))
+      (setcdr yank-menu
+             (cons
+              (cons string (cons menu-string 'menu-bar-select-yank))
+              (cdr yank-menu)))))
+  (if (> (length (cdr yank-menu)) kill-ring-max)
+      (setcdr (nthcdr kill-ring-max yank-menu) nil)))
+
+(put 'menu-bar-select-yank 'apropos-inhibit t)
+(defun menu-bar-select-yank ()
+  "Insert the stretch of previously-killed text selected from menu.
+The menu shows all the killed text sequences stored in `kill-ring'."
+  (interactive "*")
+  (push-mark (point))
+  (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
+unless `uniquify-buffer-name-style' is non-nil (in which case, buffer
+names should include enough of a buffer's directory to distinguish it
+from other buffers).
+
+Setting this variable directly does not take effect until next time the
+Buffers menu is regenerated."
+  :set (lambda (symbol value)
+        (set symbol value)
+        (menu-bar-update-buffers t))
+  :initialize 'custom-initialize-default
+  :type '(choice (const :tag "Never" nil)
+                (const :tag "Unless uniquify is enabled" unless-uniquify)
+                (const :tag "Always" t))
+  :group 'menu)
+
+(defcustom buffers-menu-show-status t
+  "If non-nil, show modified/read-only status of buffers in the Buffers menu.
+Setting this variable directly does not take effect until next time the
+Buffers menu is regenerated."
+  :set (lambda (symbol value)
+        (set symbol value)
+        (menu-bar-update-buffers t))
+  :initialize 'custom-initialize-default
+  :type 'boolean
+  :group 'menu)
+
+(defvar list-buffers-directory nil
+  "String to display in buffer listings for buffers not visiting a file.")
+(make-variable-buffer-local 'list-buffers-directory)
+
+(defun menu-bar-select-buffer ()
+  (interactive)
+  (switch-to-buffer last-command-event))
+
+(defun menu-bar-select-frame (frame)
+  (make-frame-visible frame)
+  (raise-frame frame)
+  (select-frame frame))
+
+(defun menu-bar-update-buffers-1 (elt)
+  (let* ((buf (car elt))
+        (file
+         (and (if (eq buffers-menu-show-directories 'unless-uniquify)
+                  (or (not (boundp 'uniquify-buffer-name-style))
+                      (null uniquify-buffer-name-style))
+                buffers-menu-show-directories)
+              (or (buffer-file-name buf)
+                  (buffer-local-value 'list-buffers-directory buf)))))
+    (when file
+      (setq file (file-name-directory file)))
+    (when (and file (> (length file) 20))
+      (setq file (concat "..." (substring file -17))))
+    (cons (if buffers-menu-show-status
+             (let ((mod (if (buffer-modified-p buf) "*" ""))
+                   (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
+               (if file
+                   (format "%s  %s%s  --  %s" (cdr elt) mod ro file)
+                 (format "%s  %s%s" (cdr elt) mod ro)))
+           (if file
+               (format "%s  --  %s"  (cdr elt) file)
+             (cdr elt)))
+         buf)))
+
+;; Used to cache the menu entries for commands in the Buffers menu
+(defvar menu-bar-buffers-menu-command-entries nil)
+
+(defun menu-bar-update-buffers (&optional force)
+  ;; If user discards the Buffers item, play along.
+  (and (lookup-key (current-global-map) [menu-bar buffer])
+       (or force (frame-or-buffer-changed-p))
+       (let ((buffers (buffer-list))
+            (frames (frame-list))
+            buffers-menu)
+        ;; If requested, list only the N most recently selected buffers.
+        (if (and (integerp buffers-menu-max-size)
+                 (> buffers-menu-max-size 1))
+            (if (> (length buffers) buffers-menu-max-size)
+                (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
+
+        ;; Make the menu of buffers proper.
+        (setq buffers-menu
+              (let (alist)
+                ;; Put into each element of buffer-list
+                ;; the name for actual display,
+                ;; perhaps truncated in the middle.
+                (dolist (buf buffers)
+                  (let ((name (buffer-name buf)))
+                     (unless (eq ?\s (aref name 0))
+                       (push (menu-bar-update-buffers-1
+                              (cons buf
+                                   (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))
+                       (i (length alist)))
+                   (dolist (pair alist)
+                     (setq i (1- i))
+                     (aset buffers-vec i
+                          (nconc (list (car pair)
+                                       (cons nil nil))
+                                 `(lambda ()
+                                     (interactive)
+                                     (switch-to-buffer ,(cdr pair))))))
+                   (list buffers-vec))))
+
+        ;; Make a Frames menu if we have more than one frame.
+        (when (cdr frames)
+          (let* ((frames-vec (make-vector (length frames) nil))
+                  (frames-menu
+                   (cons 'keymap
+                         (list "Select Frame" frames-vec)))
+                  (i 0))
+             (dolist (frame frames)
+               (aset frames-vec i
+                     (nconc
+                      (list
+                       (frame-parameter frame 'name)
+                       (cons nil nil))
+                      `(lambda ()
+                         (interactive) (menu-bar-select-frame ,frame))))
+               (setq i (1+ i)))
+            ;; Put it after the normal buffers
+            (setq buffers-menu
+                  (nconc buffers-menu
+                         `((frames-separator "--")
+                           (frames menu-item "Frames" ,frames-menu))))))
+
+        ;; Add in some normal commands at the end of the menu.  We use
+        ;; the copy cached in `menu-bar-buffers-menu-command-entries'
+        ;; if it's been set already.  Note that we can't use constant
+        ;; lists for the menu-entries, because the low-level menu-code
+        ;; modifies them.
+        (unless menu-bar-buffers-menu-command-entries
+          (setq menu-bar-buffers-menu-command-entries
+                (list '(command-separator "--")
+                      (list 'next-buffer
+                            'menu-item
+                            "Next Buffer"
+                            'next-buffer
+                            :help "Switch to the \"next\" buffer in a cyclic order")
+                      (list 'previous-buffer
+                            'menu-item
+                            "Previous Buffer"
+                            'previous-buffer
+                            :help "Switch to the \"previous\" buffer in a cyclic order")
+                      (list 'select-named-buffer
+                            'menu-item
+                            "Select Named Buffer..."
+                            'switch-to-buffer
+                            :help "Prompt for a buffer name, and select that buffer in the current window")
+                      (list 'list-all-buffers
+                            'menu-item
+                            "List All Buffers"
+                            'list-buffers
+                            :help "Pop up a window listing all Emacs buffers"
+                            ))))
+        (setq buffers-menu
+              (nconc buffers-menu menu-bar-buffers-menu-command-entries))
+
+         ;; We used to "(define-key (current-global-map) [menu-bar buffer]"
+         ;; but that did not do the right thing when the [menu-bar buffer]
+         ;; entry above had been moved (e.g. to a parent keymap).
+        (setcdr global-buffers-menu-map (cons "Select Buffer" buffers-menu)))))
+
+(add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
+
+(menu-bar-update-buffers)
+
+;; this version is too slow
+;;(defun format-buffers-menu-line (buffer)
+;;  "Returns a string to represent the given buffer in the Buffer menu.
+;;nil means the buffer shouldn't be listed.  You can redefine this."
+;;  (if (string-match "\\` " (buffer-name buffer))
+;;      nil
+;;    (with-current-buffer buffer
+;;     (let ((size (buffer-size)))
+;;       (format "%s%s %-19s %6s %-15s %s"
+;;            (if (buffer-modified-p) "*" " ")
+;;            (if buffer-read-only "%" " ")
+;;            (buffer-name)
+;;            size
+;;            mode-name
+;;            (or (buffer-file-name) ""))))))
+\f
+;;; Set up a menu bar menu for the minibuffer.
+
+(dolist (map (list minibuffer-local-map
+                  ;; This shouldn't be necessary, but there's a funny
+                  ;; bug in keymap.c that I don't understand yet.  -stef
+                  minibuffer-local-completion-map))
+  (define-key map [menu-bar minibuf]
+    (cons (purecopy "Minibuf") (make-sparse-keymap "Minibuf"))))
+
+(let ((map minibuffer-local-completion-map))
+  (define-key map [menu-bar minibuf ?\?]
+    `(menu-item ,(purecopy "List Completions") minibuffer-completion-help
+               :help ,(purecopy "Display all possible completions")))
+  (define-key map [menu-bar minibuf space]
+    `(menu-item ,(purecopy "Complete Word") minibuffer-complete-word
+               :help ,(purecopy "Complete at most one word")))
+  (define-key map [menu-bar minibuf tab]
+    `(menu-item ,(purecopy "Complete") minibuffer-complete
+               :help ,(purecopy "Complete as far as possible"))))
+
+(let ((map minibuffer-local-map))
+  (define-key map [menu-bar minibuf quit]
+    `(menu-item ,(purecopy "Quit") abort-recursive-edit
+               :help ,(purecopy "Abort input and exit minibuffer")))
+  (define-key map [menu-bar minibuf return]
+    `(menu-item ,(purecopy "Enter") exit-minibuffer
+               :key-sequence ,(purecopy "\r")
+               :help ,(purecopy "Terminate input and exit minibuffer")))
+  (define-key map [menu-bar minibuf isearch-forward]
+    `(menu-item ,(purecopy "Isearch History Forward") isearch-forward
+               :help ,(purecopy "Incrementally search minibuffer history forward")))
+  (define-key map [menu-bar minibuf isearch-backward]
+    `(menu-item ,(purecopy "Isearch History Backward") isearch-backward
+               :help ,(purecopy "Incrementally search minibuffer history backward")))
+  (define-key map [menu-bar minibuf next]
+    `(menu-item ,(purecopy "Next History Item") next-history-element
+               :help ,(purecopy "Put next minibuffer history element in the minibuffer")))
+  (define-key map [menu-bar minibuf previous]
+    `(menu-item ,(purecopy "Previous History Item") previous-history-element
+               :help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
+\f
+(define-minor-mode menu-bar-mode
+  "Toggle display of a menu bar on each frame.
+This command applies to all frames that exist and frames to be
+created in the future.
+With a numeric argument, if the argument is positive,
+turn on menu bars; otherwise, turn off menu bars."
+  :init-value t
+  :global t
+  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
+  :variable menu-bar-mode
+
+  ;; Turn the menu-bars on all frames on or off.
+  (let ((val (if menu-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'menu-bar-lines val))
+    ;; If the user has given `default-frame-alist' a `menu-bar-lines'
+    ;; parameter, replace it.
+    (if (assq 'menu-bar-lines default-frame-alist)
+       (setq default-frame-alist
+             (cons (cons 'menu-bar-lines val)
+                   (assq-delete-all 'menu-bar-lines
+                                    default-frame-alist)))))
+  ;; Make the message appear when Emacs is idle.  We can not call message
+  ;; directly.  The minor-mode message "Menu-bar mode disabled" comes
+  ;; after this function returns, overwriting any message we do here.
+  (when (and (called-interactively-p 'interactive) (not menu-bar-mode))
+    (run-with-idle-timer 0 nil 'message
+                        "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear.")))
+
+;;;###autoload
+;; (This does not work right unless it comes after the above definition.)
+;; This comment is taken from tool-bar.el near
+;; (put 'tool-bar-mode ...)
+;; We want to pretend the menu bar by standard is on, as this will make
+;; customize consider disabling the menu bar a customization, and save
+;; that.  We could do this for real by setting :init-value above, but
+;; that would overwrite disabling the menu bar from X resources.
+(put 'menu-bar-mode 'standard-value '(t))
+
+(defun toggle-menu-bar-mode-from-frame (&optional arg)
+  "Toggle menu bar on or off, based on the status of the current frame.
+See `menu-bar-mode' for more information."
+  (interactive (list (or current-prefix-arg 'toggle)))
+  (if (eq arg 'toggle)
+      (menu-bar-mode
+       (if (menu-bar-positive-p
+           (frame-parameter (menu-bar-frame-for-menubar) 'menu-bar-lines))
+           0 1))
+    (menu-bar-mode arg)))
+
+(declare-function x-menu-bar-open "term/x-win" (&optional frame))
+(declare-function w32-menu-bar-open "term/w32-win" (&optional frame))
+
+(defun menu-bar-open (&optional frame)
+  "Start key navigation of the menu bar in FRAME.
+
+This function decides which method to use to access the menu
+depending on FRAME's terminal device.  On X displays, it calls
+`x-menu-bar-open'; on Windows, `w32-menu-bar-open' otherwise it
+calls `tmm-menubar'.
+
+If FRAME is nil or not given, use the selected frame."
+  (interactive)
+  (let ((type (framep (or frame (selected-frame)))))
+    (cond
+     ((eq type 'x) (x-menu-bar-open frame))
+     ((eq type 'w32) (w32-menu-bar-open frame))
+     (t (with-selected-frame (or frame (selected-frame))
+          (tmm-menubar))))))
+
+(global-set-key [f10] 'menu-bar-open)
+
+(provide 'menu-bar)
+
+;;; menu-bar.el ends here
index 3c45887..d75b360 100644 (file)
@@ -490,6 +490,11 @@ If your system's ping continues until interrupted, you can try setting
 
 (autoload 'comint-mode "comint" nil t)
 
+(defvar nslookup-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\t" 'comint-dynamic-complete)
+    map))
+
 ;; Using a derived mode gives us keymaps, hooks, etc.
 (define-derived-mode nslookup-mode comint-mode "Nslookup"
   "Major mode for interacting with the nslookup program."
@@ -499,8 +504,6 @@ If your system's ping continues until interrupted, you can try setting
   (setq comint-prompt-regexp nslookup-prompt-regexp)
   (setq comint-input-autoexpand t))
 
-(define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
-
 ;;;###autoload
 (defun dns-lookup-host (host)
   "Lookup the DNS information for HOST (name or IP address)."
@@ -556,6 +559,12 @@ If your system's ping continues until interrupted, you can try setting
                   (list host)))
     (pop-to-buffer buf)))
 
+(defvar ftp-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Occasionally useful
+    (define-key map "\t" 'comint-dynamic-complete)
+    map))
+
 (define-derived-mode ftp-mode comint-mode "FTP"
   "Major mode for interacting with the ftp program."
   (setq comint-prompt-regexp ftp-prompt-regexp)
@@ -571,9 +580,6 @@ If your system's ping continues until interrupted, you can try setting
     (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt
              nil t)))
 
-;; Occasionally useful
-(define-key ftp-mode-map "\t" 'comint-dynamic-complete)
-
 (defun smbclient (host service)
   "Connect to SERVICE on HOST via SMB."
   (interactive
index 0e1279c..cd662cb 100644 (file)
@@ -378,6 +378,107 @@ images."
 ;;; Newsticker mode
 ;; ======================================================================
 
+
+;; newsticker menu
+(defvar newsticker-menu
+  (let ((map (make-sparse-keymap "Newsticker")))
+
+    (define-key map [newsticker-browse-url]
+      '("Browse URL for item at point" . newsticker-browse-url))
+    (define-key map [newsticker-separator-1]
+      '("--"))
+    (define-key map [newsticker-buffer-update]
+      '("Update buffer" . newsticker-buffer-update))
+    (define-key map [newsticker-separator-2]
+      '("--"))
+    (define-key map [newsticker-get-all-news]
+      '("Get news from all feeds" . newsticker-get-all-news))
+    (define-key map [newsticker-get-news-at-point]
+      '("Get news from feed at point" . newsticker-get-news-at-point))
+    (define-key map [newsticker-separator-3]
+      '("--"))
+    (define-key map [newsticker-mark-all-items-as-read]
+      '("Mark all items as read" . newsticker-mark-all-items-as-read))
+    (define-key map [newsticker-mark-all-items-at-point-as-read]
+      '("Mark all items in feed at point as read" .
+        newsticker-mark-all-items-at-point-as-read))
+    (define-key map [newsticker-mark-item-at-point-as-read]
+      '("Mark item at point as read" .
+        newsticker-mark-item-at-point-as-read))
+    (define-key map [newsticker-mark-item-at-point-as-immortal]
+      '("Toggle immortality for item at point" .
+        newsticker-mark-item-at-point-as-immortal))
+    (define-key map [newsticker-separator-4]
+      '("--"))
+    (define-key map [newsticker-toggle-auto-narrow-to-item]
+      '("Narrow to single item" . newsticker-toggle-auto-narrow-to-item))
+    (define-key map [newsticker-toggle-auto-narrow-to-feed]
+      '("Narrow to single news feed" . newsticker-toggle-auto-narrow-to-feed))
+    (define-key map [newsticker-hide-old-items]
+      '("Hide old items" . newsticker-hide-old-items))
+    (define-key map [newsticker-show-old-items]
+      '("Show old items" . newsticker-show-old-items))
+    (define-key map [newsticker-next-item]
+      '("Go to next item" . newsticker-next-item))
+    (define-key map [newsticker-previous-item]
+      '("Go to previous item" . newsticker-previous-item))
+    map))
+
+(defvar newsticker-mode-map
+  (let ((map (make-keymap)))
+    (define-key map "sO" 'newsticker-show-old-items)
+    (define-key map "hO" 'newsticker-hide-old-items)
+    (define-key map "sa" 'newsticker-show-all-desc)
+    (define-key map "ha" 'newsticker-hide-all-desc)
+    (define-key map "sf" 'newsticker-show-feed-desc)
+    (define-key map "hf" 'newsticker-hide-feed-desc)
+    (define-key map "so" 'newsticker-show-old-item-desc)
+    (define-key map "ho" 'newsticker-hide-old-item-desc)
+    (define-key map "sn" 'newsticker-show-new-item-desc)
+    (define-key map "hn" 'newsticker-hide-new-item-desc)
+    (define-key map "se" 'newsticker-show-entry)
+    (define-key map "he" 'newsticker-hide-entry)
+    (define-key map "sx" 'newsticker-show-extra)
+    (define-key map "hx" 'newsticker-hide-extra)
+
+    (define-key map " "  'scroll-up)
+    (define-key map "q"  'newsticker-close-buffer)
+    (define-key map "p"  'newsticker-previous-item)
+    (define-key map "P"  'newsticker-previous-new-item)
+    (define-key map "F"  'newsticker-previous-feed)
+    (define-key map "\t" 'newsticker-next-item)
+    (define-key map "n"  'newsticker-next-item)
+    (define-key map "N"  'newsticker-next-new-item)
+    (define-key map "f"  'newsticker-next-feed)
+    (define-key map "M"  'newsticker-mark-all-items-as-read)
+    (define-key map "m"
+      'newsticker-mark-all-items-at-point-as-read-and-redraw)
+    (define-key map "o"
+      'newsticker-mark-item-at-point-as-read)
+    (define-key map "O"
+      'newsticker-mark-all-items-at-point-as-read)
+    (define-key map "G"  'newsticker-get-all-news)
+    (define-key map "g"  'newsticker-get-news-at-point)
+    (define-key map "u"  'newsticker-buffer-update)
+    (define-key map "U"  'newsticker-buffer-force-update)
+    (define-key map "a"  'newsticker-add-url)
+
+    (define-key map "i"
+      'newsticker-mark-item-at-point-as-immortal)
+
+    (define-key map "xf"
+      'newsticker-toggle-auto-narrow-to-feed)
+    (define-key map "xi"
+      'newsticker-toggle-auto-narrow-to-item)
+
+    ;; Bind menu to mouse.
+    (define-key map [down-mouse-3] newsticker-menu)
+    ;; Put menu in menu-bar.
+    (define-key map [menu-bar Newsticker]
+      (cons "Newsticker" newsticker-menu))
+
+    map))
+
 (define-derived-mode newsticker-mode fundamental-mode
   "NewsTicker"
   "Viewing news feeds in Emacs."
@@ -414,114 +515,16 @@ images."
     (add-to-invisibility-spec 'extra))
   (newsticker--buffer-set-uptodate nil))
 
-;; refine its mode-map
-(define-key newsticker-mode-map "sO" 'newsticker-show-old-items)
-(define-key newsticker-mode-map "hO" 'newsticker-hide-old-items)
-(define-key newsticker-mode-map "sa" 'newsticker-show-all-desc)
-(define-key newsticker-mode-map "ha" 'newsticker-hide-all-desc)
-(define-key newsticker-mode-map "sf" 'newsticker-show-feed-desc)
-(define-key newsticker-mode-map "hf" 'newsticker-hide-feed-desc)
-(define-key newsticker-mode-map "so" 'newsticker-show-old-item-desc)
-(define-key newsticker-mode-map "ho" 'newsticker-hide-old-item-desc)
-(define-key newsticker-mode-map "sn" 'newsticker-show-new-item-desc)
-(define-key newsticker-mode-map "hn" 'newsticker-hide-new-item-desc)
-(define-key newsticker-mode-map "se" 'newsticker-show-entry)
-(define-key newsticker-mode-map "he" 'newsticker-hide-entry)
-(define-key newsticker-mode-map "sx" 'newsticker-show-extra)
-(define-key newsticker-mode-map "hx" 'newsticker-hide-extra)
-
-(define-key newsticker-mode-map " "  'scroll-up)
-(define-key newsticker-mode-map "q"  'newsticker-close-buffer)
-(define-key newsticker-mode-map "p"  'newsticker-previous-item)
-(define-key newsticker-mode-map "P"  'newsticker-previous-new-item)
-(define-key newsticker-mode-map "F"  'newsticker-previous-feed)
-(define-key newsticker-mode-map "\t" 'newsticker-next-item)
-(define-key newsticker-mode-map "n"  'newsticker-next-item)
-(define-key newsticker-mode-map "N"  'newsticker-next-new-item)
-(define-key newsticker-mode-map "f"  'newsticker-next-feed)
-(define-key newsticker-mode-map "M"  'newsticker-mark-all-items-as-read)
-(define-key newsticker-mode-map "m"
-  'newsticker-mark-all-items-at-point-as-read-and-redraw)
-(define-key newsticker-mode-map "o"
-  'newsticker-mark-item-at-point-as-read)
-(define-key newsticker-mode-map "O"
-  'newsticker-mark-all-items-at-point-as-read)
-(define-key newsticker-mode-map "G"  'newsticker-get-all-news)
-(define-key newsticker-mode-map "g"  'newsticker-get-news-at-point)
-(define-key newsticker-mode-map "u"  'newsticker-buffer-update)
-(define-key newsticker-mode-map "U"  'newsticker-buffer-force-update)
-(define-key newsticker-mode-map "a"  'newsticker-add-url)
-
-(define-key newsticker-mode-map "i"
-  'newsticker-mark-item-at-point-as-immortal)
-
-(define-key newsticker-mode-map "xf"
-  'newsticker-toggle-auto-narrow-to-feed)
-(define-key newsticker-mode-map "xi"
-  'newsticker-toggle-auto-narrow-to-item)
-
 ;; maps for the clickable portions
-(defvar newsticker--url-keymap (make-sparse-keymap)
+(defvar newsticker--url-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mouse-1] 'newsticker-mouse-browse-url)
+    (define-key map [mouse-2] 'newsticker-mouse-browse-url)
+    (define-key map "\n" 'newsticker-browse-url)
+    (define-key map "\C-m" 'newsticker-browse-url)
+    (define-key map [(control return)] 'newsticker-handle-url)
+    map)
   "Key map for click-able headings in the newsticker buffer.")
-(define-key newsticker--url-keymap [mouse-1]
-  'newsticker-mouse-browse-url)
-(define-key newsticker--url-keymap [mouse-2]
-  'newsticker-mouse-browse-url)
-(define-key newsticker--url-keymap "\n"
-  'newsticker-browse-url)
-(define-key newsticker--url-keymap "\C-m"
-  'newsticker-browse-url)
-(define-key newsticker--url-keymap [(control return)]
-  'newsticker-handle-url)
-
-;; newsticker menu
-(defvar newsticker-menu (make-sparse-keymap "Newsticker"))
-
-(define-key newsticker-menu [newsticker-browse-url]
-  '("Browse URL for item at point" . newsticker-browse-url))
-(define-key newsticker-menu [newsticker-separator-1]
-  '("--"))
-(define-key newsticker-menu [newsticker-buffer-update]
-  '("Update buffer" . newsticker-buffer-update))
-(define-key newsticker-menu [newsticker-separator-2]
-  '("--"))
-(define-key newsticker-menu [newsticker-get-all-news]
-  '("Get news from all feeds" . newsticker-get-all-news))
-(define-key newsticker-menu [newsticker-get-news-at-point]
-  '("Get news from feed at point" . newsticker-get-news-at-point))
-(define-key newsticker-menu [newsticker-separator-3]
-  '("--"))
-(define-key newsticker-menu [newsticker-mark-all-items-as-read]
-  '("Mark all items as read" . newsticker-mark-all-items-as-read))
-(define-key newsticker-menu [newsticker-mark-all-items-at-point-as-read]
-  '("Mark all items in feed at point as read" .
-    newsticker-mark-all-items-at-point-as-read))
-(define-key newsticker-menu [newsticker-mark-item-at-point-as-read]
-  '("Mark item at point as read" .
-    newsticker-mark-item-at-point-as-read))
-(define-key newsticker-menu [newsticker-mark-item-at-point-as-immortal]
-  '("Toggle immortality for item at point" .
-    newsticker-mark-item-at-point-as-immortal))
-(define-key newsticker-menu [newsticker-separator-4]
-  '("--"))
-(define-key newsticker-menu [newsticker-toggle-auto-narrow-to-item]
-  '("Narrow to single item" . newsticker-toggle-auto-narrow-to-item))
-(define-key newsticker-menu [newsticker-toggle-auto-narrow-to-feed]
-  '("Narrow to single news feed" . newsticker-toggle-auto-narrow-to-feed))
-(define-key newsticker-menu [newsticker-hide-old-items]
-  '("Hide old items" . newsticker-hide-old-items))
-(define-key newsticker-menu [newsticker-show-old-items]
-  '("Show old items" . newsticker-show-old-items))
-(define-key newsticker-menu [newsticker-next-item]
-  '("Go to next item" . newsticker-next-item))
-(define-key newsticker-menu [newsticker-previous-item]
-  '("Go to previous item" . newsticker-previous-item))
-
-;; bind menu to mouse
-(define-key newsticker-mode-map [down-mouse-3] newsticker-menu)
-;; Put menu in menu-bar
-(define-key newsticker-mode-map [menu-bar Newsticker]
-  (cons "Newsticker" newsticker-menu))
 
 
 ;; ======================================================================
index f058183..8e4ded6 100644 (file)
@@ -861,41 +861,43 @@ IRC command completion is performed only if '/' is the first input char."
   (interactive "zCoding system for outgoing messages: ")
   (setq rcirc-encode-coding-system coding-system))
 
-(defvar rcirc-mode-map (make-sparse-keymap)
+(defvar rcirc-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "RET") 'rcirc-send-input)
+    (define-key map (kbd "M-p") 'rcirc-insert-prev-input)
+    (define-key map (kbd "M-n") 'rcirc-insert-next-input)
+    (define-key map (kbd "TAB") 'rcirc-complete)
+    (define-key map (kbd "C-c C-b") 'rcirc-browse-url)
+    (define-key map (kbd "C-c C-c") 'rcirc-edit-multiline)
+    (define-key map (kbd "C-c C-j") 'rcirc-cmd-join)
+    (define-key map (kbd "C-c C-k") 'rcirc-cmd-kick)
+    (define-key map (kbd "C-c C-l") 'rcirc-toggle-low-priority)
+    (define-key map (kbd "C-c C-d") 'rcirc-cmd-mode)
+    (define-key map (kbd "C-c C-m") 'rcirc-cmd-msg)
+    (define-key map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
+    (define-key map (kbd "C-c C-o") 'rcirc-omit-mode)
+    (define-key map (kbd "M-o") 'rcirc-omit-mode)
+    (define-key map (kbd "C-c C-p") 'rcirc-cmd-part)
+    (define-key map (kbd "C-c C-q") 'rcirc-cmd-query)
+    (define-key map (kbd "C-c C-t") 'rcirc-cmd-topic)
+    (define-key map (kbd "C-c C-n") 'rcirc-cmd-names)
+    (define-key map (kbd "C-c C-w") 'rcirc-cmd-whois)
+    (define-key map (kbd "C-c C-x") 'rcirc-cmd-quit)
+    (define-key map (kbd "C-c TAB") ; C-i
+      'rcirc-toggle-ignore-buffer-activity)
+    (define-key map (kbd "C-c C-s") 'rcirc-switch-to-server-buffer)
+    (define-key map (kbd "C-c C-a") 'rcirc-jump-to-first-unread-line)
+    map)
   "Keymap for rcirc mode.")
 
-(define-key rcirc-mode-map (kbd "RET") 'rcirc-send-input)
-(define-key rcirc-mode-map (kbd "M-p") 'rcirc-insert-prev-input)
-(define-key rcirc-mode-map (kbd "M-n") 'rcirc-insert-next-input)
-(define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete)
-(define-key rcirc-mode-map (kbd "C-c C-b") 'rcirc-browse-url)
-(define-key rcirc-mode-map (kbd "C-c C-c") 'rcirc-edit-multiline)
-(define-key rcirc-mode-map (kbd "C-c C-j") 'rcirc-cmd-join)
-(define-key rcirc-mode-map (kbd "C-c C-k") 'rcirc-cmd-kick)
-(define-key rcirc-mode-map (kbd "C-c C-l") 'rcirc-toggle-low-priority)
-(define-key rcirc-mode-map (kbd "C-c C-d") 'rcirc-cmd-mode)
-(define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg)
-(define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
-(define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-omit-mode)
-(define-key rcirc-mode-map (kbd "M-o") 'rcirc-omit-mode)
-(define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part)
-(define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query)
-(define-key rcirc-mode-map (kbd "C-c C-t") 'rcirc-cmd-topic)
-(define-key rcirc-mode-map (kbd "C-c C-n") 'rcirc-cmd-names)
-(define-key rcirc-mode-map (kbd "C-c C-w") 'rcirc-cmd-whois)
-(define-key rcirc-mode-map (kbd "C-c C-x") 'rcirc-cmd-quit)
-(define-key rcirc-mode-map (kbd "C-c TAB") ; C-i
-  'rcirc-toggle-ignore-buffer-activity)
-(define-key rcirc-mode-map (kbd "C-c C-s") 'rcirc-switch-to-server-buffer)
-(define-key rcirc-mode-map (kbd "C-c C-a") 'rcirc-jump-to-first-unread-line)
-
-(defvar rcirc-browse-url-map (make-sparse-keymap)
+(defvar rcirc-browse-url-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "RET") 'rcirc-browse-url-at-point)
+    (define-key map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse)
+    (define-key map [follow-link] 'mouse-face)
+    map)
   "Keymap used for browsing URLs in `rcirc-mode'.")
 
-(define-key rcirc-browse-url-map (kbd "RET") 'rcirc-browse-url-at-point)
-(define-key rcirc-browse-url-map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse)
-(define-key rcirc-browse-url-map [follow-link] 'mouse-face)
-
 (defvar rcirc-short-buffer-name nil
   "Generated abbreviation to use to indicate buffer activity.")
 
@@ -1216,16 +1218,14 @@ Create the buffer if it doesn't exist."
       (and (> pos 0) (goto-char pos))
       (message "Type C-c C-c to return text to %s, or C-c C-k to cancel" parent))))
 
-(defvar rcirc-multiline-minor-mode-map (make-sparse-keymap)
+(defvar rcirc-multiline-minor-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c C-c") 'rcirc-multiline-minor-submit)
+    (define-key map (kbd "C-x C-s") 'rcirc-multiline-minor-submit)
+    (define-key map (kbd "C-c C-k") 'rcirc-multiline-minor-cancel)
+    (define-key map (kbd "ESC ESC ESC") 'rcirc-multiline-minor-cancel)
+    map)
   "Keymap for multiline mode in rcirc.")
-(define-key rcirc-multiline-minor-mode-map
-  (kbd "C-c C-c") 'rcirc-multiline-minor-submit)
-(define-key rcirc-multiline-minor-mode-map
-  (kbd "C-x C-s") 'rcirc-multiline-minor-submit)
-(define-key rcirc-multiline-minor-mode-map
-  (kbd "C-c C-k") 'rcirc-multiline-minor-cancel)
-(define-key rcirc-multiline-minor-mode-map
-  (kbd "ESC ESC ESC") 'rcirc-multiline-minor-cancel)
 
 (define-minor-mode rcirc-multiline-minor-mode
   "Minor mode for editing multiple lines in rcirc."
@@ -1742,12 +1742,13 @@ This function does not alter the INPUT string."
     (mapconcat 'identity sorted sep)))
 \f
 ;;; activity tracking
-(defvar rcirc-track-minor-mode-map (make-sparse-keymap)
+(defvar rcirc-track-minor-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c C-@") 'rcirc-next-active-buffer)
+    (define-key map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
+    map)
   "Keymap for rcirc track minor mode.")
 
-(define-key rcirc-track-minor-mode-map (kbd "C-c C-@") 'rcirc-next-active-buffer)
-(define-key rcirc-track-minor-mode-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
-
 ;;;###autoload
 (define-minor-mode rcirc-track-minor-mode
   "Global minor mode for tracking activity in rcirc buffers."
index b35cf07..5f0908e 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * org-remember.el (org-remember-mode-map):
+       * org-src.el (org-src-mode-map): Move initialization into declaration.
+
 2011-01-13  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * org-remember.el (org-remember-mode):
index 80f9dad..fd3064a 100644 (file)
@@ -214,7 +214,11 @@ The remember buffer is still current when this hook runs."
   :group 'org-remember
   :type 'hook)
 
-(defvar org-remember-mode-map (make-sparse-keymap)
+(defvar org-remember-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-c" 'org-remember-finalize)
+    (define-key map "\C-c\C-k" 'org-remember-kill)
+    map)
   "Keymap for `org-remember-mode', a minor mode.
 Use this map to set additional keybindings for when Org-mode is used
 for a Remember buffer.")
@@ -224,8 +228,6 @@ for a Remember buffer.")
 (define-minor-mode org-remember-mode
   "Minor mode for special key bindings in a remember buffer."
   nil " Rem" org-remember-mode-map)
-(define-key org-remember-mode-map "\C-c\C-c" 'org-remember-finalize)
-(define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill)
 
 (defcustom org-remember-clock-out-on-exit 'query
   "Non-nil means stop the clock when exiting a clocking remember buffer.
index 0777970..98fdb75 100644 (file)
@@ -169,8 +169,10 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is
 
 ;;; Editing source examples
 
-(defvar org-src-mode-map (make-sparse-keymap))
-(define-key org-src-mode-map "\C-c'" 'org-edit-src-exit)
+(defvar org-src-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c'" 'org-edit-src-exit)
+    map))
 
 (defvar org-edit-src-force-single-line nil)
 (defvar org-edit-src-from-org-mode nil)
index d0ba9b0..cd353d2 100644 (file)
@@ -565,6 +565,20 @@ buffer, it is replaced by the new value.  See the documentation for
     (gametree-hack-file-layout))
   nil)
 
+;;;; Key bindings
+(defvar gametree-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-j" 'gametree-break-line-here)
+    (define-key map "\C-c\C-v" 'gametree-insert-new-leaf)
+    (define-key map "\C-c\C-m" 'gametree-merge-line)
+    (define-key map "\C-c\C-r " 'gametree-layout-to-register)
+    (define-key map "\C-c\C-r/" 'gametree-layout-to-register)
+    (define-key map "\C-c\C-rj" 'gametree-apply-register-layout)
+    (define-key map "\C-c\C-y" 'gametree-save-and-hack-layout)
+    (define-key map "\C-c;" 'gametree-insert-score)
+    (define-key map "\C-c^" 'gametree-compute-and-insert-score)
+    map))
+
 (define-derived-mode gametree-mode outline-mode "GameTree"
   "Major mode for managing game analysis trees.
 Useful to postal and email chess (and, it is hoped, also checkers, go,
@@ -575,18 +589,6 @@ shogi, etc.) players, it is a slightly modified version of Outline mode.
   (make-local-variable 'write-contents-hooks)
   (add-hook 'write-contents-hooks 'gametree-save-and-hack-layout))
 
-;;;; Key bindings
-
-(define-key gametree-mode-map "\C-c\C-j" 'gametree-break-line-here)
-(define-key gametree-mode-map "\C-c\C-v" 'gametree-insert-new-leaf)
-(define-key gametree-mode-map "\C-c\C-m" 'gametree-merge-line)
-(define-key gametree-mode-map "\C-c\C-r " 'gametree-layout-to-register)
-(define-key gametree-mode-map "\C-c\C-r/" 'gametree-layout-to-register)
-(define-key gametree-mode-map "\C-c\C-rj" 'gametree-apply-register-layout)
-(define-key gametree-mode-map "\C-c\C-y" 'gametree-save-and-hack-layout)
-(define-key gametree-mode-map "\C-c;" 'gametree-insert-score)
-(define-key gametree-mode-map "\C-c^" 'gametree-compute-and-insert-score)
-
 ;;;; Goodies for mousing users
 (and (fboundp 'track-mouse)
      (defun gametree-mouse-break-line-here (event)
index 5bab360..601232e 100644 (file)
 
 (defvar handwrite-psindex 0
   "The index of the PostScript buffer.")
-(defvar menu-bar-handwrite-map (make-sparse-keymap "Handwrite functions."))
-(fset 'menu-bar-handwrite-map (symbol-value 'menu-bar-handwrite-map))
+(defvar menu-bar-handwrite-map
+  (let ((map (make-sparse-keymap "Handwrite functions.")))
+    (define-key map [numbering]
+      '(menu-item "Page numbering" handwrite-set-pagenumber
+        :button (:toggle . handwrite-pagenumbering)))
+    (define-key map [handwrite-separator2] '("----" . nil))
+    (define-key map [10pt] '(menu-item "10 pt" handwrite-10pt
+                             :button (:radio . (eq handwrite-fontsize 10))))
+    (define-key map [11pt] '(menu-item "11 pt" handwrite-11pt
+                             :button (:radio . (eq handwrite-fontsize 11))))
+    (define-key map [12pt] '(menu-item "12 pt" handwrite-12pt
+                             :button (:radio . (eq handwrite-fontsize 12))))
+    (define-key map [13pt] '(menu-item "13 pt" handwrite-13pt
+                             :button (:radio . (eq handwrite-fontsize 13))))
+    (define-key map [handwrite-separator1] '("----" . nil))
+    (define-key map [handwrite] '("Write by hand" . handwrite))
+    map))
+(fset 'menu-bar-handwrite-map menu-bar-handwrite-map)
 
 
 ;; User definable variables
 The functions `handwrite-10pt', `handwrite-11pt', `handwrite-12pt'
 and `handwrite-13pt' set up for various sizes of output.
 
-Variables: handwrite-linespace     (default 12)
-           handwrite-fontsize      (default 11)
-           handwrite-numlines      (default 60)
-           handwrite-pagenumbering (default nil)"
+Variables: `handwrite-linespace'     (default 12)
+           `handwrite-fontsize'      (default 11)
+           `handwrite-numlines'      (default 60)
+           `handwrite-pagenumbering' (default nil)"
   (interactive)
   (let
       ((pmin)                          ; thanks, Havard
@@ -258,7 +274,8 @@ Variables: handwrite-linespace     (default 12)
   "Toggle the value of `handwrite-pagenumbering'."
   (interactive)
   (if handwrite-pagenumbering
-      (handwrite-set-pagenumber-off)(handwrite-set-pagenumber-on)))
+      (handwrite-set-pagenumber-off)
+    (handwrite-set-pagenumber-on)))
 
 (defun handwrite-10pt ()
   "Specify 10-point output for `handwrite.
@@ -268,14 +285,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 10)
   (setq handwrite-linespace 11)
   (setq handwrite-numlines handwrite-10pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt *" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 10 points"))
 
 
@@ -287,14 +296,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 11)
   (setq handwrite-linespace 12)
   (setq handwrite-numlines handwrite-11pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt *" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 11 points"))
 
 (defun handwrite-12pt ()
@@ -305,14 +306,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 12)
   (setq handwrite-linespace 13)
   (setq handwrite-numlines handwrite-12pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt *" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 12 points"))
 
 (defun handwrite-13pt ()
@@ -323,14 +316,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 13)
   (setq handwrite-linespace 14)
   (setq handwrite-numlines handwrite-13pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt *" . handwrite-13pt))
   (message "Handwrite output size set to 13 points"))
 
 
@@ -1263,62 +1248,24 @@ end
 ;;Sets page numbering off
 (defun handwrite-set-pagenumber-off ()
   (setq handwrite-pagenumbering nil)
-  (define-key menu-bar-handwrite-map
-    [numbering]
-    '("Page numbering Off" . handwrite-set-pagenumber))
   (message "page numbering off"))
 
 ;;Sets page numbering on
 (defun handwrite-set-pagenumber-on ()
   (setq handwrite-pagenumbering t)
-  (define-key menu-bar-handwrite-map
-    [numbering]
-    '("Page numbering On" . handwrite-set-pagenumber))
   (message "page numbering on" ))
 
 
 ;; Key bindings
 
-
-;;; I'd rather not fill up the menu bar menus with
-;;; lots of random miscellaneous features. -- rms.
+;; I'd rather not fill up the menu bar menus with
+;; lots of random miscellaneous features. -- rms.
 ;;;(define-key-after
 ;;;  (lookup-key global-map [menu-bar edit])
 ;;;  [handwrite]
 ;;;  '("Write by hand" . menu-bar-handwrite-map)
 ;;;  'spell)
 
-(define-key menu-bar-handwrite-map [numbering]
-  '("Page numbering Off" . handwrite-set-pagenumber))
-
-(define-key menu-bar-handwrite-map [10pt]
-  '("10 pt" . handwrite-10pt))
-
-(define-key menu-bar-handwrite-map [11pt]
-  '("11 pt *" . handwrite-11pt))
-
-(define-key menu-bar-handwrite-map [12pt]
-  '("12 pt" . handwrite-12pt))
-
-(define-key menu-bar-handwrite-map [13pt]
-  '("13 pt" . handwrite-13pt))
-
-(define-key menu-bar-handwrite-map [handwrite]
-  '("Write by hand" . handwrite))
-
-(define-key-after
-  (lookup-key menu-bar-handwrite-map [ ])
-  [handwrite-separator1]
-  '("----" . nil)
-  'handwrite)
-
-(define-key-after
-  (lookup-key menu-bar-handwrite-map [ ])
-  [handwrite-separator2]
-  '("----" . nil)
-  '10pt)
-
-
 (provide 'handwrite)
 
 
index a291283..e993e76 100644 (file)
 ;;; Initialize maps
 
 (defvar pong-mode-map
-  (make-sparse-keymap 'pong-mode-map) "Modemap for pong-mode.")
+  (let ((map (make-sparse-keymap 'pong-mode-map)))
+    (define-key map [left]      'pong-move-left)
+    (define-key map [right]     'pong-move-right)
+    (define-key map [up]                'pong-move-up)
+    (define-key map [down]      'pong-move-down)
+    (define-key map pong-left-key  'pong-move-left)
+    (define-key map pong-right-key 'pong-move-right)
+    (define-key map pong-up-key         'pong-move-up)
+    (define-key map pong-down-key  'pong-move-down)
+    (define-key map pong-quit-key  'pong-quit)
+    (define-key map pong-pause-key 'pong-pause)
+    map)
+  "Modemap for pong-mode.")
 
 (defvar pong-null-map
   (make-sparse-keymap 'pong-null-map) "Null map for pong-mode.")
 
-(define-key pong-mode-map [left]        'pong-move-left)
-(define-key pong-mode-map [right]       'pong-move-right)
-(define-key pong-mode-map [up]          'pong-move-up)
-(define-key pong-mode-map [down]        'pong-move-down)
-(define-key pong-mode-map pong-left-key  'pong-move-left)
-(define-key pong-mode-map pong-right-key 'pong-move-right)
-(define-key pong-mode-map pong-up-key   'pong-move-up)
-(define-key pong-mode-map pong-down-key  'pong-move-down)
-(define-key pong-mode-map pong-quit-key  'pong-quit)
-(define-key pong-mode-map pong-pause-key 'pong-pause)
 
 
 ;;; Fun stuff -- The code
index 3714e6b..418c898 100644 (file)
@@ -174,21 +174,22 @@ and then start moving it leftwards.")
 ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defvar snake-mode-map
-  (make-sparse-keymap 'snake-mode-map))
+  (let ((map (make-sparse-keymap 'snake-mode-map)))
 
-(define-key snake-mode-map "n"         'snake-start-game)
-(define-key snake-mode-map "q"         'snake-end-game)
-(define-key snake-mode-map "p"         'snake-pause-game)
+    (define-key map "n"                'snake-start-game)
+    (define-key map "q"                'snake-end-game)
+    (define-key map "p"                'snake-pause-game)
 
-(define-key snake-mode-map [left]      'snake-move-left)
-(define-key snake-mode-map [right]     'snake-move-right)
-(define-key snake-mode-map [up]                'snake-move-up)
-(define-key snake-mode-map [down]      'snake-move-down)
+    (define-key map [left]     'snake-move-left)
+    (define-key map [right]    'snake-move-right)
+    (define-key map [up]               'snake-move-up)
+    (define-key map [down]     'snake-move-down)
+    map))
 
 (defvar snake-null-map
-  (make-sparse-keymap 'snake-null-map))
-
-(define-key snake-null-map "n"         'snake-start-game)
+  (let ((map (make-sparse-keymap 'snake-null-map)))
+    (define-key map "n"                'snake-start-game)
+    map))
 
 ;; ;;;;;;;;;;;;;;;; game functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
index 3e6e941..9d6a0ef 100644 (file)
   :type 'hook
   :group 'solitaire)
 
+(defvar solitaire-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map special-mode-map)
+
+    (define-key map "\C-f" 'solitaire-right)
+    (define-key map "\C-b" 'solitaire-left)
+    (define-key map "\C-p" 'solitaire-up)
+    (define-key map "\C-n" 'solitaire-down)
+    (define-key map "\r" 'solitaire-move)
+    (define-key map [remap undo] 'solitaire-undo)
+    (define-key map " " 'solitaire-do-check)
+
+    (define-key map [right] 'solitaire-right)
+    (define-key map [left] 'solitaire-left)
+    (define-key map [up] 'solitaire-up)
+    (define-key map [down] 'solitaire-down)
+
+    (define-key map [S-right] 'solitaire-move-right)
+    (define-key map [S-left]  'solitaire-move-left)
+    (define-key map [S-up]    'solitaire-move-up)
+    (define-key map [S-down]  'solitaire-move-down)
+
+    (define-key map [kp-6] 'solitaire-right)
+    (define-key map [kp-4] 'solitaire-left)
+    (define-key map [kp-8] 'solitaire-up)
+    (define-key map [kp-2] 'solitaire-down)
+    (define-key map [kp-5] 'solitaire-center-point)
+
+    (define-key map [S-kp-6] 'solitaire-move-right)
+    (define-key map [S-kp-4] 'solitaire-move-left)
+    (define-key map [S-kp-8] 'solitaire-move-up)
+    (define-key map [S-kp-2] 'solitaire-move-down)
+
+    (define-key map [kp-enter] 'solitaire-move)
+    (define-key map [kp-0] 'solitaire-undo)
+
+    ;; spoil it with s ;)
+    (define-key map [?s] 'solitaire-solve)
+
+    ;;  (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
+    map)
+  "Keymap for playing Solitaire.")
+
 ;; Solitaire mode is suitable only for specially formatted data.
 (put 'solitaire-mode 'mode-class 'special)
 
@@ -54,41 +97,6 @@ The usual mnemonic keys move the cursor around the board; in addition,
   (setq truncate-lines t)
   (setq show-trailing-whitespace nil))
 
-(define-key solitaire-mode-map "\C-f" 'solitaire-right)
-(define-key solitaire-mode-map "\C-b" 'solitaire-left)
-(define-key solitaire-mode-map "\C-p" 'solitaire-up)
-(define-key solitaire-mode-map "\C-n" 'solitaire-down)
-(define-key solitaire-mode-map "\r" 'solitaire-move)
-(define-key solitaire-mode-map [remap undo] 'solitaire-undo)
-(define-key solitaire-mode-map " " 'solitaire-do-check)
-
-(define-key solitaire-mode-map [right] 'solitaire-right)
-(define-key solitaire-mode-map [left] 'solitaire-left)
-(define-key solitaire-mode-map [up] 'solitaire-up)
-(define-key solitaire-mode-map [down] 'solitaire-down)
-
-(define-key solitaire-mode-map [S-right] 'solitaire-move-right)
-(define-key solitaire-mode-map [S-left]  'solitaire-move-left)
-(define-key solitaire-mode-map [S-up]    'solitaire-move-up)
-(define-key solitaire-mode-map [S-down]  'solitaire-move-down)
-
-(define-key solitaire-mode-map [kp-6] 'solitaire-right)
-(define-key solitaire-mode-map [kp-4] 'solitaire-left)
-(define-key solitaire-mode-map [kp-8] 'solitaire-up)
-(define-key solitaire-mode-map [kp-2] 'solitaire-down)
-(define-key solitaire-mode-map [kp-5] 'solitaire-center-point)
-
-(define-key solitaire-mode-map [S-kp-6] 'solitaire-move-right)
-(define-key solitaire-mode-map [S-kp-4] 'solitaire-move-left)
-(define-key solitaire-mode-map [S-kp-8] 'solitaire-move-up)
-(define-key solitaire-mode-map [S-kp-2] 'solitaire-move-down)
-
-(define-key solitaire-mode-map [kp-enter] 'solitaire-move)
-(define-key solitaire-mode-map [kp-0] 'solitaire-undo)
-
-;; spoil it with s ;)
-(define-key solitaire-mode-map [?s] 'solitaire-solve)
-;;  (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
 (defvar solitaire-stones 0
   "Counter for the stones that are still there.")
 
index bbe9722..25d1410 100644 (file)
@@ -2983,25 +2983,27 @@ DOC is an optional documentation string."
     map)
   "Keymap to select format in the header line.")
 
-(defvar gdb-memory-format-menu (make-sparse-keymap "Format")
+(defvar gdb-memory-format-menu
+  (let ((map (make-sparse-keymap "Format")))
+
+    (define-key map [binary]
+      '(menu-item "Binary" gdb-memory-format-binary
+        :button (:radio . (equal gdb-memory-format "t"))))
+    (define-key map [octal]
+      '(menu-item "Octal" gdb-memory-format-octal
+        :button (:radio . (equal gdb-memory-format "o"))))
+    (define-key map [unsigned]
+      '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
+        :button (:radio . (equal gdb-memory-format "u"))))
+    (define-key map [signed]
+      '(menu-item "Signed Decimal" gdb-memory-format-signed
+        :button (:radio . (equal gdb-memory-format "d"))))
+    (define-key map [hexadecimal]
+      '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
+        :button (:radio . (equal gdb-memory-format "x"))))
+    map)
   "Menu of display formats in the header line.")
 
-(define-key gdb-memory-format-menu [binary]
-  '(menu-item "Binary" gdb-memory-format-binary
-             :button (:radio . (equal gdb-memory-format "t"))))
-(define-key gdb-memory-format-menu [octal]
-  '(menu-item "Octal" gdb-memory-format-octal
-             :button (:radio . (equal gdb-memory-format "o"))))
-(define-key gdb-memory-format-menu [unsigned]
-  '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned
-             :button (:radio . (equal gdb-memory-format "u"))))
-(define-key gdb-memory-format-menu [signed]
-  '(menu-item "Signed Decimal" gdb-memory-format-signed
-             :button (:radio . (equal gdb-memory-format "d"))))
-(define-key gdb-memory-format-menu [hexadecimal]
-  '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal
-             :button (:radio . (equal gdb-memory-format "x"))))
-
 (defun gdb-memory-format-menu (event)
   (interactive "@e")
   (x-popup-menu event gdb-memory-format-menu))
@@ -3061,22 +3063,23 @@ DOC is an optional documentation string."
     map)
   "Keymap to select units in the header line.")
 
-(defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
+(defvar gdb-memory-unit-menu
+  (let ((map (make-sparse-keymap "Unit")))
+    (define-key map [giantwords]
+      '(menu-item "Giant words" gdb-memory-unit-giant
+        :button (:radio . (equal gdb-memory-unit 8))))
+    (define-key map [words]
+      '(menu-item "Words" gdb-memory-unit-word
+        :button (:radio . (equal gdb-memory-unit 4))))
+    (define-key map [halfwords]
+      '(menu-item "Halfwords" gdb-memory-unit-halfword
+        :button (:radio . (equal gdb-memory-unit 2))))
+    (define-key map [bytes]
+      '(menu-item "Bytes" gdb-memory-unit-byte
+        :button (:radio . (equal gdb-memory-unit 1))))
+    map)
   "Menu of units in the header line.")
 
-(define-key gdb-memory-unit-menu [giantwords]
-  '(menu-item "Giant words" gdb-memory-unit-giant
-             :button (:radio . (equal gdb-memory-unit 8))))
-(define-key gdb-memory-unit-menu [words]
-  '(menu-item "Words" gdb-memory-unit-word
-             :button (:radio . (equal gdb-memory-unit 4))))
-(define-key gdb-memory-unit-menu [halfwords]
-  '(menu-item "Halfwords" gdb-memory-unit-halfword
-             :button (:radio . (equal gdb-memory-unit 2))))
-(define-key gdb-memory-unit-menu [bytes]
-  '(menu-item "Bytes" gdb-memory-unit-byte
-             :button (:radio . (equal gdb-memory-unit 1))))
-
 (defun gdb-memory-unit-menu (event)
   (interactive "@e")
   (x-popup-menu event gdb-memory-unit-menu))
index 1b32c78..7202d95 100644 (file)
@@ -219,23 +219,24 @@ support."
 
 ;; Define the key bindings for the Help application
 
-(defvar idlwave-help-mode-map (make-sparse-keymap)
+(defvar idlwave-help-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "q" 'idlwave-help-quit)
+    (define-key map "w" 'widen)
+    (define-key map "\C-m" (lambda (arg)
+                             (interactive "p")
+                             (scroll-up arg)))
+    (define-key map " " 'scroll-up)
+    (define-key map [delete] 'scroll-down)
+    (define-key map "h" 'idlwave-help-find-header)
+    (define-key map "H" 'idlwave-help-find-first-header)
+    (define-key map "." 'idlwave-help-toggle-header-match-and-def)
+    (define-key map "F" 'idlwave-help-fontify)
+    (define-key map "\M-?" 'idlwave-help-return-to-calling-frame)
+    (define-key map "x" 'idlwave-help-return-to-calling-frame)
+    map)
   "The keymap used in `idlwave-help-mode'.")
 
-(define-key idlwave-help-mode-map "q" 'idlwave-help-quit)
-(define-key idlwave-help-mode-map "w" 'widen)
-(define-key idlwave-help-mode-map "\C-m" (lambda (arg)
-                                          (interactive "p")
-                                          (scroll-up arg)))
-(define-key idlwave-help-mode-map " " 'scroll-up)
-(define-key idlwave-help-mode-map [delete] 'scroll-down)
-(define-key idlwave-help-mode-map "h" 'idlwave-help-find-header)
-(define-key idlwave-help-mode-map "H" 'idlwave-help-find-first-header)
-(define-key idlwave-help-mode-map "." 'idlwave-help-toggle-header-match-and-def)
-(define-key idlwave-help-mode-map "F" 'idlwave-help-fontify)
-(define-key idlwave-help-mode-map "\M-?" 'idlwave-help-return-to-calling-frame)
-(define-key idlwave-help-mode-map "x" 'idlwave-help-return-to-calling-frame)
-
 ;; Define the menu for the Help application
 
 (easy-menu-define
index 72b7914..30d9fc2 100644 (file)
@@ -8265,20 +8265,26 @@ If we do not know about MODULE, just return KEYWORD literally."
           ;; keyword - return it as it is.
           keyword))))
 
-(defvar idlwave-rinfo-mouse-map (make-sparse-keymap))
-(defvar idlwave-rinfo-map (make-sparse-keymap))
-(define-key idlwave-rinfo-mouse-map
-  (if (featurep 'xemacs) [button2] [mouse-2])
-  'idlwave-mouse-active-rinfo)
-(define-key idlwave-rinfo-mouse-map
-  (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)])
-  'idlwave-mouse-active-rinfo-shift)
-(define-key idlwave-rinfo-mouse-map
-  (if (featurep 'xemacs) [button3] [mouse-3])
-  'idlwave-mouse-active-rinfo-right)
-(define-key idlwave-rinfo-mouse-map " " 'idlwave-active-rinfo-space)
-(define-key idlwave-rinfo-map "q" 'idlwave-quit-help)
-(define-key idlwave-rinfo-mouse-map "q" 'idlwave-quit-help)
+(defvar idlwave-rinfo-mouse-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map
+      (if (featurep 'xemacs) [button2] [mouse-2])
+      'idlwave-mouse-active-rinfo)
+    (define-key map
+      (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)])
+      'idlwave-mouse-active-rinfo-shift)
+    (define-key map
+      (if (featurep 'xemacs) [button3] [mouse-3])
+      'idlwave-mouse-active-rinfo-right)
+    (define-key map " " 'idlwave-active-rinfo-space)
+    (define-key map "q" 'idlwave-quit-help)
+    map))
+
+(defvar idlwave-rinfo-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "q" 'idlwave-quit-help)
+    map))
+
 (defvar idlwave-popup-source nil)
 (defvar idlwave-rinfo-marker (make-marker))
 
index 924622b..0f8adea 100644 (file)
@@ -757,6 +757,60 @@ a previously found match."
       count)))
 
 \f
+(defvar occur-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; We use this alternative name, so we can use \\[occur-mode-mouse-goto].
+    (define-key map [mouse-2] 'occur-mode-mouse-goto)
+    (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
+    (define-key map "\C-m" 'occur-mode-goto-occurrence)
+    (define-key map "o" 'occur-mode-goto-occurrence-other-window)
+    (define-key map "\C-o" 'occur-mode-display-occurrence)
+    (define-key map "\M-n" 'occur-next)
+    (define-key map "\M-p" 'occur-prev)
+    (define-key map "r" 'occur-rename-buffer)
+    (define-key map "c" 'clone-buffer)
+    (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
+    (define-key map [menu-bar] (make-sparse-keymap))
+    (define-key map [menu-bar occur]
+      `(cons ,(purecopy "Occur") map))
+    (define-key map [next-error-follow-minor-mode]
+      (menu-bar-make-mm-toggle next-error-follow-minor-mode
+                              "Auto Occurrence Display"
+                              "Display another occurrence when moving the cursor"))
+    (define-key map [separator-1] menu-bar-separator)
+    (define-key map [kill-this-buffer]
+      `(menu-item ,(purecopy "Kill occur buffer") kill-this-buffer
+                 :help ,(purecopy "Kill the current *Occur* buffer")))
+    (define-key map [quit-window]
+      `(menu-item ,(purecopy "Quit occur window") quit-window
+                 :help ,(purecopy "Quit the current *Occur* buffer.  Bury it, and maybe delete the selected frame")))
+    (define-key map [revert-buffer]
+      `(menu-item ,(purecopy "Revert occur buffer") revert-buffer
+                 :help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur")))
+    (define-key map [clone-buffer]
+      `(menu-item ,(purecopy "Clone occur buffer") clone-buffer
+                 :help ,(purecopy "Create and return a twin copy of the current *Occur* buffer")))
+    (define-key map [occur-rename-buffer]
+      `(menu-item ,(purecopy "Rename occur buffer") occur-rename-buffer
+                 :help ,(purecopy "Rename the current *Occur* buffer to *Occur: original-buffer-name*.")))
+    (define-key map [separator-2] menu-bar-separator)
+    (define-key map [occur-mode-goto-occurrence-other-window]
+      `(menu-item ,(purecopy "Go To Occurrence Other Window") occur-mode-goto-occurrence-other-window
+                 :help ,(purecopy "Go to the occurrence the current line describes, in another window")))
+    (define-key map [occur-mode-goto-occurrence]
+      `(menu-item ,(purecopy "Go To Occurrence") occur-mode-goto-occurrence
+                 :help ,(purecopy "Go to the occurrence the current line describes")))
+    (define-key map [occur-mode-display-occurrence]
+      `(menu-item ,(purecopy "Display Occurrence") occur-mode-display-occurrence
+                 :help ,(purecopy "Display in another window the occurrence the current line describes")))
+    (define-key map [occur-next]
+      `(menu-item ,(purecopy "Move to next match") occur-next
+                 :help ,(purecopy "Move to the Nth (default 1) next match in an Occur mode buffer")))
+    (define-key map [occur-prev]
+      `(menu-item ,(purecopy "Move to previous match") occur-prev
+                 :help ,(purecopy "Move to the Nth (default 1) previous match in an Occur mode buffer")))
+    map)
+  "Keymap for `occur-mode'.")
 
 (defvar occur-revert-arguments nil
   "Arguments to pass to `occur-1' to revert an Occur mode buffer.
@@ -792,54 +846,6 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
   (setq next-error-function 'occur-next-error))
 
-(define-key occur-mode-map [mouse-2] 'occur-mode-mouse-goto)
-(define-key occur-mode-map "\C-c\C-c" 'occur-mode-goto-occurrence)
-(define-key occur-mode-map "\C-m" 'occur-mode-goto-occurrence)
-(define-key occur-mode-map "o" 'occur-mode-goto-occurrence-other-window)
-(define-key occur-mode-map "\C-o" 'occur-mode-display-occurrence)
-(define-key occur-mode-map "\M-n" 'occur-next)
-(define-key occur-mode-map "\M-p" 'occur-prev)
-(define-key occur-mode-map "r" 'occur-rename-buffer)
-(define-key occur-mode-map "c" 'clone-buffer)
-(define-key occur-mode-map "\C-c\C-f" 'next-error-follow-minor-mode)
-(define-key occur-mode-map [menu-bar] (make-sparse-keymap))
-(define-key occur-mode-map [menu-bar occur] `(cons ,(purecopy "Occur") map))
-(define-key occur-mode-map [next-error-follow-minor-mode]
-  (menu-bar-make-mm-toggle next-error-follow-minor-mode
-                           "Auto Occurrence Display"
-                           "Display another occurrence when moving the cursor"))
-(define-key occur-mode-map [separator-1] menu-bar-separator)
-(define-key occur-mode-map [kill-this-buffer]
-  `(menu-item ,(purecopy "Kill occur buffer") kill-this-buffer
-              :help ,(purecopy "Kill the current *Occur* buffer")))
-(define-key occur-mode-map [quit-window]
-  `(menu-item ,(purecopy "Quit occur window") quit-window
-              :help ,(purecopy "Quit the current *Occur* buffer.  Bury it, and maybe delete the selected frame")))
-(define-key occur-mode-map [revert-buffer]
-  `(menu-item ,(purecopy "Revert occur buffer") revert-buffer
-              :help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur")))
-(define-key occur-mode-map [clone-buffer]
-  `(menu-item ,(purecopy "Clone occur buffer") clone-buffer
-              :help ,(purecopy "Create and return a twin copy of the current *Occur* buffer")))
-(define-key occur-mode-map [occur-rename-buffer]
-  `(menu-item ,(purecopy "Rename occur buffer") occur-rename-buffer
-              :help ,(purecopy "Rename the current *Occur* buffer to *Occur: original-buffer-name*.")))
-(define-key occur-mode-map [separator-2] menu-bar-separator)
-(define-key occur-mode-map [occur-mode-goto-occurrence-other-window]
-  `(menu-item ,(purecopy "Go To Occurrence Other Window") occur-mode-goto-occurrence-other-window
-              :help ,(purecopy "Go to the occurrence the current line describes, in another window")))
-(define-key occur-mode-map [occur-mode-goto-occurrence]
-  `(menu-item ,(purecopy "Go To Occurrence") occur-mode-goto-occurrence
-              :help ,(purecopy "Go to the occurrence the current line describes")))
-(define-key occur-mode-map [occur-mode-display-occurrence]
-  `(menu-item ,(purecopy "Display Occurrence") occur-mode-display-occurrence
-              :help ,(purecopy "Display in another window the occurrence the current line describes")))
-(define-key occur-mode-map [occur-next]
-  `(menu-item ,(purecopy "Move to next match") occur-next
-              :help ,(purecopy "Move to the Nth (default 1) next match in an Occur mode buffer")))
-(define-key occur-mode-map [occur-prev]
-  `(menu-item ,(purecopy "Move to previous match") occur-prev
-              :help ,(purecopy "Move to the Nth (default 1) previous match in an Occur mode buffer")))
 (defun occur-revert-function (ignore1 ignore2)
   "Handle `revert-buffer' for Occur mode buffers."
   (apply 'occur-1 (append occur-revert-arguments (list (buffer-name)))))
index 10ea1ac..44908a8 100644 (file)
@@ -520,7 +520,84 @@ MODE should be an integer which is a file mode value."
     (goto-char (point-min))
     (restore-buffer-modified-p modified)))
 \f
+(defvar tar-mode-map
+  (let ((map (make-keymap)))
+    (suppress-keymap map)
+    (define-key map " " 'tar-next-line)
+    (define-key map "C" 'tar-copy)
+    (define-key map "d" 'tar-flag-deleted)
+    (define-key map "\^D" 'tar-flag-deleted)
+    (define-key map "e" 'tar-extract)
+    (define-key map "f" 'tar-extract)
+    (define-key map "\C-m" 'tar-extract)
+    (define-key map [mouse-2] 'tar-mouse-extract)
+    (define-key map "g" 'revert-buffer)
+    (define-key map "n" 'tar-next-line)
+    (define-key map "\^N" 'tar-next-line)
+    (define-key map [down] 'tar-next-line)
+    (define-key map "o" 'tar-extract-other-window)
+    (define-key map "p" 'tar-previous-line)
+    (define-key map "\^P" 'tar-previous-line)
+    (define-key map [up] 'tar-previous-line)
+    (define-key map "R" 'tar-rename-entry)
+    (define-key map "u" 'tar-unflag)
+    (define-key map "v" 'tar-view)
+    (define-key map "x" 'tar-expunge)
+    (define-key map "\177" 'tar-unflag-backwards)
+    (define-key map "E" 'tar-extract-other-window)
+    (define-key map "M" 'tar-chmod-entry)
+    (define-key map "G" 'tar-chgrp-entry)
+    (define-key map "O" 'tar-chown-entry)
+    ;; Let mouse-1 follow the link.
+    (define-key map [follow-link] 'mouse-face)
+
+    ;; Make menu bar items.
+
+    ;; Get rid of the Edit menu bar item to save space.
+    (define-key map [menu-bar edit] 'undefined)
+
+    (define-key map [menu-bar immediate]
+      (cons "Immediate" (make-sparse-keymap "Immediate")))
+
+    (define-key map [menu-bar immediate view]
+      '("View This File" . tar-view))
+    (define-key map [menu-bar immediate display]
+      '("Display in Other Window" . tar-display-other-window))
+    (define-key map [menu-bar immediate find-file-other-window]
+      '("Find in Other Window" . tar-extract-other-window))
+    (define-key map [menu-bar immediate find-file]
+      '("Find This File" . tar-extract))
+
+    (define-key map [menu-bar mark]
+      (cons "Mark" (make-sparse-keymap "Mark")))
+
+    (define-key map [menu-bar mark unmark-all]
+      '("Unmark All" . tar-clear-modification-flags))
+    (define-key map [menu-bar mark deletion]
+      '("Flag" . tar-flag-deleted))
+    (define-key map [menu-bar mark unmark]
+      '("Unflag" . tar-unflag))
+
+    (define-key map [menu-bar operate]
+      (cons "Operate" (make-sparse-keymap "Operate")))
+
+    (define-key map [menu-bar operate chown]
+      '("Change Owner..." . tar-chown-entry))
+    (define-key map [menu-bar operate chgrp]
+      '("Change Group..." . tar-chgrp-entry))
+    (define-key map [menu-bar operate chmod]
+      '("Change Mode..." . tar-chmod-entry))
+    (define-key map [menu-bar operate rename]
+      '("Rename to..." . tar-rename-entry))
+    (define-key map [menu-bar operate copy]
+      '("Copy to..." . tar-copy))
+    (define-key map [menu-bar operate expunge]
+      '("Expunge Marked Files" . tar-expunge))
+    \f
+    map)
+  "Local keymap for Tar mode listings.")
 
+\f
 ;; tar mode is suitable only for specially formatted data.
 (put 'tar-mode 'mode-class 'special)
 (put 'tar-subfile-mode 'mode-class 'special)
@@ -590,77 +667,6 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
      (fundamental-mode)
      (signal (car err) (cdr err)))))
 
-(define-key tar-mode-map " " 'tar-next-line)
-(define-key tar-mode-map "C" 'tar-copy)
-(define-key tar-mode-map "d" 'tar-flag-deleted)
-(define-key tar-mode-map "\^D" 'tar-flag-deleted)
-(define-key tar-mode-map "e" 'tar-extract)
-(define-key tar-mode-map "f" 'tar-extract)
-(define-key tar-mode-map "\C-m" 'tar-extract)
-(define-key tar-mode-map [mouse-2] 'tar-mouse-extract)
-(define-key tar-mode-map "g" 'revert-buffer)
-(define-key tar-mode-map "h" 'describe-mode)
-(define-key tar-mode-map "n" 'tar-next-line)
-(define-key tar-mode-map "\^N" 'tar-next-line)
-(define-key tar-mode-map [down] 'tar-next-line)
-(define-key tar-mode-map "o" 'tar-extract-other-window)
-(define-key tar-mode-map "p" 'tar-previous-line)
-(define-key tar-mode-map "\^P" 'tar-previous-line)
-(define-key tar-mode-map [up] 'tar-previous-line)
-(define-key tar-mode-map "R" 'tar-rename-entry)
-(define-key tar-mode-map "u" 'tar-unflag)
-(define-key tar-mode-map "v" 'tar-view)
-(define-key tar-mode-map "x" 'tar-expunge)
-(define-key tar-mode-map "\177" 'tar-unflag-backwards)
-(define-key tar-mode-map "E" 'tar-extract-other-window)
-(define-key tar-mode-map "M" 'tar-chmod-entry)
-(define-key tar-mode-map "G" 'tar-chgrp-entry)
-(define-key tar-mode-map "O" 'tar-chown-entry)
-;; Let mouse-1 follow the link.
-(define-key tar-mode-map [follow-link] 'mouse-face)
-
-;; Make menu bar items.
-
-;; Get rid of the Edit menu bar item to save space.
-(define-key tar-mode-map [menu-bar edit] 'undefined)
-
-(define-key tar-mode-map [menu-bar immediate]
-  (cons "Immediate" (make-sparse-keymap "Immediate")))
-
-(define-key tar-mode-map [menu-bar immediate view]
-  '("View This File" . tar-view))
-(define-key tar-mode-map [menu-bar immediate display]
-  '("Display in Other Window" . tar-display-other-window))
-(define-key tar-mode-map [menu-bar immediate find-file-other-window]
-  '("Find in Other Window" . tar-extract-other-window))
-(define-key tar-mode-map [menu-bar immediate find-file]
-  '("Find This File" . tar-extract))
-
-(define-key tar-mode-map [menu-bar mark]
-  (cons "Mark" (make-sparse-keymap "Mark")))
-
-(define-key tar-mode-map [menu-bar mark unmark-all]
-  '("Unmark All" . tar-clear-modification-flags))
-(define-key tar-mode-map [menu-bar mark deletion]
-  '("Flag" . tar-flag-deleted))
-(define-key tar-mode-map [menu-bar mark unmark]
-  '("Unflag" . tar-unflag))
-
-(define-key tar-mode-map [menu-bar operate]
-  (cons "Operate" (make-sparse-keymap "Operate")))
-
-(define-key tar-mode-map [menu-bar operate chown]
-  '("Change Owner..." . tar-chown-entry))
-(define-key tar-mode-map [menu-bar operate chgrp]
-  '("Change Group..." . tar-chgrp-entry))
-(define-key tar-mode-map [menu-bar operate chmod]
-  '("Change Mode..." . tar-chmod-entry))
-(define-key tar-mode-map [menu-bar operate rename]
-  '("Rename to..." . tar-rename-entry))
-(define-key tar-mode-map [menu-bar operate copy]
-  '("Copy to..." . tar-copy))
-(define-key tar-mode-map [menu-bar operate expunge]
-  '("Expunge Marked Files" . tar-expunge))
 
 (define-minor-mode tar-subfile-mode
   "Minor mode for editing an element of a tar-file.
dissimilarity index 85%
index 23f4d0d..e1da0f6 100644 (file)
@@ -1,82 +1,84 @@
-;; -*- no-byte-compile: t -*-
-;; Define function key sequences for DEC terminals.
-
-(defvar lk201-function-map (make-sparse-keymap)
-  "Function key definitions for DEC terminals.")
-
-;; Termcap or terminfo should set these.
-;; (define-key lk201-function-map "\e[A" [up])
-;; (define-key lk201-function-map "\e[B" [down])
-;; (define-key lk201-function-map "\e[C" [right])
-;; (define-key lk201-function-map "\e[D" [left])
-
-(define-key lk201-function-map "\e[1~" [find])
-(define-key lk201-function-map "\e[2~" [insert])
-(define-key lk201-function-map "\e[3~" [delete])
-(define-key lk201-function-map "\e[4~" [select])
-(define-key lk201-function-map "\e[5~" [prior])
-(define-key lk201-function-map "\e[6~" [next])
-(define-key lk201-function-map "\e[11~" [f1])
-(define-key lk201-function-map "\e[12~" [f2])
-(define-key lk201-function-map "\e[13~" [f3])
-(define-key lk201-function-map "\e[14~" [f4])
-(define-key lk201-function-map "\e[15~" [f5])
-(define-key lk201-function-map "\e[17~" [f6])
-(define-key lk201-function-map "\e[18~" [f7])
-(define-key lk201-function-map "\e[19~" [f8])
-(define-key lk201-function-map "\e[20~" [f9])
-(define-key lk201-function-map "\e[21~" [f10])
-;; Customarily F11 is used as the ESC key.
-;; The file that includes this one, takes care of that.
-(define-key lk201-function-map "\e[23~" [f11])
-(define-key lk201-function-map "\e[24~" [f12])
-(define-key lk201-function-map "\e[25~" [f13])
-(define-key lk201-function-map "\e[26~" [f14])
-(define-key lk201-function-map "\e[28~" [help])
-(define-key lk201-function-map "\e[29~" [menu])
-(define-key lk201-function-map "\e[31~" [f17])
-(define-key lk201-function-map "\e[32~" [f18])
-(define-key lk201-function-map "\e[33~" [f19])
-(define-key lk201-function-map "\e[34~" [f20])
-
-;; Termcap or terminfo should set these.
-;; (define-key lk201-function-map "\eOA" [up])
-;; (define-key lk201-function-map "\eOB" [down])
-;; (define-key lk201-function-map "\eOC" [right])
-;; (define-key lk201-function-map "\eOD" [left])
-
-;; Termcap or terminfo should set these, but doesn't properly.
-;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
-(define-key lk201-function-map "\eOP" [kp-f1])
-(define-key lk201-function-map "\eOQ" [kp-f2])
-(define-key lk201-function-map "\eOR" [kp-f3])
-(define-key lk201-function-map "\eOS" [kp-f4])
-
-(define-key lk201-function-map "\eOI" [kp-tab])
-(define-key lk201-function-map "\eOj" [kp-multiply])
-(define-key lk201-function-map "\eOk" [kp-add])
-(define-key lk201-function-map "\eOl" [kp-separator])
-(define-key lk201-function-map "\eOM" [kp-enter])
-(define-key lk201-function-map "\eOm" [kp-subtract])
-(define-key lk201-function-map "\eOn" [kp-decimal])
-(define-key lk201-function-map "\eOo" [kp-divide])
-(define-key lk201-function-map "\eOp" [kp-0])
-(define-key lk201-function-map "\eOq" [kp-1])
-(define-key lk201-function-map "\eOr" [kp-2])
-(define-key lk201-function-map "\eOs" [kp-3])
-(define-key lk201-function-map "\eOt" [kp-4])
-(define-key lk201-function-map "\eOu" [kp-5])
-(define-key lk201-function-map "\eOv" [kp-6])
-(define-key lk201-function-map "\eOw" [kp-7])
-(define-key lk201-function-map "\eOx" [kp-8])
-(define-key lk201-function-map "\eOy" [kp-9])
-
-(defun terminal-init-lk201 ()
-  ;; Use inheritance to let the main keymap override these defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (let ((m (copy-keymap lk201-function-map)))
-    (set-keymap-parent m (keymap-parent input-decode-map))
-    (set-keymap-parent input-decode-map m)))
-
-;;; lk201.el ends here
+;; -*- no-byte-compile: t -*-
+;; Define function key sequences for DEC terminals.
+
+(defvar lk201-function-map
+  (let ((map (make-sparse-keymap)))
+
+    ;; Termcap or terminfo should set these.
+    ;; (define-key map "\e[A" [up])
+    ;; (define-key map "\e[B" [down])
+    ;; (define-key map "\e[C" [right])
+    ;; (define-key map "\e[D" [left])
+
+    (define-key map "\e[1~" [find])
+    (define-key map "\e[2~" [insert])
+    (define-key map "\e[3~" [delete])
+    (define-key map "\e[4~" [select])
+    (define-key map "\e[5~" [prior])
+    (define-key map "\e[6~" [next])
+    (define-key map "\e[11~" [f1])
+    (define-key map "\e[12~" [f2])
+    (define-key map "\e[13~" [f3])
+    (define-key map "\e[14~" [f4])
+    (define-key map "\e[15~" [f5])
+    (define-key map "\e[17~" [f6])
+    (define-key map "\e[18~" [f7])
+    (define-key map "\e[19~" [f8])
+    (define-key map "\e[20~" [f9])
+    (define-key map "\e[21~" [f10])
+    ;; Customarily F11 is used as the ESC key.
+    ;; The file that includes this one, takes care of that.
+    (define-key map "\e[23~" [f11])
+    (define-key map "\e[24~" [f12])
+    (define-key map "\e[25~" [f13])
+    (define-key map "\e[26~" [f14])
+    (define-key map "\e[28~" [help])
+    (define-key map "\e[29~" [menu])
+    (define-key map "\e[31~" [f17])
+    (define-key map "\e[32~" [f18])
+    (define-key map "\e[33~" [f19])
+    (define-key map "\e[34~" [f20])
+
+    ;; Termcap or terminfo should set these.
+    ;; (define-key map "\eOA" [up])
+    ;; (define-key map "\eOB" [down])
+    ;; (define-key map "\eOC" [right])
+    ;; (define-key map "\eOD" [left])
+
+    ;; Termcap or terminfo should set these, but doesn't properly.
+    ;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
+    (define-key map "\eOP" [kp-f1])
+    (define-key map "\eOQ" [kp-f2])
+    (define-key map "\eOR" [kp-f3])
+    (define-key map "\eOS" [kp-f4])
+
+    (define-key map "\eOI" [kp-tab])
+    (define-key map "\eOj" [kp-multiply])
+    (define-key map "\eOk" [kp-add])
+    (define-key map "\eOl" [kp-separator])
+    (define-key map "\eOM" [kp-enter])
+    (define-key map "\eOm" [kp-subtract])
+    (define-key map "\eOn" [kp-decimal])
+    (define-key map "\eOo" [kp-divide])
+    (define-key map "\eOp" [kp-0])
+    (define-key map "\eOq" [kp-1])
+    (define-key map "\eOr" [kp-2])
+    (define-key map "\eOs" [kp-3])
+    (define-key map "\eOt" [kp-4])
+    (define-key map "\eOu" [kp-5])
+    (define-key map "\eOv" [kp-6])
+    (define-key map "\eOw" [kp-7])
+    (define-key map "\eOx" [kp-8])
+    (define-key map "\eOy" [kp-9])
+    map)
+  "Function key definitions for DEC terminals.")
+
+(defun terminal-init-lk201 ()
+  ;; Use inheritance to let the main keymap override these defaults.
+  ;; This way we don't override terminfo-derived settings or settings
+  ;; made in the .emacs file.
+  (let ((m (copy-keymap lk201-function-map)))
+    (set-keymap-parent m (keymap-parent input-decode-map))
+    (set-keymap-parent input-decode-map m)))
+
+;;; lk201.el ends here
index 728f427..17ddd1d 100644 (file)
    :type 'file
    :group 'bib)
 
-(defvar bib-mode-map (copy-keymap text-mode-map))
-(define-key bib-mode-map "\C-M" 'return-key-bib)
-(define-key bib-mode-map "\C-c\C-u" 'unread-bib)
-(define-key bib-mode-map "\C-c\C-@" 'mark-bib)
-(define-key bib-mode-map "\e`" 'abbrev-mode)
+(defvar bib-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map text-mode-map)
+    (define-key map "\C-M" 'return-key-bib)
+    (define-key map "\C-c\C-u" 'unread-bib)
+    (define-key map "\C-c\C-@" 'mark-bib)
+    (define-key map "\e`" 'abbrev-mode)
+    map))
 
 (defun addbib ()
    "Set up editor to add to troff bibliography file specified
index f6677bf..357b9d6 100644 (file)
@@ -163,6 +163,24 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
 ;; variables and to correctly update `enriched-old-bindings'.
 (defvar enriched-rerun-flag nil)
 
+;;;
+;;; Keybindings
+;;;
+
+(defvar enriched-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [remap move-beginning-of-line] 'beginning-of-line-text)
+    (define-key map "\C-m" 'reindent-then-newline-and-indent)
+    (define-key map
+      [remap newline-and-indent] 'reindent-then-newline-and-indent)
+    (define-key map "\M-j" 'facemenu-justification-menu)
+    (define-key map "\M-S" 'set-justification-center)
+    (define-key map "\C-x\t" 'increase-left-margin)
+    (define-key map "\C-c[" 'set-left-margin)
+    (define-key map "\C-c]" 'set-right-margin)
+    map)
+  "Keymap for Enriched mode.")
+
 ;;;
 ;;; Define the mode
 ;;;
@@ -184,6 +202,8 @@ Commands:
   :group 'enriched :lighter " Enriched"
   (cond ((null enriched-mode)
         ;; Turn mode off
+         (remove-hook 'change-major-mode-hook
+                      'enriched-before-change-major-mode 'local)
         (setq buffer-file-format (delq 'text/enriched buffer-file-format))
         ;; restore old variable values
         (while enriched-old-bindings
@@ -199,6 +219,8 @@ Commands:
         nil)
 
        (t                              ; Turn mode on
+         (add-hook 'change-major-mode-hook
+                   'enriched-before-change-major-mode nil 'local)
         (add-to-list 'buffer-file-format 'text/enriched)
         ;; Save old variable values before we change them.
         ;; These will be restored if we exit Enriched mode.
@@ -226,8 +248,6 @@ Commands:
     (while enriched-old-bindings
       (set (pop enriched-old-bindings) (pop enriched-old-bindings)))))
 
-(add-hook 'change-major-mode-hook 'enriched-before-change-major-mode)
-
 (defun enriched-after-change-major-mode ()
   (when enriched-mode
     (let ((enriched-rerun-flag t))
@@ -235,30 +255,8 @@ Commands:
 
 (add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode)
 
-;;;
-;;; Keybindings
-;;;
-
-(defvar enriched-mode-map nil
-  "Keymap for Enriched mode.")
 
-(if (null enriched-mode-map)
-    (fset 'enriched-mode-map (setq enriched-mode-map (make-sparse-keymap))))
-
-(if (not (assq 'enriched-mode minor-mode-map-alist))
-    (setq minor-mode-map-alist
-         (cons (cons 'enriched-mode enriched-mode-map)
-               minor-mode-map-alist)))
-
-(define-key enriched-mode-map [remap move-beginning-of-line] 'beginning-of-line-text)
-(define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map
-  [remap newline-and-indent] 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map "\M-j" 'facemenu-justification-menu)
-(define-key enriched-mode-map "\M-S" 'set-justification-center)
-(define-key enriched-mode-map "\C-x\t" 'increase-left-margin)
-(define-key enriched-mode-map "\C-c[" 'set-left-margin)
-(define-key enriched-mode-map "\C-c]" 'set-right-margin)
+(fset 'enriched-mode-map enriched-mode-map)
 
 ;;;
 ;;; Some functions dealing with text-properties, especially indentation