all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: 17742@debbugs.gnu.org
Subject: bug#17742: Acknowledgement (Support for enchant?)
Date: Mon, 5 Dec 2016 21:41:06 +0000	[thread overview]
Message-ID: <CAOnWdohVRFriqnEqCRsBaFRNLzpB66X9kPPBbjCJTT-FQVawUw@mail.gmail.com> (raw)
In-Reply-To: <handler.17742.B.140235850213377.ack@debbugs.gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 508 bytes --]

Attached, a patch to add initial enchant support.

This seems to work fine with one major limitation: at present there's no
dictionary auto-discovery, and as the built-in ispell-dictionary-alist is
all 8-bit encodings, while enchant is UTF-8, without some manual
configuration the dreaded "misalignment errors" occur.

I shall add dictionary listing support.

I have already added replace-for-session ("$$ra") to my enchant patch, so
enchant can use this functionality in ispell.el.

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 1126 bytes --]

[-- Attachment #2: 0023-Add-basic-Enchant-support-to-ispell.el.patch --]
[-- Type: text/x-patch, Size: 3600 bytes --]

From f3dce7c44241c0a17e6fb39f07a2cb32dc05a92a Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Sun, 4 Dec 2016 22:39:27 +0000
Subject: [PATCH 23/23] Add basic Enchant support to ispell.el
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/textmodes/ispell.el (ispell-program-name): Add “enchant”.
(ispell-really-enchant): Add variable.
(ispell-check-version): If using Enchant, check it’s new enough (at
least 1.6.1).  (Like the ispell check, this is absolute: cannot work
without.)
(ispell-send-replacement): Make it work with Enchant.
---
 lisp/textmodes/ispell.el | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6733c75..1b81a5d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -209,7 +209,8 @@ ispell-choices-win-default-height
   :group 'ispell)
 
 (defcustom ispell-program-name
-  (or (executable-find "aspell")
+  (or (executable-find "enchant")
+      (executable-find "aspell")
       (executable-find "ispell")
       (executable-find "hunspell")
       "ispell")
@@ -605,6 +606,8 @@ ispell-really-aspell
   "Non-nil if we can use Aspell extensions.")
 (defvar ispell-really-hunspell nil
   "Non-nil if we can use Hunspell extensions.")
+(defvar ispell-really-enchant nil
+  "Non-nil if we can use Enchant extensions.")
 (defvar ispell-encoding8-command nil
   "Command line option prefix to select encoding if supported, nil otherwise.
 If setting the encoding is supported by spellchecker and is selectable from
@@ -740,17 +743,29 @@ ispell-check-version
 		  (and (search-forward-regexp
 			"(but really Hunspell \\([0-9]+\\.[0-9\\.-]+\\)?)"
                         nil t)
+		       (match-string 1)))
+            (setq ispell-really-enchant
+		  (and (search-forward-regexp
+			"(but really Enchant \\([0-9]+\\.[0-9\\.-]+\\)?)"
+                        nil t)
 		       (match-string 1)))))
 
-      (let ((aspell-minver    "0.50")
-	    (aspell8-minver   "0.60")
-	    (ispell-minver    "3.1.12")
-	    (hunspell8-minver "1.1.6"))
-
-	(unless (version<= ispell-minver ispell-program-version)
-	  (error "%s release %s or greater is required"
+      (let* ((aspell-minver    "0.50")
+             (aspell8-minver   "0.60")
+             (ispell-minver    "3.1.12")
+             (hunspell8-minver "1.1.6")
+             (enchant-minver   "1.6.1")
+             (minver (cond
+                      ((not (version<= ispell-minver ispell-program-version))
+                       ispell-minver)
+                      ((and ispell-really-enchant
+                            (not (version<= enchant-minver ispell-really-enchant)))
+                       enchant-minver))))
+
+        (if minver
+	    (error "%s release %s or greater is required"
 		 ispell-program-name
-		 ispell-minver))
+		 minver))
 
 	(cond
 	 (ispell-really-aspell
@@ -1735,9 +1750,10 @@ ispell-accept-output
 	    (erase-buffer)))))))
 
 (defun ispell-send-replacement (misspelled replacement)
-  "Notify Aspell that MISSPELLED should be spelled REPLACEMENT.
-This allows improving the suggestion list based on actual misspellings."
-  (and ispell-really-aspell
+  "Notify spell checker that MISSPELLED should be spelled REPLACEMENT.
+This allows improving the suggestion list based on actual misspellings.
+Only works for Aspell and Enchant."
+  (and (or ispell-really-aspell ispell-really-enchant)
        (ispell-send-string (concat "$$ra " misspelled "," replacement "\n"))))
 
 
-- 
2.7.4


  parent reply	other threads:[~2016-12-05 21:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  0:01 bug#17742: Support for enchant? Reuben Thomas
2014-09-15 11:06 ` bug#17742: Limitations of enchant Reuben Thomas
2016-12-02  0:15   ` Reuben Thomas
     [not found] ` <handler.17742.B.140235850213377.ack@debbugs.gnu.org>
2016-12-05 21:41   ` Reuben Thomas [this message]
2016-12-06 15:55     ` bug#17742: Acknowledgement (Support for enchant?) Eli Zaretskii
2016-12-06 15:56       ` Reuben Thomas
2016-12-13  0:53         ` Reuben Thomas
2016-12-13 16:37           ` Eli Zaretskii
2016-12-13 18:26             ` Reuben Thomas
2016-12-13 18:54               ` Eli Zaretskii
2016-12-13 21:17                 ` Reuben Thomas
2016-12-13 21:30                   ` Reuben Thomas
2016-12-14 15:42                   ` Eli Zaretskii
2016-12-15 12:36                     ` Reuben Thomas
2016-12-18 23:39                 ` Reuben Thomas
2016-12-19  1:02                   ` Reuben Thomas
2016-12-19 12:41                     ` Reuben Thomas
2016-12-19 16:01                   ` Eli Zaretskii
2016-12-19 17:37                     ` Agustin Martin
2016-12-19 18:09                       ` Eli Zaretskii
2016-12-19 21:21                         ` Reuben Thomas
2016-12-19 21:27                       ` Reuben Thomas
2016-12-20 15:38                         ` Eli Zaretskii
2016-12-19 21:47                     ` Reuben Thomas
2016-12-19 22:04                       ` Reuben Thomas
2016-12-20 15:40                         ` Eli Zaretskii
2016-12-20 15:40                       ` Eli Zaretskii
2016-12-20 21:43                         ` Reuben Thomas
2016-12-21 17:13                           ` Eli Zaretskii
2016-12-21 17:32                             ` Reuben Thomas
2017-08-09 11:35                               ` Reuben Thomas
2017-08-18  8:54                                 ` Eli Zaretskii
2017-08-20 13:02                                   ` Reuben Thomas
2017-08-20 14:42                                     ` Eli Zaretskii
2017-08-20 14:50                                       ` Reuben Thomas
2017-08-20 19:34                                         ` Eli Zaretskii
2017-08-20 20:36                                           ` Reuben Thomas
2017-08-20 14:50 ` bug#17742: Reuben Thomas

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

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

  git send-email \
    --in-reply-to=CAOnWdohVRFriqnEqCRsBaFRNLzpB66X9kPPBbjCJTT-FQVawUw@mail.gmail.com \
    --to=rrt@sc3d.org \
    --cc=17742@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.