633 |
(kill-buffer this-buffer)))) |
(kill-buffer this-buffer)))) |
634 |
|
|
635 |
(defun vc-find-file-hook () |
(defun vc-find-file-hook () |
636 |
"Function for `find-file-hooks' activating VC mode if appropriate." |
"Function for `find-file-hook' activating VC mode if appropriate." |
637 |
;; Recompute whether file is version controlled, |
;; Recompute whether file is version controlled, |
638 |
;; if user has killed the buffer and revisited. |
;; if user has killed the buffer and revisited. |
639 |
(if vc-mode |
(if vc-mode |
676 |
"Warning: editing through the link bypasses version control") |
"Warning: editing through the link bypasses version control") |
677 |
))))))))) |
))))))))) |
678 |
|
|
679 |
(add-hook 'find-file-hooks 'vc-find-file-hook) |
(add-hook 'find-file-hook 'vc-find-file-hook) |
680 |
|
|
681 |
;; more hooks, this time for file-not-found |
;; more hooks, this time for file-not-found |
682 |
(defun vc-file-not-found-hook () |
(defun vc-file-not-found-hook () |
683 |
"When file is not found, try to check it out from version control. |
"When file is not found, try to check it out from version control. |
684 |
Returns t if checkout was successful, nil otherwise. |
Returns t if checkout was successful, nil otherwise. |
685 |
Used in `find-file-not-found-hooks'." |
Used in `find-file-not-found-hook'." |
686 |
;; When a file does not exist, ignore cached info about it |
;; When a file does not exist, ignore cached info about it |
687 |
;; from a previous visit. |
;; from a previous visit. |
688 |
(vc-file-clearprops buffer-file-name) |
(vc-file-clearprops buffer-file-name) |
695 |
(setq default-directory (file-name-directory buffer-file-name)) |
(setq default-directory (file-name-directory buffer-file-name)) |
696 |
(not (vc-error-occurred (vc-checkout buffer-file-name)))))) |
(not (vc-error-occurred (vc-checkout buffer-file-name)))))) |
697 |
|
|
698 |
(add-hook 'find-file-not-found-hooks 'vc-file-not-found-hook) |
(add-hook 'find-file-not-found-hook 'vc-file-not-found-hook) |
699 |
|
|
700 |
(defun vc-kill-buffer-hook () |
(defun vc-kill-buffer-hook () |
701 |
"Discard VC info about a file when we kill its buffer." |
"Discard VC info about a file when we kill its buffer." |