diff options
| author | Sean Whitton | 2025-08-14 14:50:09 +0100 |
|---|---|---|
| committer | Sean Whitton | 2025-08-14 14:50:09 +0100 |
| commit | ea7aee894dd113d92a2f800d40b665b239376f5d (patch) | |
| tree | e8db8ebe89552033fbd43e7b1f5ef4322882828d | |
| parent | e9800cabffa73018a83108de2bb4e1686f1e8385 (diff) | |
| download | emacs-ea7aee894dd113d92a2f800d40b665b239376f5d.tar.gz emacs-ea7aee894dd113d92a2f800d40b665b239376f5d.zip | |
vc-buffer-sync-fileset: Reorder some checks for speed (bug#79137)
* lisp/vc/vc.el (vc-buffer-sync-fileset): Check whether a
buffer's file is in one of our directories before checking
whether it exists on disk. This should mean far fewer system
calls overall (bug#79137).
| -rw-r--r-- | lisp/vc/vc.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index f2972f10e6a..5d8c3f1eeb8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -2506,14 +2506,15 @@ buffers whose files exist on disk. Otherwise it syncs all of them." | |||
| 2506 | (lambda (buf) | 2506 | (lambda (buf) |
| 2507 | (and-let* | 2507 | (and-let* |
| 2508 | ((file (buffer-local-value 'buffer-file-name buf)) | 2508 | ((file (buffer-local-value 'buffer-file-name buf)) |
| 2509 | ((or missing-in-dirs (file-exists-p file))) | ||
| 2510 | ((cl-some (if not-essential | 2509 | ((cl-some (if not-essential |
| 2511 | (lambda (dir) | 2510 | (lambda (dir) |
| 2512 | ;; For speed (bug#79137). | 2511 | ;; For speed (bug#79137). |
| 2513 | (string-prefix-p dir file)) | 2512 | (string-prefix-p dir file)) |
| 2514 | (lambda (dir) | 2513 | (lambda (dir) |
| 2515 | (file-in-directory-p file dir))) | 2514 | (file-in-directory-p file dir))) |
| 2516 | dirs))))))))) | 2515 | dirs)) |
| 2516 | ((or missing-in-dirs | ||
| 2517 | (file-exists-p file)))))))))) | ||
| 2517 | (dolist (buf buffers) | 2518 | (dolist (buf buffers) |
| 2518 | (with-current-buffer buf | 2519 | (with-current-buffer buf |
| 2519 | (vc-buffer-sync not-essential))))) | 2520 | (vc-buffer-sync not-essential))))) |