Mercurial > hg > xemacs-beta
changeset 4450:ac6231e0c1df
Automated merge with file:/Sources/xemacs-21.5-checked-out
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 07 May 2008 21:21:08 +0200 |
parents | 13ce402e1736 (diff) 15dd5229cea5 (current diff) |
children | 29efd169efe7 |
files | ChangeLog Makefile.in.in configure configure.ac install.sh lisp/ChangeLog man/ChangeLog src/ChangeLog src/emacs.c src/lread.c version.sh |
diffstat | 12 files changed, 168 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed May 07 21:06:45 2008 +0200 +++ b/ChangeLog Wed May 07 21:21:08 2008 +0200 @@ -1,3 +1,21 @@ +2008-05-07 Aidan Kehoe <kehoea@parhasard.net> + + * configure.ac (XE_EXPAND_VARIABLE): Call AC_SUBST on + SHEBANG_PATHNAME, as suggested by Michael Sperber in + y9ly7aj1wfc.fsf@deinprogramm.de. + * Makefile.in.in: Regenerate. + * configure: Ditto. + +2008-01-20 Aidan Kehoe <kehoea@parhasard.net> + + * Makefile.in.in (SHEBANG_PROGNAME): + New variable; a symbol link to the XEmacs binary to tell it it + should read a script from stdin. + * configure.ac (XE_EXPAND_VARIABLE): + Set SHEBANG_PROGNAME. + * configure: + Regenerate. + 2008-04-01 Andreas Schwab <schwab@suse.de> Thanks to Mike Fabian for posting a patch to the mainline, to Martin
--- a/Makefile.in.in Wed May 07 21:06:45 2008 +0200 +++ b/Makefile.in.in Wed May 07 21:21:08 2008 +0200 @@ -92,6 +92,7 @@ ## This will be the name of the generated binary and is set automatically ## by configure. PROGNAME=@PROGNAME@ +SHEBANG_PROGNAME=@SHEBANG_PROGNAME@ ## ==================== Where To Install Things ==================== @@ -414,10 +415,12 @@ ${INSTALL_PROGRAM} src/${PROGNAME} ${bindir}/${PROGNAME}-${version}.exe -chmod 0755 ${bindir}/${PROGNAME}-${version}.exe cd ${bindir} && $(RM) ./${PROGNAME} && ${LN_S} ${PROGNAME}-${version}.exe ./${PROGNAME} + cd ${bindir} && $(RM) ./${SHEBANG_PROGNAME} && ${LN_S} ${PROGNAME}-${version}.exe ./${SHEBANG_PROGNAME} # else ${INSTALL_PROGRAM} src/${PROGNAME} ${bindir}/${PROGNAME}-${version} -chmod 0755 ${bindir}/${PROGNAME}-${version} cd ${bindir} && $(RM) ./${PROGNAME} && ${LN_S} ${PROGNAME}-${version} ./${PROGNAME} + cd ${bindir} && $(RM) ./${SHEBANG_PROGNAME} && ${LN_S} ${PROGNAME}-${version} ./${SHEBANG_PROGNAME} # endif /* CYGWIN */ #endif /* WIN32_NATIVE */ if test "${prefix}" != "${exec_prefix}"; then \
--- a/configure Wed May 07 21:06:45 2008 +0200 +++ b/configure Wed May 07 21:21:08 2008 +0200 @@ -706,6 +706,7 @@ build_cpu build_vendor build_os +SHEBANG_PROGNAME configuration CC CFLAGS @@ -4855,16 +4856,25 @@ version=${infodock_major_version}.${infodock_minor_version}.${infodock_build_version} PROGNAME=infodock + SHEBANG_PROGNAME=infodock-script CPPFLAGS="$CPPFLAGS -DINFODOCK" else PROGNAME=xemacs -fi + SHEBANG_PROGNAME=xemacs-script +fi + + cat >>confdefs.h <<_ACEOF #define EMACS_PROGNAME "$PROGNAME" _ACEOF +cat >>confdefs.h <<_ACEOF +#define SHEBANG_PROGNAME "${PROGNAME}-script" +_ACEOF + + if test -n "$emacs_is_beta"; then beta=yes; else beta=no; fi test "${enable_error_checking_extents:=$beta}" = yes && cat >>confdefs.h <<\_ACEOF #define ERROR_CHECK_EXTENTS 1 @@ -40452,6 +40462,7 @@ build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim +SHEBANG_PROGNAME!$SHEBANG_PROGNAME$ac_delim configuration!$configuration$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim @@ -40503,7 +40514,6 @@ ldap_libs!$ldap_libs$ac_delim postgresql_libs!$postgresql_libs$ac_delim lwlib_objs!$lwlib_objs$ac_delim -canna_libs!$canna_libs$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -40545,6 +40555,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +canna_libs!$canna_libs$ac_delim ALLOCA!$ALLOCA$ac_delim have_esd_config!$have_esd_config$ac_delim SRC_SUBDIR_DEPS!$SRC_SUBDIR_DEPS$ac_delim @@ -40621,7 +40632,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
--- a/configure.ac Wed May 07 21:06:45 2008 +0200 +++ b/configure.ac Wed May 07 21:21:08 2008 +0200 @@ -1224,13 +1224,19 @@ AC_DEFINE_UNQUOTED(INFODOCK_BUILD_VERSION, $infodock_build_version) version=${infodock_major_version}.${infodock_minor_version}.${infodock_build_version} PROGNAME=infodock + SHEBANG_PROGNAME=infodock-script CPPFLAGS="$CPPFLAGS -DINFODOCK" else PROGNAME=xemacs -fi + SHEBANG_PROGNAME=xemacs-script +fi + +AC_SUBST(SHEBANG_PROGNAME) AC_DEFINE_UNQUOTED(EMACS_PROGNAME, "$PROGNAME") +AC_DEFINE_UNQUOTED(SHEBANG_PROGNAME, "${PROGNAME}-script") + dnl ---------------------------------- dnl Error checking and debugging flags dnl ----------------------------------
--- a/lisp/ChangeLog Wed May 07 21:06:45 2008 +0200 +++ b/lisp/ChangeLog Wed May 07 21:21:08 2008 +0200 @@ -1,3 +1,10 @@ +2008-01-20 Aidan Kehoe <kehoea@parhasard.net> + + * startup.el (command-line-do-script): New. + (command-switch-alist): Use command-line-do-script. + New argument, compatible with GNU; --script or -script says "treat + the following argument as a file to load in batch mode". + 2008-05-07 Aidan Kehoe <kehoea@parhasard.net> * mule/latin.el (windows-1250): Add the Central European Windows
--- a/lisp/startup.el Wed May 07 21:06:45 2008 +0200 +++ b/lisp/startup.el Wed May 07 21:21:08 2008 +0200 @@ -234,6 +234,8 @@ ("-eval" . command-line-do-eval) ("-load" . command-line-do-load) ("-l" . command-line-do-load) + ("--script" . command-line-do-script) + ("-script" . command-line-do-script) ("-insert" . command-line-do-insert) ("-i" . command-line-do-insert) ("-kill" . command-line-do-kill) @@ -437,6 +439,12 @@ (setq file (expand-file-name file))) (load file nil t))) +(defun command-line-do-script (arg) + "Load the named file of Lisp code into XEmacs. +<file>" + (let ((file (pop command-line-args-left))) + (load file nil t t))) + (defun command-line-do-insert (arg) "Insert file into the current buffer. <file>"
--- a/man/ChangeLog Wed May 07 21:06:45 2008 +0200 +++ b/man/ChangeLog Wed May 07 21:21:08 2008 +0200 @@ -1,3 +1,8 @@ +2008-01-20 Aidan Kehoe <kehoea@parhasard.net> + + * xemacs/cmdargs.texi (Command Switches): + Describe --script, -script. + 2008-02-27 Stephen J. Turnbull <stephen@xemacs.org> * internals/internals.texi (Discussion -- KKCC):
--- a/man/xemacs/cmdargs.texi Wed May 07 21:06:45 2008 +0200 +++ b/man/xemacs/cmdargs.texi Wed May 07 21:21:08 2008 +0200 @@ -171,6 +171,27 @@ Do not process early packages. (For more information on startup issues concerning the package system, @xref{Startup Paths}.) +@item -script @var{file} +@item --script @var{file} +Load @var{file} as a (compiled or interpreted) Lisp file; do not load +any window-system or TTY code, do not load the user init file, the site +file, or the early packages. This is comparable to running +@samp{xemacs} @samp{-batch} @samp{-l} @var{file}. + +You can also specify this flag implicitly by calling the XEmacs binary +with a value for @samp{argv[0]} of @samp{xemacs-script}, normally by +means of a symbolic link. On a POSIX system, this means that adding the +line: + +@example +#!/usr/bin/env xemacs-script +@end example + +at the start of an XEmacs Lisp file, and changing that file's +permissions to executable, creates a script that can be invoked by +typing the path to the file. XEmacs has logic to ignore the #! line at +the start of the script, so that won't cause an error. + @item -vanilla This is equivalent to @samp{-q -no-site-file -no-early-packages}.
--- a/src/ChangeLog Wed May 07 21:06:45 2008 +0200 +++ b/src/ChangeLog Wed May 07 21:21:08 2008 +0200 @@ -1,3 +1,15 @@ +2008-01-20 Aidan Kehoe <kehoea@parhasard.net> + + * config.h.in: Add SHEBANG_PROGNAME. + * emacs.c (main_1): + If we've been called using SHEBANG_PROGNAME, rewrite our arguments + to add a --script argument. + Also, handle the --script argument by setting noninteractive and + vanilla. + * lread.c (Fload_internal): + If the first two characters of a file are #!, replace them with ;! + before they get to the Lisp reader. + 2008-04-26 Mike Sperber <mike@xemacs.org> * window.c (set_window_pixsize): Round up when we're shrinking,
--- a/src/config.h.in Wed May 07 21:06:45 2008 +0200 +++ b/src/config.h.in Wed May 07 21:21:08 2008 +0200 @@ -91,6 +91,9 @@ /* Program name */ #undef EMACS_PROGNAME +/* Name of the link to the program to be used with #! scripts */ +#undef SHEBANG_PROGNAME + /* Allow s&m files to differentiate OS versions without having multiple files to maintain. */ #undef OS_RELEASE
--- a/src/emacs.c Wed May 07 21:06:45 2008 +0200 +++ b/src/emacs.c Wed May 07 21:21:08 2008 +0200 @@ -955,6 +955,42 @@ init_free_hook (); #endif +#define SHEBANG_PROGNAME_LENGTH \ + (int)((sizeof (WEXTSTRING (SHEBANG_PROGNAME)) - sizeof (WEXTSTRING ("")))) +#define SHEBANG_EXE_PROGNAME_LENGTH \ + (int)(sizeof (WEXTSTRING (SHEBANG_PROGNAME ".exe")) \ + - sizeof (WEXTSTRING (""))) + + { + int progname_len = wext_strlen (argv[0]); + if (progname_len >= SHEBANG_PROGNAME_LENGTH) + { + if (!wext_strcmp_ascii (argv[0] + + (progname_len - SHEBANG_PROGNAME_LENGTH), + SHEBANG_PROGNAME) + /* Allow trailing .exe. Don't check it, it could also be + .com. */ + || (progname_len >= SHEBANG_EXE_PROGNAME_LENGTH && + !wext_strncmp_ascii + (argv[0] + (progname_len - SHEBANG_EXE_PROGNAME_LENGTH), + SHEBANG_PROGNAME, + SHEBANG_PROGNAME_LENGTH))) + { + Wexttext **newarr = alloca_array (Wexttext *, argc + 2); + int j; + + newarr[0] = argv[0]; + newarr[1] = WEXTSTRING ("--script"); + for (j = 1; j < argc; ++j) + { + newarr[j + 1] = argv[j]; + } + argv = newarr; + argc++; + } + } + } + sort_args (argc, argv); #if 0 /* defined (_SCO_DS) @@ -1048,6 +1084,20 @@ noninteractive = 1; } + { + int count_before = skip_args; + /* Handle the -script switch, which implies batch and vanilla. The -l + part of its functionality is implemented in Lisp. */ + if (argmatch (argv, argc, "-script", "--script", 0, NULL, + &skip_args)) + { + noninteractive = 1; + vanilla_inhibiting = 1; + } + + /* Don't actually discard this argument. */ + skip_args = count_before; + } #ifdef WIN32_NATIVE { /* Since we aren't a console application, we can't easily be terminated @@ -2690,6 +2740,7 @@ { "-sd", "--show-dump-id", 105, 0 }, { "-nd", "--no-dump-file", 95, 0 }, { "-batch", "--batch", 88, 0 }, + { "-script", "--script", 89, 1 }, #ifdef WIN32_NATIVE { "-mswindows-termination-handle", 0, 84, 1 }, { "-nuni", "--no-unicode-lib-calls", 83, 0 },
--- a/src/lread.c Wed May 07 21:06:45 2008 +0200 +++ b/src/lread.c Wed May 07 21:21:08 2008 +0200 @@ -744,6 +744,25 @@ internal_bind_lisp_object (&Vfile_domain, Qnil); #endif + /* Is there a #!? If so, read it, and unread ;!. + + GNU implement this by treating any #! anywhere in the source text as + commenting out the whole line. */ + { + char shebangp[2]; + int num_read; + + num_read = Lstream_read (XLSTREAM (lispstream), shebangp, + sizeof(shebangp)); + if (sizeof(shebangp) == num_read + && 0 == strncmp("#!", shebangp, sizeof(shebangp))) + { + shebangp[0] = ';'; + } + + Lstream_unread (XLSTREAM (lispstream), shebangp, num_read); + } + /* Now determine what sort of ELC file we're reading in. */ internal_bind_int (&load_byte_code_version, load_byte_code_version); if (reading_elc)