bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-au


From: Drew Adams
Subject: bug#25277: 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'





reply via email to

[Prev in Thread] Current Thread [Next in Thread]