[gedit-list] [Resolved:] Spell Checking in Claws Mail Using aspell [re: Missing spell checker in Claws Mail; enchant; CentOS 6.5; Claws actions]



Charles (earlier in this thread) presented a reasonable Claws Mail spell-checking solution -- my Claws installation lacks an integrated spell checker -- that got me thinking and experimenting. Here is my solution/summary.

SOLUTION: Spell Checking in Claws Mail Using aspell

Background: I work in a corporate environment, on a CentOS-based computer without root access, where it was claimed that Claws Mail could not be installed. After I requested some needed packages (dependencies), I managed to compile Claws mail myself in my home directory, and it works fine. However, despite enchant being installed earlier by Systems (our support staff), it never worked right; e.g., my ~/.config./enchant/en_us.dic is overwritten to 0 bytes whenever I log out; this issue was never resolved. Perhaps related, when I compiled Claws Mail in my $HOME directory using ./configure --prefix=$HOME/... it compiled Claws without spell checking support. I therefore also (re-installed) enchant, set the $PATH, etc., and recompiled Claws -- all to no avail - any of these issues.

Workaround:

1. Install (local user) GNU aspell (http://aspell.net/; see 'man aspell' for moreinformation).

2. Also need to install an aspell dictionary; my aspell dictionary is at ~/.aspell.en.pws; usage: aspell -c <file>

3. Enable a Claws Mail aspell-based spell check "action" (Configuration:Actions... menu):

Per the example provided at http://www.claws-mail.org/faq/index.php/Actions ...

Check spelling (Open a terminal and check the spelling with ispell):
|T=`mktemp $HOME/.sXXXXXX`; cat - > $T;xterm -e ispell $T;cat $T;rm $T|

... I modified this action to work with aspell (vs. ispell: not installed) and gnome-terminal (vs. xterm: not installed):

| T=`mktemp $HOME/.tmpXXX`; cat - > $T ; gnome-terminal --geometry 150x55+25+25 -x aspell -c $T; printf ' ' >> $T; cat $T; rm $T |

4. Set Claws Mail keyboard shortcut (Ctrl-L) for aspell action:

a. Configuration:Preferences:Other:Miscellaneous:Enable customizable keyboard shortcuts menu

b. Hover over the Tools:Actions:aspell menu item in both the Claws main program window and separately in the message composition window and type your shortcut (e.g., Ctrl-L)

Notes:

1. System environment, versions: Claws 3.10.1 on CentOS 6.5 Final 64-bit; aspell -v: @(#) International Ispell Version 3.1.20 (but really Aspell 0.60.6.1)

2. Claws Mail actions: http://www.claws-mail.org/faq/index.php/Actions

3. mktemp: see (e.g.) linux mktemp man page (http://linux.die.net/man/1/mktemp) and https://github.com/rtomayko/shocco/issues/5 (for " too few X's in template" error message)

4. cat - > : The '-' is important! Per the linux cat man page (provided example - annotated here):

cat f - g ## Output f’s contents, then standard input [i.e. the '-'], then g’s contents."

5. gnome-terminal --geometry 150x55+25+25 ## width x height + xpos + ypos; adjust per your preference (or simply omit the --geometry option)

6. Problem - a quirk? The last character is truncated (omitted) when the output is returned to Claws; it is not due to aspell (tested independently using the same text in a text file using aspell in the terminal); the input is fine up to that point, so it must be in the latter "cat $T;" or "|" parts of the action command. Workarounds:

a. Include a trailing space in your message, prior to running aspell.

b. Alternatively (per http://www.unix.com/shell-programming-and-scripting/128970-add-space-end-file.html), modify the action script as follows (also implemented above, in case this portion of these notes is deleted or not read): programmatically add a trailing space at the end of the $T temporary file that is returned to Claws Mail (printf ' ' >> $T;):

| T=`mktemp $HOME/.tmpXXX`; cat - > $T ; gnome-terminal --geometry 150x55+25+25 -x aspell -c $T; printf ' ' >> $T; cat $T; rm $T |

7. If there are no spelling errors, aspell will simply execute and terminate; i.e., it will appear that nothing has happened.

8. aspell, aspell dictionary installation notes (CentOS 6; abbreviated here):

a. Install aspell binary [http://aspell.net/]

./configure --prefix=$HOME/Linux/apps/aspell
make
make install
make clean

Set path (see: https://www.cs.purdue.edu/homes/cs348/unix_path.html):

echo 'export PATH=/home/vstuart/Linux/apps/aspell/:$PATH'

## Note! Appending $PATH at the end, rather than the beginning,
export PATH=$PATH:/..., directs the system to this binary, first!
The trailing /, before :$PATH, is important/needed!

To make this path permanent, add the following to your ~/.bashrc:

export PATH=/home/vstuart/Linux/apps/aspell/bin/:$PATH

b. Install aspell dictionary

./configure --help
Usage: ./configure [--help | --vars VAR1=VAL1 ...]
Note: Variables may also be set in the environment brefore running config
Useful vars: ASPELL ASPELL_PARMS PREZIP DESTDIR

In the following I guessed at the PREFIX= bit, but it seemed to work. I had to dig around for "prezip-bin" : it is here (in my aspell installation):

/home/vstuart/Linux/apps/aspell/bin/prezip-bin

So, the three steps are:

./configure --vars PREFIX=--prefix=$HOME/Linux/apps/aspell ASPELL=/home/vstuart/Linux/apps/aspell/bin/aspell
make
make install
make clean

9. Also added aspell binary path to ~/.bashrc:

alias aspell='echo " [~/Linux/apps/aspell/bin/aspell]" && /home/vstuart/Linux/apps/aspell/bin/aspell'

Q.E.D. :-)

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]