mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
vc-refresh-state: Override default-directory for backend functions
I ran into the issue described in the comment with the current code in project-find-file-in and project-find-dir, when using 'C-x p p' to switch between projects. * lisp/vc/vc-hooks.el (vc-refresh-state): When calling into the backend, override any let-bindings of default-directory.
This commit is contained in:
parent
389874c533
commit
28a13b01c7
1 changed files with 10 additions and 4 deletions
|
|
@ -955,10 +955,16 @@ In the latter case, VC mode is deactivated for this buffer."
|
|||
(cond
|
||||
((setq backend (with-demoted-errors "VC refresh error: %S"
|
||||
(vc-backend buffer-file-name)))
|
||||
;; Let the backend setup any buffer-local things he needs.
|
||||
(vc-call-backend backend 'find-file-hook)
|
||||
;; Compute the state and put it in the mode line.
|
||||
(vc-mode-line buffer-file-name backend)
|
||||
;; When `auto-revert-handler' calls us then `default-directory'
|
||||
;; may be let-bound to something else for the purpose of some
|
||||
;; command that's currently doing some minibuffer prompting.
|
||||
;; Backend find-file-hook and mode-line-string functions should
|
||||
;; not need to be written so as to handle that possibility.
|
||||
(let ((default-directory (buffer-local-toplevel-value 'default-directory)))
|
||||
;; Let the backend setup any buffer-local things it needs.
|
||||
(vc-call-backend backend 'find-file-hook)
|
||||
;; Compute the state and put it in the mode line.
|
||||
(vc-mode-line buffer-file-name backend))
|
||||
(unless vc-make-backup-files
|
||||
;; Use this variable, not make-backup-files,
|
||||
;; because this is for things that depend on the file name.
|
||||
|
|
|
|||
Loading…
Reference in a new issue