From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +DXVM/vuYGLUrwAAbAwnHQ (envelope-from ) for ; Thu, 21 Apr 2022 07:43:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uKrmM/vuYGIfkgAAauVa8A (envelope-from ) for ; Thu, 21 Apr 2022 07:43:23 +0200 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 820CB810C for ; Thu, 21 Apr 2022 07:43:23 +0200 (CEST) Received: from localhost ([::1]:49790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhPb8-0001gm-JK for larch@yhetil.org; Thu, 21 Apr 2022 01:43:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhPX0-0001g9-1P for emacs-orgmode@gnu.org; Thu, 21 Apr 2022 01:39:09 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:34693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhPWy-0007kK-Ix for emacs-orgmode@gnu.org; Thu, 21 Apr 2022 01:39:05 -0400 Received: by mail-pf1-x434.google.com with SMTP id x80so4017593pfc.1 for ; Wed, 20 Apr 2022 22:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=bWleuP79VSme8q02vgNWDrzaD4sfN+EyYXmxFSIRn9M=; b=nZV3WKlBYEndlq4JuPYGIxrOKRdc3VmnDiE4+zY4qUBC1reP4pII/vdPrxdZAlq2fv 8nJLfdx8hGMksADIjiN+17ePYgREUa2NGmjWakQpJ/aqOE9pvMmg1uNGKVncSqiCOzCu yml40oVa3rekba4PtGHJc75TqmbRFpQrc1G2kjpdV1wQcQNO1QtmU/jeotn5qA/xn05+ aH81aPtL1eLRmhQkEEJlV53MmfGxyGAHu7lRbL49qztQHMuKdL1oamKFDDHJNOkSfQW6 Bs/AxbyNY7BD1IGxPmqxsnRfCw19rmDU8lsUHxtcodRggKGuaEIJuSKTz49U0bB7ez0K +tOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=bWleuP79VSme8q02vgNWDrzaD4sfN+EyYXmxFSIRn9M=; b=2jkXL32jQuspO6r9QchOxhZiDjj3q8QSpgD9Jh/Nb/2KYzLmY0fdswdsBHl2en1EJ8 ye3umW5qLo1aifLwNswhzeDjB2EuUluLiQ7JgX7ktTh6evrE/VnVxNJlERNC/2ApMu3B e5TGf3SfAp/R9NAeUmu7sd6zEWMnbuoQ0mak32c+6DMTUJb7dQsh7mkt6+qWvyqCS5De HARrXJLMbKWVWwzjucsYjRrdCTp/bYWKVgPgge+6UtuglTyAGlqqoHeqwzU1tjjAbZCN Dpj4PvELwsT/B3z8JDt48ODNASPazavCo5EWbIJsnBQP3sVVnlllbpsvE9HYOAOPhzTg 1A4w== X-Gm-Message-State: AOAM530rcy+MxrdtF5XGvPKobK/b8DaGbm02m7KTmBrg27WQvoJG1UDf iwB2LjhvrhSJ2j7KC87EIjU= X-Google-Smtp-Source: ABdhPJxbCg7YdvWYxUDrBhofDQW0Eo0pBVbAHQe7d/2R5XIvuN7XXWBGC3VLaFM+Rjx5xcifuS3Y4g== X-Received: by 2002:a63:f44e:0:b0:3aa:e66:f774 with SMTP id p14-20020a63f44e000000b003aa0e66f774mr15112306pgk.381.1650519543119; Wed, 20 Apr 2022 22:39:03 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id q5-20020a056a00084500b0050ace4a699dsm4206540pfk.95.2022.04.20.22.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 22:39:02 -0700 (PDT) From: Ihor Radchenko To: tony aldon Subject: Re: [PATCH] ol: Fix org-link-search In-Reply-To: References: Date: Thu, 21 Apr 2022 13:39:56 +0800 Message-ID: <87tuan3sgj.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=yantar92@gmail.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650519803; 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=bWleuP79VSme8q02vgNWDrzaD4sfN+EyYXmxFSIRn9M=; b=QA267w12Tsr0Mq9+5JkhwNchIr3vpP2OKHRy0Z9HEqx5OPAh3hWGQ25ZYnU2IvpfcM4wQx TeaXjZ9IFPLay0hId4uAU6oDWiwYs/axlTgJgZYcOHSYq6741Arvig3uvQWdjDcVJe5LTx UWM7GUVvcKdiOUrHIUiEEeo11+e49XaY1AqA/x0Hoh6955WoUDQus7P91sHFRdd+AeYU4h 3KQnaZiDdNjK0ivZo1KhyJg/NsNh7ml4hFZWiYQflz2kgIBNOVa31I4V6amLKbXyylN2Pl YNrLDQNfruGx5bpuLi/mWaRsYLR4iStejh/ky9asjGGonLZQ18WHJBLZMHWHjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650519803; a=rsa-sha256; cv=none; b=eK7AbQmu28URpU+LuPJ7Q2F1MpbX8TaBCnzt9uGJXExiNNkJxwJnkq5zpQ1PlrC7XY/Xj3 BK7IH4Fg6HDPazl6CQdAtxMvcGx1nQKqSXSOJLt1yABaJrYZmC5xH4+iPVNGZrHUm/OSZ2 wMKh6qAtITme38FjZm3/X4gPloFW6cDcuU5zO+KxzgIPBEMYJlLJm1zXM4/XAMxk51iDIt TgAxl6Muc6/lhCVWMyzHaBrMOpjTs5bfTQKGHqzPEbM7aXuw4waxVf37SnlnALy/LMLd1J z2+db+yGYpC/acIVOthg8GJBhma9QgdIgVXT8lvS2i2dTH3Ea8TeWFHfl1TkEw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nZV3WKlB; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -9.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nZV3WKlB; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 820CB810C X-Spam-Score: -9.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: OUn4F+FdyMDm tony aldon writes: > If I'm not wrong, name defined after #+NAME: should be match first > before trying a fuzzy search in the function `org-link-search`. > ... > - (name (org-element-property :name element))) > + (name (org-element-property :value element))) I think you are missing something. A standaline #+name: some name is a keyword, not an element name, but a generic keyword element. Named elements are the elements with affiliated keywords (not ordinary keywords): #+name: some other name Some element that can have affiliated keywords. It may be a paragraph, like here or e.g. source block. Link search should not try to search standalone keywords and hence it is sufficient to check for :name element property. :value will miss e.g. named source blocks. Try running (org-element-at-point) on the first and second #+name in org buffer. Best, Ihor