Subject: bug#59224: closed (Re: bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 10 Sep 2023 23:52:02 +0000

Your bug report

#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59224: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59224
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs
From: Stefan Kangas <[email-masked]>
To: [email-masked]
Cc: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 10 Sep 2023 16:51:25 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 29.2

Stefan Kangas <[email-masked]> writes:

> Severity: wishlist
>
> In (info "(elisp) Tips for Defining"), we have:
>
>        When defining and initializing a variable that holds a
>     complicated value (such as a keymap with bindings in it), it’s best
>     to put the entire computation of the value into the ‘defvar’, like
>     this:
>
>          (defvar my-mode-map
>            (let ((map (make-sparse-keymap)))
>              (keymap-set map "C-c C-a" 'my-command)
>              ...
>              map)
>            DOCSTRING)
>
> Could we use an example here that is not a keymap (which should be
> defined using `defvar-keymap' these days)?
>
> What would be a good example to use?  `make-syntax-table'?

I've now changed this example to `make-syntax-table' on emacs-29.

If anyone can think of a better example, please speak up and we can
reopen the bug for further tweaking.

Subject: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs
From: Stefan Kangas <[email-masked]>
To: [email-masked]
Date: Sat, 12 Nov 2022 12:02:31 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Severity: wishlist

In (info "(elisp) Tips for Defining"), we have:

       When defining and initializing a variable that holds a
    complicated value (such as a keymap with bindings in it), it’s best
    to put the entire computation of the value into the ‘defvar’, like
    this:

         (defvar my-mode-map
           (let ((map (make-sparse-keymap)))
             (keymap-set map "C-c C-a" 'my-command)
             ...
             map)
           DOCSTRING)

Could we use an example here that is not a keymap (which should be
defined using `defvar-keymap' these days)?

What would be a good example to use?  `make-syntax-table'?