From unknown Sun Aug 10 11:49:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#44639 <44639@debbugs.gnu.org> To: bug#44639 <44639@debbugs.gnu.org> Subject: Status: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer Reply-To: bug#44639 <44639@debbugs.gnu.org> Date: Sun, 10 Aug 2025 18:49:07 +0000 retitle 44639 [PATCH 2/2] autorevert: map each watch descriptor to a single= buffer reassign 44639 emacs submitter 44639 Spencer Baugh severity 44639 normal tag 44639 moreinfo patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 14 11:55:41 2020 Received: (at submit) by debbugs.gnu.org; 14 Nov 2020 16:55:41 +0000 Received: from localhost ([127.0.0.1]:51842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kdypx-0001oq-7s for submit@debbugs.gnu.org; Sat, 14 Nov 2020 11:55:41 -0500 Received: from lists.gnu.org ([209.51.188.17]:52392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kdypl-0001oW-CY for submit@debbugs.gnu.org; Sat, 14 Nov 2020 11:55:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdypk-0003nt-6j for bug-gnu-emacs@gnu.org; Sat, 14 Nov 2020 11:55:28 -0500 Received: from venus.catern.com ([68.183.49.163]:44372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdyph-0001Zu-BD for bug-gnu-emacs@gnu.org; Sat, 14 Nov 2020 11:55:27 -0500 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=98.7.229.235; helo=localhost; envelope-from=sbaugh@catern.com; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catern.com; s=mail; t=1605372918; bh=uc60j/s7nzm2q8+5zf1SEzHxnCsp1ja+IArHdRoMNCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Lz/tkhA5R/3WmSFB1YGtH13O/Da1sy5jW6pYEzsbqQn6OQP1jCKgSr04hHn3C8Hn2 KRQBq/dojpEJIDy9tiLhxORwG4CsBncPvqvlDwENais8cIit+hzfV9+xrwet8VN4xo 7hGsoKILAprC/HlMFemcSoF/Nb7nG92mehKfjsMw= Received: from localhost (cpe-98-7-229-235.nyc.res.rr.com [98.7.229.235]) by venus.catern.com (Postfix) with ESMTPSA id 7A00E2DD4A0; Sat, 14 Nov 2020 16:55:18 +0000 (UTC) From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer Date: Sat, 14 Nov 2020 11:54:59 -0500 Message-Id: <20201114165459.9518-2-sbaugh@catern.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201114165459.9518-1-sbaugh@catern.com> References: <20201114165459.9518-1-sbaugh@catern.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=68.183.49.163; envelope-from=sbaugh@catern.com; helo=venus.catern.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/14 11:55:18 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Spencer Baugh X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Now that we don't share watch descriptors between buffers, we don't need to store a list of buffers for each watch descriptor - there would only be a single buffer in each list. This should have no functional change. --- lisp/autorevert.el | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index d5bb75c2f1..ad39884ab0 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -355,10 +355,10 @@ the list of old buffers.") (add-hook 'after-set-visited-file-name-hook #'auto-revert-set-visited-file-name) -(defvar auto-revert--buffers-by-watch-descriptor +(defvar auto-revert--buffer-by-watch-descriptor (make-hash-table :test 'equal) - "A hash table mapping notification descriptors to lists of buffers. -The buffers use that descriptor for auto-revert notifications. + "A hash table mapping notification descriptors to buffers. +The buffer uses that descriptor for auto-revert notifications. The key is equal to `auto-revert-notify-watch-descriptor' in each buffer.") @@ -631,12 +631,9 @@ will use an up-to-date value of `auto-revert-interval'." (defun auto-revert-notify-rm-watch () "Disable file notification for current buffer's associated file." (let ((desc auto-revert-notify-watch-descriptor) - (table auto-revert--buffers-by-watch-descriptor)) + (table auto-revert--buffer-by-watch-descriptor)) (when desc - (let ((buffers (delq (current-buffer) (gethash desc table)))) - (if buffers - (puthash desc buffers table) - (remhash desc table))) + (remhash desc table) (ignore-errors (file-notify-rm-watch desc)) (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t))) @@ -663,10 +660,8 @@ will use an up-to-date value of `auto-revert-interval'." (setq auto-revert-notify-modified-p t) (puthash auto-revert-notify-watch-descriptor - (cons (current-buffer) - (gethash auto-revert-notify-watch-descriptor - auto-revert--buffers-by-watch-descriptor)) - auto-revert--buffers-by-watch-descriptor) + (current-buffer) + auto-revert--buffer-by-watch-descriptor) (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)))) ;; If we have file notifications, we want to update the auto-revert buffers @@ -696,8 +691,8 @@ system.") (action (nth 1 event)) (file (nth 2 event)) (file1 (nth 3 event)) ;; Target of `renamed'. - (buffers (gethash descriptor - auto-revert--buffers-by-watch-descriptor))) + (buffer (gethash descriptor + auto-revert--buffer-by-watch-descriptor))) ;; Check, that event is meant for us. (cl-assert descriptor) ;; Since we watch a directory, a file name must be returned. @@ -708,7 +703,6 @@ system.") (if (eq action 'stopped) ;; File notification has stopped. Continue with polling. - (cl-dolist (buffer buffers) (with-current-buffer buffer (when (or ;; A buffer associated with a file. @@ -721,10 +715,8 @@ system.") (auto-revert-notify-rm-watch) ;; Restart the timer if it wasn't running. (unless auto-revert-timer - (auto-revert-set-timer))))) + (auto-revert-set-timer)))) - ;; Loop over all buffers, in order to find the intended one. - (cl-dolist (buffer buffers) (when (buffer-live-p buffer) (with-current-buffer buffer (when (or @@ -752,7 +744,7 @@ system.") (setq auto-revert--lockout-timer (run-with-timer auto-revert--lockout-interval nil - #'auto-revert--end-lockout buffer))))))))))) + #'auto-revert--end-lockout buffer)))))))))) (defun auto-revert--end-lockout (buffer) "End the lockout period after a notification. -- 2.28.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 02 09:50:29 2020 Received: (at 44639) by debbugs.gnu.org; 2 Dec 2020 14:50:29 +0000 Received: from localhost ([127.0.0.1]:34821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkTSf-0008VK-8l for submit@debbugs.gnu.org; Wed, 02 Dec 2020 09:50:29 -0500 Received: from mout.gmx.net ([212.227.15.15]:59225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkTSd-0008V5-Hw for 44639@debbugs.gnu.org; Wed, 02 Dec 2020 09:50:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606920618; bh=HmTGcMduFW5XF+kc2aPIHKKY7qvzdXLzQzM4hD1d20E=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=EIWp/nDq5L7bwh5gpD6+8vp0S66sOggezlhA9e4oGLLVbPv1oGtQAVJCTOfAIbJyw FDq9lZ8IYC14e8+Bax3mKERrIcfyHCxwW/DZTsEQEeD3RFbKvWxS/stODS8/LEOh5I 2L3sbF1V6JL6bcHFLDtK4VEAm8yatYLe7AqUv7S0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gandalf.gmx.de ([212.86.45.36]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mz9Un-1jxCYr1xat-00wExN; Wed, 02 Dec 2020 15:50:18 +0100 From: Michael Albinus To: Spencer Baugh Subject: Re: bug#44639: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer References: <20201114165459.9518-1-sbaugh@catern.com> <20201114165459.9518-2-sbaugh@catern.com> Date: Wed, 02 Dec 2020 15:50:16 +0100 In-Reply-To: <20201114165459.9518-2-sbaugh@catern.com> (Spencer Baugh's message of "Sat, 14 Nov 2020 11:54:59 -0500") Message-ID: <87o8jcdzyv.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:sWmPnIa7KFbiySWBdM3qedp1QRMpWQY2gqih1zLayhpjn7BeZqx Y+Qae9tJyPNyi8VPfNDayG3VqWqU93xcHmwxOK0wipoV05OmHaIaNDa9qfa5DLRndo047wk 06V3PSRClHBFWHWcTebW3Ud+dnbHxrGq3yaRV3Pt7NeCG37PBDGh89mJlSgN6x27nNfSLif uaSraQxMBXL46gG67CKSg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:cuMNI/xLiOo=:x5bQtvGXRXIFm5LH+X4rum WG5Kk6bQvz3DpVos5E0w4PF5MQRHXrMYvEY3HXlCb1VYCjzy9A4HYN4SRhLuy2Bx9MMC/BM2K 5ijNnv+SDXgHOH7w+Tv/HBfUIKjTcDFOV4kVwt7loF7eH5XrTSnZfEe+SeXuXCPyoYhXJ0t79 +ny+1lloRi45P+1dbvyLz3BnOSqZSmU61aZ5bpTKgnlq9sVuyZSOEdKCn3Hg4HH3t1URsohYC Xa2OcoFDctwwSHuvpyHk+6NDRXLVmDsdcb9HembZv68L+DTA7FFJlmITeoS6u0hayOknlV1hS TZ5RsBicNzuGsX+BvXb27PyYAeMTjN0BQ5lqZXF/o0ezqm9skN4n1NntvGwKU0ulVwJgP7G5a AxpZ84Nn2CgiGIxdKU3MW8/RxQ6Z4dW3vbuCReTBd6RuyfgFA78yO0XBDa025Qf31lMgjF13E yEehIX679nGZkHwStP7vdYU7L7jjgmzTGYP9emyXeltJyhpCho4bQ2CUI0dJaoQJNtu7QFCQO GXbfhJ6uJhhuPMgeYWw1acLous7oyLgiqOy5q4hmUafsYWUmuyUNdSzeUjVN9YhNBY+EzvqCs LqRz2XgaC7bNjgrDGQYAwr0GaW+xxEiL3Nbc6CnaxpI6vqvLIDD6/6nOkt6UStYfLifqpUj/i pgcJmwq9w8p+dqdQipCVh90XF1cBGk3gziVxKTF0HvgWcCeYYwOx5l4/tg5J0qeKLh3mySnAT PFbJ623FphPsGy8NjlMpYmz+MH7+l6yjwWdGvNxMHf+wy2VrLiW2/cpQVcnn3FRHb6CSo1bfO iBGm7IGy+vm+APmbyMtWeU+smRakWmaVgWlOJMXpX4wiVPA+B0kH+8FiK/69kanC3/LVCgMEt k+FZfTJM3kyjig+2GF2Q== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 44639 Cc: 44639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Spencer Baugh writes: > Now that we don't share watch descriptors between buffers, we don't > need to store a list of buffers for each watch descriptor - there > would only be a single buffer in each list. This should have no > functional change. Just for the records, when I apply both patches 1/2 and 2/2, autorevert-tests fails. So it cannot be applied as such. Using just patch 1/2 works for the inotify backend. I'll continue to test. I recommend you to test also your patches by calling $ make -C test autorevert-tests Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 26 22:59:19 2021 Received: (at 44639) by debbugs.gnu.org; 27 Jan 2021 03:59:19 +0000 Received: from localhost ([127.0.0.1]:43284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bzD-0006iU-H0 for submit@debbugs.gnu.org; Tue, 26 Jan 2021 22:59:19 -0500 Received: from quimby.gnus.org ([95.216.78.240]:35718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bzB-0006i9-QX for 44639@debbugs.gnu.org; Tue, 26 Jan 2021 22:59:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1kmQXuwhDvLlLk1cAg8rUC3cd53Ba/2JGCfJxSpsLCY=; b=m3hiKM/OyUYEWxfYhb4Ymj2XFj csADZ0kAJXzYdTA2/DGRu5k4+ldbPX2cGPaPLcWhBk7ZLCudbqwBE408SLnXQhSGKzQhoRz310oVt 5m4K/Y7l5KkaGgFLPDCrGwELJOl6TWJrkmkB0LFLX+oh117DF4/EIEmezOqa4M28LrxU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4bz0-0000uX-Fp; Wed, 27 Jan 2021 04:59:12 +0100 From: Lars Ingebrigtsen To: Michael Albinus Subject: Re: bug#44639: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer References: <20201114165459.9518-1-sbaugh@catern.com> <20201114165459.9518-2-sbaugh@catern.com> <87o8jcdzyv.fsf@gmx.de> X-Now-Playing: Purr's _Whales Lead to the Deep Sea_: "Welcome" Date: Wed, 27 Jan 2021 04:59:05 +0100 In-Reply-To: <87o8jcdzyv.fsf@gmx.de> (Michael Albinus's message of "Wed, 02 Dec 2020 15:50:16 +0100") Message-ID: <87k0rzc9o6.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Michael Albinus writes: > Spencer Baugh writes: > >> Now that we don't share watch descriptors between buffers, we don't >> need to store a list of buffers for each watch descriptor - there >> would only [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44639 Cc: Spencer Baugh , 44639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Michael Albinus writes: > Spencer Baugh writes: > >> Now that we don't share watch descriptors between buffers, we don't >> need to store a list of buffers for each watch descriptor - there >> would only be a single buffer in each list. This should have no >> functional change. > > Just for the records, when I apply both patches 1/2 and 2/2, > autorevert-tests fails. So it cannot be applied as such. Spencer, did you do any further work on this patch? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 26 22:59:25 2021 Received: (at control) by debbugs.gnu.org; 27 Jan 2021 03:59:25 +0000 Received: from localhost ([127.0.0.1]:43287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bzI-0006io-SD for submit@debbugs.gnu.org; Tue, 26 Jan 2021 22:59:25 -0500 Received: from quimby.gnus.org ([95.216.78.240]:35732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bzH-0006iH-84 for control@debbugs.gnu.org; Tue, 26 Jan 2021 22:59:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=f/1L3+JnAZl7zE4qzgJ04v7v2nsJaz3npjNCK0M/Pkk=; b=BhkMgiFMPk17UoPwan3nKGCy87 qqLv87vIS9wHIuELPV3jNSFvJNRb9h1dWS9Ju1JXxwahVQLntb9ZNVSMLoRapDQMQlA6Md5vBkWDR zMMcJt6jFQyo4sgdLzrmV6ugl4WeU/UALQKdLKiah4xrkPsR9RhRhu0cZobIYYlGIxP4=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4bz9-0000ue-Mn for control@debbugs.gnu.org; Wed, 27 Jan 2021 04:59:17 +0100 Date: Wed, 27 Jan 2021 04:59:14 +0100 Message-Id: <87im7jc9nx.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #44639 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 44639 + moreinfo quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 44639 + moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 27 11:34:13 2021 Received: (at 44639) by debbugs.gnu.org; 27 Jan 2021 16:34:13 +0000 Received: from localhost ([127.0.0.1]:45972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4nlk-0002yL-RZ for submit@debbugs.gnu.org; Wed, 27 Jan 2021 11:34:13 -0500 Received: from venus.catern.com ([68.183.49.163]:33266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4nlh-0002yA-Oz for 44639@debbugs.gnu.org; Wed, 27 Jan 2021 11:34:11 -0500 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=98.7.229.235; helo=localhost; envelope-from=sbaugh@catern.com; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catern.com; s=mail; t=1611765248; bh=SZJvIWWi+B5GzNqeptPe9eakU6shgPpOzySnIrUbxRg=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=a8NziI4t5UmZ+tulyQas1IhOaEgIxF+TeQY4FJPYbuBdAsyjmsJGt7xY2mHnOTa2G UxUg5RAFw5VB7o1hQzPHgL19/kJ7lls58ORwDjcSaSuoUFM5A0ao9LXFEYnl5mca3E 4IW3QV/XXwW1FBqYs5ngbmEK12S36z1B1LjoW6zc= Received: from localhost (cpe-98-7-229-235.nyc.res.rr.com [98.7.229.235]) by venus.catern.com (Postfix) with ESMTPSA id 121E62E207F; Wed, 27 Jan 2021 16:34:08 +0000 (UTC) From: Spencer Baugh To: Lars Ingebrigtsen , Michael Albinus Subject: Re: bug#44639: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer In-Reply-To: <87k0rzc9o6.fsf@gnus.org> References: <20201114165459.9518-1-sbaugh@catern.com> <20201114165459.9518-2-sbaugh@catern.com> <87o8jcdzyv.fsf@gmx.de> <87k0rzc9o6.fsf@gnus.org> Date: Wed, 27 Jan 2021 11:34:01 -0500 Message-ID: <87tur2tk3q.fsf@catern.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44639 Cc: 44639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Michael Albinus writes: > >> Spencer Baugh writes: >> >>> Now that we don't share watch descriptors between buffers, we don't >>> need to store a list of buffers for each watch descriptor - there >>> would only be a single buffer in each list. This should have no >>> functional change. >> >> Just for the records, when I apply both patches 1/2 and 2/2, >> autorevert-tests fails. So it cannot be applied as such. > > Spencer, did you do any further work on this patch? Not this patch, no. Locally I have applied patch 1/2 and not patch 2/2. Patch 2/2 just removes dead code after patch 1/2 removes the functionality, and I must have gotten it wrong. But I can report that performance has been fine with patch 1/2 - I haven't seen the pathological case I was seeing before, and I haven't seen any new pathological cases to replace it. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 27 22:29:37 2021 Received: (at 44639) by debbugs.gnu.org; 28 Jan 2021 03:29:37 +0000 Received: from localhost ([127.0.0.1]:46701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4y00-0004JV-VT for submit@debbugs.gnu.org; Wed, 27 Jan 2021 22:29:37 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4xzy-0004JI-KQ for 44639@debbugs.gnu.org; Wed, 27 Jan 2021 22:29:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=E6ZFmsoaAiNmlnpRP7Tep+dhHSYO3OK7fDHc4l8m+W8=; b=rPia68PbzukMItYvf1YBVJx8Ze HXE/+2zr92J4h5F17kQZe14z6Hlt5jmJAUrgYFydGhel4iS9MDBqDphovkbFH5DLoS3fIIocUwHHs H25C3wptvlwxNUaNEh/SF/Md9Pt4fe6iIdyApp3gRHyAq5Rceblo6NX62KMkP/17tBdA=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4xzi-0003YX-6i; Thu, 28 Jan 2021 04:29:28 +0100 From: Lars Ingebrigtsen To: Spencer Baugh Subject: Re: bug#44639: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer References: <20201114165459.9518-1-sbaugh@catern.com> <20201114165459.9518-2-sbaugh@catern.com> <87o8jcdzyv.fsf@gmx.de> <87k0rzc9o6.fsf@gnus.org> <87tur2tk3q.fsf@catern.com> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEX5+euipq4hLE5t dYkaJkkgKkv///++XiGtAAAAAWJLR0QGYWa4fQAAAAd0SU1FB+UBHAMaH5KRqHEAAAGjSURBVDjL rZRhboMwDIXJuABVLzC5zgFKdoDVOBeIkvtfZc8mpYC6H5NmqQX6+fk5Tugw/F9MvwEiuqWULogh 2HeyQLpuIcO43X++B8InECTqMm+Kuv6eAZbEt4Xx8H1SLHdO81cHDVcWXkslpvmdQoiFtINYhGCD yxSUVRLtSkmuJUKBO5qJVsBeRiOZQjEHlrXdmlskKrkogAAQ8WHlYgphYorkAN6x4VPISjHySdwD HdVsTu6Bds384aWoxzSKkpiADRAdwWysA+7mAIxnYekgmjXMR8JAZoLMQd6VwjDJRA8fCbMIFs5Q oCOboxzMDSSxZcjNQPR+kYVSt4Txoo90UnwQA7A+2y3emAFVB6qLzaoqR7H2p9GAL2rxHXyZyx4U tb1kB7wHllxi3IBuCo67Ie4UVif7sk5gP3Z6lhKflWjOFVOaghxAba205uCgqNnNC7oKxPoCdtr8 NagoRbYjmR0gtynOXDEFdtzPvvQDl9XSoBB/n7RKP1ctY2IoxfXg8QyA7X4YLEfWd30K6X69X67p mhL+AUKYhj/F5ZfffwDV0b6VPeyM5gAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wMS0yOFQwMzoy NjozMCswMDowMA1OL0kAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDEtMjhUMDM6MjY6MzArMDA6 MDB8E5f1AAAAAElFTkSuQmCC X-Now-Playing: Wishmountain's _Wishmountain is Dead_: "Bottle" Date: Thu, 28 Jan 2021 04:29:16 +0100 In-Reply-To: <87tur2tk3q.fsf@catern.com> (Spencer Baugh's message of "Wed, 27 Jan 2021 11:34:01 -0500") Message-ID: <87pn1p68oj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Spencer Baugh writes: >>> Just for the records, when I apply both patches 1/2 and 2/2, >>> autorevert-tests fails. So it cannot be applied as such. >> >> Spencer, did you do any further work on this patch? > > Not this pat [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44639 Cc: Michael Albinus , 44639@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Spencer Baugh writes: >>> Just for the records, when I apply both patches 1/2 and 2/2, >>> autorevert-tests fails. So it cannot be applied as such. >> >> Spencer, did you do any further work on this patch? > > Not this patch, no. Locally I have applied patch 1/2 and not patch > 2/2. Patch 2/2 just removes dead code after patch 1/2 removes the > functionality, and I must have gotten it wrong. > > But I can report that performance has been fine with patch 1/2 - I > haven't seen the pathological case I was seeing before, and I haven't > seen any new pathological cases to replace it. Patch 1/2 was applied to Emacs 28 some time ago (and works fine), so this was just a followup on 2/2 -- whether this clean-up patch (which apparently doesn't work correctly, according to Michael) is going to get any further work done, or whether this issue should just be closed... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 28 09:20:01 2021 Received: (at 44639-done) by debbugs.gnu.org; 28 Jan 2021 14:20:01 +0000 Received: from localhost ([127.0.0.1]:47640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l589R-0008Dw-4D for submit@debbugs.gnu.org; Thu, 28 Jan 2021 09:20:01 -0500 Received: from mout.gmx.net ([212.227.17.21]:43217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l589O-0008De-W3 for 44639-done@debbugs.gnu.org; Thu, 28 Jan 2021 09:19:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1611843575; bh=ZD6vmWybNZfOfsuihBek6mbgRi6nJMM2yjxtQ/xtMXk=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=FuXKhqAyTicCruDo03Xa4C1Joi1uWkKzI0aUgysETQLl0hIQk+e2sN6KZ/r2z0Kkn mKLY10Pddonu1hpqCf4fdzZ9OubNJVL6oFW902DZVJyoM3VHo/rpO5j5hHHs+6tapj pdA+z/j47V8n1WLNEHhVaT2wssBtOmjRlzOGTYiM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gandalf.gmx.de ([212.91.249.101]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MBDnC-1lGiSH1MFy-00CeJC; Thu, 28 Jan 2021 15:19:35 +0100 From: Michael Albinus To: Lars Ingebrigtsen Subject: Re: bug#44639: [PATCH 2/2] autorevert: map each watch descriptor to a single buffer References: <20201114165459.9518-1-sbaugh@catern.com> <20201114165459.9518-2-sbaugh@catern.com> <87o8jcdzyv.fsf@gmx.de> <87k0rzc9o6.fsf@gnus.org> <87tur2tk3q.fsf@catern.com> <87pn1p68oj.fsf@gnus.org> Date: Thu, 28 Jan 2021 15:19:33 +0100 In-Reply-To: <87pn1p68oj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 28 Jan 2021 04:29:16 +0100") Message-ID: <871re55ekq.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:/fsUex65clwhVyNgSAJJCinsPikr9DingtZbjayCH5oR0voNfWJ 6ETZeLvAEGACBONk/+qR8mVLjy1Af57aCf/sOAv0IeqL1MEFEPwRfk8J4VhsGNAhJPE6T3K 4hZIy/7XDtlRK/B7FDB4hTQIVdxePkNZ2kFlcVOgx0OnazCEnGUplTB/AW/EG9/MXACt8qn BL0X/hyUAWXquGkm8XsyQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:0H61uEWCFfM=:CE6uOKo8Uk3k0V+BtEWh/a dNzQfadtktSvQUfNXwy2XnKEJjDRcfxUR5CiQl07c9iBvA2OANPPeO0HV6TPp8uMETCjWBDDY y6pcvjR+L7VaaXgUQeDIBwmlZ2yv1ik6VOpxJcSuD7U9/wMJJ9oW/3y6b8TkMNktCL+TrnOa8 YFQ5q4UrVR21eqU0rT9vSECgZqnJFsUJZTCbYMSypQU2GRt//hdu0hcofsDF3XJxrAtTITtmP r6hjHP/DdbeknD4y/k7is3qDxS87EyckFq3glCb90BF4qmjrAoPGzYGfgbKhIrwhQwdiJ73Mc Zcstlmdlujre2Md4d5R9JkmpmmNNJNjgXiwo9QMlR2gL6ANpWZ2ktg0Envjbb+meuu6zV0Fr1 44BBIDhD/rATlFZetabDImCPynKazwKyBf63n5RKfRqoy9fKJQ6/IJBeF7P66EzymWIp8jFfk +60vPNj1F/MgWUL8FhOttFXqTRGj2Y9sPCZne++gmV3Eua+I+XrV7IC/5xnoLh8mae4PDpKLM 6rSIBWGjaSwaANSk0EXqk7wgmJyDOK2VlbjseakQQBj+9trifCoYygNOp49JWK0D9gySiRVzm clEvxjRUeOIh8NmAuqTloVCBT2tRRfzorLE5ONGOvfE/15+g3ZJVtihzU6wZjs9pOUzIHKWB1 5vHBCnQ7FMvpBp7eZPKG+1lTbJNGqnQJxJLnBxgYA42uF8sS7n5E+3+bg0iwuRKDpHhw56R9t 7CnRcynUksm3Ypte9mHRiL8T3Ok22V8sk1pJ9Iergi+w7zC9f2fG1Qqm7cps2KgoF5B2OcZBv F86f41qDM5n1x+2ApWSCuasw87+hdKJfmF4+xnTwUvDVVjTNDQTL1ezhGw/vkonUe13OLwT+7 HO8Msw256PTTQc4ly/dw== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44639-done Cc: Spencer Baugh , 44639-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: Hi, > Patch 1/2 was applied to Emacs 28 some time ago (and works fine), so > this was just a followup on 2/2 -- whether this clean-up patch (which > apparently doesn't work correctly, according to Michael) is going to get > any further work done, or whether this issue should just be closed... I've reworked the patch, using an association list instead of a hash table. By this, I've fixed also the error which was always evident, but uncovered only by Spencer's patch. Pushed to master, I'm closing the bug. The patch itself is appended below. Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable *** /tmp/ediffGTBgTB 2021-01-28 15:18:21.881661122 +0100 =2D-- /home/albinus/src/emacs/lisp/autorevert.el 2021-01-28 15:06:38.03445= 6811 +0100 *************** *** 355,364 **** (add-hook 'after-set-visited-file-name-hook #'auto-revert-set-visited-file-name) ! (defvar auto-revert--buffers-by-watch-descriptor ! (make-hash-table :test 'equal) ! "A hash table mapping notification descriptors to lists of buffers. ! The buffers use that descriptor for auto-revert notifications. The key is equal to `auto-revert-notify-watch-descriptor' in each buffer.") =2D-- 355,363 ---- (add-hook 'after-set-visited-file-name-hook #'auto-revert-set-visited-file-name) ! (defvar auto-revert--buffer-by-watch-descriptor nil ! "An association list mapping notification descriptors to buffers. ! The buffer uses that descriptor for auto-revert notifications. The key is equal to `auto-revert-notify-watch-descriptor' in each buffer.") *************** *** 630,645 **** (defun auto-revert-notify-rm-watch () "Disable file notification for current buffer's associated file." ! (let ((desc auto-revert-notify-watch-descriptor) ! (table auto-revert--buffers-by-watch-descriptor)) ! (when desc ! (let ((buffers (delq (current-buffer) (gethash desc table)))) ! (if buffers ! (puthash desc buffers table) ! (remhash desc table))) ! (ignore-errors ! (file-notify-rm-watch desc)) ! (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t))) (setq auto-revert-notify-watch-descriptor nil auto-revert-notify-modified-p nil)) =2D-- 629,640 ---- (defun auto-revert-notify-rm-watch () "Disable file notification for current buffer's associated file." ! (when-let ((desc auto-revert-notify-watch-descriptor)) ! (setq auto-revert--buffer-by-watch-descriptor ! (assoc-delete-all desc auto-revert--buffer-by-watch-descriptor= )) ! (ignore-errors ! (file-notify-rm-watch desc)) ! (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t)) (setq auto-revert-notify-watch-descriptor nil auto-revert-notify-modified-p nil)) *************** *** 660,672 **** (if buffer-file-name '(change attribute-change) '(change)= ) 'auto-revert-notify-handler)))) (when auto-revert-notify-watch-descriptor ! (setq auto-revert-notify-modified-p t) ! (puthash ! auto-revert-notify-watch-descriptor ! (cons (current-buffer) ! (gethash auto-revert-notify-watch-descriptor ! auto-revert--buffers-by-watch-descriptor)) ! auto-revert--buffers-by-watch-descriptor) (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)= ))) ;; If we have file notifications, we want to update the auto-revert buff= ers =2D-- 655,664 ---- (if buffer-file-name '(change attribute-change) '(change)= ) 'auto-revert-notify-handler)))) (when auto-revert-notify-watch-descriptor ! (setq auto-revert-notify-modified-p t ! auto-revert--buffer-by-watch-descriptor ! (cons (cons auto-revert-notify-watch-descriptor (current-b= uffer)) ! auto-revert--buffer-by-watch-descriptor)) (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)= ))) ;; If we have file notifications, we want to update the auto-revert buff= ers *************** *** 696,703 **** (action (nth 1 event)) (file (nth 2 event)) (file1 (nth 3 event)) ;; Target of `renamed'. ! (buffers (gethash descriptor ! auto-revert--buffers-by-watch-descriptor))) ;; Check, that event is meant for us. (cl-assert descriptor) ;; Since we watch a directory, a file name must be returned. =2D-- 688,695 ---- (action (nth 1 event)) (file (nth 2 event)) (file1 (nth 3 event)) ;; Target of `renamed'. ! (buffer (alist-get descriptor auto-revert--buffer-by-watch-descripto= r ! nil nil #'equal))) ;; Check, that event is meant for us. (cl-assert descriptor) ;; Since we watch a directory, a file name must be returned. *************** *** 706,714 **** (when auto-revert-debug (message "auto-revert-notify-handler %S" event)) ! (if (eq action 'stopped) ! ;; File notification has stopped. Continue with polling. ! (cl-dolist (buffer buffers) (with-current-buffer buffer (when (or ;; A buffer associated with a file. =2D-- 698,706 ---- (when auto-revert-debug (message "auto-revert-notify-handler %S" event)) ! (when (buffer-live-p buffer) ! (if (eq action 'stopped) ! ;; File notification has stopped. Continue with polling. (with-current-buffer buffer (when (or ;; A buffer associated with a file. *************** *** 721,758 **** (auto-revert-notify-rm-watch) ;; Restart the timer if it wasn't running. (unless auto-revert-timer ! (auto-revert-set-timer))))) ! ;; Loop over all buffers, in order to find the intended one. ! (cl-dolist (buffer buffers) ! (when (buffer-live-p buffer) ! (with-current-buffer buffer ! (when (or ! ;; A buffer associated with a file. ! (and (stringp buffer-file-name) ! (or ! (and (memq ! action '(attribute-changed changed crea= ted)) ! (string-equal ! (file-name-nondirectory file) ! (file-name-nondirectory buffer-file-nam= e))) ! (and (eq action 'renamed) ! (string-equal ! (file-name-nondirectory file1) ! (file-name-nondirectory buffer-file-nam= e))))) ! ;; A buffer w/o a file, like dired. ! (and (null buffer-file-name) ! (memq action '(created renamed deleted)))) ! ;; Mark buffer modified. ! (setq auto-revert-notify-modified-p t) ! ! ;; Revert the buffer now if we're not locked out. ! (unless auto-revert--lockout-timer ! (auto-revert-handler) ! (setq auto-revert--lockout-timer ! (run-with-timer ! auto-revert--lockout-interval nil ! #'auto-revert--end-lockout buffer))))))))))) (defun auto-revert--end-lockout (buffer) "End the lockout period after a notification. =2D-- 713,747 ---- (auto-revert-notify-rm-watch) ;; Restart the timer if it wasn't running. (unless auto-revert-timer ! (auto-revert-set-timer)))) ! (with-current-buffer buffer ! (when (or ! ;; A buffer associated with a file. ! (and (stringp buffer-file-name) ! (or ! (and (memq ! action '(attribute-changed changed create= d)) ! (string-equal ! (file-name-nondirectory file) ! (file-name-nondirectory buffer-file-name)= )) ! (and (eq action 'renamed) ! (string-equal ! (file-name-nondirectory file1) ! (file-name-nondirectory buffer-file-name)= )))) ! ;; A buffer w/o a file, like dired. ! (and (null buffer-file-name) ! (memq action '(created renamed deleted)))) ! ;; Mark buffer modified. ! (setq auto-revert-notify-modified-p t) ! ! ;; Revert the buffer now if we're not locked out. ! (unless auto-revert--lockout-timer ! (auto-revert-handler) ! (setq auto-revert--lockout-timer ! (run-with-timer ! auto-revert--lockout-interval nil ! #'auto-revert--end-lockout buffer)))))))))) (defun auto-revert--end-lockout (buffer) "End the lockout period after a notification. --=-=-=-- From unknown Sun Aug 10 11:49:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 26 Feb 2021 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator