emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
teodorlu 2021-03-26T14:55:10.049400Z

Hello! Another newbie Emacs Lisp question. I'm trying to launch an external program from Emacs. I found async-shell-command, which seems to be doing what I want. But I just want my app launched, I don't want to see any more buffers. From the docstring, I think that should be possible. I've managed to evaluate display-buffer-alist, and got a lot of values. Do I need to imperatively change this in-place in order to do what I want? Or is there an equivalent to Clojure's binding? Or can I just pass in an argument and I've misread the docs? Any advice is appreciated! > You can configure `async-shell-command-buffer' to specify what to do > when the `*Async Shell Command*' buffer is already taken by another > running shell command. To run COMMAND without displaying the output > in a window you can configure `display-buffer-alist' to use the action > display-buffer-no-window' for the buffer *Async Shell Command*'.

teodorlu 2021-03-26T15:01:02.049500Z

I've got this now:

(defun teod/shell ()
  (interactive)
  (async-shell-command "th-terminal"))
, but when I run it, I'm getting an empty *Async Shell Command* buffer that I'd like to avoid.

hindol 2021-03-26T15:08:36.049900Z

Do you want Emacs to control the lifecycle of the external process or do you just want a fire and forget process?

teodorlu 2021-03-26T15:08:46.050100Z

fire and forget please.

hindol 2021-03-26T15:12:58.050300Z

I mean, should the process shutdown when emacs is stopped?

hindol 2021-03-26T15:15:41.050500Z

If you want your process to live beyond Emacs, it may be simpler to start it outside Emacs.

Phil Shapiro 2021-03-26T15:15:52.050700Z

I think start-process is what you want.

(start-process "test" "ls" nil)

πŸ‘ 1
πŸ’― 1
Phil Shapiro 2021-03-26T15:19:15.051100Z

If you don’t want it to close when emacs exits, nohup might work.

hindol 2021-03-26T15:21:37.051400Z

call-process if you want to completely detach. https://www.emacswiki.org/emacs/ExecuteExternalCommand

πŸ’― 1
teodorlu 2021-03-26T15:36:33.051900Z

Just want to say that I really appreciate the pointers, digging through docs and trying things out now :thumbsup:

teodorlu 2021-03-26T15:39:23.052200Z

(start-process "RUN" "RUN" "nohup" "th-terminal")
Seems promising. Trying to understand how to use call-process now.

hindol 2021-03-26T15:39:59.052400Z

I am no Elisp programmer myself, but I like to dig around when I see an interesting question. Thanks to you, I am also learning new things, πŸ™‚

πŸ™Œ 2
πŸ˜„ 1
hindol 2021-03-26T15:44:47.052700Z

With display-buffer-alist, you can hide (or control other aspects of) any buffers matching a specific RegEx. You can append to the alist your own RegEx and configs. alist is kind of like a hash map. This is one key-value pair for example,

("^\\*Command Line"
  (+popup-buffer)
  (actions)
  (side . bottom)
  (size . 8)
  (window-width . 40)
  (window-height . 0.16)
  (slot)
  (vslot)
  (window-parameters
   (ttl . 5)
   (quit . t)
   (select . ignore)
   (modeline)
   (autosave)))
And the configs will apply to any buffer names matching the "^\\*Command Line" RegEx.

πŸ’― 1
πŸŽ‰ 1
teodorlu 2021-03-26T16:02:11.053600Z

Also seems to do what I want without going through nohup:

(call-process "th-terminal" nil 0)

πŸ‘ 1