emacs-devel
[Top][All Lists]
Advanced

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

emacsclient's option decoding code


From: Eli Zaretskii
Subject: emacsclient's option decoding code
Date: Sat, 01 Nov 2008 16:04:14 +0200

Please take a look at this fragment of emacsclient.c, which deals with
various combinations of command-line options:

  if (!current_frame && !tty && !display)
    display = egetenv ("DISPLAY");

  if (display && strlen (display) == 0)
    display = NULL;

  if (!tty && display)
    window_system = 1;
  else if (!current_frame)
    tty = 1;

  /* --no-wait implies --current-frame on ttys when there are file
       arguments or expressions given.  */
  if (nowait && tty && argc - optind > 0)
    current_frame = 1;

  if (current_frame)
    {
      tty = 0;
      window_system = 0;
    }

  if (tty)
    window_system = 0;

I find this code highly confusing to the degree of being
unmaintainable.  Look, for example, how it sets `tty' to zero or
non-zero, and how this is interleaved with testing whether it is zero
or non-zero, completely obfuscating the semantics of the code and the
meaning of each variable.

I think this should be rewritten, but since I cannot make heads or
tails out of it, I cannot do that myself without risking to break the
code.  Please someone make this code speak to a programmer.




reply via email to

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