Fix for emacs bug #13460, ispell-change dictionary hunspell issue (#903151)

This commit is contained in:
Jochen Schmitt 2013-01-21 19:17:39 +01:00
parent fccdf0aac0
commit 46aabb9ddb
3 changed files with 113 additions and 3 deletions

102
emacs-24.2-hunspell.patch Normal file
View File

@ -0,0 +1,102 @@
diff -up emacs-24.2/lisp/textmodes/ispell.el.hunspell emacs-24.2/lisp/textmodes/ispell.el
--- emacs-24.2/lisp/textmodes/ispell.el.hunspell 2013-01-21 18:45:01.743335126 +0100
+++ emacs-24.2/lisp/textmodes/ispell.el 2013-01-21 18:51:02.082010837 +0100
@@ -572,6 +572,40 @@ re-start Emacs."
(coding-system :tag "Coding System")))
:group 'ispell)
+(defvar ispell-hunspell-dictionary-equivs-alist
+ '(("american" "en_US")
+ ("brasileiro" "pt_BR")
+ ("british" "en_GB")
+ ("castellano" "es_ES")
+ ("castellano8" "es_ES")
+ ("czech" "cs_CZ")
+ ("dansk" "da_DK")
+ ("deutsch" "de_DE")
+ ("deutsch8" "de_DE")
+ ("english" "en_US")
+ ("esperanto" "eo")
+ ("esperanto-tex" "eo")
+ ("finnish" "fi_FI")
+ ("francais7" "fr_FR")
+ ("francais" "fr_FR")
+ ("francais-tex" "fr_FR")
+ ("german" "de_DE")
+ ("german8" "de_DE")
+ ("italiano" "it_IT")
+ ("nederlands" "nl_NL")
+ ("nederlands8" "nl_NL")
+ ("norsk" "nn_NO")
+ ("norsk7-tex" "nn_NO")
+ ("polish" "pl_PL")
+ ("portugues" "pt_PT")
+ ("russian" "ru_RU")
+ ("russianw" "ru_RU")
+ ("slovak" "sk_SK")
+ ("slovenian" "sl_SI")
+ ("svenska" "sv_SE")
+ ("hebrew" "he_IL"))
+ "Alist with matching hunspell dict names for standard dict names in
+ `ispell-dictionary-base-alist'.")
(defvar ispell-dictionary-base-alist
'((nil
@@ -1106,9 +1140,57 @@ aspell is used along with Emacs).")
ispell-encoding8-command)
ispell-aspell-dictionary-alist
nil))
+ (ispell-dictionary-base-alist ispell-dictionary-base-alist)
ispell-base-dicts-override-alist ; Override only base-dicts-alist
all-dicts-alist)
+ ;; While ispell and aspell (through aliases) use the traditional
+ ;; dict naming originally expected by ispell.el, hunspell
+ ;; uses locale based names with no alias. We need to map
+ ;; standard names to locale based names to make default dict
+ ;; definitions available for hunspell.
+ (if ispell-really-hunspell
+ (let (tmp-dicts-alist)
+ (dolist (adict ispell-dictionary-base-alist)
+ (let* ((dict-name (nth 0 adict))
+ (dict-equiv
+ (cadr (assoc dict-name
+ ispell-hunspell-dictionary-equivs-alist)))
+ (ispell-args (nth 5 adict))
+ (ispell-args-has-d (member "-d" ispell-args))
+ skip-dict)
+ ;; Remove "-d" option from `ispell-args' if present
+ (if ispell-args-has-d
+ (let ((ispell-args-after-d
+ (cdr (cdr ispell-args-has-d)))
+ (ispell-args-before-d
+ (butlast ispell-args (length ispell-args-has-d))))
+ (setq ispell-args
+ (nconc ispell-args-before-d
+ ispell-args-after-d))))
+ ;; Unless default dict, re-add "-d" option with the mapped value
+ (if dict-name
+ (if dict-equiv
+ (nconc ispell-args (list "-d" dict-equiv))
+ (message
+ "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping."
+ dict-name)
+ (setq skip-dict t)))
+
+ (unless skip-dict
+ (add-to-list 'tmp-dicts-alist
+ (list
+ dict-name ; dict name
+ (nth 1 adict) ; casechars
+ (nth 2 adict) ; not-casechars
+ (nth 3 adict) ; otherchars
+ (nth 4 adict) ; many-otherchars-p
+ ispell-args ; ispell-args
+ (nth 6 adict) ; extended-character-mode
+ (nth 7 adict) ; dict encoding
+ ))))
+ (setq ispell-dictionary-base-alist tmp-dicts-alist))))
+
(run-hooks 'ispell-initialize-spellchecker-hook)
;; Add dicts to ``ispell-dictionary-alist'' unless already present.

View File

@ -1,4 +1,4 @@
diff -up emacs-23.3/lisp/textmodes/ispell.el.spellcheck emacs-23.3/lisp/textmodes/ispell.el qdiff -up emacs-23.3/lisp/textmodes/ispell.el.spellcheck emacs-23.3/lisp/textmodes/ispell.el
--- emacs-23.3/lisp/textmodes/ispell.el.spellcheck 2011-11-16 10:54:57.363513864 +0100 --- emacs-23.3/lisp/textmodes/ispell.el.spellcheck 2011-11-16 10:54:57.363513864 +0100
+++ emacs-23.3/lisp/textmodes/ispell.el 2011-11-16 10:55:17.209577635 +0100 +++ emacs-23.3/lisp/textmodes/ispell.el 2011-11-16 10:55:17.209577635 +0100
@@ -348,9 +348,9 @@ Must be greater than 1." @@ -348,9 +348,9 @@ Must be greater than 1."

View File

@ -3,7 +3,7 @@ Summary: GNU Emacs text editor
Name: emacs Name: emacs
Epoch: 1 Epoch: 1
Version: 24.2 Version: 24.2
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/emacs/ URL: http://www.gnu.org/software/emacs/
Group: Applications/Editors Group: Applications/Editors
@ -26,8 +26,10 @@ Patch3: rpm-spec-mode-changelog.patch
Patch7: emacs-spellchecker.patch Patch7: emacs-spellchecker.patch
# rhbz#830162, fixed in org-mode upstream # rhbz#830162, fixed in org-mode upstream
Patch8: emacs-locate-library.patch Patch8: emacs-locate-library.patch
# Fix for Emacs bug #11580. # Fix for Emacs bug #111500.
Patch9: emacs-bz11580-eudc-bbdb.patch Patch9: emacs-bz11580-eudc-bbdb.patch
# Fix for emacs bug #13460.
Patch100: emacs-24.2-hunspell.patch
BuildRequires: atk-devel cairo-devel freetype-devel fontconfig-devel dbus-devel giflib-devel glibc-devel libpng-devel BuildRequires: atk-devel cairo-devel freetype-devel fontconfig-devel dbus-devel giflib-devel glibc-devel libpng-devel
BuildRequires: libjpeg-devel libtiff-devel libX11-devel libXau-devel libXdmcp-devel libXrender-devel libXt-devel BuildRequires: libjpeg-devel libtiff-devel libX11-devel libXau-devel libXdmcp-devel libXrender-devel libXt-devel
@ -166,6 +168,8 @@ pushd site-lisp
%patch3 -p0 %patch3 -p0
popd popd
%patch100 -p1 -b .hunspell
# We prefer our emacs.desktop file # We prefer our emacs.desktop file
cp %SOURCE1 etc/emacs.desktop cp %SOURCE1 etc/emacs.desktop
@ -201,6 +205,7 @@ ln -s ../../%{name}/%{version}/etc/NEWS doc
%build %build
# Remove unpatched files as all files in the lisp directory are # Remove unpatched files as all files in the lisp directory are
# installed. # installed.
rm lisp/textmodes/ispell.el.hunspell
rm lisp/textmodes/ispell.el.spellchecker rm lisp/textmodes/ispell.el.spellchecker
export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS" export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS"
@ -446,6 +451,9 @@ update-desktop-database &> /dev/null || :
%dir %{_datadir}/emacs/site-lisp/site-start.d %dir %{_datadir}/emacs/site-lisp/site-start.d
%changelog %changelog
* Mon Jan 21 2013 Jochen Schmitt <Jochen herr-schmitt de> - 1:24.2-6
- Fix for emacs bug #13460, ispell-change dictionary hunspell issue (#903151)
* Tue Nov 06 2012 Sergio Durigan Junior <sergiodj@riseup.net> - 1:24.2-5 * Tue Nov 06 2012 Sergio Durigan Junior <sergiodj@riseup.net> - 1:24.2-5
- Fix for Emacs bug #11580, 'Fix querying BBDB for entries without a last - Fix for Emacs bug #11580, 'Fix querying BBDB for entries without a last
name'. name'.