changeset 101897:d08c7c69fefe

(toggle-word-wrap): New command.
author Juri Linkov <juri@jurta.org>
date Sun, 08 Feb 2009 00:46:38 +0000
parents 97a01032d9d2
children 514123462b33
files lisp/simple.el
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sat Feb 07 22:41:04 2009 +0000
+++ b/lisp/simple.el	Sun Feb 08 00:46:38 2009 +0000
@@ -5079,6 +5079,21 @@
   (message "Truncate long lines %s"
 	   (if truncate-lines "enabled" "disabled")))
 
+(defun toggle-word-wrap (&optional arg)
+  "Toggle whether to use word-wrapping for continuation lines.
+With prefix argument ARG, wrap continuation lines at word boundaries
+if ARG is positive, otherwise wrap them at the right screen edge.
+This command toggles the value of `word-wrap'.  It has no effect
+if long lines are truncated."
+  (interactive "P")
+  (setq word-wrap
+	(if (null arg)
+	    (not word-wrap)
+	  (> (prefix-numeric-value arg) 0)))
+  (force-mode-line-update)
+  (message "Word wrapping %s"
+	   (if word-wrap "enabled" "disabled")))
+
 (defvar overwrite-mode-textual " Ovwrt"
   "The string displayed in the mode line when in overwrite mode.")
 (defvar overwrite-mode-binary " Bin Ovwrt"