[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/spell-fu ddad489f2c 43/86: Adds affix dict support via asp
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/spell-fu ddad489f2c 43/86: Adds affix dict support via aspell expand cmd |
Date: |
Thu, 7 Jul 2022 12:03:42 -0400 (EDT) |
branch: elpa/spell-fu
commit ddad489f2c87467480520502a93e682f81bfac18
Author: Hanno Perrey <hanno@hoowl.se>
Commit: Campbell Barton <ideasman42@gmail.com>
Adds affix dict support via aspell expand cmd
aspell supports dictionaries with affixes which determine the
grammatically valid expansions for each word. Affixes are separated from
the individual word via a forward slash. If such slash is found, the
word list has to be expanded. This is done via piping the word list
through aspell' 'expand' command with the language of the dictionary
given as parameter (if not set to "default").
---
changelog.rst | 5 +++--
readme.rst | 1 -
spell-fu.el | 26 ++++++++++++++++++++++++--
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/changelog.rst b/changelog.rst
index 2e61a47fea..c1822d03db 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -3,9 +3,10 @@
Change Log
##########
-- In development
+- Version 0.3 (2021-03-28)
- - <none>
+ - Support affix expansion when calling ``aspell`` (some non English
dictionaries use this).
+ - Use explicit ``utf-8`` encoding, (fixes issue #8).
- Version 0.2 (2020-04-26)
diff --git a/readme.rst b/readme.rst
index 286f7022ce..ec1a7adf10 100644
--- a/readme.rst
+++ b/readme.rst
@@ -189,6 +189,5 @@ TODO
- Support alternates to ``aspell`` for generating word lists.
- Support a custom command for generating a word list.
-- Support affix expansion when calling aspell (some non English dictionaries
use this).
- Support refreshing the word list at run-time when ispell updates the
personal dictionary
*(currently updates require re-enabling the mode).*
diff --git a/spell-fu.el b/spell-fu.el
index 0afc332e30..e52da2a361 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -6,7 +6,7 @@
;; URL: https://gitlab.com/ideasman42/emacs-spell-fu
;; Keywords: convenience
-;; Version: 0.2
+;; Version: 0.3
;; Package-Requires: ((emacs "26.2"))
;; This program is free software; you can redistribute it and/or modify
@@ -354,7 +354,29 @@ Argument WORDS-FILE the file to write the word list into."
((string-equal dict "default")
(call-process aspell-bin nil t nil "dump" "master"))
(t
- (call-process aspell-bin nil t nil "-d" dict "dump"
"master"))))
+ (call-process aspell-bin nil t nil "-d" dict "dump"
"master")))
+
+ ;; Check whether the dictionary has affixes, expand if necessary.
+ (when (re-search-backward "^[[:alpha:]]*/[[:alnum:]]*$" nil t)
+ (let ((lang (spell-fu--aspell-lang-from-dict dict)))
+ (unless
+ (zerop
+ (shell-command-on-region
+ (point-min) (point-max)
+ (if lang
+ (format "%s -l %s expand" aspell-bin lang)
+ (format "%s expand" aspell-bin))
+ t t
+ ;; Output any errors into the message buffer instead
of the word-list.
+ "*spell-fu word generation errors*"))
+ (message
+ (format
+ "spell-fu: affix extension for dictionary '%s' failed
(with language: %S)."
+ dict
+ lang)))
+ (goto-char (point-min))
+ (while (search-forward " " nil t)
+ (replace-match "\n")))))
(setq word-list (spell-fu--buffer-as-line-list (current-buffer)
word-list)))
- [nongnu] elpa/spell-fu 907271a557 03/86: Cleanup: unnecessary 'let' nesting, (continued)
- [nongnu] elpa/spell-fu 907271a557 03/86: Cleanup: unnecessary 'let' nesting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 3898e6f591 04/86: Cleanup: remove use of exception handling, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu ae4504f14d 07/86: Fix using hard coded en_US dictionary, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu f2b7d58e87 08/86: Cleanup: correct comment, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 1e6928f77d 05/86: Cleanup: add message for generating cache, some comments, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu bd76cb262e 15/86: Avoid 2x loops over the pending screen overlays, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 4f9732492c 01/86: Initial code., ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 6a7440044e 19/86: Cleanup: rename variables to make the assignment explicit, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 5915e0ae2a 24/86: Cleanup: use safer sharp-quoted function names, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 3f4fc34204 32/86: Add 'spell-fu-buffer' utility, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu ddad489f2c 43/86: Adds affix dict support via aspell expand cmd,
ELPA Syncer <=
- [nongnu] elpa/spell-fu ce64f4bc4d 51/86: Cleanup: remove arguments that are always fixed, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 1b765f8029 58/86: Cleanup: replace setq with let binding, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 1159eeec13 63/86: Fix including trailing single-quote in the word, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 32fcbd9e8e 68/86: Initial changes for multiple dictionaries, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 1f3e5b8f05 72/86: readme: Fix typos, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 2f2fd6de00 83/86: Change URL to codeberg, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 00b75e5741 25/86: Cleanup: docstring, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 1bc18879b6 27/86: Add license file, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu d0700095ea 28/86: Add header to cache loading & error checking for cache content, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu f6c849f860 30/86: Fix disabling spell-fu when used without a timer, ELPA Syncer, 2022/07/07