all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer'
@ 2016-12-26 18:32 Drew Adams
  2019-07-27 10:51 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2016-12-26 18:32 UTC (permalink / raw)
  To: 25277

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'





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer'
  2016-12-26 18:32 bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer' Drew Adams
@ 2019-07-27 10:51 ` Lars Ingebrigtsen
  2019-07-27 11:05   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-27 10:51 UTC (permalink / raw)
  To: Drew Adams; +Cc: 25277

Drew Adams <drew.adams@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer'
  2019-07-27 10:51 ` Lars Ingebrigtsen
@ 2019-07-27 11:05   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-27 11:05 UTC (permalink / raw)
  To: Drew Adams; +Cc: 25277

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-27 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-26 18:32 bug#25277: 24.5; Allow predicate, not just Boolean value, for `global-auto-revert-ignore-buffer' Drew Adams
2019-07-27 10:51 ` Lars Ingebrigtsen
2019-07-27 11:05   ` Lars Ingebrigtsen

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.