|
@@ -76,6 +76,8 @@
|
|
|
|
|
|
(declare-function message-make-fqdn "message" ())
|
|
|
(declare-function org-goto-location "org-goto" (&optional _buf help))
|
|
|
+;; Declared inside `org-element-with-disabled-cache' macro.
|
|
|
+(declare-function org-element--cache-active-p "org-element.el" (&optional called-from-cache-change-func-p))
|
|
|
|
|
|
;;; Customization
|
|
|
|
|
@@ -522,30 +524,31 @@ If SILENT is non-nil, messages are suppressed."
|
|
|
(ndup 0)
|
|
|
(i 0))
|
|
|
(with-temp-buffer
|
|
|
- (delay-mode-hooks
|
|
|
- (org-mode)
|
|
|
- (dolist (file files)
|
|
|
- (when (file-exists-p file)
|
|
|
- (unless silent
|
|
|
- (cl-incf i)
|
|
|
- (message "Finding ID locations (%d/%d files): %s" i nfiles file))
|
|
|
- (insert-file-contents file nil nil nil 'replace)
|
|
|
- (let ((ids nil)
|
|
|
- (case-fold-search t))
|
|
|
- (org-with-point-at 1
|
|
|
- (while (re-search-forward id-regexp nil t)
|
|
|
- (when (org-at-property-p)
|
|
|
- (push (org-entry-get (point) "ID") ids)))
|
|
|
- (when ids
|
|
|
- (push (cons (abbreviate-file-name file) ids)
|
|
|
- org-id-locations)
|
|
|
- (dolist (id ids)
|
|
|
- (cond
|
|
|
- ((not (member id seen-ids)) (push id seen-ids))
|
|
|
- (silent nil)
|
|
|
- (t
|
|
|
- (message "Duplicate ID %S" id)
|
|
|
- (cl-incf ndup)))))))))))
|
|
|
+ (org-element-with-disabled-cache
|
|
|
+ (delay-mode-hooks
|
|
|
+ (org-mode)
|
|
|
+ (dolist (file files)
|
|
|
+ (when (file-exists-p file)
|
|
|
+ (unless silent
|
|
|
+ (cl-incf i)
|
|
|
+ (message "Finding ID locations (%d/%d files): %s" i nfiles file))
|
|
|
+ (insert-file-contents file nil nil nil 'replace)
|
|
|
+ (let ((ids nil)
|
|
|
+ (case-fold-search t))
|
|
|
+ (org-with-point-at 1
|
|
|
+ (while (re-search-forward id-regexp nil t)
|
|
|
+ (when (org-at-property-p)
|
|
|
+ (push (org-entry-get (point) "ID") ids)))
|
|
|
+ (when ids
|
|
|
+ (push (cons (abbreviate-file-name file) ids)
|
|
|
+ org-id-locations)
|
|
|
+ (dolist (id ids)
|
|
|
+ (cond
|
|
|
+ ((not (member id seen-ids)) (push id seen-ids))
|
|
|
+ (silent nil)
|
|
|
+ (t
|
|
|
+ (message "Duplicate ID %S" id)
|
|
|
+ (cl-incf ndup))))))))))))
|
|
|
(setq org-id-files (mapcar #'car org-id-locations))
|
|
|
(org-id-locations-save)
|
|
|
;; Now convert to a hash table.
|