aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2012-11-26 17:34:52 +0100
committerStephen Berman2012-11-26 17:34:52 +0100
commit11aa0eef7e08002a532b864252e45561dbd544f2 (patch)
treece11ce80e092ce19d960ea3d1a28d4aaee6c81a6
parent45e4a39733aa5e124d7fd75977eeea8511d84554 (diff)
downloademacs-11aa0eef7e08002a532b864252e45561dbd544f2.tar.gz
emacs-11aa0eef7e08002a532b864252e45561dbd544f2.zip
Fix regex searches for beginning of category.
* 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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/calendar/todos.el34
2 files changed, 28 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 483befca9b3..21e15256a05 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12012-11-26 Stephen Berman <stephen.berman@gmx.net>
2
3 * calendar/todos.el (todos-make-categories-list)
4 (todos-convert-legacy-files, todos-jump-to-item)
5 (todos-move-category, todos-merge-category)
6 (todos-archive-done-item, todos-unarchive-items): Include end of
7 line in regex searches for beginning of category, in order not to
8 get a category whose name contains the searched for category name.
9
12012-11-15 Stephen Berman <stephen.berman@gmx.net> 102012-11-15 Stephen Berman <stephen.berman@gmx.net>
2 11
3 * calendar/todos.el (todos-forward-category): Fix typo. 12 * calendar/todos.el (todos-forward-category): Fix typo.
@@ -10,7 +19,7 @@
102012-10-08 Stephen Berman <Stephen.Berman@rub.de> 192012-10-08 Stephen Berman <Stephen.Berman@rub.de>
11 20
12 * calendar/todos.el (todos-move-item): If user quits before 21 * calendar/todos.el (todos-move-item): If user quits before
13 completing movement, restore display of initial category; If item 22 completing movement, restore display of initial category; if item
14 is moved to end of target category, make sure the items above it 23 is moved to end of target category, make sure the items above it
15 are displayed in the window. 24 are displayed in the window.
16 25
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index b2285a54b56..0e2ee569faa 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -1258,7 +1258,8 @@ the file."
1258 (widen) 1258 (widen)
1259 (goto-char (point-min)) 1259 (goto-char (point-min))
1260 (when (re-search-forward 1260 (when (re-search-forward
1261 (concat (regexp-quote todos-category-beg) cat) 1261 (concat "^" (regexp-quote todos-category-beg)
1262 cat "$")
1262 (point-max) t) 1263 (point-max) t)
1263 (forward-line) 1264 (forward-line)
1264 (while (not (or (looking-at 1265 (while (not (or (looking-at
@@ -3090,7 +3091,8 @@ saved (the latter as a Todos Archive file) with a new name in
3090 (delete-region beg (1+ end)) 3091 (delete-region beg (1+ end))
3091 (set-marker beg (point)) 3092 (set-marker beg (point))
3092 (re-search-backward 3093 (re-search-backward
3093 (concat "^" (regexp-quote (concat todos-category-beg cat))) 3094 (concat "^" (regexp-quote (concat todos-category-beg cat))
3095 "$")
3094 nil t) 3096 nil t)
3095 (forward-line) 3097 (forward-line)
3096 (if (re-search-forward 3098 (if (re-search-forward
@@ -3273,7 +3275,7 @@ The category is chosen by prompt, with TAB completion."
3273 (widen) 3275 (widen)
3274 (goto-char (point-min)) 3276 (goto-char (point-min))
3275 (re-search-forward 3277 (re-search-forward
3276 (concat "^" (regexp-quote (concat todos-category-beg cat))) nil t) 3278 (concat "^" (regexp-quote (concat todos-category-beg cat)) "$") nil t)
3277 (search-forward str) 3279 (search-forward str)
3278 (setq beg (match-beginning 0))) 3280 (setq beg (match-beginning 0)))
3279 (kill-buffer buf) 3281 (kill-buffer buf)
@@ -3808,8 +3810,8 @@ archive of the file moved to, creating it if it does not exist."
3808 (widen) 3810 (widen)
3809 (goto-char (point-max)) 3811 (goto-char (point-max))
3810 (let* ((beg (re-search-backward 3812 (let* ((beg (re-search-backward
3811 (concat "^" 3813 (concat "^" (regexp-quote (concat todos-category-beg cat))
3812 (regexp-quote (concat todos-category-beg cat))) 3814 "$")
3813 nil t)) 3815 nil t))
3814 (end (if (re-search-forward 3816 (end (if (re-search-forward
3815 (concat "^" (regexp-quote todos-category-beg)) 3817 (concat "^" (regexp-quote todos-category-beg))
@@ -3850,7 +3852,7 @@ archive of the file moved to, creating it if it does not exist."
3850 (goto-char (point-max)) 3852 (goto-char (point-max))
3851 (re-search-backward 3853 (re-search-backward
3852 (concat "^" (regexp-quote todos-category-beg) 3854 (concat "^" (regexp-quote todos-category-beg)
3853 "\\(" (regexp-quote cat) "\\)") nil t) 3855 "\\(" (regexp-quote cat) "\\)$") nil t)
3854 (replace-match new nil nil nil 1))) 3856 (replace-match new nil nil nil 1)))
3855 (setq todos-categories 3857 (setq todos-categories
3856 (append todos-categories (list (cons new counts)))) 3858 (append todos-categories (list (cons new counts))))
@@ -3934,7 +3936,8 @@ category."
3934 ;; Merge any todo items. 3936 ;; Merge any todo items.
3935 (unless (zerop (length todo)) 3937 (unless (zerop (length todo))
3936 (re-search-forward 3938 (re-search-forward
3937 (concat "^" (regexp-quote (concat todos-category-beg goal))) nil t) 3939 (concat "^" (regexp-quote (concat todos-category-beg goal)) "$")
3940 nil t)
3938 (re-search-forward 3941 (re-search-forward
3939 (concat "^" (regexp-quote todos-category-done)) nil t) 3942 (concat "^" (regexp-quote todos-category-done)) nil t)
3940 (forward-line -1) 3943 (forward-line -1)
@@ -3965,14 +3968,14 @@ category."
3965 (cbeg (save-excursion 3968 (cbeg (save-excursion
3966 (when (re-search-forward 3969 (when (re-search-forward
3967 (concat "^" (regexp-quote 3970 (concat "^" (regexp-quote
3968 (concat todos-category-beg cat))) 3971 (concat todos-category-beg cat)) "$")
3969 nil t) 3972 nil t)
3970 (goto-char (match-beginning 0)) 3973 (goto-char (match-beginning 0))
3971 (point-marker)))) 3974 (point-marker))))
3972 (gbeg (save-excursion 3975 (gbeg (save-excursion
3973 (when (re-search-forward 3976 (when (re-search-forward
3974 (concat "^" (regexp-quote 3977 (concat "^" (regexp-quote
3975 (concat todos-category-beg goal))) 3978 (concat todos-category-beg goal)) "$")
3976 nil t) 3979 nil t)
3977 (goto-char (match-beginning 0)) 3980 (goto-char (match-beginning 0))
3978 (point-marker)))) 3981 (point-marker))))
@@ -5128,11 +5131,10 @@ this category does not exist in the archive, it is created."
5128 (let (buffer-read-only) 5131 (let (buffer-read-only)
5129 (widen) 5132 (widen)
5130 (goto-char (point-min)) 5133 (goto-char (point-min))
5131 (if (and (re-search-forward (concat "^" 5134 (if (and (re-search-forward
5132 (regexp-quote 5135 (concat "^" (regexp-quote
5133 (concat todos-category-beg 5136 (concat todos-category-beg cat)) "$")
5134 cat))) 5137 nil t)
5135 nil t)
5136 (re-search-forward (regexp-quote todos-category-done) 5138 (re-search-forward (regexp-quote todos-category-done)
5137 nil t)) 5139 nil t))
5138 ;; Start of done items section in existing category. 5140 ;; Start of done items section in existing category.
@@ -5230,7 +5232,7 @@ archive, the archive file is deleted."
5230 (widen) 5232 (widen)
5231 (goto-char (point-min)) 5233 (goto-char (point-min))
5232 (re-search-forward (concat "^" (regexp-quote 5234 (re-search-forward (concat "^" (regexp-quote
5233 (concat todos-category-beg cat))) 5235 (concat todos-category-beg cat)) "$")
5234 nil t) 5236 nil t)
5235 ;; Go to end of category's done section. 5237 ;; Go to end of category's done section.
5236 (if (re-search-forward (concat "^" (regexp-quote todos-category-beg)) 5238 (if (re-search-forward (concat "^" (regexp-quote todos-category-beg))
@@ -5279,7 +5281,7 @@ archive, the archive file is deleted."
5279 (when (eq (point-min) (point-max)) 5281 (when (eq (point-min) (point-max))
5280 (widen) 5282 (widen)
5281 (let ((beg (re-search-backward 5283 (let ((beg (re-search-backward
5282 (concat "^" (regexp-quote todos-category-beg) cat) 5284 (concat "^" (regexp-quote todos-category-beg) cat "$")
5283 nil t)) 5285 nil t))
5284 (end (if (re-search-forward 5286 (end (if (re-search-forward
5285 (concat "^" (regexp-quote todos-category-beg)) 5287 (concat "^" (regexp-quote todos-category-beg))