Hot answers tagged

10 votes
Accepted

Run elisp when `async-shell-command` is done

You can specify the output buffer for async-shell-command. The shell runs as a process of the output buffer. You can get that process with get-buffer-process. Define your own process sentinel for the ...
Tobias's user avatar
  • 32.1k
6 votes
Accepted

disable async new buffer question

You may be interested in creating a new/modified function of shell-command that does not seek confirmation. You may also be interested in customizing the variable async-shell-command-buffer. For a ...
lawlist's user avatar
  • 18.6k
5 votes
Accepted

async-shell-command: run COMMAND without displaying the output

Try this: (add-to-list 'display-buffer-alist '("*Async Shell Command*" display-buffer-no-window (nil))) The buffer is still created and it still gets the output of the command (or the error output): ...
NickD's user avatar
  • 25.9k
5 votes
Accepted

Almost working smoothly attempt to get terminal Emacs to copy to clipboard

I'm also a loyal emacs-nw user, and have struggled with this over the recent emacs versions. What works for me, and without any need to C-g, follows. Note that it has a safety check that is linux-...
user1404316's user avatar
5 votes
Accepted

Regenerate ctags TAGS file without freezing Emacs for a while?

You can use https://github.com/redguardtoo/counsel-etags/blob/master/counsel-etags.el which originally called aysnc-shell-command to run shell command ctags -e -R. Or else write your own ...
chen bin's user avatar
  • 4,771
4 votes
Accepted

Asynchronous version of shell-command-on-region?

Something in this spirit should do the trick. I tried it with espeak under Ubuntu; I guess it would work with say as well. (defun my-read-words-on-region () "Send the region to `espeak'." (...
Nsukami _'s user avatar
  • 6,281
4 votes

Silent/Asynchronous gnus-demon?

This isn't an solution on how to use async features, but one which will also satisfy your needs, i think. Basically, you can move the fetching part to an external application, and just read the mails ...
toogley's user avatar
  • 303
4 votes

How can I run an async process in the background without popping up a buffer?

There's no need to change how you run an asynchronous command. Emacs has a generic ability to allow you to control where or whether any buffer will pop-up, by modifying a single data structure, the ...
user1404316's user avatar
4 votes
Accepted

How does one create back and forth communication to a process

The functionality used by comint mode is start-process, so I think you might like to start with that. You send data to the process with process-send-string, and the process's output is "automatically"...
Stefan's user avatar
  • 26k
3 votes
Accepted

Is there a version of lisp-interaction, à la *scratch* buffer, with asynchronous processing of evaluation?

Try the async package (M-x package-install, if you don't already have it). See the functions async-start and async-inject-variables. The given example is: (async-start `(lambda () (require ...
phils's user avatar
  • 47.3k
3 votes

How to run several programs one after another asynchronously

You can start with something like: (let ((proc1 (start-process "myproc1" t "cmd1"))) (set-process-sentinel proc1 (lambda (proc1 _string) (with-current-buffer (process-buffer proc1) ...
Stefan's user avatar
  • 26k
3 votes
Accepted

How to start a persistent asynchronous process trough emacs?

You can use call-process the same way as you did, but just replace the third argument by 0. If the third argument is 0, Emacs don't wait for the process and quit without killing it. SHELL-PROMPT> ...
Nicolas Mace's user avatar
2 votes

Async shell process buffer always clobbers window arrangement

You can suppress that window for a single command instead of globally using let (let ((display-buffer-alist (cons (cons "\\*Async Shell Command\\*.*" (cons #'display-buffer-...
killdash9's user avatar
  • 179
2 votes

Turning active M-! into M-& (a'ka emacs equiv to bash Ctrl-Z)

Does there exist some similar trick in emacs - a way to turn currently running foreground (synchronous) command into backgroundized (asynchronous) one? I suspect no such trick exists. The problem is ...
PythonNut's user avatar
  • 10.2k
2 votes
Accepted

Is variable assignment an atomic operation in elisp?

Elisp relies on cooperative concurrency, so yes, these are "atomic". But I suspect, like Tobias, that this answer won't help you very much because you're probably not asking the right question.
Stefan's user avatar
  • 26k
2 votes
Accepted

ob-async issue, seq-random-elt not defined

I believe the answer is essentially that ob-async has a bug (either with how it implements this feature, or with its stated minimum supported verion of Emacs). The user is running Emacs 25.2.2 seq-...
phils's user avatar
  • 47.3k
2 votes

Wait for result of fzf without blocking input

I think I have found a solution, although It's quite hacky. Basically, I use the following loop to pass key presses to the fzf process: (while (null fzf-result) (command-execute (read-key-sequence ...
MHilton's user avatar
  • 131
1 vote

How to open a file in other window in the middle of function run?

Thanks to lawlist's suggestion, I've ended up with this: (use-package notmuch :bind (("G" . (lambda () (interactive) (find-file-other-window "~/Maildir/....
SparedWhisle's user avatar
1 vote
Accepted

Is it possible to run package-refresh-contents as some sort of background process?

As @xuchunyang pointed out, package-refresh-contents takes an optional argument which allows it to be called asynchronously. Therefor one can call it programmatically like: (package-refresh-contents ...
alecvn's user avatar
  • 399
1 vote

Async Rsync Dired error on tramp file not found

I would consider looking at dired-rsync which is available from MELPA. DISCLAIMER: I am the author.
stsquad's user avatar
  • 4,616
1 vote
Accepted

Multi-processing via TRAMP with asynchronous shell commands

The quoted limitation does not exist any longer. Moreover, the function tramp-adb-handle-shell-command does not exist any longer. All different implementations of shell-command in Tramp have been ...
Michael Albinus's user avatar
1 vote
Accepted

Change async-shell-command with a synchronous command keeping the dynamically displayed buffer

Since you know what the output buffer is, you can hack around this issue by getting the process object from the output buffer and then waiting for it to finish. (defun run-kinda-async-shell-command (...
Jordon Biondo's user avatar
1 vote
Accepted

How can I tail/stream output when evaluating org babel shell blocks?

Found the answer to my own question. Use https://raw.githubusercontent.com/whacked/ob-shstream/master/ob-shstream.el
american-ninja-warrior's user avatar
1 vote
Accepted

Atomicity with asynchronous execution

@npostavs made this comment on the question: "I didn't find anything on the semantics of asynchronous operations." - Emacs doesn't have asynchronous operations, hence no semantics. That comment ...
Tobias's user avatar
  • 32.1k
1 vote

Cleanly terminating asynchronous process after it reads stdin

Turns out I was doing this correctly, and the process was correctly returning a 1 result. So the posted code is the correct thing to do.
abingham's user avatar
  • 927
1 vote
Accepted

How to know when dired is done if called async?

The final status information of the process is reported on the mode line for 3 seconds, however if you enter some keys during the 3 seconds, it will disappear immediately, thus if you are using Emacs ...
xuchunyang's user avatar
  • 14.2k
1 vote

Windows eshell alias command line arguments.. how?

I have been trying out things since posting the question. I came up with what works for me. eshell alias felt too complicated. Perhaps even this is too complicated. (if (eq system-type 'windows-nt)...
vpit3833's user avatar
  • 111
1 vote

Silent/Asynchronous gnus-demon?

One work around is to have the demon only do stuff when Emacs is idle; I use this: ; Demon to fetch email every 5 minutes when Emacs has been idle for 5 minutes: (gnus-demon-add-handler 'gnus-demon-...
asjo's user avatar
  • 1,037
1 vote

avoid emacs to lock down or crash when used for many tasks

Entirely up to you, really. I don't think there is any agreed "best practice" here. Your concerns are perfectly valid, so it's certainly not unreasonable to isolate distinct use-cases as separate ...
phils's user avatar
  • 47.3k

Only top scored, non community-wiki answers of a minimum length are eligible