emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Skip entries with no ID when updating ID locations
Date: Wed, 19 Feb 2020 13:26:38 -0800	[thread overview]
Message-ID: <87r1yqb75d.fsf@ericabrahamsen.net> (raw)

[-- 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


             reply	other threads:[~2020-02-19 21:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 21:26 Eric Abrahamsen [this message]
2020-02-19 21:37 ` [PATCH] Skip entries with no ID when updating ID locations Bastien
2020-02-19 21:52   ` Eric Abrahamsen
2020-02-21 10:31   ` Roland Everaert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1yqb75d.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).