]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix printing of C-@ in `describe-fontset'
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 20 Aug 2021 14:35:56 +0000 (16:35 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 20 Aug 2021 14:35:56 +0000 (16:35 +0200)
* lisp/international/mule-diag.el (mule--kbd-at): New function
(bug#17836).
(print-fontset-element): Use it to get multi-key things correct.

lisp/international/mule-diag.el

index 02169ceb689fe3250ce6431969b06da3328ea460..864cd3ce01e5de287c9770749ff8e9b55cd197ef 100644 (file)
@@ -862,15 +862,28 @@ The IGNORED argument is ignored."
 
 (defvar mule--print-opened)
 
+(defun mule--kbd-at (point)
+  (save-excursion
+    (goto-char point)
+    (elt
+     (kbd (buffer-substring
+           (point)
+           (progn
+             ;; Might be a space, in which case we want it.
+             (if (zerop (skip-chars-forward "^ "))
+                 (1+ (point))
+               (point)))))
+     0)))
+
 (defun print-fontset-element (val)
   ;; VAL has this format:
   ;;  ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...)
   ;; CHAR RANGE is already inserted.  Get character codes from
   ;; the current line.
   (beginning-of-line)
-  (let ((from (following-char))
+  (let ((from (mule--kbd-at (point)))
        (to (if (looking-at "[^.]*[.]* ")
-               (char-after (match-end 0)))))
+               (mule--kbd-at (match-end 0)))))
     (if (re-search-forward "[ \t]*$" nil t)
        (delete-region (match-beginning 0) (match-end 0)))