emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`vc-call' evaluates filename argument twice


From: Lawrence Mitchell
Subject: `vc-call' evaluates filename argument twice
Date: Mon, 02 Apr 2007 16:54:36 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux)

There's a short comment in vc-hooks.el referring to the `vc-call'
macro:

;; BEWARE!! `file' is evaluated twice!!

This is relatively easy to fix (see following patch), that I wonder
why it hasn't been.

Cheers,

Lawrence


ChangeLog entry:

2007-04-02  Lawrence Mitchell  <address@hidden>

        * vc-hooks.el (vc-call): Make sure `file' argument is only
        evaluated once.


Index: vc-hooks.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.156.2.15
diff -u -r1.156.2.15 vc-hooks.el
--- vc-hooks.el 26 Jan 2007 06:15:08 -0000      1.156.2.15
+++ vc-hooks.el 2 Apr 2007 15:46:52 -0000
@@ -272,8 +272,10 @@
      (t                (apply f args)))))
 
 (defmacro vc-call (fun file &rest args)
-  ;; BEWARE!! `file' is evaluated twice!!
-  `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
+  ;; ensure we only evaluate `file' once.
+  (let ((f (make-symbol "--vc-call-file--")))
+    `(let ((,f ,file))
+       (vc-call-backend (vc-backend ,f) ',fun ,f ,@args))))
 
 (defsubst vc-parse-buffer (pattern i)
   "Find PATTERN in the current buffer and return its Ith submatch."


In GNU Emacs 23.0.0.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2007-03-02 on lamacq.ph.ed.ac.uk
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure  '--enable-font-backend' '--with-xft' 
'--prefix=/scratch/s0198183/applications/emacs-unicode''





reply via email to

[Prev in Thread] Current Thread [Next in Thread]