emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Links to external targets with (or despite) org-ref
@ 2023-02-19 15:38 Sven Bretfeld
  2023-02-20 18:07 ` John Kitchin
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Bretfeld @ 2023-02-19 15:38 UTC (permalink / raw)
  To: Emacs Orgmode

Hi everybody

I'm looking to create labels/links to specific text positions in org
files (not line number, not header).

I know that [[file:~/path_to_file::target]] can be used to jump to
<<target>>. That would be fine and works for me -- IF I write the link
manually.

However, org-ref which I use for citations seems to overwrite the
default behaviour of org-store-link and org-insert-link. So when the
point is on <<target>> and org-store-link is called (C-c l), I get a
prompt "Store link with (default org-ref-store-ref)". No alternatives
are offered when TAB is hit. Hiting RET saves the link as
"Crefrange:target". A corresponding org-insert-link (C-c C-l) produces
a link of the form [[Crefrange:target]] which, when in another file,
of course leads nowhere ("search failed"). How to get the file name
into these links without manually rewriting the link?

I couldn't find anything on this issue in the org-ref manual or on the
internet.

Thanks for help,

Sven


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

* Re: Links to external targets with (or despite) org-ref
  2023-02-19 15:38 Links to external targets with (or despite) org-ref Sven Bretfeld
@ 2023-02-20 18:07 ` John Kitchin
  2023-02-22 10:20   ` Sven Bretfeld
  0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2023-02-20 18:07 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: Emacs Orgmode

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

The quickest thing might be to remove the store properties on the ref
links. This should do it.

#+BEGIN_SRC emacs-lisp
(cl-loop for reflink in '("ref" "pageref" "nameref" "eqref" "autoref"
"cref" "Cref" "crefrange" "Crefrange")
do
(setf (cdr (assoc reflink org-link-parameters))
      (org-plist-delete (cdr (assoc reflink org-link-parameters)) :store)))
#+END_SRC

I guess I don't have that setup quite right in org-ref, it seems like it
should not clobber other ways to store links.

On Sun, Feb 19, 2023 at 10:39 AM Sven Bretfeld <sven.bretfeld@ntnu.no>
wrote:

> Hi everybody
>
> I'm looking to create labels/links to specific text positions in org
> files (not line number, not header).
>
> I know that [[file:~/path_to_file::target]] can be used to jump to
> <<target>>. That would be fine and works for me -- IF I write the link
> manually.
>
> However, org-ref which I use for citations seems to overwrite the
> default behaviour of org-store-link and org-insert-link. So when the
> point is on <<target>> and org-store-link is called (C-c l), I get a
> prompt "Store link with (default org-ref-store-ref)". No alternatives
> are offered when TAB is hit. Hiting RET saves the link as
> "Crefrange:target". A corresponding org-insert-link (C-c C-l) produces
> a link of the form [[Crefrange:target]] which, when in another file,
> of course leads nowhere ("search failed"). How to get the file name
> into these links without manually rewriting the link?
>
> I couldn't find anything on this issue in the org-ref manual or on the
> internet.
>
> Thanks for help,
>
> Sven
>
>

[-- Attachment #2: Type: text/html, Size: 2184 bytes --]

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

* Re: Links to external targets with (or despite) org-ref
  2023-02-20 18:07 ` John Kitchin
@ 2023-02-22 10:20   ` Sven Bretfeld
  2023-02-24 13:24     ` John Kitchin
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Bretfeld @ 2023-02-22 10:20 UTC (permalink / raw)
  To: John Kitchin; +Cc: Emacs Orgmode

Hi John

That's working well. Thank you very much. And thousand thanks for
org-ref in general.

Sven

Am Mon, Feb 20, 2023 at 01:07:49PM -0500 schrieb John Kitchin:
> The quickest thing might be to remove the store properties on the ref links.
> This should do it.
> 
> #+BEGIN_SRC emacs-lisp
> (cl-loop for reflink in '("ref" "pageref" "nameref" "eqref" "autoref" "cref"
> "Cref" "crefrange" "Crefrange")
> do
> (setf (cdr (assoc reflink org-link-parameters))
>       (org-plist-delete (cdr (assoc reflink org-link-parameters)) :store)))
> #+END_SRC
> 
> I guess I don't have that setup quite right in org-ref, it seems like it should
> not clobber other ways to store links.
> 
> On Sun, Feb 19, 2023 at 10:39 AM Sven Bretfeld <[1]sven.bretfeld@ntnu.no>
> wrote:
> 
>     Hi everybody
> 
>     I'm looking to create labels/links to specific text positions in org
>     files (not line number, not header).
> 
>     I know that [[file:~/path_to_file::target]] can be used to jump to
>     <<target>>. That would be fine and works for me -- IF I write the link
>     manually.
> 
>     However, org-ref which I use for citations seems to overwrite the
>     default behaviour of org-store-link and org-insert-link. So when the
>     point is on <<target>> and org-store-link is called (C-c l), I get a
>     prompt "Store link with (default org-ref-store-ref)". No alternatives
>     are offered when TAB is hit. Hiting RET saves the link as
>     "Crefrange:target". A corresponding org-insert-link (C-c C-l) produces
>     a link of the form [[Crefrange:target]] which, when in another file,
>     of course leads nowhere ("search failed"). How to get the file name
>     into these links without manually rewriting the link?
> 
>     I couldn't find anything on this issue in the org-ref manual or on the
>     internet.
> 
>     Thanks for help,
> 
>     Sven
> 
> 
> 
> References:
> 
> [1] mailto:sven.bretfeld@ntnu.no


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

* Re: Links to external targets with (or despite) org-ref
  2023-02-22 10:20   ` Sven Bretfeld
@ 2023-02-24 13:24     ` John Kitchin
  2023-03-03 16:43       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2023-02-24 13:24 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: Emacs Orgmode

[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]

You are welcome.

I also discovered just now that you can do C-u C-u C-c C-l to skip storing
functions that are not part of org-core.

If anyone knows how to use store functions that do not clobber the build in
ones, I would be happy to update org-ref so you can use all the link store
options.

On Wed, Feb 22, 2023 at 5:20 AM Sven Bretfeld <sven.bretfeld@ntnu.no> wrote:

> Hi John
>
> That's working well. Thank you very much. And thousand thanks for
> org-ref in general.
>
> Sven
>
> Am Mon, Feb 20, 2023 at 01:07:49PM -0500 schrieb John Kitchin:
> > The quickest thing might be to remove the store properties on the ref
> links.
> > This should do it.
> >
> > #+BEGIN_SRC emacs-lisp
> > (cl-loop for reflink in '("ref" "pageref" "nameref" "eqref" "autoref"
> "cref"
> > "Cref" "crefrange" "Crefrange")
> > do
> > (setf (cdr (assoc reflink org-link-parameters))
> >       (org-plist-delete (cdr (assoc reflink org-link-parameters))
> :store)))
> > #+END_SRC
> >
> > I guess I don't have that setup quite right in org-ref, it seems like it
> should
> > not clobber other ways to store links.
> >
> > On Sun, Feb 19, 2023 at 10:39 AM Sven Bretfeld <[1]sven.bretfeld@ntnu.no
> >
> > wrote:
> >
> >     Hi everybody
> >
> >     I'm looking to create labels/links to specific text positions in org
> >     files (not line number, not header).
> >
> >     I know that [[file:~/path_to_file::target]] can be used to jump to
> >     <<target>>. That would be fine and works for me -- IF I write the
> link
> >     manually.
> >
> >     However, org-ref which I use for citations seems to overwrite the
> >     default behaviour of org-store-link and org-insert-link. So when the
> >     point is on <<target>> and org-store-link is called (C-c l), I get a
> >     prompt "Store link with (default org-ref-store-ref)". No alternatives
> >     are offered when TAB is hit. Hiting RET saves the link as
> >     "Crefrange:target". A corresponding org-insert-link (C-c C-l)
> produces
> >     a link of the form [[Crefrange:target]] which, when in another file,
> >     of course leads nowhere ("search failed"). How to get the file name
> >     into these links without manually rewriting the link?
> >
> >     I couldn't find anything on this issue in the org-ref manual or on
> the
> >     internet.
> >
> >     Thanks for help,
> >
> >     Sven
> >
> >
> >
> > References:
> >
> > [1] mailto:sven.bretfeld@ntnu.no
>

[-- Attachment #2: Type: text/html, Size: 3403 bytes --]

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

* Re: Links to external targets with (or despite) org-ref
  2023-02-24 13:24     ` John Kitchin
@ 2023-03-03 16:43       ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-03-03 16:43 UTC (permalink / raw)
  To: John Kitchin; +Cc: Sven Bretfeld, Emacs Orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> If anyone knows how to use store functions that do not clobber the build in
> ones, I would be happy to update org-ref so you can use all the link store
> options.

This part of Org code has inconsistencies between the docstrings and the
implementation. https://orgmode.org/list/87tu4tppb6.fsf@localhost

I am currently unsure what will be the best way to approach this
problem. Ideally, someone with more experience creating and using custom
links could jump in and propose some solid API we should follow for Org.

-- 
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] 5+ messages in thread

end of thread, other threads:[~2023-03-03 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-19 15:38 Links to external targets with (or despite) org-ref Sven Bretfeld
2023-02-20 18:07 ` John Kitchin
2023-02-22 10:20   ` Sven Bretfeld
2023-02-24 13:24     ` John Kitchin
2023-03-03 16:43       ` Ihor Radchenko

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).