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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25277 in the body.
You can then email your comments to 25277 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25277; Package emacs. (Mon, 26 Dec 2016 18:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 Dec 2016 18:33:02 GMT) Full text and rfc822 format available.

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'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25277; Package emacs. (Sat, 27 Jul 2019 10:52:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 25277 <at> debbugs.gnu.org
Subject: Re: bug#25277: 24.5; Allow predicate, not just Boolean value, for
 `global-auto-revert-ignore-buffer'
Date: Sat, 27 Jul 2019 12:51:12 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> 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.

I think that makes sense.  What parameter(s) would the predicate take?
The buffer or the file name... or both?  Hm...  Looking at the code
where `global-auto-revert-ignore-buffer' is consulted, we're in the
correct buffer, but it may not have a file name, so I guess the buffer
should be the parameter?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25277; Package emacs. (Sat, 27 Jul 2019 11:06:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 25277 <at> debbugs.gnu.org
Subject: Re: bug#25277: 24.5; Allow predicate, not just Boolean value, for
 `global-auto-revert-ignore-buffer'
Date: Sat, 27 Jul 2019 13:05:41 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I think that makes sense.  What parameter(s) would the predicate take?
> The buffer or the file name... or both?  Hm...  Looking at the code
> where `global-auto-revert-ignore-buffer' is consulted, we're in the
> correct buffer, but it may not have a file name, so I guess the buffer
> should be the parameter?

I've now made this change on the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 27 Jul 2019 11:06:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 25277 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 27 Jul 2019 11:06:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 24 Aug 2019 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 243 days ago.

Previous Next


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