From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QOWjCUoamGAoRwAAgWs5BA (envelope-from ) for ; Sun, 09 May 2021 19:22:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OERgBUoamGC/PQAA1q6Kng (envelope-from ) for ; Sun, 09 May 2021 17:22:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3C1AE15359 for ; Sun, 9 May 2021 19:22:17 +0200 (CEST) Received: from localhost ([::1]:54184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfn8B-0000tU-OV for larch@yhetil.org; Sun, 09 May 2021 13:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfn7k-0000s9-EZ for emacs-orgmode@gnu.org; Sun, 09 May 2021 13:21:48 -0400 Received: from mout.gmx.net ([212.227.17.22]:34715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfn7h-0007SN-VG for emacs-orgmode@gnu.org; Sun, 09 May 2021 13:21:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620580894; bh=tkpTp0oUrFuyx7jVWFud3kN3HD2OaIY1qY6SMGisd04=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=fooRshISv3SiXj5SOSUonyFceNbQh7/12B2Nt0zB0ck+7CfZNdVYZX6XfPu3AqIuv /o8+68UmgjF6fkzwu/Uu1WD4BBCacbln0yFsMzrp/twHEyPZSIGZVocn6CNMaApgxt wsnxNN+lX8j37K4DMLOgFd8Wup9irskQCknzF4Uk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from strobe-jhalfs ([188.109.201.244]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MpUUm-1lA2nx3BVc-00pv01; Sun, 09 May 2021 19:21:33 +0200 From: Stephen Berman To: 48199@debbugs.gnu.org Subject: Re: bug#48199: 28.0.50; Org mode surprisingly usurps Calendar key binding References: <87eeen243m.fsf@gmx.net> Date: Sun, 09 May 2021 19:21:31 +0200 In-Reply-To: <87eeen243m.fsf@gmx.net> (Stephen Berman's message of "Mon, 03 May 2021 18:07:25 +0200") Message-ID: <878s4nomas.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:34zAiCTSWsdxswe9y4MBJE0GRnKdEPnGPvf7R6yRt8fnnlPYV/L Qjzels3zkyLzgh2Rbx+KGaCr5ZZSHORgtd4089TeHm6Nqz/tT/ZygN9Fm9/s8uJJ3DTyplk S/rTjTQiOaNuXxKbgjUEJhBo/59BDnMf9xJ26zwzQxkMiv2hyK6COdUdEU8Hq1s3cqWWFEB 2CsTCcY1DLMIKk5JG2yRg== X-UI-Out-Filterresults: notjunk:1;V03:K0:PkWXqQh4bKY=:2oDJAj2wf3ICCvnxtrKnVN WOWf6zmzlLeEAhdrLGdTJ3tDvYRcqy1nD49LBBSTaGytqvcEZormlST9qJ61586D7A//Tj9YU 2CQJCYtwr/i+H78plVpWjZN7mnsw3qaGlA6V+ynQx2qV8b9uPh34Iy/KgXvftlVOjHr/CS2pl /iYmyUewaTRwMJZNfV90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P Hd2OEMTe0vIeDUlLh Received-SPF: pass client-ip=212.227.17.22; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620580937; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EPFKTE4LofDY2SJHNGWOyp7W4/4zvB/LxyKyv3MnkcQ=; b=nBYkecVUYqFv1DHNcq/rX0+oY6dksyNn1sqySNuzp2IQtD/qIO7+XlyK6bRKGDkvlienGE 6xsPZ5syz66p2g6EWQFFx3LgqSqvK33fN2jO/qHteTlX6oW5vpjMeUrYizJdAK+r1b76s8 4a4MZdAy4MitPeXiAF0PrhlpxBz5e8ewrwjVb5/HKM7Q4QbSa/Q21HT9JRqy95HZeGCLUD uKZAoosNLA4NzQuwuilVRs4L3Nq+iKMdA3s1o5KJvB47dGDXjoHbrGabhYogIJj9c3T4qT 1XjEQICiqHFVsPjSTReqeg8Q+yMg8eq0sXNYExQ7hNZd1girFU68g2C77BHT1Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620580937; a=rsa-sha256; cv=none; b=EuCVUEq3PeByWDJxB4eZMHQjNJzYmmX7BJK8lUt7y/aG+H0bc5TOGOEEYBngW0DmHzUveE N6E1Iiz6fdV91YXXxjLbJVsrO1kjSpnTK6RK3fuhqkT61a0jULw49hc74YbRyQ1eLqPVG6 TgICtdPOarQ2E5l9XuBvuL7SYWCsUXTwpB+i83sQHkaqf65nxy/XUP5fGUf3cJyRBPG/h9 J/eSkxY/mcC8YP7g5ZZsKZeRlHO9dB9uf0MEeVHGbsZNzLLOZSFWleZSSR2saVbrONmyJR Zc3UHq3Ox6/g/ItUMo5/QW6wZ2Kvb7HTlqL9GtIWQ7XaMyaLRJsN44WEga9k4w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=fooRshIS; dmarc=pass (policy=none) header.from=gmx.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=fooRshIS; dmarc=pass (policy=none) header.from=gmx.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 3C1AE15359 X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: FI+31Pn6RUZM --=-=-= Content-Type: text/plain [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 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@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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: org-compat.el patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 1f4e2e8308..b68e5b58fc 100644 =2D-- 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))) --=-=-= Content-Type: text/plain 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 --=-=-=--