diff options
| author | André Spiegel | 2001-11-23 10:11:29 +0000 |
|---|---|---|
| committer | André Spiegel | 2001-11-23 10:11:29 +0000 |
| commit | 169f0cae92a13ca453f382a42eb80d36f9174f88 (patch) | |
| tree | b0e5ca289d3e61ba8ce8b1eb477440d73c0949c2 | |
| parent | 5d1c524737d1eb905a89c3b4ab465dec21285496 (diff) | |
| download | emacs-169f0cae92a13ca453f382a42eb80d36f9174f88.tar.gz emacs-169f0cae92a13ca453f382a42eb80d36f9174f88.zip | |
(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.
| -rw-r--r-- | lisp/vc.el | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 6b1d80996ce..b9212326b87 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | ;; Keywords: tools | 7 | ;; Keywords: tools |
| 8 | 8 | ||
| 9 | ;; $Id: vc.el,v 1.319 2001/11/12 23:01:17 sds Exp $ | 9 | ;; $Id: vc.el,v 1.320 2001/11/15 10:31:17 spiegel Exp $ |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -726,13 +726,12 @@ The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.") | |||
| 726 | SETTINGS is an association list of property/value pairs. After | 726 | SETTINGS is an association list of property/value pairs. After |
| 727 | executing FORM, set those properties from SETTINGS that have not yet | 727 | executing FORM, set those properties from SETTINGS that have not yet |
| 728 | been updated to their corresponding values." | 728 | been updated to their corresponding values." |
| 729 | `(let ((vc-touched-properties (list t)) | 729 | `(let ((vc-touched-properties (list t))) |
| 730 | (filename ,file)) | ||
| 731 | ,form | 730 | ,form |
| 732 | (mapcar (lambda (setting) | 731 | (mapcar (lambda (setting) |
| 733 | (let ((property (car setting))) | 732 | (let ((property (car setting))) |
| 734 | (unless (memq property vc-touched-properties) | 733 | (unless (memq property vc-touched-properties) |
| 735 | (put (intern filename vc-file-prop-obarray) | 734 | (put (intern ,file vc-file-prop-obarray) |
| 736 | property (cdr setting))))) | 735 | property (cdr setting))))) |
| 737 | ,settings))) | 736 | ,settings))) |
| 738 | 737 | ||
| @@ -751,17 +750,20 @@ Check in FILE with COMMENT (a string) after BODY has been executed. | |||
| 751 | FILE is passed through `expand-file-name'; BODY executed within | 750 | FILE is passed through `expand-file-name'; BODY executed within |
| 752 | `save-excursion'. If FILE is not under version control, or locked by | 751 | `save-excursion'. If FILE is not under version control, or locked by |
| 753 | somebody else, signal error." | 752 | somebody else, signal error." |
| 754 | `(let ((file (expand-file-name ,file))) | 753 | (let ((filevar (make-symbol "file"))) |
| 755 | (or (vc-backend file) | 754 | `(let ((,filevar (expand-file-name ,file))) |
| 756 | (error (format "File not under version control: `%s'" file))) | 755 | (or (vc-backend ,filevar) |
| 757 | (unless (vc-editable-p file) | 756 | (error (format "File not under version control: `%s'" file))) |
| 758 | (let ((state (vc-state file))) | 757 | (unless (vc-editable-p ,filevar) |
| 759 | (if (stringp state) (error (format "`%s' is locking `%s'" state file)) | 758 | (let ((state (vc-state ,filevar))) |
| 760 | (vc-checkout file t)))) | 759 | (if (stringp state) |
| 761 | (save-excursion | 760 | (error (format "`%s' is locking `%s'" state ,filevar)) |
| 762 | ,@body) | 761 | (vc-checkout ,filevar t)))) |
| 763 | (vc-checkin file nil ,comment))) | 762 | (save-excursion |
| 764 | (put 'with-vc-file 'indent-function 1) | 763 | ,@body) |
| 764 | (vc-checkin ,filevar nil ,comment)))) | ||
| 765 | |||
| 766 | (put 'with-vc-file 'lisp-indent-function 2) | ||
| 765 | 767 | ||
| 766 | ;;;###autoload | 768 | ;;;###autoload |
| 767 | (defmacro edit-vc-file (file comment &rest body) | 769 | (defmacro edit-vc-file (file comment &rest body) |
| @@ -769,12 +771,15 @@ somebody else, signal error." | |||
| 769 | Checkin with COMMENT after executing BODY. | 771 | Checkin with COMMENT after executing BODY. |
| 770 | This macro uses `with-vc-file', passing args to it. | 772 | This macro uses `with-vc-file', passing args to it. |
| 771 | However, before executing BODY, find FILE, and after BODY, save buffer." | 773 | However, before executing BODY, find FILE, and after BODY, save buffer." |
| 772 | `(with-vc-file | 774 | (let ((filevar (make-symbol "file"))) |
| 773 | ,file ,comment | 775 | `(let ((,filevar (expand-file-name ,file))) |
| 774 | (set-buffer (find-file-noselect ,file)) | 776 | (with-vc-file |
| 775 | ,@body | 777 | ,filevar ,comment |
| 776 | (save-buffer))) | 778 | (set-buffer (find-file-noselect ,filevar)) |
| 777 | (put 'edit-vc-file 'indent-function 1) | 779 | ,@body |
| 780 | (save-buffer))))) | ||
| 781 | |||
| 782 | (put 'edit-vc-file 'lisp-indent-function 2) | ||
| 778 | 783 | ||
| 779 | (defun vc-ensure-vc-buffer () | 784 | (defun vc-ensure-vc-buffer () |
| 780 | "Make sure that the current buffer visits a version-controlled file." | 785 | "Make sure that the current buffer visits a version-controlled file." |