From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id IIl6LKab8WVFEQEAe85BDQ:P1 (envelope-from ) for ; Wed, 13 Mar 2024 13:27:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id IIl6LKab8WVFEQEAe85BDQ (envelope-from ) for ; Wed, 13 Mar 2024 13:27:18 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Nx7RVI6D; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1710332838; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=HrES3luNXGcFnURO5SPbp83PwjZqr3wh00kAqUIIn8I=; b=NxC14I52u7UaPJ7VjJQQdD9JDB0t/cOrtiDz3yoLZJq1N0aXAWf8S5GZbBLsL8Q1gR95Fw 20da1nDXRREB/NclFDrZNs2w5j0PiAoc5ymypmRjAqSkrdeNhNAfs+w9eeqoVFvO+X55G/ fI2ekrRMaUa8AGVD5pUCYBX4Unz5z9zMvuVaU/QKsDGCIGbUtYeMZ/JcxkgObp1dF5kvaB WmFjbjNFuTF0+3vURiO3qGlJ/dMfuSwPNZ7CIEgzRN49aakcVwYIuK/DomDen1G/F3r2Le kRNLyC2sql2XVsei01PiKFEtuwfkaakl9NAN06ycK/4dAmIqR5vcyoXe1Io2ew== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Nx7RVI6D; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1710332838; a=rsa-sha256; cv=none; b=aUyJtpAhNl4qLZ5dMJDrCcujbQCTj+X1iWuEzSZ0JygyWi1qgrK86T2oLq+VdHkZwdL+Qd pR5BGo+m9khOE8xnyT5LwBnVJYy9Cd3F92sdwGtFXAJC+2gH9rGH4FgoXRVF9PP0Bx9Vmh eG9AokRGG/Zx+XMHK40FErDItzmGrNgfSE198e75PgSCkt3tL6WZg17cJ/OpCgDHTztnXS rd0IQyFm17uV3/hSIS5vnxyxMEfO9p4nJarRGKYuwjm8qQv16rdmWOMqjELT48OWWiRBbs Uv0nZqw1Hv4hNcMpmCZ7FM4g6I8m+nXZjm88CyOz4sjkGNFtylx+55c5MH5GDA== 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 53CE15637E for ; Wed, 13 Mar 2024 13:27:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkNgp-0007a6-RO; Wed, 13 Mar 2024 08:26:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNgn-0007Zp-8z for emacs-orgmode@gnu.org; Wed, 13 Mar 2024 08:26:33 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNgi-0004g4-O9 for emacs-orgmode@gnu.org; Wed, 13 Mar 2024 08:26:32 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9AABC240103 for ; Wed, 13 Mar 2024 13:26:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1710332785; bh=DNveWO7EDISGuLsHYyU7hbfUhKBPM5mMVDWboPARdWw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=Nx7RVI6DVErLf7DNAmqzmnoJRzko2XLQPo7zfUyB3KLLJgLwy/wTcrJes+H8xm2Xu Y9LkgPv7fWnpRVAT9w80Pz5Y15KQA/JSpobRf/MwAGjEAJn5q50BT+Jkqgk1YS9sAL nkfaH9njLRIAinWvafOI2XxVD4oDYUHooJB0QxKa8bmP1qYLQcrDMIQU0K64YVSMon PD7YXDGl3KQTzu882od+GEffNF33jA8ns4h43Ik1sRosXkyB6kszhvjqAknYRLuUUH GBKt5sAbYyp0AghVn+p6moUWqU5gDUiC3504s/fe9m9QoSuXf0O8tHupv/C37Th0jy y8di4okNHtzOA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TvqW46cj8z6twB; Wed, 13 Mar 2024 13:26:24 +0100 (CET) From: Ihor Radchenko To: Rick Lupton Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations In-Reply-To: <715e7a79-2107-4c61-8b7c-26b68e680451@app.fastmail.com> References: <715e7a79-2107-4c61-8b7c-26b68e680451@app.fastmail.com> Date: Wed, 13 Mar 2024 12:30:37 +0000 Message-ID: <87zfv2wbyq.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.49 X-Spam-Score: -9.49 X-Migadu-Queue-Id: 53CE15637E X-Migadu-Scanner: mx13.migadu.com X-TUID: R9a/r5dJihXc "Rick Lupton" writes: > Since updating the org-id code [1] to use the standard org-link registered functions instead of hard-coding org-id opening, I have a problem using org-roam. > > org-roam overwrites the :follow function for "id" links from the build-in `org-id-open' to its own `org-roam-id-open' (https://github.com/org-roam/org-roam/blob/8667e441876cd2583fbf7282a65796ea149f0e5f/org-roam-id.el#L91). The only change between these functions is to insert a call to try `org-roam-id-find' before trying `org-id-find', which uses org-roam's cached sqlite database to find the id (https://github.com/org-roam/org-roam/blob/8667e441876cd2583fbf7282a65796ea149f0e5f/org-roam-id.el#L70-L71) > > As well as being messy, my specific problem is that the improvements to open search strings in org-id links are no longer enabled when org-roam is loaded. > > It seems reasonable that a library might want to provide its own way of locating org-ids. The attached patch adds a new hook variable `org-id-find-functions` which contains functions doing the same job as `org-id-find' that should be tried first. Then all org-roam needs to do is add its `org-roam-id-find' to the hook. > > Does this seem like a good idea? I think that we can do it simpler. Something like (defun yant/message-me (&rest _) (message "I am here!") nil) ; return nil to pass the turn (gv-define-setter org-link-get-parameter (value type key) `(org-link-set-parameters ,type ,key ,value)) (add-function :before-until (org-link-get-parameter "id" :follow) #'yant/message-me) The idea is to use Emacs' advice machinery to allow third-party code alter the functions stored in link parameters. Either way, org-roam needs to be adapted in order to support the changes in org-id. My variant appears to be simpler. We just need to add `gv-define-setter ...' and maybe also document the `add-function' approach in the manual. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at