diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-05-27 10:56:03 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-05-27 10:56:03 -0400 |
commit | 53bc1e2982f6ac29a75ce63bc9a35bb19e0f58e1 (patch) | |
tree | 3e3639268c4ef8a5e55bab665c7cebcbba34a966 | |
parent | 6c5fa28d4f72c29ff5958095ebbb1623dc030346 (diff) | |
download | emacs-53bc1e2982f6ac29a75ce63bc9a35bb19e0f58e1.tar.gz |
* lisp/emacs-lisp/byte-opt.el (byte-optimize-binary-predicate): Don't assume
there can't be more than 2 arguments.
Fixes: debbugs:17584
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 18 |
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b886000014..fe34854ab53 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-05-27 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacs-lisp/byte-opt.el (byte-optimize-binary-predicate): Don't assume + there can't be more than 2 arguments (bug#17584). + 2014-05-27 Glenn Morris <rgm@gnu.org> * simple.el (filter-buffer-substring-functions) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index b1e06410da4..fe6640cc51e 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -859,14 +859,16 @@ (defun byte-optimize-binary-predicate (form) - (if (macroexp-const-p (nth 1 form)) - (if (macroexp-const-p (nth 2 form)) - (condition-case () - (list 'quote (eval form)) - (error form)) - ;; This can enable some lapcode optimizations. - (list (car form) (nth 2 form) (nth 1 form))) - form)) + (cond + ((or (not (macroexp-const-p (nth 1 form))) + (nthcdr 3 form)) ;; In case there are more than 2 args. + form) + ((macroexp-const-p (nth 2 form)) + (condition-case () + (list 'quote (eval form)) + (error form))) + (t ;; This can enable some lapcode optimizations. + (list (car form) (nth 2 form) (nth 1 form))))) (defun byte-optimize-predicate (form) (let ((ok t) |