From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#26649: 26.0.50; buffer-command: Return the cmd that started a process in buffer Date: Wed, 26 Apr 2017 13:03:36 +0300 Message-ID: <83a873pjt3.fsf@gnu.org> References: <87a874299d.fsf@calancha-pc> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1493201120 9064 195.159.176.226 (26 Apr 2017 10:05:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2017 10:05:20 +0000 (UTC) Cc: 26649@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 26 12:05:11 2017 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 1d3Jot-00023N-30 for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Apr 2017 12:05:11 +0200 Original-Received: from localhost ([::1]:53976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Jou-0002t1-3P for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Apr 2017 06:05:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Jon-0002rj-G2 for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 06:05:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3Jok-0000ie-BH for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 06:05:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42380) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3Jok-0000iZ-81 for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 06:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d3Joj-0005NO-U1 for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 06:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Apr 2017 10:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26649 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26649-submit@debbugs.gnu.org id=B26649.149320106520619 (code B ref 26649); Wed, 26 Apr 2017 10:05:01 +0000 Original-Received: (at 26649) by debbugs.gnu.org; 26 Apr 2017 10:04:25 +0000 Original-Received: from localhost ([127.0.0.1]:40579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3Jo8-0005MV-TV for submit@debbugs.gnu.org; Wed, 26 Apr 2017 06:04:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3Jo7-0005MI-Vi for 26649@debbugs.gnu.org; Wed, 26 Apr 2017 06:04:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3Jnz-0000Wo-K9 for 26649@debbugs.gnu.org; Wed, 26 Apr 2017 06:04:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Jnz-0000Wi-H2; Wed, 26 Apr 2017 06:04:15 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3549 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d3Jny-00059b-To; Wed, 26 Apr 2017 06:04:15 -0400 In-reply-to: <87a874299d.fsf@calancha-pc> (message from Tino Calancha on Tue, 25 Apr 2017 17:15:26 +0900) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:132000 Archived-At: > From: Tino Calancha > Date: Tue, 25 Apr 2017 17:15:26 +0900 > > Severity: wishlist > > I define in my private customization a command `buffer-command', which > calls `process-command' on the process associated with the current > buffer. > Interactively, it shows in the echo area the command as the last column > of `list-processes' does. > Is anyone interested in adding this feature? I don't have an opinion on this, perhaps others will offer theirs. I do have a few comments: > Subject: [PATCH] buffer-command: Return the cmd that started a process in > buffer ^^^^^^ Not "return", "display". > * lisp/simple.el (buffer-command): Return command executed to > start a process in BUFFER (Bug#26649). Likewise. Also, we generally use just "new command" in these cases. > * doc/lispref/processes.texi (Process Information): Document new command. It is better to mention the name of the command. > +@deffn Command buffer-command &optional buffer I think it would be better to have the command's name start with "process-", so something like process-command-in-buffer. > +This command calls @code{process-command} on the process associated > +with @var{buffer}. This describes the implementation; it should instead describe the effect of the command. > +If @var{buffer} is not associated with a running process, then returns > +@code{nil}. The value returned by a command is not interesting, you should describe the effect of invoking this command in a buffer that has n o associated process. > +(defun buffer-command (&optional buffer) > + "Return the command that was executed to start the process in BUFFER. Same comment here: describe the effect, not the return value. If the returned value is important for non-interactive invocations, it should be described in addition to the effect of an interactive invocation. > +Buffer defaults to the current buffer. ^^^^^^ BUFFER > + (error "Not a living buffer '%S'" buffer)) "Not a live buffer '%S'" > + (cond ((null cmd) > + (message "No process in buffer '%s'" (buffer-name buf)) It is better to say something like Buffer '%s' is not associated with any process Btw, why %s here and %S in the error message? > + (t > + (message "%s" (mapconcat #'identity cmd " ")) What will this produce if some of the command-line arguments include embedded whitespace? > +(ert-deftest subr-tests--buffer-command () > + (let ((program (executable-find "sleep")) > + (timeout "10") proc) Instead of bypassing the test where 'sleep' doesn't exist, how about if you use the Emacs executable instead? That will always exist. Thanks.