From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: peder@klingenberg.no (Peder O. Klingenberg) Newsgroups: gmane.emacs.bugs Subject: bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t' Date: Mon, 20 Feb 2017 21:55:15 +0100 Message-ID: References: <83efytpmj4.fsf@gnu.org> <87d1eceo2t.fsf@linux-m68k.org> <83y3x0ohm9.fsf@gnu.org> <878tp0eks9.fsf@linux-m68k.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1487624179 32074 195.159.176.226 (20 Feb 2017 20:56:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 20 Feb 2017 20:56:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) Cc: 25708@debbugs.gnu.org, alexhutcheson@google.com To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 20 21:56:13 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 1cfv0G-0007uQ-Qx for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Feb 2017 21:56:13 +0100 Original-Received: from localhost ([::1]:41058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfv0M-00036N-G1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Feb 2017 15:56:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfv0B-00034X-7R for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2017 15:56:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfv06-0003Oa-Cy for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2017 15:56:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cfv06-0003OT-9I for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2017 15:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cfv06-0007YC-33 for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2017 15:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: peder@klingenberg.no (Peder O. Klingenberg) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2017 20:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25708 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25708-submit@debbugs.gnu.org id=B25708.148762413328987 (code B ref 25708); Mon, 20 Feb 2017 20:56:02 +0000 Original-Received: (at 25708) by debbugs.gnu.org; 20 Feb 2017 20:55:33 +0000 Original-Received: from localhost ([127.0.0.1]:47843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfuzd-0007XS-8W for submit@debbugs.gnu.org; Mon, 20 Feb 2017 15:55:33 -0500 Original-Received: from tarrant.klingenberg.no ([80.91.231.253]:35066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfuzb-0007XK-L3 for 25708@debbugs.gnu.org; Mon, 20 Feb 2017 15:55:32 -0500 Original-Received: from [94.102.36.20] (helo=modesty.localdomain) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1cfuzO-0001nJ-57; Mon, 20 Feb 2017 21:55:27 +0100 Original-Received: by modesty.localdomain (Postfix, from userid 502) id F27ED17152A3; Mon, 20 Feb 2017 21:55:15 +0100 (CET) In-Reply-To: <878tp0eks9.fsf@linux-m68k.org> (Andreas Schwab's message of "Mon, 20 Feb 2017 20:15:18 +0100") 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:129596 Archived-At: --=-=-= Content-Type: text/plain Andreas Schwab writes: > Then it's not a good word to describe the option. Better would be > --suppress-output. I thought it succinctly expressed what the flag did, but I have no objection to --suppress-output. Attached is the latest version of the patch, with all objections raised so far addressed. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-option-u-suppress-output-to-emacsclient.patch >From 5db44b3f36eedb26865a7761152fac764eb7c0f7 Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Sun, 19 Feb 2017 20:59:14 +0100 Subject: [PATCH] New option -u / --suppress-output to emacsclient When evaluating expressions for side-effects with emacsclient, the result returned from the server is often useless. These new options allow the user to skip the printing of non-error results. (Bug#25708) * lib-src/emacsclient.c (print_help_and_exit, longopts) (decode_options, main): Implement new option --suppress-output / -u to suppress printing of eval-results. * doc/emacs/misc.texi (emacsclient Options): Document new --suppress-output / -u options. --- doc/emacs/misc.texi | 6 ++++++ etc/NEWS | 4 ++++ lib-src/emacsclient.c | 37 ++++++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 091ead1bae..bcc20a6db1 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1847,6 +1847,12 @@ emacsclient Options Do not let @command{emacsclient} display messages about waiting for Emacs or connecting to remote server sockets. +@item -u +@itemx --suppress-output +Do not let @command{emacsclient} display results returned from the +server. Mostly useful in combination with @samp{-e} when the +evaluation performed is for side-effect rather than result. + @item -s @var{server-name} @itemx --socket-name=@var{server-name} Connect to the Emacs server named @var{server-name}. The server name diff --git a/etc/NEWS b/etc/NEWS index 143e4655de..c727471e64 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -321,6 +321,10 @@ substituted by a home directory by writing it as "/foo:/:/~/file". settings of 'scroll-margin' up to half the window size, instead of always restricting the margin to a quarter of the window. ++++ +** Emacsclient has a new option -u/--suppress-output. The option +suppresses display of return values from the server process. + * Editing Changes in Emacs 26.1 diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 70709ecec0..7b735dfb05 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -118,6 +118,9 @@ int nowait = 0; /* Nonzero means don't print messages for successful operations. --quiet. */ int quiet = 0; +/* Nonzero means don't print values returned from emacs. --suppress-output. */ +int suppress_output = 0; + /* Nonzero means args are expressions to be evaluated. --eval. */ int eval = 0; @@ -160,6 +163,7 @@ struct option longopts[] = { { "no-wait", no_argument, NULL, 'n' }, { "quiet", no_argument, NULL, 'q' }, + { "suppress-output", no_argument, NULL, 'u' }, { "eval", no_argument, NULL, 'e' }, { "help", no_argument, NULL, 'H' }, { "version", no_argument, NULL, 'V' }, @@ -469,9 +473,9 @@ decode_options (int argc, char **argv) { int opt = getopt_long_only (argc, argv, #ifndef NO_SOCKETS_IN_FILE_SYSTEM - "VHneqa:s:f:d:F:tc", + "VHnequa:s:f:d:F:tc", #else - "VHneqa:f:d:F:tc", + "VHnequa:f:d:F:tc", #endif longopts, 0); @@ -519,6 +523,10 @@ decode_options (int argc, char **argv) quiet = 1; break; + case 'u': + suppress_output = 1; + break; + case 'V': message (false, "emacsclient %s\n", VERSION); exit (EXIT_SUCCESS); @@ -631,6 +639,7 @@ The following OPTIONS are accepted:\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ -n, --no-wait Don't wait for the server to return\n\ -q, --quiet Don't display messages on success\n\ +-u, --suppress-output Don't display return values from the server\n\ -d DISPLAY, --display=DISPLAY\n\ Visit the file in the given display\n\ ", "\ @@ -1860,19 +1869,25 @@ main (int argc, char **argv) else if (strprefix ("-print ", p)) { /* -print STRING: Print STRING on the terminal. */ - str = unquote_argument (p + strlen ("-print ")); - if (needlf) - printf ("\n"); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } + if (!suppress_output) + { + str = unquote_argument (p + strlen ("-print ")); + if (needlf) + printf ("\n"); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + } else if (strprefix ("-print-nonl ", p)) { /* -print-nonl STRING: Print STRING on the terminal. Used to continue a preceding -print command. */ - str = unquote_argument (p + strlen ("-print-nonl ")); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + if (!suppress_output) + { + str = unquote_argument (p + strlen ("-print-nonl ")); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } } else if (strprefix ("-error ", p)) { -- 2.11.0 --=-=-= Content-Type: text/plain -- ...Peder... --=-=-=--