GNU bug report logs - #25277
24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 26 Dec 2016 18:33:02 UTC

Severity: wishlist

Tags: fixed

Found in version 24.5

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Allow predicate, not just Boolean value, for
 `global-auto-revert-ignore-buffer'
Date: Mon, 26 Dec 2016 10:32:17 -0800 (PST)
Enhancement request.  Provide an easy way to specify a predicate that
inhibits (or activates) auto-revert for a given buffer.

See this question, for example:
http://emacs.stackexchange.com/q/29591/105

I provided this answer, but it might be helpful if Emacs provided a
variable whose value is a predicate that determines whether the current
buffer can be auto-reverted.  Emacs provides a variable,
`global-auto-revert-ignore-buffer', to test for auto-reversion.  In
addition or instead, it could provide a predicate-valued variable.

Simpler, perhaps, is to let the value of
`global-auto-revert-ignore-buffer' be, alternatively, a predicate, which
is called when the buffer is set up (e.g. `after-file-hook', for a file
buffer).  The return value would be handled just like the current value
of `global-auto-revert-ignore-buffer' is handled now.

---

(defvar my-max-auto-revert-size 1000000000
  "Do not auto-revert file buffers larger than this.")

(add-hook 'find-file-hook
          (lambda ()
            (when (> (buffer-size) my-max-auto-revert-size)
              (setq global-auto-revert-ignore-buffer  t))))

(global-auto-revert-mode 1)


In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/usr --host=i686-pc-mingw32'




This bug report was last modified 5 years and 359 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.