From 064eee0324df9b7d0d320e523ced87478dc3a849 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 23 Jan 2010 17:44:03 -0500 Subject: * emacs-lisp/assoc.el (aput, adelete, amake): Use lexical-let (Bug#5450). --- lisp/emacs-lisp/assoc.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp/assoc.el') 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 @@ ;; fetching off key-value pairs in association lists. ;;; Code: +(eval-when-compile (require 'cl)) (defun asort (alist-symbol key) "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 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 of the alist (with value nil if VALUE is nil or not supplied)." - (let ((elem (aelement key value)) - alist) + (lexical-let ((elem (aelement key value)) + alist) (asort alist-symbol key) (setq alist (eval alist-symbol)) (cond ((null alist) (set alist-symbol elem)) @@ -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 is pair matching KEY. Returns the altered alist." (asort alist-symbol key) - (let ((alist (eval alist-symbol))) + (lexical-let ((alist (eval alist-symbol))) (cond ((null alist) nil) ((anot-head-p alist key) alist) (t (set alist-symbol (cdr alist)))))) @@ -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 keys are associated with nil. If VALUELIST is larger than KEYLIST, extra values are ignored. Returns the created alist." - (let ((keycar (car keylist)) - (keycdr (cdr keylist)) - (valcar (car valuelist)) - (valcdr (cdr valuelist))) + (lexical-let ((keycar (car keylist)) + (keycdr (cdr keylist)) + (valcar (car valuelist)) + (valcdr (cdr valuelist))) (cond ((null keycdr) (aput alist-symbol keycar valcar)) (t -- cgit v1.2.1 From 245e0fafb7c1cde6fb9ea580008249b7c09f8f12 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 23 Jan 2010 17:46:32 -0500 Subject: * emacs-lisp/assoc.el (aelement): Doc fix. --- lisp/emacs-lisp/assoc.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/assoc.el') diff --git a/lisp/emacs-lisp/assoc.el b/lisp/emacs-lisp/assoc.el index dd437d7cb1d..60692495776 100644 --- a/lisp/emacs-lisp/assoc.el +++ b/lisp/emacs-lisp/assoc.el @@ -42,7 +42,8 @@ sorted list." (defun aelement (key value) "Make a list of a cons cell containing car of KEY and cdr of VALUE. -The returned list is suitable as an element of an alist." +The returned list is suitable for concatanating with an existing +alist, via `nconc'." (list (cons key value))) -- cgit v1.2.1 From ac59f99d910bf80135b647892636fa9a3135d55e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Jan 2010 19:58:14 -0800 Subject: (aelement): Fix typo in previous. --- lisp/emacs-lisp/assoc.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/assoc.el') diff --git a/lisp/emacs-lisp/assoc.el b/lisp/emacs-lisp/assoc.el index 60692495776..ccab5d90c09 100644 --- a/lisp/emacs-lisp/assoc.el +++ b/lisp/emacs-lisp/assoc.el @@ -1,7 +1,7 @@ ;;; assoc.el --- insert/delete/sort functions on association lists -;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, -;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Barry A. Warsaw ;; Keywords: extensions @@ -42,7 +42,7 @@ sorted list." (defun aelement (key value) "Make a list of a cons cell containing car of KEY and cdr of VALUE. -The returned list is suitable for concatanating with an existing +The returned list is suitable for concatenating with an existing alist, via `nconc'." (list (cons key value))) -- cgit v1.2.1