From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Reuben Thomas via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#52179: Highlighting a word in `ispell' using `enchant' Date: Tue, 24 May 2022 22:34:14 +0100 Message-ID: References: <83y1yq4ug1.fsf@gnu.org> <83v8tu4tac.fsf@gnu.org> Reply-To: Reuben Thomas Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000080c55605dfc8b843" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15908"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tor Kringeland , 52179@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 24 23:35:17 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntcBR-0003tj-86 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 May 2022 23:35:17 +0200 Original-Received: from localhost ([::1]:47050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntcBP-0002d4-QV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 May 2022 17:35:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntcBD-0002be-3n for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 17:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntcBC-0007xz-Op for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 17:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ntcBC-0002Yf-Lr for bug-gnu-emacs@gnu.org; Tue, 24 May 2022 17:35:02 -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, 24 May 2022 21:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52179 X-GNU-PR-Package: emacs Original-Received: via spool by 52179-submit@debbugs.gnu.org id=B52179.16534280749793 (code B ref 52179); Tue, 24 May 2022 21:35:02 +0000 Original-Received: (at 52179) by debbugs.gnu.org; 24 May 2022 21:34:34 +0000 Original-Received: from localhost ([127.0.0.1]:53721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntcAj-0002Xt-MA for submit@debbugs.gnu.org; Tue, 24 May 2022 17:34:34 -0400 Original-Received: from mail-pg1-f179.google.com ([209.85.215.179]:33300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntcAh-0002Xf-En for 52179@debbugs.gnu.org; Tue, 24 May 2022 17:34:32 -0400 Original-Received: by mail-pg1-f179.google.com with SMTP id r71so17373538pgr.0 for <52179@debbugs.gnu.org>; Tue, 24 May 2022 14:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vp1wFbjRya1R1SiZg5Y6MHupQxKuP/X5K4hpFPSp3iY=; b=jM6stenWNTky9ueBVMXN5M5B+2dwgtwNgP8kGWhwnfD9Mt1KOWLFAu5t66c5tvOeFG lDs97qANcHNgAUvebzb0qts6NJa5pq9VwdqdpQH5iHxhaBAS/Qm9ttxAW96LMQnTzV1H 69PxT+BP1u9BeYx+o2Kr0rVAwiT5vyrpoJQGc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vp1wFbjRya1R1SiZg5Y6MHupQxKuP/X5K4hpFPSp3iY=; b=fqAVLnOdf2XSlixyjeqhwTN+V0i9tw06a9nXjchpb0yITMnnV9HLbw5d/lrCnVvaKJ /yQVetOxVOoe6lIFO2dQkmEcCb14tRc+sG1uzwgxHnPLvwb0707cPL5d2klXaPOTAvwq k6MMIzZzk/KyTPCYZqhl/1YQnUagWsBIw/oV+g6e0pSXJhDFBilytD2EegOydP5cSDn+ 8kgClawS7htACx9Wi3OiUQmdHODGK4sUFdzvbqhHqOZXAhsba5Xm3hSYiIRFmLG8Jgbm 3J3c1SwmkSZcS/DevRxXlqnHBL+G5YnJUxCSHkwXOafqsa/YmXKJ9exchK1nZoj5Ux34 lrxw== X-Gm-Message-State: AOAM530HFOvlf/T9aotwWIfXAhjYY+1LOhTC977g6GvXOoLI+2Apb5C/ eSRKimQzIwSadSNGualz0v3KYg1kJ2OaughYFc/b3Q== X-Google-Smtp-Source: ABdhPJyepyO6XYj08bz7u+2GkJpvnEoFqQLbatGM2B7R7w1qLz2N49JBD7uzu3kQvr19YKC4Bq+gIZg55yoTTAwnVRg= X-Received: by 2002:a05:6a00:1307:b0:50d:b02e:11df with SMTP id j7-20020a056a00130700b0050db02e11dfmr30413163pfu.4.1653428065443; Tue, 24 May 2022 14:34:25 -0700 (PDT) In-Reply-To: <83v8tu4tac.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233031 Archived-At: --00000000000080c55605dfc8b843 Content-Type: text/plain; charset="UTF-8" On Tue, 24 May 2022 at 20:36, Eli Zaretskii wrote: > > From: Tor Kringeland > > CC: "52179@debbugs.gnu.org" <52179@debbugs.gnu.org> > > Date: Tue, 24 May 2022 19:27:58 +0000 > > > > Aspell works for me, but enchant doesn't. When I change > `ispell-program-name' to "aspell" ispell starts recognizing full words. > > > > Looking into the functions you mentioned, it seems like > `ispell-find-aspell-dictionaries' explicitly adds an entry for nil, while > `ispell-find-enchant-dictionaries' doesn't. This is what causes the bug for > me since I have set `ispell-dictionary' to nil/haven't changed it so the > resulting regex recognizing words is too strict for my use. > > Then maybe ispell-find-enchant-dictionaries should be improved? > > > Might there be a reason why `ispell-find-enchant-dictionaries' doesn't > set a nil entry? For sure I would think it could handle whatever input > aspell can. > > I don't know. CC'ing Reuben, who might know better. > I had a look at the code. I think what is happening is that the default dictionary in ispell-dictionary-base-alist uses only [A-Za-z] for word chars and [^A-Za-z] for non-word chars. The assumption is that this works for ispell (the program). Then, [[:alpha:]] and [^[:alpha:]] are used in the default 'nil'-keyed entry for aspell. As far as I can tell from the rather hairy hunspell code, it too does not set a default entry. Since ispell is the only spellchecker Emacs supports that can't cope with [[:alpha:]], it would seem more sensible to have a default (nil-keyed) setting in ispell-dictionary-base-alist, and to overwrite the default with [A-Za-z] only if the spellchecker is really ispell. This way, duplicate code can be removed and future spellcheckers will not need to rediscover this problem. (I never came across this problem because I have customized ispell-local-dictionary-alist with my own nil entry!) -- https://rrt.sc3d.org --00000000000080c55605dfc8b843 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 24 May 2022 at= 20:36, Eli Zaretskii <eliz@gnu.org&= gt; wrote:
> From: Tor Kringeland <tor.kringeland@ntnu.no> > CC: "5= 2179@debbugs.gnu.org" <52179@debbugs.gnu.org>
> Date: Tue, 24 May 2022 19:27:58 +0000
>
> Aspell works for me, but enchant doesn't. When I change `ispell-pr= ogram-name' to "aspell" ispell starts recognizing full words.=
>
> Looking into the functions you mentioned, it seems like `ispell-find-a= spell-dictionaries' explicitly adds an entry for nil, while `ispell-fin= d-enchant-dictionaries' doesn't. This is what causes the bug for me= since I have set `ispell-dictionary' to nil/haven't changed it so = the resulting regex recognizing words is too strict for my use.

Then maybe ispell-find-enchant-dictionaries should be improved?

> Might there be a reason why `ispell-find-enchant-dictionaries' doe= sn't set a nil entry? For sure I would think it could handle whatever i= nput aspell can.

I don't know.=C2=A0 CC'ing Reuben, who might know better.

I had a look a= t the code. I think what is happening is that the default dictionary in isp= ell-dictionary-base-alist uses only [A-Za-z] for word chars and [^A-Za-z] f= or non-word chars. The assumption is that this works for ispell (the progra= m). Then, [[:alpha:]] and [^[:alpha:]] are used in the default 'nil'= ;-keyed entry for aspell. As far as I can tell from the rather hairy hunspe= ll code, it too does not set a default entry.

<= /div>
Since ispell is the only spellchecker Emacs support= s that can't cope with [[:alpha:]], it would seem more sensible to have= a default (nil-keyed) setting in ispell-dictionary-base-alist, and to over= write the default with [A-Za-z] only if the spellchecker is really ispell.<= /div>

This way, duplicate co= de can be removed and future spellcheckers will not need to rediscover this= problem.

(I never cam= e across this problem because I have customized ispell-local-dictionary-ali= st with my own nil entry!)

--
--00000000000080c55605dfc8b843--