From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: PATCH Make org-open-at-point only ask once Date: Mon, 29 Aug 2011 13:25:01 +0200 Message-ID: <87ty90jw8i.fsf@gmail.com> References: <20110828200542.GS5700@0x63.nu> <87liuclmey.fsf@gmail.com> <20110829092146.GT5700@0x63.nu> <87d3folfu4.fsf@gmail.com> <20110829105345.GU5700@0x63.nu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxzyH-0006YT-29 for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 07:25:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxzyF-00081v-Qe for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 07:25:41 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:54657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxzyF-00081r-I8 for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 07:25:39 -0400 Received: by wyi11 with SMTP id 11so4421750wyi.0 for ; Mon, 29 Aug 2011 04:25:38 -0700 (PDT) In-Reply-To: <20110829105345.GU5700@0x63.nu> (Anders Waldenborg's message of "Mon, 29 Aug 2011 12:53:45 +0200") 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: Anders Waldenborg Cc: emacs-orgmode@gnu.org Anders Waldenborg writes: > On Mon, Aug 29, 2011 at 11:36:19AM +0200, Nicolas Goaziou wrote: >> Maybe we should define a consistent link search: ignore the narrowing >> but first search in current sub-tree, if that fails (any error, I guess) >> search in current tree and if that one fails too, search in the whole >> buffer. > > So something with the same semantics as this: > > (defun find-nearest-heading-named (l) > (unless (find-heading-in-current-subtree l) > (up-one-level) > (find-nearest-heading-named l))) Recursively, yes. And enclosing this with (org-with-wide-buffer ...) macro. > i.e find the target with its parent headings list sharing the longest > prefix with current point's. > > * A > ** B > * C > ** B > ** D > *** B > *** E > > A link to B inside E would go to C/D/B because (C D B) shares longer > prefix with (C D E) than (C B) and (A B) does. To be sure we understand it the same way: 1. Go to E and search from there: failure. 2. Go to D and search from there: success. And if there's a link to D in A/B: 1. Search from B: failure. 2. Search from A: failure. 3. Search from (point-min): success. Also, I would use "hierarchically" (or the like) instead of "nearest", which can be confusing, as in this example: * A ** F * B ** C *** D **** F Linking F from B should point to **** F instead of ** F while the latter is nearer if considered distance is positive difference between buffer positions. What do you (or anyone reading this) think? Regards, -- Nicolas Goaziou