Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda command prototype. #1239

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mychris
Copy link
Contributor

@mychris mychris commented Jan 6, 2024

A was fooling around a bit and noticed, that the result of define-command could be bound using define-key with a very simple change. Just prototyped a lambda-command. Can be used as follows:

(define-key *global-keymap*
  "C-c C-a" (define-command my-lambda-command () ()
                  (message "Hello world")))

(define-key *global-keymap*
  "C-c C-o" (lambda-command () ()
              (message "Hello World")))

I removed the options from the lambda-command, otherwise it would look very awkward ((lambda-command () () () ...)).

I didn't think this through entirely yet, so there might be some side-effects I am not aware of. One "weird" thing for instance (from a users perspective): You can call the lambda-command via M-x.

What do you think about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants