From 860ae8b019cecd0e07f8d78bd89e428fee988e79 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Wed, 15 May 2013 16:44:07 +0200 Subject: [PATCH] * todos.el: Use tab instead of spaces to indent. (todos-indent-to-here): Change default value. (todos-modes-set-1): Make tab-width a local variable and set it to todos-indent-to-here. (todos-insert-item-1, todos-edit-item): Use tab not spaces to indent. (todos-edit-quit): Use tab not spaces to indent and fix omission of item. --- lisp/calendar/ChangeLog | 9 +++++++++ lisp/calendar/todos.el | 19 +++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog index 6b99c1f36dc..c6d8be377aa 100644 --- a/lisp/calendar/ChangeLog +++ b/lisp/calendar/ChangeLog @@ -1,3 +1,12 @@ +2013-05-15 Stephen Berman + + * todos.el: Use tab instead of spaces to indent. + (todos-indent-to-here): Change default value. + (todos-modes-set-1): Make tab-width a local variable and set it to + todos-indent-to-here. + (todos-insert-item-1, todos-edit-item): Use tab not spaces to indent. + (todos-edit-quit): Use tab not spaces to indent and fix omission of item. + 2013-05-15 Stephen Berman * todos.el (todos-jump-to-category): Fix wrong variable left over diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 4b18e001b62..aa1e9db47a5 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -399,7 +399,7 @@ The amount of indentation is given by user option (unless (member '(continuation) fringe-indicator-alist) (push '(continuation) fringe-indicator-alist))) -(defcustom todos-indent-to-here 6 +(defcustom todos-indent-to-here 3 "Number of spaces `todos-line-wrapping-function' indents to." :type '(integer :validate (lambda (widget) @@ -2996,6 +2996,7 @@ which is the value of the user option (defun todos-modes-set-1 () "" (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))) @@ -4759,10 +4760,8 @@ the priority is not given by HERE but by prompting." todos-nondiary-end) " " new-item)) ;; Indent newlines inserted by C-q C-j if nonspace char follows. - (setq new-item (replace-regexp-in-string - "\\(\n\\)[^[:blank:]]" - (concat "\n" (make-string todos-indent-to-here 32)) - new-item nil nil 1)) + (setq new-item (replace-regexp-in-string "\\(\n\\)[^[:blank:]]" + "\n\t" new-item nil nil 1)) (unwind-protect (progn ;; Make sure the correct category is selected. There @@ -4945,10 +4944,8 @@ minibuffer; otherwise, edit it in Todos Edit mode." (setq new (read-from-minibuffer "Item must start with a date: " new)))) ;; Ensure lines following hard newlines are indented. - (setq new (replace-regexp-in-string - "\\(\n\\)[^[:blank:]]" - (concat "\n" (make-string todos-indent-to-here 32)) new - nil nil 1)) + (setq new (replace-regexp-in-string "\\(\n\\)[^[:blank:]]" + "\n\t" new nil nil 1)) ;; If user moved point during editing, make sure it moves back. (goto-char opoint) (todos-remove-item) @@ -4996,9 +4993,7 @@ in the number or names of categories." (regex "\\(\n\\)[^[:blank:]]")) ;; Ensure lines following hard newlines are indented. (when (string-match regex (buffer-string)) - (replace-regexp-in-string - regex (concat "\n" (make-string todos-indent-to-here 32)) - nil nil 1) + (setq item (replace-regexp-in-string regex "\n\t" item nil nil 1)) (delete-region (point-min) (point-max)) (insert item)) (kill-buffer)) -- 2.39.5