stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] Functions vs Commands?


From: J. David Smith
Subject: [STUMP] Functions vs Commands?
Date: Sun, 20 Apr 2014 20:01:34 -0400

Hullo,

I'm sure most of you are aware of the fact that (define-key ...) cannot directly take a function as its third parameter. Instead, it is given a string containing the command name. For example, this:

(define-key *root-map* (kbd "f") "firefox")

versus this:

(define-key *root-map* (kbd "f") #'firefox)

This is doubly confusing because (defcommand ...) wraps (defun ...), so (defcommand firefox (&optional (new-window nil)) () ....) produces a function (firefox ...). In order to make two keys (f and C-f), I can't simply do:

(define-key *root-map* (kbd "f") #'firefox)
(define-key *root-map* (kbd "C-f") (lambda () (firefox t)))

I have to define two commands:

(defcommand firefox ...) and (defcommand new-firefox ...).

as well as two keys.

So I suppose my question can be summed up like this:

What is the reasoning for using strings to reference functions like this?

  -- J David Smith

reply via email to

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