unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: peder@klingenberg.no (Peder O. Klingenberg)
To: Alex Hutcheson <alexhutcheson@google.com>
Cc: 25708@debbugs.gnu.org
Subject: bug#25708: 25.1.91; Allow users to inhibit printing for 'emacsclient -c -t'
Date: Sun, 19 Feb 2017 21:54:22 +0100	[thread overview]
Message-ID: <m1bmtxzytd.fsf@modesty> (raw)
In-Reply-To: <u49xk28t50x1.fsf@alexhutcheson1.nyc.corp.google.com> (Alex Hutcheson's message of "Mon, 13 Feb 2017 14:46:34 -0500")

[-- 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


  reply	other threads:[~2017-02-19 20:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1bmtxzytd.fsf@modesty \
    --to=peder@klingenberg.no \
    --cc=25708@debbugs.gnu.org \
    --cc=alexhutcheson@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).