summaryrefslogtreecommitdiff
path: root/lisp/vc-hooks.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-05-05 03:52:13 +0000
committerRichard M. Stallman <rms@gnu.org>1996-05-05 03:52:13 +0000
commit566f2169f25306942e6b2f8c7ed8163aa709d163 (patch)
tree7aa68b01630802cd43eb87c655d85ed6bd946204 /lisp/vc-hooks.el
parentd63a6ae0d09a3f5a8373c852732d88dd603b99bd (diff)
downloademacs-566f2169f25306942e6b2f8c7ed8163aa709d163.tar.gz
(vc-follow-link, vc-find-file-hook):
Use file-chase-links instead of file-truename. (vc-find-file-hook): Follow a link without asking if the target is already visited.
Diffstat (limited to 'lisp/vc-hooks.el')
-rw-r--r--lisp/vc-hooks.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 43065a2ddbc..38b91ddef85 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -924,7 +924,7 @@ control system name."
;; visit the real file instead. If the real file is already visited in
;; another buffer, make that buffer current, and kill the buffer
;; that visits the link.
- (let* ((truename (abbreviate-file-name (file-truename buffer-file-name)))
+ (let* ((truename (abbreviate-file-name (file-chase-links buffer-file-name)))
(true-buffer (find-buffer-visiting truename))
(this-buffer (current-buffer)))
(if (eq true-buffer this-buffer)
@@ -958,7 +958,18 @@ control system name."
(cond ((eq vc-follow-symlinks nil)
(message
"Warning: symbolic link to %s-controlled source file" link-type))
- ((eq vc-follow-symlinks 'ask)
+ ((or (not (eq vc-follow-symlinks 'ask))
+ ;; If we already visited this file by following
+ ;; the link, don't ask again if we try to visit
+ ;; it again. GUD does that, and repeated questions
+ ;; are painful.
+ (get-file-buffer
+ (abbreviate-file-name (file-chase-links buffer-file-name))))
+
+ (vc-follow-link)
+ (message "Followed link to %s" buffer-file-name)
+ (vc-find-file-hook))
+ (t
(if (yes-or-no-p (format
"Symbolic link to %s-controlled source file; follow link? " link-type))
(progn (vc-follow-link)
@@ -966,10 +977,7 @@ control system name."
(vc-find-file-hook))
(message
"Warning: editing through the link bypasses version control")
- ))
- (t (vc-follow-link)
- (message "Followed link to %s" buffer-file-name)
- (vc-find-file-hook))))))))))
+ ))))))))))
(add-hook 'find-file-hooks 'vc-find-file-hook)