diff options
author | Glenn Morris <rgm@gnu.org> | 2012-08-14 14:23:10 -0400 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2012-08-14 14:23:10 -0400 |
commit | c548f821804e834e29f267e69206ecfd50b48a93 (patch) | |
tree | 06fb66eb1a7f392d924e8968689da9bc1a031ff7 /lisp/emacs-lisp | |
parent | f5d9e83a70335308d5c6d18d62a7ac94f4bd431c (diff) | |
download | emacs-c548f821804e834e29f267e69206ecfd50b48a93.tar.gz emacs-c548f821804e834e29f267e69206ecfd50b48a93.tar.bz2 emacs-c548f821804e834e29f267e69206ecfd50b48a93.zip |
byte-compile-setq-default fix for bug#12195
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq-default):
Optimize away setq-default with no args, as is done for setq.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index abfd73cb438..10bc37c6dcd 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3578,20 +3578,22 @@ discarding." (defun byte-compile-setq-default (form) (setq form (cdr form)) - (if (> (length form) 2) - (let ((setters ())) - (while (consp form) - (push `(setq-default ,(pop form) ,(pop form)) setters)) - (byte-compile-form (cons 'progn (nreverse setters)))) - (let ((var (car form))) - (and (or (not (symbolp var)) - (macroexp--const-symbol-p var t)) - (byte-compile-warning-enabled-p 'constants) - (byte-compile-warn - "variable assignment to %s `%s'" - (if (symbolp var) "constant" "nonvariable") - (prin1-to-string var))) - (byte-compile-normal-call `(set-default ',var ,@(cdr form)))))) + (if (null form) ; (setq-default), with no arguments + (byte-compile-form nil byte-compile--for-effect) + (if (> (length form) 2) + (let ((setters ())) + (while (consp form) + (push `(setq-default ,(pop form) ,(pop form)) setters)) + (byte-compile-form (cons 'progn (nreverse setters)))) + (let ((var (car form))) + (and (or (not (symbolp var)) + (macroexp--const-symbol-p var t)) + (byte-compile-warning-enabled-p 'constants) + (byte-compile-warn + "variable assignment to %s `%s'" + (if (symbolp var) "constant" "nonvariable") + (prin1-to-string var))) + (byte-compile-normal-call `(set-default ',var ,@(cdr form))))))) (byte-defop-compiler-1 set-default) (defun byte-compile-set-default (form) |