aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2003-11-25 13:03:14 +0000
committerKenichi Handa2003-11-25 13:03:14 +0000
commitf2b4b39d20ecf66df26c7b5063af66cd7f87796f (patch)
tree206a6fe83dd72c4990146ea3a16c17f2d31ae5dd
parent487519ff7407b4b586e1c42c24222a897cb9b901 (diff)
downloademacs-f2b4b39d20ecf66df26c7b5063af66cd7f87796f.tar.gz
emacs-f2b4b39d20ecf66df26c7b5063af66cd7f87796f.zip
(select-safe-coding-system): Fix for
the case that the first element of default-coding-system is t. Fix a message when some coding systems are rejected.
-rw-r--r--lisp/international/mule-cmds.el32
1 files changed, 14 insertions, 18 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 82456859ebb..d18f368ba01 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -702,22 +702,20 @@ and TO is ignored."
702 (coding-system nil) 702 (coding-system nil)
703 (bufname (buffer-name)) 703 (bufname (buffer-name))
704 safe rejected unsafe) 704 safe rejected unsafe)
705 (if (eq (car codings) 'undecided) 705 ;; Classify the defaults into safe, rejected, and unsafe.
706 ;; Any coding system is ok. 706 (dolist (elt default-coding-system)
707 (setq coding-system t) 707 (if (or (eq (car codings) 'undecided)
708 ;; Classify the defaults into safe, rejected, and unsafe. 708 (memq (cdr elt) codings))
709 (dolist (elt default-coding-system) 709 (if (and (functionp accept-default-p)
710 (if (memq (cdr elt) codings) 710 (not (funcall accept-default-p (cdr elt))))
711 (if (and (functionp accept-default-p) 711 (push (car elt) rejected)
712 (not (funcall accept-default-p (cdr elt)))) 712 (push (car elt) safe))
713 (push (car elt) rejected) 713 (push (car elt) unsafe)))
714 (push (car elt) safe)) 714 (if safe
715 (push (car elt) unsafe))) 715 (setq coding-system (car safe)))
716 (if safe
717 (setq coding-system (car safe))))
718 716
719 ;; If all the defaults failed, ask a user. 717 ;; If all the defaults failed, ask a user.
720 (when (not coding-system) 718 (unless coding-system
721 ;; At first, if some defaults are unsafe, record at most 11 719 ;; At first, if some defaults are unsafe, record at most 11
722 ;; problematic characters and their positions for them by turning 720 ;; problematic characters and their positions for them by turning
723 ;; (CODING ...) 721 ;; (CODING ...)
@@ -860,7 +858,7 @@ e.g., for sending an email message.\n ")
860The first problematic character is at point in the displayed buffer,\n" 858The first problematic character is at point in the displayed buffer,\n"
861 (substitute-command-keys "\ 859 (substitute-command-keys "\
862and \\[universal-argument] \\[what-cursor-position] will give information about it.\n")))) 860and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
863 (insert (if safe 861 (insert (if rejected
864 "\nSelect the above, or " 862 "\nSelect the above, or "
865 "\nSelect ") 863 "\nSelect ")
866 "\ 864 "\
@@ -886,14 +884,12 @@ on your risk of losing the problematic characters.\n")))
886 (kill-buffer "*Warning*") 884 (kill-buffer "*Warning*")
887 (set-window-configuration window-configuration))) 885 (set-window-configuration window-configuration)))
888 886
889 (if (vectorp (coding-system-eol-type coding-system)) 887 (if (and coding-system (vectorp (coding-system-eol-type coding-system)))
890 (let ((eol (coding-system-eol-type buffer-file-coding-system))) 888 (let ((eol (coding-system-eol-type buffer-file-coding-system)))
891 (if (numberp eol) 889 (if (numberp eol)
892 (setq coding-system 890 (setq coding-system
893 (coding-system-change-eol-conversion coding-system eol))))) 891 (coding-system-change-eol-conversion coding-system eol)))))
894 892
895 (if (eq coding-system t)
896 (setq coding-system buffer-file-coding-system))
897 ;; Check we're not inconsistent with what `coding:' spec &c would 893 ;; Check we're not inconsistent with what `coding:' spec &c would
898 ;; give when file is re-read. 894 ;; give when file is re-read.
899 ;; But don't do this if we explicitly ignored the cookie 895 ;; But don't do this if we explicitly ignored the cookie