aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorMichael Albinus2017-08-21 17:30:33 +0200
committerMichael Albinus2017-08-21 17:30:33 +0200
commit01844e40dc43baf1fdc088ef6400343e908ea449 (patch)
tree65ffb9b54340522908591de90a01f402b6226b8d /src/process.c
parent76fbe2f4541b11af8bcb0b5e57bb155b796b8d8e (diff)
downloademacs-01844e40dc43baf1fdc088ef6400343e908ea449.tar.gz
emacs-01844e40dc43baf1fdc088ef6400343e908ea449.zip
Implement `interrupt-process-functions'
* lisp/net/tramp.el (tramp-interrupt-process): Rename from `tramp-advice-interrupt-process'. Adapt according to changed API. (top): Add it to `interrupt-process-functions'. * src/process.c (Finternal_default_interrupt_process): New defun. (Finterrupt_process): Change implementation, based on Vinterrupt_process_functions. (Vinterrupt_process_functions): New defvar. * test/lisp/net/tramp-tests.el (tramp-test40-unload): Do not test removal of advice.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c
index 19009515336..e7ee99ab3d9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6677,6 +6677,18 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
6677 unblock_child_signal (&oldset); 6677 unblock_child_signal (&oldset);
6678} 6678}
6679 6679
6680DEFUN ("internal-default-interrupt-process",
6681 Finternal_default_interrupt_process,
6682 Sinternal_default_interrupt_process, 0, 2, 0,
6683 doc: /* Default function to interrupt process PROCESS.
6684It shall be the last element in list `interrupt-process-functions'.
6685See function `interrupt-process' for more details on usage. */)
6686 (Lisp_Object process, Lisp_Object current_group)
6687{
6688 process_send_signal (process, SIGINT, current_group, 0);
6689 return process;
6690}
6691
6680DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, 6692DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0,
6681 doc: /* Interrupt process PROCESS. 6693 doc: /* Interrupt process PROCESS.
6682PROCESS may be a process, a buffer, or the name of a process or buffer. 6694PROCESS may be a process, a buffer, or the name of a process or buffer.
@@ -6688,11 +6700,14 @@ If the process is a shell, this means interrupt current subjob
6688rather than the shell. 6700rather than the shell.
6689 6701
6690If CURRENT-GROUP is `lambda', and if the shell owns the terminal, 6702If CURRENT-GROUP is `lambda', and if the shell owns the terminal,
6691don't send the signal. */) 6703don't send the signal.
6704
6705This function calls the functions of `interrupt-process-functions' in
6706the order of the list, until one of them returns non-`nil'. */)
6692 (Lisp_Object process, Lisp_Object current_group) 6707 (Lisp_Object process, Lisp_Object current_group)
6693{ 6708{
6694 process_send_signal (process, SIGINT, current_group, 0); 6709 return CALLN (Frun_hook_with_args_until_success, Qinterrupt_process_functions,
6695 return process; 6710 process, current_group);
6696} 6711}
6697 6712
6698DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0, 6713DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0,
@@ -8176,6 +8191,17 @@ non-nil value means that the delay is not reset on write.
8176The variable takes effect when `start-process' is called. */); 8191The variable takes effect when `start-process' is called. */);
8177 Vprocess_adaptive_read_buffering = Qt; 8192 Vprocess_adaptive_read_buffering = Qt;
8178 8193
8194 DEFVAR_LISP ("interrupt-process-functions", Vinterrupt_process_functions,
8195 doc: /* List of functions to be called for `interrupt-function'.
8196The arguments of the functions are the same as for `interrupt-function'.
8197These functions are called in the order of the list, until one of them
8198returns non-`nil'. */);
8199 Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process);
8200
8201 DEFSYM (Qinternal_default_interrupt_process,
8202 "internal-default-interrupt-process");
8203 DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions");
8204
8179 defsubr (&Sprocessp); 8205 defsubr (&Sprocessp);
8180 defsubr (&Sget_process); 8206 defsubr (&Sget_process);
8181 defsubr (&Sdelete_process); 8207 defsubr (&Sdelete_process);
@@ -8218,6 +8244,7 @@ The variable takes effect when `start-process' is called. */);
8218 defsubr (&Saccept_process_output); 8244 defsubr (&Saccept_process_output);
8219 defsubr (&Sprocess_send_region); 8245 defsubr (&Sprocess_send_region);
8220 defsubr (&Sprocess_send_string); 8246 defsubr (&Sprocess_send_string);
8247 defsubr (&Sinternal_default_interrupt_process);
8221 defsubr (&Sinterrupt_process); 8248 defsubr (&Sinterrupt_process);
8222 defsubr (&Skill_process); 8249 defsubr (&Skill_process);
8223 defsubr (&Squit_process); 8250 defsubr (&Squit_process);