unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ispell loads dict twice.
@ 2006-04-24 19:36 Michaël Cadilhac
  2006-04-26 10:14 ` Agustin Martin
  2006-05-23 18:26 ` Michaël Cadilhac
  0 siblings, 2 replies; 62+ messages in thread
From: Michaël Cadilhac @ 2006-04-24 19:36 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 1239 bytes --]


  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.
  
  Could someone have a look and install it if needed ?


[-- Attachment #1.1.2: Patch for ispell --]
[-- Type: text/x-patch, Size: 5627 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9435
diff -c -r1.9435 ChangeLog
*** ChangeLog	23 Apr 2006 21:45:28 -0000	1.9435
--- ChangeLog	24 Apr 2006 19:30:55 -0000
***************
*** 1,3 ****
--- 1,14 ----
+ 2006-04-24  Michaël Cadilhac  <michael.cadilhac@lrde.org>
+ 
+ 	* textmodes/ispell.el (ispell-buffer-local-dict): Add a `no-reload'
+ 	argument to avoid the call to `ispell-internal-change-dictionary'
+ 	when not needed.
+ 	(ispell-change-dictionary): Use this argument and call
+ 	`ispell-internal-change-dictionary' after the possible change
+ 	to `ispell-local-dictionary'.
+ 	(ispell-internal-change-dictionary): Check for a change in
+ 	personal dictionary use too.
+ 	
  2006-04-23  Michael Albinus  <michael.albinus@gmx.de>
  
  	* net/tramp.el (tramp-register-file-name-handlers): New defun.
Index: textmodes/ispell.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.197
diff -c -r1.197 ispell.el
*** textmodes/ispell.el	6 Apr 2006 19:20:37 -0000	1.197
--- textmodes/ispell.el	24 Apr 2006 19:30:55 -0000
***************
*** 2607,2621 ****
  	       (mapcar 'list (ispell-valid-dictionary-list)))
  	  nil t)
  	 current-prefix-arg))
!   (unless arg (ispell-buffer-local-dict))
    (if (equal dict "default") (setq dict nil))
    ;; This relies on completing-read's bug of returning "" for no match
    (cond ((equal dict "")
  	 (message "Using %s dictionary"
  		  (or ispell-local-dictionary ispell-dictionary "default")))
  	((equal dict (or ispell-local-dictionary
  			 ispell-dictionary "default"))
! 	 ;; Specified dictionary is the default already.  No-op
  	 (and (interactive-p)
  	      (message "No change, using %s dictionary" dict)))
  	(t				; reset dictionary!
--- 2607,2624 ----
  	       (mapcar 'list (ispell-valid-dictionary-list)))
  	  nil t)
  	 current-prefix-arg))
!   (unless arg (ispell-buffer-local-dict t))
    (if (equal dict "default") (setq dict nil))
    ;; This relies on completing-read's bug of returning "" for no match
    (cond ((equal dict "")
+ 	 (ispell-internal-change-dictionary)
  	 (message "Using %s dictionary"
  		  (or ispell-local-dictionary ispell-dictionary "default")))
  	((equal dict (or ispell-local-dictionary
  			 ispell-dictionary "default"))
! 	 ;; Specified dictionary is the default already. Could reload
! 	 ;; the dictionaries if needed.
! 	 (ispell-internal-change-dictionary)
  	 (and (interactive-p)
  	      (message "No change, using %s dictionary" dict)))
  	(t				; reset dictionary!
***************
*** 2634,2646 ****
  		  dict))))
  
  (defun ispell-internal-change-dictionary ()
!   "Update the dictionary actually used by Ispell.
  This may kill the Ispell process; if so,
  a new one will be started when needed."
!   (let ((dict (or ispell-local-dictionary ispell-dictionary)))
!     (unless (equal ispell-current-dictionary dict)
        (ispell-kill-ispell t)
!       (setq ispell-current-dictionary dict))))
  
  ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
  
--- 2637,2652 ----
  		  dict))))
  
  (defun ispell-internal-change-dictionary ()
!   "Update the dictionary and the personal dictionary used by Ispell.
  This may kill the Ispell process; if so,
  a new one will be started when needed."
!   (let ((dict (or ispell-local-dictionary ispell-dictionary))
! 	(pdict (or ispell-local-pdict ispell-personal-dictionary)))
!     (unless (and (equal ispell-current-dictionary dict)
! 		 (equal ispell-current-personal-dictionary pdict))
        (ispell-kill-ispell t)
!       (setq ispell-current-dictionary dict
! 	    ispell-current-personal-dictionary pdict))))
  
  ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
  
***************
*** 3667,3674 ****
  
  ;;; Can kill the current ispell process
  
! (defun ispell-buffer-local-dict ()
    "Initializes local dictionary and local personal dictionary.
  When a dictionary is defined in the buffer (see variable
  `ispell-dictionary-keyword'), it will override the local setting
  from \\[ispell-change-dictionary].
--- 3673,3681 ----
  
  ;;; Can kill the current ispell process
  
! (defun ispell-buffer-local-dict (&optional no-reload)
    "Initializes local dictionary and local personal dictionary.
+ If optional NO-RELOAD is non-nil, do not make any dictionary reloading.
  When a dictionary is defined in the buffer (see variable
  `ispell-dictionary-keyword'), it will override the local setting
  from \\[ispell-change-dictionary].
***************
*** 3695,3706 ****
  	    (if (re-search-forward " *\\([^ \"]+\\)" end t)
  		(setq ispell-local-pdict
  		      (match-string-no-properties 1)))))))
!   ;; Reload if new personal dictionary defined.
!   (if (not (equal ispell-current-personal-dictionary
! 		  (or ispell-local-pdict ispell-personal-dictionary)))
!       (ispell-kill-ispell t))
!   ;; Reload if new dictionary defined.
!   (ispell-internal-change-dictionary))
  
  
  (defun ispell-buffer-local-words ()
--- 3702,3710 ----
  	    (if (re-search-forward " *\\([^ \"]+\\)" end t)
  		(setq ispell-local-pdict
  		      (match-string-no-properties 1)))))))
!   (unless no-reload
!     ;; Reload if new dictionary (maybe the personal one) defined.
!     (ispell-internal-change-dictionary)))
  
  
  (defun ispell-buffer-local-words ()

[-- Attachment #1.1.3: Type: text/plain, Size: 336 bytes --]


  Thanks.

-- 
 |      Michaël `Micha' Cadilhac   |   Mieux vaut se taire                  |
 |         Epita/LRDE Promo 2007   |    Que de parler trop fort.            |
 | http://www.lrde.org/~cadilh_m   |            -- As de trèfle             |
 `--  -   JID: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2006-06-09 13:02 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-24 19:36 Ispell loads dict twice Michaël Cadilhac
2006-04-26 10:14 ` Agustin Martin
2006-04-26 21:58   ` Michaël Cadilhac
2006-05-23 18:26 ` Michaël Cadilhac
2006-05-24 11:28   ` Agustin Martin
2006-05-25 10:57     ` delete-process bug (was: Ispell loads dict twice.) Michaël Cadilhac
2006-05-25 12:19       ` Agustin Martin
2006-05-25 14:55       ` delete-process bug Stefan Monnier
2006-05-25 14:59         ` David Kastrup
2006-05-25 15:17         ` Michaël Cadilhac
2006-05-25 15:26           ` David Kastrup
2006-05-25 19:40           ` Stefan Monnier
2006-05-25 23:51         ` Kim F. Storm
2006-05-26  4:49           ` Richard Stallman
2006-05-26 13:03           ` Stefan Monnier
2006-05-26  2:22         ` Richard Stallman
2006-05-26 11:29           ` Michaël Cadilhac
2006-05-27  3:36             ` Richard Stallman
2006-05-26 13:10           ` Stefan Monnier
2006-05-26 17:27             ` Michael Mauger
2006-05-27  9:19               ` Michaël Cadilhac
2006-05-27 14:16                 ` Stefan Monnier
2006-05-27 14:29                   ` Michaël Cadilhac
2006-05-28 16:01                     ` Michaël Cadilhac
2006-05-28 18:00                       ` Stefan Monnier
2006-05-28 18:32                         ` Michaël Cadilhac
2006-05-28 19:48                           ` Stefan Monnier
2006-05-28 20:26                             ` Michaël Cadilhac
2006-05-28 21:15                               ` Kim F. Storm
2006-05-28 21:36                                 ` Michaël Cadilhac
2006-05-28 23:54                                   ` Stefan Monnier
2006-05-29 11:39                                     ` Michaël Cadilhac
2006-05-29  8:22                                   ` Kim F. Storm
2006-05-29  8:50                                     ` David Kastrup
2006-05-29 19:04                                       ` Eli Zaretskii
2006-05-29 19:27                                     ` Eli Zaretskii
2006-05-29 21:42                                       ` Kim F. Storm
2006-05-29 22:08                                         ` Eli Zaretskii
2006-05-29  3:32                                 ` Eli Zaretskii
2006-05-29  8:14                                   ` Kim F. Storm
2006-05-29 10:59                                     ` Michaël Cadilhac
2006-05-29 19:25                                     ` Eli Zaretskii
2006-05-29 20:04                                       ` Michaël Cadilhac
2006-05-29 21:24                                         ` Eli Zaretskii
2006-05-29 21:42                                           ` Michaël Cadilhac
2006-05-29 22:11                                             ` Eli Zaretskii
2006-05-29 22:32                                               ` Michaël Cadilhac
2006-05-30 12:11                                         ` Kim F. Storm
2006-05-30 12:42                                           ` Michaël Cadilhac
2006-05-30 14:26                                             ` Kim F. Storm
2006-05-30 15:13                                               ` Michaël Cadilhac
2006-06-01 14:06                                                 ` Kim F. Storm
2006-06-01 14:20                                                   ` Michaël Cadilhac
2006-06-01 14:29                                                     ` Kim F. Storm
2006-06-01 16:05                                                       ` Michaël Cadilhac
2006-06-02  7:46                                                         ` Kim F. Storm
2006-06-01 16:41                                                     ` Agustin Martin
2006-06-01 16:55                                                       ` Michaël Cadilhac
2006-05-29 23:07                               ` Agustin Martin
2006-05-25 23:52       ` delete-process bug (was: Ispell loads dict twice.) Kim F. Storm
2006-06-06 20:45   ` Ispell loads dict twice Michaël Cadilhac
2006-06-09 13:02     ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).