From: Artur Malabarba Date: Thu, 18 Dec 2014 20:32:56 +0000 (-0200) Subject: lisp/let-alist.el (let-alist): Evaluate `alist' only once. X-Git-Tag: emacs-25.0.90~2635^2~30 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17589518728e247e7574e9b61502c3ff5cf9dc67;p=emacs.git lisp/let-alist.el (let-alist): Evaluate `alist' only once. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8978bde017d..9828b845368 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-18 Artur Malabarba + + * let-alist.el (let-alist): Evaluate the `alist' argument only + once. + 2014-12-18 Sam Steingold * emacs-lisp/package.el: Avoid compilation warning by declaring diff --git a/lisp/let-alist.el b/lisp/let-alist.el index 2efa027c449..8f02404cbdf 100644 --- a/lisp/let-alist.el +++ b/lisp/let-alist.el @@ -94,9 +94,11 @@ expands to .body .site))" (declare (indent 1) (debug t)) - `(let ,(mapcar (lambda (x) `(,(car x) (cdr (assq ',(cdr x) ,alist)))) - (delete-dups (let-alist--deep-dot-search body))) - ,@body)) + (let ((var (gensym "let-alist"))) + `(let ((,var ,alist) + (let ,(mapcar (lambda (x) `(,(car x) (cdr (assq ',(cdr x) ,var)))) + (delete-dups (let-alist--deep-dot-search body))) + ,@body))))) (provide 'let-alist)