From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [ISSUE] links navigation not consistent behavior Date: Thu, 04 Apr 2019 15:54:26 +0200 Message-ID: <87tvfd7u5p.fsf@nicolasgoaziou.fr> References: <87k1gj3n5q.fsf@gmail.com> <87zhp8i2q9.fsf@nicolasgoaziou.fr> <87r2ajrr2r.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:33530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hC2p7-0002qB-Kv for emacs-orgmode@gnu.org; Thu, 04 Apr 2019 09:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hC2p6-0005o7-K8 for emacs-orgmode@gnu.org; Thu, 04 Apr 2019 09:54:33 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:49193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hC2p6-0005jt-Al for emacs-orgmode@gnu.org; Thu, 04 Apr 2019 09:54:32 -0400 In-Reply-To: <87r2ajrr2r.fsf@alphaville.usersys.redhat.com> (Nick Dokos's message of "Wed, 03 Apr 2019 12:28:28 -0400") 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" To: Nick Dokos Cc: emacs-orgmode@gnu.org Hello, Nick Dokos writes: > | I can reproduce this and traced it to this code: > | > | ,---- > | | (catch :found > | | (while (funcall search-fun org-link-any-re nil t) > | | (pcase (org-element-lineage (org-element-context) '(link) t) ;;; <<<<< HERE > | | (`nil nil) (link > | | (goto-char (org-element-property :begin link)) (when > | | (org-invisible-p) (org-show-context)) (throw :found t)))) > | `---- > | > | which is a rewrite of org-next-link in commit 4ff8947ea8. > | > | There is some asymmetry in how forward and backward searches behave: > | > | - in the forward case, the search ends up at the end of the first > | link where `org-element-lineage' returns nil, so the loop repeats; > | we then end up at the end of the second link where > | `org-element-lineage' returns the link, we go to the beginning of > | the link and return. > | > | - in the backward case, we end up at the beginning of each link in > | turn, in which case `org-element-lineage' returns a link, so both > | links are found. > | > | So it may be that `org-element-context' should return a structure with > | the link included when called at the end of the first link or it may > | be that the search should back up one char in the forward case, before > | calling org-context. > `---- > > This may be wrong but I did not have time to continue with it: I hope it's > useful. Fixed. Thank you. Regards, -- Nicolas Goaziou