From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs,gmane.emacs.orgmode Subject: bug#48199: 28.0.50; Org mode surprisingly usurps Calendar key binding Date: Fri, 25 Jun 2021 11:15:30 +0200 Message-ID: <87zgvei9u5.fsf@gmx.net> References: <87eeen243m.fsf@gmx.net> <878s4nomas.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13788"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-orgmode@gnu.org To: 48199-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 25 11:17:41 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwhy1-0003NF-3B for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 25 Jun 2021 11:17:41 +0200 Original-Received: from localhost ([::1]:36346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwhy0-0007jk-3o for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 25 Jun 2021 05:17:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwhwQ-0005G9-KQ; Fri, 25 Jun 2021 05:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwhwQ-0004Tg-As; Fri, 25 Jun 2021 05:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwhwQ-000833-6q; Fri, 25 Jun 2021 05:16:02 -0400 Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Fri, 25 Jun 2021 09:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 48199 X-GNU-PR-Package: emacs,org-mode Mail-Followup-To: 48199@debbugs.gnu.org, stephen.berman@gmx.net, stephen.berman@gmx.net Original-Received: via spool by 48199-done@debbugs.gnu.org id=D48199.162461254230890 (code D ref 48199); Fri, 25 Jun 2021 09:16:02 +0000 Original-Received: (at 48199-done) by debbugs.gnu.org; 25 Jun 2021 09:15:42 +0000 Original-Received: from localhost ([127.0.0.1]:44852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwhw5-000829-MN for submit@debbugs.gnu.org; Fri, 25 Jun 2021 05:15:42 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:57707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwhw2-00081q-Vv for 48199-done@debbugs.gnu.org; Fri, 25 Jun 2021 05:15:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1624612532; bh=8npvVtZWaNe/jGmFRipz2oyHVi1XtuW4ZKc4cs93/78=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=Cm2nFZB6OZxIoAoElPVGXQZr4fbJJdDbVbldEsS0CpFKm+vMUJSDxKNR8hnVjDx9a 3oxImGptJbnBl+6KvUtxtnEBNmAiynJ6u2WK09Twewc5O4wTop9ahUuPDgekcecK8T Lm9tJNIHbWCsxeqUkgqsbfBQqJdmb+FHMSiuXcfk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobelfs ([178.1.126.121]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4s0t-1lvsSC47vz-001vvA; Fri, 25 Jun 2021 11:15:32 +0200 In-Reply-To: <878s4nomas.fsf@gmx.net> (Stephen Berman's message of "Sun, 09 May 2021 19:21:31 +0200") X-Provags-ID: V03:K1:Tts7J9Pq+t1MWNjK7hd5keYB0WZTqQsiccv+XyPYnOQH4aIZetT KqdFmItjWjY8kKogBdBShp4v6qRFbf4r7fKXVZqcYR8ZAVu1SvmGOIglX6JHwS86kJDwBsV 9aLObPZc55GO5BFnfCpbZ3wU1aejqnNDo7Jbiv5Z8VTq2XGwhdgZHN9gSVZcD/LFrHY2Bie Sfpz4ZEGEpzxhtrqxHP6g== X-UI-Out-Filterresults: notjunk:1;V03:K0:a4DzqTuixMg=:HY+SzbmTu+Ic8emcSpdXTj +CCNovElcpaIRVstOta2VsZs58tfP4Wyhu98OgP/A5JB9cHe4Db6Rpy19C4WUHkEMUQcqVwxC Lcl1u3DuPYSMxjPpEymLkzWtdA2hV6xEBXhmVex0QlrQN7b8/gX/eidDQ7QHIgn7VhbGUDhWy GtXB6t6zcXDZHpn6tEwkO6VpjnjgC1abt4Zwq/NbdJ/+EelZo+eV3NP8vbIdaHnDEGiciS6Qm 0f9zeQhvo8cPnQlQASLp1K6MwR8NVbucJCdl7ATdjL95FUNJxRNONKxmLAdGb6FLDVez3qZnO +zOp3a1vC7lX4EAgy5OPrxrSzP4qWWg82cKzXHJ4FyHQaoYU9JnWCqBEGF0cdvfxkY2niogQv 5JnTek5Odv+H9ztWxJ2KMxlzLMMo6bXVw9Jsga+IgWb0Pz7qsE67POOyAEe1BtODx7WS/4kd/ Texx7XpojMwXEdQI2oxC4YtnZvrUkihU0zRwOY2l3jICXFt6Y9vEEKzp+w2SUXizeXYOWT7PJ b9kEnjUvWcYhO7Z3DgWPoCXQ/bQ5tKRFCf+JpZcUiVyFQjZwwSuMGiSurpG0g8p6MV5KIt86x +YyETd9tEqyD8+DSt/ljJMyRWaGrhNoL9fXiXOxaRDw3DOJlfqUV6TMTh/ks1pHmMi5WaZzeD eo4GxOArAo33AiFrktlJIKbBj/P6kJoDDuRuzmgEydGElRKJ5T34QKuzNJUo+Qjnsg5aOW7CJ h2Adm4vCz0yS/aEF7NGkxMwVSoVH33AvFcq8lZpPo+viChzmF6OG2cJTk88pYdj//wLZMWkR X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208980 gmane.emacs.orgmode:138457 Archived-At: On Sun, 09 May 2021 19:21:31 +0200 Stephen Berman = wrote: > [I added emacs-orgmode@gnu.org in the Cc:] > > On Mon, 03 May 2021 18:07:25 +0200 Stephen Berman wrote: > >> By default `i' is a prefix key in calendar-mode for commands that inser= t >> 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' >> =3D> 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 o= n >> the gmane.emacs.humanities group; type RET to enter it. >> 2c. Type `j <87sg6wulu6.fsf@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 us= e >> of the `i' binding in the Calendar, and if Org mode has its own version= s >> 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 wrote: > Hello, > > Stephen Berman writes: > >> Yeah, the next time Org is merged to the Emacs master branch, forcing m= e >> 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