diff options
| author | Chong Yidong | 2010-01-23 17:44:03 -0500 |
|---|---|---|
| committer | Chong Yidong | 2010-01-23 17:44:03 -0500 |
| commit | 064eee0324df9b7d0d320e523ced87478dc3a849 (patch) | |
| tree | 684bf871a54f67ef0510f9a5c7a594e30780332f | |
| parent | c6d09b8da9277374a080f8574251b98f8f7879cb (diff) | |
| download | emacs-064eee0324df9b7d0d320e523ced87478dc3a849.tar.gz emacs-064eee0324df9b7d0d320e523ced87478dc3a849.zip | |
* emacs-lisp/assoc.el (aput, adelete, amake): Use lexical-let (Bug#5450).
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/assoc.el | 15 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83903e1e9e5..afa01ebac9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-01-23 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * emacs-lisp/assoc.el (aput, adelete, amake): Use lexical-let (Bug#5450). | ||
| 4 | |||
| 1 | 2010-01-23 Stephen Leake <stephen_leake@member.fsf.org> | 5 | 2010-01-23 Stephen Leake <stephen_leake@member.fsf.org> |
| 2 | 6 | ||
| 3 | * progmodes/ada-mode.el (ada-in-paramlist-p): Pragma syntax | 7 | * progmodes/ada-mode.el (ada-in-paramlist-p): Pragma syntax |
diff --git a/lisp/emacs-lisp/assoc.el b/lisp/emacs-lisp/assoc.el index 8082069a34b..dd437d7cb1d 100644 --- a/lisp/emacs-lisp/assoc.el +++ b/lisp/emacs-lisp/assoc.el | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | ;; fetching off key-value pairs in association lists. | 27 | ;; fetching off key-value pairs in association lists. |
| 28 | 28 | ||
| 29 | ;;; Code: | 29 | ;;; Code: |
| 30 | (eval-when-compile (require 'cl)) | ||
| 30 | 31 | ||
| 31 | (defun asort (alist-symbol key) | 32 | (defun asort (alist-symbol key) |
| 32 | "Move a specified key-value pair to the head of an alist. | 33 | "Move a specified key-value pair to the head of an alist. |
| @@ -71,8 +72,8 @@ If VALUE is not supplied, or is nil, the key-value pair will not be | |||
| 71 | modified, but will be moved to the head of the alist. If the key-value | 72 | modified, but will be moved to the head of the alist. If the key-value |
| 72 | pair cannot be found in the alist, it will be inserted into the head | 73 | pair cannot be found in the alist, it will be inserted into the head |
| 73 | of the alist (with value nil if VALUE is nil or not supplied)." | 74 | of the alist (with value nil if VALUE is nil or not supplied)." |
| 74 | (let ((elem (aelement key value)) | 75 | (lexical-let ((elem (aelement key value)) |
| 75 | alist) | 76 | alist) |
| 76 | (asort alist-symbol key) | 77 | (asort alist-symbol key) |
| 77 | (setq alist (eval alist-symbol)) | 78 | (setq alist (eval alist-symbol)) |
| 78 | (cond ((null alist) (set alist-symbol elem)) | 79 | (cond ((null alist) (set alist-symbol elem)) |
| @@ -86,7 +87,7 @@ of the alist (with value nil if VALUE is nil or not supplied)." | |||
| 86 | Alist is referenced by ALIST-SYMBOL and the key-value pair to remove | 87 | Alist is referenced by ALIST-SYMBOL and the key-value pair to remove |
| 87 | is pair matching KEY. Returns the altered alist." | 88 | is pair matching KEY. Returns the altered alist." |
| 88 | (asort alist-symbol key) | 89 | (asort alist-symbol key) |
| 89 | (let ((alist (eval alist-symbol))) | 90 | (lexical-let ((alist (eval alist-symbol))) |
| 90 | (cond ((null alist) nil) | 91 | (cond ((null alist) nil) |
| 91 | ((anot-head-p alist key) alist) | 92 | ((anot-head-p alist key) alist) |
| 92 | (t (set alist-symbol (cdr alist)))))) | 93 | (t (set alist-symbol (cdr alist)))))) |
| @@ -123,10 +124,10 @@ KEYLIST and VALUELIST should have the same number of elements, but | |||
| 123 | this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining | 124 | this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining |
| 124 | keys are associated with nil. If VALUELIST is larger than KEYLIST, | 125 | keys are associated with nil. If VALUELIST is larger than KEYLIST, |
| 125 | extra values are ignored. Returns the created alist." | 126 | extra values are ignored. Returns the created alist." |
| 126 | (let ((keycar (car keylist)) | 127 | (lexical-let ((keycar (car keylist)) |
| 127 | (keycdr (cdr keylist)) | 128 | (keycdr (cdr keylist)) |
| 128 | (valcar (car valuelist)) | 129 | (valcar (car valuelist)) |
| 129 | (valcdr (cdr valuelist))) | 130 | (valcdr (cdr valuelist))) |
| 130 | (cond ((null keycdr) | 131 | (cond ((null keycdr) |
| 131 | (aput alist-symbol keycar valcar)) | 132 | (aput alist-symbol keycar valcar)) |
| 132 | (t | 133 | (t |