Browse Source

Fix bug with id files to be scanned

John Wiegley writes:

> In `org-id-update-id-locations', it uses the value of
> org-id-extra-files and calls file-truename on all its members,
> assuming them to be filenames.
>
> However, my `org-id-extra-files' is the symbol
> `org-agenda-text-search-extra-files', which contains the symbol
> `agenda-archives'.  I get an error because Org is calling
> file-truename on that symbol.  This stops me from doing "id"
> based link lookups within archive files.
Carsten Dominik 15 years ago
parent
commit
c2d7c2f982
2 changed files with 30 additions and 18 deletions
  1. 5 0
      lisp/ChangeLog
  2. 25 18
      lisp/org-id.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-10-28  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-id.el (org-id-update-id-locations): Add archive files if
+	that is required by `org-id-extra-files'.
+
 2009-10-27  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-src.el (org-src-window-setup): New option.

+ 25 - 18
lisp/org-id.el

@@ -392,25 +392,32 @@ When CHECK is given, prepare detailed information about duplicate IDs."
   (interactive)
   (if (not org-id-track-globally)
       (error "Please turn on `org-id-track-globally' if you want to track IDs")
-    (let ((files
-	   (or files
-	       (append
-		;; Agenda files and all associated archives
-		(org-agenda-files t org-id-search-archives)
-		;; Explicit extra files
-		(if (symbolp org-id-extra-files)
-		    (symbol-value org-id-extra-files)
-		  org-id-extra-files)
+    (let* ((org-id-search-archives
+	    (or org-id-search-archives
+		(and (symbolp org-id-extra-files)
+		     (symbol-value org-id-extra-files)
+		     (member 'agenda-archives org-id-extra-files))))
+	   (files
+	    (or files
+		(append
+		 ;; Agenda files and all associated archives
+		 (org-agenda-files t org-id-search-archives)
+		 ;; Explicit extra files
+		 (if (symbolp org-id-extra-files)
+		     (symbol-value org-id-extra-files)
+		   org-id-extra-files)
 	      ;; Files associated with live org-mode buffers
-		(delq nil
-		      (mapcar (lambda (b)
-				(with-current-buffer b
-				  (and (org-mode-p) (buffer-file-name))))
-			      (buffer-list)))
-		;; All files known to have IDs
-		org-id-files)))
-	  org-agenda-new-buffers
-	  file nfiles tfile ids reg found id seen (ndup 0))
+		 (delq nil
+		       (mapcar (lambda (b)
+				 (with-current-buffer b
+				   (and (org-mode-p) (buffer-file-name))))
+			       (buffer-list)))
+		 ;; All files known to have IDs
+		 org-id-files)))
+	   org-agenda-new-buffers
+	   file nfiles tfile ids reg found id seen (ndup 0))
+      (when (member 'agenda-archives files)
+	(setq files (delq 'agenda-archives (copy-sequence files))))
       (setq nfiles (length files))
       (while (setq file (pop files))
 	(message "Finding ID locations (%d/%d files): %s"