2009-08-03

emacs spell checker pain

Sam,

load-path is not relevant. The relevant vars discussed is exec-path and the PATH env var.

exec-path in emacs is the var that tells emacs which paths to search to locate external programs.

The PATH env var serves similar function in the OS's shell. It must be set correctly.

But also, emacs also needs to use the OS's PATH env var, and must inherited it correctly, as emacs does not always inherit it correctly due to various complications such as where or how you launched emacs, OS differences, etc.

Emacs's load-path is a set of paths for emacs to locate elisp files. It is irrevalent here.

i gave code in previous message on how you set exec-path and PATH.

you gotta pay attention to details here if you want to use emacs.

PS but note to emacs developers, it'd be really good to god damn include the essential unix utils as used by emacs. Their executable are tiny by today's standards, and saves huge amount of headache. In particular, spell checking is essential to emacs. On linuxes, all's peach n cream. But unfortunately, linux is used by minority however you count it. On OS X, it's also a pain with spell checking, as there are lots questions about getting it to work or how to use OS X's bundled spell checker that's far superior, yet nigh impossible to get emacs to use. On Windows, getting spell checking to work is a pain in the ass. Not possible unless you have fair degree of sys admin expertise and some emacs know how about all the path vars and mechanisms, AND, have the time to tech geek for fucking hours to get it to work (installing cygwin, dig into cygwin's interactions with OS, sundries minor compatibility issues, researching MinWGW and alternative unix binaries for Windows, dig into online forums ... ). Spell checking works out of the box on any commercial editor today.

Xah
∑ http://xahlee.org/



ok, first make sure the PATH env var in your Windows is setup correctly.

some tips here

• Using PowerShell to Manage Environment Variables
http://xahlee.org/powershell/environment_variables.html

then, restart your cmd.exe (by just closing it).
After restart, type

echo %PATH%

e.g. on my machine shows:

C:\Users\xah>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\hp\bin\Python;c:\Prog
ram Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Quic
kTime\QTSystem\;C:\Windows\system32\WindowsPowerShell\v1.0\

Once you got this, then type aspell from any dir and see it works.
You need to get this step fixed.

Once good, launch emacs, then in emacs, type Alt+x shell or Alt+x cmd-shell (the latter is in emacsW32, not sure if it is in other emacs on Windows)

then type
echo %PATH%

the output should match the same as in your cmd.exe. If not, try the set paths elisp code:

(when (string-equal system-type "windows-nt")
(progn
(setenv "PATH" "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem")
(setq exec-path
'(
"C:/Program Files (x86)/Emacs/emacs/bin/"
"C:/Windows/system32/"
"C:/Windows/"
"C:/Windows/System32/Wbem/"
"C:/Windows/system32/WindowsPowerShell/v1.0/"
"C:/cygwin/bin/"
)
)
)
)

mod the path for your machine and put it in your emacs init file.
Select the code, then type Alt+x eval-region.

Now, close your shell buffer. Start it again. Try
echo %PATH%

again.
If good, type aspell while in emacs's cmd shell. It should run. If so, hten you should be have spell checking in emacs now.

--------

on my machine, i have the above in my init file, but often the env var PATH shown in emacs is still different from OS's PATH value. This causes running SOME of the unix commands to fail. I haven't investigated why yet, but i workaround by eval that code again in emacs whenever that happens ....

nor do i know what exactly is the diff between exec-path and setenv with PATH...

Xah
∑ http://xahlee.org/

No comments:

Post a Comment