2

I am often opening exwm buffers by running async-shell-command but unfortunately these buffers always get named *EXWM*. It would be great if when I ran async-shell-command 'firefox the buffer that gets created would be named firefox.

3
  • 1
    I don't use EXWM, but async-shell-command accepts extra optional parameters. The second parameter is the name you want for the buffer with the results.
    – darcamo
    Dec 14 '20 at 22:38
  • @darcamo: Please consider posting that as an answer.
    – Drew
    Dec 15 '20 at 17:07
  • please note that I am seeking a complete elisp function. Dec 15 '20 at 20:29
0

something like this could work...

(defun async-shell-to-buffer (cmd)
  (interactive "sCall command: ")
  (let ((output-buffer (generate-new-buffer (format "*async:%s*" cmd)))
        (error-buffer  (generate-new-buffer (format "*error:%s*" cmd))))
    (async-shell-command cmd output-buffer error-buffer)))

then it's possible to call (async-shell-to-buffer "firefox")

3
  • this behaves exactly the same for me as async-shell-command Dec 16 '20 at 0:35
  • in the *Buffer List* i get *async:firefox* and *error:firefox* so might be something else exwm is doing?
    – zzkt
    Dec 16 '20 at 2:51
  • maybe try rename-buffer in a function advising exwm-manage--manage-window looks like that's where it's creating new buffers...
    – zzkt
    Dec 16 '20 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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