Closed mankoff closed 10 years ago
Ken Mankoff notifications@github.com writes:
How do I use emacs-async and not get hung processes?
I'm using emacs-async like so:
(add-hook 'after-save-hook (lambda () (if (or (eq major-mode 'org-mode) (eq major-mode 'org-agenda-mode)) (dolist (file (org-mobile-files-alist)) (if (string= (expand-file-name (car file)) You should compare your filenames with `file-equal-p'. (buffer-file-name)) (fork-org-push-mobile) ))))) (defun fork-org-push-mobile () (async-start `(lambda () (org-mobile-push) ) 'ignore) )
The external emacs session where you are forking to execute async
org-mobile-push' know nothing about this function, and all other org related vars/functions, so you should instruct this Emacs about this. For this, require the needed libraries and use
async-inject-variables'.
Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997
Oops. I do inject variables. When I removed some commented lines while pasting above I cut a valid line. Between lambda
and org-mobile-push
I have: ,(async-inject-variables "org-directory\\|org-mobile-.*\\|org-agenda-files")
So, async-inject-variables
is used. Can you give more specific advice about the other related vars-functions? How/where would I go about loading a file called my-org-mode.el
? And I presume the file-equal-p
comment above is an improvement but not causing this bug...
Ken Mankoff notifications@github.com writes:
Oops. I do inject variables. When I removed some commented lines while pasting above I cut a valid line. Between
lambda
and org-mobile-pushI have:
,(async-inject-variables "org-directory|org-mobile-.*|org-agenda-files")` This will setq all these vars but you have to require your org stuff before (Emacs know nothing about these vars).So,
async-inject-variables
is used. Can you give more specific advice about the other related vars-functions? How/where would I go about loading a file calledmy-org-mode.el
?
async-start ;; 1) require the needed libraries ;; 2) inject vars (they will have the value that are in your current emacs)
And I presume the file-equal-p` comment above is an improvement but not causing this bug... Yes.
Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997
The function I want to run asynchronously ((org-mobile-push)
) does run just fine. And it runs with the top code I posted (now edited to include the inject
). But often (but not always) emacs processes are still left hanging, to be discovered when I try to quit emacs.
The external async processes may or may not know certain things, but it knows enough to do what I want it to do. Unfortunately, I don't know enough how to get it to do that and then exit cleanly... Any more hints or thoughts on why it might be hanging?
I have a similar issue, perhaps related. I also use async.el to run a wrapped org-mobile-push. I have no process buffers left in emacs, but i noticed that leftover emacs processes exist on linux. They all look like this:
/usr/local/bin/emacs -Q -l /home/mrb/.emacs.d/el-get/async/async.el -batch -f async-batch-invoke
They are not hanging in the 'not running' sense, but looks like they are waiting on input (strace shows incomplete read(0,..)
I think this is fixed now, and we have anyway a notification in mode-line showing if a job is running or not. Closing, feel free to reopen.
How do I use emacs-async and not get hung processes?
I'm using emacs-async like so:
When I try to exit emacs, I get a warning that says:
And a buffer
*Process List*
appears that is full of emacs-async processes like so: