Commit 169f0cae authored by André Spiegel's avatar André Spiegel
Browse files

(with-vc-properties): Don't bind `filename' locally.

(with-vc-file, edit-vc-file): Use `make-symbol' for local bindings to
avoid name clashes.  Fix `lisp-indent-function' property for both.
parent 5d1c5247
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
;; Maintainer: Andre Spiegel <spiegel@gnu.org> ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; Keywords: tools ;; Keywords: tools
;; $Id: vc.el,v 1.319 2001/11/12 23:01:17 sds Exp $ ;; $Id: vc.el,v 1.320 2001/11/15 10:31:17 spiegel Exp $
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -726,13 +726,12 @@ The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.") ...@@ -726,13 +726,12 @@ The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.")
SETTINGS is an association list of property/value pairs. After SETTINGS is an association list of property/value pairs. After
executing FORM, set those properties from SETTINGS that have not yet executing FORM, set those properties from SETTINGS that have not yet
been updated to their corresponding values." been updated to their corresponding values."
`(let ((vc-touched-properties (list t)) `(let ((vc-touched-properties (list t)))
(filename ,file))
,form ,form
(mapcar (lambda (setting) (mapcar (lambda (setting)
(let ((property (car setting))) (let ((property (car setting)))
(unless (memq property vc-touched-properties) (unless (memq property vc-touched-properties)
(put (intern filename vc-file-prop-obarray) (put (intern ,file vc-file-prop-obarray)
property (cdr setting))))) property (cdr setting)))))
,settings))) ,settings)))
...@@ -751,17 +750,20 @@ Check in FILE with COMMENT (a string) after BODY has been executed. ...@@ -751,17 +750,20 @@ Check in FILE with COMMENT (a string) after BODY has been executed.
FILE is passed through `expand-file-name'; BODY executed within FILE is passed through `expand-file-name'; BODY executed within
`save-excursion'. If FILE is not under version control, or locked by `save-excursion'. If FILE is not under version control, or locked by
somebody else, signal error." somebody else, signal error."
`(let ((file (expand-file-name ,file))) (let ((filevar (make-symbol "file")))
(or (vc-backend file) `(let ((,filevar (expand-file-name ,file)))
(error (format "File not under version control: `%s'" file))) (or (vc-backend ,filevar)
(unless (vc-editable-p file) (error (format "File not under version control: `%s'" file)))
(let ((state (vc-state file))) (unless (vc-editable-p ,filevar)
(if (stringp state) (error (format "`%s' is locking `%s'" state file)) (let ((state (vc-state ,filevar)))
(vc-checkout file t)))) (if (stringp state)
(save-excursion (error (format "`%s' is locking `%s'" state ,filevar))
,@body) (vc-checkout ,filevar t))))
(vc-checkin file nil ,comment))) (save-excursion
(put 'with-vc-file 'indent-function 1) ,@body)
(vc-checkin ,filevar nil ,comment))))
(put 'with-vc-file 'lisp-indent-function 2)
;;;###autoload ;;;###autoload
(defmacro edit-vc-file (file comment &rest body) (defmacro edit-vc-file (file comment &rest body)
...@@ -769,12 +771,15 @@ somebody else, signal error." ...@@ -769,12 +771,15 @@ somebody else, signal error."
Checkin with COMMENT after executing BODY. Checkin with COMMENT after executing BODY.
This macro uses `with-vc-file', passing args to it. This macro uses `with-vc-file', passing args to it.
However, before executing BODY, find FILE, and after BODY, save buffer." However, before executing BODY, find FILE, and after BODY, save buffer."
`(with-vc-file (let ((filevar (make-symbol "file")))
,file ,comment `(let ((,filevar (expand-file-name ,file)))
(set-buffer (find-file-noselect ,file)) (with-vc-file
,@body ,filevar ,comment
(save-buffer))) (set-buffer (find-file-noselect ,filevar))
(put 'edit-vc-file 'indent-function 1) ,@body
(save-buffer)))))
(put 'edit-vc-file 'lisp-indent-function 2)
(defun vc-ensure-vc-buffer () (defun vc-ensure-vc-buffer ()
"Make sure that the current buffer visits a version-controlled file." "Make sure that the current buffer visits a version-controlled file."
......
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