aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2016-02-14 17:19:24 +1100
committerLars Ingebrigtsen2016-02-14 17:19:24 +1100
commit0ba42383e24f5ed5fd758ea0afac17fed1d9dc46 (patch)
tree951a593767cdda6e4aef17198c36e52d43713f09
parent66d9ef95c0f9407d2a6d26bcd7ed84a303294b53 (diff)
downloademacs-0ba42383e24f5ed5fd758ea0afac17fed1d9dc46.tar.gz
emacs-0ba42383e24f5ed5fd758ea0afac17fed1d9dc46.zip
Remove codepage setup code from mm-util
* lisp/gnus/mm-util.el (mm-codepage-setup): Remove. (mm-codepage-iso-8859-list): Remove. (mm-codepage-ibm-list, mm-setup-codepage-iso-8859) (mm-setup-codepage-ibm): Remove. (mm-charset-eval-alist): Remove the code pages from the default value.
-rw-r--r--lisp/gnus/mm-util.el164
1 files changed, 4 insertions, 160 deletions
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index a67bc305055..234ad3d3121 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -27,11 +27,7 @@
27(require 'mail-prsvr) 27(require 'mail-prsvr)
28(require 'timer) 28(require 'timer)
29 29
30(defvar mm-mime-mule-charset-alist ) 30(defvar mm-mime-mule-charset-alist)
31;; Note this is not presently used on Emacs >= 23, which is good,
32;; since it means standalone message-mode (which requires mml and
33;; hence mml-util) does not load gnus-util.
34(autoload 'gnus-completing-read "gnus-util")
35 31
36;; Emulate functions that are not available in every (X)Emacs version. 32;; Emulate functions that are not available in every (X)Emacs version.
37;; The name of a function is prefixed with mm-, like `mm-char-int' for 33;; The name of a function is prefixed with mm-, like `mm-char-int' for
@@ -125,169 +121,17 @@
125 (mm-coding-system-p 'iso-8859-1)) 121 (mm-coding-system-p 'iso-8859-1))
126 '((iso_8859-1 . iso-8859-1))) 122 '((iso_8859-1 . iso-8859-1)))
127 ) 123 )
128 "A mapping from unknown or invalid charset names to the real charset names. 124 "A mapping from unknown or invalid charset names to the real charset names.")
129
130See `mm-codepage-iso-8859-list' and `mm-codepage-ibm-list'.")
131
132(defun mm-codepage-setup (number &optional alias)
133 "Create a coding system cpNUMBER.
134The coding system is created using `codepage-setup'. If ALIAS is
135non-nil, an alias is created and added to
136`mm-charset-synonym-alist'. If ALIAS is a string, it's used as
137the alias. Else windows-NUMBER is used."
138 (interactive
139 (let ((completion-ignore-case t)
140 (candidates (if (fboundp 'cp-supported-codepages)
141 (cp-supported-codepages)
142 ;; Removed in Emacs 23 (unicode), so signal an error:
143 (error "`codepage-setup' not present in this Emacs version"))))
144 (list (gnus-completing-read "Setup DOS Codepage" candidates
145 t nil nil "437"))))
146 (when alias
147 (setq alias (if (stringp alias)
148 (intern alias)
149 (intern (format "windows-%s" number)))))
150 (let* ((cp (intern (format "cp%s" number))))
151 (unless (mm-coding-system-p cp)
152 (if (fboundp 'codepage-setup) ; silence compiler
153 (codepage-setup number)
154 (error "`codepage-setup' not present in this Emacs version")))
155 (when (and alias
156 ;; Don't add alias if setup of cp failed.
157 (mm-coding-system-p cp))
158 (add-to-list 'mm-charset-synonym-alist (cons alias cp)))))
159
160(defcustom mm-codepage-iso-8859-list
161 (list 1250 ;; Windows-1250 is a variant of Latin-2 heavily used by Microsoft
162 ;; Outlook users in Czech republic. Use this to allow reading of
163 ;; their e-mails.
164 '(1252 . 1) ;; Windows-1252 is a superset of iso-8859-1 (West
165 ;; Europe). See also `gnus-article-dumbquotes-map'.
166 '(1254 . 9) ;; Windows-1254 is a superset of iso-8859-9 (Turkish).
167 '(1255 . 8));; Windows-1255 is a superset of iso-8859-8 (Hebrew).
168 "A list of Windows codepage numbers and iso-8859 charset numbers.
169
170If an element is a number corresponding to a supported windows
171codepage, appropriate entries to `mm-charset-synonym-alist' are
172added by `mm-setup-codepage-iso-8859'. An element may also be a
173cons cell where the car is a codepage number and the cdr is the
174corresponding number of an iso-8859 charset."
175 :type '(list (set :inline t
176 (const 1250 :tag "Central and East European")
177 (const (1252 . 1) :tag "West European")
178 (const (1254 . 9) :tag "Turkish")
179 (const (1255 . 8) :tag "Hebrew"))
180 (repeat :inline t
181 :tag "Other options"
182 (choice
183 (integer :tag "Windows codepage number")
184 (cons (integer :tag "Windows codepage number")
185 (integer :tag "iso-8859 charset number")))))
186 :version "22.1" ;; Gnus 5.10.9
187 :group 'mime)
188
189(defcustom mm-codepage-ibm-list
190 (list 437 ;; (US etc.)
191 860 ;; (Portugal)
192 861 ;; (Iceland)
193 862 ;; (Israel)
194 863 ;; (Canadian French)
195 865 ;; (Nordic)
196 852 ;;
197 850 ;; (Latin 1)
198 855 ;; (Cyrillic)
199 866 ;; (Cyrillic - Russian)
200 857 ;; (Turkish)
201 864 ;; (Arabic)
202 869 ;; (Greek)
203 874);; (Thai)
204 ;; In Emacs 23 (unicode), cp... and ibm... are aliases.
205 ;; Cf. http://thread.gmane.org/v9lkng5nwy.fsf@marauder.physik.uni-ulm.de
206 "List of IBM codepage numbers.
207
208The codepage mappings slightly differ between IBM and other vendors.
209See \"ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/IBM/README.TXT\".
210
211If an element is a number corresponding to a supported windows
212codepage, appropriate entries to `mm-charset-synonym-alist' are
213added by `mm-setup-codepage-ibm'."
214 :type '(list (set :inline t
215 (const 437 :tag "US etc.")
216 (const 860 :tag "Portugal")
217 (const 861 :tag "Iceland")
218 (const 862 :tag "Israel")
219 (const 863 :tag "Canadian French")
220 (const 865 :tag "Nordic")
221 (const 852)
222 (const 850 :tag "Latin 1")
223 (const 855 :tag "Cyrillic")
224 (const 866 :tag "Cyrillic - Russian")
225 (const 857 :tag "Turkish")
226 (const 864 :tag "Arabic")
227 (const 869 :tag "Greek")
228 (const 874 :tag "Thai"))
229 (repeat :inline t
230 :tag "Other options"
231 (integer :tag "Codepage number")))
232 :version "22.1" ;; Gnus 5.10.9
233 :group 'mime)
234
235(defun mm-setup-codepage-iso-8859 (&optional list)
236 "Add appropriate entries to `mm-charset-synonym-alist'.
237Unless LIST is given, `mm-codepage-iso-8859-list' is used."
238 (unless list
239 (setq list mm-codepage-iso-8859-list))
240 (dolist (i list)
241 (let (cp windows iso)
242 (if (consp i)
243 (setq cp (intern (format "cp%d" (car i)))
244 windows (intern (format "windows-%d" (car i)))
245 iso (intern (format "iso-8859-%d" (cdr i))))
246 (setq cp (intern (format "cp%d" i))
247 windows (intern (format "windows-%d" i))))
248 (unless (mm-coding-system-p windows)
249 (if (mm-coding-system-p cp)
250 (add-to-list 'mm-charset-synonym-alist (cons windows cp))
251 (add-to-list 'mm-charset-synonym-alist (cons windows iso)))))))
252
253(defun mm-setup-codepage-ibm (&optional list)
254 "Add appropriate entries to `mm-charset-synonym-alist'.
255Unless LIST is given, `mm-codepage-ibm-list' is used."
256 (unless list
257 (setq list mm-codepage-ibm-list))
258 (dolist (number list)
259 (let ((ibm (intern (format "ibm%d" number)))
260 (cp (intern (format "cp%d" number))))
261 (when (and (not (mm-coding-system-p ibm))
262 (mm-coding-system-p cp))
263 (add-to-list 'mm-charset-synonym-alist (cons ibm cp))))))
264
265;; Initialize:
266(mm-setup-codepage-iso-8859)
267(mm-setup-codepage-ibm)
268 125
269;; Note: this has to be defined before `mm-charset-to-coding-system'. 126;; Note: this has to be defined before `mm-charset-to-coding-system'.
270(defcustom mm-charset-eval-alist 127(defcustom mm-charset-eval-alist nil
271 '(
272 ;; Emacs 22 provides autoloads for 1250-1258
273 ;; (i.e. `mm-codepage-setup' does nothing).
274 (windows-1250 . (mm-codepage-setup 1250 t))
275 (windows-1251 . (mm-codepage-setup 1251 t))
276 (windows-1253 . (mm-codepage-setup 1253 t))
277 (windows-1257 . (mm-codepage-setup 1257 t)))
278 "An alist of (CHARSET . FORM) pairs. 128 "An alist of (CHARSET . FORM) pairs.
279If an article is encoded in an unknown CHARSET, FORM is 129If an article is encoded in an unknown CHARSET, FORM is
280evaluated. This allows the loading of additional libraries 130evaluated. This allows the loading of additional libraries
281providing charsets on demand. If supported by your Emacs 131providing charsets on demand. If supported by your Emacs
282version, you could use `autoload-coding-system' here." 132version, you could use `autoload-coding-system' here."
283 :version "22.1" ;; Gnus 5.10.9 133 :version "22.1" ;; Gnus 5.10.9
284 :type '(list (set :inline t 134 :type '(list (repeat :inline t
285 (const (windows-1250 . (mm-codepage-setup 1250 t)))
286 (const (windows-1251 . (mm-codepage-setup 1251 t)))
287 (const (windows-1253 . (mm-codepage-setup 1253 t)))
288 (const (windows-1257 . (mm-codepage-setup 1257 t)))
289 (const (cp850 . (mm-codepage-setup 850 nil))))
290 (repeat :inline t
291 :tag "Other options" 135 :tag "Other options"
292 (cons (symbol :tag "charset") 136 (cons (symbol :tag "charset")
293 (symbol :tag "form")))) 137 (symbol :tag "form"))))