• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:default +defs:file +defs:name +defs:coding +defs:system

8 ;; This file is part of GNU Emacs.
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
39 '((decode-coding-string . (lambda (s a) s))
40 (encode-coding-string . (lambda (s a) s))
41 (encode-coding-region . ignore)
42 (coding-system-list . ignore)
43 (decode-coding-region . ignore)
45 (coding-system-equal . equal)
47 (set-buffer-file-coding-system . ignore)
57 (mapcar (lambda (e) (list (symbol-name (car e))))
85 ;; Better use string-to-multibyte or encode-coding-string.
91 ;; (string-as-multibyte s) ~= (decode-coding-string s 'emacs-mule)
92 ;; (string-to-multibyte s) ~= (decode-coding-string s 'binary)
93 ;; (string-make-multibyte s) ~= (decode-coding-string s locale-coding-system)
147 ;; proper charset names (base coding systems which have a
150 ;; `(or (coding-system-get 'iso-8859-1 'mime-charset)
151 ;; (coding-system-get 'iso-8859-1 :mime-charset))'
152 ;; Actually, there should be an `mm-coding-system-mime-charset'.
154 (defalias 'mm-read-coding-system
156 ((fboundp 'read-coding-system)
159 (lambda (prompt &optional default-coding-system)
160 (read-coding-system prompt))
161 'read-coding-system))
162 (t (lambda (prompt &optional default-coding-system)
163 "Prompt the user for a coding system."
165 prompt (mapcar (lambda (s) (list (symbol-name (car s))))
168 (defvar mm-coding-system-list nil)
169 (defun mm-get-coding-system-list ()
170 "Get the coding system list."
171 (or mm-coding-system-list
172 (setq mm-coding-system-list (mm-coding-system-list))))
174 (defun mm-coding-system-p (cs)
175 "Return non-nil if CS is a symbol naming a coding system.
176 In XEmacs, also return non-nil if CS is a coding system object.
177 If CS is available, return CS itself in Emacs, and return a coding
178 system object in XEmacs."
179 (if (fboundp 'find-coding-system)
180 (and cs (find-coding-system cs))
181 (if (fboundp 'coding-system-p)
182 (when (coding-system-p cs)
185 (car (memq cs (mm-get-coding-system-list))))))
188 "Create a coding system cpNUMBER.
189 The coding system is created using `codepage-setup'. If ALIAS is
196 (list (completing-read "Setup DOS Codepage: (default 437) " candidates
203 (unless (mm-coding-system-p cp)
207 (mm-coding-system-p cp))
213 ,@(unless (mm-coding-system-p 'x-ctext)
217 ,@(unless (mm-coding-system-p 'iso-8859-15)
220 ,@(unless (mm-coding-system-p 'big5-hkscs)
223 ,@(when (and (not (mm-coding-system-p 'unicode))
224 (mm-coding-system-p 'utf-16-le))
227 ,@(unless (mm-coding-system-p 'ks_c_5601-1987)
228 (if (mm-coding-system-p 'cp949)
232 ,@(when (and (not (mm-coding-system-p 'windows-31j))
233 (mm-coding-system-p 'cp932))
329 (unless (mm-coding-system-p windows)
330 (if (mm-coding-system-p cp)
342 (when (and (not (mm-coding-system-p ibm))
343 (mm-coding-system-p cp))
380 could use `autoload-coding-system' here."
394 (defvar mm-binary-coding-system
396 ((mm-coding-system-p 'binary) 'binary)
397 ((mm-coding-system-p 'no-conversion) 'no-conversion)
399 "100% binary coding system.")
401 (defvar mm-text-coding-system
402 (or (if (memq system-type '(windows-nt ms-dos ms-windows))
403 (and (mm-coding-system-p 'raw-text-dos) 'raw-text-dos)
404 (and (mm-coding-system-p 'raw-text) 'raw-text))
405 mm-binary-coding-system)
406 "Text-safe coding system (For removing ^M).")
408 (defvar mm-text-coding-system-for-write nil
409 "Text coding system for write.")
411 (defvar mm-auto-save-coding-system
413 ((mm-coding-system-p 'utf-8-emacs) ; Mule 7
414 (if (memq system-type '(windows-nt ms-dos ms-windows))
415 (if (mm-coding-system-p 'utf-8-emacs-dos)
416 'utf-8-emacs-dos mm-binary-coding-system)
418 ((mm-coding-system-p 'emacs-mule)
419 (if (memq system-type '(windows-nt ms-dos ms-windows))
420 (if (mm-coding-system-p 'emacs-mule-dos)
421 'emacs-mule-dos mm-binary-coding-system)
423 ((mm-coding-system-p 'escape-quoted) 'escape-quoted)
424 (t mm-binary-coding-system))
425 "Coding system of auto save file.")
427 (defvar mm-universal-coding-system mm-auto-save-coding-system
428 "The universal coding system.")
440 ;; The fake mule-charset, gnus-koi8-r, tells Gnus that the default
480 (cons 'utf-8 (delq 'ascii (mapcar 'charset-name
484 (not (mm-coding-system-p 'mule-utf-8)))
489 (coding-system-get 'mule-utf-8 'safe-charsets))))))
515 (when (and (fboundp 'coding-system-list)
516 (fboundp 'sort-coding-systems))
517 (let ((css (sort-coding-systems (coding-system-list 'base-only)))
521 mime (or (coding-system-get cs :mime-charset) ; Emacs 23 (unicode)
522 (coding-system-get cs 'mime-charset)))
525 (coding-system-get cs 'safe-charsets))))
540 "ISO-8859-15 exchangeable coding systems and inconvertible characters.")
543 (and (fboundp 'coding-system-p)
544 (mm-coding-system-p 'iso-8859-15)
547 (if (mm-coding-system-p (car cs))
549 (decode-coding-string "\341" (car cs)))))
553 (decode-coding-string "\341" 'iso-8859-15)) c)
554 (string-to-list (decode-coding-string (car (cdr cs))
560 (defcustom mm-coding-system-priorities
568 "Preferred coding systems for encoding outgoing messages.
570 More than one suitable coding system may be found for some text.
571 By default, the coding system with the highest priority is used
572 to encode outgoing messages (see `sort-coding-systems'). If this
573 variable is set, it overrides the default priority."
575 :type '(repeat (symbol :tag "Coding system"))
579 (defvar mm-use-find-coding-systems-region
580 (fboundp 'find-coding-systems-region)
581 "Use `find-coding-systems-region' to find proper coding systems.
592 (if (and (fboundp 'find-coding-systems-for-charsets)
593 (fboundp 'sort-coding-systems))
594 (let ((css (sort (sort-coding-systems
595 (find-coding-systems-for-charsets (list charset)))
596 'mm-sort-coding-systems-predicate))
601 (setq mime (or (coding-system-get cs :mime-charset)
602 (coding-system-get cs 'mime-charset)))))
607 'mm-sort-coding-systems-predicate)))
616 (defun mm-charset-to-coding-system (charset &optional lbt
618 "Return coding-system corresponding to CHARSET.
621 used as the line break code type of the coding system.
635 ((or (null (mm-get-coding-system-list))
636 (not (fboundp 'coding-system-get)))
642 (and cs (mm-coding-system-p cs) cs))))
647 ;; on there being some coding system matching each `mime-charset'
649 ((and (mm-coding-system-p charset)
652 ;;; (eq charset (coding-system-get charset 'mime-charset))
665 (mm-coding-system-p cs)
671 (mm-coding-system-p cs)
676 ;; Last resort: search the coding system list for entries which
677 ;; have the right mime-charset in case the canonical name isn't
680 ;; mm-get-coding-system-list returns a list of cs without lbt.
682 (dolist (c (mm-get-coding-system-list))
684 (eq charset (or (coding-system-get c :mime-charset)
685 (coding-system-get c 'mime-charset))))
699 (boundp 'default-enable-multibyte-characters)
700 default-enable-multibyte-characters
707 Only do this if the default value of `enable-multibyte-characters' is
719 (defun mm-preferred-coding-system (charset)
721 (or (get-charset-property charset 'preferred-coding-system)
722 (get-charset-property charset 'prefered-coding-system)))
741 ;; default
767 (if (and (fboundp 'coding-system-get) (fboundp 'get-charset-property))
770 (and (mm-preferred-coding-system charset)
771 (or (coding-system-get
772 (mm-preferred-coding-system charset) :mime-charset)
773 (coding-system-get
774 (mm-preferred-coding-system charset) 'mime-charset)))
777 (mm-preferred-coding-system charset)
799 ;; default multibyteness. See mm-default-multibyte-p.
808 (defun mm-default-multibyte-p ()
810 This affects whether coding conversion should be attempted generally."
812 (if (boundp 'default-enable-multibyte-characters)
813 default-enable-multibyte-characters
837 (defun mm-sort-coding-systems-predicate (a b)
841 (and (setq cs (mm-coding-system-p cs))
842 (coding-system-base cs)))
843 mm-coding-system-priorities)))
844 (and (setq a (mm-coding-system-p a))
845 (if (setq b (mm-coding-system-p b))
846 (> (length (memq (coding-system-base a) priorities))
847 (length (memq (coding-system-base b) priorities)))
851 (autoload 'latin-unity-massage-name "latin-unity")
855 (defvar latin-unity-coding-systems)
862 can be encoded using a single one of the corresponding coding systems.
864 It treats `mm-coding-system-priorities' as the list of preferred
865 coding systems; a useful example setting for this list in Western
866 Europe would be '(iso-8859-1 iso-8859-15 utf-8), which would default
867 to the very standard Latin 1 coding system, and only move to coding
876 (let ((systems mm-coding-system-priorities) csets psets curset)
890 ;; Pass back the first coding system in the preferred list
893 (setq curset (latin-unity-massage-name 'buffer-default curset))
895 ;; If the coding system is a universal coding system, then
900 ;; If a coding system isn't universal, and isn't in
905 (unless (memq curset latin-unity-coding-systems)
908 ;; Right, we know about this coding system, and it may
915 ;; `mm-coding-system-priorities' list.
920 ;; take its default action, which equally applies to GNU Emacs.
934 mm-use-find-coding-systems-region
935 ;; Find the mime-charset of the most preferred coding
936 ;; system that has one.
937 (let ((systems (find-coding-systems-region b e)))
938 (when mm-coding-system-priorities
940 (sort systems 'mm-sort-coding-systems-predicate)))
945 (cs (or (coding-system-get head :mime-charset)
946 (coding-system-get head 'mime-charset))))
953 ;; Also people apparently need the coding system
957 (not (string-match "^[Xx]-" (symbol-name cs)))
961 ;; and versions of Emacs. (The name
964 (not (string-match "utf-16" (symbol-name cs))))
968 ;; If we're XEmacs, and some coding system is appropriate,
973 ;; We're not multibyte, or a single coding system won't cover it.
991 (mm-coding-system-p 'utf-8))
992 (let ((mm-coding-system-priorities
993 (cons 'utf-8 mm-coding-system-priorities)))
1004 `(let (default-enable-multibyte-characters)
1012 `(let ((default-enable-multibyte-characters t))
1019 Also bind `default-enable-multibyte-characters' to nil.
1034 (let (default-enable-multibyte-characters)
1039 (let (default-enable-multibyte-characters)
1045 "Eval the FORMS with the default value of `enable-multibyte-characters' nil."
1046 `(let (default-enable-multibyte-characters)
1052 "Eval the FORMS with the default value of `enable-multibyte-characters' t."
1053 `(let ((default-enable-multibyte-characters t))
1117 (defvar mm-inhibit-file-name-handlers
1118 '(jka-compr-handler image-file-handler)
1121 (defun mm-insert-file-contents (filename &optional visit beg end replace
1123 "Like `insert-file-contents', but only reads in the file.
1125 to advanced Emacs features, such as file-name-handlers, format decoding,
1126 `find-file-hooks', etc.
1127 If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'.
1131 (default-major-mode 'fundamental-mode)
1133 (after-insert-file-functions nil)
1135 (inhibit-file-name-operation (if inhibit
1136 'insert-file-contents
1137 inhibit-file-name-operation))
1138 (inhibit-file-name-handlers
1140 (append mm-inhibit-file-name-handlers
1141 inhibit-file-name-handlers)
1142 inhibit-file-name-handlers))
1143 (ffh (if (boundp 'find-file-hook)
1144 'find-file-hook
1145 'find-file-hooks))
1149 (insert-file-contents filename visit beg end replace)
1152 (defun mm-append-to-file (start end filename &optional codesys inhibit)
1153 "Append the contents of the region to the end of file FILENAME.
1157 Optional fourth argument specifies the coding system to use when
1158 encoding the file.
1159 If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
1160 (let ((coding-system-for-write
1161 (or codesys mm-text-coding-system-for-write
1162 mm-text-coding-system))
1163 (inhibit-file-name-operation (if inhibit
1164 'append-to-file
1165 inhibit-file-name-operation))
1166 (inhibit-file-name-handlers
1168 (append mm-inhibit-file-name-handlers
1169 inhibit-file-name-handlers)
1170 inhibit-file-name-handlers)))
1175 coding-system inhibit)
1178 If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
1179 (let ((coding-system-for-write
1180 (or coding-system mm-text-coding-system-for-write
1181 mm-text-coding-system))
1182 (inhibit-file-name-operation (if inhibit
1184 inhibit-file-name-operation))
1185 (inhibit-file-name-handlers
1187 (append mm-inhibit-file-name-handlers
1188 inhibit-file-name-handlers)
1189 inhibit-file-name-handlers)))
1193 (if (and (fboundp 'make-temp-file)
1195 (let ((def (symbol-function 'make-temp-file)))
1203 (defalias 'mm-make-temp-file 'make-temp-file)
1205 (defun mm-make-temp-file (prefix &optional dir-flag suffix)
1206 "Create a temporary file.
1207 The returned file name (created by appending some random characters at the end
1208 of PREFIX, and expanding against `temporary-file-directory' if necessary),
1209 is guaranteed to point to a newly created empty file.
1210 You can then use `write-region' to write new data into the file.
1212 If DIR-FLAG is non-nil, create a new empty directory instead of a file.
1214 If SUFFIX is non-nil, add that at the end of the file name."
1215 (let ((umask (default-file-modes))
1216 file)
1222 (set-default-file-modes 448)
1225 (setq file
1226 (make-temp-name
1227 (expand-file-name
1232 temporary-file-directory))))
1234 (setq file (concat file suffix)))
1236 (make-directory file)
1240 (gmm-write-region "" nil file nil 'silent
1243 (file-already-exists t)
1245 ;; `make-directory' issue `file-error'.
1246 (file-error (or (and (or (featurep 'xemacs)
1248 (file-exists-p file))
1250 ;; the file was somehow created by someone else between
1251 ;; `make-temp-name' and `write-region', let's try again.
1253 file)
1255 (set-default-file-modes umask)))))
1261 (file-directory-p
1262 (setq dir (concat (file-name-directory
1263 (directory-file-name path))
1269 (if (fboundp 'detect-coding-region)
1270 (defun mm-detect-coding-region (start end)
1271 "Like `detect-coding-region' except returning the best one."
1272 (let ((coding-systems
1273 (detect-coding-region start end)))
1274 (or (car-safe coding-systems)
1275 coding-systems)))
1276 (defun mm-detect-coding-region (start end)
1284 (if (fboundp 'coding-system-get)
1287 (let ((cs (mm-detect-coding-region start end)))
1288 (or (coding-system-get cs :mime-charset)
1289 (coding-system-get cs 'mime-charset))))
1292 (let ((cs (mm-detect-coding-region start end)))