all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs
@ 2022-11-12 20:02 Stefan Kangas
  2023-09-10 23:51 ` Stefan Kangas
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kangas @ 2022-11-12 20:02 UTC (permalink / raw)
  To: 59224; +Cc: Lars Ingebrigtsen

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'?





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

* bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs
  2022-11-12 20:02 bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs Stefan Kangas
@ 2023-09-10 23:51 ` Stefan Kangas
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2023-09-10 23:51 UTC (permalink / raw)
  To: 59224-done; +Cc: Lars Ingebrigtsen

Version: 29.2

Stefan Kangas <stefankangas@gmail.com> 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.





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

end of thread, other threads:[~2023-09-10 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-12 20:02 bug#59224: 29.0.50; Don't use defvar+make-sparse-keymap for example in docs Stefan Kangas
2023-09-10 23:51 ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.