From dc2b79a184971658809472848f1aced089d42da5 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 3 Mar 2024 09:40:45 +0100 Subject: [PATCH] ; Fix dictionary name completion annotations * lisp/net/dictionary.el (dictionary-dictionaries): Decode server response as UTF-8. (dictionary-completing-read-dictionary): Use 'string-width' to calculate string width. --- lisp/net/dictionary.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index f207894ae14..f4c6ee56265 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1530,9 +1530,9 @@ Further arguments are currently ignored." (defun dictionary-dictionaries () "Return the list of dictionaries the server supports." (dictionary-send-command "show db") - (when (and (= (read (dictionary-read-reply)) 110)) + (when (= (read (dictionary-read-reply)) 110) (with-temp-buffer - (insert (dictionary-read-answer)) + (insert (decode-coding-string (dictionary-read-answer) 'utf-8)) (goto-char (point-min)) (let ((result '(("!" . "First matching dictionary") ("*" . "All dictionaries")))) @@ -1547,7 +1547,7 @@ Further arguments are currently ignored." (defun dictionary-completing-read-dictionary () "Prompt for a dictionary the server supports." (let* ((dicts (dictionary-dictionaries)) - (len (apply #'max (mapcar #'length (mapcar #'car dicts)))) + (len (apply #'max (mapcar #'string-width (mapcar #'car dicts)))) (completion-extra-properties (list :annotation-function (lambda (key) -- 2.39.5