From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Locking/unlocking file inside with-silent-modifications Date: Wed, 27 Dec 2017 18:27:24 +0200 Message-ID: <83lghogmqb.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1514391978 8133 195.159.176.226 (27 Dec 2017 16:26:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 27 Dec 2017 16:26:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 27 17:26:14 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUEWz-0001tb-6e for ged-emacs-devel@m.gmane.org; Wed, 27 Dec 2017 17:26:13 +0100 Original-Received: from localhost ([::1]:38652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEYy-0007bc-07 for ged-emacs-devel@m.gmane.org; Wed, 27 Dec 2017 11:28:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEY0-0007ZK-Ov for emacs-devel@gnu.org; Wed, 27 Dec 2017 11:27:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUEXw-0002xn-Jc for emacs-devel@gnu.org; Wed, 27 Dec 2017 11:27:16 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEXw-0002wf-16 for emacs-devel@gnu.org; Wed, 27 Dec 2017 11:27:12 -0500 Original-Received: from [176.228.60.248] (port=4644 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eUEXv-0005sZ-Ax for emacs-devel@gnu.org; Wed, 27 Dec 2017 11:27:11 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221435 Archived-At: This is a spin-off from bug#29846, where a user complained about very slow scrolling due to JIT font-lock, when the buffer visits a file that resides on a very slow networked volume. The reason for that is that JIT font-lock repeatedly calls with-silent-modifications, which calls restore-buffer-modified-p, which calls unlock_file. It does that even if the user disabled file-locking (presumably because some other Emacs session could have locked the file). After thinking about this, I concluded that it makes little sense to lock and unlock files in the body run by with-silent-modifications. After all, with-silent-modifications is meant to pretend that no modifications happened in the first place, so why would we want to lock and unlock the buffer's file while performing modifications that "never happened"? Am I missing something? There is a way, albeit an undocumented one, of disabling lock/unlock inside restore-buffer-modified-p. So if we agree that it's TRT, the change to implement that is easy. Comments?