org-store-link does not work in gnus article mode (messages)

2022-01-01 Thread Uwe Brauer
Hi  

I thought this worked a while ago, but in a gnus article buffer I tried to use 
org-store-link and received

(Running Emacs Master and org-mode master (some weeks old))

Debugger entered--Lisp error: (void-function org-fixup-message-id-for-http)
  
org-fixup-message-id-for-http("8ad92378cff625ebc8020dc45afdaadef484a3a3.ca...@web.de")
  org-gnus-article-link("nntp+news.gmane.io:gmane.comp.finance.ledger.general" 
"gmane.comp.finance.ledger.general" 
"8ad92378cff625ebc8020dc45afdaadef484a3a3.camel@web..." nil)
  org-gnus-store-link()
  org-store-link(nil 1)
  funcall-interactively(org-store-link nil 1)
  call-interactively(org-store-link nil nil)
  command-execute(org-store-link)




Re: [PATCH] ob-shell-test, test-ob-shell and introduction

2022-01-01 Thread Matt
Apologies for the book.  I've been sitting on this stuff for two months and am 
wondering how to proceed.

IANAL but AFAIK/CT, my contract contains an exception for making contributions 
to projects like Org. I've gotten confirmation from my manager and by HR.  
However, until the CEO signs the FSF disclaimer, I can't officially contribute. 
 I'm confident that I can publish changes (e.g. to a personal website); the FSF 
just can't accept my changes (yet).

I could start working on ob-shell.el separately now and publish that myself. 
It's not clear how I would then contribute those changes back once I'm cleared 
by the FSF.  I'm inclined towards some refactoring and I'm not sure how I could 
break that down in such a way that if it took two more months to get the 
copyright stuff worked out that anyone could make sense of the changes.  I 
would much prefer to gradually submit patches, discuss them, and then 
eventually have them merged in turn.  If I have a heap of changes elsewhere, I 
feel like it would be harder to have a conversion about them.

Regardless, I think I should define test cases first.  If those are considered 
valid, then any refactoring would be moot if they pass, right?  With (agreed 
upon) test cases, it shouldn't matter if I refactor as long as functionality 
remains the same?

Overall, what advice do you have?

It looks to me like ob-shell.el could use some love in other respects besides 
async evaluation.  I've detailed where below, partly for my own organization 
and partly for posterity, but mainly because this isn't my house, so to speak, 
and I don't want to barge in and start rearranging the furniture and eating 
whatever's in the fridge.  Or, is it like Worg in that once I have the keys I 
can drive where I like, so long as there're no crashes?

I'm interested in people's thoughts on these notes on ob-shell.el:

* Tests
There are several code paths, like shebang, cmdline, and basic execution, which 
don't always have something to do with one another in the code.  Having tests 
would be really helpful to make sure everything jives.  Before doing anything 
with the code base, I intend to create tests for all the functionality.

* 2D-array
I documented two options for the =:var= header[fn:1]. The ob-shell.el code 
actually defines a third option for 2D-arrays.  I couldn't get it to work.  It 
was one of several things not documented anywhere, at least as far as I could 
find, and which I had to figure out straight from the code.  Between not being 
great at shell scripting and having a hard time deciphering that ob-shell.el 
code, I'm not sure 2D-arrays are actually fully or correctly implemented.

* M-up behavior <>
The =org-babel-load-session:shell= code path only works when M-up is used on a 
code block[fn:2]. Is M-up actually documented anywhere?  Furthermore, the 
=org-babel-load-session:shell= only works for the "shell" language, which is 
not actually a "proper" shell (i.e. it's not listed in 
=org-babel-shell-names=). The M-up defaults to using $ESHELL or shell-file-name 
through the =shell= command.

For example, try calling M-up on these:

#+comment: (opaquely) calls the system shell
#+begin_src shell :session my-shell
echo "hello, world!"  #+end_src

#+comment: fails
#+begin_src sh :session my-sh
echo "hello, world!"  #+end_src

#+comment: fails
#+begin_src bash :session my-bash
echo "hello, world!"  #+end_src

To fix this, there needs to be an =org-babel-load-session:= for each 
language in =org-babel-shell-names=.  This would probably make the most sense 
in =org-babel-shell-initialize=.  However, that function 
[[org-babel-shell-initialize][needs attention]].

* Refactoring <>
The ob-shell.el code appears inconsistent to me.  Clearly, this is somewhat 
subjective.  I've tried to give a rationale for each point to make it less so.  
My goal is to be maintainer of ob-shell.el, but that's not forever.  These 
things were an obstacle for me and my aim is to remove them for the next person.

** =org-babel-shell-initialize= <>
As alluded to elsewhere, =org-babel-shell-initialize= doesn't appear to adhere 
to the (elisp) Coding Conventions,

#+begin_quote
   • Constructs that define a function or variable should be macros, not 
functions, and their names should start with ‘define-’.  The macro should 
receive the name to be defined as the first argument.  That will help various 
tools find the definition automatically.  Avoid constructing the names in the 
macro itself, since that would confuse these tools.  #+end_quote

The =org-babel-shell-initialize= function defines =org-babel-execute:=, 
=org-babel-variable-assignments:=, and 
=org-babel-default-header-args:= for the "languages" in 
=org-babel-shell-names=.  As it stands, that =org-babel-shell-initialize= is a 
function does no harm (aside from being confusing by way of straying from 
convention).  However, if the [[M-up][M-up]] issue is to be resolved, it seems 
to me that =org-babel-shell-initialize= should be 

[PATCH] Re: Escaping org mode date properties

2022-01-01 Thread Ihor Radchenko
Eduardo Suarez-Santana  writes:

>> I am unable to reproduce. What are your Org and Emacs versions?
>
> I'm using Spacemacs (develop branch).
>
> - Emacs 27.2
> - Org 9.5.1
>
> I get a weird behaviour about it. These events appear when I start emacs. If I
> edit somehow these entries they disappear from the agenda view (until I start
> emacs again).

Confirmed

Thanks for the hint! I was able to reproduce entries disappearing from
agenda view.

The culprit is org-in-src-block-p. It relies on fontification to
determine if we are inside a code block. However, when you strip a code
block with SCHEDULED inside from begin/end lines, the fontification
properties do not get removed.

The attached patch should fix the issue. However, I need several people
to test it first - the patch will make things slower without cache.

>> Depending what you want, you may use org-agenda-todo-list-sublevels or
>> add agenda filter excluding specific tags that you can then use to mark
>> undesired subtrees.
>
> Could be a workaround. Thanks a lot.
>
> Anyway it looks like a bug to me.

For future. You will make things much easier if you provide a clear
sequence of steps to reproduce the problem. Your original report is not
reproducible if I just copy-paste your code into a new org file. I had
to guess what you did in order to see the problem.

Best,
Ihor

>From 0f046ebe94bbe84ac2f167feda527022bfac4e6e Mon Sep 17 00:00:00 2001
Message-Id: <0f046ebe94bbe84ac2f167feda527022bfac4e6e.1641091542.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Sun, 2 Jan 2022 10:30:03 +0800
Subject: [PATCH] org-in-src-block-p: Do not rely on fontification

* lisp/org.el (org-in-src-block-p): New optional argument ELEMENT.
The code now relies on org-element API to check if we are inside
src-block.

Fixes https://list.orgmode.org/20220101200103.gb29...@itccanarias.org/T/#t
---
 lisp/org.el | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 8c09a057c..7ea8d65f3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18731,17 +18731,19 @@ (defun org-uuidgen-p (s)
   "Is S an ID created by UUIDGEN?"
   (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s)))
 
-(defun org-in-src-block-p ( inside)
+(defun org-in-src-block-p ( inside element)
   "Whether point is in a code source block.
 When INSIDE is non-nil, don't consider we are within a source
-block when point is at #+BEGIN_SRC or #+END_SRC."
-  (let ((case-fold-search t))
-(or (and (eq (get-char-property (point) 'src-block) t))
-	(and (not inside)
-	 (save-match-data
-	   (save-excursion
-		 (beginning-of-line)
-		 (looking-at ".*#\\+\\(begin\\|end\\)_src")))
+block when point is at #+BEGIN_SRC or #+END_SRC.
+When ELEMENT is provided, it is considered to be element at point."
+  (save-match-data (setq element (or element (org-element-at-point
+  (when (eq 'src-block (org-element-type element))
+(or (not inside)
+(not (or (= (line-beginning-position)
+  (org-element-property :post-affiliated element))
+   (= (1+ (line-end-position))
+  (- (org-element-property :end element)
+ (org-element-property :post-blank element
 
 (defun org-context ()
   "Return a list of contexts of the current cursor position.
-- 
2.34.1



[BUG] wrong date returned by org-read-date in table formula [9.5.2 (release_9.5.2-3-geb9f34 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2022-01-01 Thread Steven Bagley
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


The following example, reading from "-Tue", inserts the wrong date into the 
table. Last Tuesday is not Jan 1, 2022.

| date | (0 55 17 1 1 2022 6 nil -28800) |
#+TBLFM: @1$2='(format "%s" (decode-time (org-read-date nil t "-Tue")))

However, using "-tue" (all lowercase) instead does work correctly.

The problem is that org-table-eval-formula binds case-fold-search to nil, which 
breaks the regex search near the top of org-read-date-get-relative.


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin21.2.0, NS 
appkit-2113.20 Version 12.1 (Build 21C52))
 of 2022-01-01
Package: Org mode version 9.5.2 (release_9.5.2-3-geb9f34 @ 
/Applications/Emacs.app/Contents/Resources/lisp/org/)




bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2022-01-01 Thread General discussions about Org-mode.
"Berry, Charles"  writes:

> Max,
>
>> On Dec 31, 2021, at 4:05 AM, Max Nikulin  wrote:
>> 
>> 
>> Should some function a macro be provided to facilitate declaring
>> languages as data format (config files, JSON, YAML, etc.) rather than
>> executable source code?
>
> I think we already have this in the form of export blocks, viz.

While "export" blocks do support "org-edit-special" and more, they do
not support ":tangle", right?  For BibTeX, one needs to tangle.

Rudy
-- 
"I love deadlines. I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2022-01-01 Thread General discussions about Org-mode.
Max Nikulin  writes:

> On 30/12/2021 15:00, Rudolf Adamkovič wrote:
>> 
>> #+property: header-args:bibtex+ :eval yes
>
> Why do you set ":eval yes" explicitly for bibtex if you believe that
> it should not be executed?

Plain old stupidity.  :)

Rudy
-- 
"Programming reliably --- must be an activity of an undeniably
mathematical nature […] You see, mathematics is about thinking, and
doing mathematics is always trying to think as well as possible." --
Edsger W. Dijkstra (1981)

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





Re: Escaping org mode date properties

2022-01-01 Thread Eduardo Suarez-Santana
On Sat, Jan 01, 2022 at 11:10:30PM +0800, Ihor Radchenko wrote:
> Eduardo Suarez  writes:
> 
> > The next code snippet makes the entry to appear in the agenda:
> >
> > * sample date code
> > #+begin_src org
> > SCHEDULED: <2015-02-16 Mon .+2d>
> > #+end_src
> 
> I am unable to reproduce. What are your Org and Emacs versions?

I'm using Spacemacs (develop branch).

- Emacs 27.2
- Org 9.5.1

I get a weird behaviour about it. These events appear when I start emacs. If I
edit somehow these entries they disappear from the agenda view (until I start
emacs again).

> > On the other hand, I wonder whether it is possible to make a subtree to be
> > ignored by the agenda views.
> 
> Depending what you want, you may use org-agenda-todo-list-sublevels or
> add agenda filter excluding specific tags that you can then use to mark
> undesired subtrees.

Could be a workaround. Thanks a lot.

Anyway it looks like a bug to me.



Re: [BUG] org-cite-insert does not like @conference [9.5.2 (release_9.5.2 @ ~/.emacs.d/git/org-mode/lisp/)]

2022-01-01 Thread András Simonyi
Dear All,

On Sat, 1 Jan 2022 at 14:53, Julien Chastang
 wrote:

> I have been experimenting with org-cite. I noticed that I can insert 
> (org-cite-insert) all bibtex types *except* for @conference. [...]
> yet I believe @conference is a valid bibtex type. I noticed that 
> org-bibtex-types has an empty description for the conference type, but I 
> don't know if that has anything to do with it. I hope I have not missed 
> anything obvious.

it seems that 'conference' is indeed a valid BibTeX entry type, but is
only an alias of 'inproceedings' and was included for some (nowadays
obscure?) compatibility reasons, while biblatex doesn't support it at
all.
Consequently, you can simply use 'inproceedings' instead. If this is
not an option, then you can force org-cite to parse a bibliography as
a (strict) BibTeX bibliography instead of the default biblatex parsing
by using the 'bibtex' extension in the file's name, this should cause
'conference' entries to be treated as valid.

best wishes,
András



org-journal key-bind confusion

2022-01-01 Thread Colin Baxter 


There appears to be confusion between "org-journal-new-entry" and
"org-goto". My ME is:

1. emacs -Q  (I used emacs-29.0.50)
2. M-x load-library 
3. /path/to/org-journal.el 
4. C-h c 
5. C-c C-j
6. "C-c C-j runs the command org-journal-new-entry"
7. Create an org file (say "test.org") from C-x C-f
8. C-h c
9. C-c C-j
10. "C-c C-j runs the command org-goto"

Best wishes,

Colin Baxter.




Re: Escaping org mode date properties

2022-01-01 Thread Ihor Radchenko
Eduardo Suarez  writes:

> The next code snippet makes the entry to appear in the agenda:
>
> * sample date code
> #+begin_src org
> SCHEDULED: <2015-02-16 Mon .+2d>
> #+end_src

I am unable to reproduce. What are your Org and Emacs versions?

> Any hint?

Update org?

> On the other hand, I wonder whether it is possible to make a subtree to be
> ignored by the agenda views.

Depending what you want, you may use org-agenda-todo-list-sublevels or
add agenda filter excluding specific tags that you can then use to mark
undesired subtrees.

Best,
Ihor



[SOLVED] Re: [BUG] ob-python :results value pp does not working

2022-01-01 Thread Christopher M. Miles

Jack Kamm  writes:

> Hi Christopher,
>
>> This might need to mentioned in Org manual and in ob-python.el source
>> code with comment. WDYT?
>
> The main documentation for this is in the Worg page for ob-python, in
> particular see the section "Return values":
>
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html
>
> I think that is the appropriate place to put this sort of documentation
> (i.e. usage of specific babel languages). However, the clarity of this
> documentation could be improved; contributions on that would be very
> welcome.
>
> In addition, this is also mentioned in the Org manual on return values
> in Org babel, "Results of Evaluation":
>
> For languages like Python, an explicit ‘return’ statement is
> mandatory when using ‘:results value’.

I see, thanks. problem solved.

-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[BUG] org-cite-insert does not like @conference [9.5.2 (release_9.5.2 @ ~/.emacs.d/git/org-mode/lisp/)]

2022-01-01 Thread Julien Chastang
Hello,

I have been experimenting with org-cite. I noticed that I can insert
(org-cite-insert) all bibtex types *except* for @conference. For example:

@misc{foo123,
  author =   {joe},
  title ={baba},
  booktitle ={cacab},
  year = 1999
}

works fine (and all other types that I experimented with) leading to
a valid [cite:@foo123]

but not

@conference{foo123,
  author =   {joe},
  title ={baba},
  booktitle ={cacab},
  year = 1999
}

yet I believe @conference is a valid bibtex type. I noticed
that org-bibtex-types has an empty description for the conference type, but
I don't know if that has anything to do with it. I hope I have not missed
anything obvious.

Thank you very much for maintaining org.

-Julien


Emacs  : GNU Emacs 27.2 (build 1, x86_64-apple-darwin20.6.0, X toolkit,
cairo version 1.16.0, Xaw scroll bars)
 of 2021-09-30
Package: Org mode version 9.5.2 (release_9.5.2 @
/Users//.emacs.d/git/org-mode/lisp/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-babel-clojure-backend 'cider
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '(jc/fix-inline-images)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id
 org-mode-hook '(org-bullets-mode
 (closure
  (org-agenda-skip-regexp org-table1-hline-regexp
   org-table-tab-recognizes-table\.el
org-table-dataline-regexp
   org-table-any-border-regexp
   org-agenda-restriction-lock-overlay
   org-agenda-overriding-restriction org-agenda-diary-file
   org-complex-heading-regexp t)
  nil (setq imenu-create-index-function
'org-imenu-get-tree))
 (lambda nil (local-set-key (kbd " SPC") 'ace-jump-mode))
 (closure
  (org--rds reftex-docstruct-symbol
org-element-greater-elements
   visual-fill-column-width org-clock-history
   org-agenda-current-date org-with-time org-defdecode
org-def
   org-read-date-inactive org-ans2 org-ans1
   org-columns-current-fmt-compiled org-clock-current-task
   org-clock-effort org-agenda-skip-function
   org-agenda-skip-comment-trees org-agenda-archives-mode
   org-end-time-was-given org-time-was-given
org-log-note-extra
   org-log-note-purpose org-log-post-message
   org-last-inserted-timestamp org-last-changed-timestamp
   org-entry-property-inherited-from
org-blocked-by-checkboxes
   org-state org-agenda-headline-snapshot-before-repeat
   org-agenda-buffer-name org-agenda-start-on-weekday
   org-agenda-buffer-tmp-name org-priority-regexp
   org-mode-abbrev-table org-mode-syntax-table
   buffer-face-mode-face org-tbl-menu org-org-menu
   org-struct-menu org-entities org-last-state
   org-id-track-globally org-clock-start-time texmathp-why
   remember-data-file
org-agenda-tags-todo-honor-ignore-options
   iswitchb-temp-buflist calc-embedded-open-mode
   calc-embedded-open-formula calc-embedded-close-formula
   align-mode-rules-list org-emphasis-alist
   org-emphasis-regexp-components
org-export-registered-backends
   org-modules crm-separator org-babel-load-languages
   org-id-overriding-file-name
org-indent-indentation-per-level
   org-element-paragraph-separate org-inlinetask-min-level
t)
  nil
  (add-hook 'change-major-mode-hook 'org-show-all 'append
'local)
  )
 (closure
  (org-src-window-setup *this*
   org-babel-confirm-evaluate-answer-no
   org-babel-tangle-uncomment-comments
   org-src-preserve-indentation org-src-lang-modes
   org-edit-src-content-indentation
org-babel-library-of-babel t)
  nil
  (add-hook 'change-major-mode-hook
#'org-babel-show-result-all
   'append 'local)
  )
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-odt-format-drawer-function '(closure
  (hfy-user-sheet-assoc hfy-html-quote-regex
   hfy-html-quote-map hfy-face-to-css
   

Escaping org mode date properties

2022-01-01 Thread Eduardo Suarez
The next code snippet makes the entry to appear in the agenda:

* sample date code
#+begin_src org
SCHEDULED: <2015-02-16 Mon .+2d>
#+end_src

I have also tried without success:
- using begin_example,
- preceding with comma,
- special edit,
- starting the line with colon.

Any hint?

On the other hand, I wonder whether it is possible to make a subtree to be
ignored by the agenda views.



Re: [PATCH] Re: [BUG] Underlined text in parentheses is not exported correctly

2022-01-01 Thread Juan Manuel Macías
Ihor Radchenko writes:

> However, thinking about it more, I feel that prioritising underline
> should work better. The underline parser recently got changed into a
> stricter version. Now, only underlines starting after spaces,-,(,',",
> and { are recognised as an underlines.
>
> So, the attached patch is changing the priority of the parsing.
> Maybe Nicolas knows some tricky cases when the patch makes things wrong,
> but those cases are certainly not covered by tests.

Great! I vote for this patch, I think it is a necessary addition. In my
case I have not found any error.

Best regards,

Juan Manuel 



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/)]

2022-01-01 Thread Allen Li
On Sat, Jan 1, 2022 at 9:31 AM Allen Li  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).
From 16ff89c309b8bd9aa11183cc9620c56ed96e3ff7 Mon Sep 17 00:00:00 2001
From: Allen Li 
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



[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/)]

2022-01-01 Thread Allen Li
The docstring for org-todo (C-c C-t) is unclear about the handling of -
prefix compared to -1 prefix.

Here is the relevant part of the docstring:

With ‘C-u’ prefix ARG, force logging the state change and take a
logging note.
With a ‘C-u C-u’ prefix, switch to the next set of TODO keywords (nextset).
Another way to achieve this is ‘S-C-’.
With a ‘C-u C-u C-u’ prefix, circumvent any state blocking.
With numeric prefix arg, switch to the Nth state.

With a numeric prefix arg of 0, inhibit note taking for the change.
With a numeric prefix arg of -1, cancel repeater to allow marking as DONE.

The actual behavior is that - (along with any other negative numeric
prefix excluding -1) switches to the first state and -1 cancels
the repeater.

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.

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
cairo version 1.17.4)
 of 2021-03-26
Package: Org mode version 9.5.2 (9.5.2-gfbff08 @ 
/home/ionasal/.emacs.d/elpa/org-9.5.2/)