From: Stephen Berman Date: Fri, 19 Apr 2013 13:34:47 +0000 (+0200) Subject: * calendar/todos.el: Extend and improve item filtering and handling of X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2064 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f1806c78f4da16f9f0123eddac86246ccfa960da;p=emacs.git * calendar/todos.el: Extend and improve item filtering and handling of saved files of filtered items. (todos-show-first): Add choices for diary and regexp items. (todos-absolute-file-name): Handle file names for diary and regexp items. (todos-filter-items): New function abstracted from item filtering commands, with handling of saved files of diary and regexp items. (todos-filter-items-1): Rename from todos-filter-items. (todos-filtered-buffer-name): Remove, since functionality is now incorporated into new function todos-filter-items. (todos-filtered-items-buffer, todos-top-priorities-buffer) (todos-diary-items-buffer, todos-regexp-items-buffer): Make defconsts instead of defcustoms. (todos-find-item): Restrict calculation and comparison of priorities to top priority items, in order to handle diary and regexp items. (todos-check-filtered-items-file): Rename from todos-check-top-priorities and adjust message and callers. (todos-filter-items-filename): Rename from todos-top-priorities-filename, adjusting caller and extending to files of filtered diary and regexp items. (todos-save-filtered-items-buffer): Rename from todos-save-top-priorities-buffer and adjust caller and uses. Use write-file instead of write-region and use existing file name if previously saved. (todos-show): Handle initially displaying saved file of filtered diary or regexp items. (todos-top-priorities, todos-top-priorities-multifile) (todos-diary-items, todos-diary-items-multifile) (todos-regexp-items, todos-regexp-items-multifile): Use new function todos-filter-items. (auto-mode-alist): Extend regexp for files assigned to todos-filtered-items-mode to handle saved diary and regexp items. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb42d10aad2..cdc021d192f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,1827 +1,3 @@ -2013-03-17 Stephen Berman - - * calendar/todos.el (todos-insert-item): Fix mistake in logic of - here insertion from last change, and ensure category is set when - command is called from outside Todos buffer. - -2013-03-15 Stephen Berman - - * calendar/todos.el: Item unarchiving fixes and improvements. - (todos-archive-mode-map): Add bindings for item and category - marking/unmarking; make todos-display-categories binding same as - in Todos mode; remove todos-unarchive-category binding. - (todos-unarchive-category): Remove. - (todos-unarchive-items): Fix handling of marked items. Remove - code for unarchiving whole category, since that is covered by - unarchiving marked items. Handle unarchiving items to a category - that had been deleted from the todo file by re-adding the - category. Use todos-category-select to display restored items, - not todos-show. Remove obsolete or superfluous code. - -2013-03-15 Stephen Berman - - * calendar/todos.el (todos-reset-prefix): Don't remove overlays, - since it's superfluous and also wrongly removes items marks. - (todos-category-completions): Select current category on visiting - file, to ensure category is properly displayed if user switches to - file via a non-Todos command. - (todos-mark-category): Make implementation cleaner. - (todos-unmark-category): Improve implementation. Get overlay - property only when there is an overlay. - -2013-03-14 Stephen Berman - - * calendar/todos.el (todos-insert-item): Fix last change to make - sure calling insertion "here" from outside goal todo items section - gives new item top priority. With priority insertion, if user - cancels before setting priority, restore display. - (todos-find-item): Restore narrowing after searching. - (todos-item-done): Allow adding (same) comment to marked items. - Don't add empty comment to done item. - -2013-03-13 Stephen Berman - - * calendar/todos.el (todos-quit): If quitting - todos-filtered-items-mode makes todos-mode current, don't call - todos-show, which (here wrongly) prompts for a new Todos file. - (todos-delete-category): Fix incorrect quotation mark. - (todos-set-item-priority): Make prefix argument a no-op with - commands for raising or lowering item priority. Move mistakenly - placed right paren to end of defun, where it belongs. - -2013-02-25 Stephen Berman - - * calendar/todos.el (todos-key-bindings): Add binding for `todos-show'. - (todos-show): Prompt for which todo file to visit when invoked - from Todos mode. - -2013-02-19 Stephen Berman - - * calendar/todos.el: Item insertion and done/undo fixes. - (todos-insert-item): Maybe set the insertion file to - todos-global-current-todos-file. When inserting into a file that - was not being visited on invoking this command, ensure chosen - category is properly selected. Make item inserted "here" the - first todo item if the command was invoked with point in done - items section or outside of the current category. - (todos-item-done): When done items are shown, put cursor on first - just done item. - (todos-item-undo): Put cursor on undone item. - -2013-02-16 Stephen Berman - - * calendar/todos.el: Improve handling of overlays. - (todos-get-overlay): New function. - (todos-prefix-overlay): Remove, since subsumed by - todos-get-overlay, and replace by the latter in callers. - (todos-reset-prefix): Apply only to buffer visiting Todos files. - Simplify implementation and use `todos' overlay property. - (todos-reset-done-separator): Use todos-get-overlay and `todos' - overlay property. Fix logic. - (todos-category-select): Use todos-get-overlay and `todos' overlay - property. - (todos-remove-item): Use todos-get-overlay. Correct obsolete code. - (todos-prefix-overlays): Use todos-top-priority face also for - non-numerical prefix of top priority items. Add `todos' overlay - property. - (todos-hide-show-date-time): Simplify, using todos-get-overlay and - `todos' overlay property. - -2013-02-14 Stephen Berman - - * calendar/todos.el (todos-edit-multiline, todos-edit-quit): - Revert buffer renaming. - -2013-02-11 Stephen Berman - - * calendar/todos.el (todos-edit-quit): On quitting file editing, - rename buffer back to current Todos file. After selecting - category, put point at top instead of recentering. - -2013-02-08 Stephen Berman - - * calendar/todos.el (todos-edit-multiline-item): Revert to using - indirect buffer, which makes it easier to return to Todos mode. - (todos-edit-quit): Don't delete and reinsert items that don't need - indenting. Revert to just killing buffer on quitting single item - editing. On quitting file editing, select nearest category. - -2013-02-07 Stephen Berman - - * calendar/todos.el: Bug fixes and improvements to item editing - and insertion. - (todos-check-format): Compare current value of todos-categories - with actual categories sexp. - (todos-repair-categories-sexp): Add warning to doc string about - category order getting restored to list element order. - (todos-mode-external-set): When todos-categories is nil, as in - Todos Edit mode, set it by reading actual categories sexp. - (todos-edit-mode): Make buffer writeable. - (todos-done-item-section-p): New function. - (todos-insert-item): Use it as part of preventing insertion here - in done items section. Move check for display of done items only - to just before setting new item's priority, and if cancelled after - toggling to todo items, restore display of done items. - (todos-edit-multiline-item): Don't base on todos-edit-multiline - but just narrow and change mode. - (todos-edit-multiline): Don't make indirect buffer but just widen - and change mode; also remove overlays. - (todos-edit-quit): Restore Todos mode and category display; when - quitting multiline item editing, ensure items above edited item - are visible in window if possible. - (todos-done-item-add-edit-or-delete-comment): If user moved point - during editing, make sure it moves back to edited item before - returning. - -2013-02-05 Stephen Berman - - * calendar/todos.el (todos-reset-done-separator-string): - Complete the implementation. - (todos-hide-show-done-items): If start of done items sections is - below the bottom of the window, make it visible. - (todos-insert-item): Allow inserting item here to work outside of - the current category, but then at top of category. After checking - whether only done items are shown, restore point to ensure - inserting item here works correctly. - (todos-set-item-priority): Delete leftover right paren at end. - -2013-02-04 Stephen Berman - - * calendar/todos.el: Bug fixes involving or displaying done items. - (todos-done-separator): Make length of long separator one less - than window-width, in order to avoid following empty line. - (todos-forward-item, todos-backward-item): Make empty line below - last todo item accessible only by invoking without a numerical - prefix argument and make the latter invocations move only to items. - (todos-insert-item): Set todos-current-todos-file after selecting - buffer, in order not to set global value. If only done items are - shown when this command is invoked, toggle to show todo items to - avoid insertion into done items section. When done items are - shown, protect from cancelling before setting item priority: this - also needs recentering to display all items. - (todos-set-item-priority): Only call on (not done) todo items. - Check that done items are visible not because file is widened. - Use only `any' argument of called-interactively-p. Make sure that - giving an undone item lowest priority restores it to the todo - section. - (todos-item-done): If done items are visible on invoking this - command, keep them visible afterwards. Stop looking for marked - items on reaching the empty line below the last todo item. - -2013-02-02 Stephen Berman - - * calendar/todos.el: Several small fixes and improvements. - (todos-done-separator-string): Change default value. - (todos-update-categories-sexp): Remove unnecessary and misquided - setq of todos-default-todos-file. Use delete-region instead of - kill-region to avoid polluting kill-ring. - (todos-unload-hook): Remove (was not used). - (todos-edit-multiline): Don't generate new edit buffer name on - each invocation---that can cause confusion due to indirect buffer. - (todos-edit-quit): Ensure lines in edit buffer that follow hard - newlines are indented in the file to conform to diary format. - (todos-set-item-priority): If done items in category are visible, - keep them visible. - -2013-01-30 Stephen Berman - - * calendar/todos.el: Fix done separator overlay bug. Remove most - FIXME comments. - (todos-reset-and-enable-done-separator): Remove commented out - workaround for done separator overlay bug; fix doc string. - (todos-reset-done-separator): Delete old overlay after adding new - overlay to fix done separator overlay bug; improve implementation. - (todos-prefix-overlays): Improve first line of doc string. - -2013-01-29 Stephen Berman - - * calendar/todos.el: Improve item marking and handling of marked items. - (todos-prefix): Add validator to ensure value differs from that of - todos-item-mark. - (todos-item-mark): New defcustom. - (todos-prefix-overlay): New function. - (todos-marked-item-p): Use it. Adapt implementation to new - handling of marked items. - (todos-insert-with-overlays): When inserting pushes down a marked - item, move its prefix overlay. - (todos-prefix-overlays): Add overlay even when prefix is empty string, - otherwise item marking fails. Improve handling of marked items. - (todos-mark-unmark-item): Adapt to new handling of marked items - and simplify by removing marking of all items in category. - (todos-mark-category): Adapt to new handling of marked items and - don't use todos-mark-unmark-item. - (todos-unmark-category): Adapt to new handling of marked items. - (todos-delete-item): Remove obsolete handling of marked items and - useless restoration of point. - (todos-set-item-priority): Use new handling of marked items. - (todos-move-item, todos-item-done, todos-item-undo) - (todos-archive-done-item): Remove obsolete handling of marked items. - -2013-01-25 Stephen Berman - - * calendar/todos.el: Improve definitions and use of some faces. - (todos-top-priority): Use current definition of font-lock-constant-face. - (todos-diary-expired): Make default value contrast more with - default value of todos-date face. - (todos-nondiary, todos-category-string): New faces. - (todos-nondiary-face, todos-category-string-face): Corresponding - new variables. - (todos-done, todos-comment): Switch default values to go better - with default value of todos-date face. - (todos-done-sep): Change default value. - (todos-category-string-matcher-1) - (todos-category-string-matcher-2): Improve doc string. - (todos-font-lock-keywords): Use todos-nondiary-face and - todos-category-string-face. - (todos-done-separator): Propertize string with todos-done-sep face. - (todos-filtered-items-mode): Fix typo. - -2013-01-23 Stephen Berman - - * calendar/todos.el: Improve handling of saved top priorities items. - (todos-find-item): Find done items and items whose priority has - changed or whose text was truncated or augmented; add doc string. - (todos-check-top-priorities): Highlight each item that is not up - to date. - (todos-jump-to-item): Jump to items whose priority has changed or - whose text was truncated or augmented. - -2013-01-22 Stephen Berman - - * calendar/todos.el: Revise handling of initial display and extend - to top priorities file. - (todos-display-categories-first): Remove, replacing by this: - (todos-show-first): New defcustom. - (todos-first-visit): Remove, replacing by this: - (todos-visited): New variable. - (todos-absolute-file-name): Extend possible values of optional - argument to take top priorities files into account. - (todos-modes-set-3, todos-mode): Remove use of todos-first-visit. - (todos-mode-external-set): Call find-file-noselect instead of - find-buffer-visiting, since the latter may fail. - (todos-show): Revise handling of initial display using - todos-show-first and todos-visited and extend to top priorities - file. - (todos-quit): Adapt to new handling of initial display. - -2013-01-14 Stephen Berman - - * calendar/todos.el: Implement saving top priority items buffers, - improve implementation of item filtering commands and - infrastucture, and fix two bugs. - (todos-prefix-overlays): Use todos-top-priority face only in Todos - mode. - (todos-multiple-filter-files): Get file-truename of Todos file. - (todos-filter-items): Pass a list of files from the caller instead - of building it here, and move handling of cancelled file selection - dialog to callers. Correct omission of file-wide default number - of top priorities. - (todos-filtered-buffer-name): Treat file-list argument only as a list. - (todos-find-item, todos-check-top-priorities) - (todos-top-priorities-filename) - (todos-save-top-priorities-buffer): New functions. - (todos-save): Use todos-save-top-priorities-buffer. - (todos-jump-to-item): Refactor and use todos-find-item. - (todos-top-priorities): Simplify semantics of prefix argument. - Check if top priorities file exists and if so, visit it, reporting - whether it is up to date. Add optional argument and use it to - handle multiple files. - (todos-diary-items, todos-regexp-items): Add optional argument and - use it to handle multiple files. - (todos-top-priorities-multifile, todos-diary-items-multifile) - (todos-regexp-items-multifile): Refactor, using corresponding - non-multifile command. - (auto-mode-alist): Add pattern for top priorities files to visit - these in Todos Filtered Items mode. - -2013-01-08 Stephen Berman - - * calendar/todos.el: Fix tabular alignment in Todos Categories mode. - (todos-adjusted-category-label-length): New function. - (todos-padded-string): Use it. - -2013-01-08 Stephen Berman - - * calendar/todos.el (todos-move-item): Allow moving done items to - done section of another category. - -2013-01-06 Stephen Berman - - * calendar/todos.el: Display numerical priority string of top - priority items in category in a distinctive face. - (todos-prefix-string): Make doc string more precise. - (todos-top-priority): New defface. - (todos-done, todos-done-sep): Use more compact face definition - \(taken from font-lock.el). - (todos-comment): Give a complete face definition, instead of - inheriting from todos-done. - (todos-font-lock-keywords): Use todos-comment-face for - todos-comment-string-matcher. - (todos-prefix-overlays): Use todos-top-priority as the face - property of top priority items; don't condition reapplying item - prefix overlay on whether the string changed, since that prevents - updating display after changing number of top priorities. - (todos-set-top-priorities): Call todos-prefix-overlays to update - display. - -2013-01-04 Stephen Berman - - * calendar/todos.el (todos-reset-global-current-todos-file) - (todos-display-categories-1): Use absolute name of - todos-default-todos-file. - -2013-01-04 Stephen Berman - - * calendar/todos.el (todos-insert-item): Fix copy and paste error - from previous change. - -2013-01-03 Stephen Berman - - * calendar/todos.el: Implement extended category completions. - (todos-default-todos-file): Change default value to correct custom - type. - (todos-category-completions-files): New defcustom. - (todos-reevaluate-category-completions-files-defcustom) - (todos-absolute-file-name, todos-category-completions): New defuns. - (todos-reevaluate-filelist-defcustoms): - Add todos-category-completions-files and - todos-reevaluate-category-completions-files-defcustom. - (todos-allcats-file, todos-all-categories-alist) - (todos-jump-to-category-other-file, todos-jump-to-any-category) - (todos-move-item-to-file): Remove (todos-all-categories-alist both - as defvar and as defun). - (todos-read-category): Rewrite using extended category completions - and better handling of completion against existing or non-existing - categories. - (todos-validate-name): Correct doc string; use local instead of - dynamic variables in function body. - (todos-insert-category-line): Adjust use of todos-jump-to-category - to new argument list. - (todos-key-bindings, todos-menu): Delete entries for removed - commands. - (todos-show): Get absolute name of todos-default-todos-file; - add `nowarn' argument to find-file-noselect; adjust use of - todos-add-category to new argument list. - (todos-jump-to-category): Rewrite using extended category - completions; reverse argument list, adapting FILE argument to new - completion mechanism; add autoload cookie; call todos-show if - there are no Todos files. - (todos-add-category): Rewrite using extended category completions; - add FILE argument to accommodate new completion mechanism. - (todos-merge-category): Adapt to extended category completions, - adding prefix argument. - (todos-insert-item): Adapt to extended category completions; use - todos-read-category instead of todos-jump-to-category in prefix - argument calls; call todos-show if there are no Todos files; if - item is inserted at end of category, recenter to ensure the items - above it are displayed in the window. - (todos-move-item): Adapt to extended category completions, making - argument prefix argument; allow moving within category (for the - sake of code simplification); add `nowarn' argument to - find-file-noselect. - (todos-archive-done-item): Prevent error when attempting to - archive not-done todo item; adjust use of todos-add-category to - new argument list. - -2012-12-15 Stephen Berman - - * calendar/todos.el (todos-archive-done-item): Fix archiving of - all done items in a category and resulting display of todo file. - -2012-12-14 Stephen Berman - - * calendar/todos.el (todos-priorities-rules): Fix customization - type to prevent mismatch error. - (todos-set-top-priorities): Fix rule construction; fix input check; - improve prompt. - -2012-12-14 Stephen Berman - - * calendar/todos.el (todos-insert-item): If user exits Calendar - before choosing a date, cancel item insertion. - (todos-set-date-from-calendar): If user exits Calendar before - choosing a date, clean up properly. - -2012-12-12 Stephen Berman - - * calendar/todos.el: Extend and improve handling of item editing, - especially of date/time header. - (todos-month-name-array, todos-month-abbrev-array): New defconsts. - (todos-date-pattern): Use explicitly numbered groups. - (todos-read-date): Optionally read and return just one of the date - string components year, month or monthname, day. - (todos-key-bindings): Add bindings for new item header editing - commands. - (todos-edit-item): Exclude date/time header from minibuffer by - default; include it by passing a prefix argument. - (todos-edit-item-header-1): New function containing the guts of - the commands for editing item date/time headers. - (todos-edit-item-header): Use it. Condition editing of time - string on value of `todos-always-add-time-string'. - (todos-edit-item-date-from-calendar): Use todos-edit-item-header-1. - (todos-edit-item-date-to-today): Rename from - todos-edit-item-date-is-today and use todos-edit-item-header-1. - (todos-edit-item-date): Remove. - (todos-edit-item-date-day-name, todos-edit-item-date-year) - (todos-edit-item-date-month, todos-edit-item-date-day): New commands. - -2012-12-02 Stephen Berman - - * calendar/todos.el (todos-show): Fix a comment. - (todos-add-category): Prompt for a new category if passed category - is the empty string, not nil. - -2012-11-26 Stephen Berman - - * calendar/todos.el (todos-make-categories-list) - (todos-convert-legacy-files, todos-jump-to-item) - (todos-move-category, todos-merge-category) - (todos-archive-done-item, todos-unarchive-items): Include end of - line in regex searches for beginning of category, in order not to - get a category whose name contains the searched for category name. - -2012-11-15 Stephen Berman - - * calendar/todos.el (todos-forward-category): Fix typo. - -2012-10-30 Stephen Berman - - * calendar/todos.el (todos-define-insertion-command): - Let generated insertion commands accept a prefix argument. - -2012-10-08 Stephen Berman - - * calendar/todos.el (todos-move-item): If user quits before - completing movement, restore display of initial category; if item - is moved to end of target category, make sure the items above it - are displayed in the window. - -2012-10-08 Stephen Berman - - * calendar/todos.el: Fixes to todos-move-item and some of its - subroutines. - (todos-move-item): When there are marked items, point need not be - on an item; remove obsolete use of todos-add-category, since this - is now already done in todos-read-category; fix typo. - (todos-diary-item-p): Exclude empty lines. - (todos-read-category): Restore point and narrowing after adding - new category, to avoid moving to beginning of file when moving - marked items to a new category. - (todos-set-item-priority): Prompt for priority only when the - category has at least one todo item; only use non-nil priority to - calculate insertion location. - (todos-read-category): Don't reset todos-categories when a new - category is added due to todos-move-item or todos-jump-to-item. - -2012-09-24 Stephen Berman - - Changes from 2012-07-14 (revision 110020). - * calendar/todos.el (todos-copy-item): New command. - (todos-insertion-map): Add key binding for it. - -2012-09-24 Stephen Berman - - Changes from 2012-07-13 (revision 110019). - * calendar/todos.el (todos-undo-item-omit-comment): New defcustom. - (todos-item-undo): Use it. - (todos-allcats-file, todos-all-categories-alist): New variables. - (todos-all-categories-alist): New function. - (todos-jump-to-any-category): New command. - (todos-move-item): Remove mark overlays from buffer items were - moved from; update todos-categories-with-marks, - -2012-09-24 Stephen Berman - - Changes from 2012-06-27 (revision 110018). - * calendar/todos.el: Further code rearrangement; further new and - revised comments. - (todos-reevaluate-filelist-defcustoms): Rename from - todos-reevaluate-defcustoms and adjust callers. - (todos-date-pattern, todos-nondiary-start, todos-nondiary-end) - (todos-date-string-start, todos-done-string-start) - (todos-item-start): Change from defvar to defconst. - (todos-set-top-priorities): Use read-number and simplify. - (todos-insert-item): Check whether date-type argument is a string. - (todos-set-date-from-calendar): Check whether - todos-date-from-calendar is a string; simplify cond clause. - (todos-archive-done-item, todos-unarchive-items): - Use buffer-substring-no-properties. - -2012-09-23 Stephen Berman - - Changes from 2012-06-25 (revision 110017). - * calendar/todos.el (todos-item-undo): Fix restoration on - cancelling; use buffer-substring-no-properties; comment out code - removing mark overlay; fix insertion of undone items; display any - remaining done items. - -2012-09-23 Stephen Berman - - Changes from 2012-06-24 (revision 110016). - * calendar/todos.el: Further significant code rearrangement; - further comment revision. - (todos-mode-display): New defgroup. - (todos-prefix, todos-number-priorities) - (todos-done-separator-string, todos-done-string) - (todos-comment-string, todos-show-with-done) - (todos-mode-line-function, todos-skip-archived-categories) - (todos-highlight-item, todos-wrap-lines) - (todos-line-wrapping-function): Use it. - (todos-item-insertion): New defgroup. - (todos-include-in-diary, todos-diary-nonmarking) - (todos-nondiary-marker, todos-always-add-time-string) - (todos-use-only-highlighted-region): Use it. - (todos-forward-button, todos-backward-button): New commands. - (todos-categories-mode-map): Use them, replacing forward-button - and backward-button. - (todos-merge-category): Fix and improve implementation; handle - archived items. - (todos-insert-item, todos-set-date-from-calendar): Handle setting - date by calling todos-insert-item-from-calendar. - (todos-delete-item): Fix overlay handling. - (todos-move-item): Highlight item to be moved. - (todos-item-undo): Handle marked items. - (todos-insert-item-from-calendar): Rewrite using - todos-date-from-calendar. - -2012-09-23 Stephen Berman - - Changes from 2012-06-21 (revision 110015). - * calendar/todos.el: Further comment revision. - (todos-sorted-column): Change default value, also taking tty into - account. - (todos-reset-done-separator): Fix faulty variable binding. - (todos-reset-and-enable-done-separator): Save match data; comment - out code that causes problems for Edebug. - (todos-item-start): Handle empty line between todo and done items - when done items are hidden. - (todos-read-date): Use a leap year for `*' to allow - calendar-last-day-of-month to return Feb. 29. - (todos-archive-mode, todos-edit-mode, todos-categories-mode) - (todos-filtered-items-mode): Delete faulty parentheses. - (todos-quit): Save Todos and archive files unconditionally. - (todos-forward-item): Accept only positive prefix argument. - (todos-backward-item): Accept only positive prefix argument; don't - move point to beginning of buffer if it is on the first item. - (todos-hide-show-date-time): Remove obsolete interactive spec. - (todos-move-category): Improve prompt string; ensure file moved to - is different from file moved from. - (todos-merge-categories): Remove. - (todos-set-category-priority): New command. - (todos-raise-category-priority, todos-lower-category-priority): - Use it to define these commands. - (todos-set-item-priority): Rewrite and generalize. - (todos-raise-item-priority, todos-lower-item-priority): Use it to - define these commands. - -2012-09-23 Stephen Berman - - Changes from 2012-06-15 (revision 110014). - * calendar/todos.el (todos-reset-done-separator) - (todos-reset-and-enable-done-separator): New functions. - (todos-reset-done-separator-string): Rewrite using - todos-reset-done-separator for string longer than 1 character. - (todos-mode): Add todos-reset-and-enable-done-separator to - window-configuration-change-hook, replacing previous anonymous - function. - (todos-unload-hook): And remove it. - -2012-09-23 Stephen Berman - - Changes from 2012-06-14 (revision 110013). - * calendar/todos.el (todos-done-separator-string): New defcustom. - (todos-done-separator): New variable replacing defcustom of the - same name. - (todos-reset-done-separator-string, todos-done-separator): - New functions. - (todos-mode): Make function added to - window-configuration-change-hook do a better job of updating the - done items separator string overlay. - (todos-unload-hook): Remove it here. - (todos-item-undo): Fix search for item's end. - -2012-09-23 Stephen Berman - - Changes from 2012-06-03 (revision 110012). - * calendar/todos.el: Further comment revision. - (todos-sorted-column): Change default value. - (todos-item-start): Handle empty category (needed in - todos-filter-items). - (todos-read-date): Don't use calendar-read; make code cleaner. - (todos-multiple-filter-files): Rename this variable from - todos-multiple-files and adjust users. - (todos-multiple-filter-files-widget): Rename from - todos-multiple-files-widget and adjust users. - (todos-multiple-filter-files): Rename this function from - todos-multiple-files and adjust callers. - (todos-filter-items): Remove unused code. - (todos-insert-category-line): Add space so highlighting of last - column is consistent with the others; adjust display of column - highlighting. - (todos-menu): Remove obsolete entry. - (todos-categories-mode-map): Add new bindings. - (todos-display-categories-alphabetically-or-by-priority): New command. - (todos-display-categories-sorted-by-todo) - (todos-display-categories-sorted-by-diary) - (todos-display-categories-sorted-by-done) - (todos-display-categories-sorted-by-archived): Restore and fix - implementation. - -2012-09-23 Stephen Berman - - Changes from 2012-06-02 (revision 110011). - * calendar/todos.el: Significant code rearrangement; further - comment revision. - (todos-filtered-items-buffer): Rename from todos-filter-buffer and - adjust users. - (todos-filtered-buffer-name): Rename from - todos-special-buffer-name and adjust users. - (todos-filtered-items-mode-map): Rename from - todos-filter-items-mode-map and adjust users. - (todos-mode-external-set): Use todos-categories instead of - todos-set-categories (and add comment to check if this DTRT). - (todos-filtered-items-mode): Rename from todos-filter-items-mode - and adjust users. - (todos-add-category): Don't call todos-validate-name, since - todos-read-category does. - (todos-edit-quit): Use todos-repair-categories-sexp. - (todos-done-item-add-edit-or-delete-comment): Rename from - todos-done-item-add-or-edit-comment and adjust users; add optional - argument to prompt to delete comment. - (todos-item-undo): Delete done item comment on undoing if user - confirms. - -2012-09-22 Stephen Berman - - Changes from 2012-06-02 (revision 110010). - * calendar/todos.el: Further code rearrangement and comment - revision. - (todos-item-start): Handle empty line between todo and done items - when done items are displayed. - (todos-key-bindings): Comment out bindings meant only for - todos-archive-mode. - (todos-archive-mode-map): Fix typo. - (todos-archive-mode): Derive from special-mode instead of - todos-mode to prevent its key bindings from being available here. - (todos-archive-done-item): Remove obsolete code; fix item count - updating. - (todos-unarchive-items): Simplify; fix unarchiving of all items in - category; fix item count updating; fix typo. - -2012-09-22 Stephen Berman - - Changes from 2012-06-01 (revision 110009). - * calendar/todos.el: Further code rearrangement and comment - revision. - (todos-add-to-buffer-list, todos-update-buffer-list): New functions. - (todos-file-buffers): New variable. - (todos-reset-global-current-todos-file): Use it to simplify - implementation of this function. - (todos-filtered): New defgroup. - (todos-filter-buffer, todos-top-priorities-buffer) - (todos-diary-items-buffer, todos-regexp-items-buffer) - (todos-priorities-rules, todos-show-priorities) - (todos-filter-files, todos-filter-done-items): Use it. - (todos-skip-archived-categories): Rename from - todos-ignore-archived-categories and adjust users. - (todos-display-as-todos-file): Rename from todos-after-find-file - and adjust callers. - (todos-reset-highlight-item, todos-mode-external-set) - (todos-jump-to-category, todos-jump-to-item) - (todos-raise-category-priority, todos-insert-item) - (todos-move-item): Use find-file-visiting. - (todos-make-categories-list): Use file-truename. - (todos-display-categories-1): Adjust title text for archive files; - use done label for item counts in archive files. - (todos-modes-set-3): Add todos-display-as-todos-file to - find-file-hook. - (todos-mode): Add todos-add-to-buffer-list to find-file-hook and - todos-update-buffer-list post-command-hook. - (todos-unload-hook): And remove them. - (todos-show): Only when interactively invoked from an archive, - switch to corresponding Todos file. - (todos-archive-done-item): Remove obsolete code; fix handling of - marked items; fix search for existing category; check whether - archive exists and write to file if not; improve display handling. - -2012-09-21 Stephen Berman - - Changes from 2012-05-29 (revision 110008). - * calendar/todos.el: Further comment revision. - (todos-item-end): Replace use of command todos-forward-item by - regexp searches using internal variables. - (todos-raise-category-priority): Improve and comment. - (todos-insert-item): Fix insertion of empty time string. - -2012-09-21 Stephen Berman - - Changes from 2012-05-29 (revision 110007). - * calendar/todos.el (todos-ignore-archived-categories): - Revert last change; remove :initialize and :set functions; change - use and change users accordingly. - (todos-reset-categories, todos-categories-full) - (todos-truncate-categories-list): Remove. - (todos-set-categories, todos-update-categories-sexp): - Use todos-categories instead of todos-categories-full; remove use - of todos-ignore-archived-categories and - todos-truncate-categories-list. - (todos-check-format, todos-repair-categories-sexp): - Use todos-categories instead of todos-categories-full. - (todos-read-category): Improve last change. - (todos-validate-name): Use completing-read. - (todos-categories-category-number): Rename from - todos-category-number and adjust users. - (todos-update-categories-display, todos-mode-external-set) - (todos-delete-category, todos-move-category, todos-merge-category) - (todos-unarchive-items): Remove use of todos-categories-full and - todos-ignore-archived-categories. - (todos-modes-set-3, todos-add-category): Remove use of - todos-categories-full. - (todos-edit-mode): Fix typo. - (todos-forward-category): Use todos-ignore-archived-categories. - -2012-09-21 Stephen Berman - - Changes from 2012-05-28 (revision 110006). - * calendar/todos.el: Doubts about todos-ignore-archived-categories. - (todos-ignore-archived-categories): Change default value. - -2012-09-21 Stephen Berman - - Changes from 2012-05-27 (revision 110005). - * calendar/todos.el: Further comment revision. - (todos-reset-global-current-todos-file): - Try to make this not slow down kill-buffer. - (todos-update-categories-sexp): Handle the case where there is no - categories sexp yet, i.e. after inserting the first item in the - file, so todos-display-categories works. - (todos-read-file-name): Improve implementation. - (todos-validate-name): Use variable todos-files. - (todos-category-number): New variable. - (todos-insert-category-line, todos-update-categories-display) - (todos-raise-category-priority): Use it. - (todos-add-file): Remove unused remnant code. - -2012-09-21 Stephen Berman - - Changes from 2012-05-25 (revision 110004). - * calendar/todos.el: Further comment revision. - (todos-set-item-top-priority): New command. - (todos-reset-global-current-todos-file): - Use todos-files-function instead of todos-files. - (todos-read-category): Add optional argument to test whether - caller adds new category; if so, don't prompt for new category and - don't restore original todos-categories list. - (todos-categories-mode-map): Update to renamed commands. - (todos-filter-items-mode-map): Add binding for new command. - (todos-mode): Fix typo. - (todos-show): If called from archive file, show corresponding - category in Todos file, if it exists. - (todos-jump-to-category): Remove code to add new category, since - todos-read-category can do that. - (todos-add-file): Remove obsolete code; visit new file in selected - window. - (todos-add-category): Simplify. - (todos-rename-category): Use force-mode-line-update instead of - setting mode-line-buffer-identification. - (todos-delete-category): Improve logic of prompts; use - todos-categories-full and check todos-ignore-archived-categories. - (todos-raise-category-priority, todos-lower-category-priority): - Rename from todos-{raise,lower}-category and adjust callers. - (todos-move-category, todos-merge-category): - Set todos-categories-full; on setting todos-categories check - todos-ignore-archived-categories. - (todos-insert-item): Let-bind use-empty-active-region and use - use-region-p instead of transient-mark-mode. - (todos-raise-item-priority): Improve implementation. - (todos-archive-done-item): Rename from - todos-archive-done-item-or-items and adjust callers; confine to - Todos mode. - (todos-unarchive-items): On setting todos-categories check - todos-ignore-archived-categories. - -2012-09-21 Stephen Berman - - Changes from 2012-05-23 (revision 110003). - * calendar/todos.el (todos-key-bindings): Remove binding of - deleted command. - (todos-menu): Remove entry of deleted command. - (todos-show-archive): Fix last change. - (todos-done-item-add-or-edit-comment): Rename from - todos-comment-done-item and adjust callers; prompt to edit an - existing comment. - -2012-09-21 Stephen Berman - - Changes from 2012-05-22 (revision 110002). - * calendar/todos.el (todos-set-show-current-file): Rename from - todos-toggle-show-current-file and adjust callers. - (todos-number-priorities): Rename from todos-number-prefix and - adjust users. - (todos-update-count): Rename from todos-set-count and adjust - callers. - (todos-hide-show-item-numbering): Rename from - todos-toggle-item-numbering and adjust callers. - (todos-hide-show-done-items): Rename from - todos-toggle-view-done-items and adjust callers. - (todos-show-done-only): Rename from todos-toggle-show-done-only. - (todos-view-archived-items): Comment out. - (todos-show-archive): Prompt to choose another archive file if - current Todos file lacks an archive; prompt to visit archive - anyway when current category has no archived items. - -2012-09-21 Stephen Berman - - Changes from 2012-05-21 (revision 110001). - * calendar/todos.el: Further comment revision and code - rearrangement. - (todos-item-end): Revert last change. - (todos-key-bindings, todos-menu, todos-archive-mode-map) - (todos-filter-items-mode-map): Use renamed commands. - (todos-hide-show-date-time): Rename from - todos-toggle-display-date-time. - (todos-mark-unmark-item): Rename from todos-toggle-mark-item and - adjust caller. - (todos-backward-item): Exempt special handling only from - todos-regexp-items-buffer instead of todos-filter-items-mode. - (todos-raise-item-priority): Don't allow item reprioritizing in - Todos filter items mode except for top priority items. - -2012-09-21 Stephen Berman - - Changes from 2012-05-19 (revision 110000). - * calendar/todos.el: Add and revise further doc strings and - comments. - (todos-filter-function, todos-custom-items) - (todos-custom-items-multifile): Remove. - (todos-filter-done-items): New defcustom. - (todos-item-end, todos-backward-item): Handle todos-filter-items-mode. - (todos-filter-items): Check return value of caller first; tag - archived items for todos-jump-to-item; delete categories sexp - before processing filter; check todos-filter-done-items for - whether to leave done items; remove custom filter; fix regexp for - file and category tags; don't invoke buffer fontification. - (powerset-recursive): Fix typo. - (todos-key-bindings): Remove unused bindings. - (todos-top-priorities-multifile, todos-diary-items-multifile) - (todos-regexp-items-multifile): Use variable todos-multiple-files. - (todos-jump-to-item): Fix regexp; handle archive tags; take - todos-filter-done-items into account. - (todos-insert-item-from-calendar): Relocate to end of file - together with key-binding as addition to calendar.el. - -2012-09-20 Stephen Berman - - Changes from 2012-05-17 (revision 109999). - * calendar/todos.el: Add and revise further doc strings and - comments; major code rearrangement. - (todos-merged-files, todos-prompt-merged-files) - (todos-print-priorities, todos-tmp-buffer-name) - (todos-top-priorities-widgets, todos-update-merged-files) - (todos-merged-top-priorities, todos-merged-diary-items) - (todos-merged-regexp-items, todos-merged-custom-items) - (todos-raw-mode, todos-change-default-file) - (todos-toggle-diary-inclusion, todos-toggle-item-diary-nonmarking) - (todos-toggle-diary-nonmarking, todos-validate-category-name): - Remove. - (todos-category-string-matcher): Comment out. - (todos-categories): New defgroup. - (todos-initial-file, todos-filter-buffer) - (todos-top-priorities-buffer, todos-categories-category-label) - (todos-diary-items-buffer, todos-regexp-items-buffer) - (todos-custom-items-buffer, todos-filter-files) - (todos-highlight-item, todos-todo-mode-date-time-regexp): - New defcustoms. - (todos-diary-expired): New face. - (todos-print-buffer, todos-multiple-files) - (todos-multiple-files-widget, todos-key-bindings): New variables. - (todos-short-file-name, todos-reevaluate-default-file-defcustom) - (todos-special-buffer-name) - (todos-reevaluate-filter-files-defcustom) - (todos-reset-highlight-item, todos-reevaluate-defcustoms) - (todos-nondiary-marker-matcher, todos-diary-nonmarking-matcher) - (todos-diary-expired-matcher, todos-category-string-matcher-1) - (todos-category-string-matcher-2, todos-repair-categories-sexp) - (todos-validate-name, todos-multiple-files) - (todos-display-categories-1, todos-update-categories-display) - (todos-modes-set-3, todos-mode-external-set): New functions. - (todos-set-top-priorities-in-file) - (todos-set-top-priorities-in-category) - (todos-top-priorities-multifile, todos-diary-items-multifile) - (todos-regexp-items-multifile, todos-custom-items-multifile) - (todos-convert-legacy-files, todos-jump-to-item) - (todos-edit-multiline-item, todos-edit-item-date-from-calendar) - (todos-edit-item-diary-inclusion) - (todos-edit-category-diary-inclusion) - (todos-edit-item-diary-nonmarking) - (todos-edit-category-diary-nonmarking): New commands. - (todos, todos-faces): Update :version. - (todos-done-separator, todos-completion-ignore-case): - Change default value. - (todos-done-separator): Change :set function. - (todos-indent-to-here): Add :validate function to :type. - (todos-prefix-string, todos-mark, todos-button) - (todos-sorted-column, todos-archived-only, todos-search) - (todos-done, todos-done-sep): Provide full face definitions - instead of inheriting. - (todos-edit-buffer, todos-categories-buffer): Change from - defcustom to defvar. - (todos-category-beg, todos-category-done): Change from defvar to - defconst. - (todos-files): Check if todos-files-directory exists. - (todos-default-todos-file, todos-mode-line-control, todos-print): - Use todos-short-file-name. - (todos-font-lock-keywords): Use todos-nondiary-marker-matcher, - todos-diary-nonmarking-matcher, todos-category-string-matcher-1, - todos-category-string-matcher-2, todos-diary-expired-matcher. - (todos-category-select): Use todos-done-string-start, and - condition search on todos-show-with-done; don't make display - overlay for done items separator string if there already is one; - use todos-highlight-item, require hl-line and activate - hl-line-mode here in order to avoid a hang if done in todos-mode - or the mode hook. - (todos-update-categories-sexp): Use todos-categories-full if set, - otherwise todos-categories. - (todos-make-categories-list): Don't test for archive file when - processing a legacy todo-mode file. - (todos-check-format): Add check for todos-categories sexp. - (todos-diary-item-p): Use todos-nondiary-start instead of - todos-date-pattern. - (todos-marked-item-p): Rename from todos-item-marked-p. - (todos-read-file-name): Don't accept empty name; validate. - (todos-read-category): Validate new name before prompting whether - to add new category; force quit if user answers no. - (todos-filter-items): Improve implementation. - (todos-set-top-priorities): Rewrite as a noninteractive function - using minibuffer input instead of widgets. - (todos-insert-sort-button): Call todos-display-sorted with - argument nil to display categories in numerical order, instead of - calling todos-display-categories. - (powerset-recursive): Borrow and slightly reformulate the (GDFL'd) - Common Lisp powerset function at - http://rosettacode.org/wiki/Power_set#Common_Lisp. - (powerset-bitwise): Implement in Emacs Lisp the (GDFL'd) C - powerset function at http://rosettacode.org/wiki/Power_set#C. - (todos-powerset): Defalias to powerset-bitwise. - (todos-mode-map): Generate from todos-key-bindings instead of - listing each key definition. - (todos-categories-mode-map): Add two bindings. - (todos-filter-items-mode-map): Add some bindings, remove others. - (todos-mode): Derive from special-mode; use todos-modes-set-3; add - function setting todos-done-separator to - window-configuration-change-hook. - (todos-unload-hook): Remove function setting todos-done-separator - from window-configuration-change-hook. - (todos-archive-mode): Derive from todos-mode; use todos-modes-set-3. - (todos-edit-mode): Derive from text-mode; use todos-mode-external-set. - (todos-categories-mode): Derive from special-mode; use - todos-mode-external-set. - (todos-filter-items-mode): Derive from special-mode. - (todos-quit): Save archive file if it hasn't yet been saved. - (todos-display-categories): Delegate all functionality to - todos-display-categories-1 and todos-update-categories-display. - (todos-toggle-view-done-items): Improve implementation. - (todos-highlight-item): Require hl-line. - (todos-toggle-display-date-time): Remove argument and make it - apply only to whole file. - (todos-top-priorities, todos-diary-items, todos-regexp-items) - (todos-custom-items): Use todos-special-buffer-name. - (todos-add-file): Use todos-short-file-name and - todos-reevaluate-defcustoms; remove validation, since it's now - done in todos-read-file-name. - (todos-add-category): Also update todos-categories-full if non-nil. - (todos-delete-category): Delete file after confirmation if only - category is deleted. - (todos-move-category): Use todos-short-file-name and - todos-reevaluate-defcustoms. - (todos-insert-item): Fix getting date from the calendar and - insertion of time string. - (todos-set-date-from-calendar): Enter calendar buffer, suppressing - display of diary entries. - (todos-edit-multiline): Add optional argument to restrict editing - buffer to current item, otherwise make entire buffer (i.e. whole - file) editable. - (todos-edit-quit): When whole file is editable, check file format - validity before killing buffer, and if valid, recalculate - categories sexp to be safe. - (todos-edit-item-header): Allow choosing date from calendar. - (todos-item-done): Handle marked items. - -2012-09-19 Stephen Berman - - Changes from 2011-12-03 (revision 109998). - * calendar/todos.el (todos-item-start): Restore commented out code - to prevent wrongly moving point in widened buffer. - -2012-09-19 Stephen Berman - - Changes from 2011-12-02 (revision 109997). - * calendar/todos.el: Remove old commentary from todo-mode.el; add - and revise further doc strings and comments; require cl.el at - compile time for remove-duplicates; use function powerset from - http://rosettacode.org/wiki/Power_set#Common_Lisp (GFDL); further - code rearrangement. Add adapted version of diary-goto-entry as comment. - (todos-file-top, todos-archived-categories-buffer) - (todos-save-top-priorities-too, todos-toggle-item-diary-inclusion) - (todos-save-top-priorities, todos-reset-separator) - (todos-switch-todos-file, todos-item-string-start, todos-counts) - (todos-string-count-lines, todos-string-multiline-p) - (todos-display-categories-alphabetically): Remove. - (todos-insert-item-ask-date, todos-insert-item-ask-date-time) - (todos-insert-item-ask-date-time-for-diary) - (todos-insert-item-ask-date-time-for-diary-here) - (todos-insert-item-ask-date-time-here) - (todos-insert-item-ask-date-maybe-notime) - (todos-insert-item-ask-date-maybe-notime-for-diary) - (todos-insert-item-ask-date-maybe-notime-for-diary-here) - (todos-insert-item-ask-date-maybe-notime-here) - (todos-insert-item-ask-date-for-diary) - (todos-insert-item-ask-date-for-diary-here) - (todos-insert-item-ask-date-here, todos-insert-item-ask-dayname) - (todos-insert-item-ask-dayname-time) - (todos-insert-item-ask-dayname-time-for-diary) - (todos-insert-item-ask-dayname-time-for-diary-here) - (todos-insert-item-ask-dayname-time-here) - (todos-insert-item-ask-dayname-maybe-notime) - (todos-insert-item-ask-dayname-maybe-notime-for-diary) - (todos-insert-item-ask-dayname-maybe-notime-for-diary-here) - (todos-insert-item-ask-dayname-maybe-notime-here) - (todos-insert-item-ask-dayname-for-diary) - (todos-insert-item-ask-dayname-for-diary-here) - (todos-insert-item-ask-dayname-here, todos-insert-item-ask-time) - (todos-insert-item-ask-time-for-diary) - (todos-insert-item-ask-time-for-diary-here) - (todos-insert-item-ask-time-here) - (todos-insert-item-maybe-notime) - (todos-insert-item-maybe-notime-for-diary) - (todos-insert-item-maybe-notime-for-diary-here) - (todos-insert-item-maybe-notime-here) - (todos-insert-item-for-diary, todos-insert-item-for-diary-here) - (todos-insert-item-here): Remove; all of these are now generated - on loading (some with the same name, most with other names.) - (todos-item-counts, todos-display-categories-alphabetically) - (todos-display-categories-sorted-by-todo) - (todos-display-categories-sorted-by-diary) - (todos-display-categories-sorted-by-done) - (todos-display-categories-sorted-by-archived): Comment out. - (todos-comment-string, todos-mode-line-function) - (todos-filter-function, todos-priorities-rules) - (todos-visit-files-commands, todos-categories-totals-label) - (todos-use-only-highlighted-region, todos-diary-nonmarking): - New defcustoms. - (todos-mark, todos-comment): New faces. - (todos-comment-face): Corresponding new variable. - (todos-categories-full, todos-global-current-todos-file) - (todos-first-visit, todos-insertion-commands-args-genlist) - (todos-insertion-commands-args, todos-insertion-commands-names) - (todos-insertion-commands, todos-insertion-commands-arg-key-list) - (todos-top-priorities-widgets, todos-date-from-calendar) - (todos-item-mark, todos-categories-with-marks): New variables. - (todos-mode-line-control, todos-reset-global-current-todos-file) - (todos-gen-arglists, todos-insertion-command-name) - (todos-insertion-key-bindings, todos-unload-hook) - (todos-filter-items, todos-set-date-from-calendar) - (todos-comment-string-matcher, todos-after-find-file) - (todos-reset-nondiary-marker, todos-reset-done-string) - (todos-reset-comment-string, todos-show-current-file) - (todos-item-marked-p, todos-total-item-counts): New functions. - (todos-define-insertion-command): New macro. - (todos-toggle-mark-item, todos-mark-category) - (todos-unmark-category, todos-set-top-priorities) - (todos-merged-diary-items, todos-regexp-items) - (todos-merged-regexp-items, todos-custom-items) - (todos-merged-custom-items, todos-comment-done-item) - (todos-archive-category-done-items, todos-unarchive-items) - (todos-print-to-file): New commands. - (todos-done-separator): Change :set function. - (todos-done-string): Uncomment :initialize and :set functions. - (todos-files): Use file-truename. - (todos-show-current-file): Rename from - todos-auto-switch-todos-file and change :set function accordingly. - (todos-font-lock-keywords): Use todos-comment-string-matcher; - change names of other matcher functions to new *-matcher. - (todos-category-number): Change initial value. - (todos-insertion-map): Use todos-insertion-key-bindings to - generate key definitions. - (todos-mode-map): Don't suppress digit keys, so they can supply - prefix arguments; add new and change some existing bindings. - (todos-archive-mode-map): Change a key binding. - (todos-categories-mode-map): Comment out a key binding. - (todos-filter-items-mode-map): Rename from - todos-top-priorities-mode-map. - (todos-mode): Make todos-current-todos-file, - todos-categories-full, todos-categories, todos-first-visit, - todos-category-number, todos-show-done-only, - todos-categories-with-marks local variables and set them; add - todos-show-current-file to pre-command-hook, todos-after-find-file - to post-command-hook and todos-reset-global-current-todos-file to - kill-buffer-hook. - (todos-archive-mode): Make todos-current-todos-file, - todos-categories and todos-category-number local variables and set - them; add todos-after-find-file to post-command-hook. - (todos-raw-mode): New derived major mode. - (todos-categories-mode): Don't set font-lock-defaults and - buffer-read-only; make todos-current-todos-file and - todos-categories local variables and set them. - (todos-filter-items-mode): Rename from todos-top-priorities-mode-map. - (todos-quit): Don't reset todos-categories on quitting - todos-categories-mode; handle quitting todos-filter-items-mode. - (todos-show): Simplify; when visiting an archive file switch to - corresponding Todos file; use todos-first-visit. - (todos-view-archived-items): Simplify; call todos-category-number. - (todos-show-archive): Rename from todos-switch-to-archive and - adjust callers; simplify. - (todos-toggle-display-date-time): Add optional argument to toggle - display in entire file. - (todos-top-priorities): Use todos-filter-items, which now contains - the previous core of this command. - (todos-merged-top-priorities, todos-diary-items): - Use todos-filter-items. - (todos-forward-category): Add optional argument to go to the - previous category. - (todos-backward-category): Use todos-forward-category. - (todos-jump-to-category): Refine implementation. - (todos-forward-item, todos-backward-item): Fix movement from todo - to done item and vice versa. - (todos-add-file): Remove argument and simplify. - (todos-rename-category): Use todos-current-todos-file and - todos-mode-line-function; set todos-categories with - todos-set-categories. - (todos-delete-category): Ask what to do if category has archived items. - (todos-raise-category): Ensure modified todos-categories is added - to file's categories sexp. - (todos-move-category): Improve implementation, especially handling - of archived categories. - (todos-merge-category): Tweak; set item counts. - (todos-insert-item): Improve handling of various argument values; - add new argument values to control marking of diary items and to - use region for item body. - (todos-insert-item-from-calendar): Use todos-global-current-todos-file. - (todos-delete-item, todos-edit-item-header): Handle marked items. - (todos-edit-item): Incorporate functionality of removed - todos-string-multiline-p. - (todos-edit-multiline): Use set-window-buffer instead of - switch-to-buffer. - (todos-edit-quit): Don't save on quitting; use todos-show instead - of todos-category-select. - (todos-raise-item-priority): Add argument to lower priority; - improve handling of top priority items in todos-filter-items-mode; - restore marks. - (todos-lower-item-priority): Use todos-raise-item-priority. - (todos-set-item-priority): Increment maximum number if item is new. - (todos-move-item): Handle marked items; delay changing category - moved from till after movement to avoid restoring if user cancels - before insertion. - (todos-item-done): Add optional argument to insert comment; fix - item counts and update sexp. - (todos-item-undo): Fix item counts and update. - (todos-archive-done-item-or-items): Rename from - todos-archive-done-items; add optional argument to archive all - items in category; handle marked items. - (todos-unarchive-category): Use todos-unarchive-items. - (todos-toggle-diary-inclusion): Incorporate functionality of - removed todos-toggle-item-diary-inclusion; handle marked items. - (todos-print): Add optional argument to print to file. - (todos-done-string-start): Don't use todos-nondiary-start. - (todos-date-string-matcher, todos-time-string-matcher) - (todos-done-string-matcher, todos-category-string-matcher): Rename - from *-match and adjust callers. - (todos-wrap-and-indent): Use set instead of setq for local variables. - (todos-prefix-overlays): Improve overlay handling. - (todos-reset-categories): Fix and complete implementation. - (todos-toggle-show-current-file): Rename from - todos-toggle-switch-todos-file-noninteractively. - (todos-category-select): Use todos-mode-line-function. - (todos-item-start): Comment out code used by removed function. - (todos-remove-item): Handle presence of both prefix/number and - mark overlays. - (todos-get-count): Simplify. - (todos-set-count): Change argument list and adjust callers; simplify. - (todos-set-categories): Handle new archive files; use - todos-categories-full and todos-ignore-archived-categories. - (todos-truncate-categories-list): Use todos-categories-full. - (todos-update-categories-sexp): Use kill-region instead of - kill-line; use todos-categories-full. - (todos-read-file-name): Add argument to require existing file and - adjust callers; use file-truename. - (todos-read-category): Remove argument to require existing - category and delegate it to completing-read in function body. - (todos-validate-category-name): Make empty string prompt only for - initial category name. - (todos-read-date): Use = instead of eq for testing if month = 13, - and if it is, set monthname to *. - (todos-display-categories): Use todos-global-current-todos-file; - use set-window-buffer instead of switch-to-buffer; add a line - showing item count totals. - (todos-padded-string): Use the longest of category name or label. - (todos-descending-counts): Rename from - todos-descending-counts-store and adjust users. - (todos-insert-category-line): Adjust format; use mapconcat; kill - buffer after jumping to category. - -2012-09-18 Stephen Berman - - Changes from 2011-05-16 (revision 109996). - * calendar/todos.el Add and revise various doc strings, remove - further commented out code; add further comments; further code - rearrangement. - (todos-file-do, todos-archive-file, todos-mode-hook) - (todos-edit-mode-hook, todos-exclusion-start, todos-exclusion-end) - (todos-view-archive, todos-search-string) - (todos-jump-to-category-noninteractively, todos-initial-setup): - Remove. - (todos-files): Remove this defcustom. - (todos-initial-category, todos-display-categories-first) - (todos-auto-switch-todos-file, todos-default-todos-file) - (todos-categories-category-label, todos-categories-todo-label) - (todos-categories-diary-label, todos-categories-done-label) - (todos-categories-archived-label) - (todos-categories-number-separator, todos-categories-align) - (todos-ignore-archived-categories, todos-nondiary-marker): - New defcustoms. - (todos-prefix, todos-done-separator, todos-file-top) - (todos-categories-buffer, todos-archived-categories-buffer) - (todos-edit-buffer, todos-always-add-time-string, todos-button): - Change default value. - (todos-done-string): Add todos-reset-done-string as :set function, - but keep this commented out. - (todos-files, todos-archives, todos-insertion-map) - (todos-category-done, todos-nondiary-start, todos-nondiary-end) - (todos-show-done-only, todos-date-string-start) - (todos-done-string-start): New variables. - (todos-files-directory, todos-files-function, todos-merged-files) - (todos-prompt-merged-files, todos-files, todos-modes-set-1) - (todos-modes-set-2, todos-reset-done-string, todos-reset-categories) - (todos-toggle-switch-todos-file-noninteractively) - (todos-switch-todos-file, todos-counts, todos-get-count) - (todos-set-count, todos-set-categories) - (todos-truncate-categories-list, todos-update-categories-sexp) - (todos-read-file-name, todos-sort, todos-display-sorted) - (todos-label-to-key, todos-insert-sort-button): New functions. - (todos-display-categories-sorted-by-todo) - (todos-display-categories-sorted-by-diary) - (todos-display-categories-sorted-by-done) - (todos-display-categories-sorted-by-archived) - (todos-update-merged-files, todos-switch-to-archive) - (todos-choose-archive, todos-merged-top-priorities) - (todos-jump-to-category-other-file, todos-clear-matches) - (todos-add-file, todos-change-default-file, todos-move-category) - (todos-merge-category, todos-merge-categories) - (todos-edit-item-time, todos-move-item-to-file) - (todos-unarchive-category, todos-toggle-item-diary-nonmarking) - (todos-toggle-diary-nonmarking): New commands. - (todos-toggle-show-done-only): New command replacing todos-view-archive. - (todos-faces): New defgroup; use in all face definitions. - (todos-sorted-column, todos-archived-only, todos-search): New faces. - (todos-font-lock-keywords): Use subexpression 1 with matcher - todos-category-string-match. - (todos-mode-map, todos-archive-mode-map, todos-edit-mode-map) - (todos-categories-mode-map): Add new key bindings; change some - existing bindings. - (todos-top-priorities-mode-map): New keymap. - (todos-menu): Add submenues and new entries. - (auto-mode-alist): Add extension of Todos and Todos archive files. - (todos-mode, todos-archive-mode): Make derived mode; use - todos-modes-set-1, todos-modes-set-2, todos-auto-switch-todos-file - and todos-switch-todos-file; make todos-show-done-only local - variable. - (todos-edit-mode): Make derived mode; use todos-modes-set-1. - (todos-categories-mode): Make derived mode. - (todos-top-priorities-mode): New derived major mode. - (todos-save): Remove unused code. - (todos-quit): Handle todos-categories-mode; save archive buffer. - (todos-show): Add optional argument to prompt for a Todos file; if - called interactively or with prefix arg or from an archive, don't - make a no-op but reset todos-current-todos-file, todos-categories - and todos-category-number; use todos-read-file-name, - todos-display-categories-first, todos-ignore-archived-categories. - (todos-display-categories): Change argument name; refactor code - for inserting table labels and lines, using - todos-ignore-archived-categories, todos-sort, - todos-categories-number-separator, todos-insert-sort-button, - todos-categories-*-labels, and todos-insert-category-line. - (todos-display-categories-alphabetically): Use todos-display-sorted. - (todos-toggle-view-done-items): Use todos-done-string-start and - todos-get-count. - (todos-toggle-display-date-time): Use todos-done-string-start. - (todos-top-priorities): Remove autoload cookie; partially rewrite: - new argument list; allow combining top priorities of multiple - Todos files; change display to include category (and file) name as - part of item header; use todos-top-priorities-mode. - (todos-diary-items): Reimplement using only todos-top-priorities. - (todos-forward-category, todos-backward-category): Adjust to - 1-based numbering of categories; move point to top of category. - (todos-jump-to-category): Rewrite, adding optional arguments to - provide a category in non-interactive uses and to prompt for which - Todos file to jump to. - (todos-search): Reimplement; highlight each match as found, say - how many matches remain and prompt whether to go to next one; at - end of search prompt whether to remove highlighting. - (todos-add-category): Remove autoload cookie; assign new category - the highest category number; associate zero-initialized vector of - item counts, instead of property list, with new category; use - todos-validate-category-name and todos-update-categories-sexp. - (todos-rename-category): Use todos-validate-category-name and - todos-update-categories-sexp; take archive files into account. - (todos-delete-category): Use todos-get-count and - todos-update-categories-sexp, let-bind variable that were - mistakenly global; use delete-region instead of kill-region; - adjust to 1-based numbering of categories; move point to top of - category. - (todos-raise-category): Handle item count vectors; use - todos-insert-category-line and todos-update-categories-sexp. - (todos-insert-item): Use nil time-string argument to omit time - string; use todos-nondiary-start and todos-nondiary-end and - todos-update-categories-sexp; if category named to insert into - does not exist, add it; take new diary items into account. - (todos-insert-item-ask-date, todos-insert-item-ask-date-time) - (todos-insert-item-ask-date-time-for-diary) - (todos-insert-item-ask-date-time-for-diary-here) - (todos-insert-item-ask-date-time-here) - (todos-insert-item-ask-date-maybe-notime) - (todos-insert-item-ask-date-maybe-notime-for-diary) - (todos-insert-item-ask-date-maybe-notime-for-diary-here) - (todos-insert-item-ask-date-maybe-notime-here) - (todos-insert-item-ask-date-for-diary) - (todos-insert-item-ask-date-for-diary-here) - (todos-insert-item-ask-date-here, todos-insert-item-ask-dayname) - (todos-insert-item-ask-dayname-time) - (todos-insert-item-ask-dayname-time-for-diary) - (todos-insert-item-ask-dayname-time-for-diary-here) - (todos-insert-item-ask-dayname-time-here) - (todos-insert-item-ask-dayname-maybe-notime) - (todos-insert-item-ask-dayname-maybe-notime-for-diary) - (todos-insert-item-ask-dayname-maybe-notime-for-diary-here) - (todos-insert-item-ask-dayname-maybe-notime-here) - (todos-insert-item-ask-dayname-for-diary) - (todos-insert-item-ask-dayname-for-diary-here) - (todos-insert-item-ask-dayname-here, todos-insert-item-ask-time) - (todos-insert-item-ask-time-for-diary) - (todos-insert-item-ask-time-for-diary-here) - (todos-insert-item-ask-time-here) - (todos-insert-item-maybe-notime) - (todos-insert-item-maybe-notime-for-diary) - (todos-insert-item-maybe-notime-for-diary-here) - (todos-insert-item-maybe-notime-here) - (todos-insert-item-for-diary, todos-insert-item-for-diary-here): - New insertion commands. - (todos-insert-item-from-calendar): Use todos-current-todos-file. - (todos-delete-item): Handle diary items; - use todos-update-categories-sexp. - (todos-edit-item): Check if point is with item string; - use read-string instead of read-from-minibuffer; - use todos-date-string-start; after editing put point at start of - item text. - (todos-edit-multiline): Narrow to item before invoking - todos-edit-mode; show key binding of todos-edit-quit in a message. - (todos-edit-quit): Use todos-save; kill buffer. - (todos-edit-item-header): Add optional argument to prompt for - editing only date string or only time string; - use todos-date-string-start. - (todos-edit-item-date, todos-edit-item-date-is-today) - (todos-raise-item-priority, todos-lower-item-priority): Rename - from todos-{raise, lower}-item and make them DTRT in - todos-top-priorities-mode. - (todos-set-item-priority): Make interactive; use todos-get-count - and todos-insert-with-overlays; interactively, just relocate the - item within its category. - (todos-move-item): Add optional argument to prompt for a category - in another Todos file; handle diary items; fix restoration after - cancelling before inserting. - (todos-item-done): Handle diary items; simplify handling of - insertion in done items section. - (todos-item-undo): Handle diary items. - (todos-archive-done-items): Adjust to new handling of archive - files (in parallel with Todos files); handle diary items; use - todos-done-string-start. - (todos-toggle-item-diary-inclusion): Use todos-nondiary-start, - todos-nondiary-end and todos-item-counts. - (todos-toggle-diary-inclusion): Use todos-category-done instead of - todos-category-end. - (todos-print): Remove autoload cookie; rewrite to make overlays, - line wrapping and wrap prefixes printable. - (todos-date-pattern): Make parenthesized groups shy. - (todos-date-string-match): Use todos-date-string-start; make - todos-date-pattern an explicitly numbered group. - (todos-time-string-match): Use todos-date-string-start. - (todos-done-string-match): Use todos-done-string-start. - (todos-category-string-match): Rewrite to match new category and - category+filename patterns in todos-top-priorities-mode. - (todos-prefix-overlays): Use todos-done-string-start and - todos-category-done. - (todos-reset-prefix): Handle archive files; restore point after - changing prefix. - (todos-reset-separator): Handle archive files. - (todos-category-number): Make category number one more than its - list index. - (todos-current-category): Adjust to 1-based numbering of categories. - (todos-category-select): Simplify handling of done items and done - separator string overlay. - (todos-item-start): Use todos-date-string-start and - todos-done-string-start. - (todos-item-start, todos-item-end): Fix wrong parenthesizing. - (todos-item-string): Restore point after getting item bounds; use - buffer-substring-no-properties. - (todos-done-item-p): Use todos-done-string-start. - (todos-make-categories-list): Add optional argument to force - looping through file to get categories and their item counts, - otherwise set todos-categories from sexp in first line; use - vectors of item counts instead of plists; count diary items. - (todos-item-counts): Use todos-counts, todos-set-counts, - todos-get-counts, and todos-update-categories-sexp instead of - getting and setting properties; handle diary items. - (todos-read-category): Add argument to set prompt; don't offer - default category. - (todos-validate-category-name): Rename from - todos-check-category-name; take into account whether there are - already categories or not. - (todos-read-date): Accept `*' as an unspecified month, day, or year. - (todos-padded-string): Accommodate new structure of - todos-categories as alists; use todos-categories-align. - (todos-descending-counts-store): New variable. - (todos-insert-category-line): Rename from - todos-insert-category-name and reimplement using labels and - todos-get-counts instead of properties; use - todos-ignore-archived-categories; highlight sorted column. - -2012-09-14 Stephen Berman - - Changes from 2010-07-09 (revision 109995). - * calendar/todos.el Remove lots of commented out code; add various - comments; further code rearrangement. - (todos-insert-item-here-ask-date-time) - (todos-insert-item-ask-date-time) - (todos-insert-item-ask-dayname-time) - (todos-insert-item-for-diary) - (todos-insert-item-for-diary-ask-date-time) - (todos-make-categories-alist, todos-categories-alist): Remove. - (todos-categories-list): Comment out. - (todos-make-categories-list): New function replacing - todos-make-categories-alist, using category plists to get item - counts and taking archive into account. - (todos-current-todos-file): New variable. - (todos-mode-map): Update key bindings. - (todos-save): Add as comment code to make sure todos-categories - sexp is current on saving. - (todos-quit): Call todos-show on quitting Todos archive buffer. - (todos-show): If todos-current-todos-file is not set to Todos - file, set it as a new file; set todos-categories from - todos-make-categories-alist. - (todos-display-categories): Use a different display format for - archive file; put point initially on the first button. - (todos-toggle-view-done-items): Check the category's `done' - property to determine if there are done items. - (todos-view-archive): Set todos-current-todos-file to the archive - file; jump from the Todos file to the same category in the - archive, if it exists, else jump to the first category; use - message instead of error. - (todos-add-category): Intern a special symbol for the new category - and set its property list to holds counts of the numbers of todo, - done and archived items in the category; assign the new category - the current highest category number. - (todos-rename-category): Don't use todos-categories-alist. - (todos-delete-category): Check the category's `todo' and `done' - properties to determine if it is empty; ensure that the end of the - last category is found; after deleting the category, empty its - plist and unintern its special symbol. - (todos-insert-item-here): Fix argument list of todos-insert-item. - (todos-delete-item, todos-raise-item, todos-lower-item): - Use message instead of error. - (todos-move-item): If the category to be moved to does not exist, - add it as a new category. - (todos-item-done, todos-reset-separator): - Use todos-category-select instead of todos-show. - (todos-archive-done-items): Make buffer writeable; conditionalize - search for end of category; save after adding to archive in case - the file is new, so it can be found. - (todos-category-select): Wrap search in if instead of or+and; - don't hide done items in an archive. - (todos-set-item-priority): Check the category's `todo' - property to determine if there are not done todo items. - (todos-jump-to-category-noninteractively): Just switch to buffer - visiting todos-current-todos-file, since this can be either a - Todos file or an archive. - (todos-item-counts): Use category's plist instead of an alist. - (todos-longest-category-name-length): Argument is now a list of - category names, not an alist, so just test each element, not each - element's the car. - (todos-padded-string): Use todos-categories instead of - todos-categories-alist. - (todos-insert-category-name): Use category plist to get item - counts; take archived items into account. - -2012-09-13 Stephen Berman - - Changes from 2010-06-18 (revision 109994). - * calendar/todos.el: Numerous spelling and comment fixes, doc - string fixes to conform with checkdoc, further rearrangement of - definitions, etc. - (todos-previous-line, todos-previous-answer) - (todos-insert-item-ask-date, todos-change-date) - (todos-date-nodayname-pattern, todos-dayname-date-pattern) - (todos-count-items-in-category, todos-count-all-items): Remove. - (todos-update-numbered-prefix, todos-item-start-overlays) - (todos-add-item-non-interactively): Comment out, also in uses. - (todos-done-separator): Change default value. - (todos-always-add-time-string): Rename from todos-add-time-string - and adjust uses. - (todos-read-category): Rename from todos-completing-read and - adjust callers; use todos-current-category. - (todos-make-categories-alist): Rename from function - todos-categories-alist. - (todos-categories-alist): New variable. - (todos-indent-to-here): New defcustom. - (todos-button): New face. - (todos-display-categories-alphabetically, todos-raise-category) - (todos-lower-category, todos-insert-item-for-diary-ask-date-time) - (todos-insert-item-here-ask-date-time) - (todos-insert-item-ask-date-time) - (todos-insert-item-ask-dayname-time): New commands. - (todos-edit-item-header): New command replacing todos-change-date. - (todos-category-number, todos-indent, todos-item-counts) - (todos-check-category-name, todos-read-date, todos-read-dayname) - (todos-read-time, todos-padded-string) - (todos-insert-category-name): New functions. - (todos-set-item-priority): New function replacing - todos-add-item-non-interactively. - (todos-mode-map): Remap newline to newline-and-indent. - (todos-edit-mode-map): Make sparse keymap; remap newline to - newline-and-indent. - (todos-categories-mode-map): New keymap. - (todos-mode, todos-edit-mode): Make indent-line-function local - variable and set to todos-indent. - (todos-categories-mode): New major mode. - (todos-display-categories): List categories initially in their - numerical order; add optional argument to switch to alphabetical - listing. - (todos-toggle-view-done-items): Simplify implementation. - (todos-toggle-display-date-time): Fix regexp search string. - (todos-backward-item, todos-forward-item): Use variable - todos-item-start. - (todos-add-category): Use todos-check-category-name and - todos-categories-alist. - (todos-rename-category): Use todos-current-category, - todos-check-category-name and todos-categories-alist. - (todos-delete-category): Use todos-check-category-name and - todos-categories-alist and take done items into account. - (todos-insert-item): Use separate arguments to handle insertion of - date/dayname and time strings, add new argument to mark item for - diary inclusion, use new todos-read-* functions, - todos-set-item-priority and todos-item-counts. - (todos-insert-item-here, todos-insert-item-for-diary) - (todos-insert-item-from-calendar): Adapt to new version of - todos-insert-item. - (todos-delete-item, todos-item-done): Use todos-item-counts. - (todos-edit-item): Indent newlines inserted by C-q C-j if nonspace - char follows. - (todos-lower-item): Ensure only not-done items can be lowered. - (todos-move-item): Use todos-current-category, todos-read-category - and todos-item-counts. - (todos-archive-done-items): Use todos-current-category and - todos-item-counts; fix regexp search string. - (todos-item-undo): Use todos-current-category, - todos-set-item-priority, todos-insert-with-overlays and - todos-item-counts; restore if user quits before inserting undone - item. - (todos-date-pattern): Rewrite without using - todos-date-nodayname-pattern and todos-dayname-date-pattern. - (todos-date-string-match): Do not make todos-date-pattern an - unnumbered group. - (todos-time-string-match): Make todos-date-pattern a shy group. - (todos-wrap-and-indent): Use todos-indent-to-here. - (todos-reset-prefix): Revert to using todos-show instead of - todos-category-select. - (todos-prefix-overlays): Fix numbering of done items and updating - of prefix. - (todos-category-select): Use todos-current-category; fix display - of separator string; don't move point to top of category. - (todos-jump-to-category-noninteractively): Use todos-category-number. - (todos-insert-with-overlays): Use todos-item-start unconditionally. - (todos-item-start): New variable. - (todos-item-start): Use it to define this function. - (todos-item-end): Adjust if item is last unfinished one before - displayed done items. - (todos-remove-item): Use todos-item-start and todos-item-end - instead of todos-forward-item and todos-backward-item. - (todos-longest-category-name-length): Add argument for list of - categories. - -2012-09-13 Stephen Berman - - Changes from 2010-05-25 (revision 109993). - * calendar/todos.el: Comment out calendar require, since diary-lib - requires calendar. Rearrange file to group definitions according - to their use (types of commands, internal functions, etc.) - (todos-file-done, todos-insert-threshold, todos-remove-separator) - (todos-date-string, todos-time-string, todos-check-overlay) - (todos-show-paren-hack, todos-file-item, todos-more-important-p): - Comment out. - (todos-current-date, todos-item-end-overlays) - (todos-list-categories): Remove. - (todos-item-end): Remove (the variable, not the function). - (todos-prefix-overlays): Rename from todos-item-overlays and adjust - callers. - (todos-done-separator, todos-done-string, todos-show-with-done) - (todos-files, todos-archive-file, todos-categories-buffer) - (todos-archived-categories-buffer, todos-wrap-lines) - (todos-line-wrapping-function): New defcustoms. - (todos-done, todos-done-sep): New faces. - (todos-done-face, todos-done-sep-face): Corresponding new variables. - (todos-search-string, todos-date-nodayname-pattern) - (todos-dayname-date-pattern, todos-date-pattern): New variables. - (todos-done-string-match, todos-category-string-match) - (todos-check-format, todos-wrap-and-indent, todos-reset-separator) - (todos-current-category, todos-count-items-in-category) - (todos-done-item-p, todos-categories-alist, todos-count-all-items) - (todos-longest-category-name-length): New functions. - (todos-categories-list): New buffer-specific function replacing - todos-list-categories. - (todos-toggle-item-numbering, todos-toggle-view-done-items) - (todos-search, todos-view-archive, todos-diary-items) - (todos-toggle-display-date-time, todos-insert-item-no-time) - (todos-insert-item-ask-date, todos-insert-item-for-diary) - (todos-insert-item-from-calendar, todos-edit-quit) - (todos-change-date, todos-item-done, todos-archive-done-items) - (todos-item-undo): New commands. - (todos-archive-mode): New major mode. - (todos-archive-mode-map, todos-edit-mode-map): New keymaps. - (todos-category-beg): Change value. - (todos-number-prefix): Change default value. - (todos-edit-buffer): Change from defvar to defcustom. - (todos-font-lock-keywords): Use todos-done-string-match and - todos-category-string-match. - (todos-backward-item, todos-forward-item): Use todos-done-string - and todos-date-pattern. - (todos-display-categories): Reimplement using buttons from - button.el instead of widgets. - (todos-top-priorities): Use with-current-buffer; take done items - into account; ensure buffers gets fontified. - (todos-add-category): Ensure new category does not begin with - empty lines. - (todos-jump-to-category): Use todos-category-select instead of - todos-show. - (todos-rename-category): Prompt for new name in body instead of in - interactive spec. - (todos-insert-item): Don't insert in done items section of - category. Add two optional arguments to control insertion: (i) to - insert near point without prompting for priority; (ii) to use - defaults for date and time strings, to prompt for these, or to - choose date from the Calendar. - (todos-insert-item-here): Reimplement using todos-insert-item. - (todos-delete-item): Don't move point after deleting last item. - (todos-raise-item, todos-lower-item): Take done items into account. - (todos-move-item): Don't move done items; update item numbering; - restore if user quits before inserting moved item. - (todos-print): Prompt for confirmation to print. - (todos-reset-prefix): Search backward from end of file instead of - forward from top. - (todos-jump-to-category-noninteractively): Take Todos archive into - account. - (todos-category-select): Show or hide done items according to - todos-show-with-done; if shown, coordinate separator and prefix - overlays. - (todos-add-item-non-interactively): Replace binary insertion - algorithm with prompting for numerical priority. - (todos-insert-with-overlays): Remove use of variable todos-item-end. - (todos-item-start): Take done items into account; use - todos-date-pattern. - (todos-item-end): Reimplement using todos-forward-item. - (todos-remove-item): Reimplement using todos-forward-item and - todos-backward-item; redo overlay handling. - (todos-mode-map): Add some new key bindings and change numerous - existing bindings; use "i" as prefix key for item insertion - commands. - (todos-mode): Use todos-wrap-lines and delegate word-wrap and - wrap-prefix settings to todos-wrap-and-indent; add to invisibility - spec; set buffer-read-only to t and consequently let-bind this - variable in all Todos commands that change buffer content. - (todos-edit-mode): Make an indepent mode, not derived from text-mode. - (todos-save): Don't save top priorities buffer. - (todos-show): Make a no-op if called interactively in narrowed - Todos mode, since, also to work around item prefix reduplication - bug with show-paren-mode enabled; use todos-categories-list. - -2012-09-12 Stephen Berman - - Changes from 2009-11-07 (revision 109992). - * calendar/todos.el: Comment out time-stamp require; require - calendar and diary-lib. - (todos-prefix): Change default value and doc string to reflect new - meaning; add :initialize and :set functions. - (todos-time-string-format, todos-entry-prefix-function) - (todos-initials, todos-entry-timestamp-initials) - (todos-prefix-face, todos-category-sep, todos-category-end) - (todos-cp): Comment out. - (todos-prefix-string): Inherit from font-lock-comment-face. - (todos-item-header, todos-item-header-face): Remove. - (todos-date, todos-time): New faces. - (todos-date-face, todos-time-face): Corresponding new variables. - (todos-add-time-string, todos-include-in-diary) - (todos-exclusion-start, todos-exclusion-end, todos-number-prefix): - New defcustoms. - (todos-item-end, todos-item-start-overlays) - (todos-item-end-overlays): New variables. - (todos-date-string-match, todos-time-string-match): New functions. - (todos-font-lock-keywords): Use them. - (todos-current-date, todos-date-string, todos-time-string) - (todos-toggle-item-diary-inclusion, todos-toggle-diary-inclusion) - (todos-reset-prefix, todos-update-numbered-prefix) - (todos-check-overlay, todos-item-overlays) - (todos-insert-with-overlays, todos-show-paren-hack): New functions. - (todos-highlight-item): New command. - (todos-category-beg): Change value. - (todos-category-select): Use todos-category-beg and todos-item-overlays. - (todos-backward-item): Add optional count argument; use it and - todos-item-start. - (todos-forward-item): Use todos-check-overlay, todos-item-start - and variable todos-item-end. - (todos-edit-item, todos-delete-item): Use todos-number-prefix, - todos-update-numbered-prefix, todos-item-overlays. - (todos-add-category, todos-rename-category) - (todos-list-categories): Use new category format. - (todos-delete-category): Allow deleting non-empty category; - use new category format. - (todos-add-item-non-interactively): Comment out unnecessary - save-excursion; use todos-insert-with-overlays. - (todos-insert-item): Comment out unnecessary save-excursion; use - new item format for date/time header and diary inclusion marking. - (todos-insert-item-here): Use new item format for date/time header - and diary inclusion marking; use todos-insert-with-overlays. - (todos-raise-item): Make a no-op if point is on an empty line; use - todos-insert-with-overlays. - (todos-lower-item): Use todos-insert-with-overlays. - (todos-top-priorities): Move call to todos-show inside - save-excursion; add save-current-buffer after save-restriction. - (todos-item-start): Use variable todos-item-end. - (todos-item-end): Use todos-check-overlay and variable todos-item-end. - (todos-remove-item): Take item overlays into account. - (todos-mode): Change calculation of wrap-prefix; make - hl-line-range-function a local variable and set it to highlight - todo item. - (todos-show): Ensure point stays at top of category. - -2012-09-12 Stephen Berman - - Changes from 2009-07-04 (revision 109991). - * calendar/todos.el (todos-window-configuration): Comment out. - (todos-display-categories): Comment out use of - todos-window-configuration; use switch-to-buffer instead of - pop-to-buffer. - (todos-jump-to-category-noninteractively): Comment out use of - todos-window-configuration. - (todos-edit-item): Don't allow editing of date/time item header. - (todos-insert-item, todos-insert-item-here): Insert date/time - header in front of new item string. - (todos-mode): Tweak wrap-prefix. - -2012-09-12 Stephen Berman - - Changes from 2009-06-26 (revision 109989). - * calendar/todos.el (todos-file-do, todos-file-done): - Change default location to directory "~/.emacs.d/". - (todos-completion-ignore-case, todos-categories-buffer): - New defcustoms. - (todos-prefix-string, todos-item-header): New faces. - (todos-prefix-face, todos-item-header-face): Corresponding - new variables. - (todos-rename-category, todos-delete-category) - (todos-display-categories, todos-move-item): New commands. - (todos-mode-map): Add key bindings for new commands and for - todos-add-category, which had no key binding. - (todos-jump-to-category-noninteractively): New function. - (todos-top-priorities): Comment out code using a previously - deleted variable. - (todos-completing-read): Allow SPC to insert a space when entering - a new category name; use todos-completion-ignore-case. - (todos-font-lock-keywords, todos-window-configuration): - New variables. - (todos-mode): Make mode-name "TODOS"; make font-lock-defaults, - word-wrap, and wrap-prefix local variables. - -2012-09-12 Stephen Berman - - Changes from 2009-02-16 (revision 109988). - * calendar/todos.el (todos-list-categories): Fix typos. - (todos-show): Ensure file is in todos-mode. - -2012-09-12 Stephen Berman - - Changes from 2009-02-12 (revision 109987). - * calendar/todos.el (todos-header): Remove defvar. - (todos-add-category): Comment out code that inserts and updates - the file local variables first line of the file todos-file-do. - (todos-list-categories): New function. - (todos-show): Use it; remove use of a previously deleted variable. - -2012-09-11 Stephen Berman - - Changes from 2009-02-12 (revision 109986). - * calendar/todos.el: New file. This is a copy of todo-mode.el - from revision 94343 except for the following changes: replace all - occurrences of the namespace prefix "todo-" with "todos-", delete - the defvar todo-cats (the old name of todo-categories) and its use - in todos-add-category, delete all defaliases of old command names. - 2012-09-11 Bastien Guerry * subr.el (set-temporary-overlay-map): Add a docstring. diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog new file mode 100644 index 00000000000..d4d06352131 --- /dev/null +++ b/lisp/calendar/ChangeLog @@ -0,0 +1,1859 @@ +2013-04-19 Stephen Berman + + * todos.el: Extend and improve item filtering and handling of + saved files of filtered items. + (todos-show-first): Add choices for diary and regexp items. + (todos-absolute-file-name): Handle file names for diary and regexp + items. + (todos-filter-items): New function abstracted from item filtering + commands, with handling of saved files of diary and regexp items. + (todos-filter-items-1): Rename from todos-filter-items. + (todos-filtered-buffer-name): Remove, since functionality is now + incorporated into new function todos-filter-items. + (todos-filtered-items-buffer, todos-top-priorities-buffer) + (todos-diary-items-buffer, todos-regexp-items-buffer): + Make defconsts instead of defcustoms. + (todos-find-item): Restrict calculation and comparison of + priorities to top priority items, in order to handle diary and + regexp items. + (todos-check-filtered-items-file): Rename from + todos-check-top-priorities and adjust message and callers. + (todos-filter-items-filename): Rename from + todos-top-priorities-filename, adjusting caller and extending to + files of filtered diary and regexp items. + (todos-save-filtered-items-buffer): Rename from + todos-save-top-priorities-buffer and adjust caller and uses. Use + write-file instead of write-region and use existing file name if + previously saved. + (todos-show): Handle initially displaying saved file of filtered + diary or regexp items. + (todos-top-priorities, todos-top-priorities-multifile) + (todos-diary-items, todos-diary-items-multifile) + (todos-regexp-items, todos-regexp-items-multifile): Use new + function todos-filter-items. + (auto-mode-alist): Extend regexp for files assigned to + todos-filtered-items-mode to handle saved diary and regexp items. + +2013-03-17 Stephen Berman + + * calendar/todos.el (todos-insert-item): Fix mistake in logic of + here insertion from last change, and ensure category is set when + command is called from outside Todos buffer. + +2013-03-15 Stephen Berman + + * calendar/todos.el: Item unarchiving fixes and improvements. + (todos-archive-mode-map): Add bindings for item and category + marking/unmarking; make todos-display-categories binding same as + in Todos mode; remove todos-unarchive-category binding. + (todos-unarchive-category): Remove. + (todos-unarchive-items): Fix handling of marked items. Remove + code for unarchiving whole category, since that is covered by + unarchiving marked items. Handle unarchiving items to a category + that had been deleted from the todo file by re-adding the + category. Use todos-category-select to display restored items, + not todos-show. Remove obsolete or superfluous code. + +2013-03-15 Stephen Berman + + * calendar/todos.el (todos-reset-prefix): Don't remove overlays, + since it's superfluous and also wrongly removes items marks. + (todos-category-completions): Select current category on visiting + file, to ensure category is properly displayed if user switches to + file via a non-Todos command. + (todos-mark-category): Make implementation cleaner. + (todos-unmark-category): Improve implementation. Get overlay + property only when there is an overlay. + +2013-03-14 Stephen Berman + + * calendar/todos.el (todos-insert-item): Fix last change to make + sure calling insertion "here" from outside goal todo items section + gives new item top priority. With priority insertion, if user + cancels before setting priority, restore display. + (todos-find-item): Restore narrowing after searching. + (todos-item-done): Allow adding (same) comment to marked items. + Don't add empty comment to done item. + +2013-03-13 Stephen Berman + + * calendar/todos.el (todos-quit): If quitting + todos-filtered-items-mode makes todos-mode current, don't call + todos-show, which (here wrongly) prompts for a new Todos file. + (todos-delete-category): Fix incorrect quotation mark. + (todos-set-item-priority): Make prefix argument a no-op with + commands for raising or lowering item priority. Move mistakenly + placed right paren to end of defun, where it belongs. + +2013-02-25 Stephen Berman + + * calendar/todos.el (todos-key-bindings): Add binding for `todos-show'. + (todos-show): Prompt for which todo file to visit when invoked + from Todos mode. + +2013-02-19 Stephen Berman + + * calendar/todos.el: Item insertion and done/undo fixes. + (todos-insert-item): Maybe set the insertion file to + todos-global-current-todos-file. When inserting into a file that + was not being visited on invoking this command, ensure chosen + category is properly selected. Make item inserted "here" the + first todo item if the command was invoked with point in done + items section or outside of the current category. + (todos-item-done): When done items are shown, put cursor on first + just done item. + (todos-item-undo): Put cursor on undone item. + +2013-02-16 Stephen Berman + + * calendar/todos.el: Improve handling of overlays. + (todos-get-overlay): New function. + (todos-prefix-overlay): Remove, since subsumed by + todos-get-overlay, and replace by the latter in callers. + (todos-reset-prefix): Apply only to buffer visiting Todos files. + Simplify implementation and use `todos' overlay property. + (todos-reset-done-separator): Use todos-get-overlay and `todos' + overlay property. Fix logic. + (todos-category-select): Use todos-get-overlay and `todos' overlay + property. + (todos-remove-item): Use todos-get-overlay. Correct obsolete code. + (todos-prefix-overlays): Use todos-top-priority face also for + non-numerical prefix of top priority items. Add `todos' overlay + property. + (todos-hide-show-date-time): Simplify, using todos-get-overlay and + `todos' overlay property. + +2013-02-14 Stephen Berman + + * calendar/todos.el (todos-edit-multiline, todos-edit-quit): + Revert buffer renaming. + +2013-02-11 Stephen Berman + + * calendar/todos.el (todos-edit-quit): On quitting file editing, + rename buffer back to current Todos file. After selecting + category, put point at top instead of recentering. + +2013-02-08 Stephen Berman + + * calendar/todos.el (todos-edit-multiline-item): Revert to using + indirect buffer, which makes it easier to return to Todos mode. + (todos-edit-quit): Don't delete and reinsert items that don't need + indenting. Revert to just killing buffer on quitting single item + editing. On quitting file editing, select nearest category. + +2013-02-07 Stephen Berman + + * calendar/todos.el: Bug fixes and improvements to item editing + and insertion. + (todos-check-format): Compare current value of todos-categories + with actual categories sexp. + (todos-repair-categories-sexp): Add warning to doc string about + category order getting restored to list element order. + (todos-mode-external-set): When todos-categories is nil, as in + Todos Edit mode, set it by reading actual categories sexp. + (todos-edit-mode): Make buffer writeable. + (todos-done-item-section-p): New function. + (todos-insert-item): Use it as part of preventing insertion here + in done items section. Move check for display of done items only + to just before setting new item's priority, and if cancelled after + toggling to todo items, restore display of done items. + (todos-edit-multiline-item): Don't base on todos-edit-multiline + but just narrow and change mode. + (todos-edit-multiline): Don't make indirect buffer but just widen + and change mode; also remove overlays. + (todos-edit-quit): Restore Todos mode and category display; when + quitting multiline item editing, ensure items above edited item + are visible in window if possible. + (todos-done-item-add-edit-or-delete-comment): If user moved point + during editing, make sure it moves back to edited item before + returning. + +2013-02-05 Stephen Berman + + * calendar/todos.el (todos-reset-done-separator-string): + Complete the implementation. + (todos-hide-show-done-items): If start of done items sections is + below the bottom of the window, make it visible. + (todos-insert-item): Allow inserting item here to work outside of + the current category, but then at top of category. After checking + whether only done items are shown, restore point to ensure + inserting item here works correctly. + (todos-set-item-priority): Delete leftover right paren at end. + +2013-02-04 Stephen Berman + + * calendar/todos.el: Bug fixes involving or displaying done items. + (todos-done-separator): Make length of long separator one less + than window-width, in order to avoid following empty line. + (todos-forward-item, todos-backward-item): Make empty line below + last todo item accessible only by invoking without a numerical + prefix argument and make the latter invocations move only to items. + (todos-insert-item): Set todos-current-todos-file after selecting + buffer, in order not to set global value. If only done items are + shown when this command is invoked, toggle to show todo items to + avoid insertion into done items section. When done items are + shown, protect from cancelling before setting item priority: this + also needs recentering to display all items. + (todos-set-item-priority): Only call on (not done) todo items. + Check that done items are visible not because file is widened. + Use only `any' argument of called-interactively-p. Make sure that + giving an undone item lowest priority restores it to the todo + section. + (todos-item-done): If done items are visible on invoking this + command, keep them visible afterwards. Stop looking for marked + items on reaching the empty line below the last todo item. + +2013-02-02 Stephen Berman + + * calendar/todos.el: Several small fixes and improvements. + (todos-done-separator-string): Change default value. + (todos-update-categories-sexp): Remove unnecessary and misquided + setq of todos-default-todos-file. Use delete-region instead of + kill-region to avoid polluting kill-ring. + (todos-unload-hook): Remove (was not used). + (todos-edit-multiline): Don't generate new edit buffer name on + each invocation---that can cause confusion due to indirect buffer. + (todos-edit-quit): Ensure lines in edit buffer that follow hard + newlines are indented in the file to conform to diary format. + (todos-set-item-priority): If done items in category are visible, + keep them visible. + +2013-01-30 Stephen Berman + + * calendar/todos.el: Fix done separator overlay bug. Remove most + FIXME comments. + (todos-reset-and-enable-done-separator): Remove commented out + workaround for done separator overlay bug; fix doc string. + (todos-reset-done-separator): Delete old overlay after adding new + overlay to fix done separator overlay bug; improve implementation. + (todos-prefix-overlays): Improve first line of doc string. + +2013-01-29 Stephen Berman + + * calendar/todos.el: Improve item marking and handling of marked items. + (todos-prefix): Add validator to ensure value differs from that of + todos-item-mark. + (todos-item-mark): New defcustom. + (todos-prefix-overlay): New function. + (todos-marked-item-p): Use it. Adapt implementation to new + handling of marked items. + (todos-insert-with-overlays): When inserting pushes down a marked + item, move its prefix overlay. + (todos-prefix-overlays): Add overlay even when prefix is empty string, + otherwise item marking fails. Improve handling of marked items. + (todos-mark-unmark-item): Adapt to new handling of marked items + and simplify by removing marking of all items in category. + (todos-mark-category): Adapt to new handling of marked items and + don't use todos-mark-unmark-item. + (todos-unmark-category): Adapt to new handling of marked items. + (todos-delete-item): Remove obsolete handling of marked items and + useless restoration of point. + (todos-set-item-priority): Use new handling of marked items. + (todos-move-item, todos-item-done, todos-item-undo) + (todos-archive-done-item): Remove obsolete handling of marked items. + +2013-01-25 Stephen Berman + + * calendar/todos.el: Improve definitions and use of some faces. + (todos-top-priority): Use current definition of font-lock-constant-face. + (todos-diary-expired): Make default value contrast more with + default value of todos-date face. + (todos-nondiary, todos-category-string): New faces. + (todos-nondiary-face, todos-category-string-face): Corresponding + new variables. + (todos-done, todos-comment): Switch default values to go better + with default value of todos-date face. + (todos-done-sep): Change default value. + (todos-category-string-matcher-1) + (todos-category-string-matcher-2): Improve doc string. + (todos-font-lock-keywords): Use todos-nondiary-face and + todos-category-string-face. + (todos-done-separator): Propertize string with todos-done-sep face. + (todos-filtered-items-mode): Fix typo. + +2013-01-23 Stephen Berman + + * calendar/todos.el: Improve handling of saved top priorities items. + (todos-find-item): Find done items and items whose priority has + changed or whose text was truncated or augmented; add doc string. + (todos-check-top-priorities): Highlight each item that is not up + to date. + (todos-jump-to-item): Jump to items whose priority has changed or + whose text was truncated or augmented. + +2013-01-22 Stephen Berman + + * calendar/todos.el: Revise handling of initial display and extend + to top priorities file. + (todos-display-categories-first): Remove, replacing by this: + (todos-show-first): New defcustom. + (todos-first-visit): Remove, replacing by this: + (todos-visited): New variable. + (todos-absolute-file-name): Extend possible values of optional + argument to take top priorities files into account. + (todos-modes-set-3, todos-mode): Remove use of todos-first-visit. + (todos-mode-external-set): Call find-file-noselect instead of + find-buffer-visiting, since the latter may fail. + (todos-show): Revise handling of initial display using + todos-show-first and todos-visited and extend to top priorities + file. + (todos-quit): Adapt to new handling of initial display. + +2013-01-14 Stephen Berman + + * calendar/todos.el: Implement saving top priority items buffers, + improve implementation of item filtering commands and + infrastucture, and fix two bugs. + (todos-prefix-overlays): Use todos-top-priority face only in Todos + mode. + (todos-multiple-filter-files): Get file-truename of Todos file. + (todos-filter-items): Pass a list of files from the caller instead + of building it here, and move handling of cancelled file selection + dialog to callers. Correct omission of file-wide default number + of top priorities. + (todos-filtered-buffer-name): Treat file-list argument only as a list. + (todos-find-item, todos-check-top-priorities) + (todos-top-priorities-filename) + (todos-save-top-priorities-buffer): New functions. + (todos-save): Use todos-save-top-priorities-buffer. + (todos-jump-to-item): Refactor and use todos-find-item. + (todos-top-priorities): Simplify semantics of prefix argument. + Check if top priorities file exists and if so, visit it, reporting + whether it is up to date. Add optional argument and use it to + handle multiple files. + (todos-diary-items, todos-regexp-items): Add optional argument and + use it to handle multiple files. + (todos-top-priorities-multifile, todos-diary-items-multifile) + (todos-regexp-items-multifile): Refactor, using corresponding + non-multifile command. + (auto-mode-alist): Add pattern for top priorities files to visit + these in Todos Filtered Items mode. + +2013-01-08 Stephen Berman + + * calendar/todos.el: Fix tabular alignment in Todos Categories mode. + (todos-adjusted-category-label-length): New function. + (todos-padded-string): Use it. + +2013-01-08 Stephen Berman + + * calendar/todos.el (todos-move-item): Allow moving done items to + done section of another category. + +2013-01-06 Stephen Berman + + * calendar/todos.el: Display numerical priority string of top + priority items in category in a distinctive face. + (todos-prefix-string): Make doc string more precise. + (todos-top-priority): New defface. + (todos-done, todos-done-sep): Use more compact face definition + \(taken from font-lock.el). + (todos-comment): Give a complete face definition, instead of + inheriting from todos-done. + (todos-font-lock-keywords): Use todos-comment-face for + todos-comment-string-matcher. + (todos-prefix-overlays): Use todos-top-priority as the face + property of top priority items; don't condition reapplying item + prefix overlay on whether the string changed, since that prevents + updating display after changing number of top priorities. + (todos-set-top-priorities): Call todos-prefix-overlays to update + display. + +2013-01-04 Stephen Berman + + * calendar/todos.el (todos-reset-global-current-todos-file) + (todos-display-categories-1): Use absolute name of + todos-default-todos-file. + +2013-01-04 Stephen Berman + + * calendar/todos.el (todos-insert-item): Fix copy and paste error + from previous change. + +2013-01-03 Stephen Berman + + * calendar/todos.el: Implement extended category completions. + (todos-default-todos-file): Change default value to correct custom + type. + (todos-category-completions-files): New defcustom. + (todos-reevaluate-category-completions-files-defcustom) + (todos-absolute-file-name, todos-category-completions): New defuns. + (todos-reevaluate-filelist-defcustoms): + Add todos-category-completions-files and + todos-reevaluate-category-completions-files-defcustom. + (todos-allcats-file, todos-all-categories-alist) + (todos-jump-to-category-other-file, todos-jump-to-any-category) + (todos-move-item-to-file): Remove (todos-all-categories-alist both + as defvar and as defun). + (todos-read-category): Rewrite using extended category completions + and better handling of completion against existing or non-existing + categories. + (todos-validate-name): Correct doc string; use local instead of + dynamic variables in function body. + (todos-insert-category-line): Adjust use of todos-jump-to-category + to new argument list. + (todos-key-bindings, todos-menu): Delete entries for removed + commands. + (todos-show): Get absolute name of todos-default-todos-file; + add `nowarn' argument to find-file-noselect; adjust use of + todos-add-category to new argument list. + (todos-jump-to-category): Rewrite using extended category + completions; reverse argument list, adapting FILE argument to new + completion mechanism; add autoload cookie; call todos-show if + there are no Todos files. + (todos-add-category): Rewrite using extended category completions; + add FILE argument to accommodate new completion mechanism. + (todos-merge-category): Adapt to extended category completions, + adding prefix argument. + (todos-insert-item): Adapt to extended category completions; use + todos-read-category instead of todos-jump-to-category in prefix + argument calls; call todos-show if there are no Todos files; if + item is inserted at end of category, recenter to ensure the items + above it are displayed in the window. + (todos-move-item): Adapt to extended category completions, making + argument prefix argument; allow moving within category (for the + sake of code simplification); add `nowarn' argument to + find-file-noselect. + (todos-archive-done-item): Prevent error when attempting to + archive not-done todo item; adjust use of todos-add-category to + new argument list. + +2012-12-15 Stephen Berman + + * calendar/todos.el (todos-archive-done-item): Fix archiving of + all done items in a category and resulting display of todo file. + +2012-12-14 Stephen Berman + + * calendar/todos.el (todos-priorities-rules): Fix customization + type to prevent mismatch error. + (todos-set-top-priorities): Fix rule construction; fix input check; + improve prompt. + +2012-12-14 Stephen Berman + + * calendar/todos.el (todos-insert-item): If user exits Calendar + before choosing a date, cancel item insertion. + (todos-set-date-from-calendar): If user exits Calendar before + choosing a date, clean up properly. + +2012-12-12 Stephen Berman + + * calendar/todos.el: Extend and improve handling of item editing, + especially of date/time header. + (todos-month-name-array, todos-month-abbrev-array): New defconsts. + (todos-date-pattern): Use explicitly numbered groups. + (todos-read-date): Optionally read and return just one of the date + string components year, month or monthname, day. + (todos-key-bindings): Add bindings for new item header editing + commands. + (todos-edit-item): Exclude date/time header from minibuffer by + default; include it by passing a prefix argument. + (todos-edit-item-header-1): New function containing the guts of + the commands for editing item date/time headers. + (todos-edit-item-header): Use it. Condition editing of time + string on value of `todos-always-add-time-string'. + (todos-edit-item-date-from-calendar): Use todos-edit-item-header-1. + (todos-edit-item-date-to-today): Rename from + todos-edit-item-date-is-today and use todos-edit-item-header-1. + (todos-edit-item-date): Remove. + (todos-edit-item-date-day-name, todos-edit-item-date-year) + (todos-edit-item-date-month, todos-edit-item-date-day): New commands. + +2012-12-02 Stephen Berman + + * calendar/todos.el (todos-show): Fix a comment. + (todos-add-category): Prompt for a new category if passed category + is the empty string, not nil. + +2012-11-26 Stephen Berman + + * calendar/todos.el (todos-make-categories-list) + (todos-convert-legacy-files, todos-jump-to-item) + (todos-move-category, todos-merge-category) + (todos-archive-done-item, todos-unarchive-items): Include end of + line in regex searches for beginning of category, in order not to + get a category whose name contains the searched for category name. + +2012-11-15 Stephen Berman + + * calendar/todos.el (todos-forward-category): Fix typo. + +2012-10-30 Stephen Berman + + * calendar/todos.el (todos-define-insertion-command): + Let generated insertion commands accept a prefix argument. + +2012-10-08 Stephen Berman + + * calendar/todos.el (todos-move-item): If user quits before + completing movement, restore display of initial category; if item + is moved to end of target category, make sure the items above it + are displayed in the window. + +2012-10-08 Stephen Berman + + * calendar/todos.el: Fixes to todos-move-item and some of its + subroutines. + (todos-move-item): When there are marked items, point need not be + on an item; remove obsolete use of todos-add-category, since this + is now already done in todos-read-category; fix typo. + (todos-diary-item-p): Exclude empty lines. + (todos-read-category): Restore point and narrowing after adding + new category, to avoid moving to beginning of file when moving + marked items to a new category. + (todos-set-item-priority): Prompt for priority only when the + category has at least one todo item; only use non-nil priority to + calculate insertion location. + (todos-read-category): Don't reset todos-categories when a new + category is added due to todos-move-item or todos-jump-to-item. + +2012-09-24 Stephen Berman + + Changes from 2012-07-14 (revision 110020). + * calendar/todos.el (todos-copy-item): New command. + (todos-insertion-map): Add key binding for it. + +2012-09-24 Stephen Berman + + Changes from 2012-07-13 (revision 110019). + * calendar/todos.el (todos-undo-item-omit-comment): New defcustom. + (todos-item-undo): Use it. + (todos-allcats-file, todos-all-categories-alist): New variables. + (todos-all-categories-alist): New function. + (todos-jump-to-any-category): New command. + (todos-move-item): Remove mark overlays from buffer items were + moved from; update todos-categories-with-marks, + +2012-09-24 Stephen Berman + + Changes from 2012-06-27 (revision 110018). + * calendar/todos.el: Further code rearrangement; further new and + revised comments. + (todos-reevaluate-filelist-defcustoms): Rename from + todos-reevaluate-defcustoms and adjust callers. + (todos-date-pattern, todos-nondiary-start, todos-nondiary-end) + (todos-date-string-start, todos-done-string-start) + (todos-item-start): Change from defvar to defconst. + (todos-set-top-priorities): Use read-number and simplify. + (todos-insert-item): Check whether date-type argument is a string. + (todos-set-date-from-calendar): Check whether + todos-date-from-calendar is a string; simplify cond clause. + (todos-archive-done-item, todos-unarchive-items): + Use buffer-substring-no-properties. + +2012-09-23 Stephen Berman + + Changes from 2012-06-25 (revision 110017). + * calendar/todos.el (todos-item-undo): Fix restoration on + cancelling; use buffer-substring-no-properties; comment out code + removing mark overlay; fix insertion of undone items; display any + remaining done items. + +2012-09-23 Stephen Berman + + Changes from 2012-06-24 (revision 110016). + * calendar/todos.el: Further significant code rearrangement; + further comment revision. + (todos-mode-display): New defgroup. + (todos-prefix, todos-number-priorities) + (todos-done-separator-string, todos-done-string) + (todos-comment-string, todos-show-with-done) + (todos-mode-line-function, todos-skip-archived-categories) + (todos-highlight-item, todos-wrap-lines) + (todos-line-wrapping-function): Use it. + (todos-item-insertion): New defgroup. + (todos-include-in-diary, todos-diary-nonmarking) + (todos-nondiary-marker, todos-always-add-time-string) + (todos-use-only-highlighted-region): Use it. + (todos-forward-button, todos-backward-button): New commands. + (todos-categories-mode-map): Use them, replacing forward-button + and backward-button. + (todos-merge-category): Fix and improve implementation; handle + archived items. + (todos-insert-item, todos-set-date-from-calendar): Handle setting + date by calling todos-insert-item-from-calendar. + (todos-delete-item): Fix overlay handling. + (todos-move-item): Highlight item to be moved. + (todos-item-undo): Handle marked items. + (todos-insert-item-from-calendar): Rewrite using + todos-date-from-calendar. + +2012-09-23 Stephen Berman + + Changes from 2012-06-21 (revision 110015). + * calendar/todos.el: Further comment revision. + (todos-sorted-column): Change default value, also taking tty into + account. + (todos-reset-done-separator): Fix faulty variable binding. + (todos-reset-and-enable-done-separator): Save match data; comment + out code that causes problems for Edebug. + (todos-item-start): Handle empty line between todo and done items + when done items are hidden. + (todos-read-date): Use a leap year for `*' to allow + calendar-last-day-of-month to return Feb. 29. + (todos-archive-mode, todos-edit-mode, todos-categories-mode) + (todos-filtered-items-mode): Delete faulty parentheses. + (todos-quit): Save Todos and archive files unconditionally. + (todos-forward-item): Accept only positive prefix argument. + (todos-backward-item): Accept only positive prefix argument; don't + move point to beginning of buffer if it is on the first item. + (todos-hide-show-date-time): Remove obsolete interactive spec. + (todos-move-category): Improve prompt string; ensure file moved to + is different from file moved from. + (todos-merge-categories): Remove. + (todos-set-category-priority): New command. + (todos-raise-category-priority, todos-lower-category-priority): + Use it to define these commands. + (todos-set-item-priority): Rewrite and generalize. + (todos-raise-item-priority, todos-lower-item-priority): Use it to + define these commands. + +2012-09-23 Stephen Berman + + Changes from 2012-06-15 (revision 110014). + * calendar/todos.el (todos-reset-done-separator) + (todos-reset-and-enable-done-separator): New functions. + (todos-reset-done-separator-string): Rewrite using + todos-reset-done-separator for string longer than 1 character. + (todos-mode): Add todos-reset-and-enable-done-separator to + window-configuration-change-hook, replacing previous anonymous + function. + (todos-unload-hook): And remove it. + +2012-09-23 Stephen Berman + + Changes from 2012-06-14 (revision 110013). + * calendar/todos.el (todos-done-separator-string): New defcustom. + (todos-done-separator): New variable replacing defcustom of the + same name. + (todos-reset-done-separator-string, todos-done-separator): + New functions. + (todos-mode): Make function added to + window-configuration-change-hook do a better job of updating the + done items separator string overlay. + (todos-unload-hook): Remove it here. + (todos-item-undo): Fix search for item's end. + +2012-09-23 Stephen Berman + + Changes from 2012-06-03 (revision 110012). + * calendar/todos.el: Further comment revision. + (todos-sorted-column): Change default value. + (todos-item-start): Handle empty category (needed in + todos-filter-items). + (todos-read-date): Don't use calendar-read; make code cleaner. + (todos-multiple-filter-files): Rename this variable from + todos-multiple-files and adjust users. + (todos-multiple-filter-files-widget): Rename from + todos-multiple-files-widget and adjust users. + (todos-multiple-filter-files): Rename this function from + todos-multiple-files and adjust callers. + (todos-filter-items): Remove unused code. + (todos-insert-category-line): Add space so highlighting of last + column is consistent with the others; adjust display of column + highlighting. + (todos-menu): Remove obsolete entry. + (todos-categories-mode-map): Add new bindings. + (todos-display-categories-alphabetically-or-by-priority): New command. + (todos-display-categories-sorted-by-todo) + (todos-display-categories-sorted-by-diary) + (todos-display-categories-sorted-by-done) + (todos-display-categories-sorted-by-archived): Restore and fix + implementation. + +2012-09-23 Stephen Berman + + Changes from 2012-06-02 (revision 110011). + * calendar/todos.el: Significant code rearrangement; further + comment revision. + (todos-filtered-items-buffer): Rename from todos-filter-buffer and + adjust users. + (todos-filtered-buffer-name): Rename from + todos-special-buffer-name and adjust users. + (todos-filtered-items-mode-map): Rename from + todos-filter-items-mode-map and adjust users. + (todos-mode-external-set): Use todos-categories instead of + todos-set-categories (and add comment to check if this DTRT). + (todos-filtered-items-mode): Rename from todos-filter-items-mode + and adjust users. + (todos-add-category): Don't call todos-validate-name, since + todos-read-category does. + (todos-edit-quit): Use todos-repair-categories-sexp. + (todos-done-item-add-edit-or-delete-comment): Rename from + todos-done-item-add-or-edit-comment and adjust users; add optional + argument to prompt to delete comment. + (todos-item-undo): Delete done item comment on undoing if user + confirms. + +2012-09-22 Stephen Berman + + Changes from 2012-06-02 (revision 110010). + * calendar/todos.el: Further code rearrangement and comment + revision. + (todos-item-start): Handle empty line between todo and done items + when done items are displayed. + (todos-key-bindings): Comment out bindings meant only for + todos-archive-mode. + (todos-archive-mode-map): Fix typo. + (todos-archive-mode): Derive from special-mode instead of + todos-mode to prevent its key bindings from being available here. + (todos-archive-done-item): Remove obsolete code; fix item count + updating. + (todos-unarchive-items): Simplify; fix unarchiving of all items in + category; fix item count updating; fix typo. + +2012-09-22 Stephen Berman + + Changes from 2012-06-01 (revision 110009). + * calendar/todos.el: Further code rearrangement and comment + revision. + (todos-add-to-buffer-list, todos-update-buffer-list): New functions. + (todos-file-buffers): New variable. + (todos-reset-global-current-todos-file): Use it to simplify + implementation of this function. + (todos-filtered): New defgroup. + (todos-filter-buffer, todos-top-priorities-buffer) + (todos-diary-items-buffer, todos-regexp-items-buffer) + (todos-priorities-rules, todos-show-priorities) + (todos-filter-files, todos-filter-done-items): Use it. + (todos-skip-archived-categories): Rename from + todos-ignore-archived-categories and adjust users. + (todos-display-as-todos-file): Rename from todos-after-find-file + and adjust callers. + (todos-reset-highlight-item, todos-mode-external-set) + (todos-jump-to-category, todos-jump-to-item) + (todos-raise-category-priority, todos-insert-item) + (todos-move-item): Use find-file-visiting. + (todos-make-categories-list): Use file-truename. + (todos-display-categories-1): Adjust title text for archive files; + use done label for item counts in archive files. + (todos-modes-set-3): Add todos-display-as-todos-file to + find-file-hook. + (todos-mode): Add todos-add-to-buffer-list to find-file-hook and + todos-update-buffer-list post-command-hook. + (todos-unload-hook): And remove them. + (todos-show): Only when interactively invoked from an archive, + switch to corresponding Todos file. + (todos-archive-done-item): Remove obsolete code; fix handling of + marked items; fix search for existing category; check whether + archive exists and write to file if not; improve display handling. + +2012-09-21 Stephen Berman + + Changes from 2012-05-29 (revision 110008). + * calendar/todos.el: Further comment revision. + (todos-item-end): Replace use of command todos-forward-item by + regexp searches using internal variables. + (todos-raise-category-priority): Improve and comment. + (todos-insert-item): Fix insertion of empty time string. + +2012-09-21 Stephen Berman + + Changes from 2012-05-29 (revision 110007). + * calendar/todos.el (todos-ignore-archived-categories): + Revert last change; remove :initialize and :set functions; change + use and change users accordingly. + (todos-reset-categories, todos-categories-full) + (todos-truncate-categories-list): Remove. + (todos-set-categories, todos-update-categories-sexp): + Use todos-categories instead of todos-categories-full; remove use + of todos-ignore-archived-categories and + todos-truncate-categories-list. + (todos-check-format, todos-repair-categories-sexp): + Use todos-categories instead of todos-categories-full. + (todos-read-category): Improve last change. + (todos-validate-name): Use completing-read. + (todos-categories-category-number): Rename from + todos-category-number and adjust users. + (todos-update-categories-display, todos-mode-external-set) + (todos-delete-category, todos-move-category, todos-merge-category) + (todos-unarchive-items): Remove use of todos-categories-full and + todos-ignore-archived-categories. + (todos-modes-set-3, todos-add-category): Remove use of + todos-categories-full. + (todos-edit-mode): Fix typo. + (todos-forward-category): Use todos-ignore-archived-categories. + +2012-09-21 Stephen Berman + + Changes from 2012-05-28 (revision 110006). + * calendar/todos.el: Doubts about todos-ignore-archived-categories. + (todos-ignore-archived-categories): Change default value. + +2012-09-21 Stephen Berman + + Changes from 2012-05-27 (revision 110005). + * calendar/todos.el: Further comment revision. + (todos-reset-global-current-todos-file): + Try to make this not slow down kill-buffer. + (todos-update-categories-sexp): Handle the case where there is no + categories sexp yet, i.e. after inserting the first item in the + file, so todos-display-categories works. + (todos-read-file-name): Improve implementation. + (todos-validate-name): Use variable todos-files. + (todos-category-number): New variable. + (todos-insert-category-line, todos-update-categories-display) + (todos-raise-category-priority): Use it. + (todos-add-file): Remove unused remnant code. + +2012-09-21 Stephen Berman + + Changes from 2012-05-25 (revision 110004). + * calendar/todos.el: Further comment revision. + (todos-set-item-top-priority): New command. + (todos-reset-global-current-todos-file): + Use todos-files-function instead of todos-files. + (todos-read-category): Add optional argument to test whether + caller adds new category; if so, don't prompt for new category and + don't restore original todos-categories list. + (todos-categories-mode-map): Update to renamed commands. + (todos-filter-items-mode-map): Add binding for new command. + (todos-mode): Fix typo. + (todos-show): If called from archive file, show corresponding + category in Todos file, if it exists. + (todos-jump-to-category): Remove code to add new category, since + todos-read-category can do that. + (todos-add-file): Remove obsolete code; visit new file in selected + window. + (todos-add-category): Simplify. + (todos-rename-category): Use force-mode-line-update instead of + setting mode-line-buffer-identification. + (todos-delete-category): Improve logic of prompts; use + todos-categories-full and check todos-ignore-archived-categories. + (todos-raise-category-priority, todos-lower-category-priority): + Rename from todos-{raise,lower}-category and adjust callers. + (todos-move-category, todos-merge-category): + Set todos-categories-full; on setting todos-categories check + todos-ignore-archived-categories. + (todos-insert-item): Let-bind use-empty-active-region and use + use-region-p instead of transient-mark-mode. + (todos-raise-item-priority): Improve implementation. + (todos-archive-done-item): Rename from + todos-archive-done-item-or-items and adjust callers; confine to + Todos mode. + (todos-unarchive-items): On setting todos-categories check + todos-ignore-archived-categories. + +2012-09-21 Stephen Berman + + Changes from 2012-05-23 (revision 110003). + * calendar/todos.el (todos-key-bindings): Remove binding of + deleted command. + (todos-menu): Remove entry of deleted command. + (todos-show-archive): Fix last change. + (todos-done-item-add-or-edit-comment): Rename from + todos-comment-done-item and adjust callers; prompt to edit an + existing comment. + +2012-09-21 Stephen Berman + + Changes from 2012-05-22 (revision 110002). + * calendar/todos.el (todos-set-show-current-file): Rename from + todos-toggle-show-current-file and adjust callers. + (todos-number-priorities): Rename from todos-number-prefix and + adjust users. + (todos-update-count): Rename from todos-set-count and adjust + callers. + (todos-hide-show-item-numbering): Rename from + todos-toggle-item-numbering and adjust callers. + (todos-hide-show-done-items): Rename from + todos-toggle-view-done-items and adjust callers. + (todos-show-done-only): Rename from todos-toggle-show-done-only. + (todos-view-archived-items): Comment out. + (todos-show-archive): Prompt to choose another archive file if + current Todos file lacks an archive; prompt to visit archive + anyway when current category has no archived items. + +2012-09-21 Stephen Berman + + Changes from 2012-05-21 (revision 110001). + * calendar/todos.el: Further comment revision and code + rearrangement. + (todos-item-end): Revert last change. + (todos-key-bindings, todos-menu, todos-archive-mode-map) + (todos-filter-items-mode-map): Use renamed commands. + (todos-hide-show-date-time): Rename from + todos-toggle-display-date-time. + (todos-mark-unmark-item): Rename from todos-toggle-mark-item and + adjust caller. + (todos-backward-item): Exempt special handling only from + todos-regexp-items-buffer instead of todos-filter-items-mode. + (todos-raise-item-priority): Don't allow item reprioritizing in + Todos filter items mode except for top priority items. + +2012-09-21 Stephen Berman + + Changes from 2012-05-19 (revision 110000). + * calendar/todos.el: Add and revise further doc strings and + comments. + (todos-filter-function, todos-custom-items) + (todos-custom-items-multifile): Remove. + (todos-filter-done-items): New defcustom. + (todos-item-end, todos-backward-item): Handle todos-filter-items-mode. + (todos-filter-items): Check return value of caller first; tag + archived items for todos-jump-to-item; delete categories sexp + before processing filter; check todos-filter-done-items for + whether to leave done items; remove custom filter; fix regexp for + file and category tags; don't invoke buffer fontification. + (powerset-recursive): Fix typo. + (todos-key-bindings): Remove unused bindings. + (todos-top-priorities-multifile, todos-diary-items-multifile) + (todos-regexp-items-multifile): Use variable todos-multiple-files. + (todos-jump-to-item): Fix regexp; handle archive tags; take + todos-filter-done-items into account. + (todos-insert-item-from-calendar): Relocate to end of file + together with key-binding as addition to calendar.el. + +2012-09-20 Stephen Berman + + Changes from 2012-05-17 (revision 109999). + * calendar/todos.el: Add and revise further doc strings and + comments; major code rearrangement. + (todos-merged-files, todos-prompt-merged-files) + (todos-print-priorities, todos-tmp-buffer-name) + (todos-top-priorities-widgets, todos-update-merged-files) + (todos-merged-top-priorities, todos-merged-diary-items) + (todos-merged-regexp-items, todos-merged-custom-items) + (todos-raw-mode, todos-change-default-file) + (todos-toggle-diary-inclusion, todos-toggle-item-diary-nonmarking) + (todos-toggle-diary-nonmarking, todos-validate-category-name): + Remove. + (todos-category-string-matcher): Comment out. + (todos-categories): New defgroup. + (todos-initial-file, todos-filter-buffer) + (todos-top-priorities-buffer, todos-categories-category-label) + (todos-diary-items-buffer, todos-regexp-items-buffer) + (todos-custom-items-buffer, todos-filter-files) + (todos-highlight-item, todos-todo-mode-date-time-regexp): + New defcustoms. + (todos-diary-expired): New face. + (todos-print-buffer, todos-multiple-files) + (todos-multiple-files-widget, todos-key-bindings): New variables. + (todos-short-file-name, todos-reevaluate-default-file-defcustom) + (todos-special-buffer-name) + (todos-reevaluate-filter-files-defcustom) + (todos-reset-highlight-item, todos-reevaluate-defcustoms) + (todos-nondiary-marker-matcher, todos-diary-nonmarking-matcher) + (todos-diary-expired-matcher, todos-category-string-matcher-1) + (todos-category-string-matcher-2, todos-repair-categories-sexp) + (todos-validate-name, todos-multiple-files) + (todos-display-categories-1, todos-update-categories-display) + (todos-modes-set-3, todos-mode-external-set): New functions. + (todos-set-top-priorities-in-file) + (todos-set-top-priorities-in-category) + (todos-top-priorities-multifile, todos-diary-items-multifile) + (todos-regexp-items-multifile, todos-custom-items-multifile) + (todos-convert-legacy-files, todos-jump-to-item) + (todos-edit-multiline-item, todos-edit-item-date-from-calendar) + (todos-edit-item-diary-inclusion) + (todos-edit-category-diary-inclusion) + (todos-edit-item-diary-nonmarking) + (todos-edit-category-diary-nonmarking): New commands. + (todos, todos-faces): Update :version. + (todos-done-separator, todos-completion-ignore-case): + Change default value. + (todos-done-separator): Change :set function. + (todos-indent-to-here): Add :validate function to :type. + (todos-prefix-string, todos-mark, todos-button) + (todos-sorted-column, todos-archived-only, todos-search) + (todos-done, todos-done-sep): Provide full face definitions + instead of inheriting. + (todos-edit-buffer, todos-categories-buffer): Change from + defcustom to defvar. + (todos-category-beg, todos-category-done): Change from defvar to + defconst. + (todos-files): Check if todos-files-directory exists. + (todos-default-todos-file, todos-mode-line-control, todos-print): + Use todos-short-file-name. + (todos-font-lock-keywords): Use todos-nondiary-marker-matcher, + todos-diary-nonmarking-matcher, todos-category-string-matcher-1, + todos-category-string-matcher-2, todos-diary-expired-matcher. + (todos-category-select): Use todos-done-string-start, and + condition search on todos-show-with-done; don't make display + overlay for done items separator string if there already is one; + use todos-highlight-item, require hl-line and activate + hl-line-mode here in order to avoid a hang if done in todos-mode + or the mode hook. + (todos-update-categories-sexp): Use todos-categories-full if set, + otherwise todos-categories. + (todos-make-categories-list): Don't test for archive file when + processing a legacy todo-mode file. + (todos-check-format): Add check for todos-categories sexp. + (todos-diary-item-p): Use todos-nondiary-start instead of + todos-date-pattern. + (todos-marked-item-p): Rename from todos-item-marked-p. + (todos-read-file-name): Don't accept empty name; validate. + (todos-read-category): Validate new name before prompting whether + to add new category; force quit if user answers no. + (todos-filter-items): Improve implementation. + (todos-set-top-priorities): Rewrite as a noninteractive function + using minibuffer input instead of widgets. + (todos-insert-sort-button): Call todos-display-sorted with + argument nil to display categories in numerical order, instead of + calling todos-display-categories. + (powerset-recursive): Borrow and slightly reformulate the (GDFL'd) + Common Lisp powerset function at + http://rosettacode.org/wiki/Power_set#Common_Lisp. + (powerset-bitwise): Implement in Emacs Lisp the (GDFL'd) C + powerset function at http://rosettacode.org/wiki/Power_set#C. + (todos-powerset): Defalias to powerset-bitwise. + (todos-mode-map): Generate from todos-key-bindings instead of + listing each key definition. + (todos-categories-mode-map): Add two bindings. + (todos-filter-items-mode-map): Add some bindings, remove others. + (todos-mode): Derive from special-mode; use todos-modes-set-3; add + function setting todos-done-separator to + window-configuration-change-hook. + (todos-unload-hook): Remove function setting todos-done-separator + from window-configuration-change-hook. + (todos-archive-mode): Derive from todos-mode; use todos-modes-set-3. + (todos-edit-mode): Derive from text-mode; use todos-mode-external-set. + (todos-categories-mode): Derive from special-mode; use + todos-mode-external-set. + (todos-filter-items-mode): Derive from special-mode. + (todos-quit): Save archive file if it hasn't yet been saved. + (todos-display-categories): Delegate all functionality to + todos-display-categories-1 and todos-update-categories-display. + (todos-toggle-view-done-items): Improve implementation. + (todos-highlight-item): Require hl-line. + (todos-toggle-display-date-time): Remove argument and make it + apply only to whole file. + (todos-top-priorities, todos-diary-items, todos-regexp-items) + (todos-custom-items): Use todos-special-buffer-name. + (todos-add-file): Use todos-short-file-name and + todos-reevaluate-defcustoms; remove validation, since it's now + done in todos-read-file-name. + (todos-add-category): Also update todos-categories-full if non-nil. + (todos-delete-category): Delete file after confirmation if only + category is deleted. + (todos-move-category): Use todos-short-file-name and + todos-reevaluate-defcustoms. + (todos-insert-item): Fix getting date from the calendar and + insertion of time string. + (todos-set-date-from-calendar): Enter calendar buffer, suppressing + display of diary entries. + (todos-edit-multiline): Add optional argument to restrict editing + buffer to current item, otherwise make entire buffer (i.e. whole + file) editable. + (todos-edit-quit): When whole file is editable, check file format + validity before killing buffer, and if valid, recalculate + categories sexp to be safe. + (todos-edit-item-header): Allow choosing date from calendar. + (todos-item-done): Handle marked items. + +2012-09-19 Stephen Berman + + Changes from 2011-12-03 (revision 109998). + * calendar/todos.el (todos-item-start): Restore commented out code + to prevent wrongly moving point in widened buffer. + +2012-09-19 Stephen Berman + + Changes from 2011-12-02 (revision 109997). + * calendar/todos.el: Remove old commentary from todo-mode.el; add + and revise further doc strings and comments; require cl.el at + compile time for remove-duplicates; use function powerset from + http://rosettacode.org/wiki/Power_set#Common_Lisp (GFDL); further + code rearrangement. Add adapted version of diary-goto-entry as comment. + (todos-file-top, todos-archived-categories-buffer) + (todos-save-top-priorities-too, todos-toggle-item-diary-inclusion) + (todos-save-top-priorities, todos-reset-separator) + (todos-switch-todos-file, todos-item-string-start, todos-counts) + (todos-string-count-lines, todos-string-multiline-p) + (todos-display-categories-alphabetically): Remove. + (todos-insert-item-ask-date, todos-insert-item-ask-date-time) + (todos-insert-item-ask-date-time-for-diary) + (todos-insert-item-ask-date-time-for-diary-here) + (todos-insert-item-ask-date-time-here) + (todos-insert-item-ask-date-maybe-notime) + (todos-insert-item-ask-date-maybe-notime-for-diary) + (todos-insert-item-ask-date-maybe-notime-for-diary-here) + (todos-insert-item-ask-date-maybe-notime-here) + (todos-insert-item-ask-date-for-diary) + (todos-insert-item-ask-date-for-diary-here) + (todos-insert-item-ask-date-here, todos-insert-item-ask-dayname) + (todos-insert-item-ask-dayname-time) + (todos-insert-item-ask-dayname-time-for-diary) + (todos-insert-item-ask-dayname-time-for-diary-here) + (todos-insert-item-ask-dayname-time-here) + (todos-insert-item-ask-dayname-maybe-notime) + (todos-insert-item-ask-dayname-maybe-notime-for-diary) + (todos-insert-item-ask-dayname-maybe-notime-for-diary-here) + (todos-insert-item-ask-dayname-maybe-notime-here) + (todos-insert-item-ask-dayname-for-diary) + (todos-insert-item-ask-dayname-for-diary-here) + (todos-insert-item-ask-dayname-here, todos-insert-item-ask-time) + (todos-insert-item-ask-time-for-diary) + (todos-insert-item-ask-time-for-diary-here) + (todos-insert-item-ask-time-here) + (todos-insert-item-maybe-notime) + (todos-insert-item-maybe-notime-for-diary) + (todos-insert-item-maybe-notime-for-diary-here) + (todos-insert-item-maybe-notime-here) + (todos-insert-item-for-diary, todos-insert-item-for-diary-here) + (todos-insert-item-here): Remove; all of these are now generated + on loading (some with the same name, most with other names.) + (todos-item-counts, todos-display-categories-alphabetically) + (todos-display-categories-sorted-by-todo) + (todos-display-categories-sorted-by-diary) + (todos-display-categories-sorted-by-done) + (todos-display-categories-sorted-by-archived): Comment out. + (todos-comment-string, todos-mode-line-function) + (todos-filter-function, todos-priorities-rules) + (todos-visit-files-commands, todos-categories-totals-label) + (todos-use-only-highlighted-region, todos-diary-nonmarking): + New defcustoms. + (todos-mark, todos-comment): New faces. + (todos-comment-face): Corresponding new variable. + (todos-categories-full, todos-global-current-todos-file) + (todos-first-visit, todos-insertion-commands-args-genlist) + (todos-insertion-commands-args, todos-insertion-commands-names) + (todos-insertion-commands, todos-insertion-commands-arg-key-list) + (todos-top-priorities-widgets, todos-date-from-calendar) + (todos-item-mark, todos-categories-with-marks): New variables. + (todos-mode-line-control, todos-reset-global-current-todos-file) + (todos-gen-arglists, todos-insertion-command-name) + (todos-insertion-key-bindings, todos-unload-hook) + (todos-filter-items, todos-set-date-from-calendar) + (todos-comment-string-matcher, todos-after-find-file) + (todos-reset-nondiary-marker, todos-reset-done-string) + (todos-reset-comment-string, todos-show-current-file) + (todos-item-marked-p, todos-total-item-counts): New functions. + (todos-define-insertion-command): New macro. + (todos-toggle-mark-item, todos-mark-category) + (todos-unmark-category, todos-set-top-priorities) + (todos-merged-diary-items, todos-regexp-items) + (todos-merged-regexp-items, todos-custom-items) + (todos-merged-custom-items, todos-comment-done-item) + (todos-archive-category-done-items, todos-unarchive-items) + (todos-print-to-file): New commands. + (todos-done-separator): Change :set function. + (todos-done-string): Uncomment :initialize and :set functions. + (todos-files): Use file-truename. + (todos-show-current-file): Rename from + todos-auto-switch-todos-file and change :set function accordingly. + (todos-font-lock-keywords): Use todos-comment-string-matcher; + change names of other matcher functions to new *-matcher. + (todos-category-number): Change initial value. + (todos-insertion-map): Use todos-insertion-key-bindings to + generate key definitions. + (todos-mode-map): Don't suppress digit keys, so they can supply + prefix arguments; add new and change some existing bindings. + (todos-archive-mode-map): Change a key binding. + (todos-categories-mode-map): Comment out a key binding. + (todos-filter-items-mode-map): Rename from + todos-top-priorities-mode-map. + (todos-mode): Make todos-current-todos-file, + todos-categories-full, todos-categories, todos-first-visit, + todos-category-number, todos-show-done-only, + todos-categories-with-marks local variables and set them; add + todos-show-current-file to pre-command-hook, todos-after-find-file + to post-command-hook and todos-reset-global-current-todos-file to + kill-buffer-hook. + (todos-archive-mode): Make todos-current-todos-file, + todos-categories and todos-category-number local variables and set + them; add todos-after-find-file to post-command-hook. + (todos-raw-mode): New derived major mode. + (todos-categories-mode): Don't set font-lock-defaults and + buffer-read-only; make todos-current-todos-file and + todos-categories local variables and set them. + (todos-filter-items-mode): Rename from todos-top-priorities-mode-map. + (todos-quit): Don't reset todos-categories on quitting + todos-categories-mode; handle quitting todos-filter-items-mode. + (todos-show): Simplify; when visiting an archive file switch to + corresponding Todos file; use todos-first-visit. + (todos-view-archived-items): Simplify; call todos-category-number. + (todos-show-archive): Rename from todos-switch-to-archive and + adjust callers; simplify. + (todos-toggle-display-date-time): Add optional argument to toggle + display in entire file. + (todos-top-priorities): Use todos-filter-items, which now contains + the previous core of this command. + (todos-merged-top-priorities, todos-diary-items): + Use todos-filter-items. + (todos-forward-category): Add optional argument to go to the + previous category. + (todos-backward-category): Use todos-forward-category. + (todos-jump-to-category): Refine implementation. + (todos-forward-item, todos-backward-item): Fix movement from todo + to done item and vice versa. + (todos-add-file): Remove argument and simplify. + (todos-rename-category): Use todos-current-todos-file and + todos-mode-line-function; set todos-categories with + todos-set-categories. + (todos-delete-category): Ask what to do if category has archived items. + (todos-raise-category): Ensure modified todos-categories is added + to file's categories sexp. + (todos-move-category): Improve implementation, especially handling + of archived categories. + (todos-merge-category): Tweak; set item counts. + (todos-insert-item): Improve handling of various argument values; + add new argument values to control marking of diary items and to + use region for item body. + (todos-insert-item-from-calendar): Use todos-global-current-todos-file. + (todos-delete-item, todos-edit-item-header): Handle marked items. + (todos-edit-item): Incorporate functionality of removed + todos-string-multiline-p. + (todos-edit-multiline): Use set-window-buffer instead of + switch-to-buffer. + (todos-edit-quit): Don't save on quitting; use todos-show instead + of todos-category-select. + (todos-raise-item-priority): Add argument to lower priority; + improve handling of top priority items in todos-filter-items-mode; + restore marks. + (todos-lower-item-priority): Use todos-raise-item-priority. + (todos-set-item-priority): Increment maximum number if item is new. + (todos-move-item): Handle marked items; delay changing category + moved from till after movement to avoid restoring if user cancels + before insertion. + (todos-item-done): Add optional argument to insert comment; fix + item counts and update sexp. + (todos-item-undo): Fix item counts and update. + (todos-archive-done-item-or-items): Rename from + todos-archive-done-items; add optional argument to archive all + items in category; handle marked items. + (todos-unarchive-category): Use todos-unarchive-items. + (todos-toggle-diary-inclusion): Incorporate functionality of + removed todos-toggle-item-diary-inclusion; handle marked items. + (todos-print): Add optional argument to print to file. + (todos-done-string-start): Don't use todos-nondiary-start. + (todos-date-string-matcher, todos-time-string-matcher) + (todos-done-string-matcher, todos-category-string-matcher): Rename + from *-match and adjust callers. + (todos-wrap-and-indent): Use set instead of setq for local variables. + (todos-prefix-overlays): Improve overlay handling. + (todos-reset-categories): Fix and complete implementation. + (todos-toggle-show-current-file): Rename from + todos-toggle-switch-todos-file-noninteractively. + (todos-category-select): Use todos-mode-line-function. + (todos-item-start): Comment out code used by removed function. + (todos-remove-item): Handle presence of both prefix/number and + mark overlays. + (todos-get-count): Simplify. + (todos-set-count): Change argument list and adjust callers; simplify. + (todos-set-categories): Handle new archive files; use + todos-categories-full and todos-ignore-archived-categories. + (todos-truncate-categories-list): Use todos-categories-full. + (todos-update-categories-sexp): Use kill-region instead of + kill-line; use todos-categories-full. + (todos-read-file-name): Add argument to require existing file and + adjust callers; use file-truename. + (todos-read-category): Remove argument to require existing + category and delegate it to completing-read in function body. + (todos-validate-category-name): Make empty string prompt only for + initial category name. + (todos-read-date): Use = instead of eq for testing if month = 13, + and if it is, set monthname to *. + (todos-display-categories): Use todos-global-current-todos-file; + use set-window-buffer instead of switch-to-buffer; add a line + showing item count totals. + (todos-padded-string): Use the longest of category name or label. + (todos-descending-counts): Rename from + todos-descending-counts-store and adjust users. + (todos-insert-category-line): Adjust format; use mapconcat; kill + buffer after jumping to category. + +2012-09-18 Stephen Berman + + Changes from 2011-05-16 (revision 109996). + * calendar/todos.el Add and revise various doc strings, remove + further commented out code; add further comments; further code + rearrangement. + (todos-file-do, todos-archive-file, todos-mode-hook) + (todos-edit-mode-hook, todos-exclusion-start, todos-exclusion-end) + (todos-view-archive, todos-search-string) + (todos-jump-to-category-noninteractively, todos-initial-setup): + Remove. + (todos-files): Remove this defcustom. + (todos-initial-category, todos-display-categories-first) + (todos-auto-switch-todos-file, todos-default-todos-file) + (todos-categories-category-label, todos-categories-todo-label) + (todos-categories-diary-label, todos-categories-done-label) + (todos-categories-archived-label) + (todos-categories-number-separator, todos-categories-align) + (todos-ignore-archived-categories, todos-nondiary-marker): + New defcustoms. + (todos-prefix, todos-done-separator, todos-file-top) + (todos-categories-buffer, todos-archived-categories-buffer) + (todos-edit-buffer, todos-always-add-time-string, todos-button): + Change default value. + (todos-done-string): Add todos-reset-done-string as :set function, + but keep this commented out. + (todos-files, todos-archives, todos-insertion-map) + (todos-category-done, todos-nondiary-start, todos-nondiary-end) + (todos-show-done-only, todos-date-string-start) + (todos-done-string-start): New variables. + (todos-files-directory, todos-files-function, todos-merged-files) + (todos-prompt-merged-files, todos-files, todos-modes-set-1) + (todos-modes-set-2, todos-reset-done-string, todos-reset-categories) + (todos-toggle-switch-todos-file-noninteractively) + (todos-switch-todos-file, todos-counts, todos-get-count) + (todos-set-count, todos-set-categories) + (todos-truncate-categories-list, todos-update-categories-sexp) + (todos-read-file-name, todos-sort, todos-display-sorted) + (todos-label-to-key, todos-insert-sort-button): New functions. + (todos-display-categories-sorted-by-todo) + (todos-display-categories-sorted-by-diary) + (todos-display-categories-sorted-by-done) + (todos-display-categories-sorted-by-archived) + (todos-update-merged-files, todos-switch-to-archive) + (todos-choose-archive, todos-merged-top-priorities) + (todos-jump-to-category-other-file, todos-clear-matches) + (todos-add-file, todos-change-default-file, todos-move-category) + (todos-merge-category, todos-merge-categories) + (todos-edit-item-time, todos-move-item-to-file) + (todos-unarchive-category, todos-toggle-item-diary-nonmarking) + (todos-toggle-diary-nonmarking): New commands. + (todos-toggle-show-done-only): New command replacing todos-view-archive. + (todos-faces): New defgroup; use in all face definitions. + (todos-sorted-column, todos-archived-only, todos-search): New faces. + (todos-font-lock-keywords): Use subexpression 1 with matcher + todos-category-string-match. + (todos-mode-map, todos-archive-mode-map, todos-edit-mode-map) + (todos-categories-mode-map): Add new key bindings; change some + existing bindings. + (todos-top-priorities-mode-map): New keymap. + (todos-menu): Add submenues and new entries. + (auto-mode-alist): Add extension of Todos and Todos archive files. + (todos-mode, todos-archive-mode): Make derived mode; use + todos-modes-set-1, todos-modes-set-2, todos-auto-switch-todos-file + and todos-switch-todos-file; make todos-show-done-only local + variable. + (todos-edit-mode): Make derived mode; use todos-modes-set-1. + (todos-categories-mode): Make derived mode. + (todos-top-priorities-mode): New derived major mode. + (todos-save): Remove unused code. + (todos-quit): Handle todos-categories-mode; save archive buffer. + (todos-show): Add optional argument to prompt for a Todos file; if + called interactively or with prefix arg or from an archive, don't + make a no-op but reset todos-current-todos-file, todos-categories + and todos-category-number; use todos-read-file-name, + todos-display-categories-first, todos-ignore-archived-categories. + (todos-display-categories): Change argument name; refactor code + for inserting table labels and lines, using + todos-ignore-archived-categories, todos-sort, + todos-categories-number-separator, todos-insert-sort-button, + todos-categories-*-labels, and todos-insert-category-line. + (todos-display-categories-alphabetically): Use todos-display-sorted. + (todos-toggle-view-done-items): Use todos-done-string-start and + todos-get-count. + (todos-toggle-display-date-time): Use todos-done-string-start. + (todos-top-priorities): Remove autoload cookie; partially rewrite: + new argument list; allow combining top priorities of multiple + Todos files; change display to include category (and file) name as + part of item header; use todos-top-priorities-mode. + (todos-diary-items): Reimplement using only todos-top-priorities. + (todos-forward-category, todos-backward-category): Adjust to + 1-based numbering of categories; move point to top of category. + (todos-jump-to-category): Rewrite, adding optional arguments to + provide a category in non-interactive uses and to prompt for which + Todos file to jump to. + (todos-search): Reimplement; highlight each match as found, say + how many matches remain and prompt whether to go to next one; at + end of search prompt whether to remove highlighting. + (todos-add-category): Remove autoload cookie; assign new category + the highest category number; associate zero-initialized vector of + item counts, instead of property list, with new category; use + todos-validate-category-name and todos-update-categories-sexp. + (todos-rename-category): Use todos-validate-category-name and + todos-update-categories-sexp; take archive files into account. + (todos-delete-category): Use todos-get-count and + todos-update-categories-sexp, let-bind variable that were + mistakenly global; use delete-region instead of kill-region; + adjust to 1-based numbering of categories; move point to top of + category. + (todos-raise-category): Handle item count vectors; use + todos-insert-category-line and todos-update-categories-sexp. + (todos-insert-item): Use nil time-string argument to omit time + string; use todos-nondiary-start and todos-nondiary-end and + todos-update-categories-sexp; if category named to insert into + does not exist, add it; take new diary items into account. + (todos-insert-item-ask-date, todos-insert-item-ask-date-time) + (todos-insert-item-ask-date-time-for-diary) + (todos-insert-item-ask-date-time-for-diary-here) + (todos-insert-item-ask-date-time-here) + (todos-insert-item-ask-date-maybe-notime) + (todos-insert-item-ask-date-maybe-notime-for-diary) + (todos-insert-item-ask-date-maybe-notime-for-diary-here) + (todos-insert-item-ask-date-maybe-notime-here) + (todos-insert-item-ask-date-for-diary) + (todos-insert-item-ask-date-for-diary-here) + (todos-insert-item-ask-date-here, todos-insert-item-ask-dayname) + (todos-insert-item-ask-dayname-time) + (todos-insert-item-ask-dayname-time-for-diary) + (todos-insert-item-ask-dayname-time-for-diary-here) + (todos-insert-item-ask-dayname-time-here) + (todos-insert-item-ask-dayname-maybe-notime) + (todos-insert-item-ask-dayname-maybe-notime-for-diary) + (todos-insert-item-ask-dayname-maybe-notime-for-diary-here) + (todos-insert-item-ask-dayname-maybe-notime-here) + (todos-insert-item-ask-dayname-for-diary) + (todos-insert-item-ask-dayname-for-diary-here) + (todos-insert-item-ask-dayname-here, todos-insert-item-ask-time) + (todos-insert-item-ask-time-for-diary) + (todos-insert-item-ask-time-for-diary-here) + (todos-insert-item-ask-time-here) + (todos-insert-item-maybe-notime) + (todos-insert-item-maybe-notime-for-diary) + (todos-insert-item-maybe-notime-for-diary-here) + (todos-insert-item-maybe-notime-here) + (todos-insert-item-for-diary, todos-insert-item-for-diary-here): + New insertion commands. + (todos-insert-item-from-calendar): Use todos-current-todos-file. + (todos-delete-item): Handle diary items; + use todos-update-categories-sexp. + (todos-edit-item): Check if point is with item string; + use read-string instead of read-from-minibuffer; + use todos-date-string-start; after editing put point at start of + item text. + (todos-edit-multiline): Narrow to item before invoking + todos-edit-mode; show key binding of todos-edit-quit in a message. + (todos-edit-quit): Use todos-save; kill buffer. + (todos-edit-item-header): Add optional argument to prompt for + editing only date string or only time string; + use todos-date-string-start. + (todos-edit-item-date, todos-edit-item-date-is-today) + (todos-raise-item-priority, todos-lower-item-priority): Rename + from todos-{raise, lower}-item and make them DTRT in + todos-top-priorities-mode. + (todos-set-item-priority): Make interactive; use todos-get-count + and todos-insert-with-overlays; interactively, just relocate the + item within its category. + (todos-move-item): Add optional argument to prompt for a category + in another Todos file; handle diary items; fix restoration after + cancelling before inserting. + (todos-item-done): Handle diary items; simplify handling of + insertion in done items section. + (todos-item-undo): Handle diary items. + (todos-archive-done-items): Adjust to new handling of archive + files (in parallel with Todos files); handle diary items; use + todos-done-string-start. + (todos-toggle-item-diary-inclusion): Use todos-nondiary-start, + todos-nondiary-end and todos-item-counts. + (todos-toggle-diary-inclusion): Use todos-category-done instead of + todos-category-end. + (todos-print): Remove autoload cookie; rewrite to make overlays, + line wrapping and wrap prefixes printable. + (todos-date-pattern): Make parenthesized groups shy. + (todos-date-string-match): Use todos-date-string-start; make + todos-date-pattern an explicitly numbered group. + (todos-time-string-match): Use todos-date-string-start. + (todos-done-string-match): Use todos-done-string-start. + (todos-category-string-match): Rewrite to match new category and + category+filename patterns in todos-top-priorities-mode. + (todos-prefix-overlays): Use todos-done-string-start and + todos-category-done. + (todos-reset-prefix): Handle archive files; restore point after + changing prefix. + (todos-reset-separator): Handle archive files. + (todos-category-number): Make category number one more than its + list index. + (todos-current-category): Adjust to 1-based numbering of categories. + (todos-category-select): Simplify handling of done items and done + separator string overlay. + (todos-item-start): Use todos-date-string-start and + todos-done-string-start. + (todos-item-start, todos-item-end): Fix wrong parenthesizing. + (todos-item-string): Restore point after getting item bounds; use + buffer-substring-no-properties. + (todos-done-item-p): Use todos-done-string-start. + (todos-make-categories-list): Add optional argument to force + looping through file to get categories and their item counts, + otherwise set todos-categories from sexp in first line; use + vectors of item counts instead of plists; count diary items. + (todos-item-counts): Use todos-counts, todos-set-counts, + todos-get-counts, and todos-update-categories-sexp instead of + getting and setting properties; handle diary items. + (todos-read-category): Add argument to set prompt; don't offer + default category. + (todos-validate-category-name): Rename from + todos-check-category-name; take into account whether there are + already categories or not. + (todos-read-date): Accept `*' as an unspecified month, day, or year. + (todos-padded-string): Accommodate new structure of + todos-categories as alists; use todos-categories-align. + (todos-descending-counts-store): New variable. + (todos-insert-category-line): Rename from + todos-insert-category-name and reimplement using labels and + todos-get-counts instead of properties; use + todos-ignore-archived-categories; highlight sorted column. + +2012-09-14 Stephen Berman + + Changes from 2010-07-09 (revision 109995). + * calendar/todos.el Remove lots of commented out code; add various + comments; further code rearrangement. + (todos-insert-item-here-ask-date-time) + (todos-insert-item-ask-date-time) + (todos-insert-item-ask-dayname-time) + (todos-insert-item-for-diary) + (todos-insert-item-for-diary-ask-date-time) + (todos-make-categories-alist, todos-categories-alist): Remove. + (todos-categories-list): Comment out. + (todos-make-categories-list): New function replacing + todos-make-categories-alist, using category plists to get item + counts and taking archive into account. + (todos-current-todos-file): New variable. + (todos-mode-map): Update key bindings. + (todos-save): Add as comment code to make sure todos-categories + sexp is current on saving. + (todos-quit): Call todos-show on quitting Todos archive buffer. + (todos-show): If todos-current-todos-file is not set to Todos + file, set it as a new file; set todos-categories from + todos-make-categories-alist. + (todos-display-categories): Use a different display format for + archive file; put point initially on the first button. + (todos-toggle-view-done-items): Check the category's `done' + property to determine if there are done items. + (todos-view-archive): Set todos-current-todos-file to the archive + file; jump from the Todos file to the same category in the + archive, if it exists, else jump to the first category; use + message instead of error. + (todos-add-category): Intern a special symbol for the new category + and set its property list to holds counts of the numbers of todo, + done and archived items in the category; assign the new category + the current highest category number. + (todos-rename-category): Don't use todos-categories-alist. + (todos-delete-category): Check the category's `todo' and `done' + properties to determine if it is empty; ensure that the end of the + last category is found; after deleting the category, empty its + plist and unintern its special symbol. + (todos-insert-item-here): Fix argument list of todos-insert-item. + (todos-delete-item, todos-raise-item, todos-lower-item): + Use message instead of error. + (todos-move-item): If the category to be moved to does not exist, + add it as a new category. + (todos-item-done, todos-reset-separator): + Use todos-category-select instead of todos-show. + (todos-archive-done-items): Make buffer writeable; conditionalize + search for end of category; save after adding to archive in case + the file is new, so it can be found. + (todos-category-select): Wrap search in if instead of or+and; + don't hide done items in an archive. + (todos-set-item-priority): Check the category's `todo' + property to determine if there are not done todo items. + (todos-jump-to-category-noninteractively): Just switch to buffer + visiting todos-current-todos-file, since this can be either a + Todos file or an archive. + (todos-item-counts): Use category's plist instead of an alist. + (todos-longest-category-name-length): Argument is now a list of + category names, not an alist, so just test each element, not each + element's the car. + (todos-padded-string): Use todos-categories instead of + todos-categories-alist. + (todos-insert-category-name): Use category plist to get item + counts; take archived items into account. + +2012-09-13 Stephen Berman + + Changes from 2010-06-18 (revision 109994). + * calendar/todos.el: Numerous spelling and comment fixes, doc + string fixes to conform with checkdoc, further rearrangement of + definitions, etc. + (todos-previous-line, todos-previous-answer) + (todos-insert-item-ask-date, todos-change-date) + (todos-date-nodayname-pattern, todos-dayname-date-pattern) + (todos-count-items-in-category, todos-count-all-items): Remove. + (todos-update-numbered-prefix, todos-item-start-overlays) + (todos-add-item-non-interactively): Comment out, also in uses. + (todos-done-separator): Change default value. + (todos-always-add-time-string): Rename from todos-add-time-string + and adjust uses. + (todos-read-category): Rename from todos-completing-read and + adjust callers; use todos-current-category. + (todos-make-categories-alist): Rename from function + todos-categories-alist. + (todos-categories-alist): New variable. + (todos-indent-to-here): New defcustom. + (todos-button): New face. + (todos-display-categories-alphabetically, todos-raise-category) + (todos-lower-category, todos-insert-item-for-diary-ask-date-time) + (todos-insert-item-here-ask-date-time) + (todos-insert-item-ask-date-time) + (todos-insert-item-ask-dayname-time): New commands. + (todos-edit-item-header): New command replacing todos-change-date. + (todos-category-number, todos-indent, todos-item-counts) + (todos-check-category-name, todos-read-date, todos-read-dayname) + (todos-read-time, todos-padded-string) + (todos-insert-category-name): New functions. + (todos-set-item-priority): New function replacing + todos-add-item-non-interactively. + (todos-mode-map): Remap newline to newline-and-indent. + (todos-edit-mode-map): Make sparse keymap; remap newline to + newline-and-indent. + (todos-categories-mode-map): New keymap. + (todos-mode, todos-edit-mode): Make indent-line-function local + variable and set to todos-indent. + (todos-categories-mode): New major mode. + (todos-display-categories): List categories initially in their + numerical order; add optional argument to switch to alphabetical + listing. + (todos-toggle-view-done-items): Simplify implementation. + (todos-toggle-display-date-time): Fix regexp search string. + (todos-backward-item, todos-forward-item): Use variable + todos-item-start. + (todos-add-category): Use todos-check-category-name and + todos-categories-alist. + (todos-rename-category): Use todos-current-category, + todos-check-category-name and todos-categories-alist. + (todos-delete-category): Use todos-check-category-name and + todos-categories-alist and take done items into account. + (todos-insert-item): Use separate arguments to handle insertion of + date/dayname and time strings, add new argument to mark item for + diary inclusion, use new todos-read-* functions, + todos-set-item-priority and todos-item-counts. + (todos-insert-item-here, todos-insert-item-for-diary) + (todos-insert-item-from-calendar): Adapt to new version of + todos-insert-item. + (todos-delete-item, todos-item-done): Use todos-item-counts. + (todos-edit-item): Indent newlines inserted by C-q C-j if nonspace + char follows. + (todos-lower-item): Ensure only not-done items can be lowered. + (todos-move-item): Use todos-current-category, todos-read-category + and todos-item-counts. + (todos-archive-done-items): Use todos-current-category and + todos-item-counts; fix regexp search string. + (todos-item-undo): Use todos-current-category, + todos-set-item-priority, todos-insert-with-overlays and + todos-item-counts; restore if user quits before inserting undone + item. + (todos-date-pattern): Rewrite without using + todos-date-nodayname-pattern and todos-dayname-date-pattern. + (todos-date-string-match): Do not make todos-date-pattern an + unnumbered group. + (todos-time-string-match): Make todos-date-pattern a shy group. + (todos-wrap-and-indent): Use todos-indent-to-here. + (todos-reset-prefix): Revert to using todos-show instead of + todos-category-select. + (todos-prefix-overlays): Fix numbering of done items and updating + of prefix. + (todos-category-select): Use todos-current-category; fix display + of separator string; don't move point to top of category. + (todos-jump-to-category-noninteractively): Use todos-category-number. + (todos-insert-with-overlays): Use todos-item-start unconditionally. + (todos-item-start): New variable. + (todos-item-start): Use it to define this function. + (todos-item-end): Adjust if item is last unfinished one before + displayed done items. + (todos-remove-item): Use todos-item-start and todos-item-end + instead of todos-forward-item and todos-backward-item. + (todos-longest-category-name-length): Add argument for list of + categories. + +2012-09-13 Stephen Berman + + Changes from 2010-05-25 (revision 109993). + * calendar/todos.el: Comment out calendar require, since diary-lib + requires calendar. Rearrange file to group definitions according + to their use (types of commands, internal functions, etc.) + (todos-file-done, todos-insert-threshold, todos-remove-separator) + (todos-date-string, todos-time-string, todos-check-overlay) + (todos-show-paren-hack, todos-file-item, todos-more-important-p): + Comment out. + (todos-current-date, todos-item-end-overlays) + (todos-list-categories): Remove. + (todos-item-end): Remove (the variable, not the function). + (todos-prefix-overlays): Rename from todos-item-overlays and adjust + callers. + (todos-done-separator, todos-done-string, todos-show-with-done) + (todos-files, todos-archive-file, todos-categories-buffer) + (todos-archived-categories-buffer, todos-wrap-lines) + (todos-line-wrapping-function): New defcustoms. + (todos-done, todos-done-sep): New faces. + (todos-done-face, todos-done-sep-face): Corresponding new variables. + (todos-search-string, todos-date-nodayname-pattern) + (todos-dayname-date-pattern, todos-date-pattern): New variables. + (todos-done-string-match, todos-category-string-match) + (todos-check-format, todos-wrap-and-indent, todos-reset-separator) + (todos-current-category, todos-count-items-in-category) + (todos-done-item-p, todos-categories-alist, todos-count-all-items) + (todos-longest-category-name-length): New functions. + (todos-categories-list): New buffer-specific function replacing + todos-list-categories. + (todos-toggle-item-numbering, todos-toggle-view-done-items) + (todos-search, todos-view-archive, todos-diary-items) + (todos-toggle-display-date-time, todos-insert-item-no-time) + (todos-insert-item-ask-date, todos-insert-item-for-diary) + (todos-insert-item-from-calendar, todos-edit-quit) + (todos-change-date, todos-item-done, todos-archive-done-items) + (todos-item-undo): New commands. + (todos-archive-mode): New major mode. + (todos-archive-mode-map, todos-edit-mode-map): New keymaps. + (todos-category-beg): Change value. + (todos-number-prefix): Change default value. + (todos-edit-buffer): Change from defvar to defcustom. + (todos-font-lock-keywords): Use todos-done-string-match and + todos-category-string-match. + (todos-backward-item, todos-forward-item): Use todos-done-string + and todos-date-pattern. + (todos-display-categories): Reimplement using buttons from + button.el instead of widgets. + (todos-top-priorities): Use with-current-buffer; take done items + into account; ensure buffers gets fontified. + (todos-add-category): Ensure new category does not begin with + empty lines. + (todos-jump-to-category): Use todos-category-select instead of + todos-show. + (todos-rename-category): Prompt for new name in body instead of in + interactive spec. + (todos-insert-item): Don't insert in done items section of + category. Add two optional arguments to control insertion: (i) to + insert near point without prompting for priority; (ii) to use + defaults for date and time strings, to prompt for these, or to + choose date from the Calendar. + (todos-insert-item-here): Reimplement using todos-insert-item. + (todos-delete-item): Don't move point after deleting last item. + (todos-raise-item, todos-lower-item): Take done items into account. + (todos-move-item): Don't move done items; update item numbering; + restore if user quits before inserting moved item. + (todos-print): Prompt for confirmation to print. + (todos-reset-prefix): Search backward from end of file instead of + forward from top. + (todos-jump-to-category-noninteractively): Take Todos archive into + account. + (todos-category-select): Show or hide done items according to + todos-show-with-done; if shown, coordinate separator and prefix + overlays. + (todos-add-item-non-interactively): Replace binary insertion + algorithm with prompting for numerical priority. + (todos-insert-with-overlays): Remove use of variable todos-item-end. + (todos-item-start): Take done items into account; use + todos-date-pattern. + (todos-item-end): Reimplement using todos-forward-item. + (todos-remove-item): Reimplement using todos-forward-item and + todos-backward-item; redo overlay handling. + (todos-mode-map): Add some new key bindings and change numerous + existing bindings; use "i" as prefix key for item insertion + commands. + (todos-mode): Use todos-wrap-lines and delegate word-wrap and + wrap-prefix settings to todos-wrap-and-indent; add to invisibility + spec; set buffer-read-only to t and consequently let-bind this + variable in all Todos commands that change buffer content. + (todos-edit-mode): Make an indepent mode, not derived from text-mode. + (todos-save): Don't save top priorities buffer. + (todos-show): Make a no-op if called interactively in narrowed + Todos mode, since, also to work around item prefix reduplication + bug with show-paren-mode enabled; use todos-categories-list. + +2012-09-12 Stephen Berman + + Changes from 2009-11-07 (revision 109992). + * calendar/todos.el: Comment out time-stamp require; require + calendar and diary-lib. + (todos-prefix): Change default value and doc string to reflect new + meaning; add :initialize and :set functions. + (todos-time-string-format, todos-entry-prefix-function) + (todos-initials, todos-entry-timestamp-initials) + (todos-prefix-face, todos-category-sep, todos-category-end) + (todos-cp): Comment out. + (todos-prefix-string): Inherit from font-lock-comment-face. + (todos-item-header, todos-item-header-face): Remove. + (todos-date, todos-time): New faces. + (todos-date-face, todos-time-face): Corresponding new variables. + (todos-add-time-string, todos-include-in-diary) + (todos-exclusion-start, todos-exclusion-end, todos-number-prefix): + New defcustoms. + (todos-item-end, todos-item-start-overlays) + (todos-item-end-overlays): New variables. + (todos-date-string-match, todos-time-string-match): New functions. + (todos-font-lock-keywords): Use them. + (todos-current-date, todos-date-string, todos-time-string) + (todos-toggle-item-diary-inclusion, todos-toggle-diary-inclusion) + (todos-reset-prefix, todos-update-numbered-prefix) + (todos-check-overlay, todos-item-overlays) + (todos-insert-with-overlays, todos-show-paren-hack): New functions. + (todos-highlight-item): New command. + (todos-category-beg): Change value. + (todos-category-select): Use todos-category-beg and todos-item-overlays. + (todos-backward-item): Add optional count argument; use it and + todos-item-start. + (todos-forward-item): Use todos-check-overlay, todos-item-start + and variable todos-item-end. + (todos-edit-item, todos-delete-item): Use todos-number-prefix, + todos-update-numbered-prefix, todos-item-overlays. + (todos-add-category, todos-rename-category) + (todos-list-categories): Use new category format. + (todos-delete-category): Allow deleting non-empty category; + use new category format. + (todos-add-item-non-interactively): Comment out unnecessary + save-excursion; use todos-insert-with-overlays. + (todos-insert-item): Comment out unnecessary save-excursion; use + new item format for date/time header and diary inclusion marking. + (todos-insert-item-here): Use new item format for date/time header + and diary inclusion marking; use todos-insert-with-overlays. + (todos-raise-item): Make a no-op if point is on an empty line; use + todos-insert-with-overlays. + (todos-lower-item): Use todos-insert-with-overlays. + (todos-top-priorities): Move call to todos-show inside + save-excursion; add save-current-buffer after save-restriction. + (todos-item-start): Use variable todos-item-end. + (todos-item-end): Use todos-check-overlay and variable todos-item-end. + (todos-remove-item): Take item overlays into account. + (todos-mode): Change calculation of wrap-prefix; make + hl-line-range-function a local variable and set it to highlight + todo item. + (todos-show): Ensure point stays at top of category. + +2012-09-12 Stephen Berman + + Changes from 2009-07-04 (revision 109991). + * calendar/todos.el (todos-window-configuration): Comment out. + (todos-display-categories): Comment out use of + todos-window-configuration; use switch-to-buffer instead of + pop-to-buffer. + (todos-jump-to-category-noninteractively): Comment out use of + todos-window-configuration. + (todos-edit-item): Don't allow editing of date/time item header. + (todos-insert-item, todos-insert-item-here): Insert date/time + header in front of new item string. + (todos-mode): Tweak wrap-prefix. + +2012-09-12 Stephen Berman + + Changes from 2009-06-26 (revision 109989). + * calendar/todos.el (todos-file-do, todos-file-done): + Change default location to directory "~/.emacs.d/". + (todos-completion-ignore-case, todos-categories-buffer): + New defcustoms. + (todos-prefix-string, todos-item-header): New faces. + (todos-prefix-face, todos-item-header-face): Corresponding + new variables. + (todos-rename-category, todos-delete-category) + (todos-display-categories, todos-move-item): New commands. + (todos-mode-map): Add key bindings for new commands and for + todos-add-category, which had no key binding. + (todos-jump-to-category-noninteractively): New function. + (todos-top-priorities): Comment out code using a previously + deleted variable. + (todos-completing-read): Allow SPC to insert a space when entering + a new category name; use todos-completion-ignore-case. + (todos-font-lock-keywords, todos-window-configuration): + New variables. + (todos-mode): Make mode-name "TODOS"; make font-lock-defaults, + word-wrap, and wrap-prefix local variables. + +2012-09-12 Stephen Berman + + Changes from 2009-02-16 (revision 109988). + * calendar/todos.el (todos-list-categories): Fix typos. + (todos-show): Ensure file is in todos-mode. + +2012-09-12 Stephen Berman + + Changes from 2009-02-12 (revision 109987). + * calendar/todos.el (todos-header): Remove defvar. + (todos-add-category): Comment out code that inserts and updates + the file local variables first line of the file todos-file-do. + (todos-list-categories): New function. + (todos-show): Use it; remove use of a previously deleted variable. + +2012-09-11 Stephen Berman + + Changes from 2009-02-12 (revision 109986). + * calendar/todos.el: New file. This is a copy of todo-mode.el + from revision 94343 except for the following changes: replace all + occurrences of the namespace prefix "todo-" with "todos-", delete + the defvar todo-cats (the old name of todo-categories) and its use + in todos-add-category, delete all defaliases of old command names. diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 350a957c6e4..628af73a9b1 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -143,7 +143,9 @@ displayed correctly." "What action to take on first use of `todos-show' on a file." :type '(choice (const :tag "Show first category" first) (const :tag "Show table of categories" table) - (const :tag "Show top priorities" top)) + (const :tag "Show top priorities" top) + (const :tag "Show diary items" diary) + (const :tag "Show regexp items" regexp)) :group 'todos) (defcustom todos-completion-ignore-case nil @@ -496,26 +498,6 @@ current time, if nil, they include it." :version "24.2" :group 'todos) -(defcustom todos-filtered-items-buffer "Todos filtered items" - "Initial name of buffer in Todos Filter Items mode." - :type 'string - :group 'todos-filtered) - -(defcustom todos-top-priorities-buffer "Todos top priorities" - "Buffer type string for `todos-filtered-buffer-name'." - :type 'string - :group 'todos-filtered) - -(defcustom todos-diary-items-buffer "Todos diary items" - "Buffer type string for `todos-filtered-buffer-name'." - :type 'string - :group 'todos-filtered) - -(defcustom todos-regexp-items-buffer "Todos regexp items" - "Buffer type string for `todos-filtered-buffer-name'." - :type 'string - :group 'todos-filtered) - (defcustom todos-priorities-rules nil "List of rules giving how many items `todos-top-priorities' shows. This variable should be set interactively by @@ -1078,6 +1060,8 @@ short Todos Archive or Top Priorities file name, respectively." (concat todos-files-directory name (cond ((eq type 'archive) ".toda") ((eq type 'top) ".todt") + ((eq type 'diary) ".tody") + ((eq type 'regexp) ".todr") (t ".todo")))))) (defun todos-check-format () @@ -1940,15 +1924,64 @@ the empty string (i.e., no time string)." (message "Click \"Apply\" after selecting files.") (recursive-edit)) -(defun todos-filter-items (filter file-list) - "Display a list of items from FILE-LIST that satisfy FILTER. -The values of FILE-LIST and FILTER are passed from the calling -commands. The files in FILE-LIST are either the current Todos -file or those listed in `todos-filter-files' or chosen -interactively. The values of FILTER can be `top' for top -priority items, a cons of `top' and a number passed by the -caller, `diary' for diary items, or `regexp' for items matching a -regular expresion entered by the user." +(defun todos-filter-items (filter &optional new multifile) + "Internal routine for displaying items that satisfy FILTER. +The values of FILTER can be `top' for top priority items, a cons +of `top' and a number passed by the caller, `diary' for diary +items, or `regexp' for items matching a regular expresion entered +by the user. The items can be from any categories in the current +todo file or, with non-nil MULTIFILE, from several files. If NEW +is nil, visit an appropriate file containing the list of filtered +items; if there is no such file, or with non-nil NEW, build the +list and display it. + +See the document strings of the commands `todos-top-priorities', +`todos-diary-items', `todos-regexp-items', and those of the +corresponding multifile commands for further details. " + (let* ((top (eq filter 'top)) + (diary (eq filter 'diary)) + (regexp (eq filter 'regexp)) + (buf (cond (top todos-top-priorities-buffer) + (diary todos-diary-items-buffer) + (regexp todos-regexp-items-buffer))) + (flist (if multifile + (or todos-filter-files + (progn (todos-multiple-filter-files) + todos-multiple-filter-files)) + (list todos-current-todos-file))) + (multi (> (length flist) 1)) + (fname (if (equal flist 'quit) + ;; Pressed `cancel' in t-m-f-f file selection dialog. + (keyboard-quit) + (concat todos-files-directory + (mapconcat 'todos-short-file-name flist "-") + (cond (top ".todt") + (diary ".tody") + (regexp ".todr"))))) + (rxfiles (when regexp + (directory-files todos-files-directory t ".*\\.todr$" t))) + (file-exists (or (file-exists-p fname) rxfiles))) + (cond ((and top new (natnump new)) + (todos-filter-items-1 (cons 'top new) flist)) + ((and (not new) file-exists) + (when (and rxfiles (> (length rxfiles) 1)) + (let ((rxf (mapcar 'todos-short-file-name rxfiles))) + (setq fname (todos-absolute-file-name + (completing-read "Choose a regexp items file: " + rxf) 'regexp)))) + (find-file fname) + (todos-prefix-overlays) + (todos-check-filtered-items-file)) + (t + (todos-filter-items-1 filter flist))) + (when (or new (not file-exists)) + (setq fname (replace-regexp-in-string "-" ", " fname)) + (rename-buffer (format (concat "%s for file" (if multi "s" "") + " \"%s\"") buf fname))))) + +(defun todos-filter-items-1 (filter file-list) + "Internal subroutine called by `todos-filter-items'. +The values of FILTER and FILE-LIST are passed from the caller." (let ((num (if (consp filter) (cdr filter) todos-show-priorities)) (buf (get-buffer-create todos-filtered-items-buffer)) (multifile (> (length file-list) 1)) @@ -2143,27 +2176,26 @@ set the user customizable option `todos-priorities-rules'." (customize-save-variable 'todos-priorities-rules rules) (todos-prefix-overlays))) -(defun todos-filtered-buffer-name (buffer-type file-list) - "Rename Todos filtered buffer using BUFFER-TYPE and FILE-LIST. +(defconst todos-filtered-items-buffer "Todos filtered items" + "Initial name of buffer in Todos Filter Items mode.") -The new name is constructed from the string BUFFER-TYPE, which -refers to one of the top priorities, diary or regexp item -filters, and the names of the filtered files in FILE-LIST. Used -in Todos Filter Items mode." - (let* ((multi (> (length file-list) 1)) - (fnames (mapconcat (lambda (f) (todos-short-file-name f)) - file-list ", "))) - (rename-buffer (format (concat "%s for file" (if multi "s" "") - " \"%s\"") buffer-type fnames)))) +(defconst todos-top-priorities-buffer "Todos top priorities" + "Buffer type string for `todos-filter-items'.") + +(defconst todos-diary-items-buffer "Todos diary items" + "Buffer type string for `todos-filter-items'.") + +(defconst todos-regexp-items-buffer "Todos regexp items" + "Buffer type string for `todos-filter-items'.") (defun todos-find-item (str) - "Search for saved top priority item STR in its Todos file. + "Search for filtered item STR in its saved Todos file. Return the list (FOUND FILE CAT), where CAT and FILE are the item's category and file, and FOUND is a cons cell if the search succeeds, whose car is the start of the item in FILE and whose -cdr is `done' if the item is now a done item, `changed' if its -priority has changed or its text was truncated or augmented, and -`same' otherwise." +cdr is `done', if the item is now a done item, `changed', if its +text was truncated or augmented or, for a top priority item, if +its priority has changed, and `same' otherwise." (string-match (concat (if todos-filter-done-items (concat "\\(?:" todos-done-string-start "\\|" todos-date-string-start "\\)") @@ -2179,11 +2211,14 @@ priority has changed or its text was truncated or augmented, and (archive (string= (match-string 3 str) "(archive) ")) (filcat (match-string 4 str)) (tpriority 1) + (tpbuf (string-match "top" (buffer-name))) found) (setq str (replace-match "" nil nil str 4)) - (save-excursion - (while (search-backward filcat nil t) - (setq tpriority (1+ tpriority)))) + (when tpbuf + ;; Calculate priority of STR wrt its category. + (save-excursion + (while (search-backward filcat nil t) + (setq tpriority (1+ tpriority))))) (setq file (if file (concat todos-files-directory (substring file 0 -1) (if archive ".toda" ".todo")) @@ -2215,15 +2250,16 @@ priority has changed or its text was truncated or augmented, and (cons found (if (> (point) done) 'done (let ((cpriority 1)) - (save-excursion - ;; Not top item in category. - (while (> (point) (1+ beg)) - (let ((opoint (point))) - (todos-backward-item) - ;; Can't move backward beyond - ;; first item in file. - (unless (= (point) opoint) - (setq cpriority (1+ cpriority)))))) + (when tpbuf + (save-excursion + ;; Not top item in category. + (while (> (point) (1+ beg)) + (let ((opoint (point))) + (todos-backward-item) + ;; Can't move backward beyond + ;; first item in file. + (unless (= (point) opoint) + (setq cpriority (1+ cpriority))))))) (if (and (= tpriority cpriority) ;; Proper substring is not the same. (string= (todos-item-string) @@ -2232,8 +2268,8 @@ priority has changed or its text was truncated or augmented, and 'changed))))))))) (list found file cat))) -(defun todos-check-top-priorities () - "Return a message saying whether top priorities file is up to date." +(defun todos-check-filtered-items-file () + "Check if filtered items file is up to date and a show suitable message." ;; (catch 'old (let ((count 0)) (while (not (eobp)) @@ -2247,26 +2283,35 @@ priority has changed or its text was truncated or augmented, and ;; (throw 'old (message "The marked item is not up to date."))) (todos-forward-item)) (if (zerop count) - (message "Top priorities file is up to date.") + (message "Filtered items file is up to date.") (message (concat "The highlighted item" (if (= count 1) " is " "s are ") "not up to date." ;; "\nType on item for details." ))))) -(defun todos-top-priorities-filename () - "" +(defun todos-filter-items-filename () + "Return absolute file name for saving this Filtered Items buffer." (let ((bufname (buffer-name))) (string-match "\"\\([^\"]+\\)\"" bufname) (let* ((filename-str (substring bufname (match-beginning 1) (match-end 1))) - (filename-base (replace-regexp-in-string ", " "-" filename-str))) - (concat todos-files-directory filename-base ".todt")))) - -(defun todos-save-top-priorities-buffer () - "" - (let ((filename (todos-top-priorities-filename))) - (if (file-exists-p filename) - (save-buffer) - (write-region nil nil filename nil t nil t)))) + (filename-base (replace-regexp-in-string ", " "-" filename-str)) + (top-priorities (string-match "top priorities" bufname)) + (diary-items (string-match "diary items" bufname)) + (regexp-items (string-match "regexp items" bufname))) + (when regexp-items + (let ((prompt (concat "Enter a short identifying string" + " to make this file name unique: "))) + (setq filename-base (concat filename-base "-" (read-string prompt))))) + (concat todos-files-directory filename-base + (cond (top-priorities ".todt") + (diary-items ".tody") + (regexp-items ".todr")))))) + +(defun todos-save-filtered-items-buffer () + "Save current Filtered Items buffer to a file. +If the file already exists, overwrite it only on confirmation." + (let ((filename (or (buffer-file-name) (todos-filter-items-filename)))) + (write-file filename t))) ;; --------------------------------------------------------------------------- ;;; Sorting and display routines for Todos Categories mode. @@ -3051,12 +3096,13 @@ file name and an initial category (defaulting to of these, visits the file and displays the category. The first invocation of this command on an existing Todos file -interacts with the option `todos-show-first': if `table', show -the table of categories in the file; if `top', show the -corresponding top priorities file, if any; if `first' (the -default value), show the first category in the file. Subsequent -invocations always show the file's current (i.e., last displayed) -category. +interacts with the option `todos-show-first': if its value is +`first' (the default), show the first category in the file; if +its value is `table', show the table of categories in the file; +if its value is one of `top', `diary' or `regexp', show the +corresponding saved top priorities, diary items, or regexp items +file, if any. Subsequent invocations always show the file's +current (i.e., last displayed) category. In Todos mode just the category's unfinished todo items are shown by default. The done items are hidden, but typing @@ -3090,18 +3136,35 @@ corresponding Todos file, displaying the corresponding category." (todos-add-file)))))) (unless (member file todos-visited) ;; Can't setq t-c-t-f here, otherwise wrong file shown when - ;; called again from todos-display-categories. + ;; todos-show is called from todos-display-categories. (let ((todos-current-todos-file file)) (cond ((eq todos-show-first 'table) (todos-display-categories)) - ((eq todos-show-first 'top) + ((memq todos-show-first '(top diary regexp)) (let* ((shortf (todos-short-file-name file)) - (tp-file (todos-absolute-file-name shortf 'top))) - (if (file-exists-p tp-file) + (fi-file (todos-absolute-file-name + shortf todos-show-first))) + (when (eq todos-show-first 'regexp) + (let ((rxfiles (directory-files todos-files-directory t + ".*\\.todr$" t))) + (when (and rxfiles (> (length rxfiles) 1)) + (let ((rxf (mapcar 'todos-short-file-name rxfiles))) + (setq fi-file (todos-absolute-file-name + (completing-read + "Choose a regexp items file: " + rxf) 'regexp)))))) + (if (file-exists-p fi-file) (set-window-buffer (selected-window) - (set-buffer (find-file-noselect tp-file 'nowarn))) - (message "There is no top priorities file for %s" shortf) + (set-buffer (find-file-noselect fi-file 'nowarn))) + (message "There is no %s file for %s" + (cond ((eq todos-show-first 'top) + "top priorities") + ((eq todos-show-first 'diary) + "diary items") + ((eq todos-show-first 'regexp) + "regexp items")) + shortf) (setq todos-show-first 'first))))))) (when (or (member file todos-visited) (eq todos-show-first 'first)) @@ -3239,8 +3302,8 @@ displayed." "Save the current Todos file." (interactive) (cond ((eq major-mode 'todos-filtered-items-mode) - (todos-check-top-priorities) - (todos-save-top-priorities-buffer)) + (todos-check-filtered-items-file) + (todos-save-filtered-items-buffer)) (t (save-buffer)))) @@ -3869,13 +3932,9 @@ See `todos-set-top-priorities' for more details." (interactive) (todos-set-top-priorities t)) -(defun todos-top-priorities (&optional arg multifile) +(defun todos-top-priorities (&optional arg) "Display a list of top priority items from different categories. -The categories are either a subset of those in the current Todos -file, or else, with non-nil argument MULTIFILE, a subset of the -categories in the files listed in `todos-filter-files', or if -this nil, in the files chosen from a file selection dialog that -pops up in this case. +The categories can be any of those in the current Todos file. With numerical prefix ARG show at most ARG top priority items from each category. With `C-u' as prefix argument show the @@ -3884,37 +3943,13 @@ numbers of top priority items specified by category in otherwise show `todos-show-priorities' items per category in the file(s). With no prefix argument, if a top priorities file for the current Todos file has previously been saved (see -`todos-save-top-priorities-buffer'), visit this file; if there is +`todos-save-filtered-items-buffer'), visit this file; if there is no such file, build the list as with prefix argument `C-u'. The prefix ARG regulates how many top priorities from each category to show, as described above." (interactive "P") - (let* ((flist (if multifile - (or todos-filter-files - (progn (todos-multiple-filter-files) - todos-multiple-filter-files)) - (list todos-current-todos-file))) - (tp-file (if (equal flist 'quit) - ;; Pressed `cancel' in file selection dialog. - (keyboard-quit) - (concat todos-files-directory - (mapconcat 'identity - (mapcar 'todos-short-file-name flist) - "-") - ".todt"))) - (tp-file-exists (file-exists-p tp-file)) - (buf todos-top-priorities-buffer)) - (cond ((and arg (natnump arg)) - (todos-filter-items (cons 'top arg) flist)) - ((and (not arg) tp-file-exists) - (find-file tp-file) - (todos-prefix-overlays) - (todos-check-top-priorities)) - (t - (todos-filter-items 'top flist))) - (unless tp-file-exists - (todos-filtered-buffer-name buf flist)))) + (todos-filter-items 'top arg)) (defun todos-top-priorities-multifile (&optional arg) "Display a list of top priority items from different categories. @@ -3928,77 +3963,73 @@ show the numbers of top priority items specified in `todos-priorities-rules', if this is non-nil; otherwise show `todos-show-priorities' items per category. With no prefix argument, if a top priorities file for the chosen Todos files -exists (see `todos-save-top-priorities-buffer'), visit this file; +exists (see `todos-save-filtered-items-buffer'), visit this file; if there is no such file, do the same as with prefix argument `C-u'." (interactive "P") - (todos-top-priorities arg t)) + (todos-filter-items 'top arg t)) -(defun todos-diary-items (&optional multifile) +(defun todos-diary-items (&optional arg) + "Display a list of todo diary items from different categories. +The categories can be any of those in the current Todos file. + +Called with no prefix argument, if a diary items file for the +current Todos file has previously been saved (see +`todos-save-filtered-items-buffer'), visit this file; if there is +no such file, build the list of diary items. Called with a +prefix argument, build the list even if there is a saved file of +diary items." + (interactive "P") + (todos-filter-items 'diary arg)) + +(defun todos-diary-items-multifile (&optional arg) "Display a list of todo diary items from different categories. -The categories are either a subset of those in the current Todos -file, or else, with non-nil argument MULTIFILE, a subset of the -categories in the files listed in `todos-filter-files', or if -this nil, in the files chosen from a file selection dialog that -pops up in this case." - (interactive) - (let ((flist (if multifile - (or todos-filter-files - (progn (todos-multiple-filter-files) - todos-multiple-filter-files)) - (list todos-current-todos-file))) - (buf todos-diary-items-buffer)) - (if (equal flist 'quit) - ;; Pressed `cancel' in file selection dialog. - (keyboard-quit) - (todos-filter-items 'diary flist) - (todos-filtered-buffer-name buf flist)))) - -(defun todos-diary-items-multifile () - "Display a list of todo diary items from one or more Todos files. The categories are a subset of the categories in the files listed in `todos-filter-files', or if this nil, in the files chosen from -a file selection dialog that pops up in this case." - (interactive) - (todos-diary-items t)) +a file selection dialog that pops up in this case. -(defun todos-regexp-items (&optional multifile) - "Prompt for a regular expression and display items that match it. -The matches may be from different categories and with non-nil -option `todos-filter-done-items', can include not only todo items -but also done items, including those in Archive files. - -The categories are either a subset of those in the current Todos -file (and possibly in the corresponding Archive file), or else, -with non-nil argument MULTIFILE, a subset of the categories in -the files listed in `todos-filter-files', or if this nil, in the -files chosen from a file selection dialog that pops up in this -case (and possibly in the corresponding Archive files)." - (interactive) - (let ((flist (if multifile - (or todos-filter-files - (progn (todos-multiple-filter-files) - todos-multiple-filter-files)) - (list todos-current-todos-file))) - (buf todos-regexp-items-buffer)) - (if (equal flist 'quit) - ;; Pressed `cancel' in file selection dialog. - (keyboard-quit) - (todos-filter-items 'regexp flist) - (todos-filtered-buffer-name buf flist)))) - -(defun todos-regexp-items-multifile () +Called with no prefix argument, if a diary items file for the +chosen Todos files has previously been saved (see +`todos-save-filtered-items-buffer'), visit this file; if there is +no such file, build the list of diary items. Called with a +prefix argument, build the list even if there is a saved file of +diary items." + (interactive "P") + (todos-filter-items 'diary arg t)) + +(defun todos-regexp-items (&optional arg) "Prompt for a regular expression and display items that match it. -The matches may be from different categories and with non-nil -option `todos-filter-done-items', can include not only todo items -but also done items, including those in Archive files. +The matches can be from any categories in the current Todos file +and with non-nil option `todos-filter-done-items', can include +not only todo items but also done items, including those in +Archive files. + +Called with no prefix argument, if a regexp items file for the +current Todos file has previously been saved (see +`todos-save-filtered-items-buffer'), visit this file; if there is +no such file, build the list of regexp items. Called with a +prefix argument, build the list even if there is a saved file of +regexp items." + (interactive "P") + (todos-filter-items 'regexp arg)) -The categories are a subset of the categories in the files listed -in `todos-filter-files', or if this nil, in the files chosen from -a file selection dialog that pops up in this case (and possibly -in the corresponding Archive files)." - (interactive) - (todos-regexp-items t)) +(defun todos-regexp-items-multifile (&optional arg) + "Prompt for a regular expression and display items that match it. +The matches can be from any categories in the files listed in +`todos-filter-files', or if this nil, in the files chosen from a +file selection dialog that pops up in this case. With non-nil +option `todos-filter-done-items', the matches can include not +only todo items but also done items, including those in Archive +files. + +Called with no prefix argument, if a regexp items file for the +current Todos file has previously been saved (see +`todos-save-filtered-items-buffer'), visit this file; if there is +no such file, build the list of regexp items. Called with a +prefix argument, build the list even if there is a saved file of +regexp items." + (interactive "P") + (todos-filter-items 'regexp arg t)) ;; --------------------------------------------------------------------------- ;;; Editing Commands @@ -6013,7 +6044,7 @@ the only category in the archive, the archive file is deleted." ;; --------------------------------------------------------------------------- (add-to-list 'auto-mode-alist '("\\.todo\\'" . todos-mode)) (add-to-list 'auto-mode-alist '("\\.toda\\'" . todos-archive-mode)) -(add-to-list 'auto-mode-alist '("\\.todt\\'" . todos-filtered-items-mode)) +(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todos-filtered-items-mode)) ;;; Addition to calendar.el ;; FIXME: autoload when key-binding is defined in calendar.el