[Orgmode] Re: Difference between org-footnote.el and footnote.el

2010-10-22 Thread Sébastien Vauban
Hi all,

Eric S Fraga wrote:
 On Thu, 21 Oct 2010 17:28:20 +0200, Tassilo Horn tass...@member.fsf.org 
 wrote:
 Charles Philip Chan cpc...@sympatico.ca writes:
 
  How does footnote.el find the signature?
 
  I presume by looking for the line -- which precedes the signature.
 
 That's not completely true.  The line has to be -- , i.e. --
 followed by exactly one space.

 indeed. looking at the code in footnode.el, there is a search for the
 message-signature-separator, which defaults to ^-- $ to find where
 to insert footnotes.

If I sum up this whole thread about footnote.el vs org-footnote.el, the latest
one (org-footnote.el) seems better than the original footnote.el in every
aspect but for the placement of the footnotes before the signature.

Does someone take care of updating it?

Best regards,
  Seb

-- 
Sébastien Vauban


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Difference between org-footnote.el and footnote.el

2010-10-22 Thread Tassilo Horn
* 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 |   26 --
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 36fcfb2..4be0504 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -302,15 +302,20 @@ 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)))
+(when (org-mode-p) (org-indent-line-function))
 (message Edit definition and go back with `C-c ' or, if unique, with 
`C-c C-c'.)))
 
 ;;;###autoload
@@ -506,7 +511,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

Sébastien Vauban wxhgmqzgw...@spammotel.com
writes:

Hi Seb,

 If I sum up this whole thread about footnote.el vs org-footnote.el,
 the latest one (org-footnote.el) seems better than the original
 footnote.el in every aspect but for the placement of the footnotes
 before the signature.

Yep, that sounds correct.

 Does someone take care of updating it?

Above is a patch.  It seems to work correctly in both mails and
org-files for me, but I was that stupid not to try the original
org-footnote.el before implementing that feature.  So there could be
regressions, or at least not 100% compatible behavior.  I'm not sure,
but did the original version create a stack of footnote definitions,
e.g. was the numbering from latest to oldest footnote?  Now it's the
other way round, which looks better to me...

Please everyone, give it a test drive, and if it works, feel free to
commit.

Bye,
Tassilo


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Difference between org-footnote.el and footnote.el

2010-10-21 Thread Tassilo Horn
Charles Philip Chan cpc...@sympatico.ca writes:

Hi Charles and Nick,

 How does footnote.el find the signature?

 I presume by looking for the line -- which precedes the signature.

That's not completely true.  The line has to be -- , i.e. --
followed by exactly one space.

Bye,
Tassilo


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: Difference between org-footnote.el and footnote.el

2010-10-21 Thread Eric S Fraga
On Thu, 21 Oct 2010 17:28:20 +0200, Tassilo Horn tass...@member.fsf.org wrote:
 
 Charles Philip Chan cpc...@sympatico.ca writes:
 
 Hi Charles and Nick,
 
  How does footnote.el find the signature?
 
  I presume by looking for the line -- which precedes the signature.
 
 That's not completely true.  The line has to be -- , i.e. --
 followed by exactly one space.
 
 Bye,
 Tassilo

indeed. looking at the code in footnode.el, there is a search for the
message-signature-separator, which defaults to ^-- $ to find where
to insert footnotes.
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode