message-goto-body after <#secure
authorŁukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl>
Tue, 23 Nov 2010 20:55:35 +0000 (21:55 +0100)
committerJulien Danjou <julien@danjou.info>
Wed, 24 Nov 2010 17:27:49 +0000 (18:27 +0100)
The following patch makes message-goto-body function put cursor after
possible "<#secure" tag. This hits two birds with one stone: pressing
C-c C-b moves me where I can start typing and any citations that get
inserted into a new message buffer when replying (I have not tested
resending or forwarding yet but I suppose it works the same way) leave
the tag at the very begining of a message.

Why I wrote this? I've set up mml-secure-message-sign-pgpmime as a part
of message-setup-hook. I prefere this to putting it in message-send-hook
because I can decide whether to sign a message or not. And it works well
for a new message. However, it fails for replies because just before
citations are inserted message-goto-body sets point *brefore*
the <#secure tag that is there since message-setup-hook gets fired
before citations.

Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/message.el

index aaffff2..1aac86d 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-24  Łukasz Stelmach  <lukasz.stelmach@iem.pw.edu.pl>  (tiny change)
+
+       * message.el (message-goto-body): Go after <#secure.
+
 2010-11-24  Julien Danjou  <julien@danjou.info>
 
        * shr.el (shr-insert-color-overlay): Replace deprecated syntax.
index bff11b2..b3660c6 100644 (file)
@@ -3099,7 +3099,8 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
     (expand-abbrev))
   (goto-char (point-min))
   (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
-      (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)))
+      (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))
+  (while (looking-at "^<#secure") (forward-line 1)))
 
 (defun message-in-body-p ()
   "Return t if point is in the message body."