summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2017-08-22 01:46:27 +0100
committerReuben Thomas <rrt@sc3d.org>2017-08-24 18:53:28 +0100
commitbd9ad2ea1051a73e30e720b90cf413ee93a977f7 (patch)
tree8546816a375a517987062c13c35cc7708036e45a /lisp/textmodes
parent22ebde63c9df6a6815359c1e3406baddec1ed55b (diff)
downloademacs-bd9ad2ea1051a73e30e720b90cf413ee93a977f7.tar.gz
Avoid using string-to-multibyte in ispell.el
* lisp/textmodes/ispell.el (ispell-get-decoded-string): Use decode-coding-string instead. Note that decode-coding-string returns a string that satisfies multibyte-string-p even if its input is pure ASCII and the third argument is t, so the result of ispell-get-decoded-string is always a multibyte string.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/ispell.el16
1 files changed, 3 insertions, 13 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index e67e603e990..87a3b7aaa12 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1485,25 +1485,15 @@ used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.")
"The name of the current personal dictionary, or nil for the default.
This is passed to the Ispell process using the `-p' switch.")
-(defun ispell-decode-string (str)
- "Decodes multibyte character strings."
- (decode-coding-string str (ispell-get-coding-system)))
-
;; Return a string decoded from Nth element of the current dictionary.
(defun ispell-get-decoded-string (n)
"Get the decoded string in slot N of the descriptor of the current dict."
(let* ((slot (or
(assoc ispell-current-dictionary ispell-local-dictionary-alist)
(assoc ispell-current-dictionary ispell-dictionary-alist)
- (error "No data for dictionary \"%s\", neither in `ispell-local-dictionary-alist' nor in `ispell-dictionary-alist'"
- ispell-current-dictionary)))
- (str (nth n slot)))
- (when (and (> (length str) 0)
- (not (multibyte-string-p str)))
- (setq str (ispell-decode-string str))
- (or (multibyte-string-p str)
- (setq str (string-to-multibyte str))))
- str))
+ (error "No data for dictionary \"%s\" in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'"
+ ispell-current-dictionary))))
+ (decode-coding-string (nth n slot) (ispell-get-coding-system) t)))
(defun ispell-get-casechars ()
(ispell-get-decoded-string 1))