From: Eli Zaretskii Date: Thu, 10 Aug 2023 07:50:35 +0000 (+0300) Subject: Fix the -x switch in non-X builds X-Git-Tag: emacs-29.1.90~229 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=063d7d89d7a;p=emacs.git Fix the -x switch in non-X builds * src/emacs.c (main): Move the handling of the -x switch out of the HAVE_X_WINDOWS condition, and simplify the rest of the code by avoiding code duplication in HAVE_X_WINDOWS and !HAVE_X_WINDOWS cases. (Bug#65048) --- diff --git a/src/emacs.c b/src/emacs.c index e63b0924282..dde305edbc2 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2007,15 +2007,16 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem } #endif /* HAVE_NS */ -#ifdef HAVE_X_WINDOWS /* Stupid kludge to catch command-line display spec. We can't handle this argument entirely in window system dependent code because we don't even know which window system dependent code to run until we've recognized this argument. */ { - char *displayname = 0; int count_before = skip_args; +#ifdef HAVE_X_WINDOWS + char *displayname = 0; + /* Skip any number of -d options, but only use the last one. */ while (!only_version) { @@ -2045,12 +2046,15 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem } argv[count_before + 1] = (char *) "-d"; } +#endif /* HAVE_X_WINDOWS */ if (! no_site_lisp) { - if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args) + + if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args) || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args)) - no_site_lisp = 1; + no_site_lisp = 1; + } if (argmatch (argv, argc, "-x", 0, 1, &junk, &skip_args)) @@ -2066,18 +2070,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* Don't actually discard this arg. */ skip_args = count_before; } -#else /* !HAVE_X_WINDOWS */ - if (! no_site_lisp) - { - int count_before = skip_args; - - if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args) - || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args)) - no_site_lisp = 1; - - skip_args = count_before; - } -#endif /* argmatch must not be used after here, except when building temacs