emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Place Footnotes section before signature in all message-mode derived modes.
@ 2010-12-07 18:40 Tassilo Horn
  0 siblings, 0 replies; only message in thread
From: Tassilo Horn @ 2010-12-07 18:40 UTC (permalink / raw)
  To: emacs-orgmode

* org-footnote.el (org-footnote-create-definition): Place Footnotes
  section before message-signature-separator also in modes derived
  from message-mode.
---
 lisp/org-footnote.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 2a97b54..8cb4bbc 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -303,7 +303,7 @@ 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)
-	(let ((max (if (and (eq major-mode 'message-mode)
+	(let ((max (if (and (derived-mode-p 'message-mode)
 			    (re-search-forward message-signature-separator nil t))
 		       (progn (beginning-of-line) (point))
 		     (goto-char (point-max)))))
-- 
1.7.3.2

This patch makes the "place Footnotes section before message signature
separator" also work in modes that derive from message-mode.  For
example, I have a derived mode for editing mails from KMail with the
usual message-mode magic.

--8<---------------cut here---------------start------------->8---
(defvar th-kmail-tmp-file-regexp "\\(kontact\\|kmail\\).*\\.tmp$"
  "Regexp that matches the file names of kmail's temporary files.")

(defun kmail-save-message-and-exit ()
  (interactive)
  (goto-char 0)
  (forward-line 1)
  (delete-region 1 (point))
  (save-buffer)
  (server-edit))

(define-derived-mode kmail-mode message-mode "KMail"
  "Major mode for mails from kmail.
\\{kmail-mode-map}"
  (goto-char 0)
  (insert "--text follows this line--\n")
  (define-key kmail-mode-map (kbd "C-c C-c") 'kmail-save-message-and-exit)
  (define-key kmail-mode-map (kbd "C-c #")   'kmail-save-message-and-exit))

(add-to-list 'auto-mode-alist
	     (cons th-kmail-tmp-file-regexp 'kmail-mode))

(add-to-list 'recentf-exclude th-kmail-tmp-file-regexp)
--8<---------------cut here---------------end--------------->8---

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-07 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-07 18:40 [PATCH] Place Footnotes section before signature in all message-mode derived modes Tassilo Horn

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).