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