From f92e12a9482613d4b1d27090fac8d2667b094fdb Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 19 Feb 2012 18:48:41 +0100 Subject: [PATCH] Implement "ref" internal link type in Org buffers * lisp/org.el (org-link-search): Handle "ref" internal link types. A [[ref:some-name]] link points to a "#+name: some-name" in the same buffer. --- lisp/org.el | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index a81f7fc..ea06863 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9875,6 +9875,16 @@ visibility around point, thus ignoring ;; First check if there are any special search functions ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) ;; Now try the builtin stuff + ;; Ref internal link. + ((and (string-match "^ref:\\(.*\\)" s0) + (let ((name (org-trim (match-string 1 s0)))) + (save-excursion + (goto-char (point-min)) + (and (re-search-forward + (format "^[ \t]*#\\+name: %s" name) nil t) + (setq type 'dedicated pos (match-beginning 0)))))) + (goto-char pos)) + ;; Custom-id ((and (equal (string-to-char s0) ?#) (> (length s0) 1) (save-excursion -- 1.7.9.1