]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix dictionary name completion annotations
authorEshel Yaron <me@eshelyaron.com>
Sun, 3 Mar 2024 08:40:45 +0000 (09:40 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 3 Mar 2024 08:40:45 +0000 (09:40 +0100)
* 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

index f207894ae143aaf784d728a60ce75c4df368838f..f4c6ee56265248ebb50b7e26cfae145729e785b6 100644 (file)
@@ -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)