emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Skip entries with no ID when updating ID locations
@ 2020-02-19 21:26 Eric Abrahamsen
  2020-02-19 21:37 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Abrahamsen @ 2020-02-19 21:26 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

Would the attached patch be acceptable? It's no big deal, just skips
entries with no ID property when updating all ID locations. I couldn't
figure out why I had several thousand "Duplicate ID "nil"" warnings in
the *Messages* buffer after updating ID locations.

Thanks,
Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Skip-entries-with-no-ID-when-updating-ID-locations.patch --]
[-- Type: text/x-patch, Size: 1048 bytes --]

From d3262aafe1afef3875de83ff46096d54c5c086fe Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Wed, 19 Feb 2020 13:23:40 -0800
Subject: [PATCH] Skip entries with no ID when updating ID locations

* lisp/org-id.el (org-id-update-id-locations): Saves a little chatter
about duplicate "nil" IDs.
---
 lisp/org-id.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org-id.el b/lisp/org-id.el
index 91142917a..369b494ab 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -503,10 +503,11 @@ When FILES is given, scan also these files."
                        i nfiles file))
 	    (when (file-exists-p file)
 	      (insert-file-contents file nil nil nil 'replace)
-	      (setq ids (org-map-entries
-			 (lambda ()
-			   (org-entry-get (point) "ID"))
-			 "ID<>\"\""))
+	      (setq ids (delq nil
+			      (org-map-entries
+			       (lambda ()
+				 (org-entry-get (point) "ID"))
+			       "ID<>\"\"")))
 	      (dolist (id ids)
 		(if (member id seen-ids)
 		    (progn
-- 
2.25.1


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

* Re: [PATCH] Skip entries with no ID when updating ID locations
  2020-02-19 21:26 [PATCH] Skip entries with no ID when updating ID locations Eric Abrahamsen
@ 2020-02-19 21:37 ` Bastien
  2020-02-19 21:52   ` Eric Abrahamsen
  2020-02-21 10:31   ` Roland Everaert
  0 siblings, 2 replies; 4+ messages in thread
From: Bastien @ 2020-02-19 21:37 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Would the attached patch be acceptable? It's no big deal, just skips
> entries with no ID property when updating all ID locations. I couldn't
> figure out why I had several thousand "Duplicate ID "nil"" warnings in
> the *Messages* buffer after updating ID locations.

A welcome enhancement - applied, thanks!

-- 
 Bastien

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

* Re: [PATCH] Skip entries with no ID when updating ID locations
  2020-02-19 21:37 ` Bastien
@ 2020-02-19 21:52   ` Eric Abrahamsen
  2020-02-21 10:31   ` Roland Everaert
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Abrahamsen @ 2020-02-19 21:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Would the attached patch be acceptable? It's no big deal, just skips
>> entries with no ID property when updating all ID locations. I couldn't
>> figure out why I had several thousand "Duplicate ID "nil"" warnings in
>> the *Messages* buffer after updating ID locations.
>
> A welcome enhancement - applied, thanks!

Cool, thanks.

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

* Re: [PATCH] Skip entries with no ID when updating ID locations
  2020-02-19 21:37 ` Bastien
  2020-02-19 21:52   ` Eric Abrahamsen
@ 2020-02-21 10:31   ` Roland Everaert
  1 sibling, 0 replies; 4+ messages in thread
From: Roland Everaert @ 2020-02-21 10:31 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Eric Abrahamsen

A note related to duplicate IDs, the messages only shows one of the
duplicate, so it is not easy to know which one to change.

This have implication when creating links to headline using their IDs.

And does the current algorithm for finding duplicates check their
reference through the "org db"? 

Regards,

Roland.

Bastien writes:

> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Would the attached patch be acceptable? It's no big deal, just skips
>> entries with no ID property when updating all ID locations. I couldn't
>> figure out why I had several thousand "Duplicate ID "nil"" warnings in
>> the *Messages* buffer after updating ID locations.
>
> A welcome enhancement - applied, thanks!


-- 
Luke, use the FOSS

Sent from Emacs

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

end of thread, other threads:[~2020-02-21 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 21:26 [PATCH] Skip entries with no ID when updating ID locations Eric Abrahamsen
2020-02-19 21:37 ` Bastien
2020-02-19 21:52   ` Eric Abrahamsen
2020-02-21 10:31   ` Roland Everaert

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