unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master
@ 2021-05-27  1:52 Daniel Kahn Gillmor
  2021-05-27  2:03 ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2021-05-27  1:52 UTC (permalink / raw)
  To: Notmuch Mail


[-- Attachment #1.1: Type: text/plain, Size: 1282 bytes --]

I just tried to upgrade notmuch to the head of development.  my ~/.emacs
contains a stanza for a shortcut for dealing with junk mail, which has
given me no problems at all for notmuch 0.31.4-1:

---------
;; notmuch junk handling
(defun dkg-notmuch-show-handle-junk ()
  "Mark the message as spam, archive the thread, and display the next thread."
  (interactive)
  (notmuch-show-tag-all '("-inbox" "+spam"))
  (notmuch-show-next-thread t))
(define-key 'notmuch-show-mode-map "j" 'dkg-notmuch-show-handle-junk)
---------

After the upgrade, though, if i restart emacs, i get a failure when
loading my ~/.emacs:

Debugger entered--Lisp error: (wrong-type-argument keymapp notmuch-show-mode-map)
  define-key(notmuch-show-mode-map "j" dkg-notmuch-show-handle-junk)
  eval-buffer(#<buffer  *load*> nil "/home/dkg/.emacs" nil t)  ; Reading at buffer position 23847
  load-with-code-conversion("/home/dkg/.emacs" "/home/dkg/.emacs" t t)
  load("~/.emacs" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x157b2d94c735>) #f(compiled-function () #<bytecode 0x157b2d94c675>) t)
  command-line()
  normal-top-level()


I'll try downgrading again to see what's replicable, but i'm kind of
confused by this, as it's been working for years.

         --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master
  2021-05-27  1:52 (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master Daniel Kahn Gillmor
@ 2021-05-27  2:03 ` Daniel Kahn Gillmor
  2021-05-27  3:34   ` Kyle Meyer
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2021-05-27  2:03 UTC (permalink / raw)
  To: Notmuch Mail


[-- Attachment #1.1: Type: text/plain, Size: 1863 bytes --]

On Wed 2021-05-26 21:52:13 -0400, Daniel Kahn Gillmor wrote:
> I'll try downgrading again to see what's replicable, but i'm kind of
> confused by this, as it's been working for years.

I don't have any problem with 0.31.4-1, but the problem is present with
0.32.1-1 from experimental.  In all cases, i'm upgrading notmuch,
libnotmuch*, and elpa-notmuch in lockstep.

Nothing in NEWS between these versions suggests that my way of binding
keys is now deprecated.

I worry that this is due to one of the two following commits but my
elisp-foo is weak enough that i don't know what the right next steps are:

commit adfded9ed0a5a4b06886f462314cd4511cb72d47
Author: Jonas Bernoulli <jonas@bernoul.li>
Date:   Mon Nov 16 22:28:42 2020 +0100

    emacs: avoid binding unnamed commands in keymaps
    
    One should never bind unnamed commands in keymaps because doing that
    makes it needlessly hard for users to change these bindings.
    
    Replace such anonymous bindings with named commands that are generated
    using macros and some boilerplate. Using macros is better than using a
    simple loop because that makes it possible for `find-function' to find
    the definitions. Eat your boilerplate--it forms character.
    
    Admittedly this approach is quite ugly and it might be better to teach
    the original commands to support different buffers directly instead of
    requiring wrapper commands to do just that.
    
    Never-the-less as a short-term solution this is better than what we
    had before.

commit 05a436f730cf6277c403b445bca9419ea89a7b2d
Author: Jonas Bernoulli <jonas@bernoul.li>
Date:   Sun Nov 8 20:02:48 2020 +0100

    emacs: don't fset keymaps
    
    These keymaps are never invoked as commands
    so the function definitions serve no purpose.

Regards,

             --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master
  2021-05-27  2:03 ` Daniel Kahn Gillmor
@ 2021-05-27  3:34   ` Kyle Meyer
  2021-05-27 14:01     ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 10+ messages in thread
From: Kyle Meyer @ 2021-05-27  3:34 UTC (permalink / raw)
  To: Daniel Kahn Gillmor; +Cc: Notmuch Mail

Daniel Kahn Gillmor writes:

> I worry that this is due to one of the two following commits but my
> elisp-foo is weak enough that i don't know what the right next steps are:

It's due to the second commit, 05a436f7 (emacs: don't fset keymaps,
2020-11-11).  You could avoid the error by dropping the quote from the
keymap variable, changing

  (define-key 'notmuch-show-mode-map "j" 'dkg-notmuch-show-handle-junk)

to

  (define-key notmuch-show-mode-map "j" 'dkg-notmuch-show-handle-junk)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master
  2021-05-27  3:34   ` Kyle Meyer
@ 2021-05-27 14:01     ` Daniel Kahn Gillmor
  2021-05-27 14:50       ` David Bremner
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2021-05-27 14:01 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Notmuch Mail


[-- Attachment #1.1: Type: text/plain, Size: 1489 bytes --]

On Wed 2021-05-26 23:34:47 -0400, Kyle Meyer wrote:
> Daniel Kahn Gillmor writes:
>
>> I worry that this is due to one of the two following commits but my
>> elisp-foo is weak enough that i don't know what the right next steps are:
>
> It's due to the second commit, 05a436f7 (emacs: don't fset keymaps,
> 2020-11-11).  You could avoid the error by dropping the quote from the
> keymap variable, changing
>
>   (define-key 'notmuch-show-mode-map "j" 'dkg-notmuch-show-handle-junk)
>
> to
>
>   (define-key notmuch-show-mode-map "j" 'dkg-notmuch-show-handle-junk)

Thanks, this does resolve the issue for me.  I see the patch was
discussed briefly on-list back in November before being merged.

I wonder how many other users will have this problem when upgrading, i
don't know how widespread the use of the quoted variables are in
~/.emacs.  In some sense their removal is a change to the elisp API :/

The conservative API designer in me suggests that rather than removing
these elements directly, we should deprecate first, warning if people
use them (and those warnings should include guidance on how to avoid the
warnings).  Then, after sufficient time has passed, drop the deprecated
element.

This isn't important for me anymore (the issue is resolved for me,
thanks Kyle!), but maybe it will be for others?

If we don't want to go through the full hassle of deprecation and delay
before final removal, it seems like a mention in NEWS is at least
worthwhile.

Regards,

        --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master
  2021-05-27 14:01     ` Daniel Kahn Gillmor
@ 2021-05-27 14:50       ` David Bremner
  2021-05-27 16:58         ` [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings Daniel Kahn Gillmor
  0 siblings, 1 reply; 10+ messages in thread
From: David Bremner @ 2021-05-27 14:50 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Kyle Meyer; +Cc: Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> If we don't want to go through the full hassle of deprecation and delay
> before final removal, it seems like a mention in NEWS is at least
> worthwhile.
>

Since the change is released, it's a bit late to uh, not release it ;).
No objection to adding to NEWS retroactively.

d

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings.
  2021-05-27 14:50       ` David Bremner
@ 2021-05-27 16:58         ` Daniel Kahn Gillmor
  2021-05-27 17:11           ` Tomi Ollila
  2021-05-31 23:27           ` David Bremner
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2021-05-27 16:58 UTC (permalink / raw)
  To: Notmuch Mail

See list discussion in thread starting with
id:87h7ip2baq.fsf@fifthhorseman.net for more details.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
 NEWS | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/NEWS b/NEWS
index c0ae6afe..c3ca1085 100644
--- a/NEWS
+++ b/NEWS
@@ -101,6 +101,13 @@ Removed, inlined or renamed functions and variables:
     `notmuch-sexp-eof`, `notmuch-split-content-type`, and
     `notmuch-tree-button-activate`.
 
+Keymaps are no longer fset, which means they need to be referred to in
+define-key directly (without quotes).  If your ~/.emacs has a
+keybinding like:
+   (define-key 'notmuch-show-mode-map "7" 'foo)
+you should change it to:
+   (define-key notmuch-show-mode-map "7" 'foo)
+
 Notmuch 0.31.4 (2021-02-18)
 ===========================
 
-- 
2.30.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings.
  2021-05-27 16:58         ` [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings Daniel Kahn Gillmor
@ 2021-05-27 17:11           ` Tomi Ollila
  2021-05-27 21:46             ` Daniel Kahn Gillmor
  2021-05-31 23:27           ` David Bremner
  1 sibling, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2021-05-27 17:11 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

On Thu, May 27 2021, Daniel Kahn Gillmor wrote:

> See list discussion in thread starting with
> id:87h7ip2baq.fsf@fifthhorseman.net for more details.
>
> Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
> ---
>  NEWS | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index c0ae6afe..c3ca1085 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -101,6 +101,13 @@ Removed, inlined or renamed functions and variables:
>      `notmuch-sexp-eof`, `notmuch-split-content-type`, and
>      `notmuch-tree-button-activate`.
>  
> +Keymaps are no longer fset, which means they need to be referred to in
> +define-key directly (without quotes).  If your ~/.emacs has a

In our docs it would be better to refer ~/.emacs.d/notmuch-config.el (?) :D

Tomi


> +keybinding like:
> +   (define-key 'notmuch-show-mode-map "7" 'foo)
> +you should change it to:
> +   (define-key notmuch-show-mode-map "7" 'foo)
> +
>  Notmuch 0.31.4 (2021-02-18)
>  ===========================
>  
> -- 
> 2.30.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings.
  2021-05-27 17:11           ` Tomi Ollila
@ 2021-05-27 21:46             ` Daniel Kahn Gillmor
  2021-05-28 20:59               ` Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2021-05-27 21:46 UTC (permalink / raw)
  To: Tomi Ollila, Notmuch Mail


[-- Attachment #1.1: Type: text/plain, Size: 467 bytes --]

On Thu 2021-05-27 20:11:13 +0300, Tomi Ollila wrote:
> On Thu, May 27 2021, Daniel Kahn Gillmor wrote:
>> +Keymaps are no longer fset, which means they need to be referred to in
>> +define-key directly (without quotes).  If your ~/.emacs has a
>
> In our docs it would be better to refer ~/.emacs.d/notmuch-config.el (?) :D

Interesting, that's not where my notmuch-emacs config is located but i
certainly have no objection to the proposed revision.

          --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings.
  2021-05-27 21:46             ` Daniel Kahn Gillmor
@ 2021-05-28 20:59               ` Tomi Ollila
  0 siblings, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2021-05-28 20:59 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

On Thu, May 27 2021, Daniel Kahn Gillmor wrote:

> On Thu 2021-05-27 20:11:13 +0300, Tomi Ollila wrote:
>> On Thu, May 27 2021, Daniel Kahn Gillmor wrote:
>>> +Keymaps are no longer fset, which means they need to be referred to in
>>> +define-key directly (without quotes).  If your ~/.emacs has a
>>
>> In our docs it would be better to refer ~/.emacs.d/notmuch-config.el (?) :D
>
> Interesting, that's not where my notmuch-emacs config is located but i
> certainly have no objection to the proposed revision.

loading of .emacs.d/notmuch-config.el (notmuch-init-file) was added to 
notmuch.el in this commit: 
31fc76b78 emacs/notmuch.el (Tomi Ollila  2014-03-29 10:07:59 +0200)

When it is mentioned in our dox users have better change to know it,
and choose the most appropriate places for their notmuch configurations.

(I personally have (autoload 'notmuch "notmuch" "Notmuch mail" t) in
git repo which contains emacs configuration. There is also
'user-notmuch.el' which has "common" notmuch configurations cloned
everywhere. ~/emacs.d/notmuch-config.el starts with (load "user-notmuch"),
and then continues with site-specific configuration).

>
>           --dkg

Tomi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings.
  2021-05-27 16:58         ` [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings Daniel Kahn Gillmor
  2021-05-27 17:11           ` Tomi Ollila
@ 2021-05-31 23:27           ` David Bremner
  1 sibling, 0 replies; 10+ messages in thread
From: David Bremner @ 2021-05-31 23:27 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> See list discussion in thread starting with
> id:87h7ip2baq.fsf@fifthhorseman.net for more details.
>
> Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

applied to release and master (with generic "Emacs configuration" in
place of .emacs)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-31 23:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  1:52 (wrong-type-argument keymapp notmuch-show-mode-map) in emacs on upgrade to notmuch from master Daniel Kahn Gillmor
2021-05-27  2:03 ` Daniel Kahn Gillmor
2021-05-27  3:34   ` Kyle Meyer
2021-05-27 14:01     ` Daniel Kahn Gillmor
2021-05-27 14:50       ` David Bremner
2021-05-27 16:58         ` [PATCH] NEWS/emacs: document changes in 0.32 that affect keybindings Daniel Kahn Gillmor
2021-05-27 17:11           ` Tomi Ollila
2021-05-27 21:46             ` Daniel Kahn Gillmor
2021-05-28 20:59               ` Tomi Ollila
2021-05-31 23:27           ` David Bremner

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git