From f9ee2db4937cf51aa4442f5d24275b82c773208b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 9 Aug 2022 17:47:50 +0200 Subject: [PATCH] Improve readability of list-input-methods * lisp/international/mule-diag.el: Make screen more readable by improving the formatting. --- lisp/international/mule-diag.el | 55 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 6b630c73e8e..646e0b84802 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -1065,35 +1065,36 @@ see the function `describe-fontset' for the format of the list." (help-xref-button 1 'help-input-method (match-string 1)))))))) (defun list-input-methods-1 () - (if (not input-method-alist) - (princ " + (with-current-buffer standard-output + (if (not input-method-alist) + (insert " No input method is available, perhaps because you have not installed LEIM (Libraries of Emacs Input Methods).") - (princ (substitute-command-keys - "LANGUAGE\n NAME (`TITLE' in mode line)\n")) - (princ " SHORT-DESCRIPTION\n------------------------------\n") - (setq input-method-alist - (sort input-method-alist - (lambda (x y) (string< (nth 1 x) (nth 1 y))))) - - (let (language) - (dolist (elt input-method-alist) - (when (not (equal language (nth 1 elt))) - (setq language (nth 1 elt)) - (princ language) - (terpri)) - (princ (format-message - " %s (`%s' in mode line)\n %s\n" - (car elt) - (let ((title (nth 3 elt))) - (if (and (consp title) (stringp (car title))) - (car title) - title)) - ;; If the doc is multi-line, indent all - ;; non-blank lines. (Bug#8066) - (replace-regexp-in-string - "\n\\(.\\)" "\n \\1" - (substitute-command-keys (or (nth 4 elt) ""))))))))) + (insert (substitute-command-keys + "LANGUAGE\n NAME (`TITLE' in mode line)\n")) + (insert " SHORT-DESCRIPTION\n------------------------------\n") + (setq input-method-alist + (sort input-method-alist + (lambda (x y) (string< (nth 1 x) (nth 1 y))))) + + (let (language) + (dolist (elt input-method-alist) + (when (not (equal language (nth 1 elt))) + (setq language (nth 1 elt)) + (insert "\n" (propertize language 'face 'help-for-help-header) "\n\n")) + (insert (format-message + " %s (`%s' in mode line)\n %s\n" + (car elt) + (let ((title (nth 3 elt))) + (if (and (consp title) (stringp (car title))) + (car title) + title)) + ;; If the doc is multi-line, indent all + ;; non-blank lines. (Bug#8066) + (replace-regexp-in-string + "\n\\(.\\)" "\n \\1" + (substitute-command-keys (or (nth 4 elt) "")))))))))) + ;;; DIAGNOSIS -- 2.39.2