aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2018-08-06 23:52:47 +0200
committerStephen Berman2018-08-06 23:52:47 +0200
commit5f32ba5015b5c17dbbe0453e8fe3efc343fe8489 (patch)
treeaff6188aca4be64d64a452a6f2976ec08e3d05bd
parent518c5b64d537c77050a49d15af25bc919e60f1a2 (diff)
downloademacs-5f32ba5015b5c17dbbe0453e8fe3efc343fe8489.tar.gz
emacs-5f32ba5015b5c17dbbe0453e8fe3efc343fe8489.zip
Fix todo-mode bug involving active region (bug#32379)
* lisp/calendar/todo-mode.el (todo-forward-category) (todo-jump-to-category, todo-toggle-view-done-items) (todo-toggle-view-done-only, todo-edit-quit, todo-search) (todo-go-to-source-item, todo-diary-goto-entry): Deactivate the mark when the region is active.
-rw-r--r--lisp/calendar/todo-mode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index a375313b336..c1c292129e2 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -863,6 +863,7 @@ category is the first)."
863 (not (zerop (todo-get-count 'archived)))) 863 (not (zerop (todo-get-count 'archived))))
864 (setq todo-category-number (funcall setcatnum)))) 864 (setq todo-category-number (funcall setcatnum))))
865 (todo-category-select) 865 (todo-category-select)
866 (if transient-mark-mode (deactivate-mark))
866 (goto-char (point-min)))) 867 (goto-char (point-min))))
867 868
868(defun todo-backward-category () 869(defun todo-backward-category ()
@@ -928,6 +929,7 @@ Categories mode."
928 (when goto-archive (todo-archive-mode)) 929 (when goto-archive (todo-archive-mode))
929 (set-window-buffer (selected-window) 930 (set-window-buffer (selected-window)
930 (set-buffer (find-buffer-visiting file0))) 931 (set-buffer (find-buffer-visiting file0)))
932 (if transient-mark-mode (deactivate-mark))
931 (unless todo-global-current-todo-file 933 (unless todo-global-current-todo-file
932 (setq todo-global-current-todo-file todo-current-todo-file)) 934 (setq todo-global-current-todo-file todo-current-todo-file))
933 (todo-category-number category) 935 (todo-category-number category)
@@ -1019,15 +1021,17 @@ empty line above the done items separator."
1019 (setq shown (progn 1021 (setq shown (progn
1020 (goto-char (point-min)) 1022 (goto-char (point-min))
1021 (re-search-forward todo-done-string-start nil t))) 1023 (re-search-forward todo-done-string-start nil t)))
1022 (if (not (pos-visible-in-window-p shown)) 1024 (if (pos-visible-in-window-p shown)
1023 (recenter) 1025 (goto-char opoint)
1024 (goto-char opoint))))))) 1026 (recenter)
1027 (if transient-mark-mode (deactivate-mark))))))))
1025 1028
1026(defun todo-toggle-view-done-only () 1029(defun todo-toggle-view-done-only ()
1027 "Switch between displaying only done or only todo items." 1030 "Switch between displaying only done or only todo items."
1028 (interactive) 1031 (interactive)
1029 (setq todo-show-done-only (not todo-show-done-only)) 1032 (setq todo-show-done-only (not todo-show-done-only))
1030 (todo-category-select)) 1033 (todo-category-select)
1034 (if transient-mark-mode (deactivate-mark)))
1031 1035
1032(defun todo-toggle-item-highlighting () 1036(defun todo-toggle-item-highlighting ()
1033 "Highlight or unhighlight the todo item the cursor is on." 1037 "Highlight or unhighlight the todo item the cursor is on."
@@ -2230,7 +2234,8 @@ made in the number or names of categories."
2230 (insert item)) 2234 (insert item))
2231 (kill-buffer) 2235 (kill-buffer)
2232 (unless (eq (current-buffer) buf) 2236 (unless (eq (current-buffer) buf)
2233 (set-window-buffer (selected-window) (set-buffer buf)))) 2237 (set-window-buffer (selected-window) (set-buffer buf)))
2238 (if transient-mark-mode (deactivate-mark)))
2234 ;; We got here via `F e'. 2239 ;; We got here via `F e'.
2235 (when (todo-check-format) 2240 (when (todo-check-format)
2236 ;; FIXME: separate out sexp check? 2241 ;; FIXME: separate out sexp check?
@@ -3839,6 +3844,7 @@ face."
3839 (goto-char (point-min)) 3844 (goto-char (point-min))
3840 (while (not (eobp)) 3845 (while (not (eobp))
3841 (setq match (re-search-forward regex nil t)) 3846 (setq match (re-search-forward regex nil t))
3847 (if (and match transient-mark-mode) (deactivate-mark))
3842 (goto-char (line-beginning-position)) 3848 (goto-char (line-beginning-position))
3843 (unless (or (equal (point) 1) 3849 (unless (or (equal (point) 1)
3844 (looking-at (concat "^" (regexp-quote todo-category-beg)))) 3850 (looking-at (concat "^" (regexp-quote todo-category-beg))))
@@ -4081,6 +4087,7 @@ regexp items."
4081 t 4087 t
4082 todo-show-with-done))) 4088 todo-show-with-done)))
4083 (todo-category-select)) 4089 (todo-category-select))
4090 (if transient-mark-mode (deactivate-mark))
4084 (goto-char (car found)))))) 4091 (goto-char (car found))))))
4085 4092
4086(defvar todo-multiple-filter-files nil 4093(defvar todo-multiple-filter-files nil
@@ -5314,6 +5321,7 @@ Overrides `diary-goto-entry'."
5314 nil t) 5321 nil t)
5315 (todo-category-number (match-string 1)) 5322 (todo-category-number (match-string 1))
5316 (todo-category-select) 5323 (todo-category-select)
5324 (if transient-mark-mode (deactivate-mark))
5317 (goto-char opoint)))))) 5325 (goto-char opoint))))))
5318 5326
5319(add-function :override diary-goto-entry-function #'todo-diary-goto-entry) 5327(add-function :override diary-goto-entry-function #'todo-diary-goto-entry)