all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacsclient: --quiet/--verbose
@ 2006-11-30  5:34 Michael Mauger
  2006-11-30 22:59 ` Juanma Barranquero
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Michael Mauger @ 2006-11-30  5:34 UTC (permalink / raw)


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

As I've moved over to emacsclient from gnuclient, I've found a couple of areas where it's behavior is awkward, although not wrong per se.  

This patch adds:
* a --quiet option to suppress informational messages from emacsclient
* In emacsclientw, defaults to --quiet and --no-wait
* adds --wait and --verbose options to override the defaults in emacsclientw

If it's deemed to be too late in pretest for these that's fine, but this is a small change and leads to better interaction.

[-- Attachment #2: ec-quiet.diff --]
[-- Type: text/plain, Size: 3493 bytes --]

Index: emacs/lib-src/emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.96
diff -c -r1.96 emacsclient.c
*** emacs/lib-src/emacsclient.c	25 Nov 2006 00:32:40 -0000	1.96
--- emacs/lib-src/emacsclient.c	30 Nov 2006 04:50:55 -0000
***************
*** 113,118 ****
--- 113,121 ----
  /* Nonzero means don't wait for a response from Emacs.  --no-wait.  */
  int nowait = 0;
  
+ /* Nonzero means don't display informational messages.  --quiet.  */
+ int quiet = 0;
+ 
  /* Nonzero means args are expressions to be evaluated.  --eval.  */
  int eval = 0;
  
***************
*** 134,139 ****
--- 137,145 ----
  struct option longopts[] =
  {
    { "no-wait",	no_argument,	   NULL, 'n' },
+   { "wait",	no_argument,	   NULL, 'w' },
+   { "quiet",	no_argument,	   NULL, 'q' },
+   { "verbose",	no_argument,	   NULL, 'v' },
    { "eval",	no_argument,	   NULL, 'e' },
    { "help",	no_argument,	   NULL, 'H' },
    { "version",	no_argument,	   NULL, 'V' },
***************
*** 172,177 ****
--- 178,185 ----
    char *msg = buf;
    va_list args;
  
+   if (!is_error && quiet) return;
+ 
    va_start (args, message);
  
    if (is_error)
***************
*** 206,218 ****
  {
    alternate_editor = getenv ("ALTERNATE_EDITOR");
  
    while (1)
      {
        int opt = getopt_long (argc, argv,
  #ifndef NO_SOCKETS_IN_FILE_SYSTEM
! 			     "VHnea:s:f:d:",
  #else
!                              "VHnea:f:d:",
  #endif
                               longopts, 0);
  
--- 214,234 ----
  {
    alternate_editor = getenv ("ALTERNATE_EDITOR");
  
+ #ifdef WINDOWSNT
+   if (w32_window_app ())
+     {
+       nowait = 1;
+       quiet = 1;
+     }
+ #endif
+ 
    while (1)
      {
        int opt = getopt_long (argc, argv,
  #ifndef NO_SOCKETS_IN_FILE_SYSTEM
! 			     "VHqvwnea:s:f:d:",
  #else
! 			     "VHqvwnea:f:d:",
  #endif
                               longopts, 0);
  
***************
*** 248,258 ****
--- 264,287 ----
  	  nowait = 1;
  	  break;
  
+ 	case 'w':
+ 	  nowait = 0;
+ 	  break;
+ 
+ 	case 'q':
+ 	  quiet = 1;
+ 	  break;
+ 
+ 	case 'v':
+ 	  quiet = 0;
+ 	  break;
+ 
  	case 'e':
  	  eval = 1;
  	  break;
  
  	case 'V':
+ 	  quiet = 0;
  	  message (FALSE, "emacsclient %s\n", VERSION);
  	  exit (EXIT_SUCCESS);
  	  break;
***************
*** 272,277 ****
--- 301,307 ----
  void
  print_help_and_exit ()
  {
+   quiet = 0;
    message (FALSE,
  	  "Usage: %s [OPTIONS] FILE...\n\
  Tell the Emacs server to visit the specified files.\n\
***************
*** 281,287 ****
--- 311,320 ----
  \n\
  -V, --version		Just print version info and return\n\
  -H, --help   		Print this usage information message\n\
+ -q, --quiet		Do not display informational messages\n\
+ -v, --verbose		Display informational messages\n\
  -e, --eval   		Evaluate FILE arguments as Lisp expressions\n\
+ -w, --wait		Wait for the server to return\n\
  -n, --no-wait		Don't wait for the server to return\n\
  -d, --display=DISPLAY	Visit the file in the given display\n"
  #ifndef NO_SOCKETS_IN_FILE_SYSTEM
***************
*** 928,934 ****
    /* Maybe wait for an answer.   */
    if (!nowait)
      {
!       if (!eval)
          {
            printf ("Waiting for Emacs...");
            needlf = 2;
--- 961,967 ----
    /* Maybe wait for an answer.   */
    if (!nowait)
      {
!       if (!eval && !quiet)
          {
            printf ("Waiting for Emacs...");
            needlf = 2;

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

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: emacsclient: --quiet/--verbose
@ 2006-12-02 22:02 Michael Mauger
  2006-12-03 12:25 ` Lennart Borgman
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Mauger @ 2006-12-02 22:02 UTC (permalink / raw)
  Cc: Emacs-devel

Lennart Borgman wrote:

>Michael Mauger wrote:
>> Juanma Barranquero wrote:
>>> On 12/1/06, Michael Mauger <mmaug@yahoo.com> wrote:
>>>
>>>> Finally, if people could take another look at the Tramp changes I
>>>> proposed for emacsclient.
>>> I don't have anything about emacsclient using Tramp, as long as it is
>>> not the only way, of course. TCP sockets are fine for my uses.
>> 
>> See http://lists.gnu.org/archive/html/emacs-devel/2006-11/msg01195.html for
>> the Tramp patch.
>> 
>> The use of Tramp doesn't impact how emacsclient and emacs communicate.  It
>> has to do with how does emacs addresses the file that resides on a remote
>> machine.  My patch allowed you on the remote machine to address the file
>> locally to emacsclient, but pass a filename that would appear remote to
>> emacs.  Obviously, if emacsclient and emacs were on the same machine, the
>> Tramp settings would not be set and things would work as they do now.  (The
>> version of gnuclient I use to use had a similar feature that spoiled me
>> rotten.)
>> 
>> An example:
>> 
>> me@aaa $ emacs &
>> me@aaa $ ssh bbb -l me
>> 
>> me@bbb $ scp me@aaa:.emacs.d/server/server ~/.emacs.d/server/me-aaa
>> me@bbb $ EMACS_SERVER_FILE=$HOME/.emacs.d/server/me-aaa
>> me@bbb $ export EMACS_SERVER_FILE
>> me@bbb $ cd /etc
>> 
>> (Now I want to edit the /etc/hosts file but there is no emacs available on
>> bbb,  so I ask to edit it in the emacs instance under me@aaa)
>> 
>> me@bbb $ emacsclient /me@bbb:/etc/hosts    # without Tramp support 
>>                       # Must specify Tramp prefix and absolute file name
>> 
>> me@bbb $ EMACS_TRAMP_PREFIX=/me@bbb:
>> me@bbb $ export EMACS_TRAMP_PREFIX
>> me@bbb $ emacsclient hosts                          # same as above with
>> Tramp support
>>                       # emacsclient sends Tramp prefix and makes filename
>> absolute
>
>
>I do not think this can work. (Or am I misunderstanding something?) 
>Emacsclient have to expand local file names before sending them to emacs 
>server since the server and the client may have different working 
>directories.
>
>Could not your problem be solved with a shell script that adds 
>EMACS_TRAMP_PREFIX to the file names before calling emacsclient?
>

Actually it works very nicely.  emacsclient expands the local filename into an absolute filename (as it currenty does) and prefixes that with the Tramp prefix when it sends it to Emacs.  I use emacsclient no differently than if the emacs instance were local, and it communicates the correct filename (not only in the correct directory, but on the correct remote machine).

And yes this could be done with a script around emacsclient, but the script would have to make the filename absolute itself (because the Tramp prefix will make the filename look absolute already).  Obviously, not difficult, but with a small patch, emacsclient can do all of it out-of-the-box.

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

end of thread, other threads:[~2006-12-03 12:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30  5:34 emacsclient: --quiet/--verbose Michael Mauger
2006-11-30 22:59 ` Juanma Barranquero
2006-11-30 23:20   ` Lennart Borgman
2006-12-01 10:12     ` Eli Zaretskii
2006-12-01  0:47   ` Michael Mauger
2006-12-01  1:10     ` Juanma Barranquero
2006-12-01  3:39       ` Michael Mauger
2006-12-02 19:03         ` Lennart Borgman
2006-12-01  9:12 ` Jason Rumney
2006-12-01 13:37 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2006-12-02 22:02 Michael Mauger
2006-12-03 12:25 ` Lennart Borgman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.