GNU bug report logs - #33263
27.0.50; Tidying up Gnus modes

Previous Next

Package: emacs;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Mon, 5 Nov 2018 02:55:02 UTC

Severity: wishlist

Found in version 27.0.50

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#33263: 27.0.50; Tidying up Gnus modes
Date: Tue, 06 Nov 2018 08:21:31 -0800
Noam Postavsky <npostavs <at> gmail.com> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> Noam Postavsky <npostavs <at> gmail.com> writes:
>>
>>> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>>>
>>>> +(defvar gnus-browse-mode-map (make-keymap))
>>>>
>>>>  (unless gnus-browse-mode-map
>>>> -  (setq gnus-browse-mode-map (make-keymap))
>>>> +  (defvar gnus-browse-mode-map (make-keymap))
>>>
>>> This doesn't look right.
>>
>> Hmm, you're right, I think I got confused there. TBH I don't really know
>> why these things are wrapped in `unless', but I think what should have
>> happened is that `gnus-browse-mode-map' is first defvar'ed to nil, and
>> later setq'ed to (make-keymap).
>
> The usual idiom for this is
>
>     (defvar gnus-browse-mode-map
>       (let ((map (make-sparse-keymap)))
>         (define-key map ...)
>         ...
>         map))
>
> It seems that (the expansion of) gnus-define-keys relies on dynamic
> binding of the map variable (i.e., it must be called after the defvar,
> not inside), so that's the reason to split in two parts.

Right, I got that much, I was mostly wondering why the `unless' -- it's
unlikely these files would be loaded multiple times, and even if they
were, that wouldn't break anything, would it?





This bug report was last modified 6 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.