Merge remote-tracking branch 'savannah/master' into clean-up

This commit is contained in:
Andrea Corallo 2020-09-30 09:09:39 +02:00
commit 6eb5a8c492
66 changed files with 1388 additions and 673 deletions

View file

@ -1044,19 +1044,22 @@
(defun byte-optimize-apply (form)
;; If the last arg is a literal constant, turn this into a funcall.
;; The funcall optimizer can then transform (funcall 'foo ...) -> (foo ...).
(let ((fn (nth 1 form))
(last (nth (1- (length form)) form))) ; I think this really is fastest
(or (if (or (null last)
(eq (car-safe last) 'quote))
(if (listp (nth 1 last))
(let ((butlast (nreverse (cdr (reverse (cdr (cdr form)))))))
(nconc (list 'funcall fn) butlast
(mapcar (lambda (x) (list 'quote x)) (nth 1 last))))
(byte-compile-warn
"last arg to apply can't be a literal atom: `%s'"
(prin1-to-string last))
nil))
form)))
(if (= (length form) 2)
;; single-argument `apply' is not worth optimizing (bug#40968)
form
(let ((fn (nth 1 form))
(last (nth (1- (length form)) form))) ; I think this really is fastest
(or (if (or (null last)
(eq (car-safe last) 'quote))
(if (listp (nth 1 last))
(let ((butlast (nreverse (cdr (reverse (cdr (cdr form)))))))
(nconc (list 'funcall fn) butlast
(mapcar (lambda (x) (list 'quote x)) (nth 1 last))))
(byte-compile-warn
"last arg to apply can't be a literal atom: `%s'"
(prin1-to-string last))
nil))
form))))
(put 'funcall 'byte-optimizer #'byte-optimize-funcall)
(put 'apply 'byte-optimizer #'byte-optimize-apply)

View file

@ -3182,6 +3182,7 @@ Of course, we really can't know that for sure, so it's just a heuristic."
(buffer . bufferp)
(character . natnump)
(char-table . char-table-p)
(hash-table . hash-table-p)
(cons . consp)
(fixnum . integerp)
(float . floatp)

View file

@ -116,6 +116,10 @@ instead (which see).")
function-list &optional docstring)
"Create a new generic mode MODE.
A \"generic\" mode is a simple major mode with basic support for
comment syntax and Font Lock mode, but otherwise do not have a
any special keystrokes or functionality available.
MODE is the name of the command for the generic mode; don't quote it.
The optional DOCSTRING is the documentation for the mode command. If
you do not supply it, `define-generic-mode' uses a default

View file

@ -156,6 +156,7 @@ are non-nil, then the result is non-nil."
,@(or body `(,res))))
`(let* () ,@(or body '(t))))))
;;;###autoload
(defmacro if-let (spec then &rest else)
"Bind variables according to SPEC and evaluate THEN or ELSE.
Evaluate each binding in turn, as in `let*', stopping if a