unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* improve rmail's MIME handling
@ 2010-11-12 12:28 Kenichi Handa
  2010-11-12 12:39 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Kenichi Handa @ 2010-11-12 12:28 UTC (permalink / raw)
  To: emacs-devel

A while ago, I reported that I need various settings to make
rmail handle MIME better (i.e. subject decoding/encoding),
and showed my settings including some additional functions,
but it seems that no one is working on this field.  So, I
started to work on it.  The attached is the first (and easy)
patch for summary lines.  Nowadays, not handling MIME
properly is regarded as a bug, and thus I want to install it
for Emacs 23.  What do you think?

---
Kenichi Handa
handa@m17n.org


2010-11-11  Kenichi Handa  <handa@m17n.org>

	* mail/rmailsum.el (rmail-header-summary): Handle multiline
	Subject: field.
	(rmail-summary-line-decoder): Set the default to
	rfc2047-decode-string.

=== modified file 'lisp/mail/rmailsum.el'
--- lisp/mail/rmailsum.el	2010-08-29 16:17:13 +0000
+++ lisp/mail/rmailsum.el	2010-11-11 02:33:42 +0000
@@ -364,12 +364,15 @@
       (aset rmail-summary-vector (1- msgnum) line))
     line))
 
-(defcustom rmail-summary-line-decoder (function identity)
+(require 'rfc2047)
+
+(defcustom rmail-summary-line-decoder (function rfc2047-decode-string)
   "Function to decode a Rmail summary line.
 It receives the summary line for one message as a string
 and should return the decoded string.
 
-By default, it is `identity', which returns the string unaltered."
+By default, it is `rfc2047-decode-string', which decodes MIME-encoded
+subject."
   :type 'function
   :group 'rmail-summary)
 
@@ -589,10 +592,17 @@
 						     (t (- mch 14))))
 				      (min len (+ lo 25)))))))))
    (concat (if (re-search-forward "^Subject:" nil t)
-	       (progn (skip-chars-forward " \t")
-		      (buffer-substring (point)
-					(progn (end-of-line)
-					       (point))))
+	       (let (pos str)
+		 (skip-chars-forward " \t")
+		 (setq pos (point))
+		 (forward-line 1)
+		 (setq str (buffer-substring pos (1- (point))))
+		 (while (looking-at "\\s ")
+		   (setq str (concat str " " 
+				     (buffer-substring (match-end 0)
+						       (line-end-position))))
+		   (forward-line 1))
+		 str)
 	     (re-search-forward "[\n][\n]+" nil t)
 	     (buffer-substring (point) (progn (end-of-line) (point))))
 	   "\n")))




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-12-05 15:57 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12 12:28 improve rmail's MIME handling Kenichi Handa
2010-11-12 12:39 ` Andreas Schwab
2010-11-12 14:39 ` Stefan Monnier
2010-11-26  4:24   ` Kenichi Handa
2010-11-26 10:44     ` Eli Zaretskii
2010-11-26 11:34       ` Kenichi Handa
2010-11-26 14:41       ` Stefan Monnier
2010-11-26 14:46         ` Lars Magne Ingebrigtsen
2010-11-26 18:30           ` Stefan Monnier
2010-11-29  0:59         ` Kenichi Handa
2010-11-29  3:24           ` Bob Rogers
2010-11-29  6:38             ` Kenichi Handa
2010-11-30  6:21               ` Bob Rogers
2010-11-29  3:58           ` Eli Zaretskii
2010-11-29 20:43             ` Richard Stallman
2010-11-30  3:14               ` Stephen J. Turnbull
2010-12-01 13:10                 ` Richard Stallman
2010-12-02  0:04                   ` Stephen J. Turnbull
2010-12-03  4:32                     ` Richard Stallman
2010-12-01 13:10                 ` Richard Stallman
2010-12-02  0:05                   ` Stephen J. Turnbull
2010-12-02  4:19                   ` PJ Weisberg
2010-12-02  4:50                     ` Glenn Morris
2010-12-02  7:07                       ` Stephen J. Turnbull
2010-12-05 15:57                     ` Richard Stallman
2010-11-13 16:33 ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).