+2013-05-21 Stephen Berman <stephen.berman@gmx.net>
+
+ * 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.
+
2013-05-21 Stephen Berman <stephen.berman@gmx.net>
* todos.el (todos-read-file-name): Fix previous change to ensure
(hl-line-mode -1)))))))))
(defcustom todos-wrap-lines t
- "Non-nil to wrap long lines via `todos-line-wrapping-function'."
+ "Non-nil to activate Visual Line mode and use wrap prefix."
:group 'todos-mode-display
:type 'boolean)
-(defcustom todos-line-wrapping-function 'todos-wrap-and-indent
- "Line wrapping function used with non-nil `todos-wrap-lines'."
- :group 'todos-mode-display
- :type 'function)
-
-(defun todos-wrap-and-indent ()
- "Use word wrapping on long lines and indent with a wrap prefix.
-The amount of indentation is given by user option
-`todos-indent-to-here'."
- (set (make-local-variable 'word-wrap) t)
- (set (make-local-variable 'wrap-prefix) (make-string todos-indent-to-here 32))
- (unless (member '(continuation) fringe-indicator-alist)
- (push '(continuation) fringe-indicator-alist)))
-
(defcustom todos-indent-to-here 3
- "Number of spaces `todos-line-wrapping-function' indents to."
+ "Number of spaces to indent continuation lines of items.
+This must be a positive number to ensure such items are fully
+shown in the Fancy Diary display."
:type '(integer :validate
(lambda (widget)
(unless (> (widget-value widget) 0)
(propertize (if (= 1 (length sep))
;; Until bug#2749 is fixed, if separator's length
;; is window-width, then with non-nil
- ;; todos-wrap-lines and todos-wrap-and-indent as
- ;; value of todos-line-wrapping-function, an
- ;; indented empty line appears between the
- ;; separator and the first done item.
+ ;; todos-wrap-lines an indented empty line appears
+ ;; between the separator and the first done item.
;; (make-string (1- (window-width)) (string-to-char sep))
(make-string (window-width) (string-to-char sep))
todos-done-separator-string)
(set (make-local-variable 'font-lock-defaults) '(todos-font-lock-keywords t))
(set (make-local-variable 'tab-width) todos-indent-to-here)
(set (make-local-variable 'indent-line-function) 'todos-indent)
- (when todos-wrap-lines (funcall todos-line-wrapping-function)))
+ (when todos-wrap-lines
+ (visual-line-mode)
+ (setq wrap-prefix (make-string todos-indent-to-here 32))))
(defun todos-modes-set-2 ()
""