emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] choices in org-id-find for handling missing ids


From: Marc Ihm
Subject: Re: [PATCH] choices in org-id-find for handling missing ids
Date: Sun, 13 Jun 2021 07:51:31 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hi once more,
well after sending this patch I noticed, that org-id-update-id-locations has become orders of magnitude faster on my system; with org 9.4 it takes seconds instead of minutes as with org 9.3. Which is great news :-) This alone may dratically reduce the need for changing the behaviour of org-id-find as contained in my patch.
So you may feel free to ignore it ...
Best Marc

Am 12.06.2021 um 16:16 schrieb Marc-Oliver Ihm:
Hi,

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]