[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [PATCH] Make footnotes work correctly in message-mode (was: Di
From: |
Tassilo Horn |
Subject: |
[Orgmode] [PATCH] Make footnotes work correctly in message-mode (was: Difference between org-footnote.el and footnote.el) |
Date: |
Fri, 22 Oct 2010 11:53:19 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) |
* repos/el/org-mode/lisp/org-footnote.el
(org-footnote-create-definition)
(org-footnote-goto-local-insertion-point): Add footnotes before
signature when in message-mode.
---
lisp/org-footnote.el | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 36fcfb2..ac1305f 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -302,15 +302,19 @@ or new, let the user edit the definition of the footnote."
(t
(setq re (concat "^" org-footnote-tag-for-non-org-mode-files "[ \t]*$"))
(unless (re-search-forward re nil t)
- (goto-char (point-max))
- (skip-chars-backward " \t\r\n")
- (insert "\n\n")
- (delete-region (point) (point-max))
- (insert org-footnote-tag-for-non-org-mode-files "\n"))
- (goto-char (point-max))
- (skip-chars-backward " \t\r\n")))
- (insert "\n\n")
- (insert "[" label "] ")
+ (let ((max (if (and (eq major-mode 'message-mode)
+ (re-search-forward message-signature-separator nil
t))
+ (progn (beginning-of-line) (point))
+ (goto-char (point-max)))))
+ (skip-chars-backward " \t\r\n")
+ (delete-region (point) max)
+ (insert "\n\n")
+ (insert org-footnote-tag-for-non-org-mode-files "\n")))))
+ ;; Skip existing footnotes
+ (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t)
+ (forward-line))
+ (insert "[" label "] \n")
+ (goto-char (1- (point)))
(message "Edit definition and go back with `C-c &' or, if unique, with
`C-c C-c'.")))
;;;###autoload
@@ -506,7 +510,8 @@ ENTRY is (fn-label num-mark definition)."
(beginning-of-line 0))
(if (looking-at "[ \t]*#\\+TBLFM:") (beginning-of-line 2))
(end-of-line 1)
- (skip-chars-backward "\n\r\t "))
+ (skip-chars-backward "\n\r\t ")
+ (forward-line))
(defun org-footnote-delete (&optional label)
"Delete the footnote at point.
--
1.7.3.1
Ups, my previous patch (as reply to Seb) had a bug, so here's a new one.
Bye,
Tassilo
- [Orgmode] Difference between org-footnote.el and footnote.el (was: A few questions about how you write e-mails), (continued)
- [Orgmode] Difference between org-footnote.el and footnote.el (was: A few questions about how you write e-mails), Tassilo Horn, 2010/10/21
- Re: [Orgmode] Difference between org-footnote.el and footnote.el, Andreas Röhler, 2010/10/21
- Re: [Orgmode] Difference between org-footnote.el and footnote.el, Tassilo Horn, 2010/10/21
- Re: [Orgmode] Difference between org-footnote.el and footnote.el, Tassilo Horn, 2010/10/21
- Re: [Orgmode] Difference between org-footnote.el and footnote.el, Nick Dokos, 2010/10/21
- Re: [Orgmode] Difference between org-footnote.el and footnote.el, Charles Philip Chan, 2010/10/21
- [Orgmode] Re: Difference between org-footnote.el and footnote.el, Tassilo Horn, 2010/10/21
- Re: [Orgmode] Re: Difference between org-footnote.el and footnote.el, Eric S Fraga, 2010/10/21
- [Orgmode] Re: Difference between org-footnote.el and footnote.el, Sébastien Vauban, 2010/10/22
- [Orgmode] Re: Difference between org-footnote.el and footnote.el, Tassilo Horn, 2010/10/22
- [Orgmode] [PATCH] Make footnotes work correctly in message-mode (was: Difference between org-footnote.el and footnote.el),
Tassilo Horn <=
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Sébastien Vauban, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Tassilo Horn, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Sébastien Vauban, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Dan Davison, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Sébastien Vauban, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Sébastien Vauban, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Tassilo Horn, 2010/10/22
- [Orgmode] Re: [PATCH] Make footnotes work correctly in message-mode, Sébastien Vauban, 2010/10/22
- Re: [Orgmode] [PATCH] Make footnotes work correctly in message-mode (was: Difference between org-footnote.el and footnote.el), Carsten Dominik, 2010/10/24
- Re: [Orgmode] [PATCH] Make footnotes work correctly in message-mode (was: Difference between org-footnote.el and footnote.el), Nick Dokos, 2010/10/24