19

First of all, you shouldn't be using accept-process-output if you want asynchronous processing. Emacs will accept output every time when it is waiting for user input. The proper way to go is to use filter functions to intercept the output. You don't need to create or delete the filter(s) depending on whether you still have lines to send. Rather, you will ...


12

As already answered in the comments, Emacs becoming very slow in its redisplay for long lines is a well-known issue. Fixing it would be very nice, but needs lots of thought to be pulled off correctly. I have an idea of how it could be accomplished based on section 6.3 of this document (basically, store visual line information in the current buffer and ...


7

This is fixed in Emacs 25, where you can use the make-process function with the :stderr argument. I don't think there's anything suitable in Emacs 24.


7

As I understand it, this is a non-issue. Emacs is single-threaded, and only processes output from subprocesses when idle. Therefore, there is no time between calling start-file-process and set-process-filter when process output could arrive without being handled. The info page (elisp) Accepting Output states: Output from asynchronous subprocesses ...


6

default-directory has to be a directory, not the filename of a directory. In other words it has to end with a slash. In some places it does not matter whether a directory path ends with a slash or not, here it does. (let ((default-directory "/some/directory/")) ...)


5

For two processes A and B mutually killing each other you can use the following approach: Start the first process just with start-process and remember its process (as lisp object). Start the second process B with async-start-process and kill A in its finish-func. Define a process sentinel for A which kills B at exit of A. Running example: (defun make-kill-...


4

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'." (interactive) (start-process "espeak-process" "espeak-buffer" "espeak" "-v" "en-us") (process-send-region "espeak-process" (region-beginning) (region-end))) EDIT: ...


4

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" read by Emacs and passed to the process filter, which is a function you provide via set-process-filter. The main difficulty is that you don't get to choose ...


4

setenv-internal and setenv change the list stored in process-environment (as local or special variable) by side-effects. It does not help if you assign the list (pointer) to a local variable process-environment. You still have only a single list for the process-environment which is just bound to two variables -- the global variable process-environment and ...


4

Just run-lisp. Afterwards, you can use e.g. C-c C-l (lisp-load-file) to eval a source file. C-c C-e (lisp-eval-defun) to eval a statement. Still, I can't imagine why someone wouldn't want to run SLIME.


4

As this happened with Python likewise, solution at python-mode.el, https://launchpad.net/python-mode, is to connect to process directly, not via comint-mode. Relies on start-process and process-send-string For example see functions py--start-fast-process and py--fast-send-string-intern


4

You can use call-process-region to send string to a program as standard input, for example, (with-temp-buffer (call-process-region "Hello, World!" nil "cat" nil t nil "-n") (buffer-string)) ;; => " 1 Hello, World!"


3

In eshell, process subshells are generally done with ${...} syntax. However, the output is produced in the form of an intermediate Emacs Lisp expression. ~ $ echo ${cd ~/.emacs.d; ls} | cat ("README.md" "ac-comphist.dat" #("auto-save-list" 0 14 (font-lock-face eshell-ls-directory)) #("bin" 0 3 (font-lock-face eshell-ls-directory)) "custom.el"...


3

Just expand the file name: (let ((default-directory "/Users/HOME/Desktop/tmp")) (start-process "touch-file" nil "touch" (expand-file-name "test.txt")))


3

I suspect that the simplest approach is entirely adequate here. Using a synchronous process will prevent you from inadvertently typing into the wrong buffer -- anything you do type while the command is running will be buffered and will end up where you want it: as input to the find-tag prompt. e.g.: (defun my-find-tag () "Update TAGS file and then call `...


2

Can you do the setup in your shell before you start emacs? The compile sub-shell should inherit the environment from its grandparent via emacs.


2

The easy way would be to install ssh-askpass. This is the program that ssh-add runs when its standard input is not a terminal but an X11 display is available. The program ssh-askpass prompts for your passphrase in a separate GUI window. If you want to stay within Emacs, or if you want a solution that works whether X11 is available or not, you can make Emacs ...


2

So this isn't a proper solution but I ran your test the other way around (e.g. the while [1] on the second shell) and it works fine. As a work around you could ensure that any shell buffers that are likely to be generating heavy output are created later than the ones where you want interactivity. That way the interactive shells are the first to be handled by ...


2

{ ... } has very varying behavior (at least, from the point of view of bash): ~ $ {echo a b c} | tr [[:lower:]] [[:upper:]] ("A" "B" "C")~ $ ~ $ {echo hi} | tr [[:lower:]] [[:upper:]] HI~ $ {/bin/echo a b c} | tr [[:lower:]] [[:upper:]] ~ $ A B C ~ $ echo {echo a b c} ("a" "b" "c") ~ $ echo {/bin/echo a b c} ~ $ echo {/bin/echo hi} ~ $ echo {echo hi} hi ~ ...


2

Not sure how to fix it (I really mean it: I've tried to fix this bug in the past, but my POSIX-fu is not strong enough), but you can circumvent it by creating your process with process-connection-type bound to nil so it doesn't use a tty but a pipe.


2

You can use "process sentinel" mentioned in @steve-lorimer's answer if it is OK for you to get color AFTER the process is finished, otherwise you should use "process filter" instead. Take command echo -e "\e[31mHello World\e[0m" as an example, you can simply use comint-output-filter (I learnt this by reading shell-command's source code) (let ((process ...


2

The "let binding" way is the following (notice that contrary to Tobias's answer, this does not involve any copying or "set"ting): (let ((process-environment (cons "HOME" (cons (concat "OLDHOME=" (getenv "HOME")) process-environment)))) (start-process "proc" (current-buffer) ...))


1

The only thing I know of for this is setting process-adaptive-read-buffering to nil before starting the process. I don't know whether this will help with your situation or not.


1

call-process, despite normally being used for synchronous process calls: call-process is a built-in function in `C source code'. (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) [...] Insert output in DESTINATION before point[...]0 means discard and don't wait [...] If DESTINATION is 0, `call-process' returns immediately with ...


1

You don't need the (:file ) just give the error file as second element in the list. BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, REAL-BUFFER says what to do with standard output, as above, while STDERR-FILE says what to do with standard error in the child. So you would call: (call-process-region beg end perltidy-executable t '(t "...


1

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.


1

I found a solution to my problem here: https://stackoverflow.com/questions/23021875/wait-on-shell-command-to-finish-before-executing-another-elisp-command I resolved by using: (call-process-shell-command (concat "latex " (buffer-file-name)) nil nil) that does almost the same and that doesn't use sentinels.


1

After (re)reading the code of the shell function, here's what I'd do: (advice-add 'make-comint-in-buffer :around #'my-enable-auto-save-in-shell) (defun my-enable-auto-save-in-shell (origfun procname &rest args) (if (not (equal procname "shell")) (apply origfun procname args) ;; Not a shell, nothing to do. ;; Enable auto-save-...


1

Add the following to the end of your lambda() routine: (goto-char (point-max)) (insert (concat "export EMACS_AS_FILE=" buffer-auto-save-file-name)) The shell command to assign your variable will automatically appear on the command line; simply hit enter to set it.


1

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) (defun eshell/w32-launch (&rest args) (w32-browser (if (eq nil args) "." (car args)))))


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