[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el
From: |
Dave Love |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el |
Date: |
Sun, 06 Oct 2002 12:23:10 -0400 |
Index: emacs/lisp/international/mule-cmds.el
diff -c emacs/lisp/international/mule-cmds.el:1.204
emacs/lisp/international/mule-cmds.el:1.205
*** emacs/lisp/international/mule-cmds.el:1.204 Sun Sep 22 20:20:15 2002
--- emacs/lisp/international/mule-cmds.el Wed Sep 25 09:19:59 2002
***************
*** 661,703 ****
(let ((codings (find-coding-systems-region from to))
(coding-system nil)
(bufname (buffer-name))
! (l default-coding-system))
(if (eq (car codings) 'undecided)
;; Any coding system is ok.
(setq coding-system t)
! ;; Try the defaults.
! (while (and l (not coding-system))
! (if (memq (cdr (car l)) codings)
! (setq coding-system (car (car l)))
! (setq l (cdr l))))
! (if (and coding-system accept-default-p)
! (or (funcall accept-default-p coding-system)
! (setq coding-system (list coding-system)))))
;; If all the defaults failed, ask a user.
! (when (or (not coding-system) (consp coding-system))
! ;; At first, record at most 11 problematic characters and their
! ;; positions for each default.
! (if (stringp from)
! (mapc #'(lambda (coding)
! (setcdr coding
! (mapcar #'(lambda (pos)
! (cons pos (aref from pos)))
! (unencodable-char-position
! 0 (length from) (car coding) 11 from))))
! default-coding-system)
! (mapc #'(lambda (coding)
! (setcdr coding
! (mapcar #'(lambda (pos)
! (cons pos (char-after pos)))
! (unencodable-char-position
! from to (car coding) 11))))
! default-coding-system))
! ;; If 11 unencodable characters were found, mark the last one as nil.
! (mapc #'(lambda (coding)
! (if (> (length coding) 11)
! (setcdr (car (last coding)) nil)))
! default-coding-system)
;; Change each safe coding system to the corresponding
;; mime-charset name if it is also a coding system. Such a name
--- 661,708 ----
(let ((codings (find-coding-systems-region from to))
(coding-system nil)
(bufname (buffer-name))
! safe rejected unsafe)
(if (eq (car codings) 'undecided)
;; Any coding system is ok.
(setq coding-system t)
! ;; Classify the defaults into safe, rejected, and unsafe.
! (dolist (elt default-coding-system)
! (if (memq (cdr elt) codings)
! (if (and (functionp accept-default-p)
! (not (funcall accept-default-p (cdr elt))))
! (push (car elt) rejected)
! (push (car elt) safe))
! (push (car elt) unsafe)))
! (if safe
! (setq coding-system (car (last safe)))))
+ (setq x (list default-coding-system safe rejected unsafe))
;; If all the defaults failed, ask a user.
! (when (not coding-system)
! ;; At first, if some defaults are unsafe, record at most 11
! ;; problematic characters and their positions for them by turning
! ;; (CODING ...)
! ;; into
! ;; ((CODING (POS . CHAR) (POS . CHAR) ...) ...)
! (if unsafe
! (if (stringp from)
! (setq unsafe
! (mapcar #'(lambda (coding)
! (cons coding
! (mapcar #'(lambda (pos)
! (cons pos (aref from pos)))
! (unencodable-char-position
! 0 (length from) coding
! 11 from))))
! unsafe))
! (setq unsafe
! (mapcar #'(lambda (coding)
! (cons coding
! (mapcar #'(lambda (pos)
! (cons pos (char-after pos)))
! (unencodable-char-position
! from to coding 11))))
! unsafe))))
;; Change each safe coding system to the corresponding
;; mime-charset name if it is also a coding system. Such a name
***************
*** 722,734 ****
(let ((window-configuration (current-window-configuration)))
(save-excursion
! ;; Make sure the offending buffer is displayed.
! (when (and (consp default-coding-system) (not (stringp from)))
(pop-to-buffer bufname)
! ;; The `or' is because sometimes (car (cadr x)) is nil.
! (goto-char (apply 'min (mapcar #'(lambda (x) (or (car (cadr x))
(point-max)))
! default-coding-system))))
! ;; Then ask users to select one from CODINGS.
(with-output-to-temp-buffer "*Warning*"
(save-excursion
(set-buffer standard-output)
--- 727,740 ----
(let ((window-configuration (current-window-configuration)))
(save-excursion
! ;; If some defaults are unsafe, make sure the offending
! ;; buffer is displayed.
! (when (and unsafe (not (stringp from)))
(pop-to-buffer bufname)
! (goto-char (apply 'min (mapcar #'(lambda (x) (car (cadr x)))
! unsafe))))
! ;; Then ask users to select one from CODINGS while showing
! ;; the reason why none of the defaults are not used.
(with-output-to-temp-buffer "*Warning*"
(save-excursion
(set-buffer standard-output)
***************
*** 747,790 ****
":\n")
(let ((pos (point))
(fill-prefix " "))
! (mapcar (function (lambda (x)
! (princ " ") (princ (car x))))
! default-coding-system)
(insert "\n")
(fill-region-as-paragraph pos (point)))
! (if (consp coding-system)
! (insert (format "%s safely encodes the target text,\n"
! (car coding-system))
! "\
but it is not recommended for encoding text in this context,
! e.g., for sending an email message.\n")
! (insert "\
! However, each of them encountered these problematic characters:\n")
(mapc
#'(lambda (coding)
(insert (format " %s:" (car coding)))
! (dolist (elt (cdr coding))
! (insert " ")
! (if (stringp from)
! (insert (or (cdr elt) "..."))
! (if (cdr elt)
! (insert-text-button
! (cdr elt)
! :type 'help-xref
! 'help-echo
! "mouse-2, RET: jump to this character"
! 'help-function
! #'(lambda (bufname pos)
! (when (buffer-live-p (get-buffer bufname))
! (pop-to-buffer bufname)
! (goto-char pos)))
! 'help-args (list bufname (car elt)))
! (insert-text-button
! "..."
! :type 'help-xref
! 'help-echo
! "mouse-2, RET: next unencodable character"
! 'help-function
#'(lambda (bufname pos coding)
(when (buffer-live-p (get-buffer bufname))
(pop-to-buffer bufname)
--- 753,782 ----
":\n")
(let ((pos (point))
(fill-prefix " "))
! (mapc #'(lambda (x) (princ " ") (princ (car x)))
! default-coding-system)
(insert "\n")
(fill-region-as-paragraph pos (point)))
! (when rejected
! (insert "These safely encodes the target text,
but it is not recommended for encoding text in this context,
! e.g., for sending an email message.\n ")
! (mapc #'(lambda (x) (princ " ") (princ x)) rejected)
! (insert "\n"))
! (when unsafe
! (insert (if rejected "And the others"
! "However, each of them")
! " encountered these problematic characters:\n")
(mapc
#'(lambda (coding)
(insert (format " %s:" (car coding)))
! (let ((i 0)
! (func1
! #'(lambda (bufname pos)
! (when (buffer-live-p (get-buffer bufname))
! (pop-to-buffer bufname)
! (goto-char pos))))
! (func2
#'(lambda (bufname pos coding)
(when (buffer-live-p (get-buffer bufname))
(pop-to-buffer bufname)
***************
*** 792,807 ****
(goto-char pos)
(forward-char 1)
(search-unencodable-char coding)
! (forward-char -1))))
! 'help-args (list bufname (car elt)
! (car coding))))))
(insert "\n"))
! default-coding-system)
(insert "\
The first problematic character is at point in the displayed buffer,\n"
(substitute-command-keys "\
and \\[universal-argument] \\[what-cursor-position] will give information
about it.\n"))))
! (insert (if (consp coding-system)
"\nSelect the above, or "
"\nSelect ")
"\
--- 784,818 ----
(goto-char pos)
(forward-char 1)
(search-unencodable-char coding)
! (forward-char -1))))))
! (dolist (elt (cdr coding))
! (insert " ")
! (if (stringp from)
! (insert (if (< i 10) (cdr elt) "..."))
! (if (< i 10)
! (insert-text-button
! (cdr elt)
! :type 'help-xref
! 'help-echo
! "mouse-2, RET: jump to this character"
! 'help-function func1
! 'help-args (list bufname (car elt)))
! (insert-text-button
! "..."
! :type 'help-xref
! 'help-echo
! "mouse-2, RET: next unencodable character"
! 'help-function func2
! 'help-args (list bufname (car elt)
! (car coding)))))
! (setq i (1+ i))))
(insert "\n"))
! unsafe)
(insert "\
The first problematic character is at point in the displayed buffer,\n"
(substitute-command-keys "\
and \\[universal-argument] \\[what-cursor-position] will give information
about it.\n"))))
! (insert (if safe
"\nSelect the above, or "
"\nSelect ")
"\
***************
*** 814,821 ****
(fill-region-as-paragraph pos (point)))))
;; Read a coding system.
! (if (consp coding-system)
! (setq codings (cons (car coding-system) codings)))
(let* ((safe-names (mapcar (lambda (x) (list (symbol-name x)))
codings))
(name (completing-read
--- 825,832 ----
(fill-region-as-paragraph pos (point)))))
;; Read a coding system.
! (if safe
! (setq codings (append safe codings)))
(let* ((safe-names (mapcar (lambda (x) (list (symbol-name x)))
codings))
(name (completing-read
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Dave Love, 2002/10/05
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Dave Love, 2002/10/05
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el,
Dave Love <=
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Kenichi Handa, 2002/10/09
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Dave Love, 2002/10/09
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Kenichi Handa, 2002/10/14
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Kenichi Handa, 2002/10/15
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Dave Love, 2002/10/18
- [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el, Dave Love, 2002/10/27