all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* insert automatically a reference to a section header and a link
@ 2021-11-17  7:36 Uwe Brauer
  2021-11-17  8:28 ` Uwe Brauer
                   ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17  7:36 UTC (permalink / raw)
  To: emacs-orgmode


Hi

In auctex+reftex it is possible that when I insert a new section header
a reference label is inserted automatically:


1. Example
   \subsection{Inverse problem}
   \label{sec:one}

2. And then using  reftex-reference 
   I can insert \ref{sec:one}      


So the equivalent of 1. in org mode would be to automatically insert

** Inverse problem
   :PROPERTIES:
   :CUSTOM_ID: sec:one
   :END:

Can this be done?

And then what would be the equivalent to 2? It is not org-insert-link,
as far as I can see.

Thanks and regards

Uwe Brauer 



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

* Re: insert automatically a reference to a section header and a link
  2021-11-17  7:36 insert automatically a reference to a section header and a link Uwe Brauer
@ 2021-11-17  8:28 ` Uwe Brauer
  2021-11-17 10:04 ` Eric S Fraga
  2021-11-17 16:49 ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link) Uwe Brauer
  2 siblings, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17  8:28 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:

> Hi

> In auctex+reftex it is possible that when I insert a new section header
> a reference label is inserted automatically:


> 1. Example
>    \subsection{Inverse problem}
>    \label{sec:one}

> 2. And then using  reftex-reference 
>    I can insert \ref{sec:one}      


> So the equivalent of 1. in org mode would be to automatically insert

> ** Inverse problem
>    :PROPERTIES:
>    :CUSTOM_ID: sec:one
>    :END:

> Can this be done?

> And then what would be the equivalent to 2? It is not org-insert-link,
> as far as I can see.

To answer at least one of my questions:

org-ref-helm-insert-ref-link 
is the equivalent to reftex-reference.

But I cannot see how to configure org, so that it automatically insert a
section header link.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17  7:36 insert automatically a reference to a section header and a link Uwe Brauer
  2021-11-17  8:28 ` Uwe Brauer
@ 2021-11-17 10:04 ` Eric S Fraga
  2021-11-17 13:58   ` Uwe Brauer
  2021-11-17 16:49 ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link) Uwe Brauer
  2 siblings, 1 reply; 32+ messages in thread
From: Eric S Fraga @ 2021-11-17 10:04 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday, 17 Nov 2021 at 08:36, Uwe Brauer wrote:
> In auctex+reftex it is possible that when I insert a new section header
> a reference label is inserted automatically:

I do the following usually:

--8<---------------cut here---------------start------------->8---
* <<introduction>> Introduction

In section [[introduction]], I show something.
--8<---------------cut here---------------end--------------->8---

I prefer visible labels instead of custom IDs although the latter works
as well but you need to say [[id:introduction]].

HTH,
eric

-- 
: Eric S Fraga, with org release_9.5-230-g2bbac4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 10:04 ` Eric S Fraga
@ 2021-11-17 13:58   ` Uwe Brauer
  2021-11-17 14:06     ` John Kitchin
  2021-11-17 14:58     ` Eric S Fraga
  0 siblings, 2 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 13:58 UTC (permalink / raw)
  To: emacs-orgmode


>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Wednesday, 17 Nov 2021 at 08:36, Uwe Brauer wrote:
>> In auctex+reftex it is possible that when I insert a new section header
>> a reference label is inserted automatically:

> I do the following usually:

> * <<introduction>> Introduction

Right, but how do you do this automatically?

Maybe I did not explain this clearly enough: in auctex+reftex, when I
fire up the command LaTeX-section, I am

    1. Asked for the title

    2. And then the title *and* a label is inserted automatically. (I
       can configure what is inserted to a certain extend). Usually I
       obtain \section{Alternativa de Fredholm}
       \label{sec:altern-de-fredh}


I am looking for a similar functionality in org mode

> In section [[introduction]], I show something.

> I prefer visible labels instead of custom IDs although the latter works
> as well but you need to say [[id:introduction]].

> HTH,
> eric



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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 13:58   ` Uwe Brauer
@ 2021-11-17 14:06     ` John Kitchin
  2021-11-17 14:15       ` Uwe Brauer
  2021-11-17 14:58     ` Eric S Fraga
  1 sibling, 1 reply; 32+ messages in thread
From: John Kitchin @ 2021-11-17 14:06 UTC (permalink / raw)
  To: org-mode-email

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

there is nothing like that that I know of. You can write your own, in org
(following Eric's use of radio targets) it might look like this.

(defun my-heading ()
  (interactive)
  (let* ((title (string-trim (read-string "title: ")))
(tokens (split-string title " " t))
(label (format "<<sec:%s>>"
(string-join
(seq-take tokens (min 3 (length tokens)))
"-"))))
    (insert (format "%s %s" label title))))

you could also insert the leading * if you prefer.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Nov 17, 2021 at 8:59 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>
> >>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
> > On Wednesday, 17 Nov 2021 at 08:36, Uwe Brauer wrote:
> >> In auctex+reftex it is possible that when I insert a new section header
> >> a reference label is inserted automatically:
>
> > I do the following usually:
>
> > * <<introduction>> Introduction
>
> Right, but how do you do this automatically?
>
> Maybe I did not explain this clearly enough: in auctex+reftex, when I
> fire up the command LaTeX-section, I am
>
>     1. Asked for the title
>
>     2. And then the title *and* a label is inserted automatically. (I
>        can configure what is inserted to a certain extend). Usually I
>        obtain \section{Alternativa de Fredholm}
>        \label{sec:altern-de-fredh}
>
>
> I am looking for a similar functionality in org mode
>
> > In section [[introduction]], I show something.
>
> > I prefer visible labels instead of custom IDs although the latter works
> > as well but you need to say [[id:introduction]].
>
> > HTH,
> > eric
>
>
>

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

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 14:06     ` John Kitchin
@ 2021-11-17 14:15       ` Uwe Brauer
  2021-11-17 14:59         ` Stefan Nobis
  0 siblings, 1 reply; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 14:15 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> there is nothing like that that I know of. You can write your own, in org
> (following Eric's use of radio targets) it might look like this.

> (defun my-heading ()
>   (interactive)
>   (let* ((title (string-trim (read-string "title: ")))
> (tokens (split-string title " " t))
> (label (format "<<sec:%s>>"
> (string-join
> (seq-take tokens (min 3 (length tokens)))
> "-"))))
>     (insert (format "%s %s" label title))))

> you could also insert the leading * if you prefer.

Aha! Brilliant thanks!
I will use
(format "%s %s" title label)
and think about inserting *.

I wonder why this was not implemented or asked for.

I googled but did not find anything.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 13:58   ` Uwe Brauer
  2021-11-17 14:06     ` John Kitchin
@ 2021-11-17 14:58     ` Eric S Fraga
  2021-11-17 16:00       ` Uwe Brauer
  1 sibling, 1 reply; 32+ messages in thread
From: Eric S Fraga @ 2021-11-17 14:58 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday, 17 Nov 2021 at 14:58, Uwe Brauer wrote:
> Right, but how do you do this automatically?

John's given you an answer along the lines of what you wanted but I
would suggest that sometimes we over-complicate things?

LaTeX needs help because it's a lot more verbose.  Org, however, has a
very simple markup ("It's all text" ;-)) and just typing what you want
is often quicker!  Instead of key bindings to remember, I know I can
simply type

RET * <<label>> heading RET

and I'm done...

Likewise, typing the reference is simply typing [[label]].

And both bits above benefit from electric-pair-mode...

But I'm glad you found your solution in any case!

-- 
: Eric S Fraga, with org release_9.5-230-g2bbac4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 14:15       ` Uwe Brauer
@ 2021-11-17 14:59         ` Stefan Nobis
  2021-11-17 15:42           ` Juan Manuel Macías
  2021-11-17 15:55           ` Uwe Brauer
  0 siblings, 2 replies; 32+ messages in thread
From: Stefan Nobis @ 2021-11-17 14:59 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> I wonder why this was not implemented or asked for.

Hmmm... for me, the default way to link to headings is just fine, I
seldom need more control over the generated labels:

#+begin_src org
  ,* Intro

  Lorem ipsum dolor sit amet...

  ,* Another section

  As seen in [[*Intro]] there is not much to say.
#+end_src


-- 
Until the next mail...,
Stefan.


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 14:59         ` Stefan Nobis
@ 2021-11-17 15:42           ` Juan Manuel Macías
  2021-11-17 16:08             ` Uwe Brauer
  2021-11-17 15:55           ` Uwe Brauer
  1 sibling, 1 reply; 32+ messages in thread
From: Juan Manuel Macías @ 2021-11-17 15:42 UTC (permalink / raw)
  To: Stefan Nobis; +Cc: Uwe Brauer, orgmode

Stefan Nobis writes:

> Hmmm... for me, the default way to link to headings is just fine, I
> seldom need more control over the generated labels:
>
> #+begin_src org
>   ,* Intro
>
>   Lorem ipsum dolor sit amet...
>
>   ,* Another section
>
>   As seen in [[*Intro]] there is not much to say.
> #+end_src

Completely agree. I also tend to use `org-super-link'
(https://github.com/toshism/org-super-links). It can be run with
helm-org-ql, so if there are a lot of headings in the document, I just
have to navigate through them using helm-org-ql, and insert a link at
point to the chosen candidate. And in the destination header a back link
is also inserted.

Best regards,

Juan Manuel 


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 14:59         ` Stefan Nobis
  2021-11-17 15:42           ` Juan Manuel Macías
@ 2021-11-17 15:55           ` Uwe Brauer
  2021-11-17 16:08             ` Eric S Fraga
  2021-11-17 16:29             ` Stefan Nobis
  1 sibling, 2 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 15:55 UTC (permalink / raw)
  To: emacs-orgmode

>>> "SN" == Stefan Nobis <stefan-ml@snobis.de> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> I wonder why this was not implemented or asked for.

> Hmmm... for me, the default way to link to headings is just fine, I
> seldom need more control over the generated labels:

> #+begin_src org
>   ,* Intro

>   Lorem ipsum dolor sit amet...

>   ,* Another section

>   As seen in [[*Intro]] there is not much to say.
> #+end_src

I am not following you. You insert a header as in 

* Intro


Now you want to refer to it with a link

As we have seen in section ...

So what precisely are you typing?

All I can say is this to motivate this feature: 


I am a long time user of auctex+reftex, and the functionality to have
labels added (in a systematic way) automatically is a *great* time
saver if you want to add clickable references (links)

So I am curious to see how you do that.



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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 14:58     ` Eric S Fraga
@ 2021-11-17 16:00       ` Uwe Brauer
  2021-11-17 16:31         ` Eric S Fraga
  0 siblings, 1 reply; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 16:00 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Wednesday, 17 Nov 2021 at 14:58, Uwe Brauer wrote:
>> Right, but how do you do this automatically?

> John's given you an answer along the lines of what you wanted but I
> would suggest that sometimes we over-complicate things?

Hm not sure

> LaTeX needs help because it's a lot more verbose.  Org, however, has a
> very simple markup ("It's all text" ;-)) and just typing what you want
> is often quicker!  Instead of key bindings to remember, I know I can
> simply type

> RET * <<label>> heading RET

> and I'm done...

Well you should try auctex+reftex, it is just easier and (faster) if all
this is done automatically.

In auctex, you can also do this as you describe and I found that
terrible and was very relived to find out about reftex, that insert
labels automatically (and systematically)

> Likewise, typing the reference is simply typing [[label]].

> And both bits above benefit from electric-pair-mode...

> But I'm glad you found your solution in any case!

There is just a small problem with this approach.

When exported to latex 



** Hello 
   :PROPERTIES:
   :CUSTOM_ID: sec:wo
   :END:

Is exported as 


\subsection{Hello}
\label{sec:wo}


While

** That <<sec:That>>  

Is exported as 

\subsection{That \label{sec:That}}
\label{sec:org213d0b6}


The first one is much nicer and more in line with the logic of latex,
the second however is not bad (since it generates correct pdf files when
compiled)

I might think how to generalize John's approach.

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 15:42           ` Juan Manuel Macías
@ 2021-11-17 16:08             ` Uwe Brauer
  0 siblings, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 16:08 UTC (permalink / raw)
  To: emacs-orgmode

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


> Stefan Nobis writes:

> Completely agree. I also tend to use `org-super-link'
> (https://github.com/toshism/org-super-links). 

Interesting. This package is not in MELPA, but I will download and test
it.


> It can be run with helm-org-ql, so if there are a lot of headings in
> the document, I just have to navigate through them using helm-org-ql,
> and insert a link at point to the chosen candidate. And in the
> destination header a back link is also inserted.



> Best regards,

> Juan Manuel 



[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 15:55           ` Uwe Brauer
@ 2021-11-17 16:08             ` Eric S Fraga
  2021-11-17 16:44               ` Uwe Brauer
  2021-11-17 16:29             ` Stefan Nobis
  1 sibling, 1 reply; 32+ messages in thread
From: Eric S Fraga @ 2021-11-17 16:08 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday, 17 Nov 2021 at 16:55, Uwe Brauer wrote:
>>>> "SN" == Stefan Nobis <stefan-ml@snobis.de> writes:
>>   As seen in [[*Intro]] there is not much to say.
>
> I am not following you. You insert a header as in
>
> * Intro
>
>
> Now you want to refer to it with a link

The point is that the link uses the heading text itself (see the *in the
link) to automatically find the heading.  No need to put an explicit
label on the heading.

-- 
: Eric S Fraga, with org release_9.5-230-g2bbac4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 15:55           ` Uwe Brauer
  2021-11-17 16:08             ` Eric S Fraga
@ 2021-11-17 16:29             ` Stefan Nobis
  2021-11-17 17:05               ` Uwe Brauer
  2021-11-17 18:17               ` Juan Manuel Macías
  1 sibling, 2 replies; 32+ messages in thread
From: Stefan Nobis @ 2021-11-17 16:29 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> I am not following you. You insert a header as in 

> * Intro

> Now you want to refer to it with a link

> As we have seen in section ...

> So what precisely are you typing?

I type "As we have seen in section [[*Intro]]" (literally, I tend to
not use any keybindings or function to insert the link). This (the
"*Intro" inside double square brackets) is called an internal link to
headlines and they are a default feature of Org:

    https://orgmode.org/manual/Internal-Links.html#Internal-Links

BTW: I mostly export to PDF via LaTeX and usually use the combination
of cleveref with varioref. Therefore I prefer to type "As we have seen
in [[*Intro]]" (leaving out "section") and let Org generate a
"\vref{...}" reference. To achive this, I need little bit of extra
setup (and do not forget to add the necessary usepackage commands
either locally in the Org file or add it to
org-latex-default-packages-alist):

#+begin_src emacs-lisp
  (defun sn/ox-latex-filter-special-ref-vref (text backend info)
    (when (org-export-derived-backend-p backend 'latex)
      (replace-regexp-in-string "\\\\ref{" "\\\\vref{" text)))
  
  (add-to-list 'org-export-filter-link-functions #'sn/ox-latex-filter-special-ref-vref)
#+end_src

If you need internal links to headings more often and do not want to
type the whole heading text manually, you can use functions like this
(inspired by `worf-goto' and `counsel-outline'; if you do not use
ivy/swiper/counsel, the code should at least give the basic idea):

#+begin_src emacs-lisp
(defun sn/org-insert-internal-link ()
  "Use ivy to insert a link to a heading in the current `org-mode' document."
  (interactive)
  (let ((settings (cdr (assq major-mode counsel-outline-settings))))
    (ivy-read "Heading: " (counsel-outline-candidates settings)
              :action 'sn/org-insert-internal-link-action)))

(defun sn/org-insert-internal-link-action (x)
  "Insert link for `sn/worf-insert-internal-link'"
  (save-excursion
    (goto-char (cdr x))
    (call-interactively 'org-store-link))
  (org-insert-last-stored-link 1)
  (delete-char -1))
#+end_src

-- 
Until the next mail...,
Stefan.


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 16:00       ` Uwe Brauer
@ 2021-11-17 16:31         ` Eric S Fraga
  2021-11-17 17:06           ` Uwe Brauer
  0 siblings, 1 reply; 32+ messages in thread
From: Eric S Fraga @ 2021-11-17 16:31 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday, 17 Nov 2021 at 17:00, Uwe Brauer wrote:
> While
>
> ** That <<sec:That>>  

Well, you could write

--8<---------------cut here---------------start------------->8---
** That
<<sec:That>>
--8<---------------cut here---------------end--------------->8---

to get what you like in terms of LaTeX export.

I tend to put the label on the headline so that I can see it when I am
in outline view.  Personal taste.

-- 
: Eric S Fraga, with org release_9.5-230-g2bbac4 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 16:08             ` Eric S Fraga
@ 2021-11-17 16:44               ` Uwe Brauer
  0 siblings, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 16:44 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Wednesday, 17 Nov 2021 at 16:55, Uwe Brauer wrote:
>>>>> "SN" == Stefan Nobis <stefan-ml@snobis.de> writes:
>>> As seen in [[*Intro]] there is not much to say.
>> 
>> I am not following you. You insert a header as in
>> 
>> * Intro
>> 
>> 
>> Now you want to refer to it with a link

> The point is that the link uses the heading text itself (see the *in the
> link) to automatically find the heading.  No need to put an explicit
> label on the heading.

I am sorry, I still don't get this.
What I want is to insert, as convenient as possible a link to a
headings.
I usually use org-ref-helm-insert-ref-link for this. This function
however needs a label of sorts.

So how is your workflow?

Suppose you have 20 headers and subheaders. How to you generate a link
to subheader 6 of header 3 without a link?


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link)
  2021-11-17  7:36 insert automatically a reference to a section header and a link Uwe Brauer
  2021-11-17  8:28 ` Uwe Brauer
  2021-11-17 10:04 ` Eric S Fraga
@ 2021-11-17 16:49 ` Uwe Brauer
  2021-11-17 17:57   ` John Kitchin
  2 siblings, 1 reply; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 16:49 UTC (permalink / raw)
  To: emacs-orgmode


Please look at this example

* new 
   :PROPERTIES:
   :ID:       43b3de77-4074-47f2-9a4a-9cddebb33951
   :END:

** Inverse problem
   :PROPERTIES:
   :CUSTOM_ID: sec:one
   :END:


** new title 
   :PROPERTIES:
   :ID:       f3c76e50-5be9-47f2-bad4-257166670481
   :END:

Two ids were generated by org-id-get-create. I thought that could be
another solution to my problem.

However, strangely enough org-ref-helm-insert-ref-link
does not find these two IDs it only finds CUSTOM_ID.

@John: you are the author of that package, why doesn't the function find
the ID?

Regards

Uwe 







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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 16:29             ` Stefan Nobis
@ 2021-11-17 17:05               ` Uwe Brauer
  2021-11-17 19:10                 ` Stefan Nobis
  2021-11-23 15:20                 ` Bruce D'Arcus
  2021-11-17 18:17               ` Juan Manuel Macías
  1 sibling, 2 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 17:05 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "SN" == Stefan Nobis <stefan-ml@snobis.de> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> I am not following you. You insert a header as in 

>> * Intro

>> Now you want to refer to it with a link

>> As we have seen in section ...

>> So what precisely are you typing?

> I type "As we have seen in section [[*Intro]]" (literally, I tend to
> not use any keybindings or function to insert the link). This (the
> "*Intro" inside double square brackets) is called an internal link to
> headlines and they are a default feature of Org:

Yes, but, what do you do, if you have a 10 header and each has 20
subheaders. How do you remember all these names?
Besides your approach is not automatic.

>     https://orgmode.org/manual/Internal-Links.html#Internal-Links


> If you need internal links to headings more often and do not want to
> type the whole heading text manually, you can use functions like this
> (inspired by `worf-goto' and `counsel-outline'; if you do not use
> ivy/swiper/counsel, the code should at least give the basic idea):

> #+begin_src emacs-lisp
> (defun sn/org-insert-internal-link ()
>   "Use ivy to insert a link to a heading in the current `org-mode' document."
>   (interactive)
>   (let ((settings (cdr (assq major-mode counsel-outline-settings))))
>     (ivy-read "Heading: " (counsel-outline-candidates settings)
>               :action 'sn/org-insert-internal-link-action)))

> (defun sn/org-insert-internal-link-action (x)
>   "Insert link for `sn/worf-insert-internal-link'"
>   (save-excursion
>     (goto-char (cdr x))
>     (call-interactively 'org-store-link))
>   (org-insert-last-stored-link 1)
>   (delete-char -1))
> #+end_src

Thanks but this did not work! 


I copied,  In a separate file:
#+begin_src 
(require 'counsel)
(require 'worf)

(defun sn/org-insert-internal-link ()
  "Use ivy to insert a link to a heading in the current `org-mode' document."
  (interactive)
  (let ((settings (cdr (assq major-mode counsel-outline-settings))))
    (ivy-read "Heading: " (counsel-outline-candidates settings)
              :action 'sn/org-insert-internal-link-action)))

(defun sn/org-insert-internal-link-action (x)
  "Insert link for `sn/worf-insert-internal-link'"
  (save-excursion
    (goto-char (cdr x))
    (call-interactively 'org-store-link))
  (org-insert-last-stored-link 1)
  (delete-char -1))
#+end_src

When I loaded the file I obtained:

ivy-configure: Keyword argument :init-fn not one of (:initial-input :height :occur :update-fn :unwind-fn :index-fn :sort-fn :format-fn :display-transformer-fn :more-chars :grep-p :exit-codes)

When I tried to install worf, I obtained 
#+begin_src 
Compiling file /home/oub/.emacs.d/elpa/worf-20211014.1207/elpa.el at Wed Nov 17 17:59:27 2021
Entering directory ‘/home/oub/.emacs.d/elpa/worf-20211014.1207/’

Compiling file /home/oub/.emacs.d/elpa/worf-20211014.1207/worf.el at Wed Nov 17 17:59:27 2021
worf.el:143:1: Error: Keyword argument :init-fn not one of (:initial-input :height :occur :update-fn :unwind-fn :index-fn :sort-fn :format-fn :display-transformer-fn :more-chars :grep-p :exit-codes)
#+end_src

When I called your first function I obtained
#+begin_src 
Debugger entered--Lisp error: (void-variable counsel-outline-settings)
  (assq major-mode counsel-outline-settings)
  (cdr (assq major-mode counsel-outline-settings))
  (let ((settings (cdr (assq major-mode counsel-outline-settings))))
  (ivy-read "Heading: " (counsel-outline-candidates settings) :action
  'sn/org-insert-internal-link-action))  
  sn/org-insert-internal-link() 
  funcall-interactively(sn/org-insert-internal-link)
  call-interactively(sn/org-insert-internal-link record nil)
  command-execute(sn/org-insert-internal-link record)
  execute-extended-command(nil "sn/org-insert-internal-link" "sn/or")
  funcall-interactively(execute-extended-command nil "sn/org-insert-internal-link" "sn/or")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

#+end_src

So something is not right here!

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 16:31         ` Eric S Fraga
@ 2021-11-17 17:06           ` Uwe Brauer
  0 siblings, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 17:06 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Wednesday, 17 Nov 2021 at 17:00, Uwe Brauer wrote:
>> While
>> 
>> ** That <<sec:That>>  

> Well, you could write

> ** That
> <<sec:That>>
Right, good idea

> to get what you like in terms of LaTeX export.

> I tend to put the label on the headline so that I can see it when I am
> in outline view.  Personal taste.

That is also true. In any case, thanks!

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link)
  2021-11-17 16:49 ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link) Uwe Brauer
@ 2021-11-17 17:57   ` John Kitchin
  2021-11-17 18:58     ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] Uwe Brauer
  0 siblings, 1 reply; 32+ messages in thread
From: John Kitchin @ 2021-11-17 17:57 UTC (permalink / raw)
  To: org-mode-email

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

in the most current version (3) of org-ref, the labels that are found are
defined in org-ref-ref-label-regexps. At the moment there isn't a pattern
for ID. No particular reason, I haven't used ID like that for many years. I
added and pushed that to the current repo just now.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Nov 17, 2021 at 11:55 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>
> Please look at this example
>
> * new
>    :PROPERTIES:
>    :ID:       43b3de77-4074-47f2-9a4a-9cddebb33951
>    :END:
>
> ** Inverse problem
>    :PROPERTIES:
>    :CUSTOM_ID: sec:one
>    :END:
>
>
> ** new title
>    :PROPERTIES:
>    :ID:       f3c76e50-5be9-47f2-bad4-257166670481
>    :END:
>
> Two ids were generated by org-id-get-create. I thought that could be
> another solution to my problem.
>
> However, strangely enough org-ref-helm-insert-ref-link
> does not find these two IDs it only finds CUSTOM_ID.
>
> @John: you are the author of that package, why doesn't the function find
> the ID?
>
> Regards
>
> Uwe
>
>
>
>
>
>
>

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

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 16:29             ` Stefan Nobis
  2021-11-17 17:05               ` Uwe Brauer
@ 2021-11-17 18:17               ` Juan Manuel Macías
  2021-11-17 19:00                 ` Stefan Nobis
  1 sibling, 1 reply; 32+ messages in thread
From: Juan Manuel Macías @ 2021-11-17 18:17 UTC (permalink / raw)
  To: Stefan Nobis; +Cc: orgmode

Stefan Nobis writes:

> #+begin_src emacs-lisp
>   (defun sn/ox-latex-filter-special-ref-vref (text backend info)
>     (when (org-export-derived-backend-p backend 'latex)
>       (replace-regexp-in-string "\\\\ref{" "\\\\vref{" text)))
>   
>   (add-to-list 'org-export-filter-link-functions #'sn/ox-latex-filter-special-ref-vref)
> #+end_src

In Org 9.5 there is a new variable `org-latex-reference-command'. You
can do something like:

(setq org-latex-reference-command "\\vref{%s}")

Best regards,

Juan Manuel 


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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 17:57   ` John Kitchin
@ 2021-11-17 18:58     ` Uwe Brauer
  2021-11-17 19:58       ` John Kitchin
  0 siblings, 1 reply; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 18:58 UTC (permalink / raw)
  To: emacs-orgmode

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


> in the most current version (3) of org-ref, the labels that are found are
> defined in org-ref-ref-label-regexps. At the moment there isn't a pattern
> for ID. No particular reason, I haven't used ID like that for many years. I
> added and pushed that to the current repo just now.

Thanks, that is in MELPA already?

BTW, I downloaded the latest MELPA org-ref pkg and obtained the
following error (running emacs 29, master a couple of days ago)
,----
| 
| Debugger entered--Lisp error: (wrong-type-argument listp "gls")
|   cl-first("gls")
|   (org-link-set-parameters (cl-first command) :follow
|   #'or-follow-glossary :face 'org-ref-glossary-face-fn :help-echo
|   'or-glossary-tooltip  :export #'(lambda (path _ format) (cond ((memq format '(latex beamer)) (format "\\%s{%s}" (cl-first command) path)) (t (format "%s" path)))))
|   (let ((command (car --dolist-tail--))) (org-link-set-parameters (cl-first command) :follow #'or-follow-glossary :face 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export #'(lambda (path _ format) (cond ((memq format '...) (format "\\%s{%s}" (cl-first command) path)) (t (format "%s" path))))) (setq --dolist-tail-- (cdr --dolist-tail--)))
|   (while --dolist-tail-- (let ((command (car --dolist-tail--))) (org-link-set-parameters (cl-first command) :follow #'or-follow-glossary :face 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export #'(lambda (path _ format) (cond ((memq format ...) (format "\\%s{%s}" ... path)) (t (format "%s" path))))) (setq --dolist-tail-- (cdr --dolist-tail--))))
|   (let ((--dolist-tail-- org-ref-glossary-gls-commands)) (while --dolist-tail-- (let ((command (car --dolist-tail--))) (org-link-set-parameters (cl-first command) :follow #'or-follow-glossary :face 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export #'(lambda (path _ format) (cond (... ...) (t ...)))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
|   eval-buffer(#<buffer  *load*> nil "/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)  ; Reading at buffer position 10359
|   load-with-code-conversion("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." "/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)
|   load("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)
|   #f(compiled-function (c) #<bytecode -0x142f0bcbab31255a>)(("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1136))
|   mapc(#f(compiled-function (c) #<bytecode -0x142f0bcbab31255a>) (("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 911) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 912) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 913) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/doi-..." . 1130) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1135) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1136) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1139) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1292) ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1341)))
|   package--reload-previously-loaded(#s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind nil :archive nil :dir "/home/oub/.emacs.d/elpa/org-ref-20211110.1229" :extras ((:url . "https://github.com/jkitchin/org-ref") (:keywords "org-mode" "cite" "ref" "label") (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")) :signed nil))
|   package-activate-1(#s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind nil :archive nil :dir "/home/oub/.emacs.d/elpa/org-ref-20211110.1229" :extras ((:url . "https://github.com/jkitchin/org-ref") (:keywords "org-mode" "cite" "ref" "label") (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")) :signed nil) :reload :deps)
|   package-unpack(#s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil))
|   #f(compiled-function (&optional good-sigs) #<bytecode 0x1df497376f32ca1c>)(nil)
|   #f(compiled-function () #<bytecode -0x724af0e452d91f2>)()
|   package--with-response-buffer-1("http://melpa.org/packages/" #f(compiled-function () #<bytecode 0x1a36aee082226431>) :file "org-ref-20211110.1229.tar.sig" :async nil :error-function #f(compiled-function () #<bytecode -0x724af0e452d91f2>) :noerror t)
|   package--check-signature("http://melpa.org/packages/" "org-ref-20211110.1229.tar" "org-ref-20211110.1229/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..." nil #f(compiled-function (&optional good-sigs) #<bytecode 0x1df497376f32ca1c>))
|   #f(compiled-function () #<bytecode -0xeb56f85b3b07f67>)()
|   package--with-response-buffer-1("http://melpa.org/packages/" #f(compiled-function () #<bytecode -0xeb56f85b3b07f67>) :file "org-ref-20211110.1229.tar" :async nil :error-function #f(compiled-function () #<bytecode 0x1f4000153e91>) :noerror nil)
|   package-install-from-archive(#s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil))
|   mapc(package-install-from-archive (#s(package-desc :name queue :version (0 2) :summary "Queue data structure" :reqs nil :kind single :archive "gnu" :dir nil :extras ((:keywords "extensions" "data structures" "queue") (:authors ("Inge Wallin" . "inge@lysator.liu.se") ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") (:url . "http://www.dr-qubit.org/emacs.php")) :signed t) #s(package-desc :name citeproc :version (20211111 1008) :summary "A CSL 1.0.1 Citation Processor" :reqs ((emacs (25)) (dash (2 13 0)) (s (1 12 0)) (f (0 18 0)) (queue (0 2)) (string-inflection (1 0)) (org (9)) (parsebib (2 4))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "2857f9bb819d0d0a6e6ed91cc38b165e506bfc2e") (:authors ("András Simonyi" . "andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "andras.simonyi@gmail.com") (:keywords "bib") (:url . "https://github.com/andras-simonyi/citeproc-el")) :signed nil) #s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil)))
|   package-download-transaction((#s(package-desc :name queue :version (0 2) :summary "Queue data structure" :reqs nil :kind single :archive "gnu" :dir nil :extras ((:keywords "extensions" "data structures" "queue") (:authors ("Inge Wallin" . "inge@lysator.liu.se") ("Toby Cubitt" . "toby-predictive@dr-qubit.org")) (:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org") (:url . "http://www.dr-qubit.org/emacs.php")) :signed t) #s(package-desc :name citeproc :version (20211111 1008) :summary "A CSL 1.0.1 Citation Processor" :reqs ((emacs (25)) (dash (2 13 0)) (s (1 12 0)) (f (0 18 0)) (queue (0 2)) (string-inflection (1 0)) (org (9)) (parsebib (2 4))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "2857f9bb819d0d0a6e6ed91cc38b165e506bfc2e") (:authors ("András Simonyi" . "andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "andras.simonyi@gmail.com") (:keywords "bib") (:url . "https://github.com/andras-simonyi/citeproc-el")) :signed nil) #s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil)))
|   package-install(#s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil) dont-select)
|   package-menu--perform-transaction((#s(package-desc :name org-ref-prettify :version (20211111 742) :summary "Prettify org-ref citation links" :reqs ((emacs (24 3)) (org-ref (1 1 0)) (bibtex-completion (1 0 0))) :kind single :archive "melpa" :dir nil :extras ((:commit . "0cecd7b2611bd9d282876ab46d490ce3e635ba86") (:authors ("Alex Kost" . "alezost@gmail.com") ("Vitus Schäfftlein" . "vitusschaefftlein@live.de")) (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "convenience") (:url . "https://github.com/alezost/org-ref-prettify.el")) :signed nil) #s(package-desc :name org-ref :version (20211110 1229) :summary "citations, cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed nil)) nil)
|   package-menu-execute()
|   funcall-interactively(package-menu-execute)
|   call-interactively(package-menu-execute nil nil)
|   command-execute(package-menu-execute)
`----

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 18:17               ` Juan Manuel Macías
@ 2021-11-17 19:00                 ` Stefan Nobis
  0 siblings, 0 replies; 32+ messages in thread
From: Stefan Nobis @ 2021-11-17 19:00 UTC (permalink / raw)
  To: emacs-orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> In Org 9.5 there is a new variable `org-latex-reference-command'.

Thanks for the reminder! I once read about it, but forgot to use it
after upgrading to 9.5. :)

-- 
Until the next mail...,
Stefan.


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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 17:05               ` Uwe Brauer
@ 2021-11-17 19:10                 ` Stefan Nobis
  2021-11-23 15:20                 ` Bruce D'Arcus
  1 sibling, 0 replies; 32+ messages in thread
From: Stefan Nobis @ 2021-11-17 19:10 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> Yes, but, what do you do, if you have a 10 header and each has 20
> subheaders.

I avoid writing such complex documents for the moment. :)

[Some custom functions]
> Thanks but this did not work! 

Sorry. The code is meant as an inspiration, not to be used out-of-the
box. I never tested the functions outside my highly adjusted default
configuration.

As I read in another post you seem to be a helm user. Therefore it
might be a better idea to use helm helper functions. I assume, helm
has also some function to jump around in Org files, with headings as
targets. If you find such a function, try to copy and adapt (as I did
with the similar `counsel-outline' function): I assume such a function
will use some helper function to collect the candidates for completion
and after the user selected a candidate there is code to jump to the
selected destination. Just try to change this part so that instead of
jumping, a link is inserted at the proper place (that's the part my
function `sn/org-insert-internal-link-action' is responsible for).

Maybe someone with more knowledge about helm might help you with a
complete solution.

-- 
Until the next mail...,
Stefan.


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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 18:58     ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] Uwe Brauer
@ 2021-11-17 19:58       ` John Kitchin
  2021-11-17 20:16         ` Uwe Brauer
  2021-11-17 21:41         ` Uwe Brauer
  0 siblings, 2 replies; 32+ messages in thread
From: John Kitchin @ 2021-11-17 19:58 UTC (permalink / raw)
  To: org-mode-email

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

it usually takes up to 4 hours to propagate to MELPA.  I can't reproduce
the error you report.  At least, with a fresh emacs and install from MELPA
everything seems to load and work fine, even with emacs 29.  There seem to
be many issues with native-compiling on the most modern emacs, are you
using that?

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Nov 17, 2021 at 1:58 PM Uwe Brauer <oub@mat.ucm.es> wrote:

>
> > in the most current version (3) of org-ref, the labels that are found are
> > defined in org-ref-ref-label-regexps. At the moment there isn't a pattern
> > for ID. No particular reason, I haven't used ID like that for many
> years. I
> > added and pushed that to the current repo just now.
>
> Thanks, that is in MELPA already?
>
> BTW, I downloaded the latest MELPA org-ref pkg and obtained the
> following error (running emacs 29, master a couple of days ago)
> ,----
> |
> | Debugger entered--Lisp error: (wrong-type-argument listp "gls")
> |   cl-first("gls")
> |   (org-link-set-parameters (cl-first command) :follow
> |   #'or-follow-glossary :face 'org-ref-glossary-face-fn :help-echo
> |   'or-glossary-tooltip  :export #'(lambda (path _ format) (cond ((memq
> format '(latex beamer)) (format "\\%s{%s}" (cl-first command) path)) (t
> (format "%s" path)))))
> |   (let ((command (car --dolist-tail--))) (org-link-set-parameters
> (cl-first command) :follow #'or-follow-glossary :face
> 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export #'(lambda
> (path _ format) (cond ((memq format '...) (format "\\%s{%s}" (cl-first
> command) path)) (t (format "%s" path))))) (setq --dolist-tail-- (cdr
> --dolist-tail--)))
> |   (while --dolist-tail-- (let ((command (car --dolist-tail--)))
> (org-link-set-parameters (cl-first command) :follow #'or-follow-glossary
> :face 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export
> #'(lambda (path _ format) (cond ((memq format ...) (format "\\%s{%s}" ...
> path)) (t (format "%s" path))))) (setq --dolist-tail-- (cdr
> --dolist-tail--))))
> |   (let ((--dolist-tail-- org-ref-glossary-gls-commands)) (while
> --dolist-tail-- (let ((command (car --dolist-tail--)))
> (org-link-set-parameters (cl-first command) :follow #'or-follow-glossary
> :face 'org-ref-glossary-face-fn :help-echo 'or-glossary-tooltip :export
> #'(lambda (path _ format) (cond (... ...) (t ...)))) (setq --dolist-tail--
> (cdr --dolist-tail--)))))
> |   eval-buffer(#<buffer  *load*> nil
> "/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)  ; Reading
> at buffer position 10359
> |
>  load-with-code-conversion("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..."
> "/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)
> |   load("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." nil t)
> |   #f(compiled-function (c) #<bytecode
> -0x142f0bcbab31255a>)(("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..."
> . 1136))
> |   mapc(#f(compiled-function (c) #<bytecode -0x142f0bcbab31255a>)
> (("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 911)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 912)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 913)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/doi-..." . 1130)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1135)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1136)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1139)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1292)
> ("/home/oub/.emacs.d/elpa/org-ref-20211110.1229/org-..." . 1341)))
> |   package--reload-previously-loaded(#s(package-desc :name org-ref
> :version (20211110 1229) :summary "citations, cross-references and
> bibliographies in ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0))
> (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion (0)) (citeproc
> (0))) :kind nil :archive nil :dir
> "/home/oub/.emacs.d/elpa/org-ref-20211110.1229" :extras ((:url . "
> https://github.com/jkitchin/org-ref") (:keywords "org-mode" "cite" "ref"
> "label") (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu")
> (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:commit .
> "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")) :signed nil))
> |   package-activate-1(#s(package-desc :name org-ref :version (20211110
> 1229) :summary "citations, cross-references and bibliographies in ..."
> :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0))
> (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind nil :archive
> nil :dir "/home/oub/.emacs.d/elpa/org-ref-20211110.1229" :extras ((:url . "
> https://github.com/jkitchin/org-ref") (:keywords "org-mode" "cite" "ref"
> "label") (:maintainer "John Kitchin" . "jkitchin@andrew.cmu.edu")
> (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:commit .
> "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")) :signed nil) :reload :deps)
> |   package-unpack(#s(package-desc :name org-ref :version (20211110 1229)
> :summary "citations, cross-references and bibliographies in ..." :reqs
> ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib
> (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa"
> :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")
> (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer
> "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite"
> "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed
> nil))
> |   #f(compiled-function (&optional good-sigs) #<bytecode
> 0x1df497376f32ca1c>)(nil)
> |   #f(compiled-function () #<bytecode -0x724af0e452d91f2>)()
> |   package--with-response-buffer-1("http://melpa.org/packages/"
> #f(compiled-function () #<bytecode 0x1a36aee082226431>) :file
> "org-ref-20211110.1229.tar.sig" :async nil :error-function
> #f(compiled-function () #<bytecode -0x724af0e452d91f2>) :noerror t)
> |   package--check-signature("http://melpa.org/packages/"
> "org-ref-20211110.1229.tar"
> "org-ref-20211110.1229/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..."
> nil #f(compiled-function (&optional good-sigs) #<bytecode
> 0x1df497376f32ca1c>))
> |   #f(compiled-function () #<bytecode -0xeb56f85b3b07f67>)()
> |   package--with-response-buffer-1("http://melpa.org/packages/"
> #f(compiled-function () #<bytecode -0xeb56f85b3b07f67>) :file
> "org-ref-20211110.1229.tar" :async nil :error-function #f(compiled-function
> () #<bytecode 0x1f4000153e91>) :noerror nil)
> |   package-install-from-archive(#s(package-desc :name org-ref :version
> (20211110 1229) :summary "citations, cross-references and bibliographies in
> ..." :reqs ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0))
> (parsebib (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive
> "melpa" :dir nil :extras ((:commit .
> "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "
> jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "
> jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label")
> (:url . "https://github.com/jkitchin/org-ref")) :signed nil))
> |   mapc(package-install-from-archive (#s(package-desc :name queue
> :version (0 2) :summary "Queue data structure" :reqs nil :kind single
> :archive "gnu" :dir nil :extras ((:keywords "extensions" "data structures"
> "queue") (:authors ("Inge Wallin" . "inge@lysator.liu.se") ("Toby Cubitt"
> . "toby-predictive@dr-qubit.org")) (:maintainer "Toby Cubitt" . "
> toby-predictive@dr-qubit.org") (:url . "http://www.dr-qubit.org/emacs.php"))
> :signed t) #s(package-desc :name citeproc :version (20211111 1008) :summary
> "A CSL 1.0.1 Citation Processor" :reqs ((emacs (25)) (dash (2 13 0)) (s (1
> 12 0)) (f (0 18 0)) (queue (0 2)) (string-inflection (1 0)) (org (9))
> (parsebib (2 4))) :kind tar :archive "melpa" :dir nil :extras ((:commit .
> "2857f9bb819d0d0a6e6ed91cc38b165e506bfc2e") (:authors ("András Simonyi" . "
> andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "
> andras.simonyi@gmail.com") (:keywords "bib") (:url . "
> https://github.com/andras-simonyi/citeproc-el")) :signed nil)
> #s(package-desc :name org-ref :version (20211110 1229) :summary "citations,
> cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f
> (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion
> (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit
> . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "
> jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "
> jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label")
> (:url . "https://github.com/jkitchin/org-ref")) :signed nil)))
> |   package-download-transaction((#s(package-desc :name queue :version (0
> 2) :summary "Queue data structure" :reqs nil :kind single :archive "gnu"
> :dir nil :extras ((:keywords "extensions" "data structures" "queue")
> (:authors ("Inge Wallin" . "inge@lysator.liu.se") ("Toby Cubitt" . "
> toby-predictive@dr-qubit.org")) (:maintainer "Toby Cubitt" . "
> toby-predictive@dr-qubit.org") (:url . "http://www.dr-qubit.org/emacs.php"))
> :signed t) #s(package-desc :name citeproc :version (20211111 1008) :summary
> "A CSL 1.0.1 Citation Processor" :reqs ((emacs (25)) (dash (2 13 0)) (s (1
> 12 0)) (f (0 18 0)) (queue (0 2)) (string-inflection (1 0)) (org (9))
> (parsebib (2 4))) :kind tar :archive "melpa" :dir nil :extras ((:commit .
> "2857f9bb819d0d0a6e6ed91cc38b165e506bfc2e") (:authors ("András Simonyi" . "
> andras.simonyi@gmail.com")) (:maintainer "András Simonyi" . "
> andras.simonyi@gmail.com") (:keywords "bib") (:url . "
> https://github.com/andras-simonyi/citeproc-el")) :signed nil)
> #s(package-desc :name org-ref :version (20211110 1229) :summary "citations,
> cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f
> (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion
> (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit
> . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "
> jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "
> jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label")
> (:url . "https://github.com/jkitchin/org-ref")) :signed nil)))
> |   package-install(#s(package-desc :name org-ref :version (20211110 1229)
> :summary "citations, cross-references and bibliographies in ..." :reqs
> ((dash (0)) (s (0)) (f (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib
> (0)) (bibtex-completion (0)) (citeproc (0))) :kind tar :archive "melpa"
> :dir nil :extras ((:commit . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33")
> (:authors ("John Kitchin" . "jkitchin@andrew.cmu.edu")) (:maintainer
> "John Kitchin" . "jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite"
> "ref" "label") (:url . "https://github.com/jkitchin/org-ref")) :signed
> nil) dont-select)
> |   package-menu--perform-transaction((#s(package-desc :name
> org-ref-prettify :version (20211111 742) :summary "Prettify org-ref
> citation links" :reqs ((emacs (24 3)) (org-ref (1 1 0)) (bibtex-completion
> (1 0 0))) :kind single :archive "melpa" :dir nil :extras ((:commit .
> "0cecd7b2611bd9d282876ab46d490ce3e635ba86") (:authors ("Alex Kost" . "
> alezost@gmail.com") ("Vitus Schäfftlein" . "vitusschaefftlein@live.de"))
> (:maintainer "Alex Kost" . "alezost@gmail.com") (:keywords "convenience")
> (:url . "https://github.com/alezost/org-ref-prettify.el")) :signed nil)
> #s(package-desc :name org-ref :version (20211110 1229) :summary "citations,
> cross-references and bibliographies in ..." :reqs ((dash (0)) (s (0)) (f
> (0)) (htmlize (0)) (hydra (0)) (avy (0)) (parsebib (0)) (bibtex-completion
> (0)) (citeproc (0))) :kind tar :archive "melpa" :dir nil :extras ((:commit
> . "c87b4155cd2f60ca3a9bed2e6e366c1fa47aec33") (:authors ("John Kitchin" . "
> jkitchin@andrew.cmu.edu")) (:maintainer "John Kitchin" . "
> jkitchin@andrew.cmu.edu") (:keywords "org-mode" "cite" "ref" "label")
> (:url . "https://github.com/jkitchin/org-ref")) :signed nil)) nil)
> |   package-menu-execute()
> |   funcall-interactively(package-menu-execute)
> |   call-interactively(package-menu-execute nil nil)
> |   command-execute(package-menu-execute)
> `----
>

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

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 19:58       ` John Kitchin
@ 2021-11-17 20:16         ` Uwe Brauer
  2021-11-17 21:41         ` Uwe Brauer
  1 sibling, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 20:16 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> it usually takes up to 4 hours to propagate to MELPA.  I can't reproduce
> the error you report.  At least, with a fresh emacs and install from MELPA
> everything seems to load and work fine, even with emacs 29.  There seem to
> be many issues with native-compiling on the most modern emacs, are you
> using that?

I am running 
emacs-repository-version  "846ff294206c922da4c48396e440e90179ffe070"
* commit 846ff294206c922da4c48396e440e90179ffe070 (HEAD -> master, origin/master, origin/HEAD)
| Author: Lars Ingebrigtsen <larsi@gnus.org>
| Date:   Mon Nov 8 08:01:07 2021 +0100

So that could be the problem.

I just tried https://github.com/jkitchin/org-ref.git
but make fails as well (cask not found). I opened an issue on github. I
will restart emacs and try it again.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 19:58       ` John Kitchin
  2021-11-17 20:16         ` Uwe Brauer
@ 2021-11-17 21:41         ` Uwe Brauer
  2021-11-17 21:54           ` John Kitchin
  1 sibling, 1 reply; 32+ messages in thread
From: Uwe Brauer @ 2021-11-17 21:41 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> it usually takes up to 4 hours to propagate to MELPA.  I can't reproduce
> the error you report.  At least, with a fresh emacs and install from MELPA
> everything seems to load and work fine, even with emacs 29.  There seem to
> be many issues with native-compiling on the most modern emacs, are you
> using that?

I think, I succeeded cloning and installing directly from your github
repository, but now the function I was using for a long time 

org-ref-helm-insert-cite-link

Seems to be gone, what happened?

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 21:41         ` Uwe Brauer
@ 2021-11-17 21:54           ` John Kitchin
  2021-11-18  7:44             ` Uwe Brauer
  0 siblings, 1 reply; 32+ messages in thread
From: John Kitchin @ 2021-11-17 21:54 UTC (permalink / raw)
  To: org-mode-email

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

Probably M-x org-ref-insert-ref-link will do what you want. A lot of things
got "simplified" in version 3 to leverage completing-read more natively.
helm-mode should work with org-ref-insert-ref-link.

See https://github.com/jkitchin/org-ref#configuration for some details on
how to configure v3 with helm.


John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Nov 17, 2021 at 4:41 PM Uwe Brauer <oub@mat.ucm.es> wrote:

> >>> "JK" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > it usually takes up to 4 hours to propagate to MELPA.  I can't reproduce
> > the error you report.  At least, with a fresh emacs and install from
> MELPA
> > everything seems to load and work fine, even with emacs 29.  There seem
> to
> > be many issues with native-compiling on the most modern emacs, are you
> > using that?
>
> I think, I succeeded cloning and installing directly from your github
> repository, but now the function I was using for a long time
>
> org-ref-helm-insert-cite-link
>
> Seems to be gone, what happened?
>

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

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-17 21:54           ` John Kitchin
@ 2021-11-18  7:44             ` Uwe Brauer
  2021-11-18  8:06               ` Uwe Brauer
  2021-11-18 12:48               ` John Kitchin
  0 siblings, 2 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-18  7:44 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> Probably M-x org-ref-insert-ref-link will do what you want. A lot of things
> got "simplified" in version 3 to leverage completing-read more natively.
> helm-mode should work with org-ref-insert-ref-link.

I see. I think I got it to work, but the navigation is not entirely
clear to me, if I fire up that function a buffer pops up with possible
labels but how do I do something like scroll-up and scroll-down?

> See https://github.com/jkitchin/org-ref#configuration for some details on
> how to configure v3 with helm.

Honestly I miss a bit the old behaviour, when calling a ref function.[1]

So I checked out the org-ref-2 branch from the github repository.

But still there the function org-ref-helm-insert-cite-link is gone and
other related org-ref-helm functions. Is this correct?
 

Footnotes:
[1]  I mean the helm menu that popped up


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-18  7:44             ` Uwe Brauer
@ 2021-11-18  8:06               ` Uwe Brauer
  2021-11-18 12:48               ` John Kitchin
  1 sibling, 0 replies; 32+ messages in thread
From: Uwe Brauer @ 2021-11-18  8:06 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:

> So I checked out the org-ref-2 branch from the github repository.

> But still there the function org-ref-helm-insert-cite-link is gone and
> other related org-ref-helm functions. Is this correct?

I got the behaviour back by loading 
(require 'org-ref-helm)
(require 'org-ref-helm-cite)
(require 'org-ref-helm-bibtex)

Right now I am not sure, what I prefer ;)


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: [Problems with org-ref-helm-insert-ref-link and org-id-get-create]
  2021-11-18  7:44             ` Uwe Brauer
  2021-11-18  8:06               ` Uwe Brauer
@ 2021-11-18 12:48               ` John Kitchin
  1 sibling, 0 replies; 32+ messages in thread
From: John Kitchin @ 2021-11-18 12:48 UTC (permalink / raw)
  To: org-mode-email

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

if you don't get a helm buffer popping up, it could mean you have not
turned helm-mode on (e.g. M-x helm-mode).  That redefines completing-read
in a helm style, and should act and feel like helm when you insert a ref
link. If you don't have that on, then you will see the older completing
read behavior where you have to press tab to see the candidates etc.

The old v2 definition of org-ref-helm-insert-cite-link can be found at
https://github.com/jkitchin/org-ref/blob/org-ref-2/org-ref-helm-bibtex.el#L406,
but for refs, it probably just calls this function:
https://github.com/jkitchin/org-ref/blob/org-ref-2/org-ref-helm.el#L62.

in v3, you can customize the insert functions any way you want, so if you
want to use the old v2 functions and have them around, there should be no
issue with that. I think if you set `org-ref-insert-ref-function` to the
function you want, it should just work the way you want.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Thu, Nov 18, 2021 at 2:46 AM Uwe Brauer <oub@mat.ucm.es> wrote:

> >>> "JK" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > Probably M-x org-ref-insert-ref-link will do what you want. A lot of
> things
> > got "simplified" in version 3 to leverage completing-read more natively.
> > helm-mode should work with org-ref-insert-ref-link.
>
> I see. I think I got it to work, but the navigation is not entirely
> clear to me, if I fire up that function a buffer pops up with possible
> labels but how do I do something like scroll-up and scroll-down?
>
> > See https://github.com/jkitchin/org-ref#configuration for some details
> on
> > how to configure v3 with helm.
>
> Honestly I miss a bit the old behaviour, when calling a ref function.[1]
>
> So I checked out the org-ref-2 branch from the github repository.
>
> But still there the function org-ref-helm-insert-cite-link is gone and
> other related org-ref-helm functions. Is this correct?
>
>
> Footnotes:
> [1]  I mean the helm menu that popped up
>
>

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

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

* Re: insert automatically a reference to a section header and a link
  2021-11-17 17:05               ` Uwe Brauer
  2021-11-17 19:10                 ` Stefan Nobis
@ 2021-11-23 15:20                 ` Bruce D'Arcus
  1 sibling, 0 replies; 32+ messages in thread
From: Bruce D'Arcus @ 2021-11-23 15:20 UTC (permalink / raw)
  To: org-mode-email

On Wed, Nov 17, 2021 at 12:18 PM Uwe Brauer <oub@mat.ucm.es> wrote:

> > I type "As we have seen in section [[*Intro]]" (literally, I tend to
> > not use any keybindings or function to insert the link). This (the
> > "*Intro" inside double square brackets) is called an internal link to
> > headlines and they are a default feature of Org:
>
> Yes, but, what do you do, if you have a 10 header and each has 20
> subheaders. How do you remember all these names?

Seems like completion could help, either at point, or with completing-read?

I've been playing a bit with something using the latter, and it's not
alway so straightforward how to do this given the flexibility of org,
but here's what it looks like using the Emacs 28 grouping support and
Emacs 27 annotation support:

https://raw.githubusercontent.com/bdarcus/oxr/main/images/oxr-insert.png

Bruce


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

end of thread, other threads:[~2021-11-23 15:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17  7:36 insert automatically a reference to a section header and a link Uwe Brauer
2021-11-17  8:28 ` Uwe Brauer
2021-11-17 10:04 ` Eric S Fraga
2021-11-17 13:58   ` Uwe Brauer
2021-11-17 14:06     ` John Kitchin
2021-11-17 14:15       ` Uwe Brauer
2021-11-17 14:59         ` Stefan Nobis
2021-11-17 15:42           ` Juan Manuel Macías
2021-11-17 16:08             ` Uwe Brauer
2021-11-17 15:55           ` Uwe Brauer
2021-11-17 16:08             ` Eric S Fraga
2021-11-17 16:44               ` Uwe Brauer
2021-11-17 16:29             ` Stefan Nobis
2021-11-17 17:05               ` Uwe Brauer
2021-11-17 19:10                 ` Stefan Nobis
2021-11-23 15:20                 ` Bruce D'Arcus
2021-11-17 18:17               ` Juan Manuel Macías
2021-11-17 19:00                 ` Stefan Nobis
2021-11-17 14:58     ` Eric S Fraga
2021-11-17 16:00       ` Uwe Brauer
2021-11-17 16:31         ` Eric S Fraga
2021-11-17 17:06           ` Uwe Brauer
2021-11-17 16:49 ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] (was: insert automatically a reference to a section header and a link) Uwe Brauer
2021-11-17 17:57   ` John Kitchin
2021-11-17 18:58     ` [Problems with org-ref-helm-insert-ref-link and org-id-get-create] Uwe Brauer
2021-11-17 19:58       ` John Kitchin
2021-11-17 20:16         ` Uwe Brauer
2021-11-17 21:41         ` Uwe Brauer
2021-11-17 21:54           ` John Kitchin
2021-11-18  7:44             ` Uwe Brauer
2021-11-18  8:06               ` Uwe Brauer
2021-11-18 12:48               ` John Kitchin

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.