Steven Allen <ste...@stebalien.com> writes:

> If there's any interest, I'm happy to clean this up and submit a patch
> but I figured I'd ask first.

+1 This feature is long overdue. :)

That said, I tried your code, with a single large Org file, called
`notes.org', and would like to suggest two improvements:

(1) With exactly one file in `org-id-files', its name is added as a
prefix to every completion candidate.  In my case, every completion is
prefixed with `notes.org/', which I think is a lot of noise for no
signal.  IMO, it would be best if the file name prefix was not there
when the user has a single source of IDs.

(2) One of the completions I see is "notes.org/" exactly, but the file
itself has no ID associated with it.  Out of curiosity, I tried to
select the suspicious completion, and I got:

Can’t get link description from org link parameter ‘:insert-description’: 
#[(link desc) ((or (org-string-nw-p desc) (let* ((loc (and t (org-id-find 
(string-remove-prefix "id:" link))))) (if loc (let ((--mark-function #'(lambda 
nil (setq org-file-buffer-created (prog1 (car loc) (make-local-variable 
'org-file-buffer-created))))) (--filename (car loc)) --buffer) (add-hook 
'find-file-hook --mark-function) (unwind-protect (progn (setq --buffer 
(find-file-noselect --filename t)) (save-current-buffer (set-buffer --buffer) 
(prog1 (progn (save-excursion (goto-char (cdr loc)) (org-link-display-format 
(org-get-heading t t t t)))) (save-current-buffer (set-buffer --buffer) (if 
(equal --filename org-file-buffer-created) (progn (kill-buffer))))))) 
(remove-hook 'find-file-hook --mark-function))))))) (t)]

Still, I think this would be a *huge* improvement for Org users!

Rudy
-- 
"Programming reliably -- must be an activity of an undeniably
mathematical nature […] You see, mathematics is about thinking, and
doing mathematics is always trying to think as well as possible."
--- Edsger W. Dijkstra, 1981

Rudolf Adamkovič <rud...@adamkovic.org> [he/him]
http://adamkovic.org

Reply via email to