From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QJ4XCuzBxGAzQwAAgWs5BA (envelope-from ) for ; Sat, 12 Jun 2021 16:17:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id cMGWBezBxGBTFwAAbx9fmQ (envelope-from ) for ; Sat, 12 Jun 2021 14:17:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AC4ED27A4B for ; Sat, 12 Jun 2021 16:17:15 +0200 (CEST) Received: from localhost ([::1]:46488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls4Rm-000668-LX for larch@yhetil.org; Sat, 12 Jun 2021 10:17:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls4R9-000659-2s for emacs-orgmode@gnu.org; Sat, 12 Jun 2021 10:16:35 -0400 Received: from rspamd-proxy-01.udag.de ([62.146.106.33]:33656 helo=smtp02-ext3.udag.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls4R7-0003TU-2p for emacs-orgmode@gnu.org; Sat, 12 Jun 2021 10:16:34 -0400 Received: from ox-api-1.vpn.udag.de (unknown [62.146.80.66]) by smtp02-ext3.udag.de (Postfix) with ESMTPA id 46669E034B for ; Sat, 12 Jun 2021 16:16:29 +0200 (CEST) Date: Sat, 12 Jun 2021 16:16:28 +0200 (CEST) From: Marc-Oliver Ihm To: "emacs-orgmode@gnu.org" Message-ID: <1607921150.924467.1623507388932@www.ud-mail.de> Subject: [PATCH] choices in org-id-find for handling missing ids MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_924466_1994108456.1623507388931" X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.4-Rev22 X-Originating-Client: open-xchange-appsuite Received-SPF: none client-ip=62.146.106.33; envelope-from=marc@ihm.name; helo=smtp02-ext3.udag.de X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_20=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623507435; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=x2BbGxTUrPSaEzPh0bOnWTqL7yKugqru7SffcbskpJo=; b=KNS91zL7oYGvRZ1Y5SvFS9Z+cA6D3e3RVxvU9boUqFeNydu5jq7kZjp5s8HRW7ZDrBNJKJ oX+eBFR3a4QtozCSxQpaCVoqb+yH6EvGdlz60ZojtVVJYcmJefc+B0E1dsWoXBBIk/jPwm /PtAvfTbtQw9sfzzhdH0u92TBpyzHUDcinAvGzlR/oKgx6t0Nt9sF22GWSj2Mh5cmYr1+4 Bt0lnTIYqaks+EHlMAoeUkxnCZsx0hz47v2w9MDIG+xau4VfZ7hKnSBYAOYe9xE889su/A VILniOTzsGRxGylNXR+ic4/6nP1VF+Of+Qs65v3M1Cd737t0O2czZuen+7lC1A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623507435; a=rsa-sha256; cv=none; b=sT6zHOlpJSYoF14mphhdPgW/26R/9e4N+5y0y8WY2pCmgYVAvMvD76WT1RD9tHTlenT1Ut pYcvmFEHNccIe1cdFCn3XRcKzO8nRjioTfQmavbZEQhYIBURrRqaG8SRII7F+OAKTpC9Za eGskKrfdBcWVNTWYH9HZoWE384lCPdL688VdkpRHMCQwnwGN3SO7l4IIYvTF1pPUBSGX1g j6O2WF19x/iL85FEHqAiml0ObEZ1NZMJwoZlx8p/+VuF3gasx8v39rtQ7JsDNdW5ugbz1M CzvPyOmLxWHH3t1TM8l+bN4mphnzN/+6Zhz1j1tUELFzcBTH3onkfRAyQuUisg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: AC4ED27A4B X-Spam-Score: -1.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: xujJ4UbBRppN ------=_Part_924466_1994108456.1623507388931 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 ------=_Part_924466_1994108456.1623507388931 Content-Type: application/octet-stream; name=0001-choices-in-org-id-find-for-handling-missing-ids.patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=0001-choices-in-org-id-find-for-handling-missing-ids.patch X-Part-Id: d219e96a5dd4404f95da5b7cf6e5d980 RnJvbSA3MGZiNmY0YWIyNmU5ZmFlNjdkN2I3OTAwYTBjNmVjMTMyMTk5MTEyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXJjIElobSA8bWFyY0BpaG0ubmFtZT4KRGF0ZTogU2F0LCAx MiBKdW4gMjAyMSAxNTo0OTo1MCArMDIwMApTdWJqZWN0OiBbUEFUQ0hdIGNob2ljZXMgaW4gb3Jn LWlkLWZpbmQgZm9yIGhhbmRsaW5nIG1pc3NpbmcgaWRzCgotLS0KIGxpc3Avb3JnLWlkLmVsIHwg MjYgKysrKysrKysrKysrKysrKysrKysrKysrKy0KIDEgZmlsZSBjaGFuZ2VkLCAyNSBpbnNlcnRp b25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC9vcmctaWQuZWwgYi9sa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taW4tZmlsZSBpZCBmaWxlIG1hcmtlcnApKSkpCi0tIAoyLjMwLjIKCg== ------=_Part_924466_1994108456.1623507388931--