mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-07 15:21:46 +00:00
Make 'delete-process' into a command
* doc/lispref/processes.texi (Deleting Processes): Document missing PROCESS value. * src/process.c (Fdelete_process): Allow calling interactively (bug#10107).
This commit is contained in:
parent
2e461ab2dc
commit
fc0bd6057c
@ -1011,16 +1011,18 @@ terminated (due to calling @code{exit} or to a signal). If it is
|
||||
they exit.
|
||||
@end defopt
|
||||
|
||||
@defun delete-process process
|
||||
@defun delete-process &optional process
|
||||
This function deletes a process, killing it with a @code{SIGKILL}
|
||||
signal if the process was running a program. The argument may be a
|
||||
process, the name of a process, a buffer, or the name of a buffer. (A
|
||||
buffer or buffer-name stands for the process that
|
||||
@code{get-buffer-process} returns.) Calling @code{delete-process} on
|
||||
a running process terminates it, updates the process status, and runs
|
||||
the sentinel immediately. If the process has already terminated,
|
||||
calling @code{delete-process} has no effect on its status, or on the
|
||||
running of its sentinel (which will happen sooner or later).
|
||||
@code{get-buffer-process} returns, and a missing or @code{nil}
|
||||
@var{process} means that the current buffer's process should be
|
||||
killed.) Calling @code{delete-process} on a running process
|
||||
terminates it, updates the process status, and runs the sentinel
|
||||
immediately. If the process has already terminated, calling
|
||||
@code{delete-process} has no effect on its status, or on the running
|
||||
of its sentinel (which will happen sooner or later).
|
||||
|
||||
If the process object represents a network, serial, or pipe
|
||||
connection, its status changes to @code{closed}; otherwise, it changes
|
||||
|
7
etc/NEWS
7
etc/NEWS
@ -248,6 +248,13 @@ removed some time after that.
|
||||
|
||||
* Changes in Emacs 29.1
|
||||
|
||||
---
|
||||
** 'delete-process' is now a command.
|
||||
When called interactively, it will kill the process running in the
|
||||
current buffer (if any). This can be useful if you have runaway
|
||||
output in the current buffer (from a process or a network connection),
|
||||
and want to stop it.
|
||||
|
||||
+++
|
||||
** New command 'restart-emacs'.
|
||||
This is like 'save-buffers-kill-emacs', but instead of just killing
|
||||
|
@ -1071,13 +1071,24 @@ record_deleted_pid (pid_t pid, Lisp_Object filename)
|
||||
|
||||
}
|
||||
|
||||
DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
|
||||
DEFUN ("delete-process", Fdelete_process, Sdelete_process, 0, 1,
|
||||
"(list 'message)",
|
||||
doc: /* Delete PROCESS: kill it and forget about it immediately.
|
||||
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
||||
nil, indicating the current buffer's process. */)
|
||||
nil, indicating the current buffer's process.
|
||||
|
||||
Interactively, it will kill the current buffer's process. */)
|
||||
(register Lisp_Object process)
|
||||
{
|
||||
register struct Lisp_Process *p;
|
||||
bool mess = false;
|
||||
|
||||
/* We use this to see whether we were called interactively. */
|
||||
if (EQ (process, Qmessage))
|
||||
{
|
||||
mess = true;
|
||||
process = Qnil;
|
||||
}
|
||||
|
||||
process = get_process (process);
|
||||
p = XPROCESS (process);
|
||||
@ -1131,6 +1142,8 @@ nil, indicating the current buffer's process. */)
|
||||
}
|
||||
}
|
||||
remove_process (process);
|
||||
if (mess)
|
||||
message ("Deleted process");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
@ -8637,6 +8650,7 @@ sentinel or a process filter function has an error. */);
|
||||
|
||||
DEFSYM (Qnull, "null");
|
||||
DEFSYM (Qpipe_process_p, "pipe-process-p");
|
||||
DEFSYM (Qmessage, "message");
|
||||
|
||||
defsubr (&Sprocessp);
|
||||
defsubr (&Sget_process);
|
||||
|
Loading…
Reference in New Issue
Block a user