]> git.eshelyaron.com Git - emacs.git/commitdiff
Make eshell/kill handle -<signal> and -<SIGNALNAME> (Bug#29156)
authorEric Skoglund <eric@pagefault.se>
Fri, 16 Mar 2018 13:49:56 +0000 (14:49 +0100)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 25 Mar 2018 15:20:20 +0000 (11:20 -0400)
* 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.

doc/misc/eshell.texi
etc/NEWS
lisp/eshell/esh-proc.el

index 80077e5ccdb424d2b05300bb8108f0f2379e4889..bda61594883949633235afabdf474d4877886ffc 100644 (file)
@@ -330,7 +330,7 @@ List subprocesses of the Emacs process, if any, using the function
 @item kill
 @cmindex kill
 Kill processes.  Takes a PID or a process object and an optional
-signal specifier.
+signal specifier which can either be a number or a signal name.
 
 @item listify
 @cmindex listify
index d1db830afa18a7f34949bbb6839dc309ee2cba57..2f43125cefa3a2af04ed628fc66ea7a1f8f8bcb9 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -278,6 +278,11 @@ To restore the old behavior, use
 *** The function 'shell-uniquify-list' has been renamed from
 'eshell-uniqify-list'.
 
+*** The function eshell/kill is now able to handle signal switches.
+Previously eshell/kill would fail if provided a kill signal to send to the
+process.  It now accepts signals specified either by name or by its number.
+
+
 ** Pcomplete
 *** The function 'pcomplete-uniquify-list' has been renamed from
 'pcomplete-uniqify-list'.
index b3bd7a7245649ae9459b73b68bcc6789df656a73..a7855d81db50bfc5e4feb90980a4702b4d96a9c2 100644 (file)
@@ -167,7 +167,8 @@ The signals which will cause this to happen are matched by
 (defun eshell/kill (&rest args)
   "Kill processes.
 Usage: kill [-<signal>] <pid>|<process> ...
-Accepts PIDs and process objects."
+Accepts PIDs and process objects.  Optionally accept signals
+and signal names."
   ;; If the first argument starts with a dash, treat it as the signal
   ;; specifier.
   (let ((signum 'SIGINT))
@@ -178,12 +179,12 @@ Accepts PIDs and process objects."
          ((string-match "\\`-[[:digit:]]+\\'" arg)
           (setq signum (abs (string-to-number arg))))
          ((string-match "\\`-\\([[:upper:]]+\\|[[:lower:]]+\\)\\'" arg)
-          (setq signum (abs (string-to-number arg)))))
+          (setq signum (intern (substring arg 1)))))
         (setq args (cdr args))))
     (while args
       (let ((arg (if (eshell-processp (car args))
                      (process-id (car args))
-                   (car args))))
+                   (string-to-number (car args)))))
         (when arg
           (cond
            ((null arg)
@@ -198,6 +199,8 @@ Accepts PIDs and process objects."
       (setq args (cdr args))))
   nil)
 
+(put 'eshell/kill 'eshell-no-numeric-conversions t)
+
 (defun eshell-read-process-name (prompt)
   "Read the name of a process from the minibuffer, using completion.
 The prompt will be set to PROMPT."