* message.texi (Movement): message-beginning-of-line.
authorKai Grossjohann <kgrossjo@eu.uu.net>
Fri, 9 Nov 2001 14:28:02 +0000 (14:28 +0000)
committerKai Grossjohann <kgrossjo@eu.uu.net>
Fri, 9 Nov 2001 14:28:02 +0000 (14:28 +0000)
* message.el (message-point-in-header-p): New function.
(message-do-auto-fill): Use it.
(message-beginning-of-line): New function.  Goes to beginning of
header value (i.e., end of header name), or to beginning of line
if already at beginning of value.
(message-mode-map): Bind it.

lisp/ChangeLog
lisp/message.el
texi/ChangeLog
texi/message.texi

index c112d22..547c3de 100644 (file)
@@ -1,3 +1,12 @@
+2001-11-09  Kai Gro\e,A_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+       * message.el (message-point-in-header-p): New function.
+       (message-do-auto-fill): Use it.
+       (message-beginning-of-line): New function.  Goes to beginning of
+       header value (i.e., end of header name), or to beginning of line
+       if already at beginning of value.
+       (message-mode-map): Bind it.
+       
 2001-11-08  Simon Josefsson  <jas@extundo.com>
 
        * gnus-msg.el (gnus-posting-styles): Add doc.
index 7d75de7..8b76d42 100644 (file)
@@ -1531,7 +1531,8 @@ Point is left at the beginning of the narrowed-to region."
   ;;(define-key message-mode-map "\M-q" 'message-fill-paragraph)
 
   (define-key message-mode-map "\C-c\C-a" 'mml-attach-file)
-
+  
+  (define-key message-mode-map "\C-a" 'message-beginning-of-line)
   (define-key message-mode-map "\t" 'message-tab)
   (define-key message-mode-map "\M-;" 'comment-region))
 
@@ -2007,16 +2008,29 @@ Prefix arg means justify as well."
     (message-newline-and-reformat arg t)
     t))
 
+;; Is it better to use `mail-header-end'?
+(defun message-point-in-header-p ()
+  "Return t if point is in the header."
+  (save-excursion
+    (let ((p (point)))
+      (goto-char (point-min))
+      (or (re-search-forward
+          (concat "^" (regexp-quote mail-header-separator) "\n")
+          p t)
+         (re-search-forward "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" p t)))))
+
 (defun message-do-auto-fill ()
   "Like `do-auto-fill', but don't fill in message header."
-  (when (> (point) (save-excursion 
-                    (goto-char (point-min))
-                    (if (re-search-forward
-                         (concat "^" (regexp-quote mail-header-separator)
-                                 "\n") nil t)
-                        (match-beginning 0)
-                      (point-max))))
+  (when (message-point-in-header-p)
     (do-auto-fill)))
+;;-  (when (> (point) (save-excursion 
+;;-                 (goto-char (point-min))
+;;-                 (if (re-search-forward
+;;-                      (concat "^" (regexp-quote mail-header-separator)
+;;-                              "\n") nil t)
+;;-                     (match-beginning 0)
+;;-                   (point-max))))
+;;-    (do-auto-fill)))
 
 (defun message-insert-signature (&optional force)
   "Insert a signature.  See documentation for variable `message-signature'."
@@ -3958,6 +3972,17 @@ than 988 characters long, and if they are not, trim them until they are."
       (forward-line 2)))
    (sit-for 0)))
 
+(defun message-beginning-of-line (&optional n)
+  "Move point to beginning of header value or to beginning of line."
+  (interactive "p")
+  (let* ((here (point))
+        (bol (progn (beginning-of-line n) (point)))
+        (eol (gnus-point-at-eol))
+        (eoh (re-search-forward ": *" eol t)))
+    (if (equal here eoh)
+       (goto-char bol)
+      (goto-char eoh))))
+
 (defun message-buffer-name (type &optional to group)
   "Return a new (unique) buffer name based on TYPE and TO."
   (cond
index 39593b7..abd3f70 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-09  Kai Gro\e,A_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+       * message.texi (Movement): message-beginning-of-line.
+
 2001-11-07  Simon Josefsson  <jas@extundo.com>
 
        * sieve.texi (Examples): Add.
index d939981..23d1f34 100644 (file)
@@ -434,6 +434,13 @@ Move to the beginning of the body of the message
 @findex message-goto-signature
 Move to the signature of the message (@code{message-goto-signature}).
 
+@item C-a
+@kindex C-a
+@findex message-beginning-of-line
+If at beginning of header value, go to beginning of line, else go to
+beginning of header value.  (The header value comes after the header
+name and the colon.)
+
 @end table