GNU bug report logs -
#48199
28.0.50; Org mode surprisingly usurps Calendar key binding
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Mon, 3 May 2021 16:08:02 UTC
Severity: normal
Merged with 51815
Found in version 28.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48199 in the body.
You can then email your comments to 48199 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#48199
; Package
emacs
.
(Mon, 03 May 2021 16:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 03 May 2021 16:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
By default `i' is a prefix key in calendar-mode for commands that insert
diary entries. But if you happen to display a buffer that activates
org-mode machinery, then `i' in calendar-mode becomes bound to
org-agenda-diary-entry and typing it can raise a wrong-type-argument
error. This can happen by visiting a file in Org mode. To reproduce:
0. emacs -Q
1. (sanity check:) Type `M-x calendar RET' and then in the Calendar
buffer type `i C-h': the *Help* buffer displays all the commands
invoked by `i' plus one or more keys.
2. Visit the file `ORG-NEWS' (e.g. by typing `C-h n C-x C-f O TAB RET').
3. Type `M-x calendar RET' and then in the Calendar buffer type `i'
=> Wrong type argument: commandp, org-agenda-diary-entry
This can also catch users by surprise, e.g. in Gnus. To reproduce,
replace step 2 above by the following:
2a. Type `M-x gnus', answer `y' at the prompt; in the Gnus buffer type
`B RET news.gmane.io RET'.
2b. In the *Gnus Browse Server* buffer type `C-s humani' to put point on
the gmane.emacs.humanities group; type RET to enter it.
2c. Type `j <87sg6wulu6.fsf <at> localhost> RET', which displays an article
containing an org-mode source code block.
3. As above, resulting in the same error (when done from emacs -Q).
The Org mode manual (info "(org) Agenda Commands") does describe its use
of the `i' binding in the Calendar, and if Org mode has its own versions
of the commands that use `i' by default in calendar-mode, then
overriding the calendar-mode bindings is no problem for Org Agenda
users, but those bindings should not be overridden just by displaying a
buffer that happens to be in org-mode or happens to contain an Org
source code block.
In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo version 1.17.3)
of 2021-04-26 built on strobe-jhalfs
Repository revision: 40c71e574ad27deee003a0850a40171750234d59
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Linux From Scratch SVN-20200401
Configured using:
'configure --with-xwidgets 'CFLAGS=-Og -g3'
PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3
ZLIB
Information forwarded
to
bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
:
bug#48199
; Package
emacs,org-mode
.
(Sun, 09 May 2021 17:22:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 48199 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
[I added emacs-orgmode <at> gnu.org in the Cc:]
On Mon, 03 May 2021 18:07:25 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
> By default `i' is a prefix key in calendar-mode for commands that insert
> diary entries. But if you happen to display a buffer that activates
> org-mode machinery, then `i' in calendar-mode becomes bound to
> org-agenda-diary-entry and typing it can raise a wrong-type-argument
> error. This can happen by visiting a file in Org mode. To reproduce:
>
> 0. emacs -Q
> 1. (sanity check:) Type `M-x calendar RET' and then in the Calendar
> buffer type `i C-h': the *Help* buffer displays all the commands
> invoked by `i' plus one or more keys.
> 2. Visit the file `ORG-NEWS' (e.g. by typing `C-h n C-x C-f O TAB RET').
> 3. Type `M-x calendar RET' and then in the Calendar buffer type `i'
> => Wrong type argument: commandp, org-agenda-diary-entry
>
> This can also catch users by surprise, e.g. in Gnus. To reproduce,
> replace step 2 above by the following:
>
> 2a. Type `M-x gnus', answer `y' at the prompt; in the Gnus buffer type
> `B RET news.gmane.io RET'.
> 2b. In the *Gnus Browse Server* buffer type `C-s humani' to put point on
> the gmane.emacs.humanities group; type RET to enter it.
> 2c. Type `j <87sg6wulu6.fsf <at> localhost> RET', which displays an article
> containing an org-mode source code block.
> 3. As above, resulting in the same error (when done from emacs -Q).
>
> The Org mode manual (info "(org) Agenda Commands") does describe its use
> of the `i' binding in the Calendar, and if Org mode has its own versions
> of the commands that use `i' by default in calendar-mode, then
> overriding the calendar-mode bindings is no problem for Org Agenda
> users, but those bindings should not be overridden just by displaying a
> buffer that happens to be in org-mode or happens to contain an Org
> source code block.
The following patch fixes the problem for me:
[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 1f4e2e8308..b68e5b58fc 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -1151,8 +1151,8 @@ org--setup-calendar-bindings
((guard (not (lookup-key calendar-mode-map "c")))
(local-set-key "c" #'org-calendar-goto-agenda))
(_ nil))
- (unless (and (boundp 'org-agenda-diary-file)
- (eq org-agenda-diary-file 'diary-file))
+ (when (and (boundp 'org-agenda-diary-file)
+ (not (eq org-agenda-diary-file 'diary-file)))
(local-set-key org-calendar-insert-diary-entry-key
#'org-agenda-diary-entry)))
[Message part 3 (text/plain, inline)]
I have to admit, though, that I don't understand why the version with
`unless' results in the bug, since in the recipes I gave
org-agenda-diary-file is unbound and, indeed, when I instrument the
unpatched org--setup-calendar-bindings and step through it on calling
`calendar', the org-calendar-insert-diary-entry-key local-set-key call
is skipped as expected. But "c" does get locally set, so if I type `c'
in the Calendar buffer, it displays the Org Agenda, and if I then type
`i' in the Calendar buffer, I now get prompted with a choice menu for
the type of diary entry, but whichever I choose, the result is the
user-error "Don't know which date to use for diary entry", evidently
because there is indeed no org-agenda-diary-file with the necessary text
properties. So somehow the "i" binding is made even though the code
should prevent this (and does under Edebug but not when executed
normally).
With the above patch, after typing `c' in the Calendar buffer, `i' is
still unbound, as it should be, but if I changed the value of
org-agenda-diary-file from the default 'diary-file to some file, then
`i' works with Org Agenda as documented.
Steve Berman
Reply sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
You have taken responsibility.
(Fri, 25 Jun 2021 09:16:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
bug acknowledged by developer.
(Fri, 25 Jun 2021 09:16:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 48199-done <at> debbugs.gnu.org (full text, mbox):
On Sun, 09 May 2021 19:21:31 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
> [I added emacs-orgmode <at> gnu.org in the Cc:]
>
> On Mon, 03 May 2021 18:07:25 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
>
>> By default `i' is a prefix key in calendar-mode for commands that insert
>> diary entries. But if you happen to display a buffer that activates
>> org-mode machinery, then `i' in calendar-mode becomes bound to
>> org-agenda-diary-entry and typing it can raise a wrong-type-argument
>> error. This can happen by visiting a file in Org mode. To reproduce:
>>
>> 0. emacs -Q
>> 1. (sanity check:) Type `M-x calendar RET' and then in the Calendar
>> buffer type `i C-h': the *Help* buffer displays all the commands
>> invoked by `i' plus one or more keys.
>> 2. Visit the file `ORG-NEWS' (e.g. by typing `C-h n C-x C-f O TAB RET').
>> 3. Type `M-x calendar RET' and then in the Calendar buffer type `i'
>> => Wrong type argument: commandp, org-agenda-diary-entry
>>
>> This can also catch users by surprise, e.g. in Gnus. To reproduce,
>> replace step 2 above by the following:
>>
>> 2a. Type `M-x gnus', answer `y' at the prompt; in the Gnus buffer type
>> `B RET news.gmane.io RET'.
>> 2b. In the *Gnus Browse Server* buffer type `C-s humani' to put point on
>> the gmane.emacs.humanities group; type RET to enter it.
>> 2c. Type `j <87sg6wulu6.fsf <at> localhost> RET', which displays an article
>> containing an org-mode source code block.
>> 3. As above, resulting in the same error (when done from emacs -Q).
>>
>> The Org mode manual (info "(org) Agenda Commands") does describe its use
>> of the `i' binding in the Calendar, and if Org mode has its own versions
>> of the commands that use `i' by default in calendar-mode, then
>> overriding the calendar-mode bindings is no problem for Org Agenda
>> users, but those bindings should not be overridden just by displaying a
>> buffer that happens to be in org-mode or happens to contain an Org
>> source code block.
>
> The following patch fixes the problem for me:
>
> diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
> index 1f4e2e8308..b68e5b58fc 100644
> --- a/lisp/org/org-compat.el
> +++ b/lisp/org/org-compat.el
> @@ -1151,8 +1151,8 @@ org--setup-calendar-bindings
> ((guard (not (lookup-key calendar-mode-map "c")))
> (local-set-key "c" #'org-calendar-goto-agenda))
> (_ nil))
> - (unless (and (boundp 'org-agenda-diary-file)
> - (eq org-agenda-diary-file 'diary-file))
> + (when (and (boundp 'org-agenda-diary-file)
> + (not (eq org-agenda-diary-file 'diary-file)))
> (local-set-key org-calendar-insert-diary-entry-key
> #'org-agenda-diary-entry)))
>
>
>
> I have to admit, though, that I don't understand why the version with
> `unless' results in the bug, since in the recipes I gave
> org-agenda-diary-file is unbound and, indeed, when I instrument the
> unpatched org--setup-calendar-bindings and step through it on calling
> `calendar', the org-calendar-insert-diary-entry-key local-set-key call
> is skipped as expected. But "c" does get locally set, so if I type `c'
> in the Calendar buffer, it displays the Org Agenda, and if I then type
> `i' in the Calendar buffer, I now get prompted with a choice menu for
> the type of diary entry, but whichever I choose, the result is the
> user-error "Don't know which date to use for diary entry", evidently
> because there is indeed no org-agenda-diary-file with the necessary text
> properties. So somehow the "i" binding is made even though the code
> should prevent this (and does under Edebug but not when executed
> normally).
>
> With the above patch, after typing `c' in the Calendar buffer, `i' is
> still unbound, as it should be, but if I changed the value of
> org-agenda-diary-file from the default 'diary-file to some file, then
> `i' works with Org Agenda as documented.
>
> Steve Berman
On Thu, 24 Jun 2021 17:04:02 +0200 Nicolas Goaziou <mail <at> nicolasgoaziou.fr> wrote:
> Hello,
>
> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> Yeah, the next time Org is merged to the Emacs master branch, forcing me
>> to first stash and then reapply my patch locally, I'll ask if anyone
>> objects to the patch being committed to master.
>
> Sure, go ahead.
Thanks, done in commit 19f2f26 on master. Closing the bug.
Steve Berman
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 23 Jul 2021 11:24:09 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Yuchen Pei <hi <at> ypei.me>
to
control <at> debbugs.gnu.org
.
(Thu, 26 Aug 2021 07:39:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
:
bug#48199
; Package
emacs,org-mode
.
(Fri, 27 Aug 2021 03:33:01 GMT)
Full text and
rfc822 format available.
Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Looks like this email hadn't go through before I unarchived the
bug. Apologies for any duplicate messages.
Yuchen Pei <hi <at> ypei.me> writes:
> This bug seems to be still around, as it just happened to
> me. Steps to
> reproduce:
>
> - Build a recent version e.g. commit efaed29f3d with `make`
> - ./src/emacs
> - M-x calendar RET
> - i
>
> results in "command-execute: Wrong type argument: commandp,
> org-agenda-diary-entry". Can anyone else reproduce it?
--
Best,
Yuchen
PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0
<https://ypei.me/assets/ypei-pubkey.txt>
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
:
bug#48199
; Package
emacs,org-mode
.
(Fri, 27 Aug 2021 03:33:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
:
bug#48199
; Package
emacs,org-mode
.
(Fri, 27 Aug 2021 03:38:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 48199 <at> debbugs.gnu.org (full text, mbox):
Yuchen Pei <hi <at> ypei.me> writes:
>> This bug seems to be still around, as it just happened to me. Steps
>> to
>> reproduce:
>>
>> - Build a recent version e.g. commit efaed29f3d with `make`
>> - ./src/emacs
>> - M-x calendar RET
>> - i
>>
>> results in "command-execute: Wrong type argument: commandp,
>> org-agenda-diary-entry". Can anyone else reproduce it?
I can't reproduce this with "emacs -Q", or after visiting etc/ORG-NEWS,
with the current Emacs trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
:
bug#48199
; Package
emacs,org-mode
.
(Fri, 27 Aug 2021 04:34:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 48199 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Yuchen Pei <hi <at> ypei.me> writes:
>
>>> This bug seems to be still around, as it just happened to
>>> me. Steps
>>> to
>>> reproduce:
>>>
>>> - Build a recent version e.g. commit efaed29f3d with `make`
>>> - ./src/emacs
>>> - M-x calendar RET
>>> - i
>>>
>>> results in "command-execute: Wrong type argument: commandp,
>>> org-agenda-diary-entry". Can anyone else reproduce it?
>
> I can't reproduce this with "emacs -Q", or after visiting
> etc/ORG-NEWS,
> with the current Emacs trunk.
You are right. I add `-Q` to the emacs invocation and the problem
is gone. I'm gonna try to re-archive this bug.
--
Best,
Yuchen
PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0
<https://ypei.me/assets/ypei-pubkey.txt>
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Yuchen Pei <hi <at> ypei.me>
to
control <at> debbugs.gnu.org
.
(Fri, 27 Aug 2021 04:35:02 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 13 Nov 2021 23:13:02 GMT)
Full text and
rfc822 format available.
Forcibly Merged 48199 51815.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 13 Nov 2021 23:15:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
51815 <at> debbugs.gnu.org and Robert Thorpe <rt <at> robertthorpeconsulting.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 14 Nov 2021 01:30:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 13 Dec 2021 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 96 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.