diff options
| author | Eric Skoglund | 2018-03-16 14:49:56 +0100 |
|---|---|---|
| committer | Noam Postavsky | 2018-03-25 11:20:20 -0400 |
| commit | 1be6a21fd8b5ade67f7f69f964331aa570623683 (patch) | |
| tree | 6ff6e3406ebd0f99ffa8225b8edf4ebd1bd915de | |
| parent | 1d47d777ef24c0be9153b0a1c8ba21918fa1025a (diff) | |
| download | emacs-1be6a21fd8b5ade67f7f69f964331aa570623683.tar.gz emacs-1be6a21fd8b5ade67f7f69f964331aa570623683.zip | |
Make eshell/kill handle -<signal> and -<SIGNALNAME> (Bug#29156)
* lisp/eshell/esh-proc.el (eshell/kill): Handle the argument parsing
and numeric conversion in function in order to parse -signal and
-SIGNALNAME correctly.
* doc/misc/eshell.texi (kill): Update docs to reflect new function
behaviour.
* etc/NEWS: Mention new eshell/kill behaviour.
| -rw-r--r-- | doc/misc/eshell.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 9 |
3 files changed, 12 insertions, 4 deletions
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 80077e5ccdb..bda61594883 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi | |||
| @@ -330,7 +330,7 @@ List subprocesses of the Emacs process, if any, using the function | |||
| 330 | @item kill | 330 | @item kill |
| 331 | @cmindex kill | 331 | @cmindex kill |
| 332 | Kill processes. Takes a PID or a process object and an optional | 332 | Kill processes. Takes a PID or a process object and an optional |
| 333 | signal specifier. | 333 | signal specifier which can either be a number or a signal name. |
| 334 | 334 | ||
| 335 | @item listify | 335 | @item listify |
| 336 | @cmindex listify | 336 | @cmindex listify |
| @@ -278,6 +278,11 @@ To restore the old behavior, use | |||
| 278 | *** The function 'shell-uniquify-list' has been renamed from | 278 | *** The function 'shell-uniquify-list' has been renamed from |
| 279 | 'eshell-uniqify-list'. | 279 | 'eshell-uniqify-list'. |
| 280 | 280 | ||
| 281 | *** The function eshell/kill is now able to handle signal switches. | ||
| 282 | Previously eshell/kill would fail if provided a kill signal to send to the | ||
| 283 | process. It now accepts signals specified either by name or by its number. | ||
| 284 | |||
| 285 | |||
| 281 | ** Pcomplete | 286 | ** Pcomplete |
| 282 | *** The function 'pcomplete-uniquify-list' has been renamed from | 287 | *** The function 'pcomplete-uniquify-list' has been renamed from |
| 283 | 'pcomplete-uniqify-list'. | 288 | 'pcomplete-uniqify-list'. |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index b3bd7a72456..a7855d81db5 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -167,7 +167,8 @@ The signals which will cause this to happen are matched by | |||
| 167 | (defun eshell/kill (&rest args) | 167 | (defun eshell/kill (&rest args) |
| 168 | "Kill processes. | 168 | "Kill processes. |
| 169 | Usage: kill [-<signal>] <pid>|<process> ... | 169 | Usage: kill [-<signal>] <pid>|<process> ... |
| 170 | Accepts PIDs and process objects." | 170 | Accepts PIDs and process objects. Optionally accept signals |
| 171 | and signal names." | ||
| 171 | ;; If the first argument starts with a dash, treat it as the signal | 172 | ;; If the first argument starts with a dash, treat it as the signal |
| 172 | ;; specifier. | 173 | ;; specifier. |
| 173 | (let ((signum 'SIGINT)) | 174 | (let ((signum 'SIGINT)) |
| @@ -178,12 +179,12 @@ Accepts PIDs and process objects." | |||
| 178 | ((string-match "\\`-[[:digit:]]+\\'" arg) | 179 | ((string-match "\\`-[[:digit:]]+\\'" arg) |
| 179 | (setq signum (abs (string-to-number arg)))) | 180 | (setq signum (abs (string-to-number arg)))) |
| 180 | ((string-match "\\`-\\([[:upper:]]+\\|[[:lower:]]+\\)\\'" arg) | 181 | ((string-match "\\`-\\([[:upper:]]+\\|[[:lower:]]+\\)\\'" arg) |
| 181 | (setq signum (abs (string-to-number arg))))) | 182 | (setq signum (intern (substring arg 1))))) |
| 182 | (setq args (cdr args)))) | 183 | (setq args (cdr args)))) |
| 183 | (while args | 184 | (while args |
| 184 | (let ((arg (if (eshell-processp (car args)) | 185 | (let ((arg (if (eshell-processp (car args)) |
| 185 | (process-id (car args)) | 186 | (process-id (car args)) |
| 186 | (car args)))) | 187 | (string-to-number (car args))))) |
| 187 | (when arg | 188 | (when arg |
| 188 | (cond | 189 | (cond |
| 189 | ((null arg) | 190 | ((null arg) |
| @@ -198,6 +199,8 @@ Accepts PIDs and process objects." | |||
| 198 | (setq args (cdr args)))) | 199 | (setq args (cdr args)))) |
| 199 | nil) | 200 | nil) |
| 200 | 201 | ||
| 202 | (put 'eshell/kill 'eshell-no-numeric-conversions t) | ||
| 203 | |||
| 201 | (defun eshell-read-process-name (prompt) | 204 | (defun eshell-read-process-name (prompt) |
| 202 | "Read the name of a process from the minibuffer, using completion. | 205 | "Read the name of a process from the minibuffer, using completion. |
| 203 | The prompt will be set to PROMPT." | 206 | The prompt will be set to PROMPT." |