Commit c548f821 authored by Glenn Morris's avatar Glenn Morris

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.
parent f5d9e83a
2012-08-14 Glenn Morris <rgm@gnu.org>
* emacs-lisp/bytecomp.el (byte-compile-setq-default):
Optimize away setq-default with no args, as for setq. (Bug#12195)
2012-08-14 Chong Yidong <cyd@gnu.org>
* minibuffer.el (read-file-name): Doc fix (Bug#10881).
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment