emacs-devel
[Top][All Lists]
Advanced

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

Re: Ispell loads dict twice.


From: Michaël Cadilhac
Subject: Re: Ispell loads dict twice.
Date: Tue, 23 May 2006 20:26:19 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

address@hidden (Michaël Cadilhac) writes:

>   Hi !
>
>   I use the latest CVS version.
>
>   With the following :
>
> $ emacs -Q
>
> C-u M-x ispell-change-dictionary RET francais RET
> C-x b test1 RET
> M-x ispell-change-dictionary RET english RET
> M-x ispell-buffer
> C-x b test2 RET
> M-x ispell-change-dictionary RET english RET
>
>   The « english » dictionary will be loaded twice: on the
>   « ispell-buffer » and on the latest « ispell-change-dictionary ».
>
>   The rest of this message is IMHO :-)
>
>   What happens is the following on the second ispell-change-dictionary:
>
>   - ispell-buffer-local-dict is called,
>   - this one calls ispell-internal-change-dictionary,
>   - ispell-local-dictionary being nil, and current dictionary
>     (« english ») not being equal to default one (« francais »), the
>     ispell process is killed.
>
>   So it has to be restarted.
>
>   The call to ispell-buffer-local-dict is mandatory
>   (ispell-change-dictionary could be called with "" just to load
>   default buffer's one), but it should not call
>   ispell-internal-change-dictionary at this time.
>
>   The proposed patch :
>   - Delays this call,
>   - Makes ispell-internal-change-dictionary checks for pdict,
>   - Fixes the bug.

  Well,  this  bug  is  still  triggered in  some  cases,  but  before
  I investigate, I was  wondering why ispell-kill-process took so much
  time to execute.

  This function does the following:
  - Send EOF to ispell,
  - Read its output if there is, timeout to 1 sec,
  - Kill the process if it's still not,
  - Wait for it to be really killed (sleeping for 0.25 sec between checks).

  I don't want to be ... rude, I'm really a pacifist actually, but why
  not just delete-process it ?

  I often have some flyspellized buffers in English and some others in
  French, the time I have to wait on every C-x o is kind of
  disturbing...

  I propose the following change:
  
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9586
diff -c -B -b -r1.9586 ChangeLog
*** lisp/ChangeLog      23 May 2006 11:23:25 -0000      1.9586
--- lisp/ChangeLog      23 May 2006 18:17:41 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2006-05-23  Michaël Cadilhac  <address@hidden>
+ 
+       * textmodes/ispell.el (ispell-kill-ispell): If ispell has been
+       launched asynchronously, delete its process instead of being
+       cool.
+ 
  2006-05-23  Thien-Thi Nguyen  <address@hidden>
  
        * emacs-lisp/ewoc.el (ewoc-delete): New function.
Index: lisp/textmodes/ispell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.199
diff -c -B -b -r1.199 ispell.el
*** lisp/textmodes/ispell.el    21 May 2006 20:25:43 -0000      1.199
--- lisp/textmodes/ispell.el    23 May 2006 18:17:41 -0000
***************
*** 2572,2586 ****
        (or no-error
          (error "There is no ispell process running!"))
      (if ispell-async-processp
!       (progn
!         (process-send-eof ispell-process)
!         (if (eq (ispell-process-status) 'run)
!             (ispell-accept-output 1))
!         (if (eq (ispell-process-status) 'run)
!             (kill-process ispell-process))
!         (while (not (or (eq (ispell-process-status) 'exit)
!                         (eq (ispell-process-status) 'signal)))
!           (sleep-for 0.25)))
        ;; synchronous processes
        (ispell-send-string "\n")               ; make sure side effects 
occurred.
        (kill-buffer ispell-output-buffer)
--- 2572,2578 ----
        (or no-error
          (error "There is no ispell process running!"))
      (if ispell-async-processp
!       (delete-process ispell-process)
        ;; synchronous processes
        (ispell-send-string "\n")               ; make sure side effects 
occurred.
        (kill-buffer ispell-output-buffer)

-- 
 |      Michaël `Micha' Cadilhac   |   Un certain Blaise Pascal             |
 |         Epita/LRDE Promo 2007   |     etc... etc...                      |
 | http://www.lrde.org/~cadilh_m   |   -- Prévert (Les paris stupides)      |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpkYQDfF2wNL.pgp
Description: PGP signature


reply via email to

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