emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ecbd5f9: New option -u / --suppress-output to emacs


From: Eli Zaretskii
Subject: [Emacs-diffs] master ecbd5f9: New option -u / --suppress-output to emacsclient
Date: Sat, 25 Feb 2017 03:33:05 -0500 (EST)

branch: master
commit ecbd5f9ac6eb2d31241657bbb3e3f9b860391054
Author: Peder O. Klingenberg <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    New option -u / --suppress-output to emacsclient
    
    * 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 the new
    "--suppress-output/-u" options.
    * etc/NEWS: Mention the new 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 091ead1..bcc20a6 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1847,6 +1847,12 @@ option is mainly useful for developers.
 Do not let @command{emacsclient} display messages about waiting for
 Emacs or connecting to remote server sockets.
 
address@hidden -u
address@hidden --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 address@hidden
 Connect to the Emacs server named @var{server-name}.  The server name
diff --git a/etc/NEWS b/etc/NEWS
index 9355dff..5d14e12 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 70709ec..7b735df 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))
             {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]