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

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

Re: Finding last *Async Shell Command* buffer?


From: Jean Louis
Subject: Re: Finding last *Async Shell Command* buffer?
Date: Thu, 25 Mar 2021 23:05:06 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

(defun rcd-async-shell-command (command &rest args)
  "Remembers last async shell command on `C-c l'"
  (interactive)
  (let* ((shell-command-buffer-name-async (concat "RCD Async: " 
(format-time-string "%T")))
         (last-buffer shell-command-buffer-name-async))
    (global-set-key (kbd "C-c l") `(lambda () 
                                     (interactive)
                                     (switch-to-buffer ,last-buffer)))
    (apply #'async-shell-command command args)))

(rcd-async-shell-command "gimp") → works, I can find last buffer with C-c l

(global-set-key (kbd "M-&") 'rcd-async-shell-command) → not working, as when I 
press M-& I get funcall-interactively: Wrong number of arguments: (lambda 
(command &rest args) "Remembers last async shell command on `C-c l'" 
(interactive) (let* ((shell-command-buffer-name-async (concat "RCD Async: " 
(format-time-string "%T"))) (last-buffer shell-command-buffer-name-async)) 
(global-set-key (kbd "C-c l") (list 'lambda nil '(interactive) (list 
'switch-to-buffer last-buffer))) (apply #'async-shell-command command args))), 0

So I need sharp eye to tell me what I do wrong.




reply via email to

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