comparison lisp/international/mule-cmds.el @ 43182:faaa5a3adc82

(select-safe-coding-system): State the buffer's name in the message popped in the *Warning* buffer, and make sure the offending buffer is displayed.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 08 Feb 2002 11:59:42 +0000
parents 61ad8f29fefa
children bccb026d40e4
comparison
equal deleted inserted replaced
43181:0f5eacbb65d9 43182:faaa5a3adc82
597 (if select-safe-coding-system-accept-default-p 597 (if select-safe-coding-system-accept-default-p
598 (setq accept-default-p select-safe-coding-system-accept-default-p)) 598 (setq accept-default-p select-safe-coding-system-accept-default-p))
599 599
600 (let ((codings (find-coding-systems-region from to)) 600 (let ((codings (find-coding-systems-region from to))
601 (coding-system nil) 601 (coding-system nil)
602 (bufname (buffer-name))
602 (l default-coding-system)) 603 (l default-coding-system))
603 (if (eq (car codings) 'undecided) 604 (if (eq (car codings) 'undecided)
604 ;; Any coding system is ok. 605 ;; Any coding system is ok.
605 (setq coding-system t) 606 (setq coding-system t)
606 ;; Try the defaults. 607 ;; Try the defaults.
623 (setq mime-charset (coding-system-get (car l) 'mime-charset)) 624 (setq mime-charset (coding-system-get (car l) 'mime-charset))
624 (if (and mime-charset (coding-system-p mime-charset)) 625 (if (and mime-charset (coding-system-p mime-charset))
625 (setcar l mime-charset)) 626 (setcar l mime-charset))
626 (setq l (cdr l)))) 627 (setq l (cdr l))))
627 628
629 ;; Make sure the offending buffer is displayed.
630 (or (stringp from)
631 (pop-to-buffer bufname))
628 ;; Then ask users to select one form CODINGS. 632 ;; Then ask users to select one form CODINGS.
629 (unwind-protect 633 (unwind-protect
630 (save-window-excursion 634 (save-window-excursion
631 (with-output-to-temp-buffer "*Warning*" 635 (with-output-to-temp-buffer "*Warning*"
632 (save-excursion 636 (save-excursion
633 (set-buffer standard-output) 637 (set-buffer standard-output)
634 (if (not default-coding-system) 638 (if (not default-coding-system)
635 (insert "No default coding systems to try.") 639 (insert "No default coding systems to try for "
636 (insert "These default coding systems were tried") 640 (if (stringp from)
637 (if (stringp from) 641 (format "string \"%s\"." from)
638 (insert " to encode \"" 642 (format "buffer `%s'." bufname)))
639 (if (> (length from) 10) 643 (insert
640 (substring from 0 10) 644 "These default coding systems were tried to encode"
641 from) 645 (if (stringp from)
642 "...\"")) 646 (concat " \"" (if (> (length from) 10)
643 (insert ":\n") 647 (concat (substring from 0 10) "...\"")
648 (concat from "\"")))
649 (format " text\nin the buffer `%s'" bufname))
650 ":\n")
644 (let ((pos (point)) 651 (let ((pos (point))
645 (fill-prefix " ")) 652 (fill-prefix " "))
646 (mapcar (function (lambda (x) 653 (mapcar (function (lambda (x)
647 (princ " ") (princ (car x)))) 654 (princ " ") (princ (car x))))
648 default-coding-system) 655 default-coding-system)