1402 |
(defun ps-mule-show-warning (charsets from to header-footer-list) |
(defun ps-mule-show-warning (charsets from to header-footer-list) |
1403 |
(let ((table (make-category-table)) |
(let ((table (make-category-table)) |
1404 |
(buf (current-buffer)) |
(buf (current-buffer)) |
1405 |
|
(max-unprintable-chars 15) |
1406 |
char-pos-list) |
char-pos-list) |
1407 |
(define-category ?u "Unprintable charset" table) |
(define-category ?u "Unprintable charset" table) |
1408 |
(dolist (cs charsets) |
(dolist (cs charsets) |
1410 |
(with-category-table table |
(with-category-table table |
1411 |
(save-excursion |
(save-excursion |
1412 |
(goto-char from) |
(goto-char from) |
1413 |
(while (and (< (length char-pos-list) 20) |
(while (and (<= (length char-pos-list) max-unprintable-chars) |
1414 |
(re-search-forward "\\cu" to t)) |
(re-search-forward "\\cu" to t)) |
1415 |
(push (cons (preceding-char) (1- (point))) char-pos-list)) |
(push (cons (preceding-char) (1- (point))) char-pos-list)))) |
|
(setq char-pos-list (nreverse char-pos-list)))) |
|
1416 |
(with-output-to-temp-buffer "*Warning*" |
(with-output-to-temp-buffer "*Warning*" |
1417 |
(with-current-buffer standard-output |
(with-current-buffer standard-output |
1418 |
(when char-pos-list |
(when char-pos-list |
1419 |
(let ((func #'(lambda (buf pos) |
(let ((func #'(lambda (buf pos) |
1420 |
(when (buffer-live-p buf) |
(when (buffer-live-p buf) |
1421 |
(pop-to-buffer buf) |
(pop-to-buffer buf) |
1422 |
(goto-char pos))))) |
(goto-char pos)))) |
1423 |
|
(more nil)) |
1424 |
|
(if (>= (length char-pos-list) max-unprintable-chars) |
1425 |
|
(setq char-pos-list (cdr char-pos-list) |
1426 |
|
more t)) |
1427 |
(insert "These characters in the buffer can't be printed:\n") |
(insert "These characters in the buffer can't be printed:\n") |
1428 |
(dolist (elt char-pos-list) |
(dolist (elt (nreverse char-pos-list)) |
1429 |
(insert " ") |
(insert " ") |
1430 |
(insert-text-button (string (car elt)) |
(insert-text-button (string (car elt)) |
1431 |
:type 'help-xref |
:type 'help-xref |
1434 |
'help-function func |
'help-function func |
1435 |
'help-args (list buf (cdr elt))) |
'help-args (list buf (cdr elt))) |
1436 |
(insert ",")) |
(insert ",")) |
1437 |
;; Delete the last comma. |
(if more |
1438 |
(delete-char -1) |
(insert " and more...") |
1439 |
|
;; Delete the last comma. |
1440 |
|
(delete-char -1)) |
1441 |
(insert "\nClick them to jump to the buffer position,\n" |
(insert "\nClick them to jump to the buffer position,\n" |
1442 |
(substitute-command-keys "\ |
(substitute-command-keys "\ |
1443 |
or \\[universal-argument] \\[what-cursor-position] will give information about them.\n")))) |
or \\[universal-argument] \\[what-cursor-position] will give information about them.\n")))) |