emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Jack Kamm <jackkamm@tatersworld.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug? org-id-find not finding some IDs
Date: Thu, 04 Aug 2022 10:24:29 +0800	[thread overview]
Message-ID: <87v8r8hhk2.fsf@localhost> (raw)
In-Reply-To: <87r11zifjy.fsf@gmail.com>

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

Jack Kamm <jackkamm@tatersworld.org> writes:

> For a minimal example, put the following in test.org:
>
>> * Headline 1
>> :PROPERTIES:
>> :ID:       b1569c92-3872-4ab9-80eb-274c4950991e
>> :END:
>
> Then:
>
> 1. emacs -Q test.org
> 2. C-x b *scratch*
> 3. M-: (org-id-find "b1569c92-3872-4ab9-80eb-274c4950991e")
>
> Which returns nil. Also, "C-h v org-id-files" doesn't contain
> test.org.

This is indeed inconsistent. The current behaviour is to scan only files
where it is known that IDs are present.

Can you try the attached patch?

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-id-update-locations-Scan-all-the-open-Org-buffer.patch --]
[-- Type: text/x-patch, Size: 1644 bytes --]

From 5d166219c9af1f34dccebac55249db926fcfbbe1 Mon Sep 17 00:00:00 2001
Message-Id: <5d166219c9af1f34dccebac55249db926fcfbbe1.1659579786.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Thu, 4 Aug 2022 10:21:59 +0800
Subject: [PATCH] org-id-update-locations: Scan all the open Org buffers

* lisp/org-id.el (org-id-update-id-locations): Always scan all the
open Org file buffers for IDs.

Fixes https://orgmode.org/list/87r11zifjy.fsf@gmail.com
---
 lisp/org-id.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-id.el b/lisp/org-id.el
index f54e7280a..fe2f5f328 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -491,8 +491,8 @@ (defun org-id-decode (id)
 (defun org-id-update-id-locations (&optional files silent)
   "Scan relevant files for IDs.
 Store the relation between files and corresponding IDs.
-This will scan all agenda files, all associated archives, and all
-files currently mentioned in `org-id-locations'.
+This will scan all agenda files, all associated archives, all open Org
+files, and all files currently mentioned in `org-id-locations'.
 When FILES is given, scan also these files.
 If SILENT is non-nil, messages are suppressed."
   (interactive)
@@ -515,6 +515,8 @@ (defun org-id-update-id-locations (&optional files silent)
 		       org-id-extra-files)
 		     ;; All files known to have IDs.
 		     org-id-files
+                     ;; All Org files open in Emacs.
+                     (mapcar #'buffer-file-name (org-buffer-list 'files t))
 		     ;; Additional files from function call.
 		     files)))))
          (nfiles (length files))
-- 
2.35.1


  reply	other threads:[~2022-08-04  2:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  1:45 Bug? org-id-find not finding some IDs Jack Kamm
2022-08-04  2:24 ` Ihor Radchenko [this message]
2022-08-05  5:32   ` Jack Kamm
2022-08-05 12:46     ` Ihor Radchenko
2022-08-14 17:35       ` Jack Kamm
2022-08-16  4:26         ` Ihor Radchenko
2022-08-20 15:27           ` Jack Kamm

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=87v8r8hhk2.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackkamm@tatersworld.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).