Fork me on GitHub
#emacs
<
2020-11-28
>
joetague11:11:43

Hi. I'm looking for some help on my first elisp code. I'm using (async-shell-command) but I don't understand how to stop the *Async Shell Command* buffer being created (it contains no output). Here's my code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; For react dev when CIDER offers to ;;
  ;; visit the url for the started cljs ;;
  ;; project, open using Google Chrome  ;;
  ;; and auto open the DevTools         ;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun browse-url-react-dev-chrome-devtools (url &optional new-window)
    "Assume Google Chrome is installed on MacOS, use open command to start Chrome with DevTools open at the passed url"
    (async-shell-command (concat "open -a \"Google Chrome\" --args --new-window --auto-open-devtools-for-tabs " url) nil nil))

  (defadvice cider--offer-to-open-app-in-browser (around cider--offer-to-open-app-in-browser activate)
    "Wrap around the CIDER function, update the browse-url to use my function that start Google Chrome instead of Safari"
    (let ((browse-url-browser-function
           'browse-url-react-dev-chrome-devtools))
      ad-do-it))

dakra12:11:32

You can name the buffer different but I'm not sure if you can not create the async buffer. I would use start-process-shell-command where you can set the buffer to nil to not create a buffer for the process.

thanks3 3