Questions tagged [async]
The async tag has no usage guidance.
60
questions
0
votes
1
answer
138
views
Best way to test output sent to a buffer
I'm writing an emacs package for Pipenv and the spike solution uses sync shell calls, which is not desirable for general usage. I'm now changing calls to be async (make-process) and for output to go ...
0
votes
1
answer
77
views
#+BIND and org-mode asynchronous exporting document
Let's say I have the following org-file:
#+TITLE: Presentation title
#+BIND: org-beamer-outline-frame-title "My own title"
#+LATEX_CLASS: beamer
* Section 1
** Slide 1
When I export this ...
2
votes
2
answers
824
views
Is it possible to run package-refresh-contents as some sort of background process?
I've repurposed some code to show me a list of packages that I have installed which have upgrades available.
Currently I'm running package-refresh-contents when I start-up Emacs and then display the ...
1
vote
2
answers
484
views
How to prevent a function being called multiple times? (locking)
With a function that calls an asynchronous process, it's possible to call the same function multiple times.
What is a reliable way to avoid this that properly handles quit and errors being raised?
...
2
votes
1
answer
288
views
How can I automatically rename buffers created with `async-shell-command` to the shell command that was called?
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 ...
0
votes
1
answer
52
views
async/await in emacs?
I'm trying to run a hook that should start after buffers are loaded - it hooks into ein package that starts an "ipython server" that takes some time to start and it seems that the subsequent ...
2
votes
1
answer
98
views
async functions in completion at point functions?
in my library, i have completion backends that i add to completion-at-point-functions as per the docs, but my completion candidates are fetched from a server with an http request. the call is very ...
0
votes
0
answers
29
views
Move mail in the background with gnus?
I switched from webmail to gnus with imap to be more efficient when going through emails. (I feel like I'm going back 5 years). 15 minutes in (after the annoying set up) and it feels great and ...
4
votes
2
answers
2k
views
async-shell-command: run COMMAND without displaying the output
I want to use async-shell-command to run a .bat file on Windows.
Reading the function documentation it says:
(defun async-shell-command (command &optional output-buffer error-buffer)
"Execute ...
0
votes
0
answers
19
views
Change buffer before async call returns its result
I have the following function that creates a new buffer and calls a compilation watcher asynchronously in it. This means that every time I save the file I'm working on the watcher will compile it and ...
1
vote
0
answers
35
views
Insert output of slow external process in current buffer, character-by-character
Imagine in the current buffer I have the text:
Hello
Bye
I want to call an external program and add the output of it at the end of the buffer. The tricky thing is that the external program provides ...
1
vote
0
answers
61
views
How can I execute synchronously a xdotool process in an Elisp function?
I want to perform a repetitive task using Emacs and another program (which, unfortunately, runs under X). I have then set up an elisp function and a xdotool script to do the two parts of the work. The ...
26
votes
4
answers
7k
views
How can I run an async process in the background without popping up a buffer?
I have defined some functions to run async background process using async-shell-command in my .emacs, but everytime I run the commands a new window (not frame) is created and the process' buffer is ...
1
vote
1
answer
266
views
Non-blocking prompt for user input
I'm using the org-pomodoro, and I have added a function to the org-pomodoro-started-hook that prompts the user for a reminder for what they should do during the break. However, I don't want to call ...
2
votes
0
answers
34
views
Debugging for Elisp threads?
Let's say some package does
(make-thread
(lambda ()
(message "Started thread.")
(error "Fit happens.")
(message "Finished thread.")))
Regardless of M-x ...
2
votes
0
answers
70
views
How to avoid losing focus after starting an asynchronous process?
The lisp function start-process is meant to start an asynchronous
subprocess, namely a process running independently of Emacs
itself.
I have noticed that, under my GNOME desktop
environment, when my ...
2
votes
1
answer
225
views
async org-agenda
I have a lot of org files in emacs 27.1 so when I do an agenda listing for the week it takes about 20seconds. Is there a nice way to do this in the background? I've put together the following function ...
1
vote
2
answers
111
views
How to open a file in other window in the middle of function run?
I use notmuch to read emails.
I've configured notmuch to call offlineimap via pre-new hook.
When I press G to refresh my notmuch buffer, I want emacs to open my offlineimap log file in another window ...
1
vote
1
answer
322
views
Wait for result of fzf without blocking input
I'm trying to make use of the fzf fuzzy finder to search through a list via a term process. The way I do this is very similar to fuzzy-finder.el or fzf.el. This is by launching fzf with:
(progn
(...
1
vote
1
answer
229
views
How to start a persistent asynchronous process trough emacs?
I am writing a lisp program to be run as a batch file through emacs.
The program calls an external application which is supposed to stay
running after the call to emacs finishes.
The two basic ways ...
0
votes
1
answer
153
views
Async Rsync Dired error on tramp file not found
I am trying to copy files from one directory on a remote computer to another directory on the same remote computer.
Using Dired I can open up the two directories, mark the files I want to copy and ...
2
votes
0
answers
133
views
Process sentinels don't run during init in GUI Emacs
Ok, this issue I'm running into seems pretty weird. I'm running an async process during init and I have set a process sentinel to tell me when it exits. This works fine in terminal Emacs but in GUI ...
1
vote
0
answers
67
views
Exporting JPG image from LaTeX SRC-block with :async header
I like to generate JPG images from my LaTeX/tikz drawings in my org files. For this, I use constructs like
#+NAME: my image
#+HEADER: :file my-image.jpg
#+BEGIN_SRC latex :results file raw :...
3
votes
1
answer
171
views
Is there a version of lisp-interaction, à la *scratch* buffer, with asynchronous processing of evaluation?
While I develop some Emacs-Lisp code, I often test it in the *scratch* buffer, just to make sure that what I just wrote behaves like I believe it does.
But sometimes evaluating an expression takes ...
1
vote
0
answers
119
views
Using diff-buffer-with-file to merge differences between the disk and the buffer
I sync my org files via Dropbox. Occasionally, Dropbox will bring in changes into a file whose buffer I've already modified. I can diff the buffer and the file on disk with diff-buffer-with-file; but ...
6
votes
1
answer
1k
views
Regenerate ctags TAGS file without freezing Emacs for a while?
When I'm currently in a large project and I call the command
projectile-regenate-tags, the project will be scanned by ctags and the tags will be stored in the TAGS file.
While all this action is ...
-1
votes
1
answer
172
views
ob-async issue, seq-random-elt not defined
I would like to asynchronously run code blocks in org mode.
My org mode version (org-version output) is: Org mode version 9.2.1 (9.2.1-23-g126a37-elpa @ /home/user/.emacs.d/elpa/org-9.2.2/)
I ...
0
votes
0
answers
23
views
Emacs continuously asking for input and not sure what is the cause
I have this function implemented to basically compile and run the cpp file I am writing. Some files needs input (cin) so running this function will not stop and would continuously showing this message:...
1
vote
0
answers
315
views
asynchronously running org-toggle-latex-fragment
In orgmode, it is quite useful to view the equations inline. However, sometimes this can take a while to execute. Running org-toggle-latex-fragment asynchronously would be quite useful. However, most ...
5
votes
1
answer
1k
views
Almost working smoothly attempt to get terminal Emacs to copy to clipboard
I'm running this emacs
GNU Emacs 25.2.2 (x86_64-pc-linux-gnu) of 2017-09-22, modified by Debian
directly in a Gnome terminal by calling emacs, which is actually a link to /etc/alternatives/emacs. ...
0
votes
1
answer
82
views
Is variable assignment an atomic operation in elisp?
I have a situation in a mode I'm writing that saves a portion of the output of a long-running asynchronous process to a variable at intermittent intervals. I need to access this data periodically. My ...
2
votes
0
answers
101
views
Help dealing with Async sleep for "Simulated Typing" effect [closed]
I am trying to build a function, that takes a body of text from a buffer or a file, and "simulates typing" in another buffer. This will serve me towards recording programming videos where the code ...
0
votes
1
answer
159
views
Emacs freeze with async command
Emacs 27.0.50. Windows 10.
This function works finely when the line is commented:
(defun Pfedj/write-async-file ()
(interactive)
(async-start (lambda ()
(setq path "~/org/file....
1
vote
2
answers
602
views
Multi-processing via TRAMP with asynchronous shell commands
I found the following code in TRAMP:
(defun tramp-adb-handle-shell-command
(command &optional output-buffer error-buffer)
"Like `shell-command' for Tramp files."
(let* ((asynchronous (...
0
votes
1
answer
174
views
Change async-shell-command with a synchronous command keeping the dynamically displayed buffer
I have this snippet of code:
(async-shell-command
(concat "perl myscript.pl " (buffer-name))
(read-string "RETURN: ")
(with-temp-file "file.new"
(insert-file-contents "file.new")
(perform-...
1
vote
1
answer
253
views
How can I tail/stream output when evaluating org babel shell blocks?
I learnt about asynchronous execution of org babel shell code blocks,
thanks to:
How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh
I want to know if it's possible to tail/stream the ...
8
votes
1
answer
3k
views
Run elisp when `async-shell-command` is done
I want to run some Elisp when my command executed by async-shell-command terminates.
How can I do this? Does it have completion hooks?
2
votes
0
answers
226
views
How to debug hanging emacs-async command?
I'm trying to set up a function running on my timer to refresh my org-gcal files by using the emacs-async library as follows:
(async-get
(async-start
`(lambda ()
,(async-inject-variables "...
4
votes
1
answer
516
views
disable async new buffer question
When I give a new async command with an interactively called async-shell-command, it gives a message "A command is running in the default buffer. Use a new buffer? (y or n)". I think this behaviour ...
3
votes
0
answers
125
views
Org async export show pdf after completion
With synchronous export I can call C-c C-e l o to generate a pdf and open it. If I try the same keys with the async export, i.e. C-c C-e C-a l o, then the pdf will be generated but the pdf won't open.
...
5
votes
1
answer
468
views
Asynchronous version of shell-command-on-region?
I have a problem which is very similar to this one. I have some text that I'd like to listen to with macOS's say utility. Unfortunately, Emacs locks up when I use shell-command-on-region because it is ...
1
vote
1
answer
526
views
tramp + async-shell-command ignores shell-file-name
If I locally call async-shell-command it takes the shell from shell-file-name (/bin/bash).
However if I use su or ssh via tramp to invoke a shell command remotely it always runs as /bin/sh. The ...
1
vote
1
answer
782
views
Async shell command can't find command
I have installed the Rust programming language (Debian). Now i can compile and run programs from terminal (with the cargo build and cargo run commands), but not from inside emacs. The cargo compiler ...
0
votes
1
answer
115
views
Atomicity with asynchronous execution
Given code such as
(defun some-code ()
(url-retrieve my-url #'my-callback)
(setq *a-global-var* (some-func *a-global-var*))
...)
(defun my-callback (status &rest args)
(setq *a-global-...
1
vote
1
answer
82
views
Cleanly terminating asynchronous process after it reads stdin
I'm starting a process with start-process and immediately calling set-process-sentinel to get notifications when it ends. After attaching the sentinel I send the buffer's contents to the process's ...
0
votes
2
answers
260
views
Windows eshell alias command line arguments.. how?
I have alias msexcel (w32-browser "C:/program files/microsoft office/office12/excel.exe") and this means I can do msexcel from eshell and an asynchronous MS Excel will begin to run.
I am looking for ...
13
votes
1
answer
3k
views
Asynchronously wait for output from a comint process
First of all, a disclaimer. I have researched this many times, and I
am pretty sure that I have already found the answer one way or
another, but I just don't understand it.
My problem is the ...
9
votes
4
answers
1k
views
Async shell process buffer always clobbers window arrangement
I frequently launch external programs from emacs using M-!, such as Firefox or Evince, etc. Whenever I do, a buffer pops up full of results for the process, which clobbers whatever else I've got going ...
1
vote
1
answer
331
views
How to know when dired is done if called async?
If I am copying files using dired having previously called (dired-async-mode) to make it copy asynchronously, how do I know when it has successfully finished copying the files?
5
votes
0
answers
201
views
Is there some way to continue reading from a STDIN file descriptor when data is PIPED to Emacs on Command-line?
Historical Perspective
On Unix like operating systems, it is common practice to redirect IO between shell commands using pipes.
For example, the command below would insert all the lines that didn't ...