From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#28179: Fix use of string-to-multibyte in ispell.el Date: Tue, 22 Aug 2017 01:51:53 +0100 Organization: =?UTF-8?Q?SC=C2=B3D?= Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E075EB8D65C87906C458FB26" X-Trace: blaine.gmane.org 1503363190 27916 195.159.176.226 (22 Aug 2017 00:53:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 22 Aug 2017 00:53:10 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: 28179@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 22 02:53:04 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djxRG-0006vc-Th for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Aug 2017 02:53:03 +0200 Original-Received: from localhost ([::1]:45870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djxRN-0001z2-Gh for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Aug 2017 20:53:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djxRH-0001yQ-FD for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:53:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djxRG-0001ei-9m for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:53:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1djxRG-0001eT-5I for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1djxRF-0007vl-Tq for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Aug 2017 00:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28179 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.150336313030412 (code B ref -1); Tue, 22 Aug 2017 00:53:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Aug 2017 00:52:10 +0000 Original-Received: from localhost ([127.0.0.1]:48366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djxQP-0007uR-Nt for submit@debbugs.gnu.org; Mon, 21 Aug 2017 20:52:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36279) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djxQO-0007uF-F3 for submit@debbugs.gnu.org; Mon, 21 Aug 2017 20:52:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djxQI-0000Lw-7B for submit@debbugs.gnu.org; Mon, 21 Aug 2017 20:52:03 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48243) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1djxQI-0000Li-2p for submit@debbugs.gnu.org; Mon, 21 Aug 2017 20:52:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djxQG-0001gm-RT for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:52:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djxQF-0000Gg-RR for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:52:00 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djxQF-0000GW-NJ for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 20:51:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48082) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1djxQF-0006BV-FB for bug-emacs@gnu.org; Mon, 21 Aug 2017 20:51:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djxQE-0000Cn-CY for bug-emacs@gnu.org; Mon, 21 Aug 2017 20:51:59 -0400 Original-Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:36051) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1djxQE-00008b-29 for bug-emacs@gnu.org; Mon, 21 Aug 2017 20:51:58 -0400 Original-Received: by mail-wr0-x231.google.com with SMTP id f8so75882715wrf.3 for ; Mon, 21 Aug 2017 17:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=to:from:subject:organization:message-id:date:user-agent :mime-version:content-language; bh=Xs9XsuaY4O2ZSR009h6peti2wxg/ZUtSuEmRGYh448s=; b=taDX+8A8HilVx/hJAI2jgWIOuCh+jV6VnapX1PxHo12ZcKnfF0Vj563T/jfQyRi6o2 EpggSLQwGu1Q+KvkMSF0nIrBBIER2lk7oHx7CVxN3odrv3tbKt2YafSZSXWCM4gblBoL Vt/iH6ciJgtdTDdLwJiAio4FByyrAahyH+iGY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:organization:message-id:date :user-agent:mime-version:content-language; bh=Xs9XsuaY4O2ZSR009h6peti2wxg/ZUtSuEmRGYh448s=; b=I/Ln+BCIZketYNnSMxXNB7JP47lZVXEOWA9AgQTg7h9EwNUiY1yn87U3ZC9o1VKqFD p4j1JV1YkCuld9Kx6+KBIFRS8Fjsd3E4j+TgOinwZavoIBUQpuJj4s4Z1aj/brs4xwcZ 1rEW6tTWSs83cbiPBNAz9IG3ApjuqNOs/rBbC/O3ORBeWY+01J5tCQU2tH+tQ4LKjEQT pHFvWVKi1vLCxLr2bfoIyDFdV6LxZjsHSs35p62y6UYPxILQcLgYpRwNPl9BuWJVKpFO S8jLDBNa/f3vZZAo4zQnpr48uEzE6ZOSqIQHlVVJ3yIquwhWxBvx+Itd7Y3WFP3idYgR WQng== X-Gm-Message-State: AHYfb5gMGW76ZiaH/BDF/hk/AxsB0gx7oLbdvT1KpXkqxmf2z1Df+hsm 96dOzqHMClUVEoqp+TEIFw== X-Received: by 10.223.182.171 with SMTP id j43mr5989661wre.118.1503363116185; Mon, 21 Aug 2017 17:51:56 -0700 (PDT) Original-Received: from ?IPv6:2a02:c7d:51cb:c700:e890:1fc2:4566:9a1? ([2a02:c7d:51cb:c700:e890:1fc2:4566:9a1]) by smtp.gmail.com with ESMTPSA id q7sm5219183wrd.89.2017.08.21.17.51.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 17:51:54 -0700 (PDT) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136029 Archived-At: This is a multi-part message in MIME format. --------------E075EB8D65C87906C458FB26 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit The attached patch removes a use of string-to-multibyte in ispell.el. It turned out to be possible to simplify the surrounding code quite a bit too. -- https://rrt.sc3d.org --------------E075EB8D65C87906C458FB26 Content-Type: text/x-patch; name="0001-Avoid-using-string-to-multibyte-in-ispell.el.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Avoid-using-string-to-multibyte-in-ispell.el.patch" >From 077584030546f97c06d1f8c907475a04115e6c58 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 22 Aug 2017 01:46:27 +0100 Subject: [PATCH] Avoid using string-to-multibyte in ispell.el * lisp/textmodes/ispell.el (ispell-get-decoded-string): Use decode-coding-string instead. --- lisp/textmodes/ispell.el | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index e67e603..87a3b7a 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1485,25 +1485,15 @@ ispell-current-personal-dictionary "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)) -- 2.7.4 --------------E075EB8D65C87906C458FB26--