aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2023-08-10 10:50:35 +0300
committerEli Zaretskii2023-08-10 10:50:35 +0300
commit063d7d89d7ae053be611f4de3d1baceddf407c07 (patch)
tree16cb185518ab6f9d73a4e1df2b95418971c30fc0 /src
parent5a7fb0b39b7059e6ff3c9a9e7641c80cf3a48459 (diff)
downloademacs-063d7d89d7ae053be611f4de3d1baceddf407c07.tar.gz
emacs-063d7d89d7ae053be611f4de3d1baceddf407c07.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c24
1 files changed, 8 insertions, 16 deletions
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
2007 } 2007 }
2008#endif /* HAVE_NS */ 2008#endif /* HAVE_NS */
2009 2009
2010#ifdef HAVE_X_WINDOWS
2011 /* Stupid kludge to catch command-line display spec. We can't 2010 /* Stupid kludge to catch command-line display spec. We can't
2012 handle this argument entirely in window system dependent code 2011 handle this argument entirely in window system dependent code
2013 because we don't even know which window system dependent code 2012 because we don't even know which window system dependent code
2014 to run until we've recognized this argument. */ 2013 to run until we've recognized this argument. */
2015 { 2014 {
2016 char *displayname = 0;
2017 int count_before = skip_args; 2015 int count_before = skip_args;
2018 2016
2017#ifdef HAVE_X_WINDOWS
2018 char *displayname = 0;
2019
2019 /* Skip any number of -d options, but only use the last one. */ 2020 /* Skip any number of -d options, but only use the last one. */
2020 while (!only_version) 2021 while (!only_version)
2021 { 2022 {
@@ -2045,12 +2046,15 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
2045 } 2046 }
2046 argv[count_before + 1] = (char *) "-d"; 2047 argv[count_before + 1] = (char *) "-d";
2047 } 2048 }
2049#endif /* HAVE_X_WINDOWS */
2048 2050
2049 if (! no_site_lisp) 2051 if (! no_site_lisp)
2050 { 2052 {
2051 if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args) 2053
2054 if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
2052 || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args)) 2055 || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
2053 no_site_lisp = 1; 2056 no_site_lisp = 1;
2057
2054 } 2058 }
2055 2059
2056 if (argmatch (argv, argc, "-x", 0, 1, &junk, &skip_args)) 2060 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
2066 /* Don't actually discard this arg. */ 2070 /* Don't actually discard this arg. */
2067 skip_args = count_before; 2071 skip_args = count_before;
2068 } 2072 }
2069#else /* !HAVE_X_WINDOWS */
2070 if (! no_site_lisp)
2071 {
2072 int count_before = skip_args;
2073
2074 if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
2075 || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
2076 no_site_lisp = 1;
2077
2078 skip_args = count_before;
2079 }
2080#endif
2081 2073
2082 /* argmatch must not be used after here, 2074 /* argmatch must not be used after here,
2083 except when building temacs 2075 except when building temacs