From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Emacs 22 branch created. Date: Wed, 02 May 2007 11:17:23 +0900 Message-ID: References: <871wi9jw37.fsf@catnip.gol.com> <462E7B94.3000008@gnu.org> <462F0A07.50104@gnu.org> <864pn4an8j.fsf@lola.quinscape.zz> <86zm4w97du.fsf@lola.quinscape.zz> <20070425195026.GA19472@printf.se> <20070427133832.22F374DD5F@rocksteady.printf.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1178072273 5541 80.91.229.12 (2 May 2007 02:17:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 May 2007 02:17:53 +0000 (UTC) Cc: henrik.enberg@telia.com, eliz@gnu.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 02 04:17:50 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hj4Pc-0007hx-EI for ged-emacs-devel@m.gmane.org; Wed, 02 May 2007 04:17:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hj4Vy-0005yn-7q for ged-emacs-devel@m.gmane.org; Tue, 01 May 2007 22:24:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hj4Vu-0005wH-Kx for emacs-devel@gnu.org; Tue, 01 May 2007 22:24:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hj4Vt-0005w5-P2 for emacs-devel@gnu.org; Tue, 01 May 2007 22:24:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hj4Vt-0005w2-Lc for emacs-devel@gnu.org; Tue, 01 May 2007 22:24:17 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hj4PT-0004hl-Sj; Tue, 01 May 2007 22:17:40 -0400 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id l422HRCC012719; Wed, 2 May 2007 11:17:27 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp4.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id l422HRO4018533; Wed, 2 May 2007 11:17:27 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp4.aist.go.jp with ESMTP id l422HNac004004; Wed, 2 May 2007 11:17:23 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.63) (envelope-from ) id 1Hj4PD-0003v9-JM; Wed, 02 May 2007 11:17:23 +0900 In-reply-to: (message from Richard Stallman on Sat, 28 Apr 2007 14:35:18 -0400) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:70463 Archived-At: In article , Richard Stallman writes: > #1 is intolerable because it means C-x b RMAIL RET won't take you > to the current message. > Why not? We could arrange for RMAIL to be that separate buffer where > we display decoded message text. > Normally the buffer named RMAIL is the one that visits the file RMAIL. > If we break that correspondence it is likely to cause a lot of > trouble. And what would we do for other mail files? I've long used the rmail-mime package which uses different buffer than the RMAIL file buffer for displaying a decoded message, and it doesn't have a serious problem. The only problem I feel is the somewhat slowness of rmail-search-forward/backward. As rmail.el already has various *-function variables (e.g. rmail-show-mime-function), what rmail-mime does is just setting proper functions to those variables. I'll attach the core file (rmail-mime.el) of that package so that you can see how it works. Unfortunately, rmail-mime package provides various its own functions for handling mime features that conflicts with the current Gnus, and is not maintained now. So it seems very difficult to include it in Emacs. But, I think it's possible to utilze Gnus' mime facilities in the similar way. > file, and the question I was asking is how to store the decoded > characters in that file, if you don't want to decode them each time > you look at that message. Are you suggesting to store them, after > decoding, in the internal Emacs format (i.e. emacs-mule)? That would > mean that only Emacs will be able to read the resulting mbox file. > That is a valid point. > A new idea just occurred to me. Moving to a message could copy that > message in the buffer, decode the copy, and display that copy using > narrowing instead of the original message. If you edit the message, > exiting the editing mode will reencode it and put that in place > of the original message. > We could have a new feature to omit part of the buffer when saving the > file. Rmail could use it so that this copy is not saved. This > feature should not affect auto-saving. > As an optimization, if there are attachments, don't copy them. Just > copy and decode the main text of the message. (Attachments don't need > character set decoding, since they are in ASCII.) Put the copy after > the original, and the attachments will effecvtively become part of it. > Does anyone see a flaw in this? One disadvantage of that method compared to using a different buffer is that, RMAIL file must be read into a multibyte buffer, which requires decoding all 8-bit bytes into multibyte 8-bit characters. I think the percentage of 8-bit bytes is small, but the decoding process move memories many times. If we use a different buffer for decoding, that process becomes unnecessary. RMAIL file tends to become very big (especially for novice users). --- Kenichi Handa handa@m17n.org ---------------------------------------------------------------------- ;;; rmail-mime.el --- Add MIME handling facility to RMAIL ;; Copyright (C) 2001 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;; This file is part of SEMI (Setting for Emacs MIME Interfaces). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: (require 'mime-view) (defun rmail-decode-header (decoded-buffer original-buffer start end) (set-buffer (get-buffer-create decoded-buffer)) (erase-buffer) (insert-buffer-substring original-buffer start end) (mime-decode-header-in-buffer rmail-enable-mime)) (defun rmail-decode-mime-message (decoded-buffer original-buffer msg) (save-excursion (set-buffer original-buffer) (save-restriction (narrow-to-region (rmail-msgbeg msg) (rmail-msgend msg)) (setq mime-message-structure (mime-open-entity 'babyl original-buffer)) (mime-display-message mime-message-structure decoded-buffer))) (set-buffer decoded-buffer)) (defun rmail-view-kill-rmail-buffer () (if rmail-buffer (kill-buffer rmail-buffer))) (defvar rmail-view-mode-map nil) (defun rmail-show-mime-message () (let ((abuf (current-buffer)) (buf-name (concat (buffer-name) "-view")) buf win) (narrow-to-region (rmail-msgbeg rmail-current-message) (rmail-msgend rmail-current-message)) (setq mime-message-structure (mime-open-entity 'babyl abuf)) (set-buffer (mime-display-message mime-message-structure buf-name nil nil nil rmail-view-mode-map)) (setq buf (current-buffer)) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(rmail-font-lock-keywords t nil nil nil (font-lock-maximum-size . nil) (font-lock-fontify-buffer-function . rmail-fontify-buffer-function) (font-lock-unfontify-buffer-function . rmail-unfontify-buffer-function) (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode)))) (make-local-variable 'rmail-buffer) (setq rmail-buffer abuf) (make-local-variable 'rmail-view-buffer) (setq rmail-view-buffer (current-buffer)) (make-local-variable 'rmail-summary-buffer) (setq rmail-summary-buffer (with-current-buffer rmail-buffer rmail-summary-buffer)) (make-local-variable 'rmail-current-message) (setq rmail-current-message (with-current-buffer rmail-buffer rmail-current-message)) (make-local-variable 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'rmail-view-kill-rmail-buffer) (let ((mode-line (with-current-buffer abuf (setq rmail-view-buffer buf) mode-line-process))) (setq mode-line-process mode-line)) (if (and (setq win (get-buffer-window abuf)) buf) (set-window-buffer win buf)) (bury-buffer rmail-buffer) (run-hooks 'rmail-show-mime-message-hook))) (defun rmail-insert-mime-forwarded-message (forward-buffer) (insert (mime-make-tag "message" "rfc822")) (insert "\n") (mime-insert-entity (with-current-buffer forward-buffer mime-message-structure))) (defun rmail-insert-mime-resent-message (forward-buffer) (mime-insert-entity (with-current-buffer forward-buffer mime-message-structure))) (defun rmail-enable-mime () (interactive) (setq rmail-enable-mime t) (rmail-show-message)) (defun rmail-disable-mime () (interactive) (let ((buf rmail-buffer)) (when rmail-enable-mime (remove-hook 'kill-buffer-hook 'rmail-view-kill-rmail-buffer) (set-window-buffer (selected-window) buf) (kill-buffer rmail-view-buffer)) (set-buffer buf)) (setq rmail-enable-mime nil rmail-view-buffer (current-buffer)) (rmail-show-message)) (defun rmail-search-mime-message (msg regexp) "Search the message of number MSG for REGEXP. If the search succeeds, return non-nil. Otherwise, return nil." (save-excursion (rmail-decode-mime-message " *RMAIL-temp-VIEW*" (current-buffer) msg) (goto-char (point-min)) (prog1 (re-search-forward regexp nil t) (kill-buffer " *RMAIL-temp-VIEW*")))) (defun rmail-search-mime-header (msg regexp limit) "Search the message header of number MSG for REGEXP. The current point is the beginninf of header, and LIMIT is the end position of header. If the search succeeds, return non-nil. Otherwise, return nil." (save-excursion (rmail-decode-header " *RMAIL-temp-VIEW*" (current-buffer) (point) limit) (goto-char (point-min)) (prog1 (re-search-forward regexp nil t) (kill-buffer " *RMAIL-temp-VIEW*")))) (set-alist 'mime-raw-representation-type-alist 'rmail-mode (if rmail-enable-mime 'binary 'cooked)) (set-alist 'mime-preview-over-to-previous-method-alist 'rmail-mode (function (lambda () (message "Beginning of buffer") ;; (rmail-previous-undeleted-message 1) ))) (set-alist 'mime-preview-over-to-next-method-alist 'rmail-mode (function (lambda () (message "End of buffer") ;; (rmail-next-undeleted-message 1) ))) (set-alist 'mime-preview-quitting-method-alist 'rmail-mode #'rmail-quit) ;; Override values defined in rmail. (eval-after-load "rmail" '(progn (define-key rmail-mode-map "v" 'rmail-enable-mime) (setq rmail-show-mime-function (function rmail-show-mime-message) rmail-insert-mime-forwarded-message-function (function rmail-insert-mime-forwarded-message) rmail-insert-mime-resent-message-function (function rmail-insert-mime-resent-message) rmail-search-mime-message-function (function rmail-search-mime-message) rmail-search-mime-header-function (function rmail-search-mime-header)) (unless rmail-view-mode-map (setq rmail-view-mode-map (mime-view-define-keymap rmail-mode-map)) (define-key rmail-view-mode-map "p" (function rmail-previous-undeleted-message)) (define-key rmail-view-mode-map "n" (function rmail-next-undeleted-message)) (define-key rmail-view-mode-map "u" (function rmail-undelete-previous-message)) (define-key rmail-view-mode-map "a" (function rmail-add-label)) (define-key rmail-view-mode-map "\C-c\C-c" (function rmail-disable-mime))))) ;; Override values defined in rmailsum. (eval-after-load "rmailsum" '(setq rmail-summary-line-decoder (function (lambda (string) (eword-decode-string (decode-coding-string string 'undecided)))))) ;; Override values defined in sendmail. (eval-after-load "sendmail" '(progn (add-hook 'mail-setup-hook 'turn-on-mime-edit) (add-hook 'mail-send-hook 'mime-edit-maybe-translate))) (provide 'rmail-mime)