help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to move point to the end of the message body?


From: Marcin Borkowski
Subject: How to move point to the end of the message body?
Date: Sat, 19 Dec 2015 18:49:55 +0100
User-agent: mu4e 0.9.13; emacs 25.0.50.1

Hi list,

I'd like to get to the end of the message body (in message-mode).  This
seems to work, but I'm looking for making it better (both in terms of
style and robustness: does my check for attachments work in all
circumstances?  Should I check for anything more?).

Note: you should insert a hash before "part" below (funnily, I could
send this email with that hash - Emacs thought it's an incomplete
attachment!).

--8<---------------cut here---------------start------------->8---
(defun mbork/message-goto-end-body ()
  "Go to end of message body (before signature and attachments)."
  (let (before-attachments)
    (setq before-attachments (goto-char (point-max)))
    (while (and (search-backward "<part " nil t)
                (eq (get-text-property (point) 'face)
                    'message-mml))
      (setq before-attachments (point)))
    (goto-char before-attachments)
    (re-search-backward message-signature-separator nil t)))
--8<---------------cut here---------------end--------------->8---

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]