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

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

Re: [solved]: Re: Finding last *Async Shell Command* buffer?


From: Emanuel Berg
Subject: Re: [solved]: Re: Finding last *Async Shell Command* buffer?
Date: Fri, 26 Mar 2021 08:31:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> (defun rcd-async-shell-command (&rest args)
>   "Remembers last async shell command on `C-c l'"
>   (interactive
>    (list
>     (read-shell-command (if shell-command-prompt-show-cwd
>                             (format-message "Async shell command in `%s': "
>                                             (abbreviate-file-name
>                                              default-directory))
>                           "Async shell command: ")
>                         nil nil
>                       (let ((filename
>                              (cond
>                               (buffer-file-name)
>                               ((eq major-mode 'dired-mode)
>                                (dired-get-filename nil t)))))
>                         (and filename (file-relative-name filename))))
>     current-prefix-arg
>     shell-command-default-error-buffer))
>   (let* ((shell-command-buffer-name-async (concat "RCD Async: " 
> (format-time-string "%Y%m%d%H%M%S")))
>        (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 args)))

M-x hooligan-elisp-mode RET

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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