all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: emacs-devel@gnu.org
Subject: improve rmail's MIME handling
Date: Fri, 12 Nov 2010 21:28:07 +0900	[thread overview]
Message-ID: <tl78w0ysp48.fsf@m17n.org> (raw)

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




             reply	other threads:[~2010-11-12 12:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 12:28 Kenichi Handa [this message]
2010-11-12 12:39 ` improve rmail's MIME handling 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

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

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

  git send-email \
    --in-reply-to=tl78w0ysp48.fsf@m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.