]> code.delx.au - gnu-emacs/blobdiff - lisp/menu-bar.el
* lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other...
[gnu-emacs] / lisp / menu-bar.el
index 66793a4a805423c7304805b805772b6a58036d0d..93dd551fdd80531b699838d77c3399ec75067d5c 100644 (file)
@@ -65,6 +65,7 @@
 ;; The "File" menu items
 (define-key menu-bar-file-menu [exit-emacs]
   '(menu-item "Exit Emacs" save-buffers-kill-emacs
+             :keys "C-x C-c"
              :help "Save unsaved buffers, then exit"))
 
 (define-key menu-bar-file-menu [separator-exit]
@@ -632,8 +633,8 @@ by \"Save Options\" in Custom buffers.")
 (defun menu-set-font ()
   "Interactively select a font and make it the default."
   (interactive)
-  (let ((font (if (functionp 'x-font-dialog)
-                 (x-font-dialog)
+  (let ((font (if (fboundp 'x-select-font)
+                 (x-select-font)
                (mouse-select-font)))
        spec)
     (when font
@@ -1054,24 +1055,51 @@ mail status in mode line"))
                                     (member 'turn-on-auto-fill text-mode-hook)
                                   (eq 'turn-on-auto-fill text-mode-hook)))))
 
-(define-key menu-bar-options-menu [longlines-mode]
-  '(menu-item "Word Wrap for Long Lines in this Buffer"
-              longlines-mode
-             :help "Perform word wrapping for long lines (Long Lines mode)"
-              :button (:toggle . (and (boundp 'longlines-mode)
-                                     longlines-mode))))
-
-(define-key menu-bar-options-menu [truncate-lines]
-  '(menu-item "Truncate Long Lines in this Buffer"
-             toggle-truncate-lines
-             :help "Truncate long lines at the window edge "
-             :button (:toggle . (if (or (window-full-width-p)
-                                        (not truncate-partial-width-windows))
-                                    truncate-lines
-                                  truncate-partial-width-windows))
-             :enable (and (menu-bar-menu-frame-live-and-visible-p)
-                          (or (window-full-width-p)
-                              (not truncate-partial-width-windows)))))
+
+(defvar menu-bar-line-wrapping-menu (make-sparse-keymap "Line Wrapping"))
+
+(define-key menu-bar-line-wrapping-menu [word-wrap]
+  '(menu-item "Word Wrap (Visual Line mode)"
+             (lambda ()
+               (interactive)
+               (unless visual-line-mode
+                 (visual-line-mode 1))
+               (message "Visual-Line mode enabled"))
+             :help "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 "Truncate Long Lines"
+             (lambda ()
+               (interactive)
+               (if visual-line-mode (visual-line-mode 0))
+               (setq word-wrap nil)
+               (toggle-truncate-lines 1))
+             :help "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 "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 "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]
+  (list 'menu-item "Line Wrapping in this Buffer" menu-bar-line-wrapping-menu))
+
 
 (define-key menu-bar-options-menu [highlight-separator]
   '("--"))