I wonder why this keybind start not working, it used to work but not today.

;; defun my-exwm-launch
(defun my-new-exwm-launch (command)
  (lambda ()
    (start-process-shell-command command nil command)))

(exwm-input-set-key (kbd "s-g") (my-new-exwm-launch "gkamus"))

I think I have this problem in the past too and I solved it by giving it lambda but that solution not work anymore

Update If I move the function and function to set keybind in elisp or .el file, it work

but If I use .org as dotfiles it not working I use this to load org file as dotfiles

(require 'org)
(org-babel-load-file (expand-file-name "~/.doom.d/personal/cheats_conf.org"   user-emacs-directory))
  • 1
    For starters, remove (lambda () and also remove a closing parenthesis at the end of the function. Since you are formally defining a function with defun, you do not need lambda in this particular context. Note that a lambda can be used inside a function ..., but not in this particular context.
    – lawlist
    Commented May 8, 2020 at 6:31
  • After I remove (lambda () and the closing parentheses of lambda the error changed to "Wrong type argument: commandp, #<process gkamus>
    – moanrisy
    Commented May 8, 2020 at 6:49
  • 1
    Here is an example that works wherein I pass the ARG -la to the ls function, which is of course unrelated to your babel example: (defun test-fn (arg) "Doc-string" (display-buffer (process-buffer (start-process "ls-process" "*OUTPUT-BUF*" "ls" arg)) t)) and (global-set-key [f5] (lambda () (interactive) (test-fn "-la"))) ....
    – lawlist
    Commented May 8, 2020 at 7:11

1 Answer 1


Try this instead:

(defun my-new-exwm-launch (command)
  (start-process-shell-command command nil command))

(exwm-input-set-key (kbd "s-g") (lambda () (interactive) (my-new-exwm-launch "gkamus")))

Based upon a comment from the O.P., here is a different example using a previous answer written by @sds at https://emacs.stackexchange.com/a/17421/2287 -- this example contains a general call to ls and passes the ARG of -la:

(defmacro defkey-arg (map key func &rest args)
  `(define-key ,map ,key (lambda () (interactive) (,func ,@args))))

(defun test-fn (arg)
  (display-buffer (process-buffer (start-process "ls-process"

(defkey-arg global-map [f5] test-fn "-la")
  • this working good :D, I can make exwm-input-set-key command shorter. I'm trying hard to make lambda and the interactive inside defun, but I guess, it's not possible. It's ok just by put start-process-shell-command inside defun.
    – moanrisy
    Commented May 8, 2020 at 7:21
  • I found an example by @sds wherein he creates a macro called defkey-arg ... and I updated the answer with a sample usage ...
    – lawlist
    Commented May 8, 2020 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.