bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57649: 27.1; Spell check on remote file fails on windows.


From: Eli Zaretskii
Subject: bug#57649: 27.1; Spell check on remote file fails on windows.
Date: Thu, 08 Sep 2022 20:14:00 +0300

> Cc: "57649@debbugs.gnu.org" <57649@debbugs.gnu.org>
> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Thu, 08 Sep 2022 17:09:27 +0200
> 
> > The emacs debugger gives:
> > Debugger entered--Lisp error: (file-missing "Opening process input file" 
> > "No such file or directory" "/plinkx:homeoffice:/home/nmichalo/NUL")
> >   call-process("c:/NProgramFiles/bin/hunspell.exe" "NUL" t nil "-D" "-a" 
> > "NUL")
> >   apply(call-process ("c:/NProgramFiles/bin/hunspell.exe" "NUL" t nil "-D" 
> > "-a" "NUL"))
> >   ispell-call-process("c:/NProgramFiles/bin/hunspell.exe" "NUL" t nil "-D" 
> > "-a" "NUL")
> >   ispell-find-hunspell-dictionaries()
> 
> That's it. `call-process' does not support remote files.
> 
> I've just checked in Emacs 29, ispell.el is still using
> `call-process'. Somebody who knows this package shall adapt, using
> either `process-file', or working on a temporary local copy of the file
> to be spelled.

In this case the problem is not with the file being spell-checked,
it's with default-directory.

The file should not be an issue, since Emacs spell-checking works by
sending buffer text to the local spell-checking process.  It should
not matter where the buffer text came from.

So, going back to the default-directory problem, we have this:

(defmacro ispell-with-safe-default-directory (&rest body)
  "Execute the forms in BODY with a reasonable `default-directory'."
  (declare (indent 0) (debug t))
  `(let ((default-directory default-directory))
     (unless (file-accessible-directory-p default-directory)
       (setq default-directory (expand-file-name "~/")))
     ,@body))

And I guess the problem is with file-accessible-directory-p, which in
this case returns non-nil, because it probes the accessibility of the
remote directory?  So something like the below should fix the problem?

(defmacro ispell-with-safe-default-directory (&rest body)
  "Execute the forms in BODY with a reasonable `default-directory'."
  (declare (indent 0) (debug t))
  `(let ((default-directory default-directory))
     (unless (and (not (file-remote-p default-directory))
                  (file-accessible-directory-p default-directory))
       (setq default-directory (expand-file-name "~/")))
     ,@body))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]