From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.devel Subject: Re: More problems with flyspell Date: Mon, 9 Jan 2006 19:26:11 +0100 Message-ID: <20060109182611.GA4925@agmartin.aq.upm.es> References: <20060106001120.GA6376@agmartin.aq.upm.es> <20060109125313.GA5011@agmartin.aq.upm.es> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" X-Trace: sea.gmane.org 1137200336 1869 80.91.229.2 (14 Jan 2006 00:58:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Jan 2006 00:58:56 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 14 01:58:51 2006 Return-path: Envelope-to: ged-emacs-devel@gmane.org Original-Received: from mail-relay.eunet.no ([193.71.71.242]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ExZS9-00014s-Ek for ged-emacs-devel@gmane.org; Sat, 14 Jan 2006 01:39:33 +0100 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by mail-relay.eunet.no (8.13.1/8.13.1/GN) with ESMTP id k09JsUnx095946 for ; Mon, 9 Jan 2006 20:54:36 +0100 (CET) (envelope-from emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org) Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ew31X-00076m-QE for ged-emacs-devel@m.gmane.org; Mon, 09 Jan 2006 14:49:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ew1sV-0001EZ-Jp for emacs-devel@gnu.org; Mon, 09 Jan 2006 13:36:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ew1qj-0000G4-QY for emacs-devel@gnu.org; Mon, 09 Jan 2006 13:34:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ew1oW-0007Xd-DD for emacs-devel@gnu.org; Mon, 09 Jan 2006 13:32:16 -0500 Original-Received: from [138.100.4.49] (helo=edison.ccupm.upm.es) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ew1qq-0007Ns-1H for emacs-devel@gnu.org; Mon, 09 Jan 2006 13:34:40 -0500 Original-Received: from debian ([138.100.247.74]) by edison.ccupm.upm.es (8.12.10/8.12.10) with ESMTP id k09IUB5u011676; Mon, 9 Jan 2006 19:30:12 +0100 Original-Received: by debian (Postfix, from userid 1000) id 648BB17DE8; Mon, 9 Jan 2006 19:26:11 +0100 (CET) Original-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <20060109125313.GA5011@agmartin.aq.upm.es> User-Agent: Mutt/1.5.9i 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:49050 Archived-At: --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 09, 2006 at 01:53:13PM +0100, Agustin Martin wrote: > c) Run again flyspell-region on the same region > => if: Buffer french-LIZEZMOI has no process Just noticed that this becomes evident when ispell patch for "flyspell needs ispell-change-dictionary twice" is applied. When using current plain ispell.el from CVS this error message does not appear, but things are also buggy; although silently, dict is not changed. > > > However, if calling flyspell-accept-buffer-local-defs twice does no > > harm, it would be fine to move that call into flyspell-region. > > However, you are right, (flyspell-word) is the key here and if instead of > (c) you run flyspell-word over a word the same error appears. I think we can > handle this from ispell.el as part of the > ispell-change-dictionary+double-call problem making sure > flyspell-last-buffer is nil'ed on dict change if flyspell is loaded. this > way first call to flyspell-word would re-run > flyspell-accept-buffer-local-defs and skip that for further calls from the > same buffer. No need to add an explicit call in flyspell-small-region or > flyspell-region. > > This might also fix the original problem Piet described, but in a different > way (that looks compatible with the current fix, no need for changes there). I am attaching a possible patch for that. It is done on top of the (not yet installed) "flyspell needs ispell-change-dictionary twice" patch. It is the incremental one, [ispell.el.ispell-internal-change-dictionary+incremental.diff] (ispell-internal-change-dictionary) - Clear out flyspell-last-buffer if flyspell is loaded and dict is changed, so (flyspell-accept-buffer-local-defs) is re-run for the new values. I am also attaching the full patch for current ispell.el from CVS, so it can be tested better if previous patch is not yet installed when reading this mail. [ispell.el.ispell-internal-change-dictionary+full.diff] -- Agustin --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ispell.el.ispell-internal-change-dictionary+incremental.diff" --- ispell.el.0 2006-01-09 12:49:13.000000000 +0100 +++ ispell.el 2006-01-09 13:22:27.000000000 +0100 @@ -2641,10 +2641,11 @@ (ispell-kill-ispell t) (setq ispell-current-dictionary dict) ;; If needed, start ispell process and clear out flyspell word cache - (when (and (featurep 'flyspell) - flyspell-mode) - (ispell-init-process) - (setq flyspell-word-cache-word nil))))) + (when (featurep 'flyspell) + (setq flyspell-last-buffer nil) ;; re-read buffer-local-defs + (when flyspell-mode + (ispell-init-process) + (setq flyspell-word-cache-word nil)))))) ;;; Spelling of comments are checked when ispell-check-comments is non-nil. --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ispell.el.ispell-internal-change-dictionary+full.diff" --- ispell.el.orig0 2005-12-20 15:06:29.000000000 +0100 +++ ispell.el 2006-01-09 13:22:27.000000000 +0100 @@ -2504,7 +2504,8 @@ (setq ispell-filter nil ispell-filter-continue nil) ;; may need to restart to select new personal dictionary. (ispell-kill-ispell t) - (message "Starting new Ispell process...") + (message "Starting new Ispell process [%s] ..." + (or ispell-local-dictionary ispell-dictionary "default")) (sit-for 0) (setq ispell-library-directory (ispell-check-version) ispell-process-directory default-directory @@ -2619,6 +2620,14 @@ (setq ispell-local-dictionary dict) (setq ispell-local-dictionary-overridden t)) (error "Undefined dictionary: %s" dict)) + ;; For global setting clear out flyspell word cache when needed + (when (and arg + (featurep 'flyspell)) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when flyspell-mode + (setq flyspell-word-cache-word nil))))) + (ispell-internal-change-dictionary) (message "%s Ispell dictionary set to %s" (if arg "Global" "Local") dict)))) @@ -2630,8 +2639,13 @@ (let ((dict (or ispell-local-dictionary ispell-dictionary))) (unless (equal ispell-current-dictionary dict) (ispell-kill-ispell t) - (setq ispell-current-dictionary dict)))) - + (setq ispell-current-dictionary dict) + ;; If needed, start ispell process and clear out flyspell word cache + (when (featurep 'flyspell) + (setq flyspell-last-buffer nil) ;; re-read buffer-local-defs + (when flyspell-mode + (ispell-init-process) + (setq flyspell-word-cache-word nil)))))) ;;; Spelling of comments are checked when ispell-check-comments is non-nil. --ZPt4rx8FFjLCG7dd 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 --ZPt4rx8FFjLCG7dd--