mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-16 10:50:49 -08:00
* 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.
This commit is contained in:
parent
46fa56ece0
commit
ea3ae33b5b
2 changed files with 44 additions and 23 deletions
|
|
@ -1,3 +1,12 @@
|
||||||
|
2013-05-16 Stephen Berman <stephen.berman@gmx.net>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2013-05-16 Stephen Berman <stephen.berman@gmx.net>
|
2013-05-16 Stephen Berman <stephen.berman@gmx.net>
|
||||||
|
|
||||||
* todos.el: Improve toggling of item numbering and headers.
|
* todos.el: Improve toggling of item numbering and headers.
|
||||||
|
|
|
||||||
|
|
@ -2981,13 +2981,15 @@ which is the value of the user option
|
||||||
(define-key map "h" 'todos-toggle-item-header)
|
(define-key map "h" 'todos-toggle-item-header)
|
||||||
(define-key map "PB" 'todos-print-buffer)
|
(define-key map "PB" 'todos-print-buffer)
|
||||||
(define-key map "PF" 'todos-print-buffer-to-file)
|
(define-key map "PF" 'todos-print-buffer-to-file)
|
||||||
(define-key map "j" 'todos-go-to-source-item)
|
(define-key map "g" 'todos-go-to-source-item)
|
||||||
|
(define-key map "j" 'todos-jump-to-category)
|
||||||
(define-key map "l" 'todos-lower-item-priority)
|
(define-key map "l" 'todos-lower-item-priority)
|
||||||
(define-key map "n" 'todos-next-item)
|
(define-key map "n" 'todos-next-item)
|
||||||
(define-key map "p" 'todos-previous-item)
|
(define-key map "p" 'todos-previous-item)
|
||||||
(define-key map "q" 'todos-quit)
|
(define-key map "q" 'todos-quit)
|
||||||
(define-key map "r" 'todos-raise-item-priority)
|
(define-key map "r" 'todos-raise-item-priority)
|
||||||
(define-key map "s" 'todos-save)
|
(define-key map "s" 'todos-save)
|
||||||
|
(define-key map "t" 'todos-show)
|
||||||
(define-key map "#" 'todos-set-item-priority)
|
(define-key map "#" 'todos-set-item-priority)
|
||||||
(define-key map [remap newline] 'todos-go-to-source-item)
|
(define-key map [remap newline] 'todos-go-to-source-item)
|
||||||
map)
|
map)
|
||||||
|
|
@ -3147,16 +3149,20 @@ corresponding Todos file, displaying the corresponding category."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let* ((cat)
|
(let* ((cat)
|
||||||
(show-first todos-show-first)
|
(show-first todos-show-first)
|
||||||
(file (cond ((or (eq major-mode 'todos-mode)
|
(file (cond ((or solicit-file
|
||||||
solicit-file)
|
(and (called-interactively-p 'any)
|
||||||
|
(memq major-mode '(todos-mode
|
||||||
|
todos-archive-mode
|
||||||
|
todos-filtered-items-mode))))
|
||||||
(if (funcall todos-files-function)
|
(if (funcall todos-files-function)
|
||||||
(todos-read-file-name "Choose a Todos file to visit: "
|
(todos-read-file-name "Choose a Todos file to visit: "
|
||||||
nil t)
|
nil t)
|
||||||
(error "There are no Todos files")))
|
(error "There are no Todos files")))
|
||||||
((and (eq major-mode 'todos-archive-mode)
|
((and (eq major-mode 'todos-archive-mode)
|
||||||
;; Called noninteractively via todos-quit from
|
;; Called noninteractively via todos-quit
|
||||||
;; Todos Categories mode to return to archive file.
|
;; to jump to corresponding category in
|
||||||
(called-interactively-p 'any))
|
;; todo file.
|
||||||
|
(not (called-interactively-p 'any)))
|
||||||
(setq cat (todos-current-category))
|
(setq cat (todos-current-category))
|
||||||
(concat (file-name-sans-extension todos-current-todos-file)
|
(concat (file-name-sans-extension todos-current-todos-file)
|
||||||
".todo"))
|
".todo"))
|
||||||
|
|
@ -3202,8 +3208,8 @@ corresponding Todos file, displaying the corresponding category."
|
||||||
(eq todos-show-first 'first))
|
(eq todos-show-first 'first))
|
||||||
(set-window-buffer (selected-window)
|
(set-window-buffer (selected-window)
|
||||||
(set-buffer (find-file-noselect file 'nowarn)))
|
(set-buffer (find-file-noselect file 'nowarn)))
|
||||||
;; If called from archive file, show corresponding
|
;; When quitting archive file, show corresponding category in
|
||||||
;; category in Todos file, if it exists.
|
;; Todos file, if it exists.
|
||||||
(when (assoc cat todos-categories)
|
(when (assoc cat todos-categories)
|
||||||
(setq todos-category-number (todos-category-number cat)))
|
(setq todos-category-number (todos-category-number cat)))
|
||||||
;; If this is a new Todos file, add its first category.
|
;; If this is a new Todos file, add its first category.
|
||||||
|
|
@ -3344,25 +3350,31 @@ displayed."
|
||||||
Depending on the specific mode, this either kills the buffer or
|
Depending on the specific mode, this either kills the buffer or
|
||||||
buries it and restores state as needed."
|
buries it and restores state as needed."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
(let ((buf (current-buffer)))
|
||||||
(cond ((eq major-mode 'todos-categories-mode)
|
(cond ((eq major-mode 'todos-categories-mode)
|
||||||
;; Postpone killing buffer till after calling todos-show, to
|
;; Postpone killing buffer till after calling todos-show, to
|
||||||
;; prevent killing todos-mode buffer.
|
;; prevent killing todos-mode buffer.
|
||||||
(let ((buf (current-buffer)))
|
|
||||||
(setq todos-descending-counts nil)
|
(setq todos-descending-counts nil)
|
||||||
;; Ensure todos-show calls todos-show-categories-table only on
|
;; Ensure todos-show calls todos-show-categories-table only on
|
||||||
;; first invocation per file.
|
;; first invocation per file.
|
||||||
(when (eq todos-show-first 'table)
|
(when (eq todos-show-first 'table)
|
||||||
(add-to-list 'todos-visited todos-current-todos-file))
|
(add-to-list 'todos-visited todos-current-todos-file))
|
||||||
(todos-show)
|
(todos-show)
|
||||||
(kill-buffer buf)))
|
(kill-buffer buf))
|
||||||
((eq major-mode 'todos-filtered-items-mode)
|
((eq major-mode 'todos-filtered-items-mode)
|
||||||
(kill-buffer)
|
(kill-buffer)
|
||||||
(unless (eq major-mode 'todos-mode) (todos-show)))
|
(unless (eq major-mode 'todos-mode) (todos-show)))
|
||||||
((member major-mode (list 'todos-mode 'todos-archive-mode))
|
((eq major-mode 'todos-archive-mode)
|
||||||
;; Have to write previously nonexistant archives to file, and might
|
(todos-save) ; Have to write previously nonexistant archives to file.
|
||||||
;; as well save Todos file also.
|
(todos-show)
|
||||||
|
(bury-buffer buf))
|
||||||
|
((eq major-mode 'todos-mode)
|
||||||
(todos-save)
|
(todos-save)
|
||||||
(bury-buffer))))
|
;; If we just quit archive mode, just burying the buffer
|
||||||
|
;; in todos-mode would return to archive.
|
||||||
|
(set-window-buffer (selected-window)
|
||||||
|
(set-buffer (other-buffer)))
|
||||||
|
(bury-buffer buf)))))
|
||||||
|
|
||||||
(defun todos-print-buffer (&optional to-file)
|
(defun todos-print-buffer (&optional to-file)
|
||||||
"Produce a printable version of the current Todos buffer.
|
"Produce a printable version of the current Todos buffer.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue