Org-mode mailing list
 help / color / mirror / Atom feed
From: Marc-Oliver Ihm <>
To: "" <>
Subject: [PATCH] choices in org-id-find for handling missing ids
Date: Sat, 12 Jun 2021 16:16:28 +0200 (CEST)
Message-ID: <> (raw)

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


please find attached a patch to allow more flexible handling of missing ids in org-id-find; some people (like me) tend to lose ids now and then and may benefit from more choices.

The current behaviour of calling org-id-update-id-locations is pretty perfect for situations where the id has been moved to another file (which will be the case in most situations, I guess). However, sometimes an id has simply been deleted and then searching for it in all files can not be helpful. Especially lisp-code calling org-id-find might want to handle things on its own.

To this goal, a new custom org-id-action-on-missing-id has been added; reproducing its description from the patch:

> (defcustom org-id-action-on-missing-id 'update
>   "Special action to be taken, if `org-id-find' cannot find an id.
> With 'update (default), org-id-find will silently call
> `org-id-update-id-locations' and try again; this will help,
> e.g. if you have moved the id to another file.
> With 'exception, the exception 'not-found will be thrown, which
> can be useful, if `org-id-find' is called from within lisp and
> the caller wants to handle the situation.
> With 'error, a descriptive error will be raised, causing the
> current command to terminate."
>   :group 'org-id
>   :type '(choice
> 	  (const :tag "Run `org-id-update-id-locations' if an id cannot be found" update)
> 	  (const :tag "Throw exception `not-found'" exception)
> 	  (const :tag "Raise an error" error)
>           ))

the handling in org-id-find is straightforward.

The default corresponds to the current behaviour.
I would like to ask for opinions/discussion on this patch and maybe see it applied if found fit.

Best regards
Marc Ihm

[-- Attachment #2: 0001-choices-in-org-id-find-for-handling-missing-ids.patch --]
[-- Type: application/octet-stream, Size: 1993 bytes --]

             reply	other threads:[~2021-06-12 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 14:16 Marc-Oliver Ihm [this message]
2021-06-13  5:51 ` Marc Ihm

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:

  List information:

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

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ \
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone