From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: revert all org buffers which changed on disk Date: Wed, 27 Apr 2011 12:18:19 +0200 Message-ID: <87r58o6lqs.wl%n142857@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF1p9-0004Dm-KU for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:18:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QF1p8-0007qE-L0 for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:18:23 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:61466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF1p8-0007q1-GL for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:18:22 -0400 Received: by wyf19 with SMTP id 19so1380991wyf.0 for ; Wed, 27 Apr 2011 03:18:21 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Mailinglist 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)))))