From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Skoglund Newsgroups: gmane.emacs.bugs Subject: bug#29156: 25.3; eshell/kill does not understand -, [PATCH] Make eshell/kill handle - and - Date: Fri, 23 Mar 2018 07:03:55 +0100 Message-ID: <87d0zv5nw4.fsf@pagefault.se> References: <87vaiprmg5.fsf@gmail.com> <87o9jnv9et.fsf@gmail.com> <87lgerv8tq.fsf@gmail.com> <83lgeroz7r.fsf@gnu.org> <87zi3661j2.fsf@pagefault.se> <83a7v6pkdf.fsf@gnu.org> <87muz65rh9.fsf@pagefault.se> <877eq3sisi.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1521784931 11020 195.159.176.226 (23 Mar 2018 06:02:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2018 06:02:11 +0000 (UTC) Cc: 29156@debbugs.gnu.org, ambrevar@gmail.com To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 23 07:02:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezFm9-0002kR-PX for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Mar 2018 07:02:06 +0100 Original-Received: from localhost ([::1]:36209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezFoC-0005Pu-OG for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Mar 2018 02:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezFo5-0005Pc-N4 for bug-gnu-emacs@gnu.org; Fri, 23 Mar 2018 02:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezFo2-0001DN-II for bug-gnu-emacs@gnu.org; Fri, 23 Mar 2018 02:04:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezFo2-0001Cq-DF for bug-gnu-emacs@gnu.org; Fri, 23 Mar 2018 02:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ezFo2-0005on-1S for bug-gnu-emacs@gnu.org; Fri, 23 Mar 2018 02:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Skoglund Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Mar 2018 06:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29156 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed easy Original-Received: via spool by 29156-submit@debbugs.gnu.org id=B29156.152178504022358 (code B ref 29156); Fri, 23 Mar 2018 06:04:01 +0000 Original-Received: (at 29156) by debbugs.gnu.org; 23 Mar 2018 06:04:00 +0000 Original-Received: from localhost ([127.0.0.1]:48530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezFo0-0005oY-5r for submit@debbugs.gnu.org; Fri, 23 Mar 2018 02:04:00 -0400 Original-Received: from pagefault.se ([31.7.186.167]:35298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezFny-0005oO-BT for 29156@debbugs.gnu.org; Fri, 23 Mar 2018 02:03:58 -0400 Original-Received: by pagefault.se (Postfix, from userid 5555) id 714529220105; Fri, 23 Mar 2018 06:03:56 +0000 (UTC) Original-Received: from pagefault.se (c-460be255.07-19-73746f67.cust.bredbandsbolaget.se [85.226.11.70]) by pagefault.se (Postfix) with ESMTPSA id BA6239220101; Fri, 23 Mar 2018 06:03:55 +0000 (UTC) In-Reply-To: <877eq3sisi.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144548 Archived-At: --=-=-= Content-Type: text/plain Noam Postavsky writes: > Thanks, do you have copyright assignment for Emacs? (the change is small > enough to install regardless, I'm asking just to know if it should be > marked as a tiny change). Yes it was completed on 2016-12-05 when I had grand plans to contribute to emacs (maybe thoose plans can be fullfilled now :)). > > A couple more minor nitpicks: > >> * doc/misc/eshell.texi (kill): Update docs to reflect new >> function behaviour >> * etc/NEWS: Mention new eshell/kill behaviour > > Missing periods here. > >> + (setq signum (intern (substring arg 1 (length arg)))))) > > That could be just (substring arg 1) > Thanks! > P.S. don't worry about the forwarding thing, it happens often enough > that I've written an Emacs command to mostly automate it. Ah great :) Here is the latest patch version. Thanks for all the help for a first time contributor! --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Make-eshell-kill-handle-signal-and-SIGNALNAME.patch Content-Description: Patch v4 >From 7588028d623a8312a7a359f2be4ba84426d0619e Mon Sep 17 00:00:00 2001 From: Eric Skoglund Date: Fri, 16 Mar 2018 14:49:56 +0100 Subject: [PATCH] Make eshell/kill handle - and - * 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 | 2 +- etc/NEWS | 5 +++++ 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 80077e5ccd..bda6159488 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -330,7 +330,7 @@ Built-ins @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 diff --git a/etc/NEWS b/etc/NEWS index b6c4157384..7df6eb4387 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -273,6 +273,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'. diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index b3bd7a7245..a7855d81db 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -167,7 +167,8 @@ eshell/jobs (defun eshell/kill (&rest args) "Kill processes. Usage: kill [-] | ... -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 @@ eshell/kill ((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 @@ eshell/kill (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." -- 2.13.6 --=-=-=--