From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22557: 25.0.90; Saving a buffer under auto-revert turns off file notifications Date: Thu, 04 Feb 2016 20:34:10 +0200 Message-ID: <83a8ngwcil.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1454610924 933 80.91.229.3 (4 Feb 2016 18:35:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Feb 2016 18:35:24 +0000 (UTC) To: 22557@debbugs.gnu.org, michael.albinus@gmx.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 04 19:35:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aROkJ-0007lL-LH for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Feb 2016 19:35:11 +0100 Original-Received: from localhost ([::1]:43535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROkJ-0000mH-16 for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Feb 2016 13:35:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROkF-0000kH-9Q for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:35:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aROkA-0007aJ-70 for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:35:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROkA-0007a1-37 for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aROk9-0007ue-SU for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Feb 2016 18:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, Michael Albinus Original-Received: via spool by submit@debbugs.gnu.org id=B.145461088630385 (code B ref -1); Thu, 04 Feb 2016 18:35:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Feb 2016 18:34:46 +0000 Original-Received: from localhost ([127.0.0.1]:60609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aROju-0007u1-1X for submit@debbugs.gnu.org; Thu, 04 Feb 2016 13:34:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56827) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aROjs-0007tl-8b for submit@debbugs.gnu.org; Thu, 04 Feb 2016 13:34:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aROjl-0007TX-C1 for submit@debbugs.gnu.org; Thu, 04 Feb 2016 13:34:38 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROjl-0007TS-8y for submit@debbugs.gnu.org; Thu, 04 Feb 2016 13:34:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROjj-0000em-Ki for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:34:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aROji-0007ST-8i for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 13:34:35 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aROjb-0007RC-2F; Thu, 04 Feb 2016 13:34:27 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4466 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aROja-000574-0o; Thu, 04 Feb 2016 13:34:26 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112425 Archived-At: emacs -Q C-x C-f SOME-FILE RET M-x auto-revert-mode RET M-: auto-revert-use-notify RET => t Modify the buffer and save it with "C-x C-s". Then: M-: auto-revert-use-notify RET => nil This is on MS-Windows; the same recipe on GNU/Linux with inotify doesn't have this problem. Looking under the hood reveals that filenotify.el sends a 'stopped' notification when Emacs renames SOME-FILE to SOME-FILE~, to back it up. In response, auto-revert-mode turns off file notifications and falls back to polling. It looks like the reason is this condition in filenotify.el: ;; Check for stopped. (setq stopped (or stopped (and (memq action '(deleted renamed)) (= (length (cdr registered)) 1) (or (string-equal (file-name-nondirectory file) (file-name-nondirectory (car registered))) (string-equal (file-name-nondirectory file) (car (cadr registered))))))) The second call to string-equal is the culprit: the file names match, so 'stopped' gets a non-nil value. I don't understand the logic of this: at least with w32notify, when a file is in auto-revert-mode, we watch the entire parent directory of that file, so there's no need to send the 'stopped' event when the file is renamed or deleted, only when the parent directory is deleted. This second call to string-equal was added as part of kqueue back-port, but it affects all the backends, and there's no comment or anything in the log message that explains the rationale for this part of the change, only a laconic "Add kqueue support." What is the reason for this test, and should it perhaps be limited to kqueue? In GNU Emacs 25.0.90.2 (i686-pc-mingw32) of 2016-01-31 built on HOME-C4E4A596F7 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 Configured using: 'configure --prefix=/d/usr --enable-checking=yes,glyphs --with-wide-int --with-modules 'CFLAGS=-Og -gdwarf-4 -g3'' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: Mail Minor modes in effect: shell-dirtrack-mode: t flyspell-mode: t diff-auto-refine-mode: t desktop-save-mode: t save-place-mode: t show-paren-mode: t display-time-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t temp-buffer-resize-mode: t line-number-mode: t auto-fill-function: mail-mode-auto-fill abbrev-mode: t Recent messages: Mark saved where search started [2 times] Mark set Mark saved where search started Mark set Saving file d:/gnu/git/emacs/branch/lisp/filenotify.el... Wrote d:/gnu/git/emacs/branch/lisp/filenotify.el Mark set Undo! Saving file d:/gnu/git/emacs/branch/lisp/filenotify.el... Wrote d:/gnu/git/emacs/branch/lisp/filenotify.el Load-path shadows: d:/usr/share/emacs/site-lisp/soap-inspect hides d:/usr/share/emacs/25.0.90/lisp/net/soap-inspect d:/usr/share/emacs/site-lisp/soap-client hides d:/usr/share/emacs/25.0.90/lisp/net/soap-client Features: (descr-text iso-transl ebuff-menu pp shadow emacsbug ruby-mode smie shell character-fold misearch multi-isearch rmailout url-util url-parse url-vars rfc2104 network-stream nsm starttls tls gnutls mail-extr smtpmail auth-source eieio eieio-core cl-macs password-cache dabbrev mailalias sendmail shr-color color shr dom subr-x browse-url cl-seq conf-mode arc-mode archive-mode vc-bzr org-element org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view image-mode org-bibtex bibtex org-bbdb org-w3m org advice org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs bat-mode make-mode parse-time vc-cvs generic vc-svn texinfo jka-compr noutline outline bug-reference flyspell add-log info vc vc-dispatcher vc-git diff-mode easy-mmode map seq byte-opt gv bytecomp byte-compile cconv cl-extra qp rmailsum rmailmm message dired-x dired format-spec rfc822 mml mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr mail-utils desktop frameset server filecache mairix cus-edit cus-start cus-load wid-edit saveplace midnight ispell generic-x cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs pcase cl-lib paren battery time time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote w32notify w32 multi-tty make-network-process emacs) Memory information: ((conses 16 1766138 246501) (symbols 56 51658 10) (miscs 48 3618 4548) (strings 16 128344 31235) (string-bytes 1 3335828) (vectors 16 42573) (vector-slots 8 1729654 252618) (floats 8 498 992) (intervals 40 338547 2583) (buffers 856 223))