[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Starting ispell in some fixed directory
From: |
Slawomir Nowaczyk |
Subject: |
Re: Starting ispell in some fixed directory |
Date: |
Fri, 06 Oct 2006 00:33:35 +0200 |
On Thu, 05 Oct 2006 15:00:47 -0700 (PDT)
"Stuart D. Herring" <address@hidden> wrote:
#> > #> We could, alternatively, use the directory from which emacs.exe
#> > #> is running, but I do not know how to get it.
#> > #> (with-current-buffer "*scratch*" default-directory) would be
#> > #> good enough for me, but I believe it is even less likely to work
#> > #> reliably.
#>
#> You can use the variable `invocation-directory'
That's nice :) Seems to be better than temporary-file-directory. Just in
case, I have included an updated patch at the end of this email.
#> but I suppose it's possible for that not to be known in some cases.
Any idea when could it happen? The doc says "[...]The value is nil if
that directory's name is not known.", so I suppose it *is* possible, but
it might be interesting to know when? If I read the code correctly, it
gets its value from argv[0], so it should always be set on w32. Right?
#> Why not just use "/" if it exists, or else continue to call
#> `directory-file-name' and `file-name-directory' repeatedly until the
#> result doesn't change? Namely,
#>
#> (let ((default-directory default-directory))
#> (while (not (equal default-directory
#> (setq default-directory
#> (file-name-directory
#> (directory-file-name default-directory)))))
#> ...)
Well, I suppose that would work in all practical cases, but I think it's
too complex for the problem at hand... Besides, at least in principle,
the root of a current drive might still not be the best place to run
ispell from (just in case it turns out to be a removable drive and we
lock it unnecessarily).
#> I can't see how this would ever fail; on Unix-like systems,
There is no problem on Unix-like systems, as those systems allow you to
rename/move/remove/whatever a directory even if you run ispell from it,
so it's OK to make it so. Only Windows is problematic.
#> you have to have access to all parents of a directory to be in it
#> anyway, and on all systems (I believe) there are fixed points. If
#> this turns out to be useful, an obvious `file-system-root' function
#> could be created to put the while loop in one place.
*If* somebody else finds file-system-root function to be useful, then it
might make sense to use it in ispell.el -- but otherwise I think it is
an overkill. YMMV, of course.
**************************************************
--- /EmacsCVS/lisp/textmodes/ispell.el 2006-09-26 20:28:23.092467200 +0200
+++ /Emacs/lisp/textmodes/ispell.el 2006-10-06 00:30:58.450860800 +0200
@@ -2492,7 +2492,8 @@
(setq ispell-buffer-local-name nil)
(if ispell-async-processp
- (let ((process-connection-type ispell-use-ptys-p))
+ (let ((process-connection-type ispell-use-ptys-p)
+ (default-directory (if (memq system-type '(cygwin windows-nt))
invocation-directory default-directory)))
(apply 'start-process
"ispell" nil ispell-program-name
"-a" ; accept single input lines
**************************************************
--
Best wishes,
Slawomir Nowaczyk
( address@hidden )
Living on Earth may be expensive, but it includes
an annual free trip around the Sun.