emacs/doc/lispref
Noam Postavsky 3cd3c008e1 Allow &rest' or &optional' without following variable (Bug#29165)
This is sometimes convenient when writing macros, so that the empty
variable case doesn't need to be handled specially.  Older versions of
Emacs accepted this in some cases (especially the interpreter in Emacs
25 and below was very accepting).

                            |   interpreted/compiled   |
| arglist                   | 25 & earlier | 26  | 27  |
|---------------------------+--------------+-----+-----|
| (&rest)                   | y/n          | n/n | y/y |
| (&rest &rest)             | y/n          | n/n | n/n |
| (&rest &rest x)           | y/n          | n/n | n/n |
| (&rest x &rest)           | y/n          | n/n | n/n |
| (&rest x &rest y)         | y/n          | n/n | n/n |
|---------------------------+--------------+-----+-----|
| (&optional)               | y/n          | n/n | y/y |
| (&optional &optional)     | y/n          | n/n | n/n |
| (&optional x &optional)   | y/n          | n/n | n/n |
| (&optional x &optional y) | y/y          | n/n | n/n |
|---------------------------+--------------+-----+-----|
| (&optional &rest)         | y/n          | n/n | y/y |
| (&optional x &rest)       | y/n          | n/n | y/y |
| (&optional &rest y)       | y/y          | n/n | y/y |
|---------------------------+--------------+-----+-----|
| (&rest &optional)         | y/n          | n/n | n/n |
| (&rest &optional y)       | y/n          | n/n | n/n |
| (&rest x &optional y)     | y/n          | n/n | n/n |

The values in the table above can be produced with the following code:

(with-current-buffer (get-buffer-create "*ck-args*")
  (erase-buffer)
  (dolist (arglist '((&rest)
                     (&rest &rest)
                     (&rest &rest x)
                     (&rest x &rest)
                     (&rest x &rest y)
                     (&optional)
                     (&optional &optional)
                     (&optional x &optional)
                     (&optional x &optional y)
                     (&optional &rest)
                     (&optional x &rest)
                     (&optional &rest y)
                     (&rest &optional)
                     (&rest &optional y)
                     (&rest x &optional y)))
    (insert
     (format "%c/%c\n"
             (condition-case err
                 (progn (funcall `(lambda ,arglist 'ok))
                        ?y)
               (error ?n))
             (condition-case err
                 (progn (byte-compile-check-lambda-list arglist)
                        ?y)
               (error ?n))))
    (display-buffer (current-buffer))))

* src/eval.c (funcall_lambda):
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Don't
check for missing variables after `&rest' and `&optional'.
* test/src/eval-tests.el (eval-tests--bugs-24912-and-24913)
(eval-tests-accept-empty-optional-rest): Update tests accordingly.
* etc/NEWS: Update announcement accordingly.
* doc/lispref/functions.texi (Argument List): Update manual to
indicate that variable names are optional.
2018-12-11 14:18:30 +08:00
..
abbrevs.texi
anti.texi * doc/lispref/anti.texi (Antinews): Fix grammar. 2018-12-11 14:17:57 +08:00
back.texi
backups.texi Yet another round of improvements in the manual 2018-02-07 22:24:13 +02:00
book-spine.texi
buffers.texi * doc/lispref/buffers.texi (Buffer List): Fix grammar. 2018-12-11 14:17:57 +08:00
ChangeLog.1
commands.texi Use @key{} where it is missing in the manuals 2018-01-31 19:59:12 +01:00
compile.texi Explain more about (defvar foo) form (Bug#18059) 2018-12-11 14:17:57 +08:00
control.texi
customize.texi * doc/lispref/customize.texi (Custom Themes): Clarify .el preference. 2018-02-02 09:22:53 -05:00
debugging.texi Merge from origin/emacs-26 2018-02-17 07:50:28 -08:00
display.texi Improve SVG documentation 2018-12-11 14:15:03 +08:00
doclicense.texi
edebug.texi Merge from origin/emacs-26 2018-02-24 07:50:30 -08:00
elisp.texi
errors.texi
eval.texi
files.texi Merge from origin/emacs-26 2018-02-28 09:40:40 -08:00
frames.texi Improve support for desktop restoration in daemon mode 2018-12-11 14:15:03 +08:00
functions.texi Allow &rest' or &optional' without following variable (Bug#29165) 2018-12-11 14:18:30 +08:00
gpl.texi
hash.texi
help.texi Improve documentation of 'with-help-window' 2018-12-11 14:17:52 +08:00
hooks.texi Improve support for desktop restoration in daemon mode 2018-12-11 14:15:03 +08:00
index.texi
internals.texi Document DEFUN attributes 2018-12-11 14:17:57 +08:00
intro.texi
keymaps.texi Further improvements on manuals 2018-03-01 09:25:55 +01:00
lay-flat.texi
lists.texi
loading.texi Merge from origin/emacs-26 2018-01-30 07:50:25 -08:00
macros.texi
Makefile.in
maps.texi Fix some issues in the emacs/lispref manuals 2018-01-28 19:27:39 +01:00
markers.texi
minibuf.texi Correct variable markup in manuals 2018-02-20 21:15:19 +02:00
modes.texi Use @key{} where it is missing in the manuals 2018-01-31 19:59:12 +01:00
nonascii.texi Replace "carriage-return" by "carriage return" in manuals 2018-12-11 14:17:30 +08:00
numbers.texi Clarify syntax of radixed integers 2018-12-11 14:18:30 +08:00
objects.texi
os.texi Merge from origin/emacs-26 2018-02-24 07:50:30 -08:00
package.texi * doc/lispref/package.texi (Packaging Basics): Fix xref. 2018-02-17 09:58:33 -08:00
positions.texi Improve word motion docs (Bug#30815) 2018-12-11 14:17:51 +08:00
processes.texi Finish renaming to internal--daemon-sockname 2018-02-12 12:57:59 -08:00
README
records.texi
searching.texi
sequences.texi
spellfile
streams.texi * doc/lispref/streams.texi (Output Variables): Fix previous. 2018-02-28 12:35:44 -05:00
strings.texi Merge from origin/emacs-26 2018-02-28 09:40:40 -08:00
symbols.texi
syntax.texi Document, in the Elisp manual, how to get a character's raw syntax descriptor 2018-02-22 18:25:13 +00:00
text.texi Merge from origin/emacs-26 2018-02-28 09:40:40 -08:00
threads.texi
tips.texi Document the "URL" keyword in library headers 2018-12-11 14:15:03 +08:00
two-volume-cross-refs.txt
two-volume.make
variables.texi Explain more about (defvar foo) form (Bug#18059) 2018-12-11 14:17:57 +08:00
windows.texi * doc/lispref/windows.texi (Selecting Windows): Fix a typo. 2018-12-11 14:17:56 +08:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Copyright (C) 2001-2018 Free Software Foundation, Inc.  -*- outline -*-
See the end of the file for license conditions.


README for the Emacs Lisp Reference Manual.

* This directory contains the texinfo source files for the Emacs Lisp
Reference Manual.

* Report bugs in the Lisp Manual (or in Emacs) using M-x report-emacs-bug.
To ask questions, use the help-gnu-emacs mailing list.

* The Emacs Lisp Reference Manual is quite large.  It totals around
1100 pages in smallbook format; the info files total around 3.0 megabytes.

* You can format this manual for Info, for printing hardcopy using TeX,
or for HTML.

* You can buy nicely printed copies from the Free Software Foundation.
Buying a manual from the Free Software Foundation helps support our GNU
development work.  See <https://shop.fsf.org/>.
(At time of writing, this manual is out of print.)

* The master file for formatting this manual for Tex is called 'elisp.texi'.
It contains @include commands to include all the chapters that make up
the manual.

* This distribution contains a Makefile that you can use with GNU Make.

** To make an Info file, you need to install Texinfo, then run 'make info'.

** Use 'make elisp.pdf' or 'make elisp.html' to create PDF or HTML versions.


This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.