From 165ea2aaa813a629eac132e082b3aa088bcd2410 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Tue, 8 Apr 2025 07:29:32 +0200 Subject: [PATCH] New variable vc-followed-link --- lisp/vc/vc-hooks.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index f9fa3e1bd7e..0b81b5d1866 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -819,11 +819,15 @@ This function assumes that the file is registered." (concat state-echo " under the " backend-name " version control system")))) +(defvar-local vc-followed-link nil) +(put 'vc-followed-link 'risky-local-variable t) + (defun vc-follow-link () "If current buffer visits a symbolic link, visit the real file. If the real file is already visited in another buffer, make that buffer current, and kill the buffer that visits the link." - (let* ((true-buffer (find-buffer-visiting buffer-file-truename)) + (let* ((link-name buffer-file-name) + (true-buffer (find-buffer-visiting buffer-file-truename)) (this-buffer (current-buffer))) (if (eq true-buffer this-buffer) (let ((truename buffer-file-truename)) @@ -833,7 +837,8 @@ current, and kill the buffer that visits the link." ;; I'm not going to work out the details right now. -- rms. (set-buffer (find-file-noselect truename))) (set-buffer true-buffer) - (kill-buffer this-buffer)))) + (kill-buffer this-buffer)) + (setq vc-followed-link link-name))) (defun vc-default-find-file-hook (_backend) nil) -- 2.39.5