[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115647: Todo mode bug fixes and new features.
From: |
Stephen Berman |
Subject: |
[Emacs-diffs] trunk r115647: Todo mode bug fixes and new features. |
Date: |
Fri, 20 Dec 2013 17:16:54 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115647
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15225
author: Stephen Berman <address@hidden>
committer: Stephen Berman <address@hidden>
branch nick: trunk
timestamp: Fri 2013-12-20 18:16:47 +0100
message:
Todo mode bug fixes and new features.
* calendar/todo-mode.el: Bug fixes and new features.
(todo-toggle-item-highlighting): Use eval-and-compile instead of
eval-when-compile.
(todo-move-category): Allow choosing a non-existing todo file to
move the category to, and create that file.
(todo-default-priority): New user option.
(todo-set-item-priority): Use it.
(todo-desktop-save-buffer, todo-restore-desktop-buffer): New functions.
(desktop-restore-file-buffer): Declare.
(desktop-buffer-mode-handlers): Add todo-restore-desktop-buffer.
(todo-modes-set-2): Locally set desktop-save-buffer to
todo-desktop-save-buffer.
(todo-mode, todo-archive-mode, todo-filtered-items-mode)
(auto-mode-alist): Add autoload cookie.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/calendar/todo-mode.el todos.el-20120911155047-0ytqo2nidwqquefa-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-20 16:37:10 +0000
+++ b/lisp/ChangeLog 2013-12-20 17:16:47 +0000
@@ -1,3 +1,20 @@
+2013-12-20 Stephen Berman <address@hidden>
+
+ * calendar/todo-mode.el: Bug fixes and new features (bug#15225).
+ (todo-toggle-item-highlighting): Use eval-and-compile instead of
+ eval-when-compile.
+ (todo-move-category): Allow choosing a non-existing todo file to
+ move the category to, and create that file.
+ (todo-default-priority): New user option.
+ (todo-set-item-priority): Use it.
+ (todo-desktop-save-buffer, todo-restore-desktop-buffer): New functions.
+ (desktop-restore-file-buffer): Declare.
+ (desktop-buffer-mode-handlers): Add todo-restore-desktop-buffer.
+ (todo-modes-set-2): Locally set desktop-save-buffer to
+ todo-desktop-save-buffer.
+ (todo-mode, todo-archive-mode, todo-filtered-items-mode)
+ (auto-mode-alist): Add autoload cookie.
+
2013-12-20 Bozhidar Batsov <address@hidden>
* emacs-lisp/subr-x.el: Renamed from helpers.el.
=== modified file 'lisp/calendar/todo-mode.el'
--- a/lisp/calendar/todo-mode.el 2013-07-28 22:34:32 +0000
+++ b/lisp/calendar/todo-mode.el 2013-12-20 17:16:47 +0000
@@ -1040,7 +1040,7 @@
(defun todo-toggle-item-highlighting ()
"Highlight or unhighlight the todo item the cursor is on."
(interactive)
- (eval-when-compile (require 'hl-line))
+ (eval-and-compile (require 'hl-line))
(when (memq major-mode
'(todo-mode todo-archive-mode todo-filtered-items-mode))
(if hl-line-mode
@@ -1360,8 +1360,9 @@
(defun todo-move-category ()
"Move current category to a different todo file.
-If current category has archived items, also move those to the
-archive of the file moved to, creating it if it does not exist."
+If the todo file chosen does not exist, it is created.
+If the current category has archived items, also move those to
+the archive of the file moved to, creating it if it does not exist."
(interactive)
(when (or (> (length todo-categories) 1)
(todo-y-or-n-p (concat "This is the only category in this file; "
@@ -1370,15 +1371,22 @@
(let* ((ofile todo-current-todo-file)
(cat (todo-current-category))
(nfile (todo-read-file-name
- "Choose a todo file to move this category to: " nil t))
+ "Todo file to move this category to: " nil))
(archive (concat (file-name-sans-extension ofile) ".toda"))
(buffers (append (list ofile)
(unless (zerop (todo-get-count 'archived cat))
(list archive))))
new)
- (while (equal (file-truename nfile) (file-truename ofile))
+ (while (equal nfile (file-truename ofile))
(setq nfile (todo-read-file-name
- "Choose a file distinct from this file: " nil t)))
+ "Choose a file distinct from this file: " nil)))
+ (unless (member nfile todo-files)
+ (with-current-buffer (get-buffer-create nfile)
+ (erase-buffer)
+ (write-region (point-min) (point-max) nfile nil 'nomessage nil t)
+ (kill-buffer nfile))
+ (setq todo-files (funcall todo-files-function))
+ (todo-reevaluate-filelist-defcustoms))
(dolist (buf buffers)
(with-current-buffer (find-file-noselect buf)
(widen)
@@ -1633,6 +1641,12 @@
:type 'boolean
:group 'todo-edit)
+(defcustom todo-default-priority 'first
+ "Default priority of new and moved items."
+ :type '(choice (const :tag "Highest priority" first)
+ (const :tag "Lowest priority" last))
+ :group 'todo-edit)
+
(defcustom todo-item-mark "*"
"String used to mark items.
To ensure item marking works, change the value of this option
@@ -2617,7 +2631,9 @@
;; todo item.
(when (> maxnum 1)
(while (not priority)
- (setq candidate (read-number prompt))
+ (setq candidate (read-number prompt
+ (if (eq todo-default-priority 'first)
+ 1 maxnum)))
(setq prompt (when (or (< candidate 1) (> candidate maxnum))
(format "Priority must be an integer between 1 and
%d.\n"
maxnum)))
@@ -5263,6 +5279,22 @@
(add-function :override diary-goto-entry-function #'todo-diary-goto-entry)
+(defun todo-desktop-save-buffer (_dir)
+ `((catnum . ,(todo-category-number (todo-current-category)))))
+
+(declare-function desktop-restore-file-buffer "desktop"
+ (buffer-filename buffer-name buffer-misc))
+
+(defun todo-restore-desktop-buffer (file buffer misc)
+ (desktop-restore-file-buffer file buffer misc)
+ (with-current-buffer buffer
+ (widen)
+ (let ((todo-category-number (cdr (assq 'catnum misc))))
+ (todo-category-select))))
+
+(add-to-list 'desktop-buffer-mode-handlers
+ '(todo-mode . todo-restore-desktop-buffer))
+
(defun todo-done-item-p ()
"Return non-nil if item at point is a done item."
(save-excursion
@@ -6480,6 +6512,8 @@
"Make some settings that apply to multiple Todo modes."
(add-to-invisibility-spec 'todo)
(setq buffer-read-only t)
+ (when (and (boundp 'desktop-save-mode) desktop-save-mode)
+ (setq-local desktop-save-buffer 'todo-desktop-save-buffer))
(when (boundp 'hl-line-range-function)
(setq-local hl-line-range-function
(lambda() (save-excursion
@@ -6495,6 +6529,7 @@
(put 'todo-mode 'mode-class 'special)
+;;;###autoload
(define-derived-mode todo-mode special-mode "Todo"
"Major mode for displaying, navigating and editing todo lists.
@@ -6521,6 +6556,7 @@
;; If todo-mode is parent, all todo-mode key bindings appear to be
;; available in todo-archive-mode (e.g. shown by C-h m).
+;;;###autoload
(define-derived-mode todo-archive-mode special-mode "Todo-Arch"
"Major mode for archived todo categories.
@@ -6569,6 +6605,7 @@
(put 'todo-filtered-items-mode 'mode-class 'special)
+;;;###autoload
(define-derived-mode todo-filtered-items-mode special-mode "Todo-Fltr"
"Mode for displaying and reprioritizing top priority Todo.
@@ -6576,8 +6613,11 @@
(todo-modes-set-1)
(todo-modes-set-2))
+;;;###autoload
(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
+;;;###autoload
(add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
+;;;###autoload
(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
;;
-----------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115647: Todo mode bug fixes and new features.,
Stephen Berman <=