From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: File local circular links Date: Thu, 3 Sep 2015 15:42:38 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXUmm-0008Qb-MD for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:42:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXUml-0000kH-J7 for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:42:40 -0400 Received: from mail-vk0-x233.google.com ([2607:f8b0:400c:c05::233]:32836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXUml-0000k5-EU for emacs-orgmode@gnu.org; Thu, 03 Sep 2015 09:42:39 -0400 Received: by vkbf67 with SMTP id f67so24473504vkb.0 for ; Thu, 03 Sep 2015 06:42:38 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Hi all I use a hack to work around a missing feature that I would like to call "file local circular links". It works until release_8.2.10-2341-g8094d01 but stops with release_8.2.10-2342-gcfe5bc9 commit cfe5bc97f8b18ccbf49d0764746c7563ce8d29da Author: Nicolas Goaziou Date: Mon Aug 3 01:06:32 2015 +0200 Fix link search and I would like to ask for some help to get it work again. File local circular links does this: C-c C-o on line 1 of the file ------------------------------------- [[:file local circular link:]] some text [[:file local circular link:]] ------------------------------------- moves to line 3 and C-c C-o again moves back to line 1. (It does not follow all links when there are more than two but this limitation is a different story.) The hack that I used so far is #+BEGIN_SRC emacs-lisp (defun f-org-link-exec (str) (let* ((context (org-element-context)) (link (let ((up (org-element-property :parent context))) (if (eq (org-element-type up) 'link) up context))) (avoid-pos (org-element-property :begin link))) (cond ;; [[<>]]: Remove the angular brackets to let `org-link-search' ;; match `str' as an angular bracket link. ((string-match "^<<\\(.*\\)>>$" str) (let ((org-execute-file-search-functions nil)) (org-link-search (match-string 1 str) 'dedicated avoid-pos))) ;; [[_:xy:]] (abbreviated with "#+LINK: _ file:bla.org:::") or ;; [[:xy:]]: Bind `org-link-search-must-match-exact-headline' to nil ;; temporarily. ((string-match-p "^:.*:$" str) (let ((org-execute-file-search-functions nil) (org-link-search-must-match-exact-headline nil)) ;; The leading part may be "[[link_abbreviation" or just "[[". (org-link-search (concat "\\[\\[[^:]*" (regexp-quote str) "\\]\\]") 'fuzzy avoid-pos)))))) (add-hook 'org-execute-file-search-functions 'f-org-link-exec) #+END_SRC The problematic part is the use of org-link-search which changed. In the above example it is called as #+BEGIN_SRC emacs-lisp (let ((org-execute-file-search-functions nil) (org-link-search-must-match-exact-headline nil)) (org-link-search "\\[\\[[^:]*:file local circular link:\\]\\]")) #+END_SRC and after the commit org-link-search errors with "cond: No match for fuzzy expression: \[\[[^:]*:file local circular link:\]\]". To me it looks like if support for regular expressions for fuzzy links has been dropped. I can not use the regexp search here because it invokes the org-occur sparse tree. How can I deal with this? Michael