[mew-int 01215] Re: converting mail in latin-9
Tatsuya Kinoshita
tats at example.com
Wed Dec 11 20:31:17 JST 2002
On December 9, 2002, [mew-int 01201],
Serge Basterot <serge.basterot at example.com> wrote:
> I have to mention too that I'm not using Mule-UCS but ucs-tables.el
> for displaying latin caracters (you will find it easily on the
> web).
The my-mew-cs-force feature conflicts with ucs-tables.el.
Would you try another ad hoc feature, my-mew-nonascii? It might
work with ucs-tables.el on GNU Emacs 21. See below.
--
Tatsuya Kinoshita
-------------- next part --------------
;;; my-mew-nonascii.el --- non-ASCII hack for Mew's Draft mode
;; Author: Tatsuya Kinoshita <tats at example.com>
;; Created: Dec 11, 2002
;; Revised: Dec 11, 2002
;;
;; Unlimited permission is granted to use, copy, distribute, and/or modify
;; this file. There is NO WARRANTY.
;;; Commentary:
;; This feature is an ad hoc solution for the iso-8859 conversion of Mew
;; on GNU Emacs 21.
;;
;; The `my-mew-nonascii-set-charset' function sets output message charset
;; to the value of the `my-mew-nonascii-charset' variable forcedly.
;;
;; If a non-ASCII character appears in the cover text of Mew's Draft mode,
;; the value of the `my-mew-nonascii-charset' variable is set. If a
;; non-ASCII character doesn't appear, default charset ("us-ascii") is used.
;;
;; `ucs-tables' provided by Dave Love <fx at example.com> is helpful for this
;; feature.
;; A sample of ~/.mew.el:
;;
;; (require 'my-mew-nonascii)
;; (setq my-mew-nonascii-charset "iso-8859-15")
;; (defun my-mew-draft-share-user-keymap (symmap)
;; (define-key (symbol-value symmap) "\C-cU" 'my-mew-nonascii-set-charset))
;; (my-mew-draft-share-user-keymap 'mew-draft-header-map)
;; (my-mew-draft-share-user-keymap 'mew-draft-body-map)
;; (my-mew-draft-share-user-keymap 'mew-draft-attach-map)
;; ;;(add-hook 'mew-send-hook 'my-mew-nonascii-set-charset)
;; ;;(add-hook 'mew-post-hook 'my-mew-nonascii-set-charset)
;; A sample of ~/.emacs:
;;
;; (set-language-environment "Latin-9")
;; (set-default-coding-systems 'iso-8859-15)
;; ;;(prefer-coding-system 'utf-8)
;; (prefer-coding-system 'iso-8859-15)
;; ;;(setq default-input-method "latin-9-prefix")
;; ;;(set-keyboard-coding-system 'iso-8859-15)
;; ;;(set-terminal-coding-system 'iso-8859-15)
;;
;; (require 'ucs-tables) ;; gnus/contrib/ucs-tables.el from cvs.gnus.org
;; (unify-8859-on-encoding-mode 1)
;; (unify-8859-on-decoding-mode 1)
;; ;;(require 'un-define) ;; Mule-UCS
;;; Code:
(require 'mew)
(defvar my-mew-nonascii-charset nil)
(defun my-mew-nonascii-set-charset ()
(interactive)
(when (and mew-mule-p my-mew-nonascii-charset)
(if (not (mew-attach-p))
(mew-draft-prepare-attachments 'no-scroll))
(let* ((param "charset")
(nums '(1))
(syntax (mew-syntax-get-entry mew-encode-syntax nums))
(file (mew-syntax-get-file syntax))
(ctl (mew-syntax-get-ct syntax))
(ct (mew-syntax-get-value ctl 'cap))
(params (mew-syntax-get-params ctl))
charset)
(when (mew-ct-textp ct)
(setq charset
(if (string=
mew-us-ascii
(mew-charset-guess-region (my-mew-nonascii-body-min)
(my-mew-nonascii-body-max)))
"guess"
(downcase my-mew-nonascii-charset)))
(setq params (mew-delete param params))
(if (string= charset "guess")
(setq ctl (cons ct params))
(if (not (member charset mew-charset-list))
(error "Cannot use charset %s" charset)
(setq ctl (cons ct (cons (list param charset) params)))))
(mew-syntax-set-ct syntax ctl)
(mew-encode-syntax-print mew-encode-syntax)))))
(defun my-mew-nonascii-body-min ()
(interactive)
(save-excursion
(mew-header-goto-body)
(point)))
(defun my-mew-nonascii-body-max ()
(interactive)
(save-excursion
(if (not (mew-attach-p))
(point-max)
(mew-attach-move-onto-body)
(point))))
(provide 'my-mew-nonascii)
;;; my-mew-nonascii.el ends here
More information about the Mew-int
mailing list