comparison lisp/vc-hooks.el @ 14142:c9cb9dbb2d40

(vc-follow-symlinks): New variable. (vc-find-file-hook): Use it.
author André Spiegel <spiegel@gnu.org>
date Wed, 10 Jan 1996 15:27:49 +0000
parents 187735b53d52
children 83f275dcd93a
comparison
equal deleted inserted replaced
14141:dc502b9c237c 14142:c9cb9dbb2d40
62 when creating new masters.") 62 when creating new masters.")
63 63
64 (defvar vc-make-backup-files nil 64 (defvar vc-make-backup-files nil
65 "*If non-nil, backups of registered files are made as with other files. 65 "*If non-nil, backups of registered files are made as with other files.
66 If nil (the default), files covered by version control don't get backups.") 66 If nil (the default), files covered by version control don't get backups.")
67
68 (defvar vc-follow-symlinks 'ask
69 "*Indicates what to do if you visit a symbolic link to a file
70 that is under version control. Editing such a file through the
71 link bypasses the version control system, which is dangerous and
72 probably not what you want.
73 If this variable is t, VC follows the link and visits the real file,
74 telling you about it in the echo area. If it is `ask', VC asks for
75 confirmation whether it should follow the link. If nil, the link is
76 visited and a warning displayed.")
67 77
68 (defvar vc-display-status t 78 (defvar vc-display-status t
69 "*If non-nil, display revision number and lock status in modeline. 79 "*If non-nil, display revision number and lock status in modeline.
70 Otherwise, not displayed.") 80 Otherwise, not displayed.")
71 81
922 (make-local-variable 'backup-inhibited) 932 (make-local-variable 'backup-inhibited)
923 (setq backup-inhibited t)))) 933 (setq backup-inhibited t))))
924 ((let* ((link (file-symlink-p buffer-file-name)) 934 ((let* ((link (file-symlink-p buffer-file-name))
925 (link-type (and link (vc-backend link)))) 935 (link-type (and link (vc-backend link))))
926 (if link-type 936 (if link-type
927 (message 937 (cond ((eq vc-follow-symlinks nil)
928 "Warning: symbolic link to %s-controlled source file" 938 (message
929 link-type)))))))) 939 "Warning: symbolic link to %s-controlled source file" link-type))
940 ((eq vc-follow-symlinks 'ask)
941 (if (yes-or-no-p (format
942 "Symbolic link to %s-controlled source file; follow link? " link-type))
943 (progn (setq buffer-file-name
944 (file-truename buffer-file-name))
945 (message "Followed link to %s" buffer-file-name)
946 (vc-find-file-hook))
947 (message
948 "Warning: editing through the link bypasses version control")
949 ))
950 (t (setq buffer-file-name (file-truename buffer-file-name))
951 (message "Followed link to %s" buffer-file-name)
952 (vc-find-file-hook))))))))))
930 953
931 (add-hook 'find-file-hooks 'vc-find-file-hook) 954 (add-hook 'find-file-hooks 'vc-find-file-hook)
932 955
933 ;;; more hooks, this time for file-not-found 956 ;;; more hooks, this time for file-not-found
934 (defun vc-file-not-found-hook () 957 (defun vc-file-not-found-hook ()