unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: How to move point to the end of the message body?
Date: Sat, 19 Dec 2015 18:49:55 +0100	[thread overview]
Message-ID: <87h9je72ib.fsf@mbork.pl> (raw)

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	other threads:[~2015-12-19 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-19 17:49 Marcin Borkowski [this message]
2015-12-20  8:50 ` How to move point to the end of the message body? Emanuel Berg
2015-12-20 10:50   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9je72ib.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).