fyi, the behavior with your form for me is identical to the behavior without it.

for me, the completions in both cases show
1) an org id
   - useless to me, because i think in terms of headings
2) followed by attachment:, eww:, rmail:, and a bunch of other prefixes
   - useless to me because i never insert those things
   - they take up the entire expanded minibuffer, so nothing usable
for me shows without scrolling
3) followed by (if and only if i scroll with arrow key):
   - another org id (useless to me)
   - a heading (headings are desirable)
   - another heading (headings are desirable)
   - another org id (useless to me)

and nothing else.  if i stored more headings than those 2, they
are not showing.

if i just press RET, i get the most recently org-store-link 'ed id/heading link.

what i would want:
  - insert org ids by their heading
  - show ALL stored links, at top, in recency sequence
    - if they are org id, show by HEADING
      - not by id
      - not by olpath
  - i don't need the eww: etc. prefixes, but they can be after all that

(optional, extra credit) upon c-u or so, somehow insert all stored
links as a batch, perhaps back until some boundary was set.  (e.g.
"now i am going to collect links" then "now i insert them all".)

my completion is ido with ido-hacks.  i have org goto stuff set so it
shows headings, not olpaths, and uses completion.


On Tue, Aug 19, 2025 at 12:42 PM Steven Allen <ste...@stebalien.com> wrote:
>
>
> I use the following snippet to quickly link to headings by ID with
> via org-insert-link. If there's any interest, I'm happy to clean this
> up and submit a patch but I figured I'd ask first.
>
>     (org-link-set-parameters
>     "id"
>     :complete
>     (lambda (&optional _prefix)
>     (unless org-id-locations (org-id-locations-load))
>     (when-let* ((id (org-id-get-with-outline-path-completion
>                         '((org-id-files . (:maxlevel . 10))))))
>         (concat "id:" id)))
>     :insert-description
>     (lambda (link desc)
>     (or (org-string-nw-p desc)
>         (when-let* ((loc (org-id-find (string-remove-prefix "id:" link))))
>             (org-with-file-buffer (car loc)
>             (save-excursion
>                 (goto-char (cdr loc))
>                 (org-link-display-format
>                 (org-get-heading t t t t))))))))
>


--
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com

Reply via email to