emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Annoying positioning of point when writing footnotes
@ 2015-08-13 14:46 Gerald Wildgruber
  2015-08-13 16:10 ` [BUG] " Matt Lundin
  0 siblings, 1 reply; 12+ messages in thread
From: Gerald Wildgruber @ 2015-08-13 14:46 UTC (permalink / raw)
  To: orgmode list


Hi,

when doing a "C-c C-x f" in order to insert a footnote in an org mode
document, the point is strangely positioned on the HEADING under which
footnotes are stored and not, as one would expect, near the actual
footnote marker [fn:X] where the text of the footnote goes. this is very
annoying as there is absolutly nothing to do at the "Footnotes" heading,
and one has to manoeuvre manually to the actual footnote every time over
and over again.

Is this a bug or can it be changed?

Thanks

Gerald.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [BUG] Re: Annoying positioning of point when writing footnotes
  2015-08-13 14:46 Annoying positioning of point when writing footnotes Gerald Wildgruber
@ 2015-08-13 16:10 ` Matt Lundin
  2015-08-13 16:42   ` Gerald Wildgruber
  0 siblings, 1 reply; 12+ messages in thread
From: Matt Lundin @ 2015-08-13 16:10 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: orgmode list

Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:

> when doing a "C-c C-x f" in order to insert a footnote in an org mode
> document, the point is strangely positioned on the HEADING under which
> footnotes are stored and not, as one would expect, near the actual
> footnote marker [fn:X] where the text of the footnote goes. this is very
> annoying as there is absolutly nothing to do at the "Footnotes" heading,
> and one has to manoeuvre manually to the actual footnote every time over
> and over again.

I can confirm this. The bug seems to lie in
org-footnote-goto-definition. I'll see if I can dig a little deeper.

Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] Re: Annoying positioning of point when writing footnotes
  2015-08-13 16:10 ` [BUG] " Matt Lundin
@ 2015-08-13 16:42   ` Gerald Wildgruber
  2015-08-13 17:19     ` Kaushal
  2015-08-13 17:59     ` Matt Lundin
  0 siblings, 2 replies; 12+ messages in thread
From: Gerald Wildgruber @ 2015-08-13 16:42 UTC (permalink / raw)
  To: Matt Lundin; +Cc: orgmode list


Matt, thanks! looking forward to any elucidation you can give on the
problem at hand!

Gerald.

On Do, Aug 13 2015, Matt Lundin <mdl@imapmail.org> wrote:

> Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
>
>> when doing a "C-c C-x f" in order to insert a footnote in an org mode
>> document, the point is strangely positioned on the HEADING under which
>> footnotes are stored and not, as one would expect, near the actual
>> footnote marker [fn:X] where the text of the footnote goes. this is very
>> annoying as there is absolutly nothing to do at the "Footnotes" heading,
>> and one has to manoeuvre manually to the actual footnote every time over
>> and over again.
>
> I can confirm this. The bug seems to lie in
> org-footnote-goto-definition. I'll see if I can dig a little deeper.
>
> Matt

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] Re: Annoying positioning of point when writing footnotes
  2015-08-13 16:42   ` Gerald Wildgruber
@ 2015-08-13 17:19     ` Kaushal
  2015-08-13 17:59     ` Matt Lundin
  1 sibling, 0 replies; 12+ messages in thread
From: Kaushal @ 2015-08-13 17:19 UTC (permalink / raw)
  To: Gerald Wildgruber, Matt Lundin; +Cc: orgmode list

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Thanks! I have this problem too; was going to report this.

On Thu, Aug 13, 2015 at 12:43 PM Gerald Wildgruber <
Gerald.Wildgruber@unibas.ch> wrote:

>
> Matt, thanks! looking forward to any elucidation you can give on the
> problem at hand!
>
> Gerald.
>
> On Do, Aug 13 2015, Matt Lundin <mdl@imapmail.org> wrote:
>
> > Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
> >
> >> when doing a "C-c C-x f" in order to insert a footnote in an org mode
> >> document, the point is strangely positioned on the HEADING under which
> >> footnotes are stored and not, as one would expect, near the actual
> >> footnote marker [fn:X] where the text of the footnote goes. this is very
> >> annoying as there is absolutly nothing to do at the "Footnotes" heading,
> >> and one has to manoeuvre manually to the actual footnote every time over
> >> and over again.
> >
> > I can confirm this. The bug seems to lie in
> > org-footnote-goto-definition. I'll see if I can dig a little deeper.
> >
> > Matt
>
>

[-- Attachment #2: Type: text/html, Size: 1540 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] Re: Annoying positioning of point when writing footnotes
  2015-08-13 16:42   ` Gerald Wildgruber
  2015-08-13 17:19     ` Kaushal
@ 2015-08-13 17:59     ` Matt Lundin
  2015-08-13 18:16       ` [PATCH] " Matt Lundin
  2015-08-14  6:02       ` [BUG] " Gerald Wildgruber
  1 sibling, 2 replies; 12+ messages in thread
From: Matt Lundin @ 2015-08-13 17:59 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: orgmode list

Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:

> Matt, thanks! looking forward to any elucidation you can give on the
> problem at hand!

Could you tell me what the value of org-footnote-auto-adjust is on your
machine?

It seems on my end that the problem only occurs when
org-footnote-auto-adjust is set to t. The problem seems to be line 556
of org-footnote.el, which reorders the footnotes *after* the position of
the footnote definition has been saved. When I remove that line or set
org-footnote-auto-adjust to nil, the cursor is positioned correctly.

Matt
                         

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-13 17:59     ` Matt Lundin
@ 2015-08-13 18:16       ` Matt Lundin
  2015-08-13 18:49         ` Kaushal
  2015-08-13 23:22         ` Nicolas Goaziou
  2015-08-14  6:02       ` [BUG] " Gerald Wildgruber
  1 sibling, 2 replies; 12+ messages in thread
From: Matt Lundin @ 2015-08-13 18:16 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: orgmode list

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Matt Lundin <mdl@imapmail.org> writes:

> Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
>
>> Matt, thanks! looking forward to any elucidation you can give on the
>> problem at hand!
>
> Could you tell me what the value of org-footnote-auto-adjust is on your
> machine?
>
> It seems on my end that the problem only occurs when
> org-footnote-auto-adjust is set to t. The problem seems to be line 556
> of org-footnote.el, which reorders the footnotes *after* the position of
> the footnote definition has been saved. When I remove that line or set
> org-footnote-auto-adjust to nil, the cursor is positioned correctly.

This patch should fix the issue. Testing is welcome.

Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-position-of-cursor-when-creating-footnotes.patch --]
[-- Type: text/x-diff, Size: 1254 bytes --]

From d52d6b331e92dddce5477c131858ded7e091599e Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Thu, 13 Aug 2015 13:14:34 -0500
Subject: [PATCH] Fix position of cursor when creating footnotes

* lisp/org-footnote.el (org-footnote-auto-label): Call
  org-footnote-auto-adjust-maybe after going to the footnote definition.
  Otherwise the correct position is lost.
---
 lisp/org-footnote.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 7396609..1048219 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -553,12 +553,12 @@ or new, let the user edit the definition of the footnote."
 	  (t
 	   (insert "[" label "]")
 	   (let ((l (copy-marker (org-footnote-create-definition label))))
-	     (org-footnote-auto-adjust-maybe)
 	     (or (ignore-errors (org-footnote-goto-definition label l))
 		 ;; Since definition was created outside current
 		 ;; scope, edit it remotely.
 		 (progn (set-marker l nil)
-			(org-edit-footnote-reference))))))))
+			(org-edit-footnote-reference))))
+	   (org-footnote-auto-adjust-maybe)))))
 
 (defvar org-blank-before-new-entry) ; Silence byte-compiler.
 (defun org-footnote-create-definition (label)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-13 18:16       ` [PATCH] " Matt Lundin
@ 2015-08-13 18:49         ` Kaushal
  2015-08-13 23:22         ` Nicolas Goaziou
  1 sibling, 0 replies; 12+ messages in thread
From: Kaushal @ 2015-08-13 18:49 UTC (permalink / raw)
  To: Matt Lundin, Gerald Wildgruber; +Cc: orgmode list

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

@Matt Correct. I have set org-footnote-auto-adjust to t.

On Thu, Aug 13, 2015 at 2:16 PM Matt Lundin <mdl@imapmail.org> wrote:

> Matt Lundin <mdl@imapmail.org> writes:
>
> > Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
> >
> >> Matt, thanks! looking forward to any elucidation you can give on the
> >> problem at hand!
> >
> > Could you tell me what the value of org-footnote-auto-adjust is on your
> > machine?
> >
> > It seems on my end that the problem only occurs when
> > org-footnote-auto-adjust is set to t. The problem seems to be line 556
> > of org-footnote.el, which reorders the footnotes *after* the position of
> > the footnote definition has been saved. When I remove that line or set
> > org-footnote-auto-adjust to nil, the cursor is positioned correctly.
>
> This patch should fix the issue. Testing is welcome.
>
> Matt
>
>

[-- Attachment #2: Type: text/html, Size: 1332 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-13 18:16       ` [PATCH] " Matt Lundin
  2015-08-13 18:49         ` Kaushal
@ 2015-08-13 23:22         ` Nicolas Goaziou
  2015-08-14  6:11           ` Gerald Wildgruber
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2015-08-13 23:22 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Gerald Wildgruber, orgmode list

Hello,

Matt Lundin <mdl@imapmail.org> writes:

> This patch should fix the issue. Testing is welcome.

Thanks for the patch.

However, `org-footnote-auto-adjust-maybe' needs to be called before
`org-edit-reference'. Otherwise, the footnote number in the remote
buffer is incorrect.

The marker information is not reliable anymore after sorting footnotes,
so it should be dropped. I applied a patch along this line.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] Re: Annoying positioning of point when writing footnotes
  2015-08-13 17:59     ` Matt Lundin
  2015-08-13 18:16       ` [PATCH] " Matt Lundin
@ 2015-08-14  6:02       ` Gerald Wildgruber
  1 sibling, 0 replies; 12+ messages in thread
From: Gerald Wildgruber @ 2015-08-14  6:02 UTC (permalink / raw)
  To: Matt Lundin; +Cc: orgmode list


On Do, Aug 13 2015, Matt Lundin <mdl@imapmail.org> wrote:

> Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
>
>> Matt, thanks! looking forward to any elucidation you can give on the
>> problem at hand!
>
> Could you tell me what the value of org-footnote-auto-adjust is on your
> machine?

Indeed, I have set this variable to t!

> It seems on my end that the problem only occurs when
> org-footnote-auto-adjust is set to t. The problem seems to be line 556
> of org-footnote.el, which reorders the footnotes *after* the position of
> the footnote definition has been saved. When I remove that line or set
> org-footnote-auto-adjust to nil, the cursor is positioned correctly.
>
> Matt
>                          

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-13 23:22         ` Nicolas Goaziou
@ 2015-08-14  6:11           ` Gerald Wildgruber
  2015-08-14 14:24             ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Gerald Wildgruber @ 2015-08-14  6:11 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Matt Lundin, orgmode list


Thanks Matt and Nicolas!

I still have org-footnote-auto-adjust set to "t" and the positioning of
point near the footnote marker works now with the sources I checked out
this morning!


One thing though: if I insert a new footnote in a region of text that
already has footnotes before and after, the auto adjust mechanism is
triggered by "C-c C-x f", but in this case point is set NOT near the NEW
footnote marker but always at the marker of the LAST footnote!

Can this be fixed as well?

Thanks

Gerald.

On Fr, Aug 14 2015, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Hello,
>
> Matt Lundin <mdl@imapmail.org> writes:
>
>> This patch should fix the issue. Testing is welcome.
>
> Thanks for the patch.
>
> However, `org-footnote-auto-adjust-maybe' needs to be called before
> `org-edit-reference'. Otherwise, the footnote number in the remote
> buffer is incorrect.
>
> The marker information is not reliable anymore after sorting footnotes,
> so it should be dropped. I applied a patch along this line.
>
>
> Regards,

-- 
Dr.Gerald Wildgruber
eikones NFS Bildkritik
NCCR Iconic Criticism
Universität Basel
Rheinsprung 11
CH-4051 Basel
www.eikones.ch
T. +41 (0)61 267 18 02
F. +41 (0)61 267 18 11
---------------------
Sent with mu4e

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-14  6:11           ` Gerald Wildgruber
@ 2015-08-14 14:24             ` Nicolas Goaziou
  2015-08-15  5:45               ` Gerald Wildgruber
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2015-08-14 14:24 UTC (permalink / raw)
  To: Gerald Wildgruber; +Cc: Matt Lundin, orgmode list

Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:

> One thing though: if I insert a new footnote in a region of text that
> already has footnotes before and after, the auto adjust mechanism is
> triggered by "C-c C-x f", but in this case point is set NOT near the NEW
> footnote marker but always at the marker of the LAST footnote!
>
> Can this be fixed as well?

Fixed. Thank you.

Regards,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Re: Annoying positioning of point when writing footnotes
  2015-08-14 14:24             ` Nicolas Goaziou
@ 2015-08-15  5:45               ` Gerald Wildgruber
  0 siblings, 0 replies; 12+ messages in thread
From: Gerald Wildgruber @ 2015-08-15  5:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Matt Lundin, orgmode list


On Fr, Aug 14 2015, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Gerald Wildgruber <Gerald.Wildgruber@unibas.ch> writes:
>
>> One thing though: if I insert a new footnote in a region of text that
>> already has footnotes before and after, the auto adjust mechanism is
>> triggered by "C-c C-x f", but in this case point is set NOT near the NEW
>> footnote marker but always at the marker of the LAST footnote!
>>
>> Can this be fixed as well?
>
> Fixed. Thank you.

Nicolas, thanks for these amazingly fast and efficient fixes, works
perfectly now.

Gerald.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-15  5:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13 14:46 Annoying positioning of point when writing footnotes Gerald Wildgruber
2015-08-13 16:10 ` [BUG] " Matt Lundin
2015-08-13 16:42   ` Gerald Wildgruber
2015-08-13 17:19     ` Kaushal
2015-08-13 17:59     ` Matt Lundin
2015-08-13 18:16       ` [PATCH] " Matt Lundin
2015-08-13 18:49         ` Kaushal
2015-08-13 23:22         ` Nicolas Goaziou
2015-08-14  6:11           ` Gerald Wildgruber
2015-08-14 14:24             ` Nicolas Goaziou
2015-08-15  5:45               ` Gerald Wildgruber
2015-08-14  6:02       ` [BUG] " Gerald Wildgruber

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).