* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
;;; mm-util.el --- Utility functions for Mule and low level things
|
2005-08-06 19:51:42 +00:00
|
|
|
|
2016-01-01 01:16:19 -08:00
|
|
|
;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
|
|
|
|
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:56:49 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-09-19 13:40:08 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:56:49 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-05-06 03:56:49 +00:00
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2000-09-19 13:40:08 +00:00
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:56:49 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
(eval-when-compile (require 'cl))
|
2000-09-19 13:40:08 +00:00
|
|
|
(require 'mail-prsvr)
|
2016-02-12 13:38:12 +11:00
|
|
|
(require 'timer)
|
2007-10-28 09:18:39 +00:00
|
|
|
|
2016-02-14 17:19:24 +11:00
|
|
|
(defvar mm-mime-mule-charset-alist)
|
* smime.el (from):
* rfc2047.el (message-posting-charset):
* qp.el (mm-use-ultra-safe-encoding):
* pop3.el (parse-time-months):
* nnrss.el (mm-text-html-renderer, mm-text-html-washer-alist):
* nnml.el (files):
* nnheader.el (gnus-newsgroup-name, nnheader-file-coding-system)
(jka-compr-compression-info-list, ange-ftp-path-format)
(efs-path-regexp):
* nndiary.el (files):
* mml2015.el (mc-default-scheme, mc-schemes, pgg-default-user-id)
(pgg-errors-buffer, pgg-output-buffer, epg-user-id-alist)
(epg-digest-algorithm-alist, inhibit-redisplay)
(password-cache-expiry):
* mml1991.el (pgg-default-user-id, pgg-errors-buffer)
(pgg-output-buffer, password-cache-expiry):
* mml.el (mml-dnd-protocol-alist, ange-ftp-name-format)
(efs-path-regexp):
* mml-smime.el (epg-user-id-alist, epg-digest-algorithm-alist)
(inhibit-redisplay):
* mm-uu.el (file-name, start-point, end-point, entry)
(gnus-newsgroup-name, gnus-newsgroup-charset):
* mm-util.el (mm-mime-mule-charset-alist, latin-unity-coding-systems)
(latin-unity-ucs-list):
* mm-bodies.el (mm-uu-yenc-decode-function, mm-uu-decode-function)
(mm-uu-binhex-decode-function):
* message.el (gnus-message-group-art, gnus-list-identifiers, )
(rmail-enable-mime-composing, gnus-local-organization)
(gnus-post-method, gnus-select-method, gnus-active-hashtb)
(gnus-read-active-file, facemenu-add-face-function)
(facemenu-remove-face-function, gnus-article-decoded-p)
(tool-bar-mode):
* mail-source.el (display-time-mail-function):
* gnus-util.el (nnmail-pathname-coding-system)
(nnmail-active-file-coding-system, gnus-emphasize-whitespace-regexp)
(gnus-original-article-buffer, gnus-user-agent)
(rmail-default-rmail-file, mm-text-coding-system, tool-bar-mode)
(xemacs-codename, sxemacs-codename, emacs-program-version):
* gnus-sum.el (tool-bar-mode, gnus-tmp-header, number):
* gnus-start.el (gnus-agent-covered-methods)
(gnus-agent-file-loading-local, gnus-agent-file-loading-cache)
(gnus-current-headers, gnus-thread-indent-array, gnus-newsgroup-name)
(gnus-newsgroup-headers, gnus-group-list-mode)
(gnus-group-mark-positions, gnus-newsgroup-data)
(gnus-newsgroup-unreads, nnoo-state-alist)
(gnus-current-select-method, mail-sources)
(nnmail-scan-directory-mail-source-once, nnmail-split-history)
(nnmail-spool-file, gnus-cache-active-hashtb):
* gnus-mh.el (mh-lib-progs):
* gnus-ems.el (gnus-tmp-unread, gnus-tmp-replied)
(gnus-tmp-score-char, gnus-tmp-indentation, gnus-tmp-opening-bracket)
(gnus-tmp-lines, gnus-tmp-name, gnus-tmp-closing-bracket)
(gnus-tmp-subject-or-nil, gnus-check-before-posting, gnus-mouse-face)
(gnus-group-buffer):
* gnus-cite.el (font-lock-defaults-computed, font-lock-keywords)
(font-lock-set-defaults):
* gnus-art.el (tool-bar-map, w3m-minor-mode-map)
(gnus-face-properties-alist, charset, gnus-summary-article-menu)
(gnus-summary-post-menu, total-parts, type, condition, length):
* gnus-agent.el (gnus-agent-read-agentview):
* flow-fill.el (show-trailing-whitespace):
* gnus-group.el (tool-bar-mode, nnrss-group-alist): Remove unnecessary
eval-and-compile wrappers for byte compiler pacifiers.
* mm-view.el (mm-inline-image-xemacs): Only do something for XEmacs.
(mm-display-inline-fontify): Check for featurep 'xemacs not
extent-list.
* mm-decode.el (mm-display-external): Check for featurep 'xemacs not
itimer-list.
(mm-create-image-xemacs): Only do something for XEmacs.
(mm-image-fit-p): Check for featurep 'xemacs not glyph-width.
* mm-util.el (mm-find-buffer-file-coding-system): Add check for XEmacs.
* gnus-registry.el (gnus-adaptive-word-syntax-table):
* gnus-fun.el (gnus-face-properties-alist): Pacify byte compiler.
* textmodes/reftex-dcr.el (reftex-start-itimer-once): Add check
for XEmacs.
* calc/calc-menu.el (calc-mode-map): Pacify byte compiler.
* doc-view.el (doc-view-resolution): Add missing :group.
2007-11-16 16:50:35 +00:00
|
|
|
|
2016-02-12 14:39:30 +11:00
|
|
|
(defun mm-ucs-to-char (codepoint)
|
|
|
|
"Convert Unicode codepoint to character."
|
|
|
|
(or (decode-char 'ucs codepoint) ?#))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defvar mm-coding-system-list nil)
|
|
|
|
(defun mm-get-coding-system-list ()
|
|
|
|
"Get the coding system list."
|
|
|
|
(or mm-coding-system-list
|
2016-02-12 14:39:30 +11:00
|
|
|
(setq mm-coding-system-list (coding-system-list))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
(defun mm-coding-system-p (cs)
|
2016-02-12 14:39:30 +11:00
|
|
|
"Return CS if CS is a coding system."
|
|
|
|
(and (coding-system-p cs)
|
|
|
|
cs))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defvar mm-charset-synonym-alist
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
`(
|
|
|
|
;; Not in XEmacs, but it's not a proper MIME charset anyhow.
|
2001-11-01 15:29:49 +00:00
|
|
|
,@(unless (mm-coding-system-p 'x-ctext)
|
2006-07-16 22:19:06 +00:00
|
|
|
'((x-ctext . ctext)))
|
2006-10-30 08:47:46 +00:00
|
|
|
;; ISO-8859-15 is very similar to ISO-8859-1. But it's _different_ in 8
|
|
|
|
;; positions!
|
2004-09-04 13:13:48 +00:00
|
|
|
,@(unless (mm-coding-system-p 'iso-8859-15)
|
2006-07-16 22:19:06 +00:00
|
|
|
'((iso-8859-15 . iso-8859-1)))
|
2004-09-04 13:13:48 +00:00
|
|
|
;; BIG-5HKSCS is similar to, but different than, BIG-5.
|
|
|
|
,@(unless (mm-coding-system-p 'big5-hkscs)
|
|
|
|
'((big5-hkscs . big5)))
|
2006-04-17 19:37:15 +00:00
|
|
|
;; A Microsoft misunderstanding.
|
2006-10-30 08:47:46 +00:00
|
|
|
,@(when (and (not (mm-coding-system-p 'unicode))
|
|
|
|
(mm-coding-system-p 'utf-16-le))
|
|
|
|
'((unicode . utf-16-le)))
|
2006-04-17 19:37:15 +00:00
|
|
|
;; A Microsoft misunderstanding.
|
|
|
|
,@(unless (mm-coding-system-p 'ks_c_5601-1987)
|
|
|
|
(if (mm-coding-system-p 'cp949)
|
|
|
|
'((ks_c_5601-1987 . cp949))
|
|
|
|
'((ks_c_5601-1987 . euc-kr))))
|
2006-07-16 22:19:06 +00:00
|
|
|
;; Windows-31J is Windows Codepage 932.
|
2006-10-30 08:47:46 +00:00
|
|
|
,@(when (and (not (mm-coding-system-p 'windows-31j))
|
|
|
|
(mm-coding-system-p 'cp932))
|
|
|
|
'((windows-31j . cp932)))
|
2007-10-09 08:55:58 +00:00
|
|
|
;; Charset name: GBK, Charset aliases: CP936, MS936, windows-936
|
|
|
|
;; http://www.iana.org/assignments/charset-reg/GBK
|
|
|
|
;; Emacs 22.1 has cp936, but not gbk, so we alias it:
|
|
|
|
,@(when (and (not (mm-coding-system-p 'gbk))
|
|
|
|
(mm-coding-system-p 'cp936))
|
|
|
|
'((gbk . cp936)))
|
2008-12-17 00:34:16 +00:00
|
|
|
;; UTF8 is a bogus name for UTF-8
|
|
|
|
,@(when (and (not (mm-coding-system-p 'utf8))
|
|
|
|
(mm-coding-system-p 'utf-8))
|
|
|
|
'((utf8 . utf-8)))
|
2007-10-28 09:18:39 +00:00
|
|
|
;; ISO8859-1 is a bogus name for ISO-8859-1
|
|
|
|
,@(when (and (not (mm-coding-system-p 'iso8859-1))
|
|
|
|
(mm-coding-system-p 'iso-8859-1))
|
|
|
|
'((iso8859-1 . iso-8859-1)))
|
2008-12-17 00:34:16 +00:00
|
|
|
;; ISO_8859-1 is a bogus name for ISO-8859-1
|
|
|
|
,@(when (and (not (mm-coding-system-p 'iso_8859-1))
|
|
|
|
(mm-coding-system-p 'iso-8859-1))
|
|
|
|
'((iso_8859-1 . iso-8859-1)))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
)
|
2016-02-14 17:19:24 +11:00
|
|
|
"A mapping from unknown or invalid charset names to the real charset names.")
|
2006-04-17 19:37:15 +00:00
|
|
|
|
2008-12-15 04:15:35 +00:00
|
|
|
;; Note: this has to be defined before `mm-charset-to-coding-system'.
|
2016-02-14 17:19:24 +11:00
|
|
|
(defcustom mm-charset-eval-alist nil
|
2008-12-15 04:15:35 +00:00
|
|
|
"An alist of (CHARSET . FORM) pairs.
|
|
|
|
If an article is encoded in an unknown CHARSET, FORM is
|
2016-01-24 20:30:39 +00:00
|
|
|
evaluated. This allows the loading of additional libraries
|
|
|
|
providing charsets on demand. If supported by your Emacs
|
|
|
|
version, you could use `autoload-coding-system' here."
|
2008-12-15 04:15:35 +00:00
|
|
|
:version "22.1" ;; Gnus 5.10.9
|
2016-02-14 17:19:24 +11:00
|
|
|
:type '(list (repeat :inline t
|
2008-12-15 04:15:35 +00:00
|
|
|
:tag "Other options"
|
|
|
|
(cons (symbol :tag "charset")
|
|
|
|
(symbol :tag "form"))))
|
|
|
|
:group 'mime)
|
|
|
|
(put 'mm-charset-eval-alist 'risky-local-variable t)
|
|
|
|
|
2008-12-16 08:10:01 +00:00
|
|
|
(defvar mm-charset-override-alist)
|
|
|
|
|
2008-12-15 04:15:35 +00:00
|
|
|
;; Note: this function has to be defined before `mm-charset-override-alist'
|
|
|
|
;; since it will use this function in order to determine its default value
|
|
|
|
;; when loading mm-util.elc.
|
|
|
|
(defun mm-charset-to-coding-system (charset &optional lbt
|
|
|
|
allow-override silent)
|
|
|
|
"Return coding-system corresponding to CHARSET.
|
|
|
|
CHARSET is a symbol naming a MIME charset.
|
|
|
|
If optional argument LBT (`unix', `dos' or `mac') is specified, it is
|
|
|
|
used as the line break code type of the coding system.
|
|
|
|
|
|
|
|
If ALLOW-OVERRIDE is given, use `mm-charset-override-alist' to
|
|
|
|
map undesired charset names to their replacement. This should
|
|
|
|
only be used for decoding, not for encoding.
|
|
|
|
|
|
|
|
A non-nil value of SILENT means don't issue a warning even if CHARSET
|
|
|
|
is not available."
|
|
|
|
;; OVERRIDE is used (only) in `mm-decode-body' and `mm-decode-string'.
|
|
|
|
(when (stringp charset)
|
|
|
|
(setq charset (intern (downcase charset))))
|
|
|
|
(when lbt
|
|
|
|
(setq charset (intern (format "%s-%s" charset lbt))))
|
|
|
|
(cond
|
|
|
|
((null charset)
|
|
|
|
charset)
|
|
|
|
;; Running in a non-MULE environment.
|
|
|
|
((or (null (mm-get-coding-system-list))
|
|
|
|
(not (fboundp 'coding-system-get)))
|
|
|
|
charset)
|
|
|
|
;; Check override list quite early. Should only used for decoding, not for
|
|
|
|
;; encoding!
|
|
|
|
((and allow-override
|
|
|
|
(let ((cs (cdr (assq charset mm-charset-override-alist))))
|
|
|
|
(and cs (mm-coding-system-p cs) cs))))
|
|
|
|
;; ascii
|
2011-06-30 01:44:14 +00:00
|
|
|
((or (eq charset 'us-ascii)
|
|
|
|
(string-match "ansi.x3.4" (symbol-name charset)))
|
2008-12-15 04:15:35 +00:00
|
|
|
'ascii)
|
|
|
|
;; Check to see whether we can handle this charset. (This depends
|
|
|
|
;; on there being some coding system matching each `mime-charset'
|
|
|
|
;; property defined, as there should be.)
|
|
|
|
((and (mm-coding-system-p charset)
|
|
|
|
;;; Doing this would potentially weed out incorrect charsets.
|
|
|
|
;;; charset
|
|
|
|
;;; (eq charset (coding-system-get charset 'mime-charset))
|
|
|
|
)
|
|
|
|
charset)
|
2010-03-15 01:38:28 +00:00
|
|
|
;; Use coding system Emacs knows.
|
|
|
|
((and (fboundp 'coding-system-from-name)
|
|
|
|
(coding-system-from-name charset)))
|
2008-12-15 04:15:35 +00:00
|
|
|
;; Eval expressions from `mm-charset-eval-alist'
|
|
|
|
((let* ((el (assq charset mm-charset-eval-alist))
|
|
|
|
(cs (car el))
|
|
|
|
(form (cdr el)))
|
|
|
|
(and cs
|
|
|
|
form
|
|
|
|
(prog2
|
|
|
|
;; Avoid errors...
|
|
|
|
(condition-case nil (eval form) (error nil))
|
|
|
|
;; (message "Failed to eval `%s'" form))
|
|
|
|
(mm-coding-system-p cs)
|
|
|
|
(message "Added charset `%s' via `mm-charset-eval-alist'" cs))
|
|
|
|
cs)))
|
|
|
|
;; Translate invalid charsets.
|
|
|
|
((let ((cs (cdr (assq charset mm-charset-synonym-alist))))
|
|
|
|
(and cs
|
|
|
|
(mm-coding-system-p cs)
|
|
|
|
;; (message
|
|
|
|
;; "Using synonym `%s' from `mm-charset-synonym-alist' for `%s'"
|
|
|
|
;; cs charset)
|
|
|
|
cs)))
|
|
|
|
;; Last resort: search the coding system list for entries which
|
|
|
|
;; have the right mime-charset in case the canonical name isn't
|
|
|
|
;; defined (though it should be).
|
|
|
|
((let (cs)
|
|
|
|
;; mm-get-coding-system-list returns a list of cs without lbt.
|
|
|
|
;; Do we need -lbt?
|
|
|
|
(dolist (c (mm-get-coding-system-list))
|
|
|
|
(if (and (null cs)
|
|
|
|
(eq charset (or (coding-system-get c :mime-charset)
|
|
|
|
(coding-system-get c 'mime-charset))))
|
|
|
|
(setq cs c)))
|
|
|
|
(unless (or silent cs)
|
|
|
|
;; Warn the user about unknown charset:
|
|
|
|
(if (fboundp 'gnus-message)
|
|
|
|
(gnus-message 7 "Unknown charset: %s" charset)
|
|
|
|
(message "Unknown charset: %s" charset)))
|
|
|
|
cs))))
|
|
|
|
|
|
|
|
;; Note: `mm-charset-to-coding-system' has to be defined before this.
|
2006-04-17 19:37:15 +00:00
|
|
|
(defcustom mm-charset-override-alist
|
2008-12-15 04:15:35 +00:00
|
|
|
;; Note: pairs that cannot be used in the Emacs version currently running
|
|
|
|
;; will be removed.
|
|
|
|
'((gb2312 . gbk)
|
|
|
|
(iso-8859-1 . windows-1252)
|
2007-10-28 09:18:39 +00:00
|
|
|
(iso-8859-8 . windows-1255)
|
|
|
|
(iso-8859-9 . windows-1254))
|
2006-04-17 19:37:15 +00:00
|
|
|
"A mapping from undesired charset names to their replacement.
|
|
|
|
|
|
|
|
You may add pairs like (iso-8859-1 . windows-1252) here,
|
|
|
|
i.e. treat iso-8859-1 as windows-1252. windows-1252 is a
|
|
|
|
superset of iso-8859-1."
|
2008-12-10 10:02:50 +00:00
|
|
|
:type
|
|
|
|
'(list
|
|
|
|
:convert-widget
|
|
|
|
(lambda (widget)
|
|
|
|
(let ((defaults
|
|
|
|
(delq nil
|
|
|
|
(mapcar (lambda (pair)
|
2008-12-15 04:15:35 +00:00
|
|
|
(if (mm-charset-to-coding-system (cdr pair)
|
|
|
|
nil nil t)
|
2008-12-10 10:02:50 +00:00
|
|
|
pair))
|
|
|
|
'((gb2312 . gbk)
|
|
|
|
(iso-8859-1 . windows-1252)
|
|
|
|
(iso-8859-8 . windows-1255)
|
|
|
|
(iso-8859-9 . windows-1254)
|
|
|
|
(undecided . windows-1252)))))
|
|
|
|
(val (copy-sequence (default-value 'mm-charset-override-alist)))
|
|
|
|
pair rest)
|
|
|
|
(while val
|
|
|
|
(push (if (and (prog1
|
|
|
|
(setq pair (assq (caar val) defaults))
|
|
|
|
(setq defaults (delq pair defaults)))
|
|
|
|
(equal (car val) pair))
|
|
|
|
`(const ,pair)
|
|
|
|
`(cons :format "%v"
|
|
|
|
(const :format "(%v" ,(caar val))
|
|
|
|
(symbol :size 3 :format " . %v)\n" ,(cdar val))))
|
|
|
|
rest)
|
|
|
|
(setq val (cdr val)))
|
|
|
|
(while defaults
|
|
|
|
(push `(const ,(pop defaults)) rest))
|
|
|
|
(widget-convert
|
|
|
|
'list
|
|
|
|
`(set :inline t :format "%v" ,@(nreverse rest))
|
|
|
|
`(repeat :inline t :tag "Other options"
|
|
|
|
(cons :format "%v"
|
|
|
|
(symbol :size 3 :format "(%v")
|
|
|
|
(symbol :size 3 :format " . %v)\n")))))))
|
2008-12-15 04:15:35 +00:00
|
|
|
;; Remove pairs that cannot be used in the Emacs version currently
|
|
|
|
;; running. Note that this section will be evaluated when loading
|
|
|
|
;; mm-util.elc.
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
(custom-set-default
|
|
|
|
symbol (delq nil
|
|
|
|
(mapcar (lambda (pair)
|
|
|
|
(if (mm-charset-to-coding-system (cdr pair)
|
|
|
|
nil nil t)
|
|
|
|
pair))
|
|
|
|
value))))
|
2006-10-03 04:58:52 +00:00
|
|
|
:version "22.1" ;; Gnus 5.10.9
|
2006-04-17 19:37:15 +00:00
|
|
|
:group 'mime)
|
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defvar mm-binary-coding-system
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(cond
|
2000-09-19 13:40:08 +00:00
|
|
|
((mm-coding-system-p 'binary) 'binary)
|
|
|
|
((mm-coding-system-p 'no-conversion) 'no-conversion)
|
|
|
|
(t nil))
|
|
|
|
"100% binary coding system.")
|
|
|
|
|
|
|
|
(defvar mm-text-coding-system
|
2010-08-30 23:24:56 +00:00
|
|
|
(or (if (memq system-type '(windows-nt ms-dos))
|
2000-09-19 13:40:08 +00:00
|
|
|
(and (mm-coding-system-p 'raw-text-dos) 'raw-text-dos)
|
|
|
|
(and (mm-coding-system-p 'raw-text) 'raw-text))
|
|
|
|
mm-binary-coding-system)
|
|
|
|
"Text-safe coding system (For removing ^M).")
|
|
|
|
|
|
|
|
(defvar mm-text-coding-system-for-write nil
|
|
|
|
"Text coding system for write.")
|
|
|
|
|
|
|
|
(defvar mm-auto-save-coding-system
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(cond
|
2004-09-04 13:13:48 +00:00
|
|
|
((mm-coding-system-p 'utf-8-emacs) ; Mule 7
|
2010-08-30 23:24:56 +00:00
|
|
|
(if (memq system-type '(windows-nt ms-dos))
|
2002-10-18 11:05:28 +00:00
|
|
|
(if (mm-coding-system-p 'utf-8-emacs-dos)
|
|
|
|
'utf-8-emacs-dos mm-binary-coding-system)
|
|
|
|
'utf-8-emacs))
|
2000-09-19 13:40:08 +00:00
|
|
|
((mm-coding-system-p 'emacs-mule)
|
2010-08-30 23:24:56 +00:00
|
|
|
(if (memq system-type '(windows-nt ms-dos))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(if (mm-coding-system-p 'emacs-mule-dos)
|
2000-09-19 13:40:08 +00:00
|
|
|
'emacs-mule-dos mm-binary-coding-system)
|
|
|
|
'emacs-mule))
|
|
|
|
((mm-coding-system-p 'escape-quoted) 'escape-quoted)
|
|
|
|
(t mm-binary-coding-system))
|
|
|
|
"Coding system of auto save file.")
|
|
|
|
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(defvar mm-universal-coding-system mm-auto-save-coding-system
|
2001-11-25 15:17:24 +00:00
|
|
|
"The universal coding system.")
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
|
|
|
;; Fixme: some of the cars here aren't valid MIME charsets. That
|
|
|
|
;; should only matter with XEmacs, though.
|
|
|
|
(defvar mm-mime-mule-charset-alist
|
2016-02-14 14:36:57 +11:00
|
|
|
'((us-ascii ascii)
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(iso-8859-1 latin-iso8859-1)
|
|
|
|
(iso-8859-2 latin-iso8859-2)
|
|
|
|
(iso-8859-3 latin-iso8859-3)
|
|
|
|
(iso-8859-4 latin-iso8859-4)
|
|
|
|
(iso-8859-5 cyrillic-iso8859-5)
|
|
|
|
;; Non-mule (X)Emacs uses the last mule-charset for 8bit characters.
|
|
|
|
;; The fake mule-charset, gnus-koi8-r, tells Gnus that the default
|
|
|
|
;; charset is koi8-r, not iso-8859-5.
|
|
|
|
(koi8-r cyrillic-iso8859-5 gnus-koi8-r)
|
|
|
|
(iso-8859-6 arabic-iso8859-6)
|
|
|
|
(iso-8859-7 greek-iso8859-7)
|
|
|
|
(iso-8859-8 hebrew-iso8859-8)
|
|
|
|
(iso-8859-9 latin-iso8859-9)
|
|
|
|
(iso-8859-14 latin-iso8859-14)
|
|
|
|
(iso-8859-15 latin-iso8859-15)
|
|
|
|
(viscii vietnamese-viscii-lower)
|
|
|
|
(iso-2022-jp latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978)
|
|
|
|
(euc-kr korean-ksc5601)
|
|
|
|
(gb2312 chinese-gb2312)
|
2006-11-27 04:37:26 +00:00
|
|
|
(gbk chinese-gbk)
|
|
|
|
(gb18030 gb18030-2-byte
|
|
|
|
gb18030-4-byte-bmp gb18030-4-byte-smp
|
|
|
|
gb18030-4-byte-ext-1 gb18030-4-byte-ext-2)
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(big5 chinese-big5-1 chinese-big5-2)
|
|
|
|
(tibetan tibetan)
|
|
|
|
(thai-tis620 thai-tis620)
|
2004-11-04 08:12:39 +00:00
|
|
|
(windows-1251 cyrillic-iso8859-5)
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(iso-2022-7bit ethiopic arabic-1-column arabic-2-column)
|
|
|
|
(iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7
|
|
|
|
latin-jisx0201 japanese-jisx0208-1978
|
|
|
|
chinese-gb2312 japanese-jisx0208
|
2004-11-04 08:12:39 +00:00
|
|
|
korean-ksc5601 japanese-jisx0212)
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(iso-2022-int-1 latin-iso8859-1 greek-iso8859-7
|
|
|
|
latin-jisx0201 japanese-jisx0208-1978
|
|
|
|
chinese-gb2312 japanese-jisx0208
|
|
|
|
korean-ksc5601 japanese-jisx0212
|
|
|
|
chinese-cns11643-1 chinese-cns11643-2)
|
|
|
|
(iso-2022-int-1 latin-iso8859-1 latin-iso8859-2
|
|
|
|
cyrillic-iso8859-5 greek-iso8859-7
|
|
|
|
latin-jisx0201 japanese-jisx0208-1978
|
|
|
|
chinese-gb2312 japanese-jisx0208
|
|
|
|
korean-ksc5601 japanese-jisx0212
|
|
|
|
chinese-cns11643-1 chinese-cns11643-2
|
|
|
|
chinese-cns11643-3 chinese-cns11643-4
|
|
|
|
chinese-cns11643-5 chinese-cns11643-6
|
|
|
|
chinese-cns11643-7)
|
2004-11-04 08:12:39 +00:00
|
|
|
(iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
|
|
|
|
japanese-jisx0213-1 japanese-jisx0213-2)
|
|
|
|
(shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208)
|
2016-02-14 14:36:57 +11:00
|
|
|
(utf-8))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
"Alist of MIME-charset/MULE-charsets.")
|
|
|
|
|
2004-11-04 08:12:39 +00:00
|
|
|
;; Correct by construction, but should be unnecessary for Emacs:
|
2016-02-12 14:39:30 +11:00
|
|
|
(when (and (fboundp 'coding-system-list)
|
|
|
|
(fboundp 'sort-coding-systems))
|
|
|
|
(let ((css (sort-coding-systems (coding-system-list 'base-only)))
|
|
|
|
cs mime mule alist)
|
|
|
|
(while css
|
|
|
|
(setq cs (pop css)
|
|
|
|
mime (or (coding-system-get cs :mime-charset) ; Emacs 23 (unicode)
|
|
|
|
(coding-system-get cs 'mime-charset)))
|
|
|
|
(when (and mime
|
|
|
|
(not (eq t (setq mule
|
|
|
|
(coding-system-get cs 'safe-charsets))))
|
|
|
|
(not (assq mime alist)))
|
|
|
|
(push (cons mime (delq 'ascii mule)) alist)))
|
|
|
|
(setq mm-mime-mule-charset-alist (nreverse alist))))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
2008-02-24 15:23:45 +00:00
|
|
|
(defvar mm-hack-charsets '(iso-8859-15 iso-2022-jp-2)
|
|
|
|
"A list of special charsets.
|
|
|
|
Valid elements include:
|
|
|
|
`iso-8859-15' convert ISO-8859-1, -9 to ISO-8859-15 if ISO-8859-15 exists.
|
|
|
|
`iso-2022-jp-2' convert ISO-2022-jp to ISO-2022-jp-2 if ISO-2022-jp-2 exists."
|
|
|
|
)
|
|
|
|
|
|
|
|
(defvar mm-iso-8859-15-compatible
|
|
|
|
'((iso-8859-1 "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE")
|
|
|
|
(iso-8859-9 "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xD0\xDD\xDE\xF0\xFD\xFE"))
|
|
|
|
"ISO-8859-15 exchangeable coding systems and inconvertible characters.")
|
|
|
|
|
|
|
|
(defvar mm-iso-8859-x-to-15-table
|
|
|
|
(and (fboundp 'coding-system-p)
|
|
|
|
(mm-coding-system-p 'iso-8859-15)
|
|
|
|
(mapcar
|
|
|
|
(lambda (cs)
|
|
|
|
(if (mm-coding-system-p (car cs))
|
|
|
|
(let ((c (string-to-char
|
|
|
|
(decode-coding-string "\341" (car cs)))))
|
|
|
|
(cons (char-charset c)
|
|
|
|
(cons
|
|
|
|
(- (string-to-char
|
|
|
|
(decode-coding-string "\341" 'iso-8859-15)) c)
|
|
|
|
(string-to-list (decode-coding-string (car (cdr cs))
|
|
|
|
(car cs))))))
|
|
|
|
'(gnus-charset 0)))
|
|
|
|
mm-iso-8859-15-compatible))
|
|
|
|
"A table of the difference character between ISO-8859-X and ISO-8859-15.")
|
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
(defcustom mm-coding-system-priorities
|
2016-02-14 14:36:57 +11:00
|
|
|
(and (string-match "\\`Japanese" current-language-environment)
|
|
|
|
;; Japanese users prefer iso-2022-jp to others usually used
|
|
|
|
;; for `buffer-file-coding-system', however iso-8859-1 should
|
|
|
|
;; be used when there are only ASCII and Latin-1 characters.
|
|
|
|
'(iso-8859-1 iso-2022-jp utf-8))
|
2004-09-04 13:13:48 +00:00
|
|
|
"Preferred coding systems for encoding outgoing messages.
|
|
|
|
|
|
|
|
More than one suitable coding system may be found for some text.
|
|
|
|
By default, the coding system with the highest priority is used
|
|
|
|
to encode outgoing messages (see `sort-coding-systems'). If this
|
|
|
|
variable is set, it overrides the default priority."
|
2013-08-19 05:10:33 +00:00
|
|
|
:version "24.4"
|
2004-09-04 13:13:48 +00:00
|
|
|
:type '(repeat (symbol :tag "Coding system"))
|
|
|
|
:group 'mime)
|
|
|
|
|
|
|
|
;; ??
|
2016-02-14 14:36:57 +11:00
|
|
|
(defvar mm-use-find-coding-systems-region t
|
2004-09-04 13:13:48 +00:00
|
|
|
"Use `find-coding-systems-region' to find proper coding systems.
|
|
|
|
|
|
|
|
Setting it to nil is useful on Emacsen supporting Unicode if sending
|
|
|
|
mail with multiple parts is preferred to sending a Unicode one.")
|
2002-01-03 14:51:05 +00:00
|
|
|
|
Leading "*" in the doc of defvars is long obsolete.
* lisp/plstore.el (plstore-encrypt-to):
* lisp/cedet/semantic/lex-spp.el
(semantic-lex-spp-macro-max-length-to-save):
* lisp/cedet/semantic/symref.el (semantic-symref-tool):
* lisp/cedet/semantic/bovine/el.el
(semantic-elisp-store-documentation-in-tag):
* lisp/cedet/semantic/wisent/comp.el (wisent-verbose-flag)
(wisent-expected-conflicts):
* lisp/cedet/semantic/wisent/wisent.el (wisent-parse-verbose-flag):
* lisp/gnus/gnus-agent.el (gnus-category-menu-hook):
* lisp/gnus/gnus-group.el (gnus-group-listing-limit):
* lisp/gnus/gnus-srvr.el (gnus-server-menu-hook)
(gnus-browse-menu-hook):
* lisp/gnus/message.el (message-shoot-gnksa-feet):
* lisp/gnus/mm-decode.el (mm-path-name-rewrite-functions):
* lisp/gnus/mm-util.el (mm-extra-numeric-entities):
* lisp/gnus/mm-view.el (mm-w3m-standalone-supports-m17n-p):
* lisp/gnus/mml.el (mml-generate-multipart-alist):
* lisp/gnus/nndraft.el (nndraft-required-headers):
* lisp/gnus/nnheader.el (nnheader-max-head-length)
(nnheader-head-chop-length, nnheader-file-name-translation-alist)
(nnheader-directory-separator-character)
(nnheader-pathname-coding-system):
* lisp/gnus/nnmail.el (nnmail-pathname-coding-system)
(nnmail-active-file-coding-system):
* lisp/gnus/nnrss.el (nnrss-file-coding-system):
* lisp/gnus/nntp.el (nntp-record-commands):
* lisp/gnus/score-mode.el (gnus-score-edit-done-hook)
(gnus-score-mode-hook, gnus-score-menu-hook):
* lisp/mail/rfc2047.el (rfc2047-header-encoding-alist)
(rfc2047-allow-irregular-q-encoded-words)
(rfc2047-allow-incomplete-encoded-text):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases):
* lisp/mh-e/mh-e.el (mh-mail-header-separator, mh-x-mailer-string):
* lisp/mh-e/mh-scan.el (mh-scan-format-mh, mh-scan-format-nmh):
* lisp/net/pop3.el (pop3-password):
* lisp/play/animate.el (animate-n-steps):
* lisp/progmodes/cc-vars.el (c-old-style-variable-behavior):
Convert from defvar with leading * to defcustom.
; * lisp/cedet/semantic/lex.el: Comments.
* lisp/emulation/viper-init.el (viper-heading-end):
* lisp/gnus/mm-url.el (mm-url-html-entities):
* lisp/gnus/nnmaildir.el (nnmaildir-article-file-name):
* lisp/mh-e/mh-e.el (mh-invisible-header-fields-compiled):
* lisp/net/tramp-adb.el (tramp-adb-method): Remove leading * from doc.
* lisp/gnus/messcompat.el: Mark (pointless) file not for compilation.
(message-from-style, message-interactive, message-indentation-spaces)
(message-signature, message-signature-file):
Remove settings that match the defaults.
(message-setup-hook, message-mode-hook, message-default-headers)
(message-send-hook, message-send-mail-function):
Just use setq rather than redefining.
* lisp/gnus/nnrss.el (nnrss):
* lisp/mail/rfc2047.el (rfc2047):
* lisp/play/animate.el (animate): New custom groups.
2016-06-10 00:23:33 -04:00
|
|
|
(defcustom mm-extra-numeric-entities
|
2010-12-07 05:06:56 +00:00
|
|
|
(mapcar
|
|
|
|
(lambda (item)
|
|
|
|
(cons (car item) (mm-ucs-to-char (cdr item))))
|
|
|
|
'((#x80 . #x20AC) (#x82 . #x201A) (#x83 . #x0192) (#x84 . #x201E)
|
|
|
|
(#x85 . #x2026) (#x86 . #x2020) (#x87 . #x2021) (#x88 . #x02C6)
|
|
|
|
(#x89 . #x2030) (#x8A . #x0160) (#x8B . #x2039) (#x8C . #x0152)
|
|
|
|
(#x8E . #x017D) (#x91 . #x2018) (#x92 . #x2019) (#x93 . #x201C)
|
|
|
|
(#x94 . #x201D) (#x95 . #x2022) (#x96 . #x2013) (#x97 . #x2014)
|
|
|
|
(#x98 . #x02DC) (#x99 . #x2122) (#x9A . #x0161) (#x9B . #x203A)
|
|
|
|
(#x9C . #x0153) (#x9E . #x017E) (#x9F . #x0178)))
|
|
|
|
"*Alist of extra numeric entities and characters other than ISO 10646.
|
|
|
|
This table is used for decoding extra numeric entities to characters,
|
Leading "*" in the doc of defvars is long obsolete.
* lisp/plstore.el (plstore-encrypt-to):
* lisp/cedet/semantic/lex-spp.el
(semantic-lex-spp-macro-max-length-to-save):
* lisp/cedet/semantic/symref.el (semantic-symref-tool):
* lisp/cedet/semantic/bovine/el.el
(semantic-elisp-store-documentation-in-tag):
* lisp/cedet/semantic/wisent/comp.el (wisent-verbose-flag)
(wisent-expected-conflicts):
* lisp/cedet/semantic/wisent/wisent.el (wisent-parse-verbose-flag):
* lisp/gnus/gnus-agent.el (gnus-category-menu-hook):
* lisp/gnus/gnus-group.el (gnus-group-listing-limit):
* lisp/gnus/gnus-srvr.el (gnus-server-menu-hook)
(gnus-browse-menu-hook):
* lisp/gnus/message.el (message-shoot-gnksa-feet):
* lisp/gnus/mm-decode.el (mm-path-name-rewrite-functions):
* lisp/gnus/mm-util.el (mm-extra-numeric-entities):
* lisp/gnus/mm-view.el (mm-w3m-standalone-supports-m17n-p):
* lisp/gnus/mml.el (mml-generate-multipart-alist):
* lisp/gnus/nndraft.el (nndraft-required-headers):
* lisp/gnus/nnheader.el (nnheader-max-head-length)
(nnheader-head-chop-length, nnheader-file-name-translation-alist)
(nnheader-directory-separator-character)
(nnheader-pathname-coding-system):
* lisp/gnus/nnmail.el (nnmail-pathname-coding-system)
(nnmail-active-file-coding-system):
* lisp/gnus/nnrss.el (nnrss-file-coding-system):
* lisp/gnus/nntp.el (nntp-record-commands):
* lisp/gnus/score-mode.el (gnus-score-edit-done-hook)
(gnus-score-mode-hook, gnus-score-menu-hook):
* lisp/mail/rfc2047.el (rfc2047-header-encoding-alist)
(rfc2047-allow-irregular-q-encoded-words)
(rfc2047-allow-incomplete-encoded-text):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases):
* lisp/mh-e/mh-e.el (mh-mail-header-separator, mh-x-mailer-string):
* lisp/mh-e/mh-scan.el (mh-scan-format-mh, mh-scan-format-nmh):
* lisp/net/pop3.el (pop3-password):
* lisp/play/animate.el (animate-n-steps):
* lisp/progmodes/cc-vars.el (c-old-style-variable-behavior):
Convert from defvar with leading * to defcustom.
; * lisp/cedet/semantic/lex.el: Comments.
* lisp/emulation/viper-init.el (viper-heading-end):
* lisp/gnus/mm-url.el (mm-url-html-entities):
* lisp/gnus/nnmaildir.el (nnmaildir-article-file-name):
* lisp/mh-e/mh-e.el (mh-invisible-header-fields-compiled):
* lisp/net/tramp-adb.el (tramp-adb-method): Remove leading * from doc.
* lisp/gnus/messcompat.el: Mark (pointless) file not for compilation.
(message-from-style, message-interactive, message-indentation-spaces)
(message-signature, message-signature-file):
Remove settings that match the defaults.
(message-setup-hook, message-mode-hook, message-default-headers)
(message-send-hook, message-send-mail-function):
Just use setq rather than redefining.
* lisp/gnus/nnrss.el (nnrss):
* lisp/mail/rfc2047.el (rfc2047):
* lisp/play/animate.el (animate): New custom groups.
2016-06-10 00:23:33 -04:00
|
|
|
like \"€\" to the euro sign, mainly in html messages."
|
|
|
|
:type '(alist :key-type character :value-type character)
|
|
|
|
:group 'mime)
|
2010-12-07 05:06:56 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
;;; Internal variables:
|
|
|
|
|
|
|
|
;;; Functions:
|
|
|
|
|
|
|
|
(defun mm-mule-charset-to-mime-charset (charset)
|
2000-11-10 18:02:56 +00:00
|
|
|
"Return the MIME charset corresponding to the given Mule CHARSET."
|
2016-02-14 14:36:57 +11:00
|
|
|
(let ((css (sort (sort-coding-systems
|
|
|
|
(find-coding-systems-for-charsets (list charset)))
|
|
|
|
'mm-sort-coding-systems-predicate))
|
|
|
|
cs mime)
|
|
|
|
(while (and (not mime)
|
|
|
|
css)
|
|
|
|
(when (setq cs (pop css))
|
|
|
|
(setq mime (or (coding-system-get cs :mime-charset)
|
|
|
|
(coding-system-get cs 'mime-charset)))))
|
|
|
|
mime))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2016-02-12 14:39:30 +11:00
|
|
|
(defun mm-enable-multibyte ()
|
|
|
|
"Set the multibyte flag of the current buffer.
|
2000-11-10 18:02:56 +00:00
|
|
|
Only do this if the default value of `enable-multibyte-characters' is
|
2016-02-12 14:39:30 +11:00
|
|
|
non-nil."
|
|
|
|
(set-buffer-multibyte 'to))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2016-02-12 14:39:30 +11:00
|
|
|
(defun mm-disable-multibyte ()
|
|
|
|
"Unset the multibyte flag of in the current buffer."
|
|
|
|
(set-buffer-multibyte nil))
|
2000-10-27 18:52:28 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defun mm-preferred-coding-system (charset)
|
|
|
|
;; A typo in some Emacs versions.
|
2001-11-25 15:17:24 +00:00
|
|
|
(or (get-charset-property charset 'preferred-coding-system)
|
|
|
|
(get-charset-property charset 'prefered-coding-system)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
;; Mule charsets shouldn't be used.
|
|
|
|
(defsubst mm-guess-charset ()
|
|
|
|
"Guess Mule charset from the language environment."
|
|
|
|
(or
|
|
|
|
mail-parse-mule-charset ;; cached mule-charset
|
|
|
|
(progn
|
|
|
|
(setq mail-parse-mule-charset
|
2016-02-14 14:36:57 +11:00
|
|
|
(and (car (last
|
2004-09-04 13:13:48 +00:00
|
|
|
(assq 'charset
|
|
|
|
(assoc current-language-environment
|
|
|
|
language-info-alist))))))
|
|
|
|
(if (or (not mail-parse-mule-charset)
|
|
|
|
(eq mail-parse-mule-charset 'ascii))
|
|
|
|
(setq mail-parse-mule-charset
|
|
|
|
(or (car (last (assq mail-parse-charset
|
|
|
|
mm-mime-mule-charset-alist)))
|
|
|
|
;; default
|
|
|
|
'latin-iso8859-1)))
|
|
|
|
mail-parse-mule-charset)))
|
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defun mm-charset-after (&optional pos)
|
|
|
|
"Return charset of a character in current buffer at position POS.
|
2011-11-20 04:48:53 +01:00
|
|
|
If POS is nil, it defaults to the current point.
|
2016-02-14 14:36:57 +11:00
|
|
|
If POS is out of range, the value is nil."
|
2000-10-27 18:52:28 +00:00
|
|
|
(let ((char (char-after pos)) charset)
|
2016-02-12 14:39:30 +11:00
|
|
|
(if (< char 128)
|
2000-10-27 18:52:28 +00:00
|
|
|
(setq charset 'ascii)
|
2016-02-14 14:36:57 +11:00
|
|
|
(setq charset (char-charset char))
|
|
|
|
(if (and charset (not (memq charset '(ascii eight-bit-control
|
|
|
|
eight-bit-graphic))))
|
|
|
|
charset
|
|
|
|
(mm-guess-charset)))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
(defun mm-mime-charset (charset)
|
2000-11-10 18:02:56 +00:00
|
|
|
"Return the MIME charset corresponding to the given Mule CHARSET."
|
2016-02-14 14:36:57 +11:00
|
|
|
(when (eq charset 'unknown)
|
|
|
|
(error "The message contains non-printable characters, please use attachment"))
|
|
|
|
(or
|
|
|
|
(and (mm-preferred-coding-system charset)
|
|
|
|
(coding-system-get (mm-preferred-coding-system charset) 'mime-charset))
|
|
|
|
(and (eq charset 'ascii)
|
|
|
|
'us-ascii)
|
|
|
|
(mm-preferred-coding-system charset)
|
|
|
|
(mm-mule-charset-to-mime-charset charset)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
;; Fixme: This is used in places when it should be testing the
|
2016-02-12 14:39:30 +11:00
|
|
|
;; default multibyteness.
|
|
|
|
(defun mm-multibyte-p ()
|
|
|
|
"Non-nil if multibyte is enabled in the current buffer."
|
|
|
|
enable-multibyte-characters)
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2008-02-24 15:23:45 +00:00
|
|
|
(defun mm-iso-8859-x-to-15-region (&optional b e)
|
2016-02-14 14:36:57 +11:00
|
|
|
(let (charset item c inconvertible)
|
|
|
|
(save-restriction
|
|
|
|
(if e (narrow-to-region b e))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(skip-chars-forward "\0-\177")
|
|
|
|
(while (not (eobp))
|
|
|
|
(cond
|
|
|
|
((not (setq item (assq (char-charset (setq c (char-after)))
|
|
|
|
mm-iso-8859-x-to-15-table)))
|
|
|
|
(forward-char))
|
|
|
|
((memq c (cdr (cdr item)))
|
|
|
|
(setq inconvertible t)
|
|
|
|
(forward-char))
|
|
|
|
(t
|
|
|
|
(insert-before-markers (prog1 (+ c (car (cdr item)))
|
|
|
|
(delete-char 1)))))
|
|
|
|
(skip-chars-forward "\0-\177")))
|
|
|
|
(not inconvertible)))
|
2008-02-24 15:23:45 +00:00
|
|
|
|
2001-11-25 15:17:24 +00:00
|
|
|
(defun mm-sort-coding-systems-predicate (a b)
|
2004-09-04 13:13:48 +00:00
|
|
|
(let ((priorities
|
|
|
|
(mapcar (lambda (cs)
|
|
|
|
;; Note: invalid entries are dropped silently
|
2004-11-04 08:12:39 +00:00
|
|
|
(and (setq cs (mm-coding-system-p cs))
|
2004-09-04 13:13:48 +00:00
|
|
|
(coding-system-base cs)))
|
|
|
|
mm-coding-system-priorities)))
|
2004-11-04 08:12:39 +00:00
|
|
|
(and (setq a (mm-coding-system-p a))
|
|
|
|
(if (setq b (mm-coding-system-p b))
|
|
|
|
(> (length (memq (coding-system-base a) priorities))
|
|
|
|
(length (memq (coding-system-base b) priorities)))
|
|
|
|
t))))
|
2001-11-25 15:17:24 +00:00
|
|
|
|
|
|
|
(defun mm-find-mime-charset-region (b e &optional hack-charsets)
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
"Return the MIME charsets needed to encode the region between B and E.
|
2001-12-20 19:01:00 +00:00
|
|
|
nil means ASCII, a single-element list represents an appropriate MIME
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
charset, and a longer list means no appropriate charset."
|
2001-11-25 15:17:24 +00:00
|
|
|
(let (charsets)
|
|
|
|
;; The return possibilities of this function are a mess...
|
|
|
|
(or (and (mm-multibyte-p)
|
2002-01-03 14:51:05 +00:00
|
|
|
mm-use-find-coding-systems-region
|
2001-11-25 15:17:24 +00:00
|
|
|
;; Find the mime-charset of the most preferred coding
|
|
|
|
;; system that has one.
|
|
|
|
(let ((systems (find-coding-systems-region b e)))
|
|
|
|
(when mm-coding-system-priorities
|
2003-02-04 13:24:35 +00:00
|
|
|
(setq systems
|
2001-11-25 15:17:24 +00:00
|
|
|
(sort systems 'mm-sort-coding-systems-predicate)))
|
|
|
|
(setq systems (delq 'compound-text systems))
|
|
|
|
(unless (equal systems '(undecided))
|
|
|
|
(while systems
|
2002-10-18 11:05:28 +00:00
|
|
|
(let* ((head (pop systems))
|
|
|
|
(cs (or (coding-system-get head :mime-charset)
|
|
|
|
(coding-system-get head 'mime-charset))))
|
2004-09-04 13:13:48 +00:00
|
|
|
;; The mime-charset (`x-ctext') of
|
|
|
|
;; `compound-text' is not in the IANA list. We
|
|
|
|
;; shouldn't normally use anything here with a
|
|
|
|
;; mime-charset having an `x-' prefix.
|
|
|
|
;; Fixme: Allow this to be overridden, since
|
|
|
|
;; there is existing use of x-ctext.
|
|
|
|
;; Also people apparently need the coding system
|
|
|
|
;; `iso-2022-jp-3' (which Mule-UCS defines with
|
|
|
|
;; mime-charset, though it's not valid).
|
|
|
|
(if (and cs
|
|
|
|
(not (string-match "^[Xx]-" (symbol-name cs)))
|
|
|
|
;; UTF-16 of any variety is invalid for
|
|
|
|
;; text parts and, unfortunately, has
|
|
|
|
;; mime-charset defined both in Mule-UCS
|
|
|
|
;; and versions of Emacs. (The name
|
|
|
|
;; might be `mule-utf-16...' or
|
|
|
|
;; `utf-16...'.)
|
|
|
|
(not (string-match "utf-16" (symbol-name cs))))
|
2001-11-25 15:17:24 +00:00
|
|
|
(setq systems nil
|
|
|
|
charsets (list cs))))))
|
|
|
|
charsets))
|
2004-12-26 23:33:51 +00:00
|
|
|
;; We're not multibyte, or a single coding system won't cover it.
|
2003-02-04 13:24:35 +00:00
|
|
|
(setq charsets
|
2016-02-12 14:39:30 +11:00
|
|
|
(delete-dups
|
2001-11-25 15:17:24 +00:00
|
|
|
(mapcar 'mm-mime-charset
|
|
|
|
(delq 'ascii
|
|
|
|
(mm-find-charset-region b e))))))
|
2008-02-24 15:23:45 +00:00
|
|
|
(if (and (> (length charsets) 1)
|
|
|
|
(memq 'iso-8859-15 charsets)
|
|
|
|
(memq 'iso-8859-15 hack-charsets)
|
|
|
|
(save-excursion (mm-iso-8859-x-to-15-region b e)))
|
|
|
|
(dolist (x mm-iso-8859-15-compatible)
|
|
|
|
(setq charsets (delq (car x) charsets))))
|
|
|
|
(if (and (memq 'iso-2022-jp-2 charsets)
|
|
|
|
(memq 'iso-2022-jp-2 hack-charsets))
|
|
|
|
(setq charsets (delq 'iso-2022-jp charsets)))
|
2001-11-25 15:17:24 +00:00
|
|
|
charsets))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defmacro mm-with-unibyte-buffer (&rest forms)
|
|
|
|
"Create a temporary buffer, and evaluate FORMS there like `progn'.
|
2000-11-10 18:02:56 +00:00
|
|
|
Use unibyte mode for this."
|
2008-04-05 20:15:57 +00:00
|
|
|
`(with-temp-buffer
|
|
|
|
(mm-disable-multibyte)
|
|
|
|
,@forms))
|
2000-09-19 13:40:08 +00:00
|
|
|
(put 'mm-with-unibyte-buffer 'lisp-indent-function 0)
|
|
|
|
(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body))
|
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
(defmacro mm-with-multibyte-buffer (&rest forms)
|
|
|
|
"Create a temporary buffer, and evaluate FORMS there like `progn'.
|
|
|
|
Use multibyte mode for this."
|
2008-04-05 20:15:57 +00:00
|
|
|
`(with-temp-buffer
|
|
|
|
(mm-enable-multibyte)
|
|
|
|
,@forms))
|
2004-09-04 13:13:48 +00:00
|
|
|
(put 'mm-with-multibyte-buffer 'lisp-indent-function 0)
|
|
|
|
(put 'mm-with-multibyte-buffer 'edebug-form-spec '(body))
|
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defmacro mm-with-unibyte-current-buffer (&rest forms)
|
2002-10-18 11:05:28 +00:00
|
|
|
"Evaluate FORMS with current buffer temporarily made unibyte.
|
2010-05-10 07:25:27 +00:00
|
|
|
|
|
|
|
Note: We recommend not using this macro any more; there should be
|
|
|
|
better ways to do a similar thing. The previous version of this macro
|
|
|
|
bound the default value of `enable-multibyte-characters' to nil while
|
|
|
|
evaluating FORMS but it is no longer done. So, some programs assuming
|
|
|
|
it if any may malfunction."
|
2015-02-04 14:44:24 -05:00
|
|
|
(declare (obsolete nil "25.1") (indent 0) (debug t))
|
2016-02-12 14:39:30 +11:00
|
|
|
(let ((multibyte (make-symbol "multibyte")))
|
|
|
|
`(let ((,multibyte enable-multibyte-characters))
|
|
|
|
(when ,multibyte
|
|
|
|
(set-buffer-multibyte nil))
|
|
|
|
(prog1
|
|
|
|
(progn ,@forms)
|
2010-05-10 07:25:27 +00:00
|
|
|
(when ,multibyte
|
2016-02-12 14:39:30 +11:00
|
|
|
(set-buffer-multibyte t))))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
(defun mm-find-charset-region (b e)
|
2000-11-10 18:02:56 +00:00
|
|
|
"Return a list of Emacs charsets in the region B to E."
|
2000-09-19 13:40:08 +00:00
|
|
|
(cond
|
2016-02-14 14:36:57 +11:00
|
|
|
((mm-multibyte-p)
|
2000-09-19 13:40:08 +00:00
|
|
|
;; Remove composition since the base charsets have been included.
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
;; Remove eight-bit-*, treat them as ascii.
|
|
|
|
(let ((css (find-charset-region b e)))
|
2016-02-14 14:36:57 +11:00
|
|
|
(dolist (cs '(composition eight-bit-control eight-bit-graphic control-1))
|
|
|
|
(setq css (delq cs css)))
|
|
|
|
css))
|
2000-10-27 18:52:28 +00:00
|
|
|
(t
|
2016-02-12 14:39:30 +11:00
|
|
|
;; We are in a unibyte buffer, so we futz around a bit.
|
2000-09-19 13:40:08 +00:00
|
|
|
(save-excursion
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region b e)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(skip-chars-forward "\0-\177")
|
|
|
|
(if (eobp)
|
|
|
|
'(ascii)
|
2000-10-27 18:52:28 +00:00
|
|
|
(let (charset)
|
2016-02-14 14:36:57 +11:00
|
|
|
(setq charset (car (last (assq 'charset
|
|
|
|
(assoc current-language-environment
|
|
|
|
language-info-alist)))))
|
2000-10-27 18:52:28 +00:00
|
|
|
(if (eq charset 'ascii) (setq charset nil))
|
|
|
|
(or charset
|
|
|
|
(setq charset
|
|
|
|
(car (last (assq mail-parse-charset
|
|
|
|
mm-mime-mule-charset-alist)))))
|
|
|
|
(list 'ascii (or charset 'latin-iso8859-1)))))))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
(defun mm-auto-mode-alist ()
|
|
|
|
"Return an `auto-mode-alist' with only the .gz (etc) thingies."
|
|
|
|
(let ((alist auto-mode-alist)
|
|
|
|
out)
|
|
|
|
(while alist
|
|
|
|
(when (listp (cdar alist))
|
|
|
|
(push (car alist) out))
|
|
|
|
(pop alist))
|
|
|
|
(nreverse out)))
|
|
|
|
|
|
|
|
(defvar mm-inhibit-file-name-handlers
|
2007-10-28 09:18:39 +00:00
|
|
|
'(jka-compr-handler image-file-handler epa-file-handler)
|
2000-09-19 13:40:08 +00:00
|
|
|
"A list of handlers doing (un)compression (etc) thingies.")
|
|
|
|
|
|
|
|
(defun mm-insert-file-contents (filename &optional visit beg end replace
|
|
|
|
inhibit)
|
2004-09-04 13:13:48 +00:00
|
|
|
"Like `insert-file-contents', but only reads in the file.
|
2000-09-19 13:40:08 +00:00
|
|
|
A buffer may be modified in several ways after reading into the buffer due
|
|
|
|
to advanced Emacs features, such as file-name-handlers, format decoding,
|
2016-02-14 14:36:57 +11:00
|
|
|
`find-file-hook', etc.
|
2002-10-18 11:05:28 +00:00
|
|
|
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'.
|
2016-02-14 14:36:57 +11:00
|
|
|
This function ensures that none of these modifications will take place."
|
2009-08-28 17:02:53 +00:00
|
|
|
(letf* ((format-alist nil)
|
|
|
|
(auto-mode-alist (if inhibit nil (mm-auto-mode-alist)))
|
|
|
|
((default-value 'major-mode) 'fundamental-mode)
|
|
|
|
(enable-local-variables nil)
|
|
|
|
(after-insert-file-functions nil)
|
|
|
|
(enable-local-eval nil)
|
|
|
|
(inhibit-file-name-operation (if inhibit
|
|
|
|
'insert-file-contents
|
|
|
|
inhibit-file-name-operation))
|
|
|
|
(inhibit-file-name-handlers
|
|
|
|
(if inhibit
|
|
|
|
(append mm-inhibit-file-name-handlers
|
|
|
|
inhibit-file-name-handlers)
|
|
|
|
inhibit-file-name-handlers))
|
2016-02-14 14:36:57 +11:00
|
|
|
(find-file-hook nil))
|
|
|
|
(insert-file-contents filename visit beg end replace)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
(defun mm-append-to-file (start end filename &optional codesys inhibit)
|
|
|
|
"Append the contents of the region to the end of file FILENAME.
|
|
|
|
When called from a function, expects three arguments,
|
|
|
|
START, END and FILENAME. START and END are buffer positions
|
|
|
|
saying what text to write.
|
|
|
|
Optional fourth argument specifies the coding system to use when
|
|
|
|
encoding the file.
|
2004-09-04 13:13:48 +00:00
|
|
|
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(let ((coding-system-for-write
|
|
|
|
(or codesys mm-text-coding-system-for-write
|
2000-09-19 13:40:08 +00:00
|
|
|
mm-text-coding-system))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(inhibit-file-name-operation (if inhibit
|
2000-09-19 13:40:08 +00:00
|
|
|
'append-to-file
|
|
|
|
inhibit-file-name-operation))
|
|
|
|
(inhibit-file-name-handlers
|
|
|
|
(if inhibit
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(append mm-inhibit-file-name-handlers
|
2000-09-19 13:40:08 +00:00
|
|
|
inhibit-file-name-handlers)
|
|
|
|
inhibit-file-name-handlers)))
|
2004-09-04 13:13:48 +00:00
|
|
|
(write-region start end filename t 'no-message)
|
|
|
|
(message "Appended to %s" filename)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(defun mm-write-region (start end filename &optional append visit lockname
|
2000-09-19 13:40:08 +00:00
|
|
|
coding-system inhibit)
|
|
|
|
|
|
|
|
"Like `write-region'.
|
2004-09-04 13:13:48 +00:00
|
|
|
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(let ((coding-system-for-write
|
|
|
|
(or coding-system mm-text-coding-system-for-write
|
2000-09-19 13:40:08 +00:00
|
|
|
mm-text-coding-system))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(inhibit-file-name-operation (if inhibit
|
2000-09-19 13:40:08 +00:00
|
|
|
'write-region
|
|
|
|
inhibit-file-name-operation))
|
|
|
|
(inhibit-file-name-handlers
|
|
|
|
(if inhibit
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(append mm-inhibit-file-name-handlers
|
2000-09-19 13:40:08 +00:00
|
|
|
inhibit-file-name-handlers)
|
|
|
|
inhibit-file-name-handlers)))
|
|
|
|
(write-region start end filename append visit lockname)))
|
|
|
|
|
2016-02-12 14:39:30 +11:00
|
|
|
(defalias 'mm-make-temp-file 'make-temp-file)
|
|
|
|
(define-obsolete-function-alias 'mm-make-temp-file 'make-temp-file "25.2")
|
2006-02-17 00:24:04 +00:00
|
|
|
|
2010-09-04 00:45:13 +00:00
|
|
|
(defvar mm-image-load-path-cache nil)
|
|
|
|
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
(defun mm-image-load-path (&optional package)
|
2010-09-04 00:45:13 +00:00
|
|
|
(if (and mm-image-load-path-cache
|
|
|
|
(equal load-path (car mm-image-load-path-cache)))
|
|
|
|
(cdr mm-image-load-path-cache)
|
|
|
|
(let (dir result)
|
|
|
|
(dolist (path load-path)
|
|
|
|
(when (and path
|
|
|
|
(file-directory-p
|
|
|
|
(setq dir (concat (file-name-directory
|
|
|
|
(directory-file-name path))
|
|
|
|
"etc/images/" (or package "gnus/")))))
|
|
|
|
(push dir result)))
|
|
|
|
(setq result (nreverse result)
|
|
|
|
mm-image-load-path-cache (cons load-path result))
|
|
|
|
result)))
|
* mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
the Gnus CVS.
* mm-util.el (mm-mime-mule-charset-alist): Move down and call
mm-coding-system-p. Don't correct it only in XEmacs.
(mm-charset-to-coding-system): Use mm-coding-system-p and
mm-get-coding-system-list.
(mm-emacs-mule, mm-mule4-p): New.
(mm-enable-multibyte, mm-disable-multibyte,
mm-enable-multibyte-mule4, mm-disable-multibyte-mule4,
mm-with-unibyte-current-buffer,
mm-with-unibyte-current-buffer-mule4): Use them.
(mm-find-mime-charset-region): Treat iso-2022-jp.
From Dave Love <fx@gnu.org>:
* mm-util.el (mm-mime-mule-charset-alist): Make it correct by
construction.
(mm-charset-synonym-alist): Remove windows-125[02]. Make other
entries conditional on not having a coding system defined for
them.
(mm-mule-charset-to-mime-charset): Use
find-coding-systems-for-charsets if defined.
(mm-charset-to-coding-system): Don't use
mm-get-coding-system-list. Look in mm-charset-synonym-alist
later. Add last resort search of coding systems.
(mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
(mm-with-unibyte-current-buffer-mule4): Just treat Mule 5 like
Mule 4.
(mm-find-mime-charset-region): Re-write.
(mm-with-unibyte-current-buffer): Restore buffer as well as
multibyteness.
2001-10-31 04:16:51 +00:00
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
;; Fixme: This doesn't look useful where it's used.
|
2016-02-14 14:36:57 +11:00
|
|
|
(defun mm-detect-coding-region (start end)
|
|
|
|
"Like `detect-coding-region' except returning the best one."
|
|
|
|
(let ((coding-systems (detect-coding-region start end)))
|
|
|
|
(or (car-safe coding-systems)
|
|
|
|
coding-systems)))
|
2004-09-04 13:13:48 +00:00
|
|
|
|
2007-12-11 05:39:36 +00:00
|
|
|
(declare-function mm-detect-coding-region "mm-util" (start end))
|
|
|
|
|
2016-02-14 14:36:57 +11:00
|
|
|
(defun mm-detect-mime-charset-region (start end)
|
|
|
|
"Detect MIME charset of the text in the region between START and END."
|
|
|
|
(let ((cs (mm-detect-coding-region start end)))
|
|
|
|
(coding-system-get cs 'mime-charset)))
|
2004-09-04 13:13:48 +00:00
|
|
|
|
2007-10-28 09:18:39 +00:00
|
|
|
(defun mm-coding-system-to-mime-charset (coding-system)
|
2016-02-12 14:39:30 +11:00
|
|
|
"Return the MIME charset corresponding to CODING-SYSTEM."
|
2016-02-14 14:36:57 +11:00
|
|
|
(and coding-system
|
|
|
|
(coding-system-get coding-system 'mime-charset)))
|
2007-10-28 09:18:39 +00:00
|
|
|
|
2013-05-22 22:05:27 -07:00
|
|
|
(defvar jka-compr-acceptable-retval-list)
|
|
|
|
(declare-function jka-compr-make-temp-name "jka-compr" (&optional local))
|
2007-10-28 09:18:39 +00:00
|
|
|
|
|
|
|
(defun mm-decompress-buffer (filename &optional inplace force)
|
|
|
|
"Decompress buffer's contents, depending on jka-compr.
|
|
|
|
Only when FORCE is t or `auto-compression-mode' is enabled and FILENAME
|
|
|
|
agrees with `jka-compr-compression-info-list', decompression is done.
|
|
|
|
Signal an error if FORCE is neither nil nor t and compressed data are
|
|
|
|
not decompressed because `auto-compression-mode' is disabled.
|
|
|
|
If INPLACE is nil, return decompressed data or nil without modifying
|
|
|
|
the buffer. Otherwise, replace the buffer's contents with the
|
|
|
|
decompressed data. The buffer's multibyteness must be turned off."
|
|
|
|
(when (and filename
|
|
|
|
(if force
|
|
|
|
(prog1 t (require 'jka-compr))
|
|
|
|
(and (fboundp 'jka-compr-installed-p)
|
|
|
|
(jka-compr-installed-p))))
|
|
|
|
(let ((info (jka-compr-get-compression-info filename)))
|
|
|
|
(when info
|
|
|
|
(unless (or (memq force (list nil t))
|
|
|
|
(jka-compr-installed-p))
|
|
|
|
(error ""))
|
|
|
|
(let ((prog (jka-compr-info-uncompress-program info))
|
|
|
|
(args (jka-compr-info-uncompress-args info))
|
|
|
|
(msg (format "%s %s..."
|
|
|
|
(jka-compr-info-uncompress-message info)
|
|
|
|
filename))
|
|
|
|
(err-file (jka-compr-make-temp-name))
|
|
|
|
(cur (current-buffer))
|
|
|
|
(coding-system-for-read mm-binary-coding-system)
|
|
|
|
(coding-system-for-write mm-binary-coding-system)
|
|
|
|
retval err-msg)
|
|
|
|
(message "%s" msg)
|
|
|
|
(mm-with-unibyte-buffer
|
|
|
|
(insert-buffer-substring cur)
|
|
|
|
(condition-case err
|
|
|
|
(progn
|
|
|
|
(unless (memq (apply 'call-process-region
|
|
|
|
(point-min) (point-max)
|
|
|
|
prog t (list t err-file) nil args)
|
|
|
|
jka-compr-acceptable-retval-list)
|
|
|
|
(erase-buffer)
|
2010-09-22 06:01:22 +00:00
|
|
|
(insert (mapconcat 'identity
|
|
|
|
(split-string
|
|
|
|
(prog2
|
|
|
|
(insert-file-contents err-file)
|
|
|
|
(buffer-string)
|
|
|
|
(erase-buffer)) t)
|
|
|
|
" ")
|
2007-10-28 09:18:39 +00:00
|
|
|
"\n")
|
|
|
|
(setq err-msg
|
|
|
|
(format "Error while executing \"%s %s < %s\""
|
|
|
|
prog (mapconcat 'identity args " ")
|
|
|
|
filename)))
|
|
|
|
(setq retval (buffer-string)))
|
|
|
|
(error
|
|
|
|
(setq err-msg (error-message-string err)))))
|
|
|
|
(when (file-exists-p err-file)
|
2010-05-04 00:38:50 +02:00
|
|
|
(ignore-errors (delete-file err-file)))
|
2007-10-28 09:18:39 +00:00
|
|
|
(when inplace
|
|
|
|
(unless err-msg
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
(insert retval))
|
|
|
|
(setq retval nil))
|
|
|
|
(message "%s" (or err-msg (concat msg "done")))
|
|
|
|
retval)))))
|
|
|
|
|
|
|
|
(defun mm-find-buffer-file-coding-system (&optional filename)
|
|
|
|
"Find coding system used to decode the contents of the current buffer.
|
|
|
|
This function looks for the coding system magic cookie or examines the
|
|
|
|
coding system specified by `file-coding-system-alist' being associated
|
|
|
|
with FILENAME which defaults to `buffer-file-name'. Data compressed by
|
|
|
|
gzip, bzip2, etc. are allowed."
|
|
|
|
(unless filename
|
|
|
|
(setq filename buffer-file-name))
|
|
|
|
(save-excursion
|
Merge changes made in Gnus master ever since feature freeze
:::::::::::::::::
::: doc/misc/ :::
:::::::::::::::::
2012-06-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus.texi (POP before SMTP): POP-before-SMTP works with all sending
methods, so don't mention smtpmail here.
2012-05-04 Wolfgang Jenkner <wjenkner@inode.at>
* gnus.texi (Picons): Document gnus-picon-properties.
2012-06-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus.texi: Remove mention of compilation, as that's no longer
supported.
2012-03-14 Christopher Schmidt <christopher@ch.ristopher.com>
* gnus.texi (Archived Messages): Mention
gnus-gcc-pre-body-encode-hook and gnus-gcc-post-body-encode-hook.
2012-02-16 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Various Summary Stuff):
Remove mention of `gnus-propagate-marks'.
2012-02-15 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi: Remove mentions of nnml/nnfolder/nntp backend marks,
which no longer exist.
2012-02-08 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus.texi (Archived Messages):
Document gnus-gcc-self-resent-messages.
2012-02-06 Lars Ingebrigtsen <larsi@gnus.org>
* message.texi (Mail Variables):
Mention the optional user parameter for X-Message-SMTP-Method.
2012-02-02 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Posting Styles): Mention X-Message-SMTP-Method.
* message.texi (Mail Variables): Document X-Message-SMTP-Method.
2012-01-31 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Key Index): Change encoding to utf-8.
::::::::::::::::::
::: lisp/gnus/ :::
::::::::::::::::::
2012-06-26 Katsumi Yamaoka <yamaoka@jpl.org>
* mm-decode.el: Add coding cookie for a soft hyphen that mm-shr uses.
2012-06-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-art.el (gnus-article-read-summary-keys): Protect against the key
being bound to a lambda form.
2012-05-04 Wolfgang Jenkner <wjenkner@inode.at>
* gnus-picon.el (gnus-picon-properties): New defcustom.
(gnus-picon-create-glyph): Use it.
2012-06-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
* shr.el: Add a iso-8859-1 cookie to make stuff work under other
locales.
* mm-decode.el (mm-display-part): Dissect archives when hitting `RET'
on a handle.
* gnus-sum.el (gnus-summary-limit-to-author): Use the current From
address as the default.
* nnfolder.el (nnfolder-save-buffer): Delete old versions silently.
It makes no sense to query the user about internal files.
* gnus-spec.el: Remove all the byte-compilation stuff, since
benchmarking shows that it doesn't help when entering large summary
buffers.
* gnus-util.el (gnus-byte-code): Remove.
* gnus-spec.el (gnus-update-format-specifications): Remove outdated
grouplens stuff.
2012-06-07 Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
* message.el (message-buffers): Return all buffers derived from Message
to make `gnus-dired-attach' work with mu4e.
2012-05-28 Daiki Ueno <ueno@unixuser.org>
* mm-decode.el (mm-inhibit-auto-detect-attachment): New variable.
(mm-dissect-singlepart): Don't guess the MIME type of
application/octet-stream parts if mm-inhibit-auto-detect-attachment is
set.
(mm-dissect-multipart): Bind mm-inhibit-auto-detect-attachment if the
toplevel MIME type is multipart/encrypted.
2011-12-02 Wolfgang Jenkner <wjenkner@inode.at>
* gnus-agent.el (gnus-agent-save-active): Deal with the "groups" format.
In particular, add an optional argument and a docstring.
* gnus-start.el (gnus-groups-to-gnus-format): Use it.
* nntp.el (nntp-finish-retrieve-group-infos): Make `nntp-server-buffer'
current before calling `gnus-groups-to-gnus-format'.
Note that this was already the case for `gnus-active-to-gnus-format'.
2012-04-25 Katsumi Yamaoka <yamaoka@jpl.org>
* pop3.el (pop3-wait-for-messages): Fix retrieved data size calculation.
2012-04-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
* mm-decode.el (mm-dissect-buffer): Doc fix.
* gnus-sum.el (gnus-handle-ephemeral-exit):
Avoid creating the group buffer if it doesn't exist.
* gnus-group.el (gnus-group-read-ephemeral-group): If no quit-config
is given, mark the group as ephemeral with the current window conf.
* gnus-sum.el (gnus-set-global-variables): Don't assume that the group
buffer exists, which it doesn't if we haven't started Gnus.
(gnus-summary-exit): Allow quitting when we don't have a group buffer.
2012-04-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
* mml.el (mml-generate-mime):
Allow specifying what the top-level part type is.
* gnus-sum.el (gnus-auto-center-summary):
`scroll-margin' isn't defined on XEmacs.
2012-04-10 Philipp Haselwarter <philipp.haselwarter@gmx.de> (tiny change)
* gnus-sum.el (gnus-auto-center-summary):
Set default to respect `scroll-margin'.
2012-04-10 Elias Oltmanns <eo@nebensachen.de> (tiny change)
* gnus-cite.el (gnus-dissect-cited-text): A single line without
citation prefix within a block of cited text should be considered
part of that block *only* if it is a blank line.
2012-04-02 Katsumi Yamaoka <yamaoka@jpl.org>
* shr.el (shr-find-fill-point): Remove unused code; don't break a line
before kinsoku-bol characters nor within kinsoku-eol characters.
2012-03-27 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-sync.el (gnus-topic-alist, gnus-group-topic)
(gnus-topic-create-topic, gnus-topic-enter-dribble):
Silence compiler.
(gnus-sync-read): Use mapc instead of mapcar.
* mm-archive.el: Require mm-decode for some macros.
(gnus-recursive-directory-files, mailcap-extension-to-mime):
Silence the byte compiler.
(mm-archive-decoders): New function that returns the value of
the mm-archive-decoders variable.
* mm-decode.el:
Don't require mm-archive; autoload mm-archive functions instead.
(mm-dissect-singlepart): Use the function mm-archive-decoders.
* nnmail.el (mail-send-and-exit): Silence the byte compiler.
2012-03-12 Peter Munster <pmrb@free.fr>
* gnus-demon.el (gnus-demon-timers): Now a plist (function -> timer).
(gnus-demon-cancel): Ditto.
(gnus-demon-run-callback): When function cannot be called due to low
idleness, call it when idleness reaches the expected value, instead
of waiting another timer period.
(gnus-demon-init): Add `time' to arguments of call-back.
2012-03-22 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus.el: Register gnus-registry functions.
* gnus-registry.el (gnus-try-warping-via-registry):
Moved here and indent.
* gnus-int.el (gnus-warp-to-article):
Check whether the registry is enabled before warping.
2012-03-22 Dave Abrahams <dave@boostpro.com>
* gnus-sum.el (gnus-summary-insert-subject): Record information
in the registry about each article retrieved.
* gnus-int.el (gnus-select-group-with-message-id): New function.
(gnus-try-warping-via-registry): Ditto.
(gnus-warp-to-article): Fall back on the registry.
2012-03-22 Lars Magne Ingebrigtsen <larsi@gnus.org>
* nnimap.el (nnimap-fetch-partial-articles): Minor doc string fixup.
2012-03-22 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-msg.el (gnus-summary-resend-message-insert-gcc): Assume that
gnus-gcc-self-resent-messages may be a group parameter.
(gnus-summary-resend-message):
Don't encode encoded words in header when Gcc'ing resent message.
2012-03-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
* shr.el (shr-insert): Treat non-breaking space just like normal
space. This seems to produce more pleasing results.
(shr-insert):
Only insert a blank line if we're starting from an image.
(shr-tag-br):
Allow <br> to end lines or to make a single blank line.
(shr-ensure-paragraph): Consider lines with white space to be blank.
2012-03-14 Christopher Schmidt <christopher@ch.ristopher.com>
* gnus-msg.el (gnus-inews-do-gcc): Add gnus-gcc-pre-body-encode-hook
and gnus-gcc-post-body-encode-hook.
2012-02-16 Lars Ingebrigtsen <larsi@gnus.org>
* mm-decode.el (mm-dissect-singlepart):
Guess what the type of application/octet-stream parts really is.
* gnus-sum.el (gnus-propagate-marks): Remove.
2012-02-15 Lars Ingebrigtsen <larsi@gnus.org>
* nntp.el (nntp-coding-system-for-read): Remove.
(nntp-coding-system-for-write): Ditto.
(nntp-open-connection): Just use `binary' directly.
2012-02-14 Teodor Zlatanov <tzz@lifelogs.com>
* registry.el (registry-usage-test, registry-persistence-test):
Move to tests/gnustest-registry.el.
(registry-make-testable-db, registry-match-test)
(registry-instantiation-test): Move to tests/gnustest-registry.el.
* gnus-registry.el (gnus-registry-misc-test)
(gnus-registry-usage-test): Move to tests/gnustest-registry.el.
* tests/gnustest-registry.el:
New file with the registry and gnus-registry ERT tests.
2012-02-13 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-msg.el (gnus-summary-resend-message):
Make gnus-summary-resend-message-insert-gcc be last item in
message-header-setup-hook.
2012-02-13 Lars Ingebrigtsen <larsi@gnus.org>
* nnfolder.el (nnfolder-marks-directory, nnfolder-marks-is-evil)
(nnfolder-marks, nnfolder-marks-file-suffix)
(nnfolder-marks-modtime): Remove.
(nnfolder-open-server): Don't use marks.
(nnfolder-request-delete-group): Ditto.
(nnfolder-request-rename-group): Ditto.
(nnfolder-request-set-mark, nnfolder-request-marks)
(nnfolder-group-marks-pathname, nnfolder-marks-changed-p)
(nnfolder-save-marks, nnfolder-open-marks): Remove.
* nnml.el (nnml-marks-is-evil, nnml-marks-file-name, nnml-marks)
(nnml-marks-modtime): Remove.
(nnml-request-delete-group): Don't use marks.
(nnml-request-rename-group): Ditto.
(nnml-request-set-mark, nnml-request-marks, nnml-marks-changed-p)
(nnml-save-marks, nnml-open-marks): Remove.
* nntp.el (nntp-marks-is-evil, nntp-marks-file-name, nntp-marks)
(nntp-marks-modtime, nntp-marks-directory, nntp-request-set-mark)
(nntp-request-marks, nntp-marks-directory, nntp-marks-changed-p)
(nntp-save-marks, nntp-open-marks, nntp-possibly-create-directory)
(nntp-server-to-method-cache): Remove.
* shr.el (shr-rescale-image): Fix wrong merge.
2012-02-15 Lars Ingebrigtsen <larsi@gnus.org>
* shr.el (shr-remove-trailing-whitespace):
Really delete the padding on too-wide lines.
2012-02-09 Lars Ingebrigtsen <larsi@gnus.org>
* mm-archive.el (mm-archive-dissect-and-inline): New function.
(mm-archive-dissect-and-inline): Fix up the undisplayer.
* mm-decode.el (mm-display-external): Output the text from
the command in the buffer after the command finished.
This makes text-based commands behave better.
2012-02-07 Lars Ingebrigtsen <larsi@gnus.org>
* message.el (smtpmail-smtp-user): Silence compiler warning.
2012-02-06 Lars Ingebrigtsen <larsi@gnus.org>
* message.el (message-multi-smtp-send-mail):
Also allow specifying the SMTP user name.
2012-02-06 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-sum.el (gnus-summary-article-map): Fix typo.
2012-02-02 Lars Ingebrigtsen <larsi@gnus.org>
* message.el (message-multi-smtp-send-mail): New function.
(message-multi-smtp-send-mail): Respect the X-Message-SMTP-Method
header to implement multi-SMTP functionality.
* gnus-agent.el (gnus-agent-send-mail-function): Removed.
(gnus-agentize): Don't set it.
(gnus-agent-send-mail): Don't use it.
* gnus-sum.el (gnus-summary-widget-backward):
New function and keystroke.
* shr.el (shr-put-image): Remove underlines from sliced images.
(shr-zoom-image): Compute the region to be replaced more correctly.
2012-02-02 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-msg.el (gnus-gcc-self-resent-messages): New user option.
(gnus-summary-resend-message-insert-gcc): New function.
(gnus-summary-resend-message): Modify message-header-setup-hook and
message-sent-hook to make it work for Gcc.
(gnus-inews-do-gcc): Update the number of unread articles of groups
that messages are Gcc'd to.
* message.el (message-resend): Run message-sent-hook to do Gcc.
2012-02-01 Lars Ingebrigtsen <larsi@gnus.org>
* gnus-registry.el (gnus-registry-fixup-registry):
Move the message to a higher level to silence compilation.
* gnus-art.el (gnus-shr-put-image): Take and pass on a `flags'
parameter to allow controlling the scaling.
* shr.el (shr-zoom-image): New command and keystroke.
(shr-put-image): Take a `size' flag to say how to scale the image.
* mm-archive.el (mm-dissect-archive): Use it to get all file names.
Use recursive deletion.
(mm-dissect-archive): Add support for zip files.
* gnus-util.el (gnus-recursive-directory-files): New function.
* mm-archive.el (mm-archive-list-files): Inline text and image parts.
(mm-archive-decoders): Add tgz support.
* mm-decode.el (mm-shr): Make sure that the HTML ends with a newline.
Otherwise inserting text into the Gnus buffer can look odd.
* gnus-art.el (gnus-mime-inline-part): Slight clean-up.
* mm-archive.el (mm-archive-decoders): Add support for tar.
* gnus.el (gnus-logo-color-alist): Change the colours for Ma Gnus.
* nnmail.el (nnmail-extra-headers): Add Cc to the default.
2012-01-31 Lars Ingebrigtsen <larsi@gnus.org>
* mm-decode.el (mm-dissect-singlepart): Check that the decoder exists.
* mm-archive.el: New file.
* mm-decode.el (mm-dissect-singlepart):
Use it to decode ms-tnef files.
* mm-util.el (mm-find-buffer-file-coding-system): Comment fix.
* message.el (message-goto-*): Make all the `message-goto-*' commands
push the mark before moving point. This makes it easier to go back
to where you came from after editing whatever you jumped to.
2012-01-07 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el (gnus-sync-newsrc-groups): Quote normally.
(gnus-sync-lesync-pre-save-group-entry): Remove invalid invlists.
(gnus-sync-lesync-normalize-group-entry): Ignore a few more keys.
2011-11-09 Teodor Zlatanov <tzz@lifelogs.com>
* spam.el: Move BBDB autoloads.
(spam-exists-in-BBDB-p):
New function to do the BBDB search directly in BBDB 2 and 3.
(spam-check-BBDB): Use it.
(spam-enter-ham-BBDB): Use it.
2011-10-31 Peter Munster <pmrb@free.fr> (tiny change)
* gnus-group.el (gnus-group-get-new-news):
New parameter `one-level' for scanning exactly one level.
* gnus-start.el (gnus-get-unread-articles): Ditto.
2011-11-03 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el: More commentary about setup.
2011-11-02 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el: More commentary about `gnus-sync-read' issues.
2011-10-31 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el: Improve docs about CouchDB admins.
2011-10-29 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el (gnus-sync-lesync-setup): Fix salt when user setup is
not needed. Provide xmlplistread list function to produce XML plist
output for non-Gnus LeSync clients.
2011-10-27 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-sync.el: Add LeSync synchronization backend and logic to read
and save against it. Group subscriptions, read marks, other marks,
subscription levels, topic names, and topic offsets (the group's
position within the topic) are saved. This is an experimental
backend and may change significantly. Load json.el from
the gnus-fallback-lib if it's not available otherwise.
(gnus-sync-save): Don't use `apply-partially' because of XEmacs.
2011-04-20 David Engster <dengste@eml.cc>
* tests/gnustest-nntp.el: New file for simple NNTP testing.
2012-06-26 22:52:31 +00:00
|
|
|
(let ((decomp (unless ;; Not worth it to examine charset of tar files.
|
2007-10-28 09:18:39 +00:00
|
|
|
(and filename
|
|
|
|
(string-match
|
|
|
|
"\\.\\(?:tar\\.[^.]+\\|tbz\\|tgz\\)\\'"
|
|
|
|
filename))
|
|
|
|
(mm-decompress-buffer filename nil t))))
|
|
|
|
(when decomp
|
2010-04-23 12:15:51 -04:00
|
|
|
(set-buffer (generate-new-buffer " *temp*"))
|
|
|
|
(mm-disable-multibyte)
|
2007-10-28 09:18:39 +00:00
|
|
|
(insert decomp)
|
|
|
|
(setq filename (file-name-sans-extension filename)))
|
|
|
|
(goto-char (point-min))
|
2011-01-20 17:36:12 -05:00
|
|
|
(unwind-protect
|
2016-02-12 14:39:30 +11:00
|
|
|
(if filename
|
|
|
|
(or (funcall (symbol-value 'set-auto-coding-function)
|
|
|
|
filename (- (point-max) (point-min)))
|
|
|
|
(car (find-operation-coding-system 'insert-file-contents
|
|
|
|
filename)))
|
|
|
|
(let (auto-coding-alist)
|
|
|
|
(condition-case nil
|
|
|
|
(funcall (symbol-value 'set-auto-coding-function)
|
|
|
|
nil (- (point-max) (point-min)))
|
|
|
|
(error nil))))
|
2007-10-28 09:18:39 +00:00
|
|
|
(when decomp
|
|
|
|
(kill-buffer (current-buffer)))))))
|
2002-03-21 19:11:23 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(provide 'mm-util)
|
|
|
|
|
|
|
|
;;; mm-util.el ends here
|