[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] PATCH Make org-open-at-point only ask once
From: |
Nicolas Goaziou |
Subject: |
Re: [O] PATCH Make org-open-at-point only ask once |
Date: |
Mon, 29 Aug 2011 13:25:01 +0200 |
Anders Waldenborg <address@hidden> 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