[Top][All Lists]

[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
set /p line= || goto :end
echo %line% >> %1
echo %line%
goto :begin
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
c:\msys64\mingw64\bin\aspell.exe  dicts
Emacs input
c:\msys64\mingw64\bin\aspell.exe  config dict-dir
Emacs input
c:\msys64\mingw64\bin\aspell.exe  config data-dir
Emacs input
c:\msys64\mingw64\bin\aspell.exe  -vv
Emacs input
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 
;;(setq ispell-program-name (expand-file-name 
(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) 
  (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)

(kill-buffer "foo.tex")

Juan José García Ripoll

reply via email to

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