From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#40332: 28.0.50; dired-readin binds inhibit-modification-hooks Date: Mon, 30 Mar 2020 15:47:17 -0400 Message-ID: References: <87k131myzf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="126938"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 40332-done@debbugs.gnu.org, Yuan Fu To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 30 21:51:01 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJ0R2-000WvG-J0 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Mar 2020 21:51:00 +0200 Original-Received: from localhost ([::1]:55742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ0R1-0003jR-Eg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Mar 2020 15:50:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58870) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ0OC-00013S-3f for bug-gnu-emacs@gnu.org; Mon, 30 Mar 2020 15:48:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJ0OA-0001cv-TI for bug-gnu-emacs@gnu.org; Mon, 30 Mar 2020 15:48:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJ0OA-0001c0-MS for bug-gnu-emacs@gnu.org; Mon, 30 Mar 2020 15:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jJ0OA-0001s7-LC for bug-gnu-emacs@gnu.org; Mon, 30 Mar 2020 15:48:02 -0400 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Mar 2020 19:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 40332 X-GNU-PR-Package: emacs Mail-Followup-To: 40332@debbugs.gnu.org, monnier@iro.umontreal.ca, stepnem@gmail.com Original-Received: via spool by 40332-done@debbugs.gnu.org id=D40332.15855976487144 (code D ref 40332); Mon, 30 Mar 2020 19:48:02 +0000 Original-Received: (at 40332-done) by debbugs.gnu.org; 30 Mar 2020 19:47:28 +0000 Original-Received: from localhost ([127.0.0.1]:35103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJ0Nc-0001rA-43 for submit@debbugs.gnu.org; Mon, 30 Mar 2020 15:47:28 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12119) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJ0Na-0001qw-6j for 40332-done@debbugs.gnu.org; Mon, 30 Mar 2020 15:47:26 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C189F100660; Mon, 30 Mar 2020 15:47:20 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2AE41100473; Mon, 30 Mar 2020 15:47:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1585597639; bh=1q4mkntThh3DVFrpKrmjK3NPXjCuqvJQeDH3pcJZ/JI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Qm/gMvBRX4qfMOWfvJIwlpgNSu/1HQ6W9eByFp/iruaeSfpdCGyPIFYC3UXdlQm3k qsvTcXd6pvs/FT8LpQkIKt1Y0kqZvRZXSN4vZzo0hT/30bC2BW/TkN0UYw90dcxUqy iaYkZe+eTXJDryhY3m98+/YGDbbU2jbev6+oCnU5zA1o85E/2cUzCB887dshwQWyfS zP0DXaP/6LeSLKXZV09D7D8+mmKLPGNimuai+zvUrrnLZoxBVji5g3naihYdFWT+US 3aOaeJRXMuW63X23pvR+6EpGjsNr7wQhjlOoyJOEKE4vpTLNx8MT5XQ/+PifU9YHI0 Vjom7QNPeJkNg== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9B8EF1208C1; Mon, 30 Mar 2020 15:47:18 -0400 (EDT) In-Reply-To: <87k131myzf.fsf@gmail.com> ("=?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?="'s message of "Mon, 30 Mar 2020 21:20:04 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177883 Archived-At: 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