[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debugging aspell problems
From: |
Juan José García-Ripoll |
Subject: |
Re: Debugging aspell problems |
Date: |
Wed, 05 Aug 2020 21:32:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) |
I agree that it may be a problem with the program itself, but it comes
from mingw, not from msys, and I am running emacs.exe -Q and I am seeing
buffering problems also with standard scripts from Windows.
I have created two Windows scripts to make it more reproducible. One is
called chain.cmd and the other one is myaspell.cmd. The first one simply
pulls lines of text and copies them to a file
@echo off
rem chain.cmd
:begin
set /p line= || goto :end
echo %line% >> %1
echo %line%
goto :begin
:end
echo EOF >> %1
The second one calls aspell.exe, using this tool to save the input
(inlog) and the output (outlog)
@echo off
rem myaspell.cmd
set program=c:\msys64\mingw64\bin\aspell.exe
set log=c:\Users\juanj\tmp\inlog
echo %program% %1 %2 %3 %4 %5 %6 >> %log%
echo Emacs input >> %log%
c:\Users\juanj\tmp\chain.cmd %log% | %program% %1 %2 %3 %4 %5 %6 |
c:\Users\juanj\tmp\chain.cmd c:\Users\juanj\tmp\outlog
Now I use the Lisp file below to run the spell checker on a fresh copy
of Emacs, as in
runemacs -Q --load test.el
The output in alllog is this:
c:\Users\juanj\tmp>type inlog
type inlog
c:\msys64\mingw64\bin\aspell.exe -vv
Emacs input
EOF
c:\msys64\mingw64\bin\aspell.exe dicts
Emacs input
EOF
c:\msys64\mingw64\bin\aspell.exe config dict-dir
Emacs input
EOF
c:\msys64\mingw64\bin\aspell.exe config data-dir
Emacs input
EOF
c:\msys64\mingw64\bin\aspell.exe -vv
Emacs input
EOF
c:\msys64\mingw64\bin\aspell.exe -a -m -B --encoding utf-8
Emacs input
!
+
The Emacs copy is wating for output but has not flushed out the line
buffer that contains the word. Note that here the script that is waiting
for input is chain.cmd, not aspell. Hence, one cannot really claim that
the problem is msys.
---
(require 'ispell)
;;(setq ispell-program-name (expand-file-name
"~/scoop/apps/hunspell/bin/hunspell.exe"))
;;(setq ispell-program-name (expand-file-name
"c:/msys64/mingw64/bin/aspell.exe"))
(setq ispell-program-name (expand-file-name "myaspell.cmd"))
(setq ispell-async-processp t)
(defun mydebug (&rest args)
(apply 'print args))
(defadvice ispell-filter (before show first (_process output) activate)
(mydebug (format "Receiving: %s" output)))
(defadvice ispell-call-process-region (before show first (start end &rest args)
activate)
(mydebug (format "Sending: %s" (buffer-substring start end))))
(trace-function 'mydebug)
(trace-function 'start-process)
(trace-function 'process-send-string)
(trace-function 'ispell-filter)
(trace-function 'ispell--run-on-word)
(trace-function 'ispell-call-process-region)
(trace-function 'call-process)
(trace-function 'call-process-region)
(find-file "foo.tex")
(switch-to-buffer "foo.tex")
(goto-char 1)
(insert "hello ")
(goto-char 1)
(ispell-word)
(kill-buffer "foo.tex")
--
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es