Add --quiet option for emacsclient (bug#663) (tiny change)
authorDrake Wilson <drake@begriffli.ch>
Thu, 3 Mar 2011 07:00:23 +0000 (23:00 -0800)
committerGlenn Morris <rgm@gnu.org>
Thu, 3 Mar 2011 07:00:23 +0000 (23:00 -0800)
* lib-src/emacsclient.c (longopts): Add quiet.
(decode_options): Handle q/quiet.
(print_help_and_exit): Add q/quiet.
(main): Suppress some messages if quiet option is used.

* doc/emacs/misc.texi (emacsclient Options): Add q/quiet.

doc/emacs/ChangeLog
doc/emacs/misc.texi
lib-src/ChangeLog
lib-src/emacsclient.c

index 5481e7f..dc43450 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-03  Drake Wilson  <drake@begriffli.ch>  (tiny change)
+
+       * misc.texi (emacsclient Options): Add q/quiet.
+
 2011-03-02  Glenn Morris  <rgm@gnu.org>
 
        * mule.texi (Communication Coding) <x-select-request-type>:
index d7143d1..1299895 100644 (file)
@@ -1672,6 +1672,11 @@ all server buffers are finished.  You can take as long as you like to
 edit the server buffers within Emacs, and they are @emph{not} killed
 when you type @kbd{C-x #} in them.
 
+@item -q
+@itemx --quiet
+Do not let @command{emacsclient} display messages about waiting for
+Emacs or connecting to remote server sockets.
+
 @item -s @var{server-name}
 @itemx --socket-name=@var{server-name}
 Connect to the Emacs server named @var{server-name}.  The server name
index f54ad38..4b50b2d 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-03  Drake Wilson  <drake@begriffli.ch>  (tiny change)
+
+       * emacsclient.c (longopts): Add quiet.
+       (decode_options): Handle q/quiet.
+       (print_help_and_exit): Add q/quiet.
+       (main): Suppress some messages if quiet option is used.
+
 2011-02-26  Eli Zaretskii  <eliz@gnu.org>
 
        * Makefile.in (fakemail${EXEEXT}): Depend on lib/ignore-value.h.
index 836891a..abc9aee 100644 (file)
@@ -129,6 +129,9 @@ char **main_argv;
 /* Nonzero means don't wait for a response from Emacs.  --no-wait.  */
 int nowait = 0;
 
+/* Nonzero means don't print messages for successful operations.  --quiet. */
+int quiet = 0;
+
 /* Nonzero means args are expressions to be evaluated.  --eval.  */
 int eval = 0;
 
@@ -164,6 +167,7 @@ static void fail (void) NO_RETURN;
 struct option longopts[] =
 {
   { "no-wait", no_argument,       NULL, 'n' },
+  { "quiet",   no_argument,       NULL, 'q' },
   { "eval",    no_argument,       NULL, 'e' },
   { "help",    no_argument,       NULL, 'H' },
   { "version", no_argument,       NULL, 'V' },
@@ -523,9 +527,9 @@ decode_options (int argc, char **argv)
     {
       int opt = getopt_long_only (argc, argv,
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
-                            "VHnea:s:f:d:tc",
+                            "VHneqa:s:f:d:tc",
 #else
-                            "VHnea:f:d:tc",
+                            "VHneqa:f:d:tc",
 #endif
                             longopts, 0);
 
@@ -569,6 +573,10 @@ decode_options (int argc, char **argv)
          eval = 1;
          break;
 
+       case 'q':
+         quiet = 1;
+         break;
+
        case 'V':
          message (FALSE, "emacsclient %s\n", VERSION);
          exit (EXIT_SUCCESS);
@@ -660,6 +668,7 @@ The following OPTIONS are accepted:\n\
                        use the current Emacs frame\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\
 -d DISPLAY, --display=DISPLAY\n\
                        Visit the file in the given display\n\
 --parent-id=ID          Open in parent window ID, via XEmbed\n"
@@ -986,7 +995,7 @@ set_tcp_socket (void)
   if (! get_server_config (&server, auth_string))
     return INVALID_SOCKET;
 
-  if (server.sin_addr.s_addr != inet_addr ("127.0.0.1"))
+  if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
     message (FALSE, "%s: connected to remote socket at %s\n",
              progname, inet_ntoa (server.sin_addr));
 
@@ -1712,7 +1721,7 @@ main (int argc, char **argv)
   send_to_emacs (emacs_socket, "\n");
 
   /* Wait for an answer. */
-  if (!eval && !tty && !nowait)
+  if (!eval && !tty && !nowait && !quiet)
     {
       printf ("Waiting for Emacs...");
       needlf = 2;