[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33263: 27.0.50; Tidying up Gnus modes

From: Noam Postavsky
Subject: bug#33263: 27.0.50; Tidying up Gnus modes
Date: Tue, 06 Nov 2018 08:27:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>> Eric Abrahamsen <eric@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 ...)

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]