From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: Difference between org-footnote.el and footnote.el Date: Fri, 22 Oct 2010 11:43:21 +0200 Message-ID: <87lj5q7ebq.fsf@thinkpad.tsdh.de> References: <87tykgxqbb.fsf@fastmail.fm> <878w1s7zw8.fsf@thinkpad.tsdh.de> <871v7k7ydt.fsf_-_@thinkpad.tsdh.de> <4CC00391.6050608@easy-emacs.de> <87wrpb7unc.fsf@thinkpad.tsdh.de> <15036.1287673547@gamaville.dokosmarshall.org> <87k4lbfu95.fsf@MagnumOpus.khem> <87mxq75zvv.fsf@thinkpad.tsdh.de> <87bp6nicn7.wl%ucecesf@ucl.ac.uk> <80zku63adu.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=58114 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9EA6-0006JB-A0 for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 05:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9E9w-0002Te-Oi for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 05:43:38 -0400 Received: from lo.gmane.org ([80.91.229.12]:49512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P9E9w-0002TB-Dw for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 05:43:36 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P9E9q-0000cd-Gk for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 11:43:30 +0200 Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Oct 2010 11:43:30 +0200 Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Oct 2010 11:43:30 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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 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