Manual suggests using deprecated `define-key`

6 views
Skip to first unread message

jman

unread,
May 25, 2025, 4:13:03 AMMay 25
to mu-discuss

Hi,

mu4e manual suggests using `define-key`, for example in (info "(mu4e) Org-mode") or the web version
https://www.djcbsoftware.nl/code/mu/mu4e/Org_002dmode-links.html

`define-key` is since Emacs 29.1 (released end of July 2023) being phased out and replaced by
`keymap-set`. I understand that mu4e is compatible with way older Emacs versions (btw which is the
earliest Emacs version supported?), I wonder if there is a way to both suggest the new function (and
help migrating configurations) and at the same time do not exclude older Emacs versions.

Cheers,

Tassilo Horn

unread,
May 26, 2025, 3:12:30 AMMay 26
to 'jman' via mu-discuss
"'jman' via mu-discuss" <mu-di...@googlegroups.com> writes:

> mu4e manual suggests using `define-key`, for example in (info "(mu4e)
> Org-mode") or the web version
> https://www.djcbsoftware.nl/code/mu/mu4e/Org_002dmode-links.html
>
> `define-key` is since Emacs 29.1 (released end of July 2023) being
> phased out and replaced by `keymap-set`.

AFAICS, define-key now says it's a legacy function and one should use
keymap-set instead in its docstring. But it's not obsolete, and infact
keymap-set just calls define-key. So we can be confident it won't
disappear within the next decade.

> I understand that mu4e is compatible with way older Emacs versions
> (btw which is the earliest Emacs version supported?), I wonder if
> there is a way to both suggest the new function (and help migrating
> configurations) and at the same time do not exclude older Emacs
> versions.

Not really, I think. Well, other than providing both versions with a
comment since when you can use the keymap-set version.

Bye,
Tassilo

Tassilo Horn

unread,
May 27, 2025, 12:25:08 AMMay 27
to jman, 'jman' via mu-discuss
jman <mu-di...@city17.xyz> writes:

>> AFAICS, define-key now says it's a legacy function and one should use
>> keymap-set instead in its docstring. But it's not obsolete, and
>> infact keymap-set just calls define-key. So we can be confident it
>> won't disappear within the next decade.
>
> I see. Then I had another understanding about what is meant with
> "legacy" (as the title of my thread implied). So, if define-key is
> not deprecated, what is then the meaning of "legacy" in this case. Why
> did they introduce another way of setting keybindings if - as it is
> customary for emacs - the old way will not be deprecated?

The new set of commands directly work with the keybinding syntax that's
also used in the docs. With the "legacy" version, you had to slap a
(kbd ...) around the bindings or use one of the other syntaxes (string
like "\C-xl" or vector [?\C-x ?l] which both mean the same as the new
"C-x l" or (kbd "C-x l") previously). So I guess, the new set of
commands is simpler from a user perspective.

Bye,
Tassilo
Reply all
Reply to author
Forward
0 new messages