all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: revert all org buffers which changed on disk
Date: Wed, 27 Apr 2011 12:18:19 +0200	[thread overview]
Message-ID: <87r58o6lqs.wl%n142857@gmail.com> (raw)


Hi.
  org-revert-all-org-buffers loads all buffers from disk even if they didn't change. This can be very slow if you have hundreds of org files. The code below adds an extra check to only revert files which changed (according to verify-visited-file-modtime).
  It may be better to have only one function, org-revert-org-buffers, which by default reverts only changed buffers, but accepts a parameter to revert them all.



(defun org-revert-changed-org-buffers ()
  "Revert all Org-mode buffers changed outside of Emacs.

This works like org-revert-all-org-buffers but is limited to those files
which have a more recent modification time than the one in Emacs' buffer.
This function is faster because it does not reload unchanged buffers."
  (interactive)
  (unless (yes-or-no-p "Revert changed Org buffers from their files? ")
    (error "Abort"))
  (save-excursion
    (save-window-excursion
      (mapc
       (lambda (b)
     (when (and (with-current-buffer b (org-mode-p))
            (with-current-buffer b buffer-file-name)
            (not (verify-visited-file-modtime b)))
       (switch-to-buffer b)
       (revert-buffer t 'no-confirm)))
       (buffer-list))
      (when (and (featurep 'org-id) org-id-track-globally)
    (org-id-locations-load)))))

             reply	other threads:[~2011-04-27 10:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 10:18 Daniel Clemente [this message]
2011-04-28 23:01 ` revert all org buffers which changed on disk Jason Dunsmore
2011-05-02 12:09   ` Daniel Clemente

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=87r58o6lqs.wl%n142857@gmail.com \
    --to=n142857@gmail.com \
    --cc=emacs-orgmode@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.