emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* re-scanning bibliography for org-cite
@ 2021-10-21 14:11 Eric S Fraga
  2021-10-21 14:51 ` Uwe Brauer
  2021-10-21 15:30 ` Bruce D'Arcus
  0 siblings, 2 replies; 18+ messages in thread
From: Eric S Fraga @ 2021-10-21 14:11 UTC (permalink / raw)
  To: Emacs Org mode mailing list

Dear all,

simple question: how can I get org-cite to rescan my bibliography (.bib)
file when it changes?  When I'm writing a paper, as I'm doing now, I add
entries to my bibliography as I write but org-cite is not aware of any
new entries.

I have gone through the code but cannot see where the bib entries are
actually read.  (my bad)

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-149-g781080
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: re-scanning bibliography for org-cite
  2021-10-21 14:11 re-scanning bibliography for org-cite Eric S Fraga
@ 2021-10-21 14:51 ` Uwe Brauer
  2021-10-21 15:02   ` Eric S Fraga
  2021-10-21 15:30 ` Bruce D'Arcus
  1 sibling, 1 reply; 18+ messages in thread
From: Uwe Brauer @ 2021-10-21 14:51 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> Dear all,

> simple question: how can I get org-cite to rescan my bibliography
> (.bib) file when it changes? When I'm writing a paper, as I'm doing
> now, I add entries to my bibliography as I write but org-cite is not
> aware of any new entries.

> I have gone through the code but cannot see where the bib entries are
> actually read.  (my bad)

Do you use 
org-ref-insert-cite-link

Or 
org-ref-helm-insert-cite-link

I use the latter in that case, if I finish an entry and update the bib
file, then when I call the function again, it is updated, not sure about
org-ref-insert-cite-link



> Thank you,
> eric

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

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

* Re: re-scanning bibliography for org-cite
  2021-10-21 14:51 ` Uwe Brauer
@ 2021-10-21 15:02   ` Eric S Fraga
  0 siblings, 0 replies; 18+ messages in thread
From: Eric S Fraga @ 2021-10-21 15:02 UTC (permalink / raw)
  To: emacs-orgmode

On Thursday, 21 Oct 2021 at 16:51, Uwe Brauer wrote:
> Do you use 
> org-ref-insert-cite-link
> org-ref-helm-insert-cite-link

Neither.  I use org-cite-insert.

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-149-g781080
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: re-scanning bibliography for org-cite
  2021-10-21 14:11 re-scanning bibliography for org-cite Eric S Fraga
  2021-10-21 14:51 ` Uwe Brauer
@ 2021-10-21 15:30 ` Bruce D'Arcus
  2021-11-03 16:21   ` Nicolas Goaziou
  1 sibling, 1 reply; 18+ messages in thread
From: Bruce D'Arcus @ 2021-10-21 15:30 UTC (permalink / raw)
  To: Org Mode List

On Thu, Oct 21, 2021 at 10:12 AM Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
> Dear all,
>
> simple question: how can I get org-cite to rescan my bibliography (.bib)
> file when it changes?  When I'm writing a paper, as I'm doing now, I add
> entries to my bibliography as I write but org-cite is not aware of any
> new entries.

Do you mean for org-cite-insert?

Which insert processor?

If it's bibtex-actions, you have to configure the filenotify support
mentioned on the README.

I'm not sure how the oc-basic one handles this.

Bruce


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

* Re: re-scanning bibliography for org-cite
  2021-10-21 15:30 ` Bruce D'Arcus
@ 2021-11-03 16:21   ` Nicolas Goaziou
  2021-11-03 16:34     ` Bruce D'Arcus
  2022-05-24 12:30     ` Eric S Fraga
  0 siblings, 2 replies; 18+ messages in thread
From: Nicolas Goaziou @ 2021-11-03 16:21 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: Org Mode List

Hello,

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> On Thu, Oct 21, 2021 at 10:12 AM Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>>
>> Dear all,
>>
>> simple question: how can I get org-cite to rescan my bibliography (.bib)
>> file when it changes?  When I'm writing a paper, as I'm doing now, I add
>> entries to my bibliography as I write but org-cite is not aware of any
>> new entries.
>
> Do you mean for org-cite-insert?
>
> Which insert processor?
>
> If it's bibtex-actions, you have to configure the filenotify support
> mentioned on the README.
>
> I'm not sure how the oc-basic one handles this.

oc-basic relies on a cache. The cache key contains a hash of the
contents of the bib file. So whenever the bib file is modified, the
cache is invalidated, and oc-basic parses again the file.

IOW, rescanning happens automatically in oc-basic.

Regards,
-- 
Nicolas Goaziou


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

* Re: re-scanning bibliography for org-cite
  2021-11-03 16:21   ` Nicolas Goaziou
@ 2021-11-03 16:34     ` Bruce D'Arcus
  2022-05-24 12:30     ` Eric S Fraga
  1 sibling, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2021-11-03 16:34 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

On Wed, Nov 3, 2021 at 12:21 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> oc-basic relies on a cache. The cache key contains a hash of the
> contents of the bib file. So whenever the bib file is modified, the
> cache is invalidated, and oc-basic parses again the file.

Of course; clever!

Bruce


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

* Re: re-scanning bibliography for org-cite
  2021-11-03 16:21   ` Nicolas Goaziou
  2021-11-03 16:34     ` Bruce D'Arcus
@ 2022-05-24 12:30     ` Eric S Fraga
  2022-05-26  5:00       ` Ihor Radchenko
  1 sibling, 1 reply; 18+ messages in thread
From: Eric S Fraga @ 2022-05-24 12:30 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

On Wednesday,  3 Nov 2021 at 17:21, Nicolas Goaziou wrote:
> oc-basic relies on a cache. The cache key contains a hash of the
> contents of the bib file. So whenever the bib file is modified, the
> cache is invalidated, and oc-basic parses again the file.
>
> IOW, rescanning happens automatically in oc-basic.

Hi Nicolas,

sorry to revisit this but I continue to run into the problem of the
bibliography not being rescanned automatically.  What is the easiest way
(other than leaving Emacs and restarting) to force it, assuming there is
one?  I.e. maybe I can invalidate or clear the cache?

I do not know why rescanning doesn't happen.  It usually does but then
sometimes it doesn't without any noticeable difference in the actions I
have taken.  Frustrating.

I hate restarting Emacs... ;-)

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.3-511-g8e69ad in Emacs 29.0.50


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

* Re: re-scanning bibliography for org-cite
  2022-05-24 12:30     ` Eric S Fraga
@ 2022-05-26  5:00       ` Ihor Radchenko
  2022-05-26  9:39         ` Eric S Fraga
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-05-26  5:00 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Nicolas Goaziou, Org Mode List

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

> sorry to revisit this but I continue to run into the problem of the
> bibliography not being rescanned automatically.  What is the easiest way
> (other than leaving Emacs and restarting) to force it, assuming there is
> one?  I.e. maybe I can invalidate or clear the cache?
>
> I do not know why rescanning doesn't happen.  It usually does but then
> sometimes it doesn't without any noticeable difference in the actions I
> have taken.  Frustrating.

In theory, it might be related to one of the changes I made in this
area. I am not 100% sure, but bibliography might not be rescanned if you
edit a bibliography file in Emacs buffer, but do not actually save it.
Is this what is happening?

Best,
Ihor


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

* Re: re-scanning bibliography for org-cite
  2022-05-26  5:00       ` Ihor Radchenko
@ 2022-05-26  9:39         ` Eric S Fraga
  2022-05-26 10:24           ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Eric S Fraga @ 2022-05-26  9:39 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Nicolas Goaziou, Org Mode List

On Thursday, 26 May 2022 at 13:00, Ihor Radchenko wrote:
> In theory, it might be related to one of the changes I made in this
> area. I am not 100% sure, but bibliography might not be rescanned if you
> edit a bibliography file in Emacs buffer, but do not actually save it.
> Is this what is happening?

No and, to be fair, I wouldn't expect the scanning to take place if I
hadn't saved the file.

I have my bibliography in an org file which I export to .bib using
org-bibtex.

Is there a function I can call to force a rescan?  That would satisfy me
as I could put it into a hook for org-bibtex (or advice the function if
no hook available).

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.3-472-gd2a459 in Emacs 29.0.50


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

* Re: re-scanning bibliography for org-cite
  2022-05-26  9:39         ` Eric S Fraga
@ 2022-05-26 10:24           ` Ihor Radchenko
  2022-05-26 10:46             ` Eric S Fraga
  2022-06-09 12:23             ` Fraga, Eric
  0 siblings, 2 replies; 18+ messages in thread
From: Ihor Radchenko @ 2022-05-26 10:24 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Nicolas Goaziou, Org Mode List

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

> Is there a function I can call to force a rescan?  That would satisfy me
> as I could put it into a hook for org-bibtex (or advice the function if
> no hook available).

The relevant function is org-cite-basic--parse-bibliography.

You can try 2 things:
1. Set org-cite-basic--file-id-cache to nil in :around advice before
   calling the function
2. Remove :cite-basic/bibliography from INFO plist in :around advice
   before calling the function

I you find any of these methods helpful, please report back. I have a
suspicion that :cite-basic/bibliography might be the cause.

Best,
Ihor


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

* Re: re-scanning bibliography for org-cite
  2022-05-26 10:24           ` Ihor Radchenko
@ 2022-05-26 10:46             ` Eric S Fraga
  2022-05-26 11:32               ` Timothy
  2022-06-09 12:23             ` Fraga, Eric
  1 sibling, 1 reply; 18+ messages in thread
From: Eric S Fraga @ 2022-05-26 10:46 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Nicolas Goaziou, Org Mode List

Hi Ihor,

I will try these out, hopefully tomorrow.  The difficulty will be
knowing whether they work or not given the sporadic nature of the
problem...

Thank you,
eric

-- 
: Eric S Fraga, with org release_9.5.3-513-g292116 in Emacs 29.0.50


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

* Re: re-scanning bibliography for org-cite
  2022-05-26 10:46             ` Eric S Fraga
@ 2022-05-26 11:32               ` Timothy
  2022-05-26 11:58                 ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Timothy @ 2022-05-26 11:32 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Ihor Radchenko, Nicolas Goaziou, emacs-orgmode

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

Hi Eric,

> The difficulty will be knowing whether they work or not given the sporadic
> nature of the problem…

If it’s any help, I consistently have this issue when producing the bib file by tangling.

All the best,
Timothy

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

* Re: re-scanning bibliography for org-cite
  2022-05-26 11:32               ` Timothy
@ 2022-05-26 11:58                 ` Ihor Radchenko
  0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2022-05-26 11:58 UTC (permalink / raw)
  To: Timothy; +Cc: Eric S Fraga, Nicolas Goaziou, emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> Hi Eric,
>
>> The difficulty will be knowing whether they work or not given the sporadic
>> nature of the problem…
>
> If it’s any help, I consistently have this issue when producing the bib file by tangling.

Then, can you also try the proposed steps? If you can reproduce the
problem consistently, you can reveal what helps (or not) far quicker.

Best,
Ihor


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

* Re: re-scanning bibliography for org-cite
  2022-05-26 10:24           ` Ihor Radchenko
  2022-05-26 10:46             ` Eric S Fraga
@ 2022-06-09 12:23             ` Fraga, Eric
  2022-06-09 14:34               ` Bruce D'Arcus
  1 sibling, 1 reply; 18+ messages in thread
From: Fraga, Eric @ 2022-06-09 12:23 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Nicolas Goaziou, Org Mode List

On Thursday, 26 May 2022 at 18:24, Ihor Radchenko wrote:
> The relevant function is org-cite-basic--parse-bibliography.

To finally follow up on this, the problem is not with org-cite but
appears to be due to my use of citar.  Citar seems to cache the keys
somewhere/somehow and this cache is not updated when the bibliography
file changes.  If I set org-cite-insert-processor to 'basic, everything
is fine.

Sorry for the noise.

-- 
: Eric S Fraga, with org release_9.5.4-521-g1105da in Emacs 29.0.50

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

* Re: re-scanning bibliography for org-cite
  2022-06-09 12:23             ` Fraga, Eric
@ 2022-06-09 14:34               ` Bruce D'Arcus
  2022-06-09 16:00                 ` Fraga, Eric
  0 siblings, 1 reply; 18+ messages in thread
From: Bruce D'Arcus @ 2022-06-09 14:34 UTC (permalink / raw)
  To: Org Mode List; +Cc: Ihor Radchenko, Nicolas Goaziou

On Thu, Jun 9, 2022 at 10:19 AM Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
>
> On Thursday, 26 May 2022 at 18:24, Ihor Radchenko wrote:
> > The relevant function is org-cite-basic--parse-bibliography.
>
> To finally follow up on this, the problem is not with org-cite but
> appears to be due to my use of citar.  Citar seems to cache the keys
> somewhere/somehow and this cache is not updated when the bibliography
> file changes.

Yes; not currently by default, but can be configured.

https://github.com/emacs-citar/citar#refreshing-the-library-display

But more importantly I'm currently working on a major change in the
caching and completion architecture of citar, where I've actually
borrowed ideas and code from oc-basic, so it should work the same WRT
to cache updating, without need for any configuration.

https://github.com/emacs-citar/citar/pull/628

It should take another few days of development and testing before I'm
ready to merge it, but it pretty much works now, and any help with
code review and/or testing would be much appreciated.

Bruce


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

* Re: re-scanning bibliography for org-cite
  2022-06-09 14:34               ` Bruce D'Arcus
@ 2022-06-09 16:00                 ` Fraga, Eric
  2022-06-09 16:51                   ` Bruce D'Arcus
  2022-07-04 16:45                   ` Bruce D'Arcus
  0 siblings, 2 replies; 18+ messages in thread
From: Fraga, Eric @ 2022-06-09 16:00 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: Org Mode List, Ihor Radchenko, Nicolas Goaziou

On Thursday,  9 Jun 2022 at 10:34, Bruce D'Arcus wrote:
> It should take another few days of development and testing before I'm
> ready to merge it, but it pretty much works now, and any help with
> code review and/or testing would be much appreciated.

Okay, let me know.  It's easy enough for me to replace 'basic with
'citar again!

-- 
: Eric S Fraga, with org release_9.5.4-521-g1105da in Emacs 29.0.50

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

* Re: re-scanning bibliography for org-cite
  2022-06-09 16:00                 ` Fraga, Eric
@ 2022-06-09 16:51                   ` Bruce D'Arcus
  2022-07-04 16:45                   ` Bruce D'Arcus
  1 sibling, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-06-09 16:51 UTC (permalink / raw)
  To: Org Mode List

BTW, just to give some context of why we didn't implement it by
default earlier; there are two reasons:

1. it seems vast differences in the size of user bib files, and those
with very large ones would be annoyed if it re-generated the
completions on every change.
2. citar also covers notes and related files, which get complicated,
and subject to further user variety; and the UI needs to keep this in
sync with the bib data

I think we understand the problem better now, however.

On Thu, Jun 9, 2022 at 12:00 PM Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
>
> On Thursday,  9 Jun 2022 at 10:34, Bruce D'Arcus wrote:
> > It should take another few days of development and testing before I'm
> > ready to merge it, but it pretty much works now, and any help with
> > code review and/or testing would be much appreciated.
>
> Okay, let me know.  It's easy enough for me to replace 'basic with
> 'citar again!
>
> --
> : Eric S Fraga, with org release_9.5.4-521-g1105da in Emacs 29.0.50


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

* Re: re-scanning bibliography for org-cite
  2022-06-09 16:00                 ` Fraga, Eric
  2022-06-09 16:51                   ` Bruce D'Arcus
@ 2022-07-04 16:45                   ` Bruce D'Arcus
  1 sibling, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-04 16:45 UTC (permalink / raw)
  To: Org Mode List; +Cc: Ihor Radchenko, Nicolas Goaziou

On Thu, Jun 9, 2022 at 12:00 PM Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
>
> On Thursday,  9 Jun 2022 at 10:34, Bruce D'Arcus wrote:
> > It should take another few days of development and testing before I'm
> > ready to merge it, but it pretty much works now, and any help with
> > code review and/or testing would be much appreciated.
>
> Okay, let me know.  It's easy enough for me to replace 'basic with
> 'citar again!

Took a bit longer than "days," because we ended up making a ton of
other changes, but it's now merged.

The result should be a snappy UI that appropriately adapts to local
buffer context, and updates the cache as needed.


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

end of thread, other threads:[~2022-07-04 16:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-21 14:11 re-scanning bibliography for org-cite Eric S Fraga
2021-10-21 14:51 ` Uwe Brauer
2021-10-21 15:02   ` Eric S Fraga
2021-10-21 15:30 ` Bruce D'Arcus
2021-11-03 16:21   ` Nicolas Goaziou
2021-11-03 16:34     ` Bruce D'Arcus
2022-05-24 12:30     ` Eric S Fraga
2022-05-26  5:00       ` Ihor Radchenko
2022-05-26  9:39         ` Eric S Fraga
2022-05-26 10:24           ` Ihor Radchenko
2022-05-26 10:46             ` Eric S Fraga
2022-05-26 11:32               ` Timothy
2022-05-26 11:58                 ` Ihor Radchenko
2022-06-09 12:23             ` Fraga, Eric
2022-06-09 14:34               ` Bruce D'Arcus
2022-06-09 16:00                 ` Fraga, Eric
2022-06-09 16:51                   ` Bruce D'Arcus
2022-07-04 16:45                   ` Bruce D'Arcus

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