summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2020-05-14 19:26:43 +0200
committerPhilipp Stephani <phst@google.com>2020-05-14 19:29:14 +0200
commit406fb0746c8b54869302d50b2327333769b7604b (patch)
treefb6a44b50edd627e9a031ab3f474e39c6e0b9af5 /doc
parent747e0a2523e474c76410430c40cb9b04500218d4 (diff)
downloademacs-406fb0746c8b54869302d50b2327333769b7604b.tar.gz
Fix documentation related to 'command-switch-alist'.
While there, add a unit test to verify the behavior. * doc/lispref/os.texi (Command-Line Arguments): Fix documentation: the option string in 'command-switch-alist' does include leading hyphens. Also mention that 'command-switch-alist' parsing ignores equals signs in options. * test/lisp/startup-tests.el (startup-tests/command-switch-alist): New unit test.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/os.texi10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 92684c8993e..97b8b532fea 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -613,7 +613,7 @@ The elements of the @code{command-switch-alist} look like this:
@end example
The @sc{car}, @var{option}, is a string, the name of a command-line
-option (not including the initial hyphen). The @var{handler-function}
+option (including the initial hyphen). The @var{handler-function}
is called to handle @var{option}, and receives the option name as its
sole argument.
@@ -623,6 +623,14 @@ remaining command-line arguments in the variable
@code{command-line-args-left} (see below). (The entire list of
command-line arguments is in @code{command-line-args}.)
+Note that the handling of @code{command-switch-alist} doesn't treat
+equals signs in @var{option} specially. That is, if there's an option
+like @code{--name=value} on the command line, then only a
+@code{command-switch-alist} member whose @code{car} is literally
+@code{--name=value} will match this option. If you want to parse such
+options, you need to use @code{command-line-functions} instead (see
+below).
+
The command-line arguments are parsed by the @code{command-line-1}
function in the @file{startup.el} file. See also @ref{Emacs
Invocation, , Command Line Arguments for Emacs Invocation, emacs, The