From: Chong Yidong Date: Mon, 21 Jul 2008 18:14:46 +0000 (+0000) Subject: (menu-bar-line-wrapping-menu): Use Visual Line mode for "word wrap" X-Git-Tag: emacs-pretest-23.0.90~4014 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad45602732ee83c99be339bac594542167b3e085;p=emacs.git (menu-bar-line-wrapping-menu): Use Visual Line mode for "word wrap" command. --- diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f9e43757d70..827148b2214 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1057,30 +1057,38 @@ mail status in mode line")) (defvar menu-bar-line-wrapping-menu (make-sparse-keymap "Line Wrapping")) -(define-key menu-bar-line-wrapping-menu [truncate] - '(menu-item "Truncate Long Lines" - toggle-truncate-lines - :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 [word-wrap] - '(menu-item "Wrap at Word Boundaries" - (lambda () (interactive) (setq truncate-lines nil - word-wrap t)) + '(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) (setq truncate-lines nil - word-wrap nil)) + (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))