summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Radchenko <yantar92@posteo.net>2024-08-06 10:21:18 +0200
committerIhor Radchenko <yantar92@posteo.net>2024-08-06 10:21:18 +0200
commit9c98b214605f20052b5297cba59b22d9ea5277bd (patch)
treea6f2dca17a2e2f30b5547325560e1109dd953d08
parent7fd80991c3d67acd05b3c18d51d99c2a6d135dfb (diff)
org-cancel-repeater: Cancel all the repeaters
* lisp/org.el (org-cancel-repeaters): Rename from `org-cancel-repeater' (leaving old name as an alias). Cancel all the repeaters instead of just the repeater in the first active timestamp. (org-todo): Use the new function name. * etc/ORG-NEWS (~org-cancel-repeater~ now cancels all the repeaters under inside entry): Announce the breaking change. The old version failed to cancel repeaters except the one in the very first active timestamp. If the first timestsamp did not have a repeaters, all other repeaters were ignored. Since the original use case of this is -1 prefix argument in `org-todo' with the intention to prevent switching back to TODO when marking done, cancelling all the repeaters makes more sense. Reported-by: Peter Solodov <solodov@gmail.com> Link: https://orgmode.org/list/87r0b4duzo.fsf@localhost
-rw-r--r--etc/ORG-NEWS9
-rw-r--r--lisp/org.el24
2 files changed, 22 insertions, 11 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 8a2a1ec0e..e7e3c0250 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -114,6 +114,15 @@ to dynamically generate the content of the resulting ~<head>~ tag in
the resulting HTML document.
** Miscellaneous
+*** ~org-cancel-repeater~ now cancels all the repeaters under inside entry
+
+Previously, ~org-cacnel-repeater~ only canceled repeater in the first
+active timestamp inside heading. Now, all the repeaters are
+cancelled.
+
+The function is renamed to ~org-cacnel-repeaters~ accordingly (the old
+name is still kept as an alias).
+
*** ~org-refile~ now saves current position to Org mark ring when jumping to heading
When ~org-refile~ is called with =C-u= or =C-u C-u= prefix argument
diff --git a/lisp/org.el b/lisp/org.el
index 362f0c158..bcab7ca86 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9374,21 +9374,23 @@ nil or a string to be used for the todo mark." )
(defvar org-block-entry-blocking ""
"First entry preventing the TODO state change.")
-(defun org-cancel-repeater ()
- "Cancel a repeater by setting its numeric value to zero."
+(defalias 'org-cancel-repeater #'org-cancel-repeaters)
+(defun org-cancel-repeaters ()
+ "Cancel all the repeaters in entry by setting their numeric value to zero."
(interactive)
(save-excursion
(org-back-to-heading t)
(let ((bound1 (point))
(bound0 (save-excursion (outline-next-heading) (point))))
- (when (and (re-search-forward
- (concat "\\(" org-scheduled-time-regexp "\\)\\|\\("
- org-deadline-time-regexp "\\)\\|\\("
- org-ts-regexp "\\)")
- bound0 t)
- (re-search-backward "[ \t]+\\(?:[.+]\\)?\\+\\([0-9]+\\)[hdwmy]"
- bound1 t))
- (replace-match "0" t nil nil 1)))))
+ (while (re-search-forward
+ (concat "\\(" org-scheduled-time-regexp "\\)\\|\\("
+ org-deadline-time-regexp "\\)\\|\\("
+ org-ts-regexp "\\)")
+ bound0 t)
+ (when (save-excursion
+ (re-search-backward "[ \t]+\\(?:[.+]\\)?\\+\\([0-9]+\\)[hdwmy]"
+ bound1 t))
+ (replace-match "0" t nil nil 1))))))
(defvar org-state)
;; FIXME: We should refactor this and similar dynamically scoped blocker flags.
@@ -9441,7 +9443,7 @@ When called through ELisp, arg is also interpreted in the following way:
nil cl
(when (org-invisible-p) (org-end-of-subtree nil t))))
(when (equal arg '(16)) (setq arg 'nextset))
- (when (equal (prefix-numeric-value arg) -1) (org-cancel-repeater) (setq arg nil))
+ (when (equal (prefix-numeric-value arg) -1) (org-cancel-repeaters) (setq arg nil))
(when (< (prefix-numeric-value arg) -1) (user-error "Prefix argument %d not supported" arg))
(let ((org-blocker-hook org-blocker-hook)
commentp