--script
expands to load, see lisp/startup.el
in Emacs sources:
;; This is used to handle -script. It's not clear
;; we need to document it (it is totally internal).
((member argi '("-scriptload"))
(let* ((file (command-line-normalize-file-name
(or argval (pop command-line-args-left))))
;; Take file from default dir.
(file-ex (expand-file-name file)))
(load file-ex nil t t)))
However, it passes t
for NOSUFFIX
, and thus does not try to expand the file name by adding .el
or .elc
automatically, unlike -load
which tries to add the suffix. Also unlike -load
, --script
never looks into load-path
: Relative file names are looked up in the current working directory.
In other words, --script
loads the literal file name given as argument, whereas -load
loads a “library”, by consulting load-path
and adding file name suffixes as needed.
The code above says -scriptload
, but the main argument processing in src/emacs.c
converts --script
to -scriptload
:
if (argmatch (argv, argc, "-script", "--script", 3, &junk, &skip_args))
{
noninteractive = 1; /* Set batch mode. */
/* Convert --script to -scriptload, un-skip it, and sort again
so that it will be handled in proper sequence. */
/* FIXME broken for --script=FILE - is that supposed to work? */
argv[skip_args - 1] = (char *) "-scriptload";
skip_args -= 2;
sort_args (argc, argv);
}
As you can see that's also where Emacs enables batch mode for --script
.
Don't ask me for the reason for this convoluted process of converting --script
to -scriptload
. As with many Emacs internals I think it's better not to ask and not to know