aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2020-03-30 15:46:47 -0400
committerStefan Monnier2020-03-30 15:46:47 -0400
commite35d68f2d8958f345206979a1ed87d25b321cc10 (patch)
treea46259ca4434aa7b2cc27ab5ef9b086cb09b9101
parentfa4eec5cfa8121837e5d5b89e623ba478f0759ad (diff)
downloademacs-e35d68f2d8958f345206979a1ed87d25b321cc10.tar.gz
emacs-e35d68f2d8958f345206979a1ed87d25b321cc10.zip
* lisp/dired.el (dired-readin): Don't bind inhibit-modification-hooks
Fixes bug#40332
-rw-r--r--lisp/dired.el44
1 files changed, 24 insertions, 20 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index b66bb034712..d58c37be2f9 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1208,15 +1208,11 @@ wildcards, erases the buffer, and builds the subdir-alist anew
1208 1208
1209 ;; default-directory and dired-actual-switches must be buffer-local 1209 ;; default-directory and dired-actual-switches must be buffer-local
1210 ;; and initialized by now. 1210 ;; and initialized by now.
1211 (let (dirname 1211 (let ((dirname
1212 ;; This makes read-in much faster. 1212 (expand-file-name
1213 ;; In particular, it prevents the font lock hook from running 1213 (if (consp dired-directory)
1214 ;; until the directory is all read in. 1214 (car dired-directory)
1215 (inhibit-modification-hooks t)) 1215 dired-directory))))
1216 (if (consp dired-directory)
1217 (setq dirname (car dired-directory))
1218 (setq dirname dired-directory))
1219 (setq dirname (expand-file-name dirname))
1220 (save-excursion 1216 (save-excursion
1221 ;; This hook which may want to modify dired-actual-switches 1217 ;; This hook which may want to modify dired-actual-switches
1222 ;; based on dired-directory, e.g. with ange-ftp to a SysV host 1218 ;; based on dired-directory, e.g. with ange-ftp to a SysV host
@@ -1226,17 +1222,25 @@ wildcards, erases the buffer, and builds the subdir-alist anew
1226 (setq buffer-undo-list nil)) 1222 (setq buffer-undo-list nil))
1227 (setq-local file-name-coding-system 1223 (setq-local file-name-coding-system
1228 (or coding-system-for-read file-name-coding-system)) 1224 (or coding-system-for-read file-name-coding-system))
1229 (let ((inhibit-read-only t) 1225 (widen)
1230 ;; Don't make undo entries for readin. 1226 ;; We used to bind `inhibit-modification-hooks' to try and speed up
1231 (buffer-undo-list t)) 1227 ;; execution, in particular, to prevent the font-lock hook from running
1232 (widen) 1228 ;; until the directory is all read in.
1233 (erase-buffer) 1229 ;; I strongly suspect that this was only useful in Emacs<21, because
1234 (dired-readin-insert)) 1230 ;; jit-lock made it a non-issue.
1235 (goto-char (point-min)) 1231 ;; Nevertheless, I used `combine-change-calls' which provides the
1236 ;; Must first make alist buffer local and set it to nil because 1232 ;; same performance advantages, just in case.
1237 ;; dired-build-subdir-alist will call dired-clear-alist first 1233 (combine-change-calls (point-min) (point-max)
1238 (setq-local dired-subdir-alist nil) 1234 (let ((inhibit-read-only t)
1239 (dired-build-subdir-alist) 1235 ;; Don't make undo entries for readin.
1236 (buffer-undo-list t))
1237 (erase-buffer)
1238 (dired-readin-insert))
1239 (goto-char (point-min))
1240 ;; Must first make alist buffer local and set it to nil because
1241 ;; dired-build-subdir-alist will call dired-clear-alist first
1242 (setq-local dired-subdir-alist nil)
1243 (dired-build-subdir-alist))
1240 (let ((attributes (file-attributes dirname))) 1244 (let ((attributes (file-attributes dirname)))
1241 (if (eq (car attributes) t) 1245 (if (eq (car attributes) t)
1242 (set-visited-file-modtime (file-attribute-modification-time 1246 (set-visited-file-modtime (file-attribute-modification-time