From 91153ff14f495b53639cdcaf23489facb8027247 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 4 Nov 2018 09:06:28 +0100 Subject: [PATCH] Tiny refactoring * lisp/org.el (org-link-search): Tiny refactoring. --- lisp/org.el | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 71921cfe8..17aeafb73 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10469,18 +10469,12 @@ of matched result, which is either `dedicated' or `fuzzy'." (let ((element (org-element-at-point))) (when (and (memq (org-element-type element) '(example-block src-block)) - ;; Build proper regexp according to current - ;; block's label format. - (let ((label-fmt - (regexp-quote - (or (org-element-property :label-fmt element) - org-coderef-label-format)))) - (save-excursion - (beginning-of-line) - (looking-at (format ".*?\\(%s\\)[ \t]*$" - (format label-fmt coderef)))))) + (org-match-line + (concat ".*?" (org-src-coderef-regexp + (org-src-coderef-format element) + coderef)))) (setq type 'dedicated) - (goto-char (match-beginning 1)) + (goto-char (match-beginning 2)) (throw :coderef-match nil)))) (goto-char origin) (error "No match for coderef: %s" coderef))))