1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 06:50:23 -08:00
emacs/lisp/emacs-lisp
Noam Postavsky 1d47d777ef 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-03-25 07:56:35 -04:00
..
advice.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
autoload.el Remove many items obsolete since Emacs 22.1 2018-03-10 19:15:56 -08:00
avl-tree.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
backquote.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
benchmark.el Merge from origin/emacs-26 2018-02-17 07:50:28 -08:00
bindat.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
byte-opt.el Fix byte-optimize-memq incorrectly optimizing some memq forms. 2018-03-25 11:22:50 +05:30
byte-run.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
bytecomp.el Allow &rest' or &optional' without following variable (Bug#29165) 2018-03-25 07:56:35 -04:00
cconv.el * lisp/emacs-lisp/cconv.el (cconv-convert): Fix compiling compiled code 2018-02-02 10:28:34 -05:00
chart.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
check-declare.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
checkdoc.el Quieten cl-lib related compiler warnings 2018-03-22 21:40:24 -07:00
cl-extra.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
cl-generic.el Prevent name clashes between CL structures and builtin types 2018-01-28 19:21:47 +01:00
cl-indent.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
cl-lib.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
cl-macs.el Merge from origin/emacs-26 2018-03-10 18:30:54 -08:00
cl-preloaded.el Add missing module types to cl--typeof-types. 2018-01-28 20:39:58 +01:00
cl-print.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
cl-seq.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
cl.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
copyright.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
crm.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
cursor-sensor.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
debug.el Explicitly require cl-lib where needed 2018-03-16 20:41:17 -04:00
derived.el Remove many items obsolete since Emacs 22.1 2018-03-10 19:15:56 -08:00
disass.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
easy-mmode.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
easymenu.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
edebug.el Merge from origin/emacs-26 2018-02-17 07:50:28 -08:00
eieio-base.el Merge from origin/emacs-26 2018-03-22 07:50:37 -07:00
eieio-compat.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
eieio-core.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
eieio-custom.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
eieio-datadebug.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
eieio-opt.el Define cl-type-definition button type as needed (Bug#28899) 2018-01-30 22:14:02 -05:00
eieio-speedbar.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
eieio.el ; lisp/emacs-lisp/eieio.el (eieio-object-set-name-string): Fix quote. 2018-03-01 22:08:42 -05:00
eldoc.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
elint.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
elp.el Merge from origin/emacs-26 2018-02-17 07:50:28 -08:00
ert-x.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
ert.el Print top time consuming tests if advised 2018-03-19 12:58:45 +01:00
ewoc.el * lisp/emacs-lisp/ewoc.el (ewoc-goto-node): 2018-03-05 14:32:20 -05:00
faceup.el Update copyright year to 2018 2018-01-01 01:25:56 -08:00
find-func.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
float-sup.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
generator.el * lisp/emacs-lisp/generator.el (iter-defun): Add 'doc-string' prop. 2018-01-11 11:24:38 -05:00
generic.el Remove many items obsolete since Emacs 22.1 2018-03-10 19:15:56 -08:00
gv.el * lisp/emacs-lisp/gv.el (char-table-range): Add gv-setter. 2018-01-25 19:20:49 -05:00
helper.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
inline.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
let-alist.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
lisp-mnt.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
lisp-mode.el Merge from origin/emacs-26 2018-01-01 01:13:04 -08:00
lisp.el Merge from origin/emacs-26 2018-01-09 15:29:25 -08:00
macroexp.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
map-ynp.el New function read-answer (bug#30073) 2018-01-21 23:45:43 +02:00
map.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
nadvice.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
package-x.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
package.el Quieten cl-lib related compiler warnings 2018-03-22 21:40:24 -07:00
pcase.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
pp.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
radix-tree.el Quieten cl-lib related compiler warnings 2018-03-22 21:40:24 -07:00
re-builder.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
regexp-opt.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
regi.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
ring.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
rmc.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
rx.el Explicitly require cl-lib where needed 2018-03-16 20:41:17 -04:00
seq.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
shadow.el ; Spelling fix 2018-01-22 08:50:06 -08:00
smie.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
subr-x.el Revert last commit 2018-03-06 18:32:04 +01:00
syntax.el Remove outdated comment in syntax.el 2018-03-03 14:41:16 +02:00
tabulated-list.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
tcover-ses.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
tcover-unsafep.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
testcover.el Explicitly require cl-lib where needed 2018-03-16 20:41:17 -04:00
thunk.el Quieten cl-lib related compiler warnings 2018-03-22 21:40:24 -07:00
timer-list.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
timer.el Remove many items obsolete since Emacs 22.1 2018-03-10 19:15:56 -08:00
tq.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
trace.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00
unsafep.el Remove many items obsolete since Emacs 22.1 2018-03-10 19:15:56 -08:00
warnings.el Update copyright year to 2018 2018-01-01 00:57:59 -08:00