>From bc9ee566cb9fee337f94870aa718d9b5e57c007b Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 15 Aug 2023 18:37:59 +0200 Subject: [PATCH 1/2] Add a function to query the Emacs executable * src/emacs.c (Femacs_executable): Add new function. (syms_of_emacs): Announce it. --- src/emacs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/emacs.c b/src/emacs.c index 687b8c7f81f..4869093ce09 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -3039,6 +3039,18 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2, "P", exit (exit_code); } +DEFUN ("emacs-executable", Femacs_executable, Semacs_executable, 0, 0, "", + doc: /* Return a string with the file name of the Emacs executable. +If this is not known, nil will be returned instead. */) + (void) +{ + static Lisp_Object *string; + if (string) + return string; + if (initial_emacs_executable) + return string = build_string(initial_emacs_executable); + return Qnil; +} /* Perform an orderly shutdown of Emacs. Autosave any modified buffers, kill any child processes, clean up the terminal modes (if @@ -3566,6 +3578,7 @@ syms_of_emacs (void) #endif defsubr (&Skill_emacs); + defsubr (&Semacs_executable); defsubr (&Sinvocation_name); defsubr (&Sinvocation_directory); -- 2.39.2