stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] define run-or-raise keybinding with anonymous function


From: David Bjergaard
Subject: Re: [STUMP] define run-or-raise keybinding with anonymous function
Date: Sat, 28 Nov 2015 13:17:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi Tamas,

In the current incarnation the code will not allow this.  Defcommand registers
the function in a hashtable that define-key looks up in order to make the
binding work.  Your example using lambda doesn't work because define-key isn't
smart enough to make an anonymous hash of the function and store it in the table
lookup.  Maybe this is something we can add in StumpWM 2.0 (codename paulownia).

Best,

    David

Tamas Papp <address@hidden> writes:

> Hi,
>
> I am new to stumpwm and find it amazing, but I need to wrap my head
> around a few things.
>
> One of them is "commands", in particular, I am looking for an equivalent
> of (lambda ...) when I don't want to name a command that I would just
> use once. Eg instead of
>
> (defcommand ensure-calibre () ()
>   "raise calibre if there is a running instance, otherwise start it"
>   (run-or-raise "calibre" '(:title "calibre")))
> (define-key *root-map* (kbd "c") "ensure-calibre")
>
> I am looking for something like
>
> (define-key *root-map* (kbd "c")
>             (lambda ()
>               (run-or-raise "calibre" '(:title "calibre"))))
>
> which of course does not work. Is there a way around this?
>
> Thanks,
>
> Tamas
>
> _______________________________________________
> Stumpwm-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel



reply via email to

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