emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Gerald Wildgruber <Gerald.Wildgruber@unibas.ch>
Cc: orgmode list <emacs-orgmode@gnu.org>
Subject: [PATCH] Re: Annoying positioning of point when writing footnotes
Date: Thu, 13 Aug 2015 13:16:22 -0500	[thread overview]
Message-ID: <87egj7rr49.fsf_-_@fastmail.fm> (raw)
In-Reply-To: <87io8jrrx6.fsf@fastmail.fm> (Matt Lundin's message of "Thu, 13 Aug 2015 12:59:01 -0500")

[-- 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


  reply	other threads:[~2015-08-13 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Matt Lundin [this message]
2015-08-13 18:49         ` [PATCH] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egj7rr49.fsf_-_@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=Gerald.Wildgruber@unibas.ch \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).