702 |
(coding-system nil) |
(coding-system nil) |
703 |
(bufname (buffer-name)) |
(bufname (buffer-name)) |
704 |
safe rejected unsafe) |
safe rejected unsafe) |
705 |
(if (eq (car codings) 'undecided) |
;; Classify the defaults into safe, rejected, and unsafe. |
706 |
;; Any coding system is ok. |
(dolist (elt default-coding-system) |
707 |
(setq coding-system t) |
(if (or (eq (car codings) 'undecided) |
708 |
;; Classify the defaults into safe, rejected, and unsafe. |
(memq (cdr elt) codings)) |
709 |
(dolist (elt default-coding-system) |
(if (and (functionp accept-default-p) |
710 |
(if (memq (cdr elt) codings) |
(not (funcall accept-default-p (cdr elt)))) |
711 |
(if (and (functionp accept-default-p) |
(push (car elt) rejected) |
712 |
(not (funcall accept-default-p (cdr elt)))) |
(push (car elt) safe)) |
713 |
(push (car elt) rejected) |
(push (car elt) unsafe))) |
714 |
(push (car elt) safe)) |
(if safe |
715 |
(push (car elt) unsafe))) |
(setq coding-system (car safe))) |
|
(if safe |
|
|
(setq coding-system (car safe)))) |
|
716 |
|
|
717 |
;; If all the defaults failed, ask a user. |
;; If all the defaults failed, ask a user. |
718 |
(when (not coding-system) |
(unless coding-system |
719 |
;; At first, if some defaults are unsafe, record at most 11 |
;; At first, if some defaults are unsafe, record at most 11 |
720 |
;; problematic characters and their positions for them by turning |
;; problematic characters and their positions for them by turning |
721 |
;; (CODING ...) |
;; (CODING ...) |
858 |
The first problematic character is at point in the displayed buffer,\n" |
The first problematic character is at point in the displayed buffer,\n" |
859 |
(substitute-command-keys "\ |
(substitute-command-keys "\ |
860 |
and \\[universal-argument] \\[what-cursor-position] will give information about it.\n")))) |
and \\[universal-argument] \\[what-cursor-position] will give information about it.\n")))) |
861 |
(insert (if safe |
(insert (if rejected |
862 |
"\nSelect the above, or " |
"\nSelect the above, or " |
863 |
"\nSelect ") |
"\nSelect ") |
864 |
"\ |
"\ |
884 |
(kill-buffer "*Warning*") |
(kill-buffer "*Warning*") |
885 |
(set-window-configuration window-configuration))) |
(set-window-configuration window-configuration))) |
886 |
|
|
887 |
(if (vectorp (coding-system-eol-type coding-system)) |
(if (and coding-system (vectorp (coding-system-eol-type coding-system))) |
888 |
(let ((eol (coding-system-eol-type buffer-file-coding-system))) |
(let ((eol (coding-system-eol-type buffer-file-coding-system))) |
889 |
(if (numberp eol) |
(if (numberp eol) |
890 |
(setq coding-system |
(setq coding-system |
891 |
(coding-system-change-eol-conversion coding-system eol))))) |
(coding-system-change-eol-conversion coding-system eol))))) |
892 |
|
|
|
(if (eq coding-system t) |
|
|
(setq coding-system buffer-file-coding-system)) |
|
893 |
;; Check we're not inconsistent with what `coding:' spec &c would |
;; Check we're not inconsistent with what `coding:' spec &c would |
894 |
;; give when file is re-read. |
;; give when file is re-read. |
895 |
;; But don't do this if we explicitly ignored the cookie |
;; But don't do this if we explicitly ignored the cookie |