changeset 111056:062487f243c2

nndoc.el (nndoc-transform-git-headers): Generate Subject headers. gnus.texi (Document Groups): Mention git.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Tue, 19 Oct 2010 23:06:50 +0000
parents 982259aceabb
children 097fe1170a9a
files doc/misc/ChangeLog doc/misc/gnus.texi lisp/gnus/ChangeLog lisp/gnus/nndoc.el
diffstat 4 files changed, 34 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/doc/misc/ChangeLog	Tue Oct 19 22:30:29 2010 +0000
+++ b/doc/misc/ChangeLog	Tue Oct 19 23:06:50 2010 +0000
@@ -2,6 +2,7 @@
 
 	* gnus.texi (Customizing the IMAP Connection): The port strings are
 	strings.
+	(Document Groups): Mention git.
 
 2010-10-18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
--- a/doc/misc/gnus.texi	Tue Oct 19 22:30:29 2010 +0000
+++ b/doc/misc/gnus.texi	Tue Oct 19 23:06:50 2010 +0000
@@ -17969,6 +17969,10 @@
 @item lanl-gov-announce
 Announcement messages from LANL Gov Announce.
 
+@cindex git commit messages
+@item git
+@code{git} commit messages.
+
 @cindex forwarded messages
 @item rfc822-forward
 A message forwarded according to RFC822.
--- a/lisp/gnus/ChangeLog	Tue Oct 19 22:30:29 2010 +0000
+++ b/lisp/gnus/ChangeLog	Tue Oct 19 23:06:50 2010 +0000
@@ -4,6 +4,7 @@
 	(nndoc-git-type-p): New function.
 	(nndoc-transform-git-article): Ditto.
 	(nndoc-transform-git-headers): Ditto.
+	(nndoc-transform-git-headers): Generate Subject headers.
 
 	* shr.el (shr-parse-style): New function.
 	(shr-tag-span): Ditto.
--- a/lisp/gnus/nndoc.el	Tue Oct 19 22:30:29 2010 +0000
+++ b/lisp/gnus/nndoc.el	Tue Oct 19 23:06:50 2010 +0000
@@ -232,19 +232,22 @@
 	  (while articles
 	    (when (setq entry (cdr (assq (setq article (pop articles))
 					 nndoc-dissection-alist)))
-	      (insert (format "221 %d Article retrieved.\n" article))
-	      (if nndoc-generate-head-function
-		  (funcall nndoc-generate-head-function article)
-		(insert-buffer-substring
-		 nndoc-current-buffer (car entry) (nth 1 entry)))
-	      (goto-char (point-max))
-	      (unless (eq (char-after (1- (point))) ?\n)
-		(insert "\n"))
-	      (insert (format "Lines: %d\n" (nth 4 entry)))
-	      (insert ".\n")))
-
-	  (when nndoc-header-transform-function
-	    (funcall nndoc-header-transform-function))
+	      (let ((start (point)))
+		(insert (format "221 %d Article retrieved.\n" article))
+		(if nndoc-generate-head-function
+		    (funcall nndoc-generate-head-function article)
+		  (insert-buffer-substring
+		   nndoc-current-buffer (car entry) (nth 1 entry)))
+		(goto-char (point-max))
+		(unless (eq (char-after (1- (point))) ?\n)
+		  (insert "\n"))
+		(insert (format "Lines: %d\n" (nth 4 entry)))
+		(insert ".\n")
+		(when nndoc-header-transform-function
+		  (save-excursion
+		    (save-restriction
+		      (narrow-to-region start (point))
+		      (funcall nndoc-header-transform-function entry)))))))
 	  (nnheader-fold-continuation-lines)
 	  'headers)))))
 
@@ -671,10 +674,19 @@
   (when (re-search-forward "^Author: " nil t)
     (replace-match "From: " t t)))
 
-(defun nndoc-transform-git-headers ()
+(defun nndoc-transform-git-headers (entry)
   (goto-char (point-min))
-  (while (re-search-forward "^Author: " nil t)
-    (replace-match "From: " t t)))
+  (when (re-search-forward "^Author: " nil t)
+    (replace-match "From: " t t))
+  (let (subject)
+    (with-current-buffer nndoc-current-buffer
+      (goto-char (car entry))
+      (when (search-forward "\n\n" nil t)
+	(setq subject (buffer-substring (point) (line-end-position)))))
+    (when subject
+      (goto-char (point-min))
+      (forward-line 1)
+      (insert (format "Subject: %s\n" subject)))))
 
 (defun nndoc-lanl-gov-announce-type-p ()
   (when (let ((case-fold-search nil))