diff options
author | Jim Blandy <jimb@redhat.com> | 1993-03-20 19:30:58 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-03-20 19:30:58 +0000 |
commit | 59653951e72a6043d1349da762ed601d53c9cee0 (patch) | |
tree | 4bb113a169f8ccd3353dc43b097323522909fac2 /src/emacs.c | |
parent | 17d68aa05a40a45758fefa2c47d655fcdb5c9bf6 (diff) | |
download | emacs-59653951e72a6043d1349da762ed601d53c9cee0.tar.gz |
* emacs.c (Finvocation_name): New function.
(Vinvocation_name): New variable.
(init_cmdargs): Set it.
(syms_of_emacs): defsubr Finvocation_name, staticpro and
initialize Vinvocation_name.
* lisp.h (Vinvocation_name): New extern declaration.
* xterm.c (invocation_name): Variable deleted; use
Vinvocation_name now.
(x_text_icon, x_term_init): Use Vinvocation_name now instead of
invocation_name.
(x_term_init): Don't initialize invocation_name.
(syms_of_xterm): Don't initialize or staticpro invocation_name.
* xfns.c (invocation_name): Remove extern declaration for this.
[HAVE_X11] (Fx_get_resource): Use Vinvocation_name now instead of
invocation_name.
[not HAVE_X11] (Fx_get_default): Same.
Diffstat (limited to 'src/emacs.c')
-rw-r--r-- | src/emacs.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index 25edb3fc659..c5b6953acfb 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -61,6 +61,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Command line args from shell, as list of strings */ Lisp_Object Vcommand_line_args; +/* The name under which Emacs was invoked, with any leading directory + names discarded. */ +Lisp_Object Vinvocation_name; + /* Hook run by `kill-emacs' before it does really anything. */ Lisp_Object Vkill_emacs_hook; @@ -155,6 +159,8 @@ init_cmdargs (argc, argv, skip_args) { register int i; + Vinvocation_name = Ffile_name_nondirectory (argv[0]); + Vcommand_line_args = Qnil; for (i = argc - 1; i >= 0; i--) @@ -164,6 +170,15 @@ init_cmdargs (argc, argv, skip_args) = Fcons (build_string (argv[i]), Vcommand_line_args); } } + +DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, + "Return the program name that was used to run Emacs.\n\ +Any directory names are omitted.") + () +{ + return Fcopy_sequence (Vinvocation_name); +} + #ifdef VMS #ifdef LINK_CRTL_SHARE @@ -826,6 +841,8 @@ syms_of_emacs () defsubr (&Skill_emacs); + defsubr (&Sinvocation_name); + DEFVAR_LISP ("command-line-args", &Vcommand_line_args, "Args passed by shell to Emacs, as a list of strings."); @@ -849,4 +866,7 @@ This value is effective only if set before Emacs is dumped,\n\ and only if the Emacs executable is installed with setuid to permit\n\ it to change priority. (Emacs sets its uid back to the real uid.)"); emacs_priority = 0; + + staticpro (&Vinvocation_name); + Vinvocation_name = Qnil; } |