unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
@ 2017-02-13 19:46 Alex Hutcheson
  2017-02-19 20:54 ` Peder O. Klingenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Alex Hutcheson @ 2017-02-13 19:46 UTC (permalink / raw)
  To: 25708

Sometimes I want to eval some elisp at the command line exclusively to
set up some buffers for me to work with in a new frame. For example, to
diff two files, I often do:
   emacsclient -c -e '(ediff "fileA" "fileB")

This works, but emacsclient annoyingly prints the result of the eval'ed
expression to stdout. In this case, I'll get:
   #<buffer *Ediff Control Panel*>

This output is annoying, and it can't be redirected (`emacsclient -c' on a
terminal fail to launch if stdout is redirected, for obvious reasons).

It would be great if emacsclient had a way to inhibit printing the
result, for cases where the user is only eval'ing the expressions for
their side effects.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-13 19:46 bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t' Alex Hutcheson
@ 2017-02-19 20:54 ` Peder O. Klingenberg
  2017-02-20  3:29   ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-19 20:54 UTC (permalink / raw)
  To: Alex Hutcheson; +Cc: 25708

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

Alex Hutcheson <alexhutcheson@google.com> writes:

> It would be great if emacsclient had a way to inhibit printing the
> result, for cases where the user is only eval'ing the expressions for
> their side effects.

Emacsclient claims to have that functionality already.  From the
usage-message:

-q, --quiet		Don't display messages on success

This should, in my opinion, cover the case of successfully eval-ing
forms.  However, -q currently has no effect on output from emacs, it
only inhibits messages about connecting to emacs.

The attached patch should prevent emacsclient from printing non-error
output from emacs to the terminal.

With this the terminal stays quiet after exiting the client frame when I
do "emacsclient -q -c -e '(+ 2 3)'".  Without the -q, the terminal
prints 5 as before.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Extend-emacsclient-quiet-to-cover-eval-output.patch --]
[-- Type: text/x-patch, Size: 1908 bytes --]

From 6d3e185a9ddacd94b8950775e3fb056c568fc66d Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Sun, 19 Feb 2017 20:59:14 +0100
Subject: [PATCH] Extend emacsclient --quiet to cover eval output

* lib-src/emacsclient.c (main): Extend --quiet flag to suppress
printing of eval-results. (Bug#25708)
---
 lib-src/emacsclient.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 70709ecec0..65ea5541b8 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1860,19 +1860,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 (!quiet)
+		{
+		  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 (!quiet)
+		{
+		  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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-19 20:54 ` Peder O. Klingenberg
@ 2017-02-20  3:29   ` Eli Zaretskii
  2017-02-20  8:58     ` Peder O. Klingenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-02-20  3:29 UTC (permalink / raw)
  To: Peder O. Klingenberg; +Cc: 25708, alexhutcheson

> From: peder@klingenberg.no (Peder O. Klingenberg)
> Date: Sun, 19 Feb 2017 21:54:22 +0100
> Cc: 25708@debbugs.gnu.org
> 
> > It would be great if emacsclient had a way to inhibit printing the
> > result, for cases where the user is only eval'ing the expressions for
> > their side effects.
> 
> Emacsclient claims to have that functionality already.  From the
> usage-message:
> 
> -q, --quiet		Don't display messages on success
> 
> This should, in my opinion, cover the case of successfully eval-ing
> forms.  However, -q currently has no effect on output from emacs, it
> only inhibits messages about connecting to emacs.
> 
> The attached patch should prevent emacsclient from printing non-error
> output from emacs to the terminal.
> 
> With this the terminal stays quiet after exiting the client frame when I
> do "emacsclient -q -c -e '(+ 2 3)'".  Without the -q, the terminal
> prints 5 as before.

Thanks, but I think this warrants a separate command-line option, or
maybe a special argument to --quiet.  Otherwise, it would be an
incompatible change in behavior.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20  3:29   ` Eli Zaretskii
@ 2017-02-20  8:58     ` Peder O. Klingenberg
  2017-02-20 17:19       ` Peder O. Klingenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-20  8:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25708, alexhutcheson

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, but I think this warrants a separate command-line option, or
> maybe a special argument to --quiet.  Otherwise, it would be an
> incompatible change in behavior.

Ok.  I'll take a stab at implementing that later today.

--
...Peder...





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20  8:58     ` Peder O. Klingenberg
@ 2017-02-20 17:19       ` Peder O. Klingenberg
  2017-02-20 17:34         ` Eli Zaretskii
  2017-02-20 18:04         ` Andreas Schwab
  0 siblings, 2 replies; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-20 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25708, alexhutcheson

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

peder@klingenberg.no (Peder O. Klingenberg) writes:

> Ok.  I'll take a stab at implementing that later today.

How about this patch instead of my previous one?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-option-u-quell-to-emacsclient.patch --]
[-- Type: text/x-patch, Size: 4999 bytes --]

From 6c6f60c200f8bb2ed873cdc8c8ac8e90e090d65f Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Sun, 19 Feb 2017 20:59:14 +0100
Subject: [PATCH] New option -u / -quell 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 --quell / -u to suppress
printing of eval-results.
* doc/emacs/misc.texi (emacsclient Options): Document new
--quell / -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..df4c1f717d 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 --quell
+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..394c1e904c 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/--quell.  The option suppresses
+display of non-error return values from the server process.
+
 \f
 * Editing Changes in Emacs 26.1
 
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 70709ecec0..1bb772be1b 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. --quell */
+int quell = 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' },
+  { "quell",	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':
+	  quell = 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, --quell		Don't display non-error 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 (!quell)
+		{
+		  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 (!quell)
+		{
+		  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


[-- Attachment #3: Type: text/plain, Size: 16 bytes --]


--
...Peder...

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 17:19       ` Peder O. Klingenberg
@ 2017-02-20 17:34         ` Eli Zaretskii
  2017-02-20 18:28           ` Peder O. Klingenberg
  2017-02-20 18:04         ` Andreas Schwab
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-02-20 17:34 UTC (permalink / raw)
  To: Peder O. Klingenberg; +Cc: 25708, alexhutcheson

> From: peder@klingenberg.no (Peder O. Klingenberg)
> Cc: 25708@debbugs.gnu.org,  alexhutcheson@google.com
> Date: Mon, 20 Feb 2017 18:19:20 +0100
> 
> How about this patch instead of my previous one?

Looks good (but see minor comments below).  Let's wait for a few days
to give others a chance to comment.

> +/* Nonzero means don't print values returned from emacs. --quell */

Each comment should end with a period and 2 spaces.  Like this:

>  /* Nonzero means args are expressions to be evaluated.  --eval.  */


> +-u, --quell		Don't display non-error return values from the server\n\

Do we really need the "non-error" part here?  Errors don't manifest
themselves via return values, I think.

Thanks.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 17:19       ` Peder O. Klingenberg
  2017-02-20 17:34         ` Eli Zaretskii
@ 2017-02-20 18:04         ` Andreas Schwab
  2017-02-20 18:13           ` Eli Zaretskii
  2017-02-20 18:17           ` Peder O. Klingenberg
  1 sibling, 2 replies; 13+ messages in thread
From: Andreas Schwab @ 2017-02-20 18:04 UTC (permalink / raw)
  To: Peder O. Klingenberg; +Cc: 25708, alexhutcheson

On Feb 20 2017, peder@klingenberg.no (Peder O. Klingenberg) wrote:

> Subject: [PATCH] New option -u / -quell to emacsclient

Is quell a word?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 18:04         ` Andreas Schwab
@ 2017-02-20 18:13           ` Eli Zaretskii
  2017-02-20 19:15             ` Andreas Schwab
  2017-02-20 18:17           ` Peder O. Klingenberg
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-02-20 18:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 25708, alexhutcheson, peder

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Eli Zaretskii <eliz@gnu.org>,  25708@debbugs.gnu.org,  alexhutcheson@google.com
> Date: Mon, 20 Feb 2017 19:04:10 +0100
> 
> On Feb 20 2017, peder@klingenberg.no (Peder O. Klingenberg) wrote:
> 
> > Subject: [PATCH] New option -u / -quell to emacsclient
> 
> Is quell a word?

Yes, although not a widely used one.  It means "silence" or "subdue".





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 18:04         ` Andreas Schwab
  2017-02-20 18:13           ` Eli Zaretskii
@ 2017-02-20 18:17           ` Peder O. Klingenberg
  1 sibling, 0 replies; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-20 18:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 25708, alexhutcheson

Andreas Schwab <schwab@linux-m68k.org> writes:

> Is quell a word?

Yes.  See for instance:

https://www.merriam-webster.com/dictionary/quell





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 17:34         ` Eli Zaretskii
@ 2017-02-20 18:28           ` Peder O. Klingenberg
  0 siblings, 0 replies; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-20 18:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25708, alexhutcheson

Eli Zaretskii <eliz@gnu.org> writes:

> Each comment should end with a period and 2 spaces.  Like this:

Sorry.  I'll fix it.

> Do we really need the "non-error" part here?  Errors don't manifest
> themselves via return values, I think.

I'm not intimately familiar with the protocol between emacs and
emacsclient, but emacsclient handles a number of different return
messages from emacs.  Two of which (-print and -print-nonl) I made -u
apply to.

Another possible return message seems to be -error, which also results
in stuff being printed by emacsclient (in this case to stderr).  -u does
not suppress that kind of printing.  I thought it worth specifying, but
if that path is in practice never used, I can take that wording out.
What do people think?

--
...Peder...





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 18:13           ` Eli Zaretskii
@ 2017-02-20 19:15             ` Andreas Schwab
  2017-02-20 20:55               ` Peder O. Klingenberg
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2017-02-20 19:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 25708, alexhutcheson, peder

On Feb 20 2017, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Andreas Schwab <schwab@linux-m68k.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  25708@debbugs.gnu.org,  alexhutcheson@google.com
>> Date: Mon, 20 Feb 2017 19:04:10 +0100
>> 
>> On Feb 20 2017, peder@klingenberg.no (Peder O. Klingenberg) wrote:
>> 
>> > Subject: [PATCH] New option -u / -quell to emacsclient
>> 
>> Is quell a word?
>
> Yes, although not a widely used one.  It means "silence" or "subdue".

Then it's not a good word to describe the option.  Better would be
--suppress-output.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 19:15             ` Andreas Schwab
@ 2017-02-20 20:55               ` Peder O. Klingenberg
  2017-02-25  8:33                 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Peder O. Klingenberg @ 2017-02-20 20:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 25708, alexhutcheson

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

Andreas Schwab <schwab@linux-m68k.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-option-u-suppress-output-to-emacsclient.patch --]
[-- Type: text/x-patch, Size: 5100 bytes --]

From 5db44b3f36eedb26865a7761152fac764eb7c0f7 Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
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.
+
 \f
 * 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


[-- Attachment #3: Type: text/plain, Size: 17 bytes --]



--
...Peder...

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
  2017-02-20 20:55               ` Peder O. Klingenberg
@ 2017-02-25  8:33                 ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2017-02-25  8:33 UTC (permalink / raw)
  To: Peder O. Klingenberg; +Cc: 25708-done, schwab, alexhutcheson

> From: peder@klingenberg.no (Peder O. Klingenberg)
> Cc: Eli Zaretskii <eliz@gnu.org>,  25708@debbugs.gnu.org,  alexhutcheson@google.com
> Date: Mon, 20 Feb 2017 21:55:15 +0100
> 
> Andreas Schwab <schwab@linux-m68k.org> 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.

Thanks, pushed to the master branch.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-25  8:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 19:46 bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t' Alex Hutcheson
2017-02-19 20:54 ` Peder O. Klingenberg
2017-02-20  3:29   ` Eli Zaretskii
2017-02-20  8:58     ` Peder O. Klingenberg
2017-02-20 17:19       ` Peder O. Klingenberg
2017-02-20 17:34         ` Eli Zaretskii
2017-02-20 18:28           ` Peder O. Klingenberg
2017-02-20 18:04         ` Andreas Schwab
2017-02-20 18:13           ` Eli Zaretskii
2017-02-20 19:15             ` Andreas Schwab
2017-02-20 20:55               ` Peder O. Klingenberg
2017-02-25  8:33                 ` Eli Zaretskii
2017-02-20 18:17           ` Peder O. Klingenberg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).