From 17589518728e247e7574e9b61502c3ff5cf9dc67 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 18 Dec 2014 18:32:56 -0200 Subject: [PATCH] lisp/let-alist.el (let-alist): Evaluate `alist' only once. --- lisp/ChangeLog | 5 +++++ lisp/let-alist.el | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) 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) -- 2.39.2