mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Improve a recent change in 'mule-cmds.el'
* lisp/international/mule-cmds.el (select-safe-coding-system--format-list): Display codepoints in hex and as characters. Display the ellipsis in a better place. Enlarge the limit to 5 codepoints, as the display is now easier to grasp. (select-safe-coding-system-interactively): Don't use 'select-safe-coding-system--format-list' for "rejected" coding-systems, as those don't come with characters and positions.
This commit is contained in:
parent
28dc18a553
commit
bfb2dd0e9d
1 changed files with 19 additions and 11 deletions
|
|
@ -663,19 +663,23 @@ overrides that argument.")
|
|||
codings))
|
||||
|
||||
(defun select-safe-coding-system--format-list (list)
|
||||
(let ((spec " %-20s %6s %10s %s\n"))
|
||||
(insert (format spec "Coding System" "Pos" "Code Point" ""))
|
||||
(let ((spec1 " %-20s %6s %-10s %s\n")
|
||||
(spec2 " %-20s %6s #x%-8X %c\n")
|
||||
(nmax 5))
|
||||
(insert (format spec1 "Coding System" "Pos" "Codepoint" "Char"))
|
||||
(cl-loop for (coding . pairs) in list
|
||||
do (cl-loop for pair in pairs
|
||||
;; If there's a lot, only do the first three.
|
||||
for i from 1 upto 3
|
||||
;; If there's a lot, only do the first five.
|
||||
for i from 1 upto nmax
|
||||
do (insert
|
||||
(format spec
|
||||
(format spec2
|
||||
(if (= i 1) coding "")
|
||||
(car pair) (cdr pair)
|
||||
(if (and (= i 3) (> (length pairs) 3))
|
||||
"..."
|
||||
""))))))
|
||||
(car pair)
|
||||
(cdr pair)
|
||||
(cdr pair))))
|
||||
(if (> (length pairs) nmax)
|
||||
(insert (format spec1 "" "..." "" "")))))
|
||||
|
||||
(insert "\n"))
|
||||
|
||||
(defun select-safe-coding-system-interactively (from to codings unsafe
|
||||
|
|
@ -736,14 +740,18 @@ DEFAULT is the coding system to use by default in the query."
|
|||
(concat " \"" (if (> (length from) 10)
|
||||
(concat (substring from 0 10) "...\"")
|
||||
(concat from "\"")))
|
||||
(format-message " text\nin the buffer `%s'" bufname))
|
||||
(format-message
|
||||
" the following\nproblematic characters in the buffer `%s'"
|
||||
bufname))
|
||||
":\n")
|
||||
(select-safe-coding-system--format-list unsafe)
|
||||
(when rejected
|
||||
(insert "These safely encode the text in the buffer,
|
||||
but are not recommended for encoding text in this context,
|
||||
e.g., for sending an email message.\n ")
|
||||
(select-safe-coding-system--format-list rejected))
|
||||
(dolist (x rejected)
|
||||
(princ " ") (princ x))
|
||||
(insert "\n"))
|
||||
(when unsafe
|
||||
(insert (if rejected "The other coding systems"
|
||||
"However, each of them")
|
||||
|
|
|
|||
Loading…
Reference in a new issue