771
|
1 ;;; code-cmds.el --- Commands for manipulating coding systems.
|
444
|
2
|
|
3 ;; Copyright (C) 1995,1999 Electrotechnical Laboratory, JAPAN.
|
|
4 ;; Licensed to the Free Software Foundation.
|
3416
|
5 ;; Copyright (C) 2000,2006 Free Software Foundation
|
444
|
6 ;; Copyright (C) 1997 MORIOKA Tomohiko
|
771
|
7 ;; Copyright (C) 2001, 2002 Ben Wing.
|
444
|
8
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
25 ;; 02111-1307, USA.
|
|
26
|
|
27 ;;
|
|
28 ;; This code defines the keybindings and utility commands for the
|
|
29 ;; user to manipulate coding systems.
|
3416
|
30 ;; This code used to be in mule-cmds.el which now contains only the
|
|
31 ;; additional bindings/commands that are available for full Mule.
|
444
|
32
|
|
33
|
|
34 ;;; Code:
|
|
35
|
|
36 ;;; Coding related key bindings and menus.
|
|
37
|
771
|
38 (defvar coding-keymap (make-sparse-keymap "Coding+Mule")
|
|
39 "Keymap for coding-system-specific and (when available) Mule commands.")
|
444
|
40
|
771
|
41 ;; Keep "C-x C-m ..." for coding/mule specific commands.
|
444
|
42 (define-key ctl-x-map "\C-m" coding-keymap)
|
|
43
|
|
44 (define-key coding-keymap "f" 'set-buffer-file-coding-system)
|
|
45 (define-key coding-keymap "F" 'set-default-buffer-file-coding-system) ; XEmacs
|
|
46 (define-key coding-keymap "t" 'set-terminal-coding-system)
|
|
47 (define-key coding-keymap "p" 'set-buffer-process-coding-system)
|
|
48 (define-key coding-keymap "c" 'universal-coding-system-argument)
|
|
49 ;;(define-key coding-keymap "c" 'list-coding-system-briefly) ; XEmacs
|
771
|
50 (when-fboundp 'describe-coding-system
|
|
51 (define-key coding-keymap "C" 'describe-coding-system)) ; XEmacs
|
|
52 (when-fboundp 'set-selection-coding-system
|
|
53 (define-key coding-keymap "x" 'set-selection-coding-system)
|
|
54 (define-key coding-keymap "X" 'set-next-selection-coding-system))
|
444
|
55
|
3416
|
56 ;; XEmacs change: make code readable, and sanity-check EOL-TYPE.
|
444
|
57 (defun coding-system-change-eol-conversion (coding-system eol-type)
|
3416
|
58 "Return a version of CODING-SYSTEM that provides EOL-TYPE eol conversion.
|
|
59 EOL-TYPE should be `lf', `crlf', `cr' or nil. nil means the returned coding
|
|
60 system automatically detects the end-of-line convention while decoding.
|
|
61 EOL-TYPE may also be one of the symbols `unix', `dos' or `mac', meaning
|
|
62 `lf', `crlf', and `cr' respectively."
|
|
63 (setq eol-type (cond ((or (eq eol-type 'unix) (eq eol-type 'lf)) 'eol-lf)
|
|
64 ((or (eq eol-type 'dos) (eq eol-type 'crlf)) 'eol-crlf)
|
|
65 ((or (eq eol-type 'mac) (eq eol-type 'cr)) 'eol-cr)
|
|
66 ((null eol-type) nil)
|
|
67 (t (error 'invalid-constant eol-type))))
|
1318
|
68 (coding-system-name
|
3416
|
69 (let ((orig-eol-type (cdr (assq (coding-system-eol-type coding-system)
|
|
70 '((lf . eol-lf)
|
|
71 (cr . eol-cr)
|
|
72 (crlf . eol-crlf)
|
|
73 ;; #### also returns nil if not a key
|
|
74 (nil . nil)))))
|
|
75 (base (coding-system-base coding-system)))
|
|
76 (cond ((eq eol-type orig-eol-type) coding-system)
|
|
77 ((null orig-eol-type)
|
|
78 (coding-system-property coding-system eol-type))
|
|
79 ((null eol-type) base)
|
|
80 ((null (coding-system-eol-type base))
|
|
81 (coding-system-property base eol-type))
|
|
82 (t (warn "couldn't change EOL conversion of %s from %s to %s."
|
|
83 coding-system orig-eol-type eol-type)
|
|
84 ;; return nil for compatibility with old code
|
|
85 nil)))))
|
444
|
86
|
771
|
87 ;; (defun coding-system-change-text-conversion (coding-system coding)
|
|
88 ;; "Return a coding system which differs from CODING-SYSTEM in text conversion.
|
|
89 ;; The returned coding system converts text by CODING
|
|
90 ;; but end-of-line as the same way as CODING-SYSTEM.
|
|
91 ;; If CODING is nil, the returned coding system detects
|
|
92 ;; how text is formatted automatically while decoding."
|
|
93 ;; (if (not coding)
|
|
94 ;; (coding-system-base coding-system)
|
|
95 ;; (let ((eol-type (coding-system-eol-type coding-system)))
|
|
96 ;; (coding-system-change-eol-conversion
|
|
97 ;; coding
|
|
98 ;; (if (numberp eol-type) (aref [unix dos mac] eol-type))))))
|
444
|
99
|
|
100 (defun universal-coding-system-argument ()
|
|
101 "Execute an I/O command using the specified coding system."
|
|
102 (interactive)
|
|
103 (let* ((default (and buffer-file-coding-system
|
|
104 (not (eq (coding-system-type buffer-file-coding-system)
|
|
105 t))
|
|
106 (coding-system-name buffer-file-coding-system)))
|
|
107 (coding-system
|
|
108 (read-coding-system
|
|
109 (if default
|
|
110 (format "Coding system for following command (default, %s): "
|
|
111 default)
|
|
112 "Coding system for following command: ")
|
|
113 default))
|
|
114 (keyseq (read-key-sequence
|
|
115 (format "Command to execute with %s:" coding-system)))
|
|
116 (cmd (key-binding keyseq)))
|
|
117 (let ((coding-system-for-read coding-system)
|
|
118 (coding-system-for-write coding-system))
|
|
119 (message "")
|
|
120 (call-interactively cmd))))
|
|
121
|
771
|
122 (defun set-default-output-coding-systems (coding-system)
|
|
123 "Set default value for coding system output to CODING-SYSTEM.
|
|
124 This sets the coding system of newly created buffers (the default value of
|
|
125 `buffer-file-coding-system') and the default coding system for output to a
|
|
126 subprocess (the CDR of `default-process-coding-system').
|
|
127
|
|
128 Other defaults are not changed; see `prefer-coding-system' for why."
|
444
|
129 (check-coding-system coding-system)
|
|
130 (set-default-buffer-file-coding-system coding-system)
|
771
|
131 (setq default-process-coding-system
|
|
132 (cons (car default-process-coding-system) coding-system)))
|
444
|
133
|
|
134 (defun prefer-coding-system (coding-system)
|
|
135 "Add CODING-SYSTEM at the front of the priority list for automatic detection.
|
771
|
136 This also sets the coding system of newly created buffers (the default
|
|
137 value of `buffer-file-coding-system') and the default coding system for
|
|
138 output to a subprocess (the CDR of `default-process-coding-system').
|
444
|
139
|
|
140 If CODING-SYSTEM specifies a certain type of EOL conversion, the coding
|
|
141 systems set by this function will use that type of EOL conversion.
|
|
142
|
771
|
143 This does not change the default coding system for converting file names
|
|
144 because that is dependent on the current locale; it's changed when
|
|
145 `set-language-environment' is called. It does not change
|
|
146 `terminal-coding-system' or `keyboard-coding-system'; they should get set
|
|
147 when the terminal is opened (and are typically an inherent property of the
|
|
148 terminal), and don't change afterward. It does not change the default
|
|
149 coding system for reading files or input from a subprocess; they should
|
|
150 remain as `undecided' so that automatic detection is done."
|
444
|
151 (interactive "zPrefer coding system: ")
|
|
152 (if (not (and coding-system (find-coding-system coding-system)))
|
|
153 (error "Invalid coding system `%s'" coding-system))
|
|
154 (let ((coding-category (coding-system-category coding-system))
|
|
155 (base (coding-system-base coding-system))
|
|
156 (eol-type (coding-system-eol-type coding-system)))
|
|
157 (if (not coding-category)
|
|
158 ;; CODING-SYSTEM is no-conversion or undecided.
|
|
159 (error "Can't prefer the coding system `%s'" coding-system))
|
|
160 (set-coding-category-system coding-category (or base coding-system))
|
|
161 ;; (update-coding-systems-internal)
|
|
162 (or (eq coding-category (car (coding-category-list)))
|
|
163 ;; We must change the order.
|
|
164 (set-coding-priority-list (list coding-category)))
|
|
165 (if (and base (interactive-p))
|
|
166 (message "Highest priority is set to %s (base of %s)"
|
|
167 base coding-system))
|
|
168 ;; If they asked for specific EOL conversion, honor that.
|
771
|
169 (if (memq eol-type '(lf crlf cr unix dos mac))
|
444
|
170 (setq coding-system
|
|
171 (coding-system-change-eol-conversion base eol-type))
|
|
172 (setq coding-system base))
|
771
|
173 (set-default-output-coding-systems coding-system)))
|
|
174
|
|
175 ;; (defun find-coding-systems-region-subset-p (list1 list2)
|
|
176 ;; "Return non-nil if all elements in LIST1 are included in LIST2.
|
|
177 ;; Comparison done with EQ."
|
|
178 ;; (catch 'tag
|
|
179 ;; (while list1
|
|
180 ;; (or (memq (car list1) list2)
|
|
181 ;; (throw 'tag nil))
|
|
182 ;; (setq list1 (cdr list1)))
|
|
183 ;; t))
|
444
|
184
|
771
|
185 ;; (defun find-coding-systems-region (from to)
|
|
186 ;; "Return a list of proper coding systems to encode a text between FROM and TO.
|
|
187 ;; All coding systems in the list can safely encode any multibyte characters
|
|
188 ;; in the text.
|
|
189 ;;
|
|
190 ;; If the text contains no multibyte characters, return a list of a single
|
|
191 ;; element `undecided'."
|
|
192 ;; (find-coding-systems-for-charsets (find-charset-region from to)))
|
|
193
|
|
194 ;; (defun find-coding-systems-string (string)
|
|
195 ;; "Return a list of proper coding systems to encode STRING.
|
|
196 ;; All coding systems in the list can safely encode any multibyte characters
|
|
197 ;; in STRING.
|
|
198 ;;
|
|
199 ;; If STRING contains no multibyte characters, return a list of a single
|
|
200 ;; element `undecided'."
|
|
201 ;; (find-coding-systems-for-charsets (find-charset-string string)))
|
444
|
202
|
771
|
203 ;; (defun find-coding-systems-for-charsets (charsets)
|
|
204 ;; "Return a list of proper coding systems to encode characters of CHARSETS.
|
|
205 ;; CHARSETS is a list of character sets."
|
|
206 ;; (if (or (null charsets)
|
|
207 ;; (and (= (length charsets) 1)
|
|
208 ;; (eq 'ascii (car charsets))))
|
|
209 ;; '(undecided)
|
|
210 ;; (setq charsets (delq 'composition charsets))
|
|
211 ;; (let ((l (coding-system-list 'base-only))
|
|
212 ;; (charset-preferred-codings
|
|
213 ;; (mapcar (function
|
|
214 ;; (lambda (x)
|
|
215 ;; (if (eq x 'unknown)
|
|
216 ;; 'raw-text
|
|
217 ;; (get-charset-property x 'preferred-coding-system))))
|
|
218 ;; charsets))
|
|
219 ;; (priorities (mapcar (function (lambda (x) (symbol-value x)))
|
|
220 ;; coding-category-list))
|
|
221 ;; codings coding safe)
|
|
222 ;; (if (memq 'unknown charsets)
|
|
223 ;; ;; The region contains invalid multibyte characters.
|
|
224 ;; (setq l '(raw-text)))
|
|
225 ;; (while l
|
|
226 ;; (setq coding (car l) l (cdr l))
|
|
227 ;; (if (and (setq safe (coding-system-get coding 'safe-charsets))
|
|
228 ;; (or (eq safe t)
|
|
229 ;; (find-coding-systems-region-subset-p charsets safe)))
|
|
230 ;; ;; We put the higher priority to coding systems included
|
|
231 ;; ;; in CHARSET-PREFERRED-CODINGS, and within them, put the
|
|
232 ;; ;; higher priority to coding systems which support smaller
|
|
233 ;; ;; number of charsets.
|
|
234 ;; (let ((priority
|
|
235 ;; (+ (if (coding-system-get coding 'mime-charset) 4096 0)
|
|
236 ;; (lsh (length (memq coding priorities)) 7)
|
|
237 ;; (if (memq coding charset-preferred-codings) 64 0)
|
|
238 ;; (if (> (coding-system-type coding) 0) 32 0)
|
|
239 ;; (if (consp safe) (- 32 (length safe)) 0))))
|
|
240 ;; (setq codings (cons (cons priority coding) codings)))))
|
|
241 ;; (mapcar 'cdr
|
|
242 ;; (sort codings (function (lambda (x y) (> (car x) (car y))))))
|
|
243 ;; )))
|
|
244
|
|
245 ;; (defun find-multibyte-characters (from to &optional maxcount excludes)
|
|
246 ;; "Find multibyte characters in the region specified by FROM and TO.
|
|
247 ;; If FROM is a string, find multibyte characters in the string.
|
|
248 ;; The return value is an alist of the following format:
|
|
249 ;; ((CHARSET COUNT CHAR ...) ...)
|
|
250 ;; where
|
|
251 ;; CHARSET is a character set,
|
|
252 ;; COUNT is a number of characters,
|
|
253 ;; CHARs are found characters of the character set.
|
|
254 ;; Optional 3rd arg MAXCOUNT limits how many CHARs are put in the above list.
|
|
255 ;; Optional 4th arg EXCLUDE is a list of character sets to be ignored.
|
|
256 ;;
|
|
257 ;; For invalid characters, CHARs are actually strings."
|
|
258 ;; (let ((chars nil)
|
|
259 ;; charset char)
|
|
260 ;; (if (stringp from)
|
|
261 ;; (let ((idx 0))
|
|
262 ;; (while (setq idx (string-match "[^\000-\177]" from idx))
|
|
263 ;; (setq char (aref from idx)
|
|
264 ;; charset (char-charset char))
|
|
265 ;; (if (eq charset 'unknown)
|
|
266 ;; (setq char (match-string 0)))
|
|
267 ;; (if (or (eq charset 'unknown)
|
|
268 ;; (not (or (eq excludes t) (memq charset excludes))))
|
|
269 ;; (let ((slot (assq charset chars)))
|
|
270 ;; (if slot
|
|
271 ;; (if (not (memq char (nthcdr 2 slot)))
|
|
272 ;; (let ((count (nth 1 slot)))
|
|
273 ;; (setcar (cdr slot) (1+ count))
|
|
274 ;; (if (or (not maxcount) (< count maxcount))
|
|
275 ;; (nconc slot (list char)))))
|
|
276 ;; (setq chars (cons (list charset 1 char) chars)))))
|
|
277 ;; (setq idx (1+ idx))))
|
|
278 ;; (save-excursion
|
|
279 ;; (goto-char from)
|
|
280 ;; (while (re-search-forward "[^\000-\177]" to t)
|
|
281 ;; (setq char (preceding-char)
|
|
282 ;; charset (char-charset char))
|
|
283 ;; (if (eq charset 'unknown)
|
|
284 ;; (setq char (match-string 0)))
|
|
285 ;; (if (or (eq charset 'unknown)
|
|
286 ;; (not (or (eq excludes t) (memq charset excludes))))
|
|
287 ;; (let ((slot (assq charset chars)))
|
|
288 ;; (if slot
|
|
289 ;; (if (not (member char (nthcdr 2 slot)))
|
|
290 ;; (let ((count (nth 1 slot)))
|
|
291 ;; (setcar (cdr slot) (1+ count))
|
|
292 ;; (if (or (not maxcount) (< count maxcount))
|
|
293 ;; (nconc slot (list char)))))
|
|
294 ;; (setq chars (cons (list charset 1 char) chars))))))))
|
|
295 ;; (nreverse chars)))
|
|
296
|
|
297 ;; (defvar last-coding-system-specified nil
|
|
298 ;; "Most recent coding system explicitly specified by the user when asked.
|
|
299 ;; This variable is set whenever Emacs asks the user which coding system
|
|
300 ;; to use in order to write a file. If you set it to nil explicitly,
|
|
301 ;; then call `write-region', then afterward this variable will be non-nil
|
|
302 ;; only if the user was explicitly asked and specified a coding system.")
|
444
|
303
|
771
|
304 ;; (defun select-safe-coding-system (from to &optional default-coding-system)
|
|
305 ;; "Ask a user to select a safe coding system from candidates.
|
|
306 ;; The candidates of coding systems which can safely encode a text
|
|
307 ;; between FROM and TO are shown in a popup window.
|
|
308 ;;
|
|
309 ;; Optional arg DEFAULT-CODING-SYSTEM specifies a coding system to be
|
|
310 ;; checked at first. If omitted, buffer-file-coding-system of the
|
|
311 ;; current buffer is used.
|
|
312 ;;
|
|
313 ;; If the text can be encoded safely by DEFAULT-CODING-SYSTEM, it is
|
|
314 ;; returned without any user interaction.
|
|
315 ;;
|
|
316 ;; Kludgy feature: if FROM is a string, the string is the target text,
|
|
317 ;; and TO is ignored."
|
|
318 ;; (or default-coding-system
|
|
319 ;; (setq default-coding-system buffer-file-coding-system))
|
|
320 ;; (let* ((charsets (if (stringp from) (find-charset-string from)
|
|
321 ;; (find-charset-region from to)))
|
|
322 ;; (safe-coding-systems (find-coding-systems-for-charsets charsets)))
|
|
323 ;; (if (or (not enable-multibyte-characters)
|
|
324 ;; (eq (car safe-coding-systems) 'undecided)
|
|
325 ;; (eq default-coding-system 'no-conversion)
|
|
326 ;; (and default-coding-system
|
|
327 ;; (memq (coding-system-base default-coding-system)
|
|
328 ;; safe-coding-systems)))
|
|
329 ;; default-coding-system
|
|
330 ;;
|
|
331 ;; ;; At first, change each coding system to the corresponding
|
|
332 ;; ;; mime-charset name if it is also a coding system.
|
|
333 ;; (let ((l safe-coding-systems)
|
|
334 ;; mime-charset)
|
|
335 ;; (while l
|
|
336 ;; (setq mime-charset (coding-system-get (car l) 'mime-charset))
|
|
337 ;; (if (and mime-charset (coding-system-p mime-charset))
|
|
338 ;; (setcar l mime-charset))
|
|
339 ;; (setq l (cdr l))))
|
|
340 ;;
|
|
341 ;; (let ((non-safe-chars (find-multibyte-characters
|
|
342 ;; from to 3
|
|
343 ;; (and default-coding-system
|
|
344 ;; (coding-system-get default-coding-system
|
|
345 ;; 'safe-charsets))))
|
|
346 ;; show-position overlays)
|
|
347 ;; (save-excursion
|
|
348 ;; ;; Highlight characters that default-coding-system can't encode.
|
|
349 ;; (when (integerp from)
|
|
350 ;; (goto-char from)
|
|
351 ;; (let ((found nil))
|
|
352 ;; (while (and (not found)
|
|
353 ;; (re-search-forward "[^\000-\177]" to t))
|
|
354 ;; (setq found (assq (char-charset (preceding-char))
|
|
355 ;; non-safe-chars))))
|
|
356 ;; (forward-line -1)
|
|
357 ;; (setq show-position (point))
|
|
358 ;; (save-excursion
|
|
359 ;; (while (and (< (length overlays) 256)
|
|
360 ;; (re-search-forward "[^\000-\177]" to t))
|
|
361 ;; (let* ((char (preceding-char))
|
|
362 ;; (charset (char-charset char)))
|
|
363 ;; (when (assq charset non-safe-chars)
|
|
364 ;; (setq overlays (cons (make-overlay (1- (point)) (point))
|
|
365 ;; overlays))
|
|
366 ;; (overlay-put (car overlays) 'face 'highlight))))))
|
|
367 ;;
|
|
368 ;; ;; At last, ask a user to select a proper coding system.
|
|
369 ;; (unwind-protect
|
|
370 ;; (save-window-excursion
|
|
371 ;; (when show-position
|
|
372 ;; ;; At first, be sure to show the current buffer.
|
|
373 ;; (set-window-buffer (selected-window) (current-buffer))
|
|
374 ;; (set-window-start (selected-window) show-position))
|
|
375 ;; ;; Then, show a helpful message.
|
|
376 ;; (with-output-to-temp-buffer "*Warning*"
|
|
377 ;; (save-excursion
|
|
378 ;; (set-buffer standard-output)
|
|
379 ;; (insert "The target text contains the following non ASCII character(s):\n")
|
|
380 ;; (let ((len (length non-safe-chars))
|
|
381 ;; (shown 0))
|
|
382 ;; (while (and non-safe-chars (< shown 3))
|
|
383 ;; (when (> (length (car non-safe-chars)) 2)
|
|
384 ;; (setq shown (1+ shown))
|
|
385 ;; (insert (format "%25s: " (car (car non-safe-chars))))
|
|
386 ;; (let ((l (nthcdr 2 (car non-safe-chars))))
|
|
387 ;; (while l
|
|
388 ;; (if (or (stringp (car l)) (char-valid-p (car l)))
|
|
389 ;; (insert (car l)))
|
|
390 ;; (setq l (cdr l))))
|
|
391 ;; (if (> (nth 1 (car non-safe-chars)) 3)
|
|
392 ;; (insert "..."))
|
|
393 ;; (insert "\n"))
|
|
394 ;; (setq non-safe-chars (cdr non-safe-chars)))
|
|
395 ;; (if (< shown len)
|
|
396 ;; (insert (format "%27s\n" "..."))))
|
|
397 ;; (insert (format "\
|
|
398 ;; These can't be encoded safely by the coding system %s.
|
|
399 ;;
|
|
400 ;; Please select one from the following safe coding systems:\n"
|
|
401 ;; default-coding-system))
|
|
402 ;; (let ((pos (point))
|
|
403 ;; (fill-prefix " "))
|
|
404 ;; (mapcar (function (lambda (x) (princ " ") (princ x)))
|
|
405 ;; safe-coding-systems)
|
|
406 ;; (fill-region-as-paragraph pos (point)))))
|
|
407 ;;
|
|
408 ;; ;; Read a coding system.
|
|
409 ;; (let* ((safe-names (mapcar (lambda (x) (list (symbol-name x)))
|
|
410 ;; safe-coding-systems))
|
|
411 ;; (name (completing-read
|
|
412 ;; (format "Select coding system (default %s): "
|
|
413 ;; (car safe-coding-systems))
|
|
414 ;; safe-names nil t nil nil
|
|
415 ;; (car (car safe-names)))))
|
|
416 ;; (setq last-coding-system-specified (intern name))
|
|
417 ;; (if (integerp (coding-system-eol-type default-coding-system))
|
|
418 ;; (setq last-coding-system-specified
|
|
419 ;; (coding-system-change-eol-conversion
|
|
420 ;; last-coding-system-specified
|
|
421 ;; (coding-system-eol-type default-coding-system))))
|
|
422 ;; last-coding-system-specified))
|
|
423 ;; (kill-buffer "*Warning*")
|
|
424 ;; (while overlays
|
|
425 ;; (delete-overlay (car overlays))
|
|
426 ;; (setq overlays (cdr overlays)))))))))
|
|
427
|
|
428 ;; (setq select-safe-coding-system-function 'select-safe-coding-system)
|
|
429
|
|
430 ;; (defun select-message-coding-system ()
|
|
431 ;; "Return a coding system to encode the outgoing message of the current buffer.
|
|
432 ;; It at first tries the first coding system found in these variables
|
|
433 ;; in this order:
|
|
434 ;; (1) local value of `buffer-file-coding-system'
|
|
435 ;; (2) value of `sendmail-coding-system'
|
|
436 ;; (3) value of `default-buffer-file-coding-system'
|
|
437 ;; (4) value of `default-sendmail-coding-system'
|
|
438 ;; If the found coding system can't encode the current buffer,
|
|
439 ;; or none of them are bound to a coding system,
|
|
440 ;; it asks the user to select a proper coding system."
|
|
441 ;; (let ((coding (or (and (local-variable-p 'buffer-file-coding-system)
|
|
442 ;; buffer-file-coding-system)
|
|
443 ;; sendmail-coding-system
|
|
444 ;; default-buffer-file-coding-system
|
|
445 ;; default-sendmail-coding-system)))
|
|
446 ;; (if (eq coding 'no-conversion)
|
|
447 ;; ;; We should never use no-conversion for outgoing mails.
|
|
448 ;; (setq coding nil))
|
|
449 ;; (if (fboundp select-safe-coding-system-function)
|
|
450 ;; (funcall select-safe-coding-system-function
|
|
451 ;; (point-min) (point-max) coding)
|
|
452 ;; coding)))
|
444
|
453
|
|
454 (provide 'code-cmds)
|
|
455
|
|
456 ;;; code-cmds.el ends here
|