]> code.delx.au - gnu-emacs/blobdiff - lisp/menu-bar.el
*** empty log message ***
[gnu-emacs] / lisp / menu-bar.el
index e7d795647a16a644aa810af683d024f7155d3e75..2c08e4f5b668c1518341eccfb96c027c8356abdc 100644 (file)
@@ -72,6 +72,8 @@ A large number or nil slows down menu responsiveness."
   '("--"))
 
 (define-key menu-bar-tools-menu [calendar] '("Display Calendar" . calendar))
+(define-key menu-bar-tools-menu [speedbar]
+  '("Display Speedbar" . speedbar-frame-mode))
 (define-key menu-bar-tools-menu [compose-mail] '("Send Mail" . compose-mail))
 (define-key menu-bar-tools-menu [rmail] '("Read Mail" . rmail))
 (define-key menu-bar-tools-menu [gnus] '("Read Net News" . gnus))
@@ -146,6 +148,8 @@ A large number or nil slows down menu responsiveness."
   '("Kill Current Buffer" . kill-this-buffer))
 (define-key menu-bar-files-menu [insert-file]
   '("Insert File..." . insert-file))
+(define-key menu-bar-files-menu [recover-session]
+  '("Recover Session..." . recover-session))
 (define-key menu-bar-files-menu [revert-buffer]
   '("Revert Buffer" . revert-buffer))
 (define-key menu-bar-files-menu [write-file]
@@ -154,6 +158,15 @@ A large number or nil slows down menu responsiveness."
 (define-key menu-bar-files-menu [dired] '("Open Directory..." . dired))
 (define-key menu-bar-files-menu [open-file] '("Open File..." . find-file))
 
+(put 'recover-session 'menu-enable
+     '(and 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)))
 \f
 (defun nonincremental-search-forward (string)
   "Read a string and search for it nonincrementally."
@@ -258,11 +271,10 @@ A large number or nil slows down menu responsiveness."
 
 (define-key menu-bar-edit-menu [clear] '("Clear" . delete-region))
 
-(define-key menu-bar-edit-menu [paste] '("Paste Most Recent" . yank))
-
 (defvar yank-menu (cons "Select Yank" nil))
 (fset 'yank-menu (cons 'keymap yank-menu))
 (define-key menu-bar-edit-menu [select-paste] '("Select and Paste" . yank-menu))
+(define-key menu-bar-edit-menu [paste] '("Paste" . yank))
 (define-key menu-bar-edit-menu [copy] '("Copy" . menu-bar-kill-ring-save))
 (define-key menu-bar-edit-menu [cut] '("Cut" . kill-region))
 (define-key menu-bar-edit-menu [undo] '("Undo" . undo))
@@ -270,7 +282,7 @@ A large number or nil slows down menu responsiveness."
 (defun menu-bar-kill-ring-save (beg end)
   (interactive "r")
   (if (mouse-region-match)
-      (message "Select a region with the mouse does `copy' automatically")
+      (message "Selecting a region with the mouse does `copy' automatically")
     (kill-ring-save beg end)))
 
 (put 'fill-region 'menu-enable '(and mark-active (not buffer-read-only)))
@@ -299,7 +311,7 @@ A large number or nil slows down menu responsiveness."
      '(or (x-selection-exists-p) (x-selection-exists-p 'CLIPBOARD)))
 
 (defun clipboard-yank ()
-  "Reinsert the last stretch of killed text, or the clipboard contents."
+  "Insert the clipboard contents, or the last stretch of killed text."
   (interactive)
   (let ((x-select-enable-clipboard t))
     (yank)))
@@ -358,6 +370,8 @@ Do the same for the keys of the same name."
   '("Specific Face..." . customize-face))
 (define-key menu-bar-custom-menu [customize-option]
   '("Specific Option..." . customize-option))
+(define-key menu-bar-custom-menu [customize-changed-options]
+  '("Changed Options..." . customize-changed-options))
 (define-key menu-bar-custom-menu [separator-3]
   '("--"))
 (define-key menu-bar-custom-menu [customize-browse]
@@ -377,41 +391,57 @@ Do the same for the keys of the same name."
              `(setq ,variable (not ,variable)))
           (message ,message "enabled")
         (message ,message "disabled")))
-     '(,doc . ,name)))
+     '(menu-item ,doc ,name .
+                 (:button (:toggle . (and (boundp ',variable) ,variable))))))
 
 (define-key menu-bar-options-menu [debug-on-quit]
   (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
-                       "Toggle Debug on Quit" "Debug on Quit %s"))
+                       "Debug on Quit" "Debug on Quit %s"))
 (define-key menu-bar-options-menu [debug-on-error]
   (menu-bar-make-toggle toggle-debug-on-error debug-on-error
-                       "Toggle Debug on Error" "Debug on Error %s"))
+                       "Debug on Error" "Debug on Error %s"))
 (define-key menu-bar-options-menu [options-separator]
   '("--"))
 (define-key menu-bar-options-menu [save-place]
   (menu-bar-make-toggle toggle-save-place-globally save-place
-                       "Toggle Saving Place in Files between Sessions"
+                       "Save Place in Files between Sessions"
                        "Saving place in files %s"
+                        (require 'saveplace)
                        (setq-default save-place (not (default-value save-place)))))
 (define-key menu-bar-options-menu [uniquify]
   (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
-                       "Toggle Directory Names in Buffer Names"
+                       "Use Directory Names in Buffer Names"
                        "Directory name in buffer names (uniquify) %s"
                        (require 'uniquify)
                        (setq uniquify-buffer-name-style
                              (if (not uniquify-buffer-name-style)
                                  'forward))))
+(define-key menu-bar-options-menu [case-fold-search]
+  (menu-bar-make-toggle toggle-case-fold-search case-fold-search
+                       "Case folding in searches"
+                       "Case folding in searches %s"))
+(define-key menu-bar-options-menu [truncate-lines]
+  (menu-bar-make-toggle
+   toggle-truncate-lines truncate-lines
+   "Line Truncation" "Line Truncation %s"
+   (prog1 (setq truncate-lines (not truncate-lines))
+     (set-buffer-modified-p (buffer-modified-p)))))
 (define-key menu-bar-options-menu [transient-mark-mode]
   (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
-                       "Toggle Transient Mark Mode (highlights region)"
+                       "Transient Mark Mode (highlights region)"
                        "Transient Mark mode %s"))
 (define-key menu-bar-options-menu [toggle-auto-compression]
-  '("Toggle Automatic File De/compression" . auto-compression-mode))
+  '(menu-item "Automatic File De/compression"
+             auto-compression-mode .
+             (:button (:toggle . (rassq 'jka-compr-handler
+                                        file-name-handler-alist)))))
 (define-key menu-bar-options-menu [auto-fill-mode]
-  '("Toggle Auto Fill (word wrap) in Text modes"
-    . toggle-text-mode-auto-fill))
+  '(menu-item "Auto Fill (word wrap) in Text modes"
+              toggle-text-mode-auto-fill .
+              (:button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))))
 (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
-  (menu-bar-make-toggle toggle-global-lazy-font-lock-mode nil
-                       "Toggle Global Font Lock (highlights syntax)"
+  (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode
+                       "Global Font Lock (highlights syntax)"
                        "Global Font Lock mode %s"
                        ;; Make sure a support mode is used;
                        ;; otherwise Font Lock will be too slow.
@@ -457,6 +487,12 @@ Do the same for the keys of the same name."
 (define-key menu-bar-manuals-menu [emacs-news]
   '("Emacs News" . view-emacs-news))
 
+(define-key menu-bar-help-menu [describe-no-warranty]
+  '("(Non)Warranty" . describe-no-warranty))
+(define-key menu-bar-help-menu [describe-copying]
+  '("Copying Conditions" . describe-copying))
+(define-key menu-bar-help-menu [describe-distribution]
+  '("Getting New Versions" . describe-distribution))
 (define-key menu-bar-help-menu [emacs-version]
   '("Show Version" . emacs-version))
 (define-key menu-bar-help-menu [report-emacs-bug]
@@ -799,8 +835,8 @@ Do the same for the keys of the same name."
   "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 negative,
-turn off menu bars; otherwise, turn on menu bars."
+With a numeric argument, if the argument is positive,
+turn on menu bars; otherwise, turn off menu bars."
  (interactive "P")
 
   ;; Make menu-bar-mode and default-frame-alist consistent.