diff options
author | Drake Wilson <drake@begriffli.ch> | 2011-03-02 23:00:23 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2011-03-02 23:00:23 -0800 |
commit | 0b973fc594aa04c4a22aa1aee7bc8b5c4f74c93f (patch) | |
tree | 23d0a55326d7bfb257d72757ee726a1d636911ba /lib-src/emacsclient.c | |
parent | a915d7a1e55a887ff5bd628369ca9f2c3b2fa367 (diff) | |
download | emacs-0b973fc594aa04c4a22aa1aee7bc8b5c4f74c93f.tar.gz |
Add --quiet option for emacsclient (bug#663) (tiny change)
* 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.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r-- | lib-src/emacsclient.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 836891ae6aa..abc9aee37c1 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -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; |