aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2013-05-21 12:04:44 +0200
committerStephen Berman2013-05-21 12:04:44 +0200
commit8a10ab0299469dc5a0da8167df4ab13593ed6c00 (patch)
tree7c42b1e709784ac8657a36a84762c6cb3403ef3d
parente8429183d55a6b3541c4b51fb85b2439caec65f6 (diff)
downloademacs-8a10ab0299469dc5a0da8167df4ab13593ed6c00.tar.gz
emacs-8a10ab0299469dc5a0da8167df4ab13593ed6c00.zip
* todos.el: Use visual-line-mode instead of custom code.
(todos-line-wrapping-function, todos-wrap-and-indent): Remove. (todos-wrap-lines, todos-indent-to-here): Update doc string. (todos-modes-set-1): Use visual-line-mode.
-rw-r--r--lisp/calendar/ChangeLog7
-rw-r--r--lisp/calendar/todos.el30
2 files changed, 16 insertions, 21 deletions
diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog
index 4b68e41698d..c52dfc12cbd 100644
--- a/lisp/calendar/ChangeLog
+++ b/lisp/calendar/ChangeLog
@@ -1,5 +1,12 @@
12013-05-21 Stephen Berman <stephen.berman@gmx.net> 12013-05-21 Stephen Berman <stephen.berman@gmx.net>
2 2
3 * todos.el: Use visual-line-mode instead of custom code.
4 (todos-line-wrapping-function, todos-wrap-and-indent): Remove.
5 (todos-wrap-lines, todos-indent-to-here): Update doc string.
6 (todos-modes-set-1): Use visual-line-mode.
7
82013-05-21 Stephen Berman <stephen.berman@gmx.net>
9
3 * todos.el (todos-read-file-name): Fix previous change to ensure 10 * todos.el (todos-read-file-name): Fix previous change to ensure
4 it works when invoked outside of a Todos file. 11 it works when invoked outside of a Todos file.
5 12
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index d8bf02b432a..ab88337c8b9 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -384,26 +384,14 @@ Categories mode visits the archived categories."
384 (hl-line-mode -1))))))))) 384 (hl-line-mode -1)))))))))
385 385
386(defcustom todos-wrap-lines t 386(defcustom todos-wrap-lines t
387 "Non-nil to wrap long lines via `todos-line-wrapping-function'." 387 "Non-nil to activate Visual Line mode and use wrap prefix."
388 :group 'todos-mode-display 388 :group 'todos-mode-display
389 :type 'boolean) 389 :type 'boolean)
390 390
391(defcustom todos-line-wrapping-function 'todos-wrap-and-indent
392 "Line wrapping function used with non-nil `todos-wrap-lines'."
393 :group 'todos-mode-display
394 :type 'function)
395
396(defun todos-wrap-and-indent ()
397 "Use word wrapping on long lines and indent with a wrap prefix.
398The amount of indentation is given by user option
399`todos-indent-to-here'."
400 (set (make-local-variable 'word-wrap) t)
401 (set (make-local-variable 'wrap-prefix) (make-string todos-indent-to-here 32))
402 (unless (member '(continuation) fringe-indicator-alist)
403 (push '(continuation) fringe-indicator-alist)))
404
405(defcustom todos-indent-to-here 3 391(defcustom todos-indent-to-here 3
406 "Number of spaces `todos-line-wrapping-function' indents to." 392 "Number of spaces to indent continuation lines of items.
393This must be a positive number to ensure such items are fully
394shown in the Fancy Diary display."
407 :type '(integer :validate 395 :type '(integer :validate
408 (lambda (widget) 396 (lambda (widget)
409 (unless (> (widget-value widget) 0) 397 (unless (> (widget-value widget) 0)
@@ -1152,10 +1140,8 @@ number as its value."
1152 (propertize (if (= 1 (length sep)) 1140 (propertize (if (= 1 (length sep))
1153 ;; Until bug#2749 is fixed, if separator's length 1141 ;; Until bug#2749 is fixed, if separator's length
1154 ;; is window-width, then with non-nil 1142 ;; is window-width, then with non-nil
1155 ;; todos-wrap-lines and todos-wrap-and-indent as 1143 ;; todos-wrap-lines an indented empty line appears
1156 ;; value of todos-line-wrapping-function, an 1144 ;; between the separator and the first done item.
1157 ;; indented empty line appears between the
1158 ;; separator and the first done item.
1159 ;; (make-string (1- (window-width)) (string-to-char sep)) 1145 ;; (make-string (1- (window-width)) (string-to-char sep))
1160 (make-string (window-width) (string-to-char sep)) 1146 (make-string (window-width) (string-to-char sep))
1161 todos-done-separator-string) 1147 todos-done-separator-string)
@@ -3015,7 +3001,9 @@ which is the value of the user option
3015 (set (make-local-variable 'font-lock-defaults) '(todos-font-lock-keywords t)) 3001 (set (make-local-variable 'font-lock-defaults) '(todos-font-lock-keywords t))
3016 (set (make-local-variable 'tab-width) todos-indent-to-here) 3002 (set (make-local-variable 'tab-width) todos-indent-to-here)
3017 (set (make-local-variable 'indent-line-function) 'todos-indent) 3003 (set (make-local-variable 'indent-line-function) 'todos-indent)
3018 (when todos-wrap-lines (funcall todos-line-wrapping-function))) 3004 (when todos-wrap-lines
3005 (visual-line-mode)
3006 (setq wrap-prefix (make-string todos-indent-to-here 32))))
3019 3007
3020(defun todos-modes-set-2 () 3008(defun todos-modes-set-2 ()
3021 "" 3009 ""