From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael.cadilhac@lrde.org (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: Re: Ispell loads dict twice. Date: Wed, 26 Apr 2006 23:58:15 +0200 Organization: Epita/LRDE Message-ID: <877j5cq9s8.fsf@lrde.org> References: <87k69eyddj.fsf@lrde.org> <20060426101418.GA5899@agmartin.aq.upm.es> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1434480092==" X-Trace: sea.gmane.org 1146088698 19409 80.91.229.2 (26 Apr 2006 21:58:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2006 21:58:18 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 26 23:58:12 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FYs1N-0006GM-SZ for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 23:58:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYs1M-000513-TF for ged-emacs-devel@m.gmane.org; Wed, 26 Apr 2006 17:58:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYs12-0004yi-Pe for emacs-devel@gnu.org; Wed, 26 Apr 2006 17:57:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYs0x-0004uo-Fh for emacs-devel@gnu.org; Wed, 26 Apr 2006 17:57:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYs0x-0004ui-7V for emacs-devel@gnu.org; Wed, 26 Apr 2006 17:57:39 -0400 Original-Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FYs3i-0007O3-Mm for emacs-devel@gnu.org; Wed, 26 Apr 2006 18:00:31 -0400 Original-Received: from mahaena.lrde.epita.fr ([192.168.101.66] helo=mahaena.lrde) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FYs0u-0002o3-Dc for emacs-devel@gnu.org; Wed, 26 Apr 2006 23:57:36 +0200 Original-To: emacs-devel@gnu.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEU/JREXDATg1LV8UCao i1fQpmoP3Nd6AAACa0lEQVQ4jWWUQW7jMAxFqZEPICJzAjXeM6W8dyNqX9ji/a8yn04xnWIEJLD9 LJH85DcJFyJV3erqPty8ExHfBikXSdn0WVezC0hOAQiA2nCsAHOqEnPe4k+puU8zw/t+xquqjRKA 4lHsmQBT8C5pDtBwfwH8VdcHI5+FHtjRxrQRwZsf3hNjZRKAPEzHEdH9mFNSYb5dQK3r8KM6ftNy KikAirDZFWdVkDqbxjGFbAcwbQCxxc8mPRHUGOcCIMgMACV23RfJTch3gC6ofT3qCdG0NyUUPfYF yQrKCIAnuYsgX2qPzW2i9sNrfSOSPPZQiygtCNlCjlpXJV38lIKshF/AZzsAMoArdCKNHfXukPuJ ImbLh+9J2gXwap0QpZ7NjZ7ekdkFcDiqPiLGcHmuvaG/AHgy62s52Lae1ABoA7D6d2kDoAvgbnyD ZutEd6lTHOXfYPHVJDH1K8a1+oyrjoZpAGn1x5pfwPr2E9yjxSpk50/gEyKgD/+BD/KzN3tQ13b8 Cx5loF0AgnZf5IUny9hRHQOYBllHDM+6s3oviZBu77mFjDm621Np3hkjR90wE1BkTYvhdDgDgCmR xWChFfcYAOqMm5NZkVWMur8AL5+oeMQOob2FmY76FiM+PrDDZypwGdqokSlAaQOmGH6mW8KpsOwl 0YOLedjSITr6scNRF8D4PesH33QmLrx8AzjpV/3kkg025w2gfAFYKCLluJAc4Ap+h18oo4S8wzaY klDsBUTiY8EZFkg5Iass75FubC9wd8qa0u9+gRxAsAKEaRAo6iB+vwCMGmdBjvgidQGA1ntMX4CS ZYGV/wADyL80LIX/UAAAAABJRU5ErkJggg== In-Reply-To: <20060426101418.GA5899@agmartin.aq.upm.es> (Agustin Martin's message of "Wed, 26 Apr 2006 12:14:18 +0200") User-Agent: Gnus/5.110005 (No Gnus v0.5) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53493 Archived-At: --===============1434480092== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Agustin Martin writes: > On Mon, Apr 24, 2006 at 09:36:40PM +0200, Micha=EBl Cadilhac wrote: >> $ emacs -Q >>=20 >> 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 >>=20 >> The =AB english =BB dictionary will be loaded twice: on the >> =AB ispell-buffer =BB and on the latest =AB ispell-change-dictionary = =BB. > > While the above problem looks rather minor In fact, it wasn't for me :-) I frequently switch between french and english dictionaries and this bug arises more than you think :-) > your patch seems to work well here, both the above and the personal > dict part. > I would only suggest a very minor cosmetic change Thank you, I dithered about making this change in the first patch, as I wasn't sure that it was OK regarding to the coding style. Here's attached the patch modified. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename=ispell.patch Content-Transfer-Encoding: quoted-printable Content-Description: Ispell patch Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =2D-- ChangeLog 26 Apr 2006 21:55:49 -0000 *************** *** 1,3 **** =2D-- 1,16 ---- + 2006-04-24 Micha=EBl Cadilhac +=20 + * 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. + Cosmetic changes thanks to Agustin Martin + . +=20 2006-04-23 Michael Albinus =20=20 * net/tramp.el (tramp-register-file-name-handlers): New defun. Index: textmodes/ispell.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =2D-- textmodes/ispell.el 26 Apr 2006 21:55:50 -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! =2D-- 2607,2624 ---- (mapcar 'list (ispell-valid-dictionary-list))) nil t) current-prefix-arg)) ! (unless arg (ispell-buffer-local-dict 'no-reload)) (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)))) =20=20 (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)))) =20=20 ;;; Spelling of comments are checked when ispell-check-comments is non-ni= l. =20=20 =2D-- 2637,2652 ---- dict)))) =20=20 (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)))) =20=20 ;;; Spelling of comments are checked when ispell-check-comments is non-ni= l. =20=20 *************** *** 3667,3674 **** =20=20 ;;; Can kill the current ispell process =20=20 ! (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]. =2D-- 3673,3681 ---- =20=20 ;;; Can kill the current ispell process =20=20 ! (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)) =20=20 =20=20 (defun ispell-buffer-local-words () =2D-- 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))) =20=20 =20=20 (defun ispell-buffer-local-words () --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =2D-=20 | Micha=EBl `Micha' Cadilhac | Pour les 35-40 ans, l'humour = | | Epita/LRDE Promo 2007 | c'est une plus-value. = | | http://www.lrde.org/~cadilh_m | -- Guillaume L. = | `-- - JID: micha@amessage.be --' - -= -' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFET+z5ZYNf4qobZ7kRAhPtAJ9QZfswfHBrSFoIORF1YTYJFNBOhQCfbsAx bJgGI0ldRcoCYz2Nv2VQu78= =q009 -----END PGP SIGNATURE----- --==-=-=-- --===============1434480092== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1434480092==--