diff options
| author | Glenn Morris | 2012-08-14 14:23:10 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-08-14 14:23:10 -0400 |
| commit | c548f821804e834e29f267e69206ecfd50b48a93 (patch) | |
| tree | 06fb66eb1a7f392d924e8968689da9bc1a031ff7 | |
| parent | f5d9e83a70335308d5c6d18d62a7ac94f4bd431c (diff) | |
| download | emacs-c548f821804e834e29f267e69206ecfd50b48a93.tar.gz 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.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 30 |
2 files changed, 21 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 606be46b118..b58580f6429 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-14 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-setq-default): | ||
| 4 | Optimize away setq-default with no args, as for setq. (Bug#12195) | ||
| 5 | |||
| 1 | 2012-08-14 Chong Yidong <cyd@gnu.org> | 6 | 2012-08-14 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * minibuffer.el (read-file-name): Doc fix (Bug#10881). | 8 | * minibuffer.el (read-file-name): Doc fix (Bug#10881). |
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." | |||
| 3578 | 3578 | ||
| 3579 | (defun byte-compile-setq-default (form) | 3579 | (defun byte-compile-setq-default (form) |
| 3580 | (setq form (cdr form)) | 3580 | (setq form (cdr form)) |
| 3581 | (if (> (length form) 2) | 3581 | (if (null form) ; (setq-default), with no arguments |
| 3582 | (let ((setters ())) | 3582 | (byte-compile-form nil byte-compile--for-effect) |
| 3583 | (while (consp form) | 3583 | (if (> (length form) 2) |
| 3584 | (push `(setq-default ,(pop form) ,(pop form)) setters)) | 3584 | (let ((setters ())) |
| 3585 | (byte-compile-form (cons 'progn (nreverse setters)))) | 3585 | (while (consp form) |
| 3586 | (let ((var (car form))) | 3586 | (push `(setq-default ,(pop form) ,(pop form)) setters)) |
| 3587 | (and (or (not (symbolp var)) | 3587 | (byte-compile-form (cons 'progn (nreverse setters)))) |
| 3588 | (macroexp--const-symbol-p var t)) | 3588 | (let ((var (car form))) |
| 3589 | (byte-compile-warning-enabled-p 'constants) | 3589 | (and (or (not (symbolp var)) |
| 3590 | (byte-compile-warn | 3590 | (macroexp--const-symbol-p var t)) |
| 3591 | "variable assignment to %s `%s'" | 3591 | (byte-compile-warning-enabled-p 'constants) |
| 3592 | (if (symbolp var) "constant" "nonvariable") | 3592 | (byte-compile-warn |
| 3593 | (prin1-to-string var))) | 3593 | "variable assignment to %s `%s'" |
| 3594 | (byte-compile-normal-call `(set-default ',var ,@(cdr form)))))) | 3594 | (if (symbolp var) "constant" "nonvariable") |
| 3595 | (prin1-to-string var))) | ||
| 3596 | (byte-compile-normal-call `(set-default ',var ,@(cdr form))))))) | ||
| 3595 | 3597 | ||
| 3596 | (byte-defop-compiler-1 set-default) | 3598 | (byte-defop-compiler-1 set-default) |
| 3597 | (defun byte-compile-set-default (form) | 3599 | (defun byte-compile-set-default (form) |