all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 25277@debbugs.gnu.org
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)	[thread overview]
Message-ID: <e8b435eb-3f40-4c73-bcc7-92ec96eb8de3@default> (raw)

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	other threads:[~2016-12-26 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 18:32 Drew Adams [this message]
2019-07-27 10:51 ` bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer' Lars Ingebrigtsen
2019-07-27 11:05   ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=e8b435eb-3f40-4c73-bcc7-92ec96eb8de3@default \
    --to=drew.adams@oracle.com \
    --cc=25277@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.