emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#40332: closed (28.0.50; dired-readin binds inhibit-modification-hook


From: GNU bug Tracking System
Subject: bug#40332: closed (28.0.50; dired-readin binds inhibit-modification-hooks)
Date: Mon, 30 Mar 2020 19:48:02 +0000

Your message dated Mon, 30 Mar 2020 15:47:17 -0400
with message-id <address@hidden>
and subject line Re: bug#40332: 28.0.50; dired-readin binds 
inhibit-modification-hooks
has caused the debbugs.gnu.org bug report #40332,
regarding 28.0.50; dired-readin binds inhibit-modification-hooks
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
40332: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40332
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 28.0.50; dired-readin binds inhibit-modification-hooks Date: Mon, 30 Mar 2020 21:20:04 +0200 User-agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu)
`dired-readin' binds `inhibit-modification-hooks' to t, so the buffer
changes caused by populating dired buffers are not noticeable in
`after-change-functions'.

A practical example of the problem:

https://gitlab.com/stepnem/stripes-el/-/issues/1#note_309176403

Related discussion:

https://lists.gnu.org/archive/html/emacs-devel/2020-03/msg00921.html

In GNU Emacs 28.0.50 (build 16, x86_64-pc-linux-gnu, GTK+ Version 3.24.14, 
cairo version 1.17.3)
 of 2020-03-28 built on lenora
Repository revision: e27b8882e3969412876561af8fd30144820ec81a
Repository branch: master

-- 
Štěpán



--- End Message ---
--- Begin Message --- Subject: Re: bug#40332: 28.0.50; dired-readin binds inhibit-modification-hooks Date: Mon, 30 Mar 2020 15:47:17 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Version: 28.1

> `dired-readin' binds `inhibit-modification-hooks' to t, so the buffer
> changes caused by populating dired buffers are not noticeable in
> `after-change-functions'.

Indeed, thanks.  I just installed into `master` the patch below which
should fix this problem.

Can you confirm it works for you?


        Stefan


diff --git a/lisp/dired.el b/lisp/dired.el
index b66bb03471..d58c37be2f 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1208,15 +1208,11 @@ dired-readin
 
   ;; default-directory and dired-actual-switches must be buffer-local
   ;; and initialized by now.
-  (let (dirname
-       ;; This makes read-in much faster.
-       ;; In particular, it prevents the font lock hook from running
-       ;; until the directory is all read in.
-       (inhibit-modification-hooks t))
-    (if (consp dired-directory)
-       (setq dirname (car dired-directory))
-      (setq dirname dired-directory))
-    (setq dirname (expand-file-name dirname))
+  (let ((dirname
+        (expand-file-name
+         (if (consp dired-directory)
+             (car dired-directory)
+           dired-directory))))
     (save-excursion
       ;; This hook which may want to modify dired-actual-switches
       ;; based on dired-directory, e.g. with ange-ftp to a SysV host
@@ -1226,17 +1222,25 @@ dired-readin
          (setq buffer-undo-list nil))
       (setq-local file-name-coding-system
                   (or coding-system-for-read file-name-coding-system))
-      (let ((inhibit-read-only t)
-           ;; Don't make undo entries for readin.
-           (buffer-undo-list t))
-       (widen)
-       (erase-buffer)
-       (dired-readin-insert))
-      (goto-char (point-min))
-      ;; Must first make alist buffer local and set it to nil because
-      ;; dired-build-subdir-alist will call dired-clear-alist first
-      (setq-local dired-subdir-alist nil)
-      (dired-build-subdir-alist)
+      (widen)
+      ;; We used to bind `inhibit-modification-hooks' to try and speed up
+      ;; execution, in particular, to prevent the font-lock hook from running
+      ;; until the directory is all read in.
+      ;; I strongly suspect that this was only useful in Emacs<21, because
+      ;; jit-lock made it a non-issue.
+      ;; Nevertheless, I used `combine-change-calls' which provides the
+      ;; same performance advantages, just in case.
+      (combine-change-calls (point-min) (point-max)
+       (let ((inhibit-read-only t)
+             ;; Don't make undo entries for readin.
+             (buffer-undo-list t))
+         (erase-buffer)
+         (dired-readin-insert))
+       (goto-char (point-min))
+       ;; Must first make alist buffer local and set it to nil because
+       ;; dired-build-subdir-alist will call dired-clear-alist first
+       (setq-local dired-subdir-alist nil)
+       (dired-build-subdir-alist))
       (let ((attributes (file-attributes dirname)))
        (if (eq (car attributes) t)
            (set-visited-file-modtime (file-attribute-modification-time



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]