comparison lisp/vc-hooks.el @ 98429:b87cc3b45aa5

* vc-hooks.el (vc-file-clearprops): Revert change from 2008-09-29. (vc-file-not-found-hook): Check, that `buffer-file-name' is non-nil. It is not clear, whether this is only fixing symptoms on an error. OTOH, in all other cases, the call of `vc-file-clearprops' is embedded by that check. So it might be TRT. Suggested by Dan Nicolaescu <dann@ics.uci.edu>.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 30 Sep 2008 19:11:07 +0000
parents 29b6eeebe3bf
children 2cae4bd13e67
comparison
equal deleted inserted replaced
98428:d6858e23ac05 98429:b87cc3b45aa5
236 "Get per-file VC PROPERTY for FILE." 236 "Get per-file VC PROPERTY for FILE."
237 (get (intern file vc-file-prop-obarray) property)) 237 (get (intern file vc-file-prop-obarray) property))
238 238
239 (defun vc-file-clearprops (file) 239 (defun vc-file-clearprops (file)
240 "Clear all VC properties of FILE." 240 "Clear all VC properties of FILE."
241 ;; Sometimes, Tramp runs into trouble, FILE is nil then. We shall 241 (setplist (intern file vc-file-prop-obarray) nil))
242 ;; avoid an error in this case.
243 (when (stringp file)
244 (setplist (intern file vc-file-prop-obarray) nil)))
245 242
246 243
247 ;; We keep properties on each symbol naming a backend as follows: 244 ;; We keep properties on each symbol naming a backend as follows:
248 ;; * `vc-functions': an alist mapping vc-FUNCTION to vc-BACKEND-FUNCTION. 245 ;; * `vc-functions': an alist mapping vc-FUNCTION to vc-BACKEND-FUNCTION.
249 246
941 "When file is not found, try to check it out from version control. 938 "When file is not found, try to check it out from version control.
942 Returns t if checkout was successful, nil otherwise. 939 Returns t if checkout was successful, nil otherwise.
943 Used in `find-file-not-found-functions'." 940 Used in `find-file-not-found-functions'."
944 ;; When a file does not exist, ignore cached info about it 941 ;; When a file does not exist, ignore cached info about it
945 ;; from a previous visit. 942 ;; from a previous visit.
946 (vc-file-clearprops buffer-file-name) 943 ;; We check that `buffer-file-name' is non-nil. It should be always
947 (let ((backend (vc-backend buffer-file-name))) 944 ;; the case, but in conjunction with Tramp, it might be nil. M. Albinus.
948 (when backend (vc-call-backend backend 'find-file-not-found-hook)))) 945 (when buffer-file-name
946 (vc-file-clearprops buffer-file-name)
947 (let ((backend (vc-backend buffer-file-name)))
948 (when backend (vc-call-backend backend 'find-file-not-found-hook)))))
949 949
950 (defun vc-default-find-file-not-found-hook (backend) 950 (defun vc-default-find-file-not-found-hook (backend)
951 ;; This used to do what vc-rcs-find-file-not-found-hook does, but it only 951 ;; This used to do what vc-rcs-find-file-not-found-hook does, but it only
952 ;; really makes sense for RCS. For other backends, better not do anything. 952 ;; really makes sense for RCS. For other backends, better not do anything.
953 nil) 953 nil)