From: Allen Li <darkfeline@felesatra.moe>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-todo (C-c C-t) bad negative prefix behavior [9.5.2 (9.5.2-gfbff08 @ /home/ionasal/.emacs.d/elpa/org-9.5.2/)]
Date: Sat, 1 Jan 2022 09:44:20 +0000 [thread overview]
Message-ID: <CADbSrJyUJ6CGEWqoGEWVY6sdffFV78Scg0u2Vi8Bm-dn2-AVdA@mail.gmail.com> (raw)
In-Reply-To: <80o84vol8s.fsf@felesatra.moe>
[-- Attachment #1.1: Type: text/plain, Size: 482 bytes --]
On Sat, Jan 1, 2022 at 9:31 AM Allen Li <darkfeline@felesatra.moe> wrote:
> It seems like the right fix here is to make - behave the same as -1, and
> raise a user error for any other negative numeric prefix, since it is
> likely not doing whatever the user wanted.
>
Attached a small patch fixing this, which I tested manually.
Feel free to remove the negative arg error if it's not desired (although I
don't think there is a use case for, e.g., typing M-- M-2 instead of M-1).
[-- Attachment #1.2: Type: text/html, Size: 782 bytes --]
[-- Attachment #2: 0001-org-Improve-org-todo-handling-of-negative-prefix-arg.patch --]
[-- Type: text/x-patch, Size: 1056 bytes --]
From 16ff89c309b8bd9aa11183cc9620c56ed96e3ff7 Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Sat, 1 Jan 2022 01:38:35 -0800
Subject: [PATCH] org: Improve org-todo handling of negative prefix args
* lisp/org.el (org-todo): Handle -1 prefix args consistently and error
on other negative args.
---
lisp/org.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index e2f315a4c..6b48f660e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9785,7 +9785,8 @@ 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 arg -1) (org-cancel-repeater) (setq arg nil))
+ (when (equal (prefix-numeric-value arg) -1) (org-cancel-repeater) (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
case-fold-search)
--
2.34.1
next prev parent reply other threads:[~2022-01-01 9:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-01 9:31 [BUG] org-todo (C-c C-t) bad negative prefix behavior [9.5.2 (9.5.2-gfbff08 @ /home/ionasal/.emacs.d/elpa/org-9.5.2/)] Allen Li
2022-01-01 9:44 ` Allen Li [this message]
2022-02-07 14:11 ` Ihor Radchenko
2022-06-18 6:10 ` Ihor Radchenko
2022-06-26 4:30 ` Allen Li
2022-06-26 4:49 ` Ihor Radchenko
2022-06-26 5:41 ` Allen Li
2022-06-26 6:31 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADbSrJyUJ6CGEWqoGEWVY6sdffFV78Scg0u2Vi8Bm-dn2-AVdA@mail.gmail.com \
--to=darkfeline@felesatra.moe \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).