Commit 064eee03 authored by Chong Yidong's avatar Chong Yidong
Browse files

* emacs-lisp/assoc.el (aput, adelete, amake): Use lexical-let (Bug#5450).

parent c6d09b8d
2010-01-23 Chong Yidong <cyd@stupidchicken.com>
* emacs-lisp/assoc.el (aput, adelete, amake): Use lexical-let (Bug#5450).
2010-01-23 Stephen Leake <stephen_leake@member.fsf.org> 2010-01-23 Stephen Leake <stephen_leake@member.fsf.org>
* progmodes/ada-mode.el (ada-in-paramlist-p): Pragma syntax * progmodes/ada-mode.el (ada-in-paramlist-p): Pragma syntax
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
;; fetching off key-value pairs in association lists. ;; fetching off key-value pairs in association lists.
;;; Code: ;;; Code:
(eval-when-compile (require 'cl))
(defun asort (alist-symbol key) (defun asort (alist-symbol key)
"Move a specified key-value pair to the head of an alist. "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,8 +72,8 @@ If VALUE is not supplied, or is nil, the key-value pair will not be
modified, but will be moved to the head of the alist. If the key-value modified, but will be moved to the head of the alist. If the key-value
pair cannot be found in the alist, it will be inserted into the head pair cannot be found in the alist, it will be inserted into the head
of the alist (with value nil if VALUE is nil or not supplied)." of the alist (with value nil if VALUE is nil or not supplied)."
(let ((elem (aelement key value)) (lexical-let ((elem (aelement key value))
alist) alist)
(asort alist-symbol key) (asort alist-symbol key)
(setq alist (eval alist-symbol)) (setq alist (eval alist-symbol))
(cond ((null alist) (set alist-symbol elem)) (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,7 +87,7 @@ of the alist (with value nil if VALUE is nil or not supplied)."
Alist is referenced by ALIST-SYMBOL and the key-value pair to remove Alist is referenced by ALIST-SYMBOL and the key-value pair to remove
is pair matching KEY. Returns the altered alist." is pair matching KEY. Returns the altered alist."
(asort alist-symbol key) (asort alist-symbol key)
(let ((alist (eval alist-symbol))) (lexical-let ((alist (eval alist-symbol)))
(cond ((null alist) nil) (cond ((null alist) nil)
((anot-head-p alist key) alist) ((anot-head-p alist key) alist)
(t (set alist-symbol (cdr alist)))))) (t (set alist-symbol (cdr alist))))))
...@@ -123,10 +124,10 @@ KEYLIST and VALUELIST should have the same number of elements, but ...@@ -123,10 +124,10 @@ KEYLIST and VALUELIST should have the same number of elements, but
this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining
keys are associated with nil. If VALUELIST is larger than KEYLIST, keys are associated with nil. If VALUELIST is larger than KEYLIST,
extra values are ignored. Returns the created alist." extra values are ignored. Returns the created alist."
(let ((keycar (car keylist)) (lexical-let ((keycar (car keylist))
(keycdr (cdr keylist)) (keycdr (cdr keylist))
(valcar (car valuelist)) (valcar (car valuelist))
(valcdr (cdr valuelist))) (valcdr (cdr valuelist)))
(cond ((null keycdr) (cond ((null keycdr)
(aput alist-symbol keycar valcar)) (aput alist-symbol keycar valcar))
(t (t
......
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