diff options
| author | Lars Ingebrigtsen | 2022-06-26 22:45:39 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-06-26 22:45:39 +0200 |
| commit | ed84f24a215a65dcf2ef49d343eebdbd4be178ee (patch) | |
| tree | 6e0bfde02f305697efe6291a3969483df794a52d /src | |
| parent | 19c44e2be30a2549db446308a128acdff4686c28 (diff) | |
| download | emacs-ed84f24a215a65dcf2ef49d343eebdbd4be178ee.tar.gz emacs-ed84f24a215a65dcf2ef49d343eebdbd4be178ee.zip | |
Make `signal-process' allow completing over signal names
* lisp/simple.el (read-signal-name): New function.
* src/process.c (Fsignal_process): Use it to allow completing over
the signal names (bug#56239).
(Fsignal_names): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c index b2847ee1725..5cb5d952229 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -7109,7 +7109,7 @@ See function `signal-process' for more details on usage. */) | |||
| 7109 | } | 7109 | } |
| 7110 | 7110 | ||
| 7111 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, | 7111 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, |
| 7112 | 2, 3, "sProcess (name or number): \nnSignal code: ", | 7112 | 2, 3, "(list (read-string \"Process (name or number): \") (read-signal-name))", |
| 7113 | doc: /* Send PROCESS the signal with code SIGCODE. | 7113 | doc: /* Send PROCESS the signal with code SIGCODE. |
| 7114 | PROCESS may also be a number specifying the process id of the | 7114 | PROCESS may also be a number specifying the process id of the |
| 7115 | process to signal; in this case, the process need not be a child of | 7115 | process to signal; in this case, the process need not be a child of |
| @@ -8317,6 +8317,22 @@ If QUERY is `all', also count processors not available. */) | |||
| 8317 | #endif | 8317 | #endif |
| 8318 | } | 8318 | } |
| 8319 | 8319 | ||
| 8320 | DEFUN ("signal-names", Fsignal_names, Ssignal_names, 0, 0, 0, | ||
| 8321 | doc: /* Return a list of known signal names on this system. */) | ||
| 8322 | (void) | ||
| 8323 | { | ||
| 8324 | char name[SIG2STR_MAX]; | ||
| 8325 | Lisp_Object names = Qnil; | ||
| 8326 | for (int i = 0; i < 255; ++i) | ||
| 8327 | { | ||
| 8328 | if (!sig2str (i, name)) | ||
| 8329 | { | ||
| 8330 | names = Fcons (build_string (name), names); | ||
| 8331 | } | ||
| 8332 | } | ||
| 8333 | return names; | ||
| 8334 | } | ||
| 8335 | |||
| 8320 | #ifdef subprocesses | 8336 | #ifdef subprocesses |
| 8321 | /* Arrange to catch SIGCHLD if this hasn't already been arranged. | 8337 | /* Arrange to catch SIGCHLD if this hasn't already been arranged. |
| 8322 | Invoke this after init_process_emacs, and after glib and/or GNUstep | 8338 | Invoke this after init_process_emacs, and after glib and/or GNUstep |
| @@ -8770,4 +8786,5 @@ sentinel or a process filter function has an error. */); | |||
| 8770 | defsubr (&Slist_system_processes); | 8786 | defsubr (&Slist_system_processes); |
| 8771 | defsubr (&Sprocess_attributes); | 8787 | defsubr (&Sprocess_attributes); |
| 8772 | defsubr (&Snum_processors); | 8788 | defsubr (&Snum_processors); |
| 8789 | defsubr (&Ssignal_names); | ||
| 8773 | } | 8790 | } |