all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-cite: how to force a reparsing of the .bib file
@ 2023-08-22 18:35 Leo Butler
  2023-08-22 18:48 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Butler @ 2023-08-22 18:35 UTC (permalink / raw)
  To: Org Mode Mailing List

Hello,

I am struggling with org-cite at the moment. One problem: it is not
re-parsing my .bib file, so it is not picking up changes. How can I
force it to pick up changes?

TIA,
Leo

ps: (insert (format "\n%s\nOrg: %s" (emacs-version) (org-version)))
GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0)
 of 2023-05-13, modified by Debian
Org: 9.6.7

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

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-22 18:35 org-cite: how to force a reparsing of the .bib file Leo Butler
@ 2023-08-22 18:48 ` Ihor Radchenko
  2023-08-22 20:44   ` Leo Butler
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-22 18:48 UTC (permalink / raw)
  To: Leo Butler; +Cc: Org Mode Mailing List

Leo Butler <Leo.Butler@umanitoba.ca> writes:

> I am struggling with org-cite at the moment. One problem: it is not
> re-parsing my .bib file, so it is not picking up changes. How can I
> force it to pick up changes?

Please, provide more details.
org-cite should already monitor .bib file contents and re-parse it as
necessary.

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

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-22 18:48 ` Ihor Radchenko
@ 2023-08-22 20:44   ` Leo Butler
  2023-08-23  9:13     ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Butler @ 2023-08-22 20:44 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode Mailing List

On Tue, Aug 22 2023, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>> I am struggling with org-cite at the moment. One problem: it is not
>> re-parsing my .bib file, so it is not picking up changes. How can I
>> force it to pick up changes?
>
> Please, provide more details.
> org-cite should already monitor .bib file contents and re-parse it as
> necessary.

Does org-cite monitor contents or the timestamp?
I am using a symlink to the bib file.

Leo

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

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-22 20:44   ` Leo Butler
@ 2023-08-23  9:13     ` Ihor Radchenko
  2023-08-23 16:47       ` Leo Butler
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-23  9:13 UTC (permalink / raw)
  To: Leo Butler; +Cc: Org Mode Mailing List

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

Leo Butler <Leo.Butler@umanitoba.ca> writes:

> Does org-cite monitor contents or the timestamp?
> I am using a symlink to the bib file.

Timestamp.

Does the attached patch fix the problem?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-oc-basic-Fix-detecting-changes-in-symlinked-bibliogr.patch --]
[-- Type: text/x-patch, Size: 1266 bytes --]

From 39b503301fc7a3ea68733dfd9e4391e3f84efec8 Mon Sep 17 00:00:00 2001
Message-ID: <39b503301fc7a3ea68733dfd9e4391e3f84efec8.1692781998.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 23 Aug 2023 12:12:13 +0300
Subject: [PATCH] oc-basic: Fix detecting changes in symlinked bibliography

* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Use
`file-truename' to follow symlinks first before checking bibliography
file change times.

Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/877cpmkds1.fsf@t14.reltub.ca
---
 lisp/oc-basic.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 84d9492ea..c4468e5a8 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -272,6 +272,9 @@ (defun org-cite-basic--parse-bibliography (&optional info)
       (plist-get info :cite-basic/bibliography)
     (let ((results nil))
       (dolist (file (org-cite-list-bibliography-files))
+        ;; Follow symlinks, to look into modification time of the
+        ;; actual file, not its symlink.
+        (setq file (file-truename file))
         (when (file-readable-p file)
           (with-temp-buffer
             (when (or (org-file-has-changed-p file)
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 225 bytes --]



-- 
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 related	[flat|nested] 7+ messages in thread

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-23  9:13     ` Ihor Radchenko
@ 2023-08-23 16:47       ` Leo Butler
  2023-08-24  7:22         ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Butler @ 2023-08-23 16:47 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode Mailing List

On Wed, Aug 23 2023, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>> Does org-cite monitor contents or the timestamp?
>> I am using a symlink to the bib file.
>
> Timestamp.
>
> Does the attached patch fix the problem?

Thanks, Ihor.

To avoid an unneeded setq, I applied the patch:

      (dolist (file (mapcar #'file-truename (org-cite-list-bibliography-files)))

This caused the bibtex file to be re-parsed when I changed it.

Best,
Leo

>
> From 39b503301fc7a3ea68733dfd9e4391e3f84efec8 Mon Sep 17 00:00:00 2001
> Message-ID: <39b503301fc7a3ea68733dfd9e4391e3f84efec8.1692781998.git.yantar92@posteo.net>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Wed, 23 Aug 2023 12:12:13 +0300
> Subject: [PATCH] oc-basic: Fix detecting changes in symlinked bibliography
>
> * lisp/oc-basic.el (org-cite-basic--parse-bibliography): Use
> `file-truename' to follow symlinks first before checking bibliography
> file change times.
>
> Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
> Link: https://orgmode.org/list/877cpmkds1.fsf@t14.reltub.ca
> ---
>  lisp/oc-basic.el | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
> index 84d9492ea..c4468e5a8 100644
> --- a/lisp/oc-basic.el
> +++ b/lisp/oc-basic.el
> @@ -272,6 +272,9 @@ (defun org-cite-basic--parse-bibliography (&optional info)
>        (plist-get info :cite-basic/bibliography)
>      (let ((results nil))
>        (dolist (file (org-cite-list-bibliography-files))
> +        ;; Follow symlinks, to look into modification time of the
> +        ;; actual file, not its symlink.
> +        (setq file (file-truename file))
>          (when (file-readable-p file)
>            (with-temp-buffer
>              (when (or (org-file-has-changed-p file)
> -- 
> 2.41.0

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

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-23 16:47       ` Leo Butler
@ 2023-08-24  7:22         ` Ihor Radchenko
  2023-08-24 17:57           ` Leo Butler
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-24  7:22 UTC (permalink / raw)
  To: Leo Butler; +Cc: Org Mode Mailing List

Leo Butler <Leo.Butler@umanitoba.ca> writes:

>> Does the attached patch fix the problem?
>
> ...
> To avoid an unneeded setq, I applied the patch:
>
>       (dolist (file (mapcar #'file-truename (org-cite-list-bibliography-files)))

This would create an extra list and increase GC pressure. So, I prefer setq.

> This caused the bibtex file to be re-parsed when I changed it.

Thanks for testing!
Applied.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3c3db7b33

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

* Re: org-cite: how to force a reparsing of the .bib file
  2023-08-24  7:22         ` Ihor Radchenko
@ 2023-08-24 17:57           ` Leo Butler
  0 siblings, 0 replies; 7+ messages in thread
From: Leo Butler @ 2023-08-24 17:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode Mailing List

On Thu, Aug 24 2023, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>>> Does the attached patch fix the problem?
>>
>> ...
>> To avoid an unneeded setq, I applied the patch:
>>
>>       (dolist (file (mapcar #'file-truename (org-cite-list-bibliography-files)))
>
> This would create an extra list and increase GC pressure. So, I prefer setq.
>
>> This caused the bibtex file to be re-parsed when I changed it.
>
> Thanks for testing!
> Applied.
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3c3db7b33

Thanks, Ihor.
Leo

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

end of thread, other threads:[~2023-08-24 18:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-22 18:35 org-cite: how to force a reparsing of the .bib file Leo Butler
2023-08-22 18:48 ` Ihor Radchenko
2023-08-22 20:44   ` Leo Butler
2023-08-23  9:13     ` Ihor Radchenko
2023-08-23 16:47       ` Leo Butler
2023-08-24  7:22         ` Ihor Radchenko
2023-08-24 17:57           ` Leo Butler

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.