unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: 19449@debbugs.gnu.org
Subject: bug#19449: 25.0.50; `auto-revert-tail-mode' tries to revert remote files even if `auto-revert-remote-files' is nil
Date: Fri, 26 Dec 2014 23:24:43 +0300	[thread overview]
Message-ID: <m24msi40s4.fsf@fastmail.fm> (raw)

Below is the suggested patch.

Analysis:

When the `auto-revert-tail-mode' is called it temporarily enables
auto-revert-mode:

      (or auto-revert-mode
	  (let ((auto-revert-tail-mode t))
	    (auto-revert-mode 1)))

`auto-revert-mode' then calls `auto-revert-buffers' which in turn calls
`auto-revert-handler' (fixed by the patch).

Then, this code yielded t:

+	      (and (or auto-revert-mode
+		       global-auto-revert-non-file-buffers)

which resulted as `revert' set to t.

In the end, `(auto-revert-tail-handler size)' was evaluted with nil
size.

This produces error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  auto-revert-tail-handler(nil)


Fix:

In `revert' value calculation, `or' is changed to `if'.  The "then"
clause applies to file-visiting buffers, this is where the result of
`file-remote-p' is analyzed.  The "else" clause case applies to non-file
buffers.

Ok to apply?

Filipp

diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index f1074e2..514dc2b 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -589,8 +589,8 @@ This is an internal function used by Auto-Revert Mode."
 	   ;; the values.
 	   (remote-file-name-inhibit-cache t)
 	   (revert
-	    (or (and buffer-file-name
-		     (or auto-revert-remote-files
+	    (if buffer-file-name
+		(and (or auto-revert-remote-files
 			 (not (file-remote-p buffer-file-name)))
 		     (or (not auto-revert-use-notify)
 			 auto-revert-notify-modified-p)
@@ -603,11 +603,11 @@ This is an internal function used by Auto-Revert Mode."
 		       (funcall (or buffer-stale-function
                                     #'buffer-stale--default-function)
                                 t)))
-		(and (or auto-revert-mode
-			 global-auto-revert-non-file-buffers)
-		     (funcall (or buffer-stale-function
-                                  #'buffer-stale--default-function)
-                              t))))
+	      (and (or auto-revert-mode
+		       global-auto-revert-non-file-buffers)
+		   (funcall (or buffer-stale-function
+				#'buffer-stale--default-function)
+			    t))))
 	   eob eoblist)
       (setq auto-revert-notify-modified-p nil)
       (when revert





             reply	other threads:[~2014-12-26 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26 20:24 Filipp Gunbin [this message]
2014-12-28 12:34 ` bug#19449: 25.0.50; `auto-revert-tail-mode' tries to revert remote files even if `auto-revert-remote-files' is nil Michael Albinus
2014-12-29 15:36   ` Filipp Gunbin
2014-12-29 15:58     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24msi40s4.fsf@fastmail.fm \
    --to=fgunbin@fastmail.fm \
    --cc=19449@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).