Hot answers tagged

8

The question was asked in 2016. Now in 2019, there exists M-x proced: Mode for displaying system processes and sending signals to them. Proced makes an Emacs buffer containing a listing of the current system processes. You can use the normal Emacs commands to move around in this buffer, and special Proced commands to operate on the processes listed....


5

Here's a simple function that gets the pid of the process running in the current buffer and then calls the pstree command to get the process tree of that process: (defun iproc () (interactive) (let ((pid (process-id (get-buffer-process (current-buffer))))) (shell-command (format "pstree -p %d" pid)))) If I have a *shell* buffer running bash, run ...


4

Or the simpler one would be : (setq kill-buffer-query-functions nil) Inspired from abo-abo config


4

If your ~/dotfiles/rundo.sh accepts stdin as input, like many other commands such as grep/wc/bash/python, to run a command with the region as stdin, simply run M-| ~/dotfiles/rundo.sh (M-| runs shell-command-on-region). If the command doesn't support stdin, the following should do what you described (defun rundo (beg end) "Wrapper of ~/dotfiles/rundo.sh."...


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 `...


3

Emacs 26.1 added the confirm-kill-processes variable. To disable conformation to kill processes on Emacs exit, add to your init file: (setq confirm-kill-processes nil) Documentation: Non-nil if Emacs should confirm killing processes on exit. If this variable is nil, the value of process-query-on-exit-flag is ignored. Otherwise, if there are processes ...


2

You can't usefully have two simultaneous Emacs session that use the same file to store the session state. Each time a session saves its state, it would overwrite the other session's state. Many people run a single Emacs session. To open a file in the existing Emacs session, use emacsclient (see also the Emacs wiki). Emacsclient has several options to ...


2

So you want to, after a certain amount of time, run some code? You can use a timer. In the simplest way of using it, you can pass it a number of seconds to wait, tell it not to repeat, then give it a lambda to run. For example: (run-at-time 1 ;; in one second nil ;; do NOT repeat (lambda () ;; this lambda is called ...


2

Note that script-proc-buffer will always be new-buffer since that is an existing buffer when make-comint-in-buffer is called. To bind kill-process to the key sequence q make it somehow interactive and use local-set-key with the wanted buffer current, e.g.: (with-current-buffer script-proc-buffer (local-set-key "q" (lambda () (interactive) (kill-process)))...


2

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.


1

You should start with Process Information: (process-command (get-buffer-process "*Python*")) ==> ("python3" "-i") (process-status (get-buffer-process "*Python*")) ==> run You should not be running ftp and python under bash under Emacs, but rather use the specific modes for them (e.g., M-x run-python &c). If you insist on doing it your way, you ...


1

In a private email, Christopher Wellons answered my question. The problem is that server-process is a special variable defined in server.el. Special variables are always dynamically bound. As a result, the filter closure doesn't close over the server-process variable. When the filter closure is evaluated, the server-process variable's value is the one from ...


1

It seems like the problem is that both Emacs and Vim want to control the entire screen. If I edit the function in the question to use date or a utility like that instead of Vim, there is no hang and the output replaces the buffer contents in the way I want. Fortunately, Emacs has a function called suspend-emacs which can be used to suspend Emacs, run some ...


1

One way I discovered is to construct the command send to the bash process in such a way that after the execution the bash process gets stopped: (format "%s; kill -s STOP %s\n" command (process-id bash-process)) This way a process-sentinel can be used to detect when the execution is done and can enable the process again: (defun sentinel (proc status) (...


1

Something like this? (defvar run-terminal-app-history nil) (defun run-terminal-app (command &optional name) "Runs COMMAND in a `term' buffer." (interactive (list (read-from-minibuffer "$ " nil nil nil 'run-terminal-app-history))) (let* ((name (or name command)) (switches (split-string-and-unquote command)) (command (pop ...


1

Use :command '("hello-world") instead. Here is the related docstring of make-process. :command COMMAND -- COMMAND is a list starting with the program file name, followed by strings to give to the program as arguments.


1

I believe the command you're looking for is (comint-send-eof). You can bind it with something like: (global-set-key (kbd "<f5>") 'comint-send-eof) It is bound, by default, to C-c C-d.


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