aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorJens Schmidt2025-04-02 22:48:31 +0200
committerEli Zaretskii2025-04-13 11:33:30 +0300
commite82989757f42e95bf72a2a55de415a8162a55dc3 (patch)
treea403b48a17f89cc6a001eeeaad84a4e4e5c685bb /src/lisp.h
parent5665b446b7a5b2f6ff4d4e7ea9b2c91e0e733c92 (diff)
downloademacs-e82989757f42e95bf72a2a55de415a8162a55dc3.tar.gz
emacs-e82989757f42e95bf72a2a55de415a8162a55dc3.zip
Use a pristine copy of argv to restart Emacs
argv as left after main has proccessed the command-line can differ both in order and contents of the original command-line arguments, which can lead to surprising results when restarting emacs on the cooked argv through `kill-emacs'. Starting from that observation, consistenly use variables 'initial_cmdline' on Windows, 'initial_argc', 'initial_argv' on non-Windows, and 'initial_argv0' in all ports. * src/lisp.h: Declare 'initial_argv0', limit declaration of 'initial_argv' and 'initial_argc' to non-Windows ports. * src/emacs.c: Likewise, but for the definitions. (init_cmdargs): Move initialization of 'initial_argv' and 'initial_argc' ... (copy_args) [!WINDOWSNT]: ... to this new function ... (main): ... and call that in 'main', also initializing 'initial_argv0' before the command-line processing. * src/emacs.c (Fkill_emacs): * src/pgtkterm.c (pgtk_term_init): * src/sysdep.c (emacs_perror): * src/xterm.c (x_term_init): Use 'initial_argv0' where only that is required. (Bug#77389)
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 243e8cc7f36..bca58b9c12d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5136,8 +5136,11 @@ extern void init_frame_once (void);
5136extern void syms_of_frame (void); 5136extern void syms_of_frame (void);
5137 5137
5138/* Defined in emacs.c. */ 5138/* Defined in emacs.c. */
5139#ifndef WINDOWSNT
5139extern char **initial_argv; 5140extern char **initial_argv;
5140extern int initial_argc; 5141extern int initial_argc;
5142#endif
5143extern char *initial_argv0;
5141extern char const *emacs_wd; 5144extern char const *emacs_wd;
5142#if defined (HAVE_X_WINDOWS) || defined (HAVE_PGTK) || defined (HAVE_NS) 5145#if defined (HAVE_X_WINDOWS) || defined (HAVE_PGTK) || defined (HAVE_NS)
5143extern bool display_arg; 5146extern bool display_arg;