all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* auto-revert in VCS
@ 2010-02-16  9:57 Andrea Crotti
  2010-02-23  4:29 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Crotti @ 2010-02-16  9:57 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to have auto-revert activated when I work with branches.
For example in git projects every time I change branch I have to revert
buffer manually to start working on the new branch.
So I wrote this in my conf:

--8<---------------cut here---------------start------------->8---
(require 'autorevert)
(setq auto-revert-check-vc-info t)
(setq auto-revert-interval 3) ;; this could be cpu consuming
(setq auto-revert-verbose t)

(setq global-auto-revert-mode t)
--8<---------------cut here---------------end--------------->8---

The problem is that emacs was sucking all my cpu power and that's not
nice...
I only need to enable auto-revert for files under revision control, and
only on files which I'm visiting in some buffers (and the buffer is
active), is that possible somehow?





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

* Re: auto-revert in VCS
  2010-02-16  9:57 auto-revert in VCS Andrea Crotti
@ 2010-02-23  4:29 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2010-02-23  4:29 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti wrote:
> I would like to have auto-revert activated when I work with branches.
> For example in git projects every time I change branch I have to revert
> buffer manually to start working on the new branch.
> So I wrote this in my conf:
> 
> --8<---------------cut here---------------start------------->8---
> (require 'autorevert)
> (setq auto-revert-check-vc-info t)
> (setq auto-revert-interval 3) ;; this could be cpu consuming
> (setq auto-revert-verbose t)
> 
> (setq global-auto-revert-mode t)

That last setting is not recommended:

,----[ C-h v global-auto-revert-mode RET ]
| global-auto-revert-mode is a variable defined in `autorevert.el'.
| Its value is nil
|
|
| Documentation:
| Non-nil if Global-Auto-Revert mode is enabled.
| See the command `global-auto-revert-mode' for a description of this minor mode.
| Setting this variable directly does not take effect;
| either customize it (see the info node `Easy Customization')
| or call the function `global-auto-revert-mode'.
|
| You can customize this variable.
|
| [back]
`----

> --8<---------------cut here---------------end--------------->8---
> 
> The problem is that emacs was sucking all my cpu power and that's not
> nice...
> I only need to enable auto-revert for files under revision control, and
> only on files which I'm visiting in some buffers (and the buffer is
> active), is that possible somehow?

Call turn-on-auto-revert-mode in a find-file-hook function that checks
the result of (vc-backend buffer-file-name).

There is no such thing as an active/inactive buffer.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

end of thread, other threads:[~2010-02-23  4:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16  9:57 auto-revert in VCS Andrea Crotti
2010-02-23  4:29 ` Kevin Rodgers

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.