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 via email to