* Starting ispell in some fixed directory
@ 2006-09-18 14:32 Slawomir Nowaczyk
2006-09-18 18:51 ` Richard Stallman
2006-09-18 19:10 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-09-18 14:32 UTC (permalink / raw)
Hello,
At the moment, ispell is started (or restarted) in the current directory
of the current buffer. This can lead to problems on w32 where ispell is
still left running after I finish editing a file, which means I cannot
rename, move nor delete the directory in which that file reside.
I use flyspell and, for some reason I do not understand too well but
which might be related to how ispell works, whenever I change from a
buffer with "LocalWords: " definition to one without it, ispell process
is restarted. But it not always restarted again when I kill the new
buffer and go back to the old one.
I often visit some file, edit it, and then want to rename the directory.
It is not (I think) a problem in GNU/Linux, but on w32 system will not
allow me to do it, since there is an ispell process running from that
directory.
A simple fix would be to run ispell in some predefined directory, at
least on Windows -- c:/ for example. I do not think the location matters
for ispell.
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
Lottery: A tax on people who don't understand statistics.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-09-18 14:32 Starting ispell in some fixed directory Slawomir Nowaczyk
@ 2006-09-18 18:51 ` Richard Stallman
2006-09-18 19:10 ` Eli Zaretskii
1 sibling, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2006-09-18 18:51 UTC (permalink / raw)
Cc: emacs-devel
A simple fix would be to run ispell in some predefined directory, at
least on Windows -- c:/ for example. I do not think the location matters
for ispell.
If you send a patch, people will install it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-09-18 14:32 Starting ispell in some fixed directory Slawomir Nowaczyk
2006-09-18 18:51 ` Richard Stallman
@ 2006-09-18 19:10 ` Eli Zaretskii
2006-09-24 17:37 ` Slawomir Nowaczyk
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2006-09-18 19:10 UTC (permalink / raw)
Cc: emacs-devel
> Date: Mon, 18 Sep 2006 16:32:57 +0200
> From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
>
> A simple fix would be to run ispell in some predefined directory, at
> least on Windows -- c:/ for example. I do not think the location matters
> for ispell.
Patches are welcome, but I doubt that it's so easy to find a robust
directory to run ispell, what with machines that lack a C: drive. The
user's home directory might be a better idea, but even that is not
fool-proof.
So I think perhaps the code should try c:/ or ~, and if that fails,
fall back on the current behavior.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-09-18 19:10 ` Eli Zaretskii
@ 2006-09-24 17:37 ` Slawomir Nowaczyk
2006-09-25 8:21 ` Slawomir Nowaczyk
2006-10-05 21:36 ` Slawomir Nowaczyk
0 siblings, 2 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-09-24 17:37 UTC (permalink / raw)
On Mon, 18 Sep 2006 22:10:16 +0300
Eli Zaretskii <eliz@gnu.org> wrote:
#> > Date: Mon, 18 Sep 2006 16:32:57 +0200
#> > From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
#> >
#> > A simple fix would be to run ispell in some predefined directory, at
#> > least on Windows -- c:/ for example. I do not think the location matters
#> > for ispell.
#>
#> Patches are welcome, but I doubt that it's so easy to find a robust
#> directory to run ispell, what with machines that lack a C: drive.
Possibly... Are there M$ Windows installations without C: drive?
Anyway, the following patch seems to work on my machines:
**********************************************************************
M:\__\_installing_Emacs_CVS\my_code>diff -u m:/EmacsCVS/EmacsCVS/lisp/textmodes/ispell.el c:/Emacs/lisp/textmodes/ispell.el
--- m:/EmacsCVS/EmacsCVS/lisp/textmodes/ispell.el 2006-08-11 12:45:48.025268800 +0200
+++ c:/Emacs/lisp/textmodes/ispell.el 2006-09-24 19:11:05.962598400 +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 (member system-type '(cygwin windows-nt)) temporary-file-directory default-directory)))
(apply 'start-process
"ispell" nil ispell-program-name
"-a" ; accept single input lines
**********************************************************************
but I am not 100% sure if temporary-file-directory *always* points to an
existing directory... I believe it should, though.
I was also thinking about using (substitute-in-file-name "$WINDIR")
instead... Wikipedia claims $WINDIR should be available on all versions
of M$ Windows, but I do not have access to any 95 nor 98 machines to
test this claim.
I think the change applies to windows-nt and cygwin environments only, I
doubt any other system is similarly broken (except, maybe, MS-DOS?).
#> The user's home directory might be a better idea, but even that is
#> not fool-proof.
#>
#> So I think perhaps the code should try c:/ or ~, and if that fails,
#> fall back on the current behavior.
Well, if we are really paranoid, the test could be expanded into
(and (member system-type '(cygwin windows-nt)) (file-exists-p temporary-file-directory))
but I do not think it is necessary.
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.
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
God is real, unless declared integer.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-09-24 17:37 ` Slawomir Nowaczyk
@ 2006-09-25 8:21 ` Slawomir Nowaczyk
2006-10-05 21:36 ` Slawomir Nowaczyk
1 sibling, 0 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-09-25 8:21 UTC (permalink / raw)
On Sun, 24 Sep 2006 19:37:04 +0200
Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> wrote:
#>> Patches are welcome, but I doubt that it's so easy to find a robust
#>> directory to run ispell, what with machines that lack a C: drive.
#> Anyway, the following patch seems to work on my machines:
Here is changelog entry, just in case somebody thinks my patch is good
enough to be installed
2006-09-24 Slawomir Nowaczyk <slawek@cs.lth.se>
* ispell.el (ispell-start-process): on windows, do not run
ispell in a current buffer's directory (it prevented the
directory from being moved/renamed)
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
Recursive: see recursive.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-09-24 17:37 ` Slawomir Nowaczyk
2006-09-25 8:21 ` Slawomir Nowaczyk
@ 2006-10-05 21:36 ` Slawomir Nowaczyk
2006-10-05 22:00 ` Stuart D. Herring
2006-10-05 22:43 ` Stefan Monnier
1 sibling, 2 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-10-05 21:36 UTC (permalink / raw)
Hello,
Any comments on this?
On Sun, 24 Sep 2006 19:37:04 +0200
Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> wrote:
#> #> > A simple fix would be to run ispell in some predefined
#> #> > directory, at least on Windows -- c:/ for example. I do not
#> #> > think the location matters for ispell.
#> #>
#> #> Patches are welcome, but I doubt that it's so easy to find a
#> #> robust directory to run ispell, what with machines that lack a C:
#> #> drive.
#>
#> Possibly... Are there M$ Windows installations without C: drive?
#>
#> Anyway, the following patch seems to work on my machines:
#>
#> **********************************************************************
#>
#> --- m:/EmacsCVS/EmacsCVS/lisp/textmodes/ispell.el 2006-08-11 12:45:48.025268800 +0200
#> +++ c:/Emacs/lisp/textmodes/ispell.el 2006-09-24 19:11:05.962598400 +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 (member system-type '(cygwin windows-nt)) temporary-file-directory default-directory)))
#> (apply 'start-process
#> "ispell" nil ispell-program-name
#> "-a" ; accept single input lines
#>
#> **********************************************************************
#>
#> but I am not 100% sure if temporary-file-directory *always* points to an
#> existing directory... I believe it should, though.
#>
#> #> The user's home directory might be a better idea, but even that is
#> #> not fool-proof.
#> #>
#> #> So I think perhaps the code should try c:/ or ~, and if that fails,
#> #> fall back on the current behavior.
#>
#> Well, if we are really paranoid, the test could be expanded into
#> (and (member system-type '(cygwin windows-nt)) (file-exists-p temporary-file-directory))
#> but I do not think it is necessary.
#>
#> 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.
On Sun, 24 Sep 2006 19:37:04 +0200
Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> wrote:
Here is changelog entry, just in case somebody thinks my patch is good
enough to be installed
2006-09-24 Slawomir Nowaczyk <slawek@cs.lth.se>
* ispell.el (ispell-start-process): on windows, do not run
ispell in a current buffer's directory (it prevented the
directory from being moved/renamed)
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
I asked Mom if I was a gifted child... she said they certainly
wouldn't have paid for me.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-10-05 21:36 ` Slawomir Nowaczyk
@ 2006-10-05 22:00 ` Stuart D. Herring
2006-10-05 22:33 ` Slawomir Nowaczyk
2006-10-05 22:43 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: Stuart D. Herring @ 2006-10-05 22:00 UTC (permalink / raw)
Cc: emacs-devel
> Hello,
>
> Any comments on this?
[snip]
> #> + (default-directory (if (member system-type '(cygwin
> windows-nt)) temporary-file-directory default-directory)))
You can use `memq' here, since you're comparing symbols.
> #> 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', but I suppose it's
possible for that not to be known in some cases. 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)))))
...)
I can't see how this would ever fail; on Unix-like systems, 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.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-10-05 22:00 ` Stuart D. Herring
@ 2006-10-05 22:33 ` Slawomir Nowaczyk
0 siblings, 0 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-10-05 22:33 UTC (permalink / raw)
On Thu, 05 Oct 2006 15:00:47 -0700 (PDT)
"Stuart D. Herring" <herring@lanl.gov> 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
( slawomir.nowaczyk.847@student.lu.se )
Living on Earth may be expensive, but it includes
an annual free trip around the Sun.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-10-05 21:36 ` Slawomir Nowaczyk
2006-10-05 22:00 ` Stuart D. Herring
@ 2006-10-05 22:43 ` Stefan Monnier
2006-10-06 20:28 ` Slawomir Nowaczyk
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2006-10-05 22:43 UTC (permalink / raw)
Cc: emacs-devel
> #> - (let ((process-connection-type ispell-use-ptys-p))
> #> + (let ((process-connection-type ispell-use-ptys-p)
> #> + (default-directory (if (member system-type '(cygwin windows-nt)) temporary-file-directory default-directory)))
Rather than testing system-type, why not test that temporary-file-directory
exists?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Starting ispell in some fixed directory
2006-10-05 22:43 ` Stefan Monnier
@ 2006-10-06 20:28 ` Slawomir Nowaczyk
0 siblings, 0 replies; 10+ messages in thread
From: Slawomir Nowaczyk @ 2006-10-06 20:28 UTC (permalink / raw)
On Thu, 05 Oct 2006 18:43:34 -0400
Stefan Monnier <monnier@iro.umontreal.ca> wrote:
#> > #> - (let ((process-connection-type ispell-use-ptys-p))
#> > #> + (let ((process-connection-type ispell-use-ptys-p)
#> > #> + (default-directory (if (member system-type '(cygwin windows-nt)) temporary-file-directory default-directory)))
#>
#> Rather than testing system-type, why not test that
#> temporary-file-directory exists?
Well, I wanted to keep the change a non-invasive as possible, but you
are probably right, there is nothing wrong with running ispell from
another directory on systems other than w32 as well.
So, how about:
(let ((process-connection-type ispell-use-ptys-p)
(default-directory (if (and invocation-directory (file-exists-p invocation-directory))
invocation-directory default-directory)))
Initially I had some doubts about efficiency of checking directory
existence, but it should be totally negligible compared to the cost of
start-process.
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
Copy Protection: A clever method of preventing incompetent pirates from
stealing software and legitimate customers from using it.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-10-06 20:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 14:32 Starting ispell in some fixed directory Slawomir Nowaczyk
2006-09-18 18:51 ` Richard Stallman
2006-09-18 19:10 ` Eli Zaretskii
2006-09-24 17:37 ` Slawomir Nowaczyk
2006-09-25 8:21 ` Slawomir Nowaczyk
2006-10-05 21:36 ` Slawomir Nowaczyk
2006-10-05 22:00 ` Stuart D. Herring
2006-10-05 22:33 ` Slawomir Nowaczyk
2006-10-05 22:43 ` Stefan Monnier
2006-10-06 20:28 ` Slawomir Nowaczyk
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.