From: tony aldon <tony.aldon.adm@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ol: Fix org-link-search
Date: Wed, 20 Apr 2022 18:10:31 +0200 [thread overview]
Message-ID: <CACWitSDq6W+=0hhBV6NS1iydHSmCK5jmgosV45hS=_aF_kMshA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 304 bytes --]
Hey everyone,
If I'm not wrong, name defined after #+NAME: should be match first
before trying a fuzzy search in the function `org-link-search`.
You can find the patch in attachment (hope it feat in Tiny changes
[though I also sent a request today for the FSF agreement]).
Have a nice day.
Tony Aldon
[-- Attachment #1.2: Type: text/html, Size: 357 bytes --]
[-- Attachment #2: 0001-ol-Fix-org-link-search.patch --]
[-- Type: text/x-patch, Size: 1647 bytes --]
From ba4028e71fb41b6e4367d3e85846526dd7577d52 Mon Sep 17 00:00:00 2001
From: tony <tony.aldon.adm@gmail.com>
Date: Wed, 20 Apr 2022 17:58:34 +0200
Subject: [PATCH] ol: Fix org-link-search
* lisp/ol.el (org-link-search): Replace wrong property :name by
:value. Name defined after #+NAME: should be match first before
trying a fuzzy search.
* testing/lisp/test-ol.el (test-ol/search): New test.
TINYCHANGE
---
lisp/ol.el | 2 +-
testing/lisp/test-ol.el | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lisp/ol.el b/lisp/ol.el
index 1b2bb9a9a..4554941b6 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1189,7 +1189,7 @@ of matched result, which is either `dedicated' or `fuzzy'."
(goto-char (point-min))
(while (re-search-forward name nil t)
(let* ((element (org-element-at-point))
- (name (org-element-property :name element)))
+ (name (org-element-property :value element)))
(when (and name (equal words (split-string name)))
(setq type 'dedicated)
(beginning-of-line)
diff --git a/testing/lisp/test-ol.el b/testing/lisp/test-ol.el
index ddcc570b3..3e5b9c7cd 100644
--- a/testing/lisp/test-ol.el
+++ b/testing/lisp/test-ol.el
@@ -492,6 +492,18 @@
(buffer-substring (point) (line-end-position))))))
\f
+;;; Search
+
+(ert-deftest test-ol/search ()
+ "Test `org-link-search'."
+ ;; Look for name defined after #+NAME:
+ (should
+ (equal 'dedicated
+ (org-test-with-temp-text "foo\n#+NAME: foo"
+ (let ((org-link-search-must-match-exact-headline nil))
+ (org-link-search "foo"))))))
+
+\f
;;; Link regexps
--
2.17.1
next reply other threads:[~2022-04-20 16:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 16:10 tony aldon [this message]
2022-04-21 5:39 ` [PATCH] ol: Fix org-link-search Ihor Radchenko
[not found] ` <CACWitSA6eYp68L3u3HFxA-U-EE=s9ZDQxKaHmaFPdL+UxXVEOw@mail.gmail.com>
2022-04-21 10:25 ` tony aldon
2022-04-21 13:00 ` Ihor Radchenko
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACWitSDq6W+=0hhBV6NS1iydHSmCK5jmgosV45hS=_aF_kMshA@mail.gmail.com' \
--to=tony.aldon.adm@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).