Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-05-06 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 I guess that's fine.  Still, someone who never uses narrows may find jump
 better, especially for short documents.  If the org-src window can be
 configured to show less than a fullscreen I guess I would have no concerns
 with this proposal.

I pushed a different approach. C-c C-c still jumps to definition or
throw an error if outside narrowed part of buffer. However, creating
a new footnote now doesn't break narrowing and automatically switches to
remote editing when not accessible.


Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-28 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 To have a defcustom that let you choose preferred method.  Whether the
 default should be changed I don't know.

We don't need a defcustom if we can assign a different keybinding to
each of them.

 This is not possible ATM because it doesn't handle inline footnotes at
 all (this requires some work in org-src.el, since
 `org-src--edit-element' wasn't designed to edit inline objects), and,

 There's no need IMO.  ATM it moves to the second colon and I don't see
 other logical ways to handle it.

You can reference inline footnotes too:

  [fn:label] refers to [fn:label:definition]

and you may want to edit definition from [fn:label].

 C-c C-c would then depend on a defcustom, I guess.  At least it's a pity
 if C-c C-c only works in some cases, e.g. if not narrowed.

If remote editing is improved, it can become the default for C-c C-c
when on a footnote reference. C-c C-o can jump between the definition
and the reference. We can remove C-c '.

WDYT?


Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-28 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 To have a defcustom that let you choose preferred method.  Whether the
 default should be changed I don't know.

 We don't need a defcustom if we can assign a different keybinding to
 each of them.

Perhaps.  Unless C-c C-c should reflect my preferred method.

 This is not possible ATM because it doesn't handle inline footnotes at
 all (this requires some work in org-src.el, since
 `org-src--edit-element' wasn't designed to edit inline objects), and,

 There's no need IMO.  ATM it moves to the second colon and I don't see
 other logical ways to handle it.

 You can reference inline footnotes too:

   [fn:label] refers to [fn:label:definition]

 and you may want to edit definition from [fn:label].

Right.  I had not thought of that.

 C-c C-c would then depend on a defcustom, I guess.  At least it's a pity
 if C-c C-c only works in some cases, e.g. if not narrowed.

 If remote editing is improved, it can become the default for C-c C-c
 when on a footnote reference. C-c C-o can jump between the definition
 and the reference. We can remove C-c '.

I guess that's fine.  Still, someone who never uses narrows may find jump
better, especially for short documents.  If the org-src window can be
configured to show less than a fullscreen I guess I would have no concerns
with this proposal.

Thanks,
Rasmus

-- 
There are known knowns; there are things we know that we know



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-27 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Wouldn't it only find definition in the same file?  If you use a popup
 indirect buffer narrowed to the footnote-definition in question I don't
 think these problems can exist. In any case, this would seem similar to
 the way ob handles code blocks.

 Good idea. I didn't thought about using org-src.el, but, albeit not
 perfect, it goes a long way towards avoiding these problems.

 I toyed a bit with that. Now C-' on a (non inline) footnote reference
 should edit it in a dedicated buffer.

 Feedback welcome.

I added this to org.texi.

Note, C-c ' will fail in the following example 'cause the fn definition
does not have contents-end.  I started to try fix this but feel free to
beat me to it.  I likely will not have time to look more into it until the
weekend.

foo[fn:1]
* Footnotes

[fn:1]

—Rasmus

-- 
This is the kind of tedious nonsense up with which I will not put



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-27 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 I added this to org.texi.

OK.

 Note, C-c ' will fail in the following example 'cause the fn definition
 does not have contents-end.  I started to try fix this but feel free to
 beat me to it.  I likely will not have time to look more into it until the
 weekend.

 foo[fn:1]
 * Footnotes

 [fn:1]

Fixed. Thank you.

Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-27 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Would it make sense to allow this to hook into org-footnote-action?

What do you mean by hooking it into `org-footnote-action'? To replace
default action with this?

This is not possible ATM because it doesn't handle inline footnotes at
all (this requires some work in org-src.el, since
`org-src--edit-element' wasn't designed to edit inline objects), and, as
you noticed it doesn't allow to create footnotes either (though this one
is trivial to fix).

Also, jumping to a footnote may still be useful, e.g. with nested
footnotes. It is symmetric, too.

However, interestingly, if both behaviours become mostly equivalent, we
have first-class key bindings to choose from: C-c C-o, C-c ', C-c
C-c.

 Note that new footnotes currently break the narrow, which is pretty
 annoying.

I know. This is bad, indeed.


Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-26 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 The problem is that narrow can be time-consuming to recreate.

This is why we shouldn't mess with it in the first place.

 Wouldn't it only find definition in the same file?  If you use a popup
 indirect buffer narrowed to the footnote-definition in question I don't
 think these problems can exist. In any case, this would seem similar to
 the way ob handles code blocks.

Good idea. I didn't thought about using org-src.el, but, albeit not
perfect, it goes a long way towards avoiding these problems.

I toyed a bit with that. Now C-' on a (non inline) footnote reference
should edit it in a dedicated buffer.

Feedback welcome.


Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-26 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Good idea. I didn't thought about using org-src.el, but, albeit not
 perfect, it goes a long way towards avoiding these problems.

 I toyed a bit with that. Now C-' on a (non inline) footnote reference
 should edit it in a dedicated buffer.

I tried it.  It works nicely.  I like it better than the default move to
footnote.  It's less of an interruption (to me) and it works consistently
across narrows.

Would it make sense to allow this to hook into org-footnote-action?  For
this, the popup buffer would also have to work with *new* footnotes.  Note
that new footnotes currently break the narrow, which is pretty annoying.

Thanks,
Rasmus

-- 
. . . It begins of course with The Internet.  A Net of Peers



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-25 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 In any case, how about some of these alternative approaches to the issue
 of handling footnotes from a narrowed buffer.

1. Retrieve the footnote in the minibuffer.  E.g. org-footnote-action
   shows the footnote-definition if it is outside of the narrow (and
   known) in the minibuffer?  E.g. 2. when using prefix.

 I suggested it already in this thread, i.e., if the definition is
 outside the narrowed part of the buffer, offer to widen and jump to it,
 or display the definition, or do nothing.

The problem is that narrow can be time-consuming to recreate.  Consider
this narrow where I have to edit fn:1

* top
** h1
** h2
*** h3
Txtpoint[fn:1]

To recreate the narrow I have to go to *top, narrow to the subtree,
potentially collapse *h{1,2}...

 Actually, displaying the definition could be a separate binding (e.g.,
 C-u C-c C-c), since it could be useful even outside this case.

2. Show the definition in the minibuffer as editable text (read input)
   and update it if necessary.

 Then you have to deal with out of sync buffers, closed buffers,.. 

Wouldn't it only find definition in the same file?  If you use a popup
indirect buffer narrowed to the footnote-definition in question I don't
think these problems can exist.  In any case, this would seem similar to
the way ob handles code blocks.

 I'm pretty sure that in this situation, the user is able to widen the
 buffer himself and then jump to the definition in order to edit it. This
 would be a lot of trouble for a debatable benefit.

Sure, but recreating your narrow takes time.  And it's annoying when you
want to review a section, say.

—Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .




Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-25 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Point is moved, though.  If narrow shouldn't be broken then point
 shouldn't be moved.  I.e. no move when the definition is not within the
 buffer.

Fixed in 5954f6aa25b51a3a9a8f258fb0f15ef51be31366. Thank you.

 Outside of the most trivial case (i.e., jump back and forth between the
 definition and one of its references) it sounds like it would quickly
 get in the way.

 It would only work for the most trivial case I guess.

This is why it is not worth implementing.


Regards,



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-25 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Rasmus ras...@gmx.us writes:

 Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Point is moved, though.  If narrow shouldn't be broken then point
 shouldn't be moved.  I.e. no move when the definition is not within the
 buffer.

 Fixed in 5954f6aa25b51a3a9a8f258fb0f15ef51be31366. Thank you.

 Outside of the most trivial case (i.e., jump back and forth between the
 definition and one of its references) it sounds like it would quickly
 get in the way.

 It would only work for the most trivial case I guess.

 This is why it is not worth implementing.

If it covers x%, for x large, of the realized usecases when working with a
narrowed buffer it's still worth it.

In any case, how about some of these alternative approaches to the issue
of handling footnotes from a narrowed buffer.

   1. Retrieve the footnote in the minibuffer.  E.g. org-footnote-action
  shows the footnote-definition if it is outside of the narrow (and
  known) in the minibuffer?  E.g. 2. when using prefix.
   2. Show the definition in the minibuffer as editable text (read input)
  and update it if necessary.
   3. A way to quickly get back to the previous narrow (this should
  probably be an Emacs-core feature).

—Rasmus

-- 
Enough with the bla bla!



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-25 Thread Rasmus
Rasmus ras...@gmx.us writes:

1. Retrieve the footnote in the minibuffer.  E.g. org-footnote-action
   shows the footnote-definition if it is outside of the narrow (and
   known) in the minibuffer?  E.g. 2. when using prefix.
2. Show the definition in the minibuffer as editable text (read input)
   and update it if necessary.

1. and  2. should be combined and use a popup buffer a la capture since
footnotes can hold stuff like tables which probably do not go well the
minibuffer.  It would close with C-c C-c.

—Rasmus

-- 
Evidence suggests Snowden used a powerful tool called monospaced fonts



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-25 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 If it covers x%, for x large, of the realized usecases when working with a
 narrowed buffer it's still worth it.

Please do not mess with user's narrowing. There's no valid reason to do
this, no matter how large x is.

 In any case, how about some of these alternative approaches to the issue
 of handling footnotes from a narrowed buffer.

1. Retrieve the footnote in the minibuffer.  E.g. org-footnote-action
   shows the footnote-definition if it is outside of the narrow (and
   known) in the minibuffer?  E.g. 2. when using prefix.

I suggested it already in this thread, i.e., if the definition is
outside the narrowed part of the buffer, offer to widen and jump to it,
or display the definition, or do nothing.

Actually, displaying the definition could be a separate binding (e.g.,
C-u C-c C-c), since it could be useful even outside this case.

2. Show the definition in the minibuffer as editable text (read input)
   and update it if necessary.

Then you have to deal with out of sync buffers, closed buffers,.. 

I'm pretty sure that in this situation, the user is able to widen the
buffer himself and then jump to the definition in order to edit it. This
would be a lot of trouble for a debatable benefit.

3. A way to quickly get back to the previous narrow (this should
   probably be an Emacs-core feature).

It doesn't belong to Org to implement it anyway.


Regards,



[O] [bug, org] footnote-action broken with narrowed buffer

2015-04-24 Thread Rasmus
Hi,

Narrow to h1 in the following example and run org-footnote-action on the
footnote-reference.  Expected behavior is IMO to go to the definition.
This does not happen.

Ideally, it should be possible to get back to the narrowed stage again,
but I'm not sure how this would work.  Perhaps hooking into next C- or
org-footnote-action if it's performed from within the [:begin, :end] range
of the footnote-definition...

* h1
foo[fn:1]

* Footnotes

[fn:1] bar

—Rasmus

-- 
Er du tosset for noge' lårt!




Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-24 Thread Nicolas Goaziou
Hello,

Rasmus ras...@gmx.us writes:

 Narrow to h1 in the following example and run org-footnote-action on the
 footnote-reference.  Expected behavior is IMO to go to the definition.
 This does not happen.

I disagree. Interactive commands are not expected to break current
narrowing (try, e.g., C-c C-n).

We might however ask the user if he wants to widen in order to reach
footnote definition, or display said definition in the echo area if he
doesn't, and maybe introduce a variable to always do one of these.

 Ideally, it should be possible to get back to the narrowed stage again,
 but I'm not sure how this would work.  Perhaps hooking into next C- or
 org-footnote-action if it's performed from within the [:begin, :end] range
 of the footnote-definition...

I suggest to stay away from this kind of smart behaviour. 

Outside of the most trivial case (i.e., jump back and forth between the
definition and one of its references) it sounds like it would quickly
get in the way.

 * h1
 foo[fn:1]

 * Footnotes

 [fn:1] bar

Regards,

-- 
Nicolas Goaziou



Re: [O] [bug, org] footnote-action broken with narrowed buffer

2015-04-24 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Rasmus ras...@gmx.us writes:

 Narrow to h1 in the following example and run org-footnote-action on the
 footnote-reference.  Expected behavior is IMO to go to the definition.
 This does not happen.

 I disagree. Interactive commands are not expected to break current
 narrowing (try, e.g., C-c C-n).

 We might however ask the user if he wants to widen in order to reach
 footnote definition, or display said definition in the echo area if he
 doesn't, and maybe introduce a variable to always do one of these.

Point is moved, though.  If narrow shouldn't be broken then point
shouldn't be moved.  I.e. no move when the definition is not within the
buffer.

 Ideally, it should be possible to get back to the narrowed stage again,
 but I'm not sure how this would work.  Perhaps hooking into next C- or
 org-footnote-action if it's performed from within the [:begin, :end] range
 of the footnote-definition...

 I suggest to stay away from this kind of smart behaviour. 

 Outside of the most trivial case (i.e., jump back and forth between the
 definition and one of its references) it sounds like it would quickly
 get in the way.

It would only work for the most trivial case I guess.

—Rasmus

-- 
It was you, Jezebel, it was you