From: Agustin Martin <agustin.martin@hispalinux.es>
Subject: Re: More problems with flyspell
Date: Mon, 9 Jan 2006 19:26:11 +0100 [thread overview]
Message-ID: <20060109182611.GA4925@agmartin.aq.upm.es> (raw)
In-Reply-To: <20060109125313.GA5011@agmartin.aq.upm.es>
[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]
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
[-- Attachment #2: ispell.el.ispell-internal-change-dictionary+incremental.diff --]
[-- Type: text/plain, Size: 700 bytes --]
--- 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.
[-- Attachment #3: ispell.el.ispell-internal-change-dictionary+full.diff --]
[-- Type: text/plain, Size: 1734 bytes --]
--- 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.
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-01-09 18:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-05 13:37 More problems with flyspell Piet van Oostrum
2006-01-05 21:52 ` Stefan Monnier
2006-01-06 0:11 ` Agustin Martin
2006-01-08 14:47 ` Richard M. Stallman
2006-01-09 12:53 ` Agustin Martin
2006-01-09 18:26 ` Agustin Martin [this message]
2006-01-09 21:53 ` Stefan Monnier
2006-01-09 22:56 ` Agustin Martin
2006-01-10 4:16 ` Stefan Monnier
2006-01-10 14:46 ` Agustin Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060109182611.GA4925@agmartin.aq.upm.es \
--to=agustin.martin@hispalinux.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.