Переглянути джерело

Reverting: also handle id locations.

Saving all buffers will now also safe the id locations.
Reverting all buffers will now also reload the id locations.
Carsten Dominik 16 роки тому
батько
коміт
304cb36530
3 змінених файлів з 22 додано та 3 видалено
  1. 2 1
      doc/org.texi
  2. 5 0
      lisp/ChangeLog
  3. 15 2
      lisp/org.el

+ 2 - 1
doc/org.texi

@@ -6339,7 +6339,8 @@ Same as @kbd{r}.
 @kindex C-x C-s
 @item s
 @itemx C-x C-s
-Save all Org buffers in the current Emacs session.
+Save all Org buffers in the current Emacs session, and also the locations of
+IDs.
 @c
 @kindex @key{right}
 @item @key{right}

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-02-13  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-save-all-org-buffers): Also save id locations.
+	(org-revert-all-org-buffers): Also load id locations.
+
 2009-02-12  Carsten Dominik  <carsten.dominik@gmail.com>
 	* org.el (org-drawers): Add LOGBOOK to the default drawers.
 	(org-log-state-notes-into-drawer): New option.

+ 15 - 2
lisp/org.el

@@ -12327,11 +12327,22 @@ If there is already a time stamp at the cursor position, update it."
   (interactive)
   (message "Saving all Org-mode buffers...")
   (save-some-buffers t 'org-mode-p)
+  (when (featurep 'org-id) (org-id-locations-save))
   (message "Saving all Org-mode buffers... done"))
 
 (defun org-revert-all-org-buffers ()
   "Revert all Org-mode buffers.
-Prompt for confirmation when there are unsaved changes."
+Prompt for confirmation when there are unsaved changes.
+Be sure you know what you are doing before letting this function
+overwrite your changes.
+
+This function is useful in a setup where one tracks org files
+with a version control system, to revert on one machine after pulling
+changes from another.  I believe the procedure must be like this:
+
+1. M-x org-save-all-org-buffers
+2. Pull changes from the other machine, resolve conflicts
+3. M-x org-revert-all-org-buffers"
   (interactive)
   (unless (yes-or-no-p "Revert all Org buffers from their files? ")
     (error "Abort"))
@@ -12343,7 +12354,9 @@ Prompt for confirmation when there are unsaved changes."
 		    (with-current-buffer b buffer-file-name))
 	   (switch-to-buffer b)
 	   (revert-buffer t 'no-confirm)))
-       (buffer-list)))))
+       (buffer-list))
+      (when (and (featurep 'org-id) org-id-track-globally)
+	(org-id-locations-load)))))
 
 ;;;; Agenda files