unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jorge P. de Morais Neto <jorge+list@disroot.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 42248@debbugs.gnu.org, stefan@marxist.se
Subject: bug#42248: 27.0.91; With enchant-2.2.8 from Guix, Flyspell errors out or gives lots of false positives
Date: Sun, 30 Aug 2020 15:51:42 -0300	[thread overview]
Message-ID: <875z90ezlt.fsf@disroot.org> (raw)
In-Reply-To: <83y2m45clu.fsf@gnu.org>

Em [2020-08-24 seg 17:42:53+0300], Eli Zaretskii escreveu:
> Maybe the dictionary you are using doesn't support the apostrophe?

Yes, with your help, I found out that Debian's hunspell-en-us package is
missing the apostrophe in WORDCHARS value in
`/usr/share/hunspell/en_US.aff'.  I have worked around the problem by:
1. Create `~/.config/enchant/hunspell' directory and `cd' to it
2. Symlink `/usr/share/hunspell/en_US.dic' to `./en_US.dic'
3. Copy `/usr/share/hunspell/en_US.aff' to `./en_US.aff'
4. Edit `./en_US.aff' and fix WORDCHARS.

This solves the Emacs contraction problem and doesn't seem to harm other
enchant consumers like LibreOffice and Gedit.  I think I should report
this to the dictionary developers.  And where did you get your en_US
dictionary from?  The en_US hunspell dictionary is wrong both in Debian
buster and Guix.

And what should we do about ispell-dictionary-alist still including "-B"
among ISPELL-ARGS for many of its entries?  This causes an error if the
user chooses one of those dictionaries, such as "american".

> I don't think I understand the proposed changes -- can you tell in
> more detail why they are needed?

The revised patch:
--8<---------------cut here---------------start------------->8---
--- 27.1/ispell.el	2020-08-30 12:45:49.113459675 -0300
+++ lisp/ispell.el	2020-08-30 08:58:57.182813606 -0300
@@ -1237,11 +1237,12 @@
   "Find Enchant's dictionaries, and record in `ispell-enchant-dictionary-alist'."
   (let* ((dictionaries
 	  (split-string
-	   (ispell--call-enchant-lsmod "-list-dicts" (buffer-string)) " ([^)]+)\n"))
+	   (ispell--call-enchant-lsmod "-list-dicts")
+	   " ([^)]+)\n" t))
          (found
           (mapcar #'(lambda (lang)
                       `(,lang "[[:alpha:]]" "[^[:alpha:]]"
-                              ,(ispell--get-extra-word-characters) t nil nil utf-8))
+                              ,(ispell--get-extra-word-characters lang) t nil nil utf-8))
                   dictionaries)))
     ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist
     ;; which have no element in FOUND at all.
--8<---------------cut here---------------end--------------->8---

The patch removes the extraneous `(buffer-string)' argument to
`ispell--call-enchant-lsmod'.  That argument was passed as the final
argument to `enchant-lsmod-2', which is wrong.  The command we want to
invoke is only `enchant-lsmod-2 -list-dicts'---that is the command to
list Enchant dictionaries according to the enchant-lsmod-2 manpage.  And
it actually works in practice, unlike the former invocation which causes
an error.

The patch also passes t as the OMIT-NULLS argument of `split-string'.
This correctly avoids a final "" string in the return value of
`split-string', because the output of `enchant-lsmod-2 -list-dicts' ends
in a separator.

Finally, the patch passes `lang' to `ispell--get-extra-word-characters',
because the whole point of the invocation is to get the
extra word characters for the language under examination; the former
code always returned the extra word characters for the default language.

The current source code is visibly broken.  And in fact, without my
patch, when you invoke `emacs -q', evaluate (setq ispell-program-name
"enchant-2"), open the original ispell.el.gz, invoke M-x eval-buffer and
then M-x ispell-change-dictionary, you can see the error in the list of
languages.

On the other hand, when you invoke `emacs -q', evaluate
(setq ispell-program-name "enchant-2") and then
M-x ispell-change-dictionary, there is no error!  This makes me suspect
that, somehow, `ispell.elc' does not correspond to `ispell.el.gz'.  That
is a weird idea, but is the only explanation I can think of.  This
occurs on the emacs-27 branch, commit 29708cbde7.

Best regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Free Software Supporter: <https://www.fsf.org/free-software-supporter>
- If an email of mine arrives at your spam box, please notify me.





  reply	other threads:[~2020-08-30 18:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 16:06 bug#42248: 27.0.91; With enchant-2.2.8 from Guix, Flyspell errors out or gives lots of false positives Jorge P. de Morais Neto
     [not found] ` <CADwFkm=7Pus_bMhUita=70qsRjfRiNN+oe-YnsCucpParnfPcA@mail.gmail.com>
2020-08-20  1:35   ` Jorge P. de Morais Neto
2020-08-20  1:56     ` Jorge P. de Morais Neto
2020-08-20 13:18     ` Eli Zaretskii
2020-08-20 15:36       ` Jorge P. de Morais Neto
2020-08-20 16:02         ` Eli Zaretskii
2020-08-20 17:49           ` Jorge P. de Morais Neto
2020-08-20 17:52             ` Jorge P. de Morais Neto
2020-08-20 18:26             ` Eli Zaretskii
2020-08-22 20:54               ` Jorge P. de Morais Neto
2020-08-27 17:30                 ` Stefan Kangas
2020-08-27 17:49                   ` Eli Zaretskii
2020-08-27 19:05                     ` Stefan Kangas
2020-08-27 19:13                       ` Eli Zaretskii
2020-08-27 19:13                       ` Eli Zaretskii
2020-08-24 14:30               ` Jorge P. de Morais Neto
2020-08-24 14:42                 ` Eli Zaretskii
2020-08-30 18:51                   ` Jorge P. de Morais Neto [this message]
2020-08-24 15:08                 ` Stefan Kangas
2020-08-27 17:30                 ` Stefan Kangas
2020-08-27 17:49                   ` Eli Zaretskii
2020-08-27 19:05                     ` Stefan Kangas
2020-08-27 19:14                       ` Eli Zaretskii
2020-09-06 23:53 ` bug#42248: Problems between Flyspell and Enchant Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-07 15:48   ` Eli Zaretskii
2020-09-07 20:07     ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-07 21:20       ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-26 13:02         ` bug#42248: 27.0.91; With enchant-2.2.8 from Guix, Flyspell errors out or gives lots of false positives Lars Ingebrigtsen
2020-09-07 21:10   ` bug#42248: Problems between Flyspell and Enchant Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875z90ezlt.fsf@disroot.org \
    --to=jorge+list@disroot.org \
    --cc=42248@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).