help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: global-set-key with function taking arguments


From: Emanuel Berg
Subject: Re: global-set-key with function taking arguments
Date: Sun, 01 Nov 2020 13:57:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech wrote:

>> ... you mean `describe-function'?
>
> No. I mean describe-key. If you try describe-key for a key binding
> you are not going to get useful documentation with an
> anonymous function.

Ah, that's what you mean. No, you are right, and I agree!

> But I might be mistaken. May one include documentation string for
> lambda ()?

You can! But it doesn't work the same way. C-h f lambda RET

  (lambda ARGS [DOCSTRING] [INTERACTIVE] BODY)
 
  DOCSTRING is an optional documentation string.
  If present, it should describe how to call the function.
  But documentation strings are usually not useful in nameless functions.

IMO proper functions (defuns) should be used with keys, not lambdas.
Except for perhaps very simple or temporary solutions.

Because functions are up in the sky - heaven, almost. And keys are by
all means a way, one way, a good way, but not the _only_ way, to
reach them. Functions shouldn't be imprisoned down there, at the same
level as mere keys...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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