From 98c97dee7675f6028a82340e9c495c8759cd6b8e Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 4 Jul 2009 00:07:26 +0100 Subject: [PATCH] * 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. --- lisp/ChangeLog | 13 +++++++++++++ lisp/calendar/todos.el | 43 ++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5c81102cb83..21821505339 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2012-09-12 Stephen Berman + + * 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 * calendar/todos.el (todos-file-do, todos-file-done): diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 591cf690758..eaf4b92f5c8 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -455,12 +455,12 @@ For details see the variable `time-stamp-format'." (defvar todos-category-end "--- End" "Separator after a category.") -(defvar todos-window-configuration nil - "Variable for storing current window configuration in Todos mode. +;; (defvar todos-window-configuration nil +;; "Variable for storing current window configuration in Todos mode. -Set before leaving Todos mode buffer by todos-display-categories. -Restored before re-entering Todo mode buffer by todo-kill-buffer -and todo-jump-to-category-noninteractively.") +;; Set before leaving Todos mode buffer by todos-display-categories. +;; Restored before re-entering Todo mode buffer by todo-kill-buffer +;; and todo-jump-to-category-noninteractively.") ;; --------------------------------------------------------------------------- @@ -530,10 +530,15 @@ and todo-jump-to-category-noninteractively.") (defun todos-edit-item () "Edit current TODO list entry." (interactive) - (let ((item (todos-item-string))) + (let* ((prefix (concat todos-prefix " " (todos-entry-timestamp-initials))) + ;; don't allow editing of Todos prefix string + ;; FIXME: or should this be automatically updated upon editing? + (item (substring (todos-item-string) (length prefix)))) + ;; FIXME: disable minibuffer-history ?? + ;; (minibuffer-history)) (if (todos-string-multiline-p item) (todos-edit-multiline) - (let ((new (read-from-minibuffer "Edit: " item))) + (let ((new (concat prefix (read-from-minibuffer "Edit: " item)))) (todos-remove-item) (insert new "\n") (todos-backward-item) @@ -679,7 +684,7 @@ and todo-jump-to-category-noninteractively.") "Display an alphabetical list of clickable Todos category names. Click or type RET on a category name to go to it." (interactive) - (setq todos-window-configuration (current-window-configuration)) + ;; (setq todos-window-configuration (current-window-configuration)) (let ((categories (copy-sequence todos-categories)) beg) ;; alphabetize the list case insensitively @@ -690,7 +695,7 @@ Click or type RET on a category name to go to it." (eval-when-compile (require 'wid-edit)) (with-current-buffer (get-buffer-create todos-categories-buffer) - (pop-to-buffer (current-buffer)) + (switch-to-buffer (current-buffer)) (erase-buffer) (kill-all-local-variables) (widget-insert "Press a button to display the corresponding category.\n\n") @@ -711,7 +716,7 @@ Click or type RET on a category name to go to it." (let ((name todos-categories-buffer)) (if (string= (buffer-name) name) (kill-buffer name))) - (set-window-configuration todos-window-configuration) + ;; (set-window-configuration todos-window-configuration) (switch-to-buffer (file-name-nondirectory todos-file-do)) (widen) (goto-char (point-min)) @@ -728,10 +733,9 @@ category." (save-excursion (if (not (derived-mode-p 'todos-mode)) (todos-show)) (let* ((new-item (concat todos-prefix " " - (read-from-minibuffer - "New TODO entry: " - (if todos-entry-prefix-function - (funcall todos-entry-prefix-function))))) + (if todos-entry-prefix-function + (funcall todos-entry-prefix-function)) + (read-from-minibuffer "New TODO entry: "))) (current-category (nth todos-category-number todos-categories)) (category (if arg (todos-completing-read) current-category))) (todos-add-item-non-interactively new-item category)))) @@ -742,10 +746,9 @@ If point is on an empty line, insert the entry there." (interactive) (if (not (derived-mode-p 'todos-mode)) (todos-show)) (let ((new-item (concat todos-prefix " " - (read-from-minibuffer - "New TODO entry: " - (if todos-entry-prefix-function - (funcall todos-entry-prefix-function)))))) + (if todos-entry-prefix-function + (funcall todos-entry-prefix-function)) + (read-from-minibuffer "New TODO entry: ")))) (unless (and (bolp) (eolp)) (goto-char (todos-item-start))) (insert (concat new-item "\n")) (backward-char) @@ -1076,8 +1079,8 @@ Number of entries for each category is given by `todos-print-priorities'." (setq word-wrap t) (make-local-variable 'wrap-prefix) (setq wrap-prefix - (make-string (1+ (length (concat todos-prefix - (todos-entry-timestamp-initials)))) 32)) + (make-string (length (concat todos-prefix " " + (todos-entry-timestamp-initials))) 32)) (unless (member '(continuation) fringe-indicator-alist) (push '(continuation) fringe-indicator-alist)) (run-mode-hooks 'todos-mode-hook)) -- 2.39.2