Browse Source

Only write id locations if any are defined

This is to avoid an empty file when no id's have been used at all.
Carsten Dominik 15 years ago
parent
commit
00179c97b7
2 changed files with 4 additions and 1 deletions
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-id.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-12-10  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-id.el (org-id-locations-save): Only write the id locations
+	if any are defined.
+
 	* org-archive.el (org-archive-all-done): Make this work in a file
 	with org-odd-levels-only set.
 

+ 1 - 1
lisp/org-id.el

@@ -466,7 +466,7 @@ When CHECK is given, prepare detailed information about duplicate IDs."
 
 (defun org-id-locations-save ()
   "Save `org-id-locations' in `org-id-locations-file'."
-  (when org-id-track-globally
+  (when (and org-id-track-globally org-id-locations)
     (let ((out (if (hash-table-p org-id-locations)
 		   (org-id-hash-to-alist org-id-locations)
 		 org-id-locations)))