emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Completion mechanism for headlines when creating a link between 2 Org files?
@ 2023-09-04  7:31 Alain.Cochard
  2023-09-04  8:14 ` Ihor Radchenko
  2023-09-05 21:35 ` David Masterson
  0 siblings, 2 replies; 3+ messages in thread
From: Alain.Cochard @ 2023-09-04  7:31 UTC (permalink / raw)
  To: emacs-orgmode


Hello.  For internal links, the manual states that

   To insert a link targeting a headline, in-buffer completion can be
   used.  Just type a star followed by a few optional letters into the
   buffer and press ‘M-<TAB>’.  All headlines in the current buffer
   are offered as completions."

Is there a similar mechanism for links from one Org file to a headline
of another Org file?  In the 'Handling Links' section of the manual:

   C-c C-l (org-insert-link)

       [...]

       Completion support

	   Completion with TAB helps you to insert valid link prefixes
	   like ‘http’ or ‘ftp’, including the prefixes defined
	   through link abbreviations (see Link Abbreviations). If you
	   press RET after inserting only the prefix, Org offers
	   specific completion support for some link types.

but, after I complete for a given file, I cannot find a way to further
complete for a specific (sub)headline.  Is there a way that I missed,
even after searching the Internet a bit?

If not, I am making it a feature request.  Indeed it would be great,
especially if one does not really remember where, in a (known) file,
the headline is, nor --even more importantly-- what its name exactly
is.

(In my naive view, as the completion mechanism already exists for
internal files, it should be easy to extend it for external files...)

Regards


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion mechanism for headlines when creating a link between 2 Org files?
  2023-09-04  7:31 Completion mechanism for headlines when creating a link between 2 Org files? Alain.Cochard
@ 2023-09-04  8:14 ` Ihor Radchenko
  2023-09-05 21:35 ` David Masterson
  1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2023-09-04  8:14 UTC (permalink / raw)
  To: alain.cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

>    C-c C-l (org-insert-link)
>
>        [...]
>
>        Completion support
>
> 	   Completion with TAB helps you to insert valid link prefixes
> 	   like ‘http’ or ‘ftp’, including the prefixes defined
> 	   through link abbreviations (see Link Abbreviations). If you
> 	   press RET after inserting only the prefix, Org offers
> 	   specific completion support for some link types.
>
> but, after I complete for a given file, I cannot find a way to further
> complete for a specific (sub)headline.  Is there a way that I missed,
> even after searching the Internet a bit?

You would need to extend the default file: link completion function -
`org-link-complete-file'.

You can override it with any custom function:

(org-link-set-parameters "file" :complete #'your-custom-completion-function)

> If not, I am making it a feature request.  Indeed it would be great,
> especially if one does not really remember where, in a (known) file,
> the headline is, nor --even more importantly-- what its name exactly
> is.
>
> (In my naive view, as the completion mechanism already exists for
> internal files, it should be easy to extend it for external files...)

It is, although even more common request is simply inserting a link to a
heading in _a_ file (not known).

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion mechanism for headlines when creating a link between 2 Org files?
  2023-09-04  7:31 Completion mechanism for headlines when creating a link between 2 Org files? Alain.Cochard
  2023-09-04  8:14 ` Ihor Radchenko
@ 2023-09-05 21:35 ` David Masterson
  1 sibling, 0 replies; 3+ messages in thread
From: David Masterson @ 2023-09-05 21:35 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

> (In my naive view, as the completion mechanism already exists for
> internal files, it should be easy to extend it for external files...)

I believe the auto-complete package will do that.

-- 
David Masterson


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-05 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-04  7:31 Completion mechanism for headlines when creating a link between 2 Org files? Alain.Cochard
2023-09-04  8:14 ` Ihor Radchenko
2023-09-05 21:35 ` David Masterson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).