From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [PATCH] Make footnotes work correctly in message-mode (was: Difference between org-footnote.el and footnote.el) Date: Sun, 24 Oct 2010 13:02:55 -0400 Message-ID: <13176.1287939775@gamaville.dokosmarshall.org> 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> <87lj5q7ebq.fsf@thinkpad.tsdh.de> <87hbge7dv4.fsf_-_@thinkpad.tsdh.de> <399A4FF9-D71B-414B-9948-3ECDBAAFCA3C@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=47098 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PA3yO-0004Lp-SN for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 13:03:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PA3yN-0007u1-Fm for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 13:03:08 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]:46245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PA3yN-0007tc-Ay for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 13:03:07 -0400 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LAT00CKC0OVNOG0@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 12:02:56 -0500 (CDT) In-reply-to: Message from Carsten Dominik of "Sun, 24 Oct 2010 18:20:29 +0200." <399A4FF9-D71B-414B-9948-3ECDBAAFCA3C@gmail.com> 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: Carsten Dominik Cc: Tassilo Horn , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Carsten Dominik wrote: > Applied, thanks - bplease confirm that I did get the right patch. > > Thanks. > > - Carsten > > On Oct 22, 2010, at 11:53 AM, Tassilo Horn wrote: > > > * 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. Message-mode is just *one* message composition mode available to emacs users and there are various other mail readers out there that don't use it (e.g. mh-e) and therefore cannot take advantage of this patch. Whether anybody cares or not, I don't know.[fn:1] Nick Footnotes: [fn:1] Personally (mh-e user), I don't care. My signature has always been nil.