diff options
| author | Sean Whitton | 2025-04-03 16:31:36 +0800 |
|---|---|---|
| committer | Sean Whitton | 2025-04-03 16:31:36 +0800 |
| commit | 4ace02755bc5cd5add8d88be5abf2de60a92e635 (patch) | |
| tree | 7bebdfd96dd93cd98c93e2d2e7fc4a97ead8d832 | |
| parent | 12b06992dfc944dcd4104a3ae1ce60285b349095 (diff) | |
| download | emacs-4ace02755bc5cd5add8d88be5abf2de60a92e635.tar.gz emacs-4ace02755bc5cd5add8d88be5abf2de60a92e635.zip | |
vc-setup-buffer: Fix leaving wrong default-directory
* lisp/vc/vc-dispatcher.el (vc-setup-buffer): Use run-with-timer
to ensure the buffer-local value gets set (bug#77306).
| -rw-r--r-- | lisp/vc/vc-dispatcher.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index d7577da6c19..5416dac5313 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el | |||
| @@ -195,7 +195,19 @@ Another is that undo information is not kept." | |||
| 195 | (setq-local vc-parent-buffer camefrom) | 195 | (setq-local vc-parent-buffer camefrom) |
| 196 | (setq-local vc-parent-buffer-name | 196 | (setq-local vc-parent-buffer-name |
| 197 | (concat " from " (buffer-name camefrom)))) | 197 | (concat " from " (buffer-name camefrom)))) |
| 198 | |||
| 199 | ;; We want to set the buffer-local value of `default-directory' to | ||
| 200 | ;; olddir. This `setq' alone ought to be sufficient. But if there | ||
| 201 | ;; is a let-binding of `default-directory' in effect, such as the | ||
| 202 | ;; one established by `vc-print-root-log', then all we are able to | ||
| 203 | ;; do is change the let-binding, and not affect the underlying | ||
| 204 | ;; buffer-local cell. Work around this using `run-with-timer'. | ||
| 205 | ;; See bug#53626 and bug#77306. | ||
| 198 | (setq default-directory olddir) | 206 | (setq default-directory olddir) |
| 207 | (run-with-timer 0 nil (lambda () | ||
| 208 | (with-current-buffer buf | ||
| 209 | (setq default-directory olddir)))) | ||
| 210 | |||
| 199 | (let ((buffer-undo-list t) | 211 | (let ((buffer-undo-list t) |
| 200 | (inhibit-read-only t)) | 212 | (inhibit-read-only t)) |
| 201 | (erase-buffer)))) | 213 | (erase-buffer)))) |