aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2013-05-16 20:29:06 +0200
committerStephen Berman2013-05-16 20:29:06 +0200
commitea3ae33b5b94bf095c52f279887009e8fb71a9df (patch)
treeeb716fbe363b612714c2d04cc4124b92ded74a63
parent46fa56ece0f7082de6da8a0a289ad18ae8d1d10a (diff)
downloademacs-ea3ae33b5b94bf095c52f279887009e8fb71a9df.tar.gz
emacs-ea3ae33b5b94bf095c52f279887009e8fb71a9df.zip
* todos.el (todos-filtered-items-mode-map): Update some bindings.
(todos-show): Make it work the same in todos-archive-mode and todos-filtered-items-mode as in todos-mode. (todos-quit): When called in todos-archive-mode, switch to corresponding category in todo file. When called in todos-mode, avoid going right back to archive.
-rw-r--r--lisp/calendar/ChangeLog9
-rw-r--r--lisp/calendar/todos.el58
2 files changed, 44 insertions, 23 deletions
diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog
index 83bbb421e0f..33494043d1a 100644
--- a/lisp/calendar/ChangeLog
+++ b/lisp/calendar/ChangeLog
@@ -1,5 +1,14 @@
12013-05-16 Stephen Berman <stephen.berman@gmx.net> 12013-05-16 Stephen Berman <stephen.berman@gmx.net>
2 2
3 * todos.el (todos-filtered-items-mode-map): Update some bindings.
4 (todos-show): Make it work the same in todos-archive-mode and
5 todos-filtered-items-mode as in todos-mode.
6 (todos-quit): When called in todos-archive-mode, switch to
7 corresponding category in todo file. When called in todos-mode,
8 avoid going right back to archive.
9
102013-05-16 Stephen Berman <stephen.berman@gmx.net>
11
3 * todos.el: Improve toggling of item numbering and headers. 12 * todos.el: Improve toggling of item numbering and headers.
4 (todos-prefix-overlays): Don't reset item numbering for 13 (todos-prefix-overlays): Don't reset item numbering for
5 done items unless in todos-mode. 14 done items unless in todos-mode.
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index 508ae61b111..33f413d4cf3 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -2981,13 +2981,15 @@ which is the value of the user option
2981 (define-key map "h" 'todos-toggle-item-header) 2981 (define-key map "h" 'todos-toggle-item-header)
2982 (define-key map "PB" 'todos-print-buffer) 2982 (define-key map "PB" 'todos-print-buffer)
2983 (define-key map "PF" 'todos-print-buffer-to-file) 2983 (define-key map "PF" 'todos-print-buffer-to-file)
2984 (define-key map "j" 'todos-go-to-source-item) 2984 (define-key map "g" 'todos-go-to-source-item)
2985 (define-key map "j" 'todos-jump-to-category)
2985 (define-key map "l" 'todos-lower-item-priority) 2986 (define-key map "l" 'todos-lower-item-priority)
2986 (define-key map "n" 'todos-next-item) 2987 (define-key map "n" 'todos-next-item)
2987 (define-key map "p" 'todos-previous-item) 2988 (define-key map "p" 'todos-previous-item)
2988 (define-key map "q" 'todos-quit) 2989 (define-key map "q" 'todos-quit)
2989 (define-key map "r" 'todos-raise-item-priority) 2990 (define-key map "r" 'todos-raise-item-priority)
2990 (define-key map "s" 'todos-save) 2991 (define-key map "s" 'todos-save)
2992 (define-key map "t" 'todos-show)
2991 (define-key map "#" 'todos-set-item-priority) 2993 (define-key map "#" 'todos-set-item-priority)
2992 (define-key map [remap newline] 'todos-go-to-source-item) 2994 (define-key map [remap newline] 'todos-go-to-source-item)
2993 map) 2995 map)
@@ -3147,19 +3149,23 @@ corresponding Todos file, displaying the corresponding category."
3147 (interactive "P") 3149 (interactive "P")
3148 (let* ((cat) 3150 (let* ((cat)
3149 (show-first todos-show-first) 3151 (show-first todos-show-first)
3150 (file (cond ((or (eq major-mode 'todos-mode) 3152 (file (cond ((or solicit-file
3151 solicit-file) 3153 (and (called-interactively-p 'any)
3154 (memq major-mode '(todos-mode
3155 todos-archive-mode
3156 todos-filtered-items-mode))))
3152 (if (funcall todos-files-function) 3157 (if (funcall todos-files-function)
3153 (todos-read-file-name "Choose a Todos file to visit: " 3158 (todos-read-file-name "Choose a Todos file to visit: "
3154 nil t) 3159 nil t)
3155 (error "There are no Todos files"))) 3160 (error "There are no Todos files")))
3156 ((and (eq major-mode 'todos-archive-mode) 3161 ((and (eq major-mode 'todos-archive-mode)
3157 ;; Called noninteractively via todos-quit from 3162 ;; Called noninteractively via todos-quit
3158 ;; Todos Categories mode to return to archive file. 3163 ;; to jump to corresponding category in
3159 (called-interactively-p 'any)) 3164 ;; todo file.
3165 (not (called-interactively-p 'any)))
3160 (setq cat (todos-current-category)) 3166 (setq cat (todos-current-category))
3161 (concat (file-name-sans-extension todos-current-todos-file) 3167 (concat (file-name-sans-extension todos-current-todos-file)
3162 ".todo")) 3168 ".todo"))
3163 (t 3169 (t
3164 (or todos-current-todos-file 3170 (or todos-current-todos-file
3165 (and todos-show-current-file 3171 (and todos-show-current-file
@@ -3202,10 +3208,10 @@ corresponding Todos file, displaying the corresponding category."
3202 (eq todos-show-first 'first)) 3208 (eq todos-show-first 'first))
3203 (set-window-buffer (selected-window) 3209 (set-window-buffer (selected-window)
3204 (set-buffer (find-file-noselect file 'nowarn))) 3210 (set-buffer (find-file-noselect file 'nowarn)))
3205 ;; If called from archive file, show corresponding 3211 ;; When quitting archive file, show corresponding category in
3206 ;; category in Todos file, if it exists. 3212 ;; Todos file, if it exists.
3207 (when (assoc cat todos-categories) 3213 (when (assoc cat todos-categories)
3208 (setq todos-category-number (todos-category-number cat))) 3214 (setq todos-category-number (todos-category-number cat)))
3209 ;; If this is a new Todos file, add its first category. 3215 ;; If this is a new Todos file, add its first category.
3210 (when (zerop (buffer-size)) 3216 (when (zerop (buffer-size))
3211 (setq todos-category-number 3217 (setq todos-category-number
@@ -3344,25 +3350,31 @@ displayed."
3344Depending on the specific mode, this either kills the buffer or 3350Depending on the specific mode, this either kills the buffer or
3345buries it and restores state as needed." 3351buries it and restores state as needed."
3346 (interactive) 3352 (interactive)
3347 (cond ((eq major-mode 'todos-categories-mode) 3353 (let ((buf (current-buffer)))
3348 ;; Postpone killing buffer till after calling todos-show, to 3354 (cond ((eq major-mode 'todos-categories-mode)
3349 ;; prevent killing todos-mode buffer. 3355 ;; Postpone killing buffer till after calling todos-show, to
3350 (let ((buf (current-buffer))) 3356 ;; prevent killing todos-mode buffer.
3351 (setq todos-descending-counts nil) 3357 (setq todos-descending-counts nil)
3352 ;; Ensure todos-show calls todos-show-categories-table only on 3358 ;; Ensure todos-show calls todos-show-categories-table only on
3353 ;; first invocation per file. 3359 ;; first invocation per file.
3354 (when (eq todos-show-first 'table) 3360 (when (eq todos-show-first 'table)
3355 (add-to-list 'todos-visited todos-current-todos-file)) 3361 (add-to-list 'todos-visited todos-current-todos-file))
3356 (todos-show) 3362 (todos-show)
3357 (kill-buffer buf))) 3363 (kill-buffer buf))
3358 ((eq major-mode 'todos-filtered-items-mode) 3364 ((eq major-mode 'todos-filtered-items-mode)
3359 (kill-buffer) 3365 (kill-buffer)
3360 (unless (eq major-mode 'todos-mode) (todos-show))) 3366 (unless (eq major-mode 'todos-mode) (todos-show)))
3361 ((member major-mode (list 'todos-mode 'todos-archive-mode)) 3367 ((eq major-mode 'todos-archive-mode)
3362 ;; Have to write previously nonexistant archives to file, and might 3368 (todos-save) ; Have to write previously nonexistant archives to file.
3363 ;; as well save Todos file also. 3369 (todos-show)
3364 (todos-save) 3370 (bury-buffer buf))
3365 (bury-buffer)))) 3371 ((eq major-mode 'todos-mode)
3372 (todos-save)
3373 ;; If we just quit archive mode, just burying the buffer
3374 ;; in todos-mode would return to archive.
3375 (set-window-buffer (selected-window)
3376 (set-buffer (other-buffer)))
3377 (bury-buffer buf)))))
3366 3378
3367(defun todos-print-buffer (&optional to-file) 3379(defun todos-print-buffer (&optional to-file)
3368 "Produce a printable version of the current Todos buffer. 3380 "Produce a printable version of the current Todos buffer.