https://bugzilla.redhat.com/show_bug.cgi?id=915448
Giuseppe Castagna <gc(a)pps.univ-paris-diderot.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gc(a)pps.univ-paris-diderot.f
| |r
--- Comment #10 from Giuseppe Castagna <gc(a)pps.univ-paris-diderot.fr> ---
The bug is still in the rawhide version (normal, last update was in October
2013).
As suggested Petr Hracek it suffices to apply a very simple patch: it takes 5
minutes and it works like a charm.
For those that are desperate to wait and want to use emacs for languages other
than English here you are how to do it.
1. download the hunspell src.rpm, for instance (or the version you find there)
http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/source/S...
2. install it as root
rpm -ivh hunspell-1.3.2-15.fc21.src.rpm
3. save the following text in the file
/root/rpmbuild/SOURCES/hunspell.emacs.patch
--- src/tools/hunspell.cxx~0 2011-01-21 19:01:29.000000000 +0200
+++ src/tools/hunspell.cxx 2013-02-07 10:11:54.443610900 +0200
@@ -710,13 +748,22 @@ if (pos >= 0) {
fflush(stdout);
} else {
char ** wlst = NULL;
- int ns = pMS[d]->suggest(&wlst, token);
+ int byte_offset = parser->get_tokenpos() + pos;
+ int char_offset = 0;
+ if (strcmp(io_enc, "UTF-8") == 0) {
+ for (int i = 0; i < byte_offset; i++) {
+ if ((buf[i] & 0xc0) != 0x80)
+ char_offset++;
+ }
+ } else {
+ char_offset = byte_offset;
+ }
+ int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
if (ns == 0) {
- fprintf(stdout,"# %s %d", token,
- parser->get_tokenpos() + pos);
+ fprintf(stdout,"# %s %d", token, char_offset);
} else {
fprintf(stdout,"& %s %d %d: ", token, ns,
- parser->get_tokenpos() + pos);
+ char_offset);
fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], io_enc));
}
for (int j = 1; j < ns; j++) {
@@ -745,13 +792,23 @@ if (pos >= 0) {
if (root) free(root);
} else {
char ** wlst = NULL;
+ int byte_offset = parser->get_tokenpos() + pos;
+ int char_offset = 0;
+ if (strcmp(io_enc, "UTF-8") == 0) {
+ for (int i = 0; i < byte_offset; i++) {
+ if ((buf[i] & 0xc0) != 0x80)
+ char_offset++;
+ }
+ } else {
+ char_offset = byte_offset;
+ }
int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
if (ns == 0) {
fprintf(stdout,"# %s %d", chenc(token, io_enc, ui_enc),
- parser->get_tokenpos() + pos);
+ char_offset);
} else {
fprintf(stdout,"& %s %d %d: ", chenc(token, io_enc,
ui_enc),
ns,
- parser->get_tokenpos() + pos);
+ char_offset);
fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], ui_enc));
}
for (int j = 1; j < ns; j++) {
4. edit the file /root/rpmbuild/SPECS/hunspell.spec
- Add on line 25
Patch5: hunspell.emacs.patch
- Add on line 48
%patch5 -p0 -b .emacs
5. rebuild the rpm files
rpmbuild -ba SPECS/hunspell.spec
6. Install the rpm files you now have in /root/rpmbuild/RPMS/<arch>
Enjoy!
--
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug
https://bugzilla.redhat.com/token.cgi?t=SofN6MNc7S&a=cc_unsubscribe