emacs/lisp/gnus/mm-util.el

905 lines
32 KiB
EmacsLisp
Raw Normal View History

;;; mm-util.el --- Utility functions for Mule and low level things
2005-08-06 19:51:42 +00:00
;; Copyright (C) 1998-2018 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.
;; 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
;; 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
;; 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
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
2000-09-19 13:40:08 +00:00
;;; Commentary:
;;; Code:
(eval-when-compile (require 'cl))
2000-09-19 13:40:08 +00:00
(require 'mail-prsvr)
(require 'timer)
(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
(defun mm-ucs-to-char (codepoint)
"Convert Unicode codepoint to character."
(or (decode-char 'ucs codepoint) ?#))
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
(setq mm-coding-system-list (coding-system-list))))
2000-09-19 13:40:08 +00:00
(defun mm-coding-system-p (cs)
"Return CS if CS is a coding system."
(and (coding-system-p cs)
cs))
2000-09-19 13:40:08 +00:00
(defvar mm-charset-synonym-alist
`(
;; Not in XEmacs, but it's not a proper MIME charset anyhow.
,@(unless (mm-coding-system-p 'x-ctext)
'((x-ctext . ctext)))
;; ISO-8859-15 is very similar to ISO-8859-1. But it's _different_ in 8
;; positions!
,@(unless (mm-coding-system-p 'iso-8859-15)
'((iso-8859-15 . iso-8859-1)))
;; BIG-5HKSCS is similar to, but different than, BIG-5.
,@(unless (mm-coding-system-p 'big5-hkscs)
'((big5-hkscs . big5)))
;; A Microsoft misunderstanding.
,@(when (and (not (mm-coding-system-p 'unicode))
(mm-coding-system-p 'utf-16-le))
'((unicode . utf-16-le)))
;; 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))))
;; Windows-31J is Windows Codepage 932.
,@(when (and (not (mm-coding-system-p 'windows-31j))
(mm-coding-system-p 'cp932))
'((windows-31j . cp932)))
;; 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)))
;; 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)))
;; 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)))
;; 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)))
)
"A mapping from unknown or invalid charset names to the real charset names.")
;; Note: this has to be defined before `mm-charset-to-coding-system'.
(defcustom mm-charset-eval-alist nil
"An alist of (CHARSET . FORM) pairs.
If an article is encoded in an unknown CHARSET, FORM is
Expunge "allow" + infinitive without direct object from source and doc. Do the same for "permit", "enable", and "prevent". * doc/emacs/mule.texi: * doc/lispref/control.texi: * doc/lispref/display.texi: * doc/lispref/frames.texi: * doc/lispref/functions.texi: * doc/lispref/nonascii.texi: * doc/lispref/streams.texi: * doc/lispref/windows.texi: * doc/misc/dbus.texi: * doc/misc/eww.texi: * doc/misc/flymake.texi: * doc/misc/octave-mode.texi: * doc/misc/org.texi: * doc/misc/reftex.texi: * doc/misc/tramp.texi: * doc/misc/wisent.texi: * etc/NEWS: * lisp/autorevert.el: * lisp/cedet/mode-local.el: * lisp/cedet/semantic/senator.el: * lisp/cedet/semantic/wisent.el: * lisp/dos-fns.el: * lisp/frameset.el: * lisp/gnus/gnus-agent.el: * lisp/gnus/mm-util.el: * lisp/international/characters.el: * lisp/ldefs-boot.el: * lisp/mail/mailclient.el: * lisp/man.el: * lisp/mh-e/mh-search.el: * lisp/net/tramp-cmds.el: * lisp/net/tramp-gvfs.el: * lisp/org/org-crypt.el: * lisp/org/org-element.el: * lisp/org/org-feed.el: * lisp/org/org.el: * lisp/org/ox-ascii.el: * lisp/org/ox-icalendar.el: * lisp/org/ox-publish.el: * lisp/org/ox.el: * lisp/play/gamegrid.el: * lisp/play/gomoku.el: * lisp/progmodes/antlr-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/vhdl-mode.el: * lisp/strokes.el: * lisp/textmodes/ispell.el: * lisp/tree-widget.el: * lisp/vc/pcvs.el: * lisp/window.el: * src/lisp.h: * src/w32.c: * src/w32heap.c: * src/w32term.c: * src/window.c: * src/xfaces.c: Replace solecisms like "This allow to do something" with a correct alternative, such as "This allow you to do something", "This allows something to be done" or "This allows the doing of something".
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."
:version "22.1" ;; Gnus 5.10.9
:type '(list (repeat :inline t
:tag "Other options"
(cons (symbol :tag "charset")
(symbol :tag "form"))))
:group 'mime)
(put 'mm-charset-eval-alist 'risky-local-variable t)
(defvar mm-charset-override-alist)
;; 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
((or (eq charset 'us-ascii)
(string-match "ansi.x3.4" (symbol-name charset)))
'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)
;; Use coding system Emacs knows.
((and (fboundp 'coding-system-from-name)
(coding-system-from-name charset)))
;; 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.
(defcustom mm-charset-override-alist
;; Note: pairs that cannot be used in the Emacs version currently running
;; will be removed.
'((gb2312 . gbk)
(iso-8859-1 . windows-1252)
(iso-8859-8 . windows-1255)
(iso-8859-9 . windows-1254))
"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."
:type
'(list
:convert-widget
(lambda (widget)
(let ((defaults
(delq nil
(mapcar (lambda (pair)
(if (mm-charset-to-coding-system (cdr pair)
nil nil t)
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")))))))
;; 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))))
:version "22.1" ;; Gnus 5.10.9
:group 'mime)
2000-09-19 13:40:08 +00:00
(defvar mm-binary-coding-system
(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
(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
(cond
((mm-coding-system-p 'utf-8-emacs) ; Mule 7
(if (memq system-type '(windows-nt ms-dos))
(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)
(if (memq system-type '(windows-nt ms-dos))
(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.")
(defvar mm-universal-coding-system mm-auto-save-coding-system
"The universal coding system.")
;; Fixme: some of the cars here aren't valid MIME charsets. That
;; should only matter with XEmacs, though.
(defvar mm-mime-mule-charset-alist
'((us-ascii ascii)
(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)
(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)
(big5 chinese-big5-1 chinese-big5-2)
(tibetan tibetan)
(thai-tis620 thai-tis620)
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
2004-11-04 08:12:39 +00:00
(windows-1251 cyrillic-iso8859-5)
(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
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
2004-11-04 08:12:39 +00:00
korean-ksc5601 japanese-jisx0212)
(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)
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
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)
(utf-8))
"Alist of MIME-charset/MULE-charsets.")
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
2004-11-04 08:12:39 +00:00
;; Correct by construction, but should be unnecessary for Emacs:
(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))))
(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.")
(defcustom mm-coding-system-priorities
(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))
"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."
:version "24.4"
:type '(repeat (symbol :tag "Coding system"))
:group 'mime)
;; ??
(defvar mm-use-find-coding-systems-region t
"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.")
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
(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 \"&#128;\" to the euro sign, mainly in html messages."
:type '(alist :key-type character :value-type character)
:group 'mime)
2000-09-19 13:40:08 +00:00
;;; Internal variables:
;;; Functions:
(defun mm-mule-charset-to-mime-charset (charset)
"Return the MIME charset corresponding to the given Mule CHARSET."
(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
(defun mm-enable-multibyte ()
"Set the multibyte flag of the current buffer.
Only do this if the default value of `enable-multibyte-characters' is
non-nil."
(set-buffer-multibyte 'to))
2000-09-19 13:40:08 +00:00
(defun mm-disable-multibyte ()
"Unset the multibyte flag of in the current buffer."
(set-buffer-multibyte nil))
2000-09-19 13:40:08 +00:00
(defun mm-preferred-coding-system (charset)
;; A typo in some Emacs versions.
(or (get-charset-property charset 'preferred-coding-system)
(get-charset-property charset 'prefered-coding-system)))
2000-09-19 13:40:08 +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
(and (car (last
(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.
If POS is out of range, the value is nil."
(let ((char (char-after pos)) charset)
(if (< char 128)
(setq charset 'ascii)
(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)
"Return the MIME charset corresponding to the given Mule CHARSET."
(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
;; Fixme: This is used in places when it should be testing the
;; 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
(defun mm-iso-8859-x-to-15-region (&optional b e)
(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)))
(defun mm-sort-coding-systems-predicate (a b)
(let ((priorities
(mapcar (lambda (cs)
;; Note: invalid entries are dropped silently
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
2004-11-04 08:12:39 +00:00
(and (setq cs (mm-coding-system-p cs))
(coding-system-base cs)))
mm-coding-system-priorities)))
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev <gin@mo.msk.ru>. (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry.
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))))
(defun mm-find-mime-charset-region (b e &optional hack-charsets)
"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
charset, and a longer list means no appropriate charset."
(let (charsets)
;; The return possibilities of this function are a mess...
(or (and (mm-multibyte-p)
mm-use-find-coding-systems-region
;; 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
(sort systems 'mm-sort-coding-systems-predicate)))
(setq systems (delq 'compound-text systems))
(unless (equal systems '(undecided))
(while systems
(let* ((head (pop systems))
(cs (or (coding-system-get head :mime-charset)
(coding-system-get head 'mime-charset))))
;; 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))))
(setq systems nil
charsets (list cs))))))
charsets))
;; We're not multibyte, or a single coding system won't cover it.
2003-02-04 13:24:35 +00:00
(setq charsets
(delete-dups
(mapcar 'mm-mime-charset
(delq 'ascii
(mm-find-charset-region b e))))))
(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)))
charsets))
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'.
Use unibyte mode for this."
`(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))
(defmacro mm-with-multibyte-buffer (&rest forms)
"Create a temporary buffer, and evaluate FORMS there like `progn'.
Use multibyte mode for this."
`(with-temp-buffer
(mm-enable-multibyte)
,@forms))
(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)
"Evaluate FORMS with current buffer temporarily made unibyte.
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."
(declare (obsolete nil "25.1") (indent 0) (debug t))
(let ((multibyte (make-symbol "multibyte")))
`(let ((,multibyte enable-multibyte-characters))
(when ,multibyte
(set-buffer-multibyte nil))
(prog1
(progn ,@forms)
(when ,multibyte
(set-buffer-multibyte t))))))
2000-09-19 13:40:08 +00:00
(defun mm-find-charset-region (b e)
"Return a list of Emacs charsets in the region B to E."
2000-09-19 13:40:08 +00:00
(cond
((mm-multibyte-p)
2000-09-19 13:40:08 +00:00
;; Remove composition since the base charsets have been included.
;; Remove eight-bit-*, treat them as ascii.
(let ((css (find-charset-region b e)))
(dolist (cs '(composition eight-bit-control eight-bit-graphic control-1))
(setq css (delq cs css)))
css))
(t
;; 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)
(let (charset)
(setq charset (car (last (assq 'charset
(assoc current-language-environment
language-info-alist)))))
(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
'(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)
"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,
`find-file-hook', etc.
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'.
This function ensures that none of these modifications will take place."
(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))
(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.
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
(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))
(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
(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 t 'no-message)
(message "Appended to %s" filename)))
2000-09-19 13:40:08 +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'.
If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
(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))
(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
(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)))
(defalias 'mm-make-temp-file 'make-temp-file)
(define-obsolete-function-alias 'mm-make-temp-file 'make-temp-file "26.1")
(defvar mm-image-load-path-cache nil)
(defun mm-image-load-path (&optional package)
(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)))
;; Fixme: This doesn't look useful where it's used.
(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)))
(declare-function mm-detect-coding-region "mm-util" (start end))
(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)))
(defun mm-coding-system-to-mime-charset (coding-system)
"Return the MIME charset corresponding to CODING-SYSTEM."
(and coding-system
(coding-system-get coding-system 'mime-charset)))
(defvar jka-compr-acceptable-retval-list)
(declare-function jka-compr-make-temp-name "jka-compr" (&optional local))
(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)
(insert (mapconcat 'identity
(split-string
(prog2
(insert-file-contents err-file)
(buffer-string)
(erase-buffer))
nil t)
" ")
"\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)
(ignore-errors (delete-file err-file)))
(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.
(and filename
(string-match
"\\.\\(?:tar\\.[^.]+\\|tbz\\|tgz\\)\\'"
filename))
(mm-decompress-buffer filename nil t))))
(when decomp
(set-buffer (generate-new-buffer " *temp*"))
(mm-disable-multibyte)
(insert decomp)
(setq filename (file-name-sans-extension filename)))
(goto-char (point-min))
(unwind-protect
(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))))
(when decomp
(kill-buffer (current-buffer)))))))
2000-09-19 13:40:08 +00:00
(provide 'mm-util)
;;; mm-util.el ends here