Mercurial > emacs
annotate lisp/textmodes/flyspell.el @ 65626:69a9e146ef35
(add_sym): Compare namespace names instead of namespace objects. This
prevents the parser from incorrectly treating classes whose superclass
is in another namespace.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 20 Sep 2005 13:19:29 +0000 |
parents | 703495630901 |
children | f621d74f5b9a fa0da9b57058 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37008
diff
changeset
|
1 ;;; flyspell.el --- on-the-fly spell checker |
22611 | 2 |
64751
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
3 ;; Copyright (C) 1998, 2000, 2002, 2003, 2004, |
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
4 ;; 2005 Free Software Foundation, Inc. |
22611 | 5 |
56522
6ed4179ba08b
Update author email address.
Richard M. Stallman <rms@gnu.org>
parents:
55731
diff
changeset
|
6 ;; Author: Manuel Serrano <Manuel.Serrano@sophia.inria.fr> |
55731 | 7 ;; Maintainer: FSF |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
8 ;; Keywords: convenience |
22611 | 9 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37008
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
22611 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64084 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
22611 | 26 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
27 ;;; Commentary: |
22611 | 28 ;; |
29 ;; Flyspell is a minor Emacs mode performing on-the-fly spelling | |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
30 ;; checking. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
31 ;; |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
32 ;; To enable Flyspell minor mode, type M-x flyspell-mode. |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
33 ;; This applies only to the current buffer. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
34 ;; |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
35 ;; To enable Flyspell in text representing computer programs, type |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
36 ;; M-x flyspell-prog-mode. |
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
37 ;; In that mode only text inside comments is checked. |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
38 ;; |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
39 ;; Note: consider setting the variable ispell-parser to `tex' to |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
40 ;; avoid TeX command checking; use `(setq ispell-parser 'tex)'. |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
41 ;; |
22611 | 42 ;; Some user variables control the behavior of flyspell. They are |
43 ;; those defined under the `User variables' comment. | |
44 | |
45 ;;; Code: | |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
46 |
22611 | 47 (require 'ispell) |
48 | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
49 ;*---------------------------------------------------------------------*/ |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
50 ;* Group ... */ |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
51 ;*---------------------------------------------------------------------*/ |
22611 | 52 (defgroup flyspell nil |
37008 | 53 "Spell checking on the fly." |
22611 | 54 :tag "FlySpell" |
55 :prefix "flyspell-" | |
43383
d21a74d23497
2002-02-17 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43148
diff
changeset
|
56 :group 'ispell |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
57 :group 'processes) |
22611 | 58 |
59 ;*---------------------------------------------------------------------*/ | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
60 ;* Which emacs are we currently running */ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
61 ;*---------------------------------------------------------------------*/ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
62 (defvar flyspell-emacs |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
63 (cond |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
64 ((string-match "XEmacs" emacs-version) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
65 'xemacs) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
66 (t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
67 'emacs)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
68 "The type of Emacs we are currently running.") |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
69 |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
70 ;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
71 ;* User configuration ... */ |
22611 | 72 ;*---------------------------------------------------------------------*/ |
73 (defcustom flyspell-highlight-flag t | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
74 "*How Flyspell should indicate misspelled words. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
75 Non-nil means use highlight, nil means use minibuffer messages." |
22611 | 76 :group 'flyspell |
77 :type 'boolean) | |
78 | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
79 (defcustom flyspell-mark-duplications-flag t |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
80 "*Non-nil means Flyspell reports a repeated word as an error. |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
81 Detection of repeated words is not implemented in |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
82 \"large\" regions; see `flyspell-large-region'." |
22611 | 83 :group 'flyspell |
84 :type 'boolean) | |
85 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
86 (defcustom flyspell-sort-corrections nil |
22611 | 87 "*Non-nil means, sort the corrections alphabetically before popping them." |
88 :group 'flyspell | |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
89 :version "21.1" |
22611 | 90 :type 'boolean) |
91 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
92 (defcustom flyspell-duplicate-distance -1 |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
93 "*The maximum distance for finding duplicates of unrecognized words. |
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
94 This applies to the feature that when a word is not found in the dictionary, |
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
95 if the same spelling occurs elsewhere in the buffer, |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
96 Flyspell uses a different face (`flyspell-duplicate') to highlight it. |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
97 This variable specifies how far to search to find such a duplicate. |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
98 -1 means no limit (search the whole buffer). |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
99 0 means do not search for duplicate unrecognized spellings." |
22611 | 100 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
101 :version "21.1" |
22611 | 102 :type 'number) |
103 | |
104 (defcustom flyspell-delay 3 | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
105 "*The number of seconds to wait before checking, after a \"delayed\" command." |
22611 | 106 :group 'flyspell |
107 :type 'number) | |
108 | |
109 (defcustom flyspell-persistent-highlight t | |
22946
cfde96067373
(flyspell-persistent-highlight): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22891
diff
changeset
|
110 "*Non-nil means misspelled words remain highlighted until corrected. |
cfde96067373
(flyspell-persistent-highlight): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22891
diff
changeset
|
111 If this variable is nil, only the most recently detected misspelled word |
cfde96067373
(flyspell-persistent-highlight): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22891
diff
changeset
|
112 is highlighted." |
22611 | 113 :group 'flyspell |
114 :type 'boolean) | |
115 | |
116 (defcustom flyspell-highlight-properties t | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
117 "*Non-nil means highlight incorrect words even if a property exists for this word." |
22611 | 118 :group 'flyspell |
119 :type 'boolean) | |
120 | |
121 (defcustom flyspell-default-delayed-commands | |
122 '(self-insert-command | |
123 delete-backward-char | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
124 backward-or-forward-delete-char |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
125 delete-char |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
126 scrollbar-vertical-drag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
127 backward-delete-char-untabify) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
128 "The standard list of delayed commands for Flyspell. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
129 See `flyspell-delayed-commands'." |
22611 | 130 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
131 :version "21.1" |
22611 | 132 :type '(repeat (symbol))) |
133 | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
134 (defcustom flyspell-delayed-commands nil |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
135 "List of commands that are \"delayed\" for Flyspell mode. |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
136 After these commands, Flyspell checking is delayed for a short time, |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
137 whose length is specified by `flyspell-delay'." |
22611 | 138 :group 'flyspell |
139 :type '(repeat (symbol))) | |
140 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
141 (defcustom flyspell-default-deplacement-commands |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
142 '(next-line |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
143 previous-line |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
144 scroll-up |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
145 scroll-down) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
146 "The standard list of deplacement commands for Flyspell. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
147 See `flyspell-deplacement-commands'." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
148 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
149 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
150 :type '(repeat (symbol))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
151 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
152 (defcustom flyspell-deplacement-commands nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
153 "List of commands that are \"deplacement\" for Flyspell mode. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
154 After these commands, Flyspell checking is performed only if the previous |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
155 command was not the very same command." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
156 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
157 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
158 :type '(repeat (symbol))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
159 |
22611 | 160 (defcustom flyspell-issue-welcome-flag t |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
161 "*Non-nil means that Flyspell should display a welcome message when started." |
22611 | 162 :group 'flyspell |
163 :type 'boolean) | |
164 | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
165 (defcustom flyspell-issue-message-flag t |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
166 "*Non-nil means that Flyspell emits messages when checking words." |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
167 :group 'flyspell |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
168 :type 'boolean) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
169 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
170 (defcustom flyspell-incorrect-hook nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
171 "*List of functions to be called when incorrect words are encountered. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
172 Each function is given three arguments: the beginning and the end |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
173 of the incorrect region. The third is either the symbol 'doublon' or the list |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
174 of possible corrections as returned by `ispell-parse-output'. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
175 |
37008 | 176 If any of the functions return non-Nil, the word is not highlighted as |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
177 incorrect." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
178 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
179 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
180 :type 'hook) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
181 |
40933
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
182 (defcustom flyspell-default-dictionary nil |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
183 "A string that is the name of the default dictionary. |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
184 This is passed to the `ispell-change-dictionary' when flyspell is started. |
40933
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
185 If the variable `ispell-local-dictionary' or `ispell-dictionary' is non-nil |
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
186 when flyspell is started, the value of that variable is used instead |
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
187 of `flyspell-default-dictionary' to select the default dictionary. |
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
188 Otherwise, if `flyspell-default-dictionary' is nil, it means to use |
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
189 Ispell's ultimate default dictionary." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
190 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
191 :version "21.1" |
40942
52f0b9d1d57b
(flyspell-default-dictionary): Fix previous change.
Pavel Janík <Pavel@Janik.cz>
parents:
40938
diff
changeset
|
192 :type '(choice string (const :tag "Default" nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
193 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
194 (defcustom flyspell-tex-command-regexp |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
195 "\\(\\(begin\\|end\\)[ \t]*{\\|\\(cite[a-z*]*\\|label\\|ref\\|eqref\\|usepackage\\|documentclass\\)[ \t]*\\(\\[[^]]*\\]\\)?{[^{}]*\\)" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
196 "A string that is the regular expression that matches TeX commands." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
197 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
198 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
199 :type 'string) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
200 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
201 (defcustom flyspell-check-tex-math-command nil |
37008 | 202 "*Non nil means check even inside TeX math environment. |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
203 TeX math environments are discovered by the TEXMATHP that implemented |
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
204 inside the texmathp.el Emacs package. That package may be found at: |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
205 http://strw.leidenuniv.nl/~dominik/Tools" |
22611 | 206 :group 'flyspell |
207 :type 'boolean) | |
208 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
209 (defcustom flyspell-dictionaries-that-consider-dash-as-word-delimiter |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
210 '("francais" "deutsch8" "norsk") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
211 "List of dictionary names that consider `-' as word delimiter." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
212 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
213 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
214 :type '(repeat (string))) |
22611 | 215 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
216 (defcustom flyspell-abbrev-p |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
217 nil |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
218 "*If non-nil, add correction to abbreviation table." |
22611 | 219 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
220 :version "21.1" |
22611 | 221 :type 'boolean) |
222 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
223 (defcustom flyspell-use-global-abbrev-table-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
224 nil |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
225 "*If non-nil, prefer global abbrev table to local abbrev table." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
226 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
227 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
228 :type 'boolean) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
229 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
230 (defcustom flyspell-mode-line-string " Fly" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
231 "*String displayed on the modeline when flyspell is active. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
232 Set this to nil if you don't want a modeline indicator." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
233 :group 'flyspell |
42622
2c67c90f9b6d
(flyspell-mode-line-string): Fix custom type.
Richard M. Stallman <rms@gnu.org>
parents:
42456
diff
changeset
|
234 :type '(choice string (const :tag "None" nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
235 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
236 (defcustom flyspell-large-region 1000 |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
237 "*The threshold that determines if a region is small. |
61380
ef6efcaaf3c3
(flyspell-large-region): Clarify docstring.
Stephen Eglen <stephen@gnu.org>
parents:
60855
diff
changeset
|
238 If the region is smaller than this number of characters, |
ef6efcaaf3c3
(flyspell-large-region): Clarify docstring.
Stephen Eglen <stephen@gnu.org>
parents:
60855
diff
changeset
|
239 `flyspell-region' checks the words sequentially using regular |
ef6efcaaf3c3
(flyspell-large-region): Clarify docstring.
Stephen Eglen <stephen@gnu.org>
parents:
60855
diff
changeset
|
240 flyspell methods. Else, if the region is large, a new Ispell process is |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
241 spawned for speed. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
242 |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
243 Doubled words are not detected in a large region, because Ispell |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
244 does not check for them. |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
245 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
246 If `flyspell-large-region' is nil, all regions are treated as small." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
247 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
248 :version "21.1" |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
249 :type '(choice number (const :tag "All small" nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
250 |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
251 (defcustom flyspell-insert-function (function insert) |
43148
b3cf1a561428
(flyspell-insert-function): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents:
43064
diff
changeset
|
252 "*Function for inserting word by flyspell upon correction." |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
253 :group 'flyspell |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
254 :type 'function) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
255 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
256 (defcustom flyspell-before-incorrect-word-string nil |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
257 "String used to indicate an incorrect word starting." |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
258 :group 'flyspell |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
259 :type '(choice string (const nil))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
260 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
261 (defcustom flyspell-after-incorrect-word-string nil |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
262 "String used to indicate an incorrect word ending." |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
263 :group 'flyspell |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
264 :type '(choice string (const nil))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
265 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
266 (defcustom flyspell-use-meta-tab t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
267 "*Non-nil means that flyspell uses META-TAB to correct word." |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
268 :group 'flyspell |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
269 :type 'boolean) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
270 |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
271 (defcustom flyspell-auto-correct-binding |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
272 [(control ?\;)] |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
273 "The key binding for flyspell auto correction." |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
274 :group 'flyspell) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
275 |
22611 | 276 ;*---------------------------------------------------------------------*/ |
277 ;* Mode specific options */ | |
278 ;* ------------------------------------------------------------- */ | |
279 ;* Mode specific options enable users to disable flyspell on */ | |
280 ;* certain word depending of the emacs mode. For instance, when */ | |
281 ;* using flyspell with mail-mode add the following expression */ | |
282 ;* in your .emacs file: */ | |
283 ;* (add-hook 'mail-mode */ | |
284 ;* '(lambda () (setq flyspell-generic-check-word-p */ | |
285 ;* 'mail-mode-flyspell-verify))) */ | |
286 ;*---------------------------------------------------------------------*/ | |
287 (defvar flyspell-generic-check-word-p nil | |
288 "Function providing per-mode customization over which words are flyspelled. | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
289 Returns t to continue checking, nil otherwise. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
290 Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate' |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
291 property of the major mode name.") |
22611 | 292 (make-variable-buffer-local 'flyspell-generic-check-word-p) |
293 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
294 ;*--- mail mode -------------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
295 (put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
296 (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) |
22611 | 297 (defun mail-mode-flyspell-verify () |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
298 "This function is used for `flyspell-generic-check-word-p' in Mail mode." |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
299 (let ((header-end (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
300 (goto-char (point-min)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
301 (re-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
302 (concat "^" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
303 (regexp-quote mail-header-separator) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
304 "$") |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
305 nil t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
306 (point))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
307 (signature-begin (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
308 (goto-char (point-max)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
309 (re-search-backward message-signature-separator |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
310 nil t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
311 (point)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
312 (cond ((< (point) header-end) |
35338
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
313 (and (save-excursion (beginning-of-line) |
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
314 (looking-at "^Subject:")) |
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
315 (> (point) (match-end 0)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
316 ((> (point) signature-begin) |
34925
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
317 nil) |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
318 (t |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
319 (save-excursion |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
320 (beginning-of-line) |
60855
8386904a5a5f
(mail-mode-flyspell-verify): Fix regexp syntax.
Richard M. Stallman <rms@gnu.org>
parents:
60459
diff
changeset
|
321 (not (looking-at "[>}|]\\|To:"))))))) |
22611 | 322 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
323 ;*--- texinfo mode ----------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
324 (put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify) |
22611 | 325 (defun texinfo-mode-flyspell-verify () |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
326 "This function is used for `flyspell-generic-check-word-p' in Texinfo mode." |
22611 | 327 (save-excursion |
328 (forward-word -1) | |
329 (not (looking-at "@")))) | |
330 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
331 ;*--- tex mode --------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
332 (put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
333 (defun tex-mode-flyspell-verify () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
334 "This function is used for `flyspell-generic-check-word-p' in LaTeX mode." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
335 (and |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
336 (not (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
337 (re-search-backward "^[ \t]*%%%[ \t]+Local" (point-min) t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
338 (not (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
339 (let ((this (point-marker)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
340 (e (progn (end-of-line) (point-marker)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
341 (beginning-of-line) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
342 (if (re-search-forward "\\\\\\(cite\\|label\\|ref\\){[^}]*}" e t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
343 (and (>= this (match-beginning 0)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
344 (<= this (match-end 0)) ))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
345 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
346 ;*--- sgml mode -------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
347 (put 'sgml-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
348 (put 'html-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
349 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
350 (defun sgml-mode-flyspell-verify () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
351 "This function is used for `flyspell-generic-check-word-p' in SGML mode." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
352 (not (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
353 (let ((this (point-marker)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
354 (s (progn (beginning-of-line) (point-marker))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
355 (e (progn (end-of-line) (point-marker)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
356 (or (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
357 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
358 (and (re-search-forward "[^<]*>" e t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
359 (= (match-beginning 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
360 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
361 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
362 (and (re-search-backward "<[^>]*" s t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
363 (= (match-end 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
364 (and (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
365 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
366 (and (re-search-forward "[^&]*;" e t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
367 (= (match-beginning 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
368 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
369 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
370 (and (re-search-backward "&[^;]*" s t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
371 (= (match-end 0) this))))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
372 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
373 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
374 ;* Programming mode */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
375 ;*---------------------------------------------------------------------*/ |
33787
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
376 (defvar flyspell-prog-text-faces |
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
377 '(font-lock-string-face font-lock-comment-face font-lock-doc-face) |
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
378 "Faces corresponding to text in programming-mode buffers.") |
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
379 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
380 (defun flyspell-generic-progmode-verify () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
381 "Used for `flyspell-generic-check-word-p' in programming modes." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
382 (let ((f (get-text-property (point) 'face))) |
33787
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
383 (memq f flyspell-prog-text-faces))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
384 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
385 ;;;###autoload |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
386 (defun flyspell-prog-mode () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
387 "Turn on `flyspell-mode' for comments and strings." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
388 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
389 (setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
390 (flyspell-mode 1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
391 (run-hooks 'flyspell-prog-mode-hook)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
392 |
22611 | 393 ;*---------------------------------------------------------------------*/ |
394 ;* Overlay compatibility */ | |
395 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
396 (autoload 'make-overlay "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
397 (autoload 'overlayp "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
398 (autoload 'overlays-in "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
399 (autoload 'delete-overlay "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
400 (autoload 'overlays-at "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
401 (autoload 'overlay-put "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
402 (autoload 'overlay-get "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
403 (autoload 'previous-overlay-change "overlay" "Overlay compatibility kit." t) |
22611 | 404 |
405 ;*---------------------------------------------------------------------*/ | |
406 ;* The minor mode declaration. */ | |
407 ;*---------------------------------------------------------------------*/ | |
27787
d40d47971e6b
(flyspell-mouse-map): Change definition
Dave Love <fx@gnu.org>
parents:
24943
diff
changeset
|
408 (defvar flyspell-mouse-map |
d40d47971e6b
(flyspell-mouse-map): Change definition
Dave Love <fx@gnu.org>
parents:
24943
diff
changeset
|
409 (let ((map (make-sparse-keymap))) |
58263
b838f6a6cb4d
(flyspell-mouse-map): Pop the menu
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58001
diff
changeset
|
410 (define-key map (if (featurep 'xemacs) [button2] [down-mouse-2]) |
b838f6a6cb4d
(flyspell-mouse-map): Pop the menu
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58001
diff
changeset
|
411 #'flyspell-correct-word) |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
412 map) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
413 "Keymap for Flyspell to put on erroneous words.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
414 |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
415 (defvar flyspell-mode-map |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
416 (let ((map (make-sparse-keymap))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
417 (if flyspell-use-meta-tab |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
418 (define-key map "\M-\t" 'flyspell-auto-correct-word)) |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
419 (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
420 (define-key map [(control ?\,)] 'flyspell-goto-next-error) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
421 (define-key map [(control ?\.)] 'flyspell-auto-correct-word) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
422 map) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
423 "Minor mode keymap for Flyspell mode--for the whole buffer.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
424 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
425 ;; dash character machinery |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
426 (defvar flyspell-consider-dash-as-word-delimiter-flag nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
427 "*Non-nil means that the `-' char is considered as a word delimiter.") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
428 (make-variable-buffer-local 'flyspell-consider-dash-as-word-delimiter-flag) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
429 (defvar flyspell-dash-dictionary nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
430 (make-variable-buffer-local 'flyspell-dash-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
431 (defvar flyspell-dash-local-dictionary nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
432 (make-variable-buffer-local 'flyspell-dash-local-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
433 |
22611 | 434 ;*---------------------------------------------------------------------*/ |
435 ;* Highlighting */ | |
436 ;*---------------------------------------------------------------------*/ | |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
437 (defface flyspell-incorrect |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
438 '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
439 (t (:bold t))) |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
440 "Face used for marking a misspelled word in Flyspell." |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
441 :group 'flyspell) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
442 ;; backward-compatibility alias |
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
443 (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
444 |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
445 (defface flyspell-duplicate |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
446 '((((class color)) (:foreground "Gold3" :bold t :underline t)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
447 (t (:bold t))) |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
448 "Face used for marking a misspelled word that appears twice in the buffer. |
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
449 See also `flyspell-duplicate-distance'." |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
450 :group 'flyspell) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
451 ;; backward-compatibility alias |
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
452 (put 'flyspell-duplicate-face 'face-alias 'flyspell-duplicate) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
453 |
22611 | 454 (defvar flyspell-overlay nil) |
455 | |
456 ;*---------------------------------------------------------------------*/ | |
457 ;* flyspell-mode ... */ | |
458 ;*---------------------------------------------------------------------*/ | |
64970
877705ac17d3
(flyspell-mode): Autoload a defvar.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
459 ;;;###autoload(defvar flyspell-mode nil) |
22611 | 460 ;;;###autoload |
63120
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
461 (define-minor-mode flyspell-mode |
22611 | 462 "Minor mode performing on-the-fly spelling checking. |
57605
6738a2db2167
(flyspell-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56767
diff
changeset
|
463 This spawns a single Ispell process and checks each word. |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
464 The default flyspell behavior is to highlight incorrect words. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
465 With no argument, this command toggles Flyspell mode. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
466 With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive. |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
467 |
22611 | 468 Bindings: |
469 \\[ispell-word]: correct words (using Ispell). | |
470 \\[flyspell-auto-correct-word]: automatically correct word. | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
471 \\[flyspell-auto-correct-previous-word]: automatically correct the last misspelled word. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
472 \\[flyspell-correct-word] (or down-mouse-2): popup correct words. |
22611 | 473 |
474 Hooks: | |
40858
0517a2e0f908
Use the keymap property instead of local-map, and don't use a minor-mode map.
Richard M. Stallman <rms@gnu.org>
parents:
38436
diff
changeset
|
475 This runs `flyspell-mode-hook' after flyspell is entered. |
22611 | 476 |
477 Remark: | |
478 `flyspell-mode' uses `ispell-mode'. Thus all Ispell options are | |
479 valid. For instance, a personal dictionary can be used by | |
480 invoking `ispell-change-dictionary'. | |
481 | |
482 Consider using the `ispell-parser' to check your text. For instance | |
483 consider adding: | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
484 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) |
22611 | 485 in your .emacs file. |
486 | |
40858
0517a2e0f908
Use the keymap property instead of local-map, and don't use a minor-mode map.
Richard M. Stallman <rms@gnu.org>
parents:
38436
diff
changeset
|
487 \\[flyspell-region] checks all words inside a region. |
0517a2e0f908
Use the keymap property instead of local-map, and don't use a minor-mode map.
Richard M. Stallman <rms@gnu.org>
parents:
38436
diff
changeset
|
488 \\[flyspell-buffer] checks the whole buffer." |
63120
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
489 :lighter flyspell-mode-line-string |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
490 :keymap flyspell-mode-map |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
491 :group 'flyspell |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
492 (if flyspell-mode |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
493 (flyspell-mode-on) |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
494 (flyspell-mode-off))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
495 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
496 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
497 ;* flyspell-buffers ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
498 ;* ------------------------------------------------------------- */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
499 ;* For remembering buffers running flyspell */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
500 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
501 (defvar flyspell-buffers nil) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
502 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
503 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
504 ;* flyspell-minibuffer-p ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
505 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
506 (defun flyspell-minibuffer-p (buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
507 "Is BUFFER a minibuffer?" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
508 (let ((ws (get-buffer-window-list buffer t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
509 (and (consp ws) (window-minibuffer-p (car ws))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
510 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
511 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
512 ;* flyspell-accept-buffer-local-defs ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
513 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
514 (defun flyspell-accept-buffer-local-defs () |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
515 ;; strange problem. If buffer in current window has font-lock turned on, |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
516 ;; but SET-BUFFER was called to point to an invisible buffer, this ispell |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
517 ;; call will reset the buffer to the buffer in the current window. However, |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
518 ;; it only happens at startup (fix by Albert L. Ting). |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
519 (let ((buf (current-buffer))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
520 (ispell-accept-buffer-local-defs) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
521 (set-buffer buf)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
522 (if (not (and (eq flyspell-dash-dictionary ispell-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
523 (eq flyspell-dash-local-dictionary ispell-local-dictionary))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
524 ;; The dictionary has changed |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
525 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
526 (setq flyspell-dash-dictionary ispell-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
527 (setq flyspell-dash-local-dictionary ispell-local-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
528 (if (member (or ispell-local-dictionary ispell-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
529 flyspell-dictionaries-that-consider-dash-as-word-delimiter) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
530 (setq flyspell-consider-dash-as-word-delimiter-flag t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
531 (setq flyspell-consider-dash-as-word-delimiter-flag nil))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
532 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
533 ;*---------------------------------------------------------------------*/ |
22611 | 534 ;* flyspell-mode-on ... */ |
535 ;*---------------------------------------------------------------------*/ | |
536 (defun flyspell-mode-on () | |
23234 | 537 "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
538 (setq ispell-highlight-face 'flyspell-incorrect) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
539 ;; local dictionaries setup |
60283
e55f542ec767
(flyspell-mode-on): Call ispell-change-dictionary only if necessary.
Richard M. Stallman <rms@gnu.org>
parents:
58263
diff
changeset
|
540 (or ispell-local-dictionary ispell-dictionary |
e55f542ec767
(flyspell-mode-on): Call ispell-change-dictionary only if necessary.
Richard M. Stallman <rms@gnu.org>
parents:
58263
diff
changeset
|
541 (if flyspell-default-dictionary |
e55f542ec767
(flyspell-mode-on): Call ispell-change-dictionary only if necessary.
Richard M. Stallman <rms@gnu.org>
parents:
58263
diff
changeset
|
542 (ispell-change-dictionary flyspell-default-dictionary))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
543 ;; we have to force ispell to accept the local definition or |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
544 ;; otherwise it could be too late, the local dictionary may |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
545 ;; be forgotten! |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
546 (flyspell-accept-buffer-local-defs) |
45184
fe852d8d5495
(make-flyspell-overlay): Add help text to flyspell overlays.
Pavel Janík <Pavel@Janik.cz>
parents:
43444
diff
changeset
|
547 ;; we put the `flyspell-delayed' property on some commands |
22611 | 548 (flyspell-delay-commands) |
45184
fe852d8d5495
(make-flyspell-overlay): Add help text to flyspell overlays.
Pavel Janík <Pavel@Janik.cz>
parents:
43444
diff
changeset
|
549 ;; we put the `flyspell-deplacement' property on some commands |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
550 (flyspell-deplacement-commands) |
22611 | 551 ;; we bound flyspell action to post-command hook |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
552 (add-hook 'post-command-hook (function flyspell-post-command-hook) t t) |
22611 | 553 ;; we bound flyspell action to pre-command hook |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
554 (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
555 ;; we bound flyspell action to after-change hook |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
556 (make-local-variable 'after-change-functions) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
557 (setq after-change-functions |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
558 (cons 'flyspell-after-change-function after-change-functions)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
559 ;; set flyspell-generic-check-word-p based on the major mode |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
560 (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
561 (if mode-predicate |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
562 (setq flyspell-generic-check-word-p mode-predicate))) |
22611 | 563 ;; the welcome message |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
564 (if (and flyspell-issue-message-flag |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
565 flyspell-issue-welcome-flag |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
566 (interactive-p)) |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
567 (let ((binding (where-is-internal 'flyspell-auto-correct-word |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
568 nil 'non-ascii))) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
569 (message "%s" |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
570 (if binding |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
571 (format "Welcome to flyspell. Use %s or Mouse-2 to correct words." |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
572 (key-description binding)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
573 "Welcome to flyspell. Use Mouse-2 to correct words.")))) |
22611 | 574 ;; we end with the flyspell hooks |
575 (run-hooks 'flyspell-mode-hook)) | |
576 | |
577 ;*---------------------------------------------------------------------*/ | |
578 ;* flyspell-delay-commands ... */ | |
579 ;*---------------------------------------------------------------------*/ | |
580 (defun flyspell-delay-commands () | |
23234 | 581 "Install the standard set of Flyspell delayed commands." |
22611 | 582 (mapcar 'flyspell-delay-command flyspell-default-delayed-commands) |
583 (mapcar 'flyspell-delay-command flyspell-delayed-commands)) | |
584 | |
585 ;*---------------------------------------------------------------------*/ | |
586 ;* flyspell-delay-command ... */ | |
587 ;*---------------------------------------------------------------------*/ | |
588 (defun flyspell-delay-command (command) | |
23234 | 589 "Set COMMAND to be delayed, for Flyspell. |
22611 | 590 When flyspell `post-command-hook' is invoked because a delayed command |
37008 | 591 as been used the current word is not immediately checked. |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
592 It will be checked only after `flyspell-delay' seconds." |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
593 (interactive "SDelay Flyspell after Command: ") |
22611 | 594 (put command 'flyspell-delayed t)) |
595 | |
596 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
597 ;* flyspell-deplacement-commands ... */ |
22611 | 598 ;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
599 (defun flyspell-deplacement-commands () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
600 "Install the standard set of Flyspell deplacement commands." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
601 (mapcar 'flyspell-deplacement-command flyspell-default-deplacement-commands) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
602 (mapcar 'flyspell-deplacement-command flyspell-deplacement-commands)) |
22611 | 603 |
604 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
605 ;* flyspell-deplacement-command ... */ |
22611 | 606 ;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
607 (defun flyspell-deplacement-command (command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
608 "Set COMMAND that implement cursor movements, for Flyspell. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
609 When flyspell `post-command-hook' is invoked because of a deplacement command |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
610 as been used the current word is checked only if the previous command was |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
611 not the very same deplacement command." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
612 (interactive "SDeplacement Flyspell after Command: ") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
613 (put command 'flyspell-deplacement t)) |
22611 | 614 |
615 ;*---------------------------------------------------------------------*/ | |
616 ;* flyspell-word-cache ... */ | |
617 ;*---------------------------------------------------------------------*/ | |
618 (defvar flyspell-word-cache-start nil) | |
619 (defvar flyspell-word-cache-end nil) | |
620 (defvar flyspell-word-cache-word nil) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
621 (defvar flyspell-word-cache-result '_) |
22611 | 622 (make-variable-buffer-local 'flyspell-word-cache-start) |
623 (make-variable-buffer-local 'flyspell-word-cache-end) | |
624 (make-variable-buffer-local 'flyspell-word-cache-word) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
625 (make-variable-buffer-local 'flyspell-word-cache-result) |
22611 | 626 |
627 ;*---------------------------------------------------------------------*/ | |
628 ;* The flyspell pre-hook, store the current position. In the */ | |
629 ;* post command hook, we will check, if the word at this position */ | |
630 ;* has to be spell checked. */ | |
631 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
632 (defvar flyspell-pre-buffer nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
633 (defvar flyspell-pre-point nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
634 (defvar flyspell-pre-column nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
635 (defvar flyspell-pre-pre-buffer nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
636 (defvar flyspell-pre-pre-point nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
637 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
638 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
639 ;* flyspell-previous-command ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
640 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
641 (defvar flyspell-previous-command nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
642 "The last interactive command checked by Flyspell.") |
22611 | 643 |
644 ;*---------------------------------------------------------------------*/ | |
645 ;* flyspell-pre-command-hook ... */ | |
646 ;*---------------------------------------------------------------------*/ | |
647 (defun flyspell-pre-command-hook () | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
648 "Save the current buffer and point for Flyspell's post-command hook." |
22611 | 649 (interactive) |
650 (setq flyspell-pre-buffer (current-buffer)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
651 (setq flyspell-pre-point (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
652 (setq flyspell-pre-column (current-column))) |
22611 | 653 |
654 ;*---------------------------------------------------------------------*/ | |
655 ;* flyspell-mode-off ... */ | |
656 ;*---------------------------------------------------------------------*/ | |
23234 | 657 ;;;###autoload |
22611 | 658 (defun flyspell-mode-off () |
23234 | 659 "Turn Flyspell mode off." |
22611 | 660 ;; we remove the hooks |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
661 (remove-hook 'post-command-hook (function flyspell-post-command-hook) t) |
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
662 (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
663 (setq after-change-functions (delq 'flyspell-after-change-function |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
664 after-change-functions)) |
22611 | 665 ;; we remove all the flyspell hilightings |
666 (flyspell-delete-all-overlays) | |
667 ;; we have to erase pre cache variables | |
668 (setq flyspell-pre-buffer nil) | |
669 (setq flyspell-pre-point nil) | |
670 ;; we mark the mode as killed | |
671 (setq flyspell-mode nil)) | |
672 | |
673 ;*---------------------------------------------------------------------*/ | |
674 ;* flyspell-check-pre-word-p ... */ | |
675 ;*---------------------------------------------------------------------*/ | |
676 (defun flyspell-check-pre-word-p () | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
677 "Return non-nil if we should check the word before point. |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
678 More precisely, it applies to the word that was before point |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
679 before the current command." |
22611 | 680 (cond |
681 ((or (not (numberp flyspell-pre-point)) | |
682 (not (bufferp flyspell-pre-buffer)) | |
683 (not (buffer-live-p flyspell-pre-buffer))) | |
684 nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
685 ((and (eq flyspell-pre-pre-point flyspell-pre-point) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
686 (eq flyspell-pre-pre-buffer flyspell-pre-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
687 nil) |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
688 ((or (and (= flyspell-pre-point (- (point) 1)) |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
689 (eq (char-syntax (char-after flyspell-pre-point)) ?w)) |
22611 | 690 (= flyspell-pre-point (point)) |
691 (= flyspell-pre-point (+ (point) 1))) | |
692 nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
693 ((and (symbolp this-command) |
42684
0dd547dafa5e
(flyspell-check-pre-word-p): Prevent delaying when executing keyboard
Pavel Janík <Pavel@Janik.cz>
parents:
42622
diff
changeset
|
694 (not executing-kbd-macro) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
695 (or (get this-command 'flyspell-delayed) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
696 (and (get this-command 'flyspell-deplacement) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
697 (eq flyspell-previous-command this-command))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
698 (or (= (current-column) 0) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
699 (= (current-column) flyspell-pre-column) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
700 (eq (char-syntax (char-after flyspell-pre-point)) ?w))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
701 nil) |
22611 | 702 ((not (eq (current-buffer) flyspell-pre-buffer)) |
703 t) | |
704 ((not (and (numberp flyspell-word-cache-start) | |
705 (numberp flyspell-word-cache-end))) | |
706 t) | |
707 (t | |
708 (or (< flyspell-pre-point flyspell-word-cache-start) | |
709 (> flyspell-pre-point flyspell-word-cache-end))))) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
710 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
711 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
712 ;* The flyspell after-change-hook, store the change position. In */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
713 ;* the post command hook, we will check, if the word at this */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
714 ;* position has to be spell checked. */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
715 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
716 (defvar flyspell-changes nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
717 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
718 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
719 ;* flyspell-after-change-function ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
720 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
721 (defun flyspell-after-change-function (start stop len) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
722 "Save the current buffer and point for Flyspell's post-command hook." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
723 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
724 (setq flyspell-changes (cons (cons start stop) flyspell-changes))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
725 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
726 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
727 ;* flyspell-check-changed-word-p ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
728 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
729 (defun flyspell-check-changed-word-p (start stop) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
730 "Return t when the changed word has to be checked. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
731 The answer depends of several criteria. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
732 Mostly we check word delimiters." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
733 (cond |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
734 ((and (memq (char-after start) '(?\n ? )) (> stop start)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
735 t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
736 ((not (numberp flyspell-pre-point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
737 t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
738 ((and (>= flyspell-pre-point start) (<= flyspell-pre-point stop)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
739 nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
740 ((let ((pos (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
741 (or (>= pos start) (<= pos stop) (= pos (1+ stop)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
742 nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
743 (t |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
744 t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
745 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
746 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
747 ;* flyspell-check-word-p ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
748 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
749 (defun flyspell-check-word-p () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
750 "Return t when the word at `point' has to be checked. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
751 The answer depends of several criteria. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
752 Mostly we check word delimiters." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
753 (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
754 ((<= (- (point-max) 1) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
755 ;; the buffer is not filled enough |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
756 nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
757 ((and (and (> (current-column) 0) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
758 (not (eq (current-column) flyspell-pre-column))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
759 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
760 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
761 (and (looking-at (flyspell-get-not-casechars)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
762 (or flyspell-consider-dash-as-word-delimiter-flag |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
763 (not (looking-at "\\-")))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
764 ;; yes because we have reached or typed a word delimiter. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
765 t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
766 ((symbolp this-command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
767 (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
768 ((get this-command 'flyspell-deplacement) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
769 (not (eq flyspell-previous-command this-command))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
770 ((get this-command 'flyspell-delayed) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
771 ;; the current command is not delayed, that |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
772 ;; is that we must check the word now |
62976
efec57cea7c7
(flyspell-check-word-p): Simplify silly compatibility code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62870
diff
changeset
|
773 (sit-for flyspell-delay)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
774 (t t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
775 (t t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
776 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
777 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
778 ;* flyspell-debug-signal-no-check ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
779 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
780 (defun flyspell-debug-signal-no-check (msg obj) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
781 (setq debug-on-error t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
782 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
783 (let ((buffer (get-buffer-create "*flyspell-debug*"))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
784 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
785 (erase-buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
786 (insert "NO-CHECK:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
787 (insert (format " %S : %S\n" msg obj))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
788 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
789 ;*---------------------------------------------------------------------*/ |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
790 ;* flyspell-debug-signal-pre-word-checked ... */ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
791 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
792 (defun flyspell-debug-signal-pre-word-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
793 (setq debug-on-error t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
794 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
795 (let ((buffer (get-buffer-create "*flyspell-debug*"))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
796 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
797 (insert "PRE-WORD:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
798 (insert (format " pre-point : %S\n" flyspell-pre-point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
799 (insert (format " pre-buffer : %S\n" flyspell-pre-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
800 (insert (format " cache-start: %S\n" flyspell-word-cache-start)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
801 (insert (format " cache-end : %S\n" flyspell-word-cache-end)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
802 (goto-char (point-max))))) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
803 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
804 ;*---------------------------------------------------------------------*/ |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
805 ;* flyspell-debug-signal-word-checked ... */ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
806 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
807 (defun flyspell-debug-signal-word-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
808 (setq debug-on-error t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
809 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
810 (let ((oldbuf (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
811 (buffer (get-buffer-create "*flyspell-debug*")) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
812 (point (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
813 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
814 (insert "WORD:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
815 (insert (format " this-cmd : %S\n" this-command)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
816 (insert (format " delayed : %S\n" (and (symbolp this-command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
817 (get this-command 'flyspell-delayed)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
818 (insert (format " point : %S\n" point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
819 (insert (format " prev-char : [%c] %S\n" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
820 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
821 (set-buffer oldbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
822 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
823 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
824 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
825 (char-after (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
826 ? ))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
827 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
828 c)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
829 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
830 (set-buffer oldbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
831 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
832 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
833 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
834 (and (and (looking-at (flyspell-get-not-casechars)) 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
835 (and (or flyspell-consider-dash-as-word-delimiter-flag |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
836 (not (looking-at "\\-"))) 2)))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
837 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
838 c)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
839 (insert (format " because : %S\n" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
840 (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
841 ((not (and (symbolp this-command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
842 (get this-command 'flyspell-delayed))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
843 ;; the current command is not delayed, that |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
844 ;; is that we must check the word now |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
845 'not-delayed) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
846 ((progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
847 (set-buffer oldbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
848 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
849 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
850 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
851 (and (looking-at (flyspell-get-not-casechars)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
852 (or flyspell-consider-dash-as-word-delimiter-flag |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
853 (not (looking-at "\\-")))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
854 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
855 c)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
856 ;; yes because we have reached or typed a word delimiter. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
857 'separator) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
858 ((not (integerp flyspell-delay)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
859 ;; yes because the user had set up a no-delay configuration. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
860 'no-delay) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
861 (t |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
862 'sit-for)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
863 (goto-char (point-max))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
864 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
865 ;*---------------------------------------------------------------------*/ |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
866 ;* flyspell-debug-signal-changed-checked ... */ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
867 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
868 (defun flyspell-debug-signal-changed-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
869 (setq debug-on-error t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
870 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
871 (let ((buffer (get-buffer-create "*flyspell-debug*")) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
872 (point (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
873 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
874 (insert "CHANGED WORD:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
875 (insert (format " point : %S\n" point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
876 (goto-char (point-max))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
877 |
22611 | 878 ;*---------------------------------------------------------------------*/ |
879 ;* flyspell-post-command-hook ... */ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
880 ;* ------------------------------------------------------------- */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
881 ;* It is possible that we check several words: */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
882 ;* 1- the current word is checked if the predicate */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
883 ;* FLYSPELL-CHECK-WORD-P is true */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
884 ;* 2- the word that used to be the current word before the */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
885 ;* THIS-COMMAND is checked if: */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
886 ;* a- the previous word is different from the current word */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
887 ;* b- the previous word as not just been checked by the */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
888 ;* previous FLYSPELL-POST-COMMAND-HOOK */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
889 ;* 3- the words changed by the THIS-COMMAND that are neither the */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
890 ;* previous word nor the current word */ |
22611 | 891 ;*---------------------------------------------------------------------*/ |
892 (defun flyspell-post-command-hook () | |
893 "The `post-command-hook' used by flyspell to check a word in-the-fly." | |
894 (interactive) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
895 (let ((command this-command)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
896 (if (flyspell-check-pre-word-p) |
22611 | 897 (save-excursion |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
898 '(flyspell-debug-signal-pre-word-checked) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
899 (set-buffer flyspell-pre-buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
900 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
901 (goto-char flyspell-pre-point) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
902 (flyspell-word)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
903 (if (flyspell-check-word-p) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
904 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
905 '(flyspell-debug-signal-word-checked) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
906 (flyspell-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
907 ;; we remember which word we have just checked. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
908 ;; this will be used next time we will check a word |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
909 ;; to compare the next current word with the word |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
910 ;; that as been registered in the pre-command-hook |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
911 ;; that is these variables are used within the predicate |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
912 ;; FLYSPELL-CHECK-PRE-WORD-P |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
913 (setq flyspell-pre-pre-buffer (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
914 (setq flyspell-pre-pre-point (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
915 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
916 (setq flyspell-pre-pre-buffer nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
917 (setq flyspell-pre-pre-point nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
918 ;; when a word is not checked because of a delayed command |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
919 ;; we do not disable the ispell cache. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
920 (if (and (symbolp this-command) (get this-command 'flyspell-delayed)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
921 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
922 (setq flyspell-word-cache-end -1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
923 (setq flyspell-word-cache-result '_))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
924 (while (consp flyspell-changes) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
925 (let ((start (car (car flyspell-changes))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
926 (stop (cdr (car flyspell-changes)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
927 (if (flyspell-check-changed-word-p start stop) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
928 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
929 '(flyspell-debug-signal-changed-checked) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
930 (goto-char start) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
931 (flyspell-word))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
932 (setq flyspell-changes (cdr flyspell-changes)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
933 (setq flyspell-previous-command command))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
934 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
935 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
936 ;* flyspell-notify-misspell ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
937 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
938 (defun flyspell-notify-misspell (start end word poss) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
939 (let ((replacements (if (stringp poss) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
940 poss |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
941 (if flyspell-sort-corrections |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
942 (sort (car (cdr (cdr poss))) 'string<) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
943 (car (cdr (cdr poss))))))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
944 (if flyspell-issue-message-flag |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
945 (message "mispelling `%s' %S" word replacements)))) |
22611 | 946 |
947 ;*---------------------------------------------------------------------*/ | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
948 ;* flyspell-word-search-backward ... */ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
949 ;*---------------------------------------------------------------------*/ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
950 (defun flyspell-word-search-backward (word bound) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
951 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
952 (let ((r '()) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
953 p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
954 (while (and (not r) (setq p (search-backward word bound t))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
955 (let ((lw (flyspell-get-word '()))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
956 (if (and (consp lw) (string-equal (car lw) word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
957 (setq r p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
958 (goto-char p)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
959 r))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
960 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
961 ;*---------------------------------------------------------------------*/ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
962 ;* flyspell-word-search-forward ... */ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
963 ;*---------------------------------------------------------------------*/ |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
964 (defun flyspell-word-search-forward (word bound) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
965 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
966 (let ((r '()) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
967 p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
968 (while (and (not r) (setq p (search-forward word bound t))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
969 (let ((lw (flyspell-get-word '()))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
970 (if (and (consp lw) (string-equal (car lw) word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
971 (setq r p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
972 (goto-char (1+ p))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
973 r))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
974 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
975 ;*---------------------------------------------------------------------*/ |
22611 | 976 ;* flyspell-word ... */ |
977 ;*---------------------------------------------------------------------*/ | |
978 (defun flyspell-word (&optional following) | |
979 "Spell check a word." | |
57936
10358c7d410b
(flyspell-word): Don't alter FOLLOWING; set it only thru `interactive' spec.
Richard M. Stallman <rms@gnu.org>
parents:
57605
diff
changeset
|
980 (interactive (list ispell-following-word)) |
22611 | 981 (save-excursion |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
982 ;; use the correct dictionary |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
983 (flyspell-accept-buffer-local-defs) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
984 (let* ((cursor-location (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
985 (flyspell-word (flyspell-get-word following)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
986 start end poss word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
987 (if (or (eq flyspell-word nil) |
22611 | 988 (and (fboundp flyspell-generic-check-word-p) |
989 (not (funcall flyspell-generic-check-word-p)))) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
990 t |
22611 | 991 (progn |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
992 ;; destructure return flyspell-word info list. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
993 (setq start (car (cdr flyspell-word)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
994 end (car (cdr (cdr flyspell-word))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
995 word (car flyspell-word)) |
22611 | 996 ;; before checking in the directory, we check for doublons. |
997 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
998 ((and (or (not (eq ispell-parser 'tex)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
999 (and (> start (point-min)) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1000 (not (memq (char-after (1- start)) '(?\} ?\\))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1001 flyspell-mark-duplications-flag |
22611 | 1002 (save-excursion |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1003 (goto-char (1- start)) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1004 (let ((p (flyspell-word-search-backward |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1005 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1006 (- start (1+ (- end start)))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1007 (and p (/= p (1- start)))))) |
22611 | 1008 ;; yes, this is a doublon |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1009 (flyspell-highlight-incorrect-region start end 'doublon) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1010 nil) |
22611 | 1011 ((and (eq flyspell-word-cache-start start) |
1012 (eq flyspell-word-cache-end end) | |
1013 (string-equal flyspell-word-cache-word word)) | |
1014 ;; this word had been already checked, we skip | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1015 flyspell-word-cache-result) |
22611 | 1016 ((and (eq ispell-parser 'tex) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1017 (flyspell-tex-command-p flyspell-word)) |
22611 | 1018 ;; this is a correct word (because a tex command) |
1019 (flyspell-unhighlight-at start) | |
1020 (if (> end start) | |
1021 (flyspell-unhighlight-at (- end 1))) | |
1022 t) | |
1023 (t | |
1024 ;; we setup the cache | |
1025 (setq flyspell-word-cache-start start) | |
1026 (setq flyspell-word-cache-end end) | |
1027 (setq flyspell-word-cache-word word) | |
1028 ;; now check spelling of word. | |
1029 (process-send-string ispell-process "%\n") | |
1030 ;; put in verbose mode | |
1031 (process-send-string ispell-process | |
1032 (concat "^" word "\n")) | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1033 ;; we mark the ispell process so it can be killed |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1034 ;; when emacs is exited without query |
56767
448c214b700f
(flyspell-word): Use set-process-query-on-exit-flag.
Richard M. Stallman <rms@gnu.org>
parents:
56522
diff
changeset
|
1035 (set-process-query-on-exit-flag ispell-process nil) |
22611 | 1036 ;; wait until ispell has processed word |
1037 (while (progn | |
1038 (accept-process-output ispell-process) | |
1039 (not (string= "" (car ispell-filter))))) | |
1040 ;; (process-send-string ispell-process "!\n") | |
1041 ;; back to terse mode. | |
1042 (setq ispell-filter (cdr ispell-filter)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1043 (if (consp ispell-filter) |
22611 | 1044 (setq poss (ispell-parse-output (car ispell-filter)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1045 (let ((res (cond ((eq poss t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1046 ;; correct |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1047 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1048 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1049 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1050 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1051 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1052 ((and (stringp poss) flyspell-highlight-flag) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1053 ;; correct |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1054 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1055 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1056 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1057 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1058 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1059 ((null poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1060 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1061 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1062 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1063 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1064 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1065 ((or (and (< flyspell-duplicate-distance 0) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1066 (or (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1067 (goto-char start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1068 (flyspell-word-search-backward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1069 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1070 (point-min))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1071 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1072 (goto-char end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1073 (flyspell-word-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1074 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1075 (point-max))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1076 (and (> flyspell-duplicate-distance 0) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1077 (or (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1078 (goto-char start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1079 (flyspell-word-search-backward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1080 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1081 (- start |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1082 flyspell-duplicate-distance))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1083 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1084 (goto-char end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1085 (flyspell-word-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1086 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1087 (+ end |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1088 flyspell-duplicate-distance)))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1089 (setq flyspell-word-cache-result nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1090 (if flyspell-highlight-flag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1091 (flyspell-highlight-duplicate-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1092 start end poss) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
1093 (message "duplicate `%s'" word)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1094 nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1095 (t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1096 (setq flyspell-word-cache-result nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1097 ;; incorrect highlight the location |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1098 (if flyspell-highlight-flag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1099 (flyspell-highlight-incorrect-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1100 start end poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1101 (flyspell-notify-misspell start end word poss)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1102 nil)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1103 ;; return to original location |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1104 (goto-char cursor-location) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1105 (if ispell-quit (setq ispell-quit nil)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1106 res)))))))) |
22611 | 1107 |
1108 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1109 ;* flyspell-tex-math-initialized ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1110 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1111 (defvar flyspell-tex-math-initialized nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1112 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1113 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1114 ;* flyspell-math-tex-command-p ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1115 ;* ------------------------------------------------------------- */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1116 ;* This function uses the texmathp package to check if (point) */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1117 ;* is within a tex command. In order to avoid using */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1118 ;* condition-case each time we use the variable */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1119 ;* flyspell-tex-math-initialized to make a special case the first */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1120 ;* time that function is called. */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1121 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1122 (defun flyspell-math-tex-command-p () |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1123 (when (fboundp 'texmathp) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1124 (cond |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1125 (flyspell-check-tex-math-command |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1126 nil) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1127 ((eq flyspell-tex-math-initialized t) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1128 (texmathp)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1129 ((eq flyspell-tex-math-initialized 'error) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1130 nil) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1131 (t |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1132 (setq flyspell-tex-math-initialized t) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1133 (condition-case nil |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1134 (texmathp) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1135 (error (progn |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1136 (setq flyspell-tex-math-initialized 'error) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1137 nil))))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1138 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1139 ;*---------------------------------------------------------------------*/ |
22611 | 1140 ;* flyspell-tex-command-p ... */ |
1141 ;*---------------------------------------------------------------------*/ | |
1142 (defun flyspell-tex-command-p (word) | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1143 "Return t if WORD is a TeX command." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1144 (or (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1145 (let ((b (car (cdr word)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1146 (and (re-search-backward "\\\\" (- (point) 100) t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1147 (or (= (match-end 0) b) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1148 (and (goto-char (match-end 0)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1149 (looking-at flyspell-tex-command-regexp) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1150 (>= (match-end 0) b)))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1151 (flyspell-math-tex-command-p))) |
22611 | 1152 |
1153 ;*---------------------------------------------------------------------*/ | |
1154 ;* flyspell-casechars-cache ... */ | |
1155 ;*---------------------------------------------------------------------*/ | |
1156 (defvar flyspell-casechars-cache nil) | |
1157 (defvar flyspell-ispell-casechars-cache nil) | |
1158 (make-variable-buffer-local 'flyspell-casechars-cache) | |
1159 (make-variable-buffer-local 'flyspell-ispell-casechars-cache) | |
1160 | |
1161 ;*---------------------------------------------------------------------*/ | |
1162 ;* flyspell-get-casechars ... */ | |
1163 ;*---------------------------------------------------------------------*/ | |
1164 (defun flyspell-get-casechars () | |
1165 "This function builds a string that is the regexp of word chars. | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1166 In order to avoid one useless string construction, |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1167 this function changes the last char of the `ispell-casechars' string." |
22611 | 1168 (let ((ispell-casechars (ispell-get-casechars))) |
1169 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1170 ((eq ispell-parser 'tex) |
22611 | 1171 (setq flyspell-ispell-casechars-cache ispell-casechars) |
1172 (setq flyspell-casechars-cache | |
1173 (concat (substring ispell-casechars | |
1174 0 | |
1175 (- (length ispell-casechars) 1)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1176 "]")) |
22611 | 1177 flyspell-casechars-cache) |
1178 (t | |
1179 (setq flyspell-ispell-casechars-cache ispell-casechars) | |
1180 (setq flyspell-casechars-cache ispell-casechars) | |
1181 flyspell-casechars-cache)))) | |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1182 |
22611 | 1183 ;*---------------------------------------------------------------------*/ |
1184 ;* flyspell-get-not-casechars-cache ... */ | |
1185 ;*---------------------------------------------------------------------*/ | |
1186 (defvar flyspell-not-casechars-cache nil) | |
1187 (defvar flyspell-ispell-not-casechars-cache nil) | |
1188 (make-variable-buffer-local 'flyspell-not-casechars-cache) | |
1189 (make-variable-buffer-local 'flyspell-ispell-not-casechars-cache) | |
1190 | |
1191 ;*---------------------------------------------------------------------*/ | |
1192 ;* flyspell-get-not-casechars ... */ | |
1193 ;*---------------------------------------------------------------------*/ | |
1194 (defun flyspell-get-not-casechars () | |
1195 "This function builds a string that is the regexp of non-word chars." | |
1196 (let ((ispell-not-casechars (ispell-get-not-casechars))) | |
1197 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1198 ((eq ispell-parser 'tex) |
22611 | 1199 (setq flyspell-ispell-not-casechars-cache ispell-not-casechars) |
1200 (setq flyspell-not-casechars-cache | |
1201 (concat (substring ispell-not-casechars | |
1202 0 | |
1203 (- (length ispell-not-casechars) 1)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1204 "]")) |
22611 | 1205 flyspell-not-casechars-cache) |
1206 (t | |
1207 (setq flyspell-ispell-not-casechars-cache ispell-not-casechars) | |
1208 (setq flyspell-not-casechars-cache ispell-not-casechars) | |
1209 flyspell-not-casechars-cache)))) | |
1210 | |
1211 ;*---------------------------------------------------------------------*/ | |
1212 ;* flyspell-get-word ... */ | |
1213 ;*---------------------------------------------------------------------*/ | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1214 (defun flyspell-get-word (following &optional extra-otherchars) |
22611 | 1215 "Return the word for spell-checking according to Ispell syntax. |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1216 If optional argument FOLLOWING is non-nil or if `flyspell-following-word' |
22611 | 1217 is non-nil when called interactively, then the following word |
1218 \(rather than preceding\) is checked when the cursor is not over a word. | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1219 Optional second argument contains otherchars that can be included in word |
22611 | 1220 many times. |
1221 | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1222 Word syntax described by `flyspell-dictionary-alist' (which see)." |
22611 | 1223 (let* ((flyspell-casechars (flyspell-get-casechars)) |
1224 (flyspell-not-casechars (flyspell-get-not-casechars)) | |
1225 (ispell-otherchars (ispell-get-otherchars)) | |
1226 (ispell-many-otherchars-p (ispell-get-many-otherchars-p)) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1227 (word-regexp (concat flyspell-casechars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1228 "+\\(" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1229 (if (not (string= "" ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1230 (concat ispell-otherchars "?")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1231 (if extra-otherchars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1232 (concat extra-otherchars "?")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1233 flyspell-casechars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1234 "+\\)" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1235 (if (or ispell-many-otherchars-p |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1236 extra-otherchars) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1237 "*" "?"))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1238 did-it-once prevpt |
22611 | 1239 start end word) |
1240 ;; find the word | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1241 (if (not (looking-at flyspell-casechars)) |
22611 | 1242 (if following |
1243 (re-search-forward flyspell-casechars (point-max) t) | |
1244 (re-search-backward flyspell-casechars (point-min) t))) | |
1245 ;; move to front of word | |
1246 (re-search-backward flyspell-not-casechars (point-min) 'start) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1247 (while (and (or (and (not (string= "" ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1248 (looking-at ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1249 (and extra-otherchars (looking-at extra-otherchars))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1250 (not (bobp)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1251 (or (not did-it-once) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1252 ispell-many-otherchars-p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1253 (not (eq prevpt (point)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1254 (if (and extra-otherchars (looking-at extra-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1255 (progn |
24943
59585a4135a6
(flyspell-get-word): Add special handling for when ispell-otherchars is empty.
Richard M. Stallman <rms@gnu.org>
parents:
24458
diff
changeset
|
1256 (backward-char 1) |
59585a4135a6
(flyspell-get-word): Add special handling for when ispell-otherchars is empty.
Richard M. Stallman <rms@gnu.org>
parents:
24458
diff
changeset
|
1257 (if (looking-at flyspell-casechars) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1258 (re-search-backward flyspell-not-casechars (point-min) 'move))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1259 (setq did-it-once t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1260 prevpt (point)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1261 (backward-char 1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1262 (if (looking-at flyspell-casechars) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1263 (re-search-backward flyspell-not-casechars (point-min) 'move) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1264 (backward-char -1)))) |
22611 | 1265 ;; Now mark the word and save to string. |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1266 (if (not (re-search-forward word-regexp (point-max) t)) |
22611 | 1267 nil |
1268 (progn | |
1269 (setq start (match-beginning 0) | |
1270 end (point) | |
36129
4c28e9406f50
(flyspell-get-word): Return string without
Dave Love <fx@gnu.org>
parents:
36120
diff
changeset
|
1271 word (buffer-substring-no-properties start end)) |
22611 | 1272 (list word start end))))) |
1273 | |
1274 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1275 ;* flyspell-small-region ... */ |
22611 | 1276 ;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1277 (defun flyspell-small-region (beg end) |
22611 | 1278 "Flyspell text between BEG and END." |
1279 (save-excursion | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1280 (if (> beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1281 (let ((old beg)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1282 (setq beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1283 (setq end old))) |
22611 | 1284 (goto-char beg) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1285 (let ((count 0)) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1286 (while (< (point) end) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1287 (if (and flyspell-issue-message-flag (= count 100)) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1288 (progn |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1289 (message "Spell Checking...%d%%" |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1290 (* 100 (/ (float (- (point) beg)) (- end beg)))) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1291 (setq count 0)) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1292 (setq count (+ 1 count))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1293 (flyspell-word) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1294 (sit-for 0) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1295 (let ((cur (point))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1296 (forward-word 1) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1297 (if (and (< (point) end) (> (point) (+ cur 1))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1298 (backward-char 1))))) |
22611 | 1299 (backward-char 1) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1300 (if flyspell-issue-message-flag (message "Spell Checking completed.")) |
22611 | 1301 (flyspell-word))) |
1302 | |
1303 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1304 ;* flyspell-external-ispell-process ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1305 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1306 (defvar flyspell-external-ispell-process '() |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
1307 "The external Flyspell Ispell process.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1308 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1309 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1310 ;* flyspell-external-ispell-buffer ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1311 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1312 (defvar flyspell-external-ispell-buffer '()) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1313 (defvar flyspell-large-region-buffer '()) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1314 (defvar flyspell-large-region-beg (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1315 (defvar flyspell-large-region-end (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1316 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1317 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1318 ;* flyspell-external-point-words ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1319 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1320 (defun flyspell-external-point-words () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1321 (let ((buffer flyspell-external-ispell-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1322 (set-buffer buffer) |
58001
f6e978fdd3ed
(flyspell-external-point-words): Use goto-char instead of beginning-of-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
57936
diff
changeset
|
1323 (goto-char (point-min)) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1324 (let ((pword "") |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1325 (pcount 1)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1326 ;; now we are done with ispell, we have to find the word in |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1327 ;; the initial buffer |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1328 (while (< (point) (- (point-max) 1)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1329 ;; we have to fetch the incorrect word |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1330 (if (re-search-forward "\\([^\n]+\\)\n" (point-max) t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1331 (let ((word (match-string 1))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1332 (if (string= word pword) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1333 (setq pcount (1+ pcount)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1334 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1335 (setq pword word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1336 (setq pcount 1))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1337 (goto-char (match-end 0)) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1338 (if flyspell-issue-message-flag |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1339 (message "Spell Checking...%d%% [%s]" |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1340 (* 100 (/ (float (point)) (point-max))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1341 word)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1342 (set-buffer flyspell-large-region-buffer) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1343 (goto-char flyspell-large-region-beg) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1344 (let ((keep t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1345 (n 0)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1346 (while (and (or (< n pcount) keep) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1347 (search-forward word flyspell-large-region-end t)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1348 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1349 (goto-char (- (point) 1)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1350 (setq n (1+ n)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1351 (setq keep (flyspell-word)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1352 (if (= n pcount) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1353 (setq flyspell-large-region-beg (point)))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1354 (set-buffer buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1355 (goto-char (point-max))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1356 ;; we are done |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1357 (if flyspell-issue-message-flag (message "Spell Checking completed.")) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1358 ;; ok, we are done with pointing out incorrect words, we just |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1359 ;; have to kill the temporary buffer |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1360 (kill-buffer flyspell-external-ispell-buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1361 (setq flyspell-external-ispell-buffer nil))) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1362 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1363 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1364 ;* flyspell-large-region ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1365 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1366 (defun flyspell-large-region (beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1367 (let* ((curbuf (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1368 (buffer (get-buffer-create "*flyspell-region*"))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1369 (setq flyspell-external-ispell-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1370 (setq flyspell-large-region-buffer curbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1371 (setq flyspell-large-region-beg beg) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1372 (setq flyspell-large-region-end end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1373 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1374 (erase-buffer) |
37008 | 1375 ;; this is done, we can start checking... |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1376 (if flyspell-issue-message-flag (message "Checking region...")) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1377 (set-buffer curbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1378 (let ((c (apply 'call-process-region beg |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1379 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1380 ispell-program-name |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1381 nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1382 buffer |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1383 nil |
60459
7d534323afd2
(flyspell-large-region): Pass args differently for aspell.
Richard M. Stallman <rms@gnu.org>
parents:
60283
diff
changeset
|
1384 (if ispell-really-aspell "list" "-l") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1385 (let (args) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1386 ;; Local dictionary becomes the global dictionary in use. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1387 (if ispell-local-dictionary |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1388 (setq ispell-dictionary ispell-local-dictionary)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1389 (setq args (ispell-get-ispell-args)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1390 (if ispell-dictionary ; use specified dictionary |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1391 (setq args |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1392 (append (list "-d" ispell-dictionary) args))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1393 (if ispell-personal-dictionary ; use specified pers dict |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1394 (setq args |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1395 (append args |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1396 (list "-p" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1397 (expand-file-name |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1398 ispell-personal-dictionary))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1399 (setq args (append args ispell-extra-args)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1400 args)))) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53420
diff
changeset
|
1401 (if (eq c 0) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1402 (flyspell-external-point-words) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1403 (error "Can't check region..."))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1404 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1405 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1406 ;* flyspell-region ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1407 ;* ------------------------------------------------------------- */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1408 ;* Because `ispell -a' is too slow, it is not possible to use */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1409 ;* it on large region. Then, when ispell is invoked on a large */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1410 ;* text region, a new `ispell -l' process is spawned. The */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1411 ;* pointed out words are then searched in the region a checked with */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1412 ;* regular flyspell means. */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1413 ;*---------------------------------------------------------------------*/ |
36120
927cbaaa27f8
(flyspell-region, flyspell-buffer):
Gerd Moellmann <gerd@gnu.org>
parents:
35617
diff
changeset
|
1414 ;;;###autoload |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1415 (defun flyspell-region (beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1416 "Flyspell text between BEG and END." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1417 (interactive "r") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1418 (if (= beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1419 () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1420 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1421 (if (> beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1422 (let ((old beg)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1423 (setq beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1424 (setq end old))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1425 (if (and flyspell-large-region (> (- end beg) flyspell-large-region)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1426 (flyspell-large-region beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1427 (flyspell-small-region beg end))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1428 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1429 ;*---------------------------------------------------------------------*/ |
22611 | 1430 ;* flyspell-buffer ... */ |
1431 ;*---------------------------------------------------------------------*/ | |
36120
927cbaaa27f8
(flyspell-region, flyspell-buffer):
Gerd Moellmann <gerd@gnu.org>
parents:
35617
diff
changeset
|
1432 ;;;###autoload |
22611 | 1433 (defun flyspell-buffer () |
1434 "Flyspell whole buffer." | |
1435 (interactive) | |
1436 (flyspell-region (point-min) (point-max))) | |
1437 | |
1438 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1439 ;* old next error position ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1440 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1441 (defvar flyspell-old-buffer-error nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1442 (defvar flyspell-old-pos-error nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1443 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1444 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1445 ;* flyspell-goto-next-error ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1446 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1447 (defun flyspell-goto-next-error () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1448 "Go to the next previously detected error. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1449 In general FLYSPELL-GOTO-NEXT-ERROR must be used after |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1450 FLYSPELL-BUFFER." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1451 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1452 (let ((pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1453 (max (point-max))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1454 (if (and (eq (current-buffer) flyspell-old-buffer-error) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1455 (eq pos flyspell-old-pos-error)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1456 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1457 (if (= flyspell-old-pos-error max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1458 ;; goto beginning of buffer |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1459 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1460 (message "Restarting from beginning of buffer") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1461 (goto-char (point-min))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1462 (forward-word 1)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1463 (setq pos (point)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1464 ;; seek the next error |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1465 (while (and (< pos max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1466 (let ((ovs (overlays-at pos)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1467 (r '())) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1468 (while (and (not r) (consp ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1469 (if (flyspell-overlay-p (car ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1470 (setq r t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1471 (setq ovs (cdr ovs)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1472 (not r))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1473 (setq pos (1+ pos))) |
37008 | 1474 ;; save the current location for next invocation |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1475 (setq flyspell-old-pos-error pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1476 (setq flyspell-old-buffer-error (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1477 (goto-char pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1478 (if (= pos max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1479 (message "No more miss-spelled word!")))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1480 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1481 ;*---------------------------------------------------------------------*/ |
22611 | 1482 ;* flyspell-overlay-p ... */ |
1483 ;*---------------------------------------------------------------------*/ | |
1484 (defun flyspell-overlay-p (o) | |
1485 "A predicate that return true iff O is an overlay used by flyspell." | |
1486 (and (overlayp o) (overlay-get o 'flyspell-overlay))) | |
1487 | |
1488 ;*---------------------------------------------------------------------*/ | |
1489 ;* flyspell-delete-all-overlays ... */ | |
1490 ;* ------------------------------------------------------------- */ | |
1491 ;* Remove all the overlays introduced by flyspell. */ | |
1492 ;*---------------------------------------------------------------------*/ | |
1493 (defun flyspell-delete-all-overlays () | |
1494 "Delete all the overlays used by flyspell." | |
1495 (let ((l (overlays-in (point-min) (point-max)))) | |
1496 (while (consp l) | |
1497 (progn | |
1498 (if (flyspell-overlay-p (car l)) | |
1499 (delete-overlay (car l))) | |
1500 (setq l (cdr l)))))) | |
1501 | |
1502 ;*---------------------------------------------------------------------*/ | |
1503 ;* flyspell-unhighlight-at ... */ | |
1504 ;*---------------------------------------------------------------------*/ | |
1505 (defun flyspell-unhighlight-at (pos) | |
1506 "Remove the flyspell overlay that are located at POS." | |
1507 (if flyspell-persistent-highlight | |
1508 (let ((overlays (overlays-at pos))) | |
1509 (while (consp overlays) | |
1510 (if (flyspell-overlay-p (car overlays)) | |
1511 (delete-overlay (car overlays))) | |
1512 (setq overlays (cdr overlays)))) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1513 (if (flyspell-overlay-p flyspell-overlay) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1514 (delete-overlay flyspell-overlay)))) |
22611 | 1515 |
1516 ;*---------------------------------------------------------------------*/ | |
1517 ;* flyspell-properties-at-p ... */ | |
1518 ;* ------------------------------------------------------------- */ | |
1519 ;* Is there an highlight properties at position pos? */ | |
1520 ;*---------------------------------------------------------------------*/ | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1521 (defun flyspell-properties-at-p (pos) |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1522 "Return t if there is a text property at POS, not counting `local-map'. |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1523 If variable `flyspell-highlight-properties' is set to nil, |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1524 text with properties are not checked. This function is used to discover |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1525 if the character at POS has any other property." |
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1526 (let ((prop (text-properties-at pos)) |
22611 | 1527 (keep t)) |
1528 (while (and keep (consp prop)) | |
1529 (if (and (eq (car prop) 'local-map) (consp (cdr prop))) | |
1530 (setq prop (cdr (cdr prop))) | |
1531 (setq keep nil))) | |
1532 (consp prop))) | |
1533 | |
1534 ;*---------------------------------------------------------------------*/ | |
1535 ;* make-flyspell-overlay ... */ | |
1536 ;*---------------------------------------------------------------------*/ | |
1537 (defun make-flyspell-overlay (beg end face mouse-face) | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1538 "Allocate an overlay to highlight an incorrect word. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1539 BEG and END specify the range in the buffer of that word. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1540 FACE and MOUSE-FACE specify the `face' and `mouse-face' properties |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1541 for the overlay." |
24076
6236e60302e2
(make-flyspell-overlay): fix front stickiness.
Richard M. Stallman <rms@gnu.org>
parents:
23943
diff
changeset
|
1542 (let ((flyspell-overlay (make-overlay beg end nil t nil))) |
22611 | 1543 (overlay-put flyspell-overlay 'face face) |
1544 (overlay-put flyspell-overlay 'mouse-face mouse-face) | |
1545 (overlay-put flyspell-overlay 'flyspell-overlay t) | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1546 (overlay-put flyspell-overlay 'evaporate t) |
45184
fe852d8d5495
(make-flyspell-overlay): Add help text to flyspell overlays.
Pavel Janík <Pavel@Janik.cz>
parents:
43444
diff
changeset
|
1547 (overlay-put flyspell-overlay 'help-echo "mouse-2: correct word at point") |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
1548 (overlay-put flyspell-overlay 'keymap flyspell-mouse-map) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1549 (when (eq face 'flyspell-incorrect) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1550 (and (stringp flyspell-before-incorrect-word-string) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1551 (overlay-put flyspell-overlay 'before-string |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1552 flyspell-before-incorrect-word-string)) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1553 (and (stringp flyspell-after-incorrect-word-string) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1554 (overlay-put flyspell-overlay 'after-string |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1555 flyspell-after-incorrect-word-string))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1556 flyspell-overlay)) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1557 |
22611 | 1558 ;*---------------------------------------------------------------------*/ |
1559 ;* flyspell-highlight-incorrect-region ... */ | |
1560 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1561 (defun flyspell-highlight-incorrect-region (beg end poss) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1562 "Set up an overlay on a misspelled word, in the buffer from BEG to END." |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1563 (let ((inhibit-read-only t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1564 (unless (run-hook-with-args-until-success |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1565 'flyspell-incorrect-hook beg end poss) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1566 (if (or flyspell-highlight-properties |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1567 (not (flyspell-properties-at-p beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1568 (progn |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1569 ;; we cleanup all the overlay that are in the region, not |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1570 ;; beginning at the word start position |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1571 (if (< (1+ beg) end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1572 (let ((os (overlays-in (1+ beg) end))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1573 (while (consp os) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1574 (if (flyspell-overlay-p (car os)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1575 (delete-overlay (car os))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1576 (setq os (cdr os))))) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1577 ;; we cleanup current overlay at the same position |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1578 (if (and (not flyspell-persistent-highlight) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1579 (overlayp flyspell-overlay)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1580 (delete-overlay flyspell-overlay) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1581 (let ((os (overlays-at beg))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1582 (while (consp os) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1583 (if (flyspell-overlay-p (car os)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1584 (delete-overlay (car os))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1585 (setq os (cdr os))))) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1586 ;; now we can use a new overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1587 (setq flyspell-overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1588 (make-flyspell-overlay |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1589 beg end 'flyspell-incorrect 'highlight))))))) |
22611 | 1590 |
1591 ;*---------------------------------------------------------------------*/ | |
1592 ;* flyspell-highlight-duplicate-region ... */ | |
1593 ;*---------------------------------------------------------------------*/ | |
56767
448c214b700f
(flyspell-word): Use set-process-query-on-exit-flag.
Richard M. Stallman <rms@gnu.org>
parents:
56522
diff
changeset
|
1594 (defun flyspell-highlight-duplicate-region (beg end poss) |
448c214b700f
(flyspell-word): Use set-process-query-on-exit-flag.
Richard M. Stallman <rms@gnu.org>
parents:
56522
diff
changeset
|
1595 "Set up an overlay on a duplicated word, in the buffer from BEG to END. |
448c214b700f
(flyspell-word): Use set-process-query-on-exit-flag.
Richard M. Stallman <rms@gnu.org>
parents:
56522
diff
changeset
|
1596 ??? What does POSS mean?" |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1597 (let ((inhibit-read-only t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1598 (unless (run-hook-with-args-until-success |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1599 'flyspell-incorrect-hook beg end poss) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1600 (if (or flyspell-highlight-properties |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1601 (not (flyspell-properties-at-p beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1602 (progn |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1603 ;; we cleanup current overlay at the same position |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1604 (if (and (not flyspell-persistent-highlight) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1605 (overlayp flyspell-overlay)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1606 (delete-overlay flyspell-overlay) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1607 (let ((overlays (overlays-at beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1608 (while (consp overlays) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1609 (if (flyspell-overlay-p (car overlays)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1610 (delete-overlay (car overlays))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1611 (setq overlays (cdr overlays))))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1612 ;; now we can use a new overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1613 (setq flyspell-overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1614 (make-flyspell-overlay beg end |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1615 'flyspell-duplicate |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1616 'highlight))))))) |
22611 | 1617 |
1618 ;*---------------------------------------------------------------------*/ | |
1619 ;* flyspell-auto-correct-cache ... */ | |
1620 ;*---------------------------------------------------------------------*/ | |
1621 (defvar flyspell-auto-correct-pos nil) | |
1622 (defvar flyspell-auto-correct-region nil) | |
1623 (defvar flyspell-auto-correct-ring nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1624 (defvar flyspell-auto-correct-word nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1625 (make-variable-buffer-local 'flyspell-auto-correct-pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1626 (make-variable-buffer-local 'flyspell-auto-correct-region) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1627 (make-variable-buffer-local 'flyspell-auto-correct-ring) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1628 (make-variable-buffer-local 'flyspell-auto-correct-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1629 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1630 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1631 ;* flyspell-check-previous-highlighted-word ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1632 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1633 (defun flyspell-check-previous-highlighted-word (&optional arg) |
37008 | 1634 "Correct the closer misspelled word. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1635 This function scans a mis-spelled word before the cursor. If it finds one |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1636 it proposes replacement for that word. With prefix arg, count that many |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1637 misspelled words backwards." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1638 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1639 (let ((pos1 (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1640 (pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1641 (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1642 ov ovs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1643 (if (catch 'exit |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1644 (while (and (setq pos (previous-overlay-change pos)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1645 (not (= pos pos1))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1646 (setq pos1 pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1647 (if (> pos (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1648 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1649 (setq ovs (overlays-at (1- pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1650 (while (consp ovs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1651 (setq ov (car ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1652 (setq ovs (cdr ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1653 (if (and (overlay-get ov 'flyspell-overlay) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1654 (= 0 (setq arg (1- arg)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1655 (throw 'exit t))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1656 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1657 (goto-char pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1658 (ispell-word)) |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
1659 (error "No word to correct before point")))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1660 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1661 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1662 ;* flyspell-display-next-corrections ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1663 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1664 (defun flyspell-display-next-corrections (corrections) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1665 (let ((string "Corrections:") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1666 (l corrections) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1667 (pos '())) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1668 (while (< (length string) 80) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1669 (if (equal (car l) flyspell-auto-correct-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1670 (setq pos (cons (+ 1 (length string)) pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1671 (setq string (concat string " " (car l))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1672 (setq l (cdr l))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1673 (while (consp pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1674 (let ((num (car pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1675 (put-text-property num |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1676 (+ num (length flyspell-auto-correct-word)) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1677 'face 'flyspell-incorrect |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1678 string)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1679 (setq pos (cdr pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1680 (if (fboundp 'display-message) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1681 (display-message 'no-log string) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
1682 (message "%s" string)))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1683 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1684 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1685 ;* flyspell-abbrev-table ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1686 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1687 (defun flyspell-abbrev-table () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1688 (if flyspell-use-global-abbrev-table-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1689 global-abbrev-table |
53420
95e0a0bdebb2
(mail-mode-flyspell-verify): Search for header separator alone on a
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
1690 (or local-abbrev-table global-abbrev-table))) |
22611 | 1691 |
1692 ;*---------------------------------------------------------------------*/ | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1693 ;* flyspell-define-abbrev ... */ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1694 ;*---------------------------------------------------------------------*/ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1695 (defun flyspell-define-abbrev (name expansion) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1696 (let ((table (flyspell-abbrev-table))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1697 (when table |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1698 (define-abbrev table name expansion)))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1699 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1700 ;*---------------------------------------------------------------------*/ |
22611 | 1701 ;* flyspell-auto-correct-word ... */ |
1702 ;*---------------------------------------------------------------------*/ | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1703 (defun flyspell-auto-correct-word () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1704 "Correct the current word. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1705 This command proposes various successive corrections for the current word." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1706 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1707 (let ((pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1708 (old-max (point-max))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1709 ;; use the correct dictionary |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1710 (flyspell-accept-buffer-local-defs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1711 (if (and (eq flyspell-auto-correct-pos pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1712 (consp flyspell-auto-correct-region)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1713 ;; we have already been using the function at the same location |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1714 (let* ((start (car flyspell-auto-correct-region)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1715 (len (cdr flyspell-auto-correct-region))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1716 (flyspell-unhighlight-at start) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1717 (delete-region start (+ start len)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1718 (setq flyspell-auto-correct-ring (cdr flyspell-auto-correct-ring)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1719 (let* ((word (car flyspell-auto-correct-ring)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1720 (len (length word))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1721 (rplacd flyspell-auto-correct-region len) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1722 (goto-char start) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1723 (if flyspell-abbrev-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1724 (if (flyspell-already-abbrevp (flyspell-abbrev-table) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1725 flyspell-auto-correct-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1726 (flyspell-change-abbrev (flyspell-abbrev-table) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1727 flyspell-auto-correct-word |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1728 word) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1729 (flyspell-define-abbrev flyspell-auto-correct-word word))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1730 (funcall flyspell-insert-function word) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1731 (flyspell-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1732 (flyspell-display-next-corrections flyspell-auto-correct-ring)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1733 (flyspell-ajust-cursor-point pos (point) old-max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1734 (setq flyspell-auto-correct-pos (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1735 ;; fetch the word to be checked |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1736 (let ((word (flyspell-get-word nil))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1737 (if (consp word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1738 (let ((start (car (cdr word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1739 (end (car (cdr (cdr word)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1740 (word (car word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1741 poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1742 (setq flyspell-auto-correct-word word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1743 ;; now check spelling of word. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1744 (process-send-string ispell-process "%\n") ;put in verbose mode |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1745 (process-send-string ispell-process (concat "^" word "\n")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1746 ;; wait until ispell has processed word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1747 (while (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1748 (accept-process-output ispell-process) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1749 (not (string= "" (car ispell-filter))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1750 (setq ispell-filter (cdr ispell-filter)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1751 (if (consp ispell-filter) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1752 (setq poss (ispell-parse-output (car ispell-filter)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1753 (cond |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1754 ((or (eq poss t) (stringp poss)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1755 ;; don't correct word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1756 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1757 ((null poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1758 ;; ispell error |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1759 (error "Ispell: error in Ispell process")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1760 (t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1761 ;; the word is incorrect, we have to propose a replacement |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1762 (let ((replacements (if flyspell-sort-corrections |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1763 (sort (car (cdr (cdr poss))) 'string<) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1764 (car (cdr (cdr poss)))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1765 (setq flyspell-auto-correct-region nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1766 (if (consp replacements) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1767 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1768 (let ((replace (car replacements))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1769 (let ((new-word replace)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1770 (if (not (equal new-word (car poss))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1771 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1772 ;; the save the current replacements |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1773 (setq flyspell-auto-correct-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1774 (cons start (length new-word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1775 (let ((l replacements)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1776 (while (consp (cdr l)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1777 (setq l (cdr l))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1778 (rplacd l (cons (car poss) replacements))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1779 (setq flyspell-auto-correct-ring |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1780 replacements) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1781 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1782 (delete-region start end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1783 (funcall flyspell-insert-function new-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1784 (if flyspell-abbrev-p |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1785 (if (flyspell-already-abbrevp |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1786 (flyspell-abbrev-table) word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1787 (flyspell-change-abbrev |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1788 (flyspell-abbrev-table) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1789 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1790 new-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1791 (flyspell-define-abbrev word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1792 new-word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1793 (flyspell-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1794 (flyspell-display-next-corrections |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1795 (cons new-word flyspell-auto-correct-ring)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1796 (flyspell-ajust-cursor-point pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1797 (point) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1798 old-max)))))))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1799 (setq flyspell-auto-correct-pos (point)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1800 (ispell-pdict-save t))))))) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1801 |
22611 | 1802 ;*---------------------------------------------------------------------*/ |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1803 ;* flyspell-auto-correct-previous-pos ... */ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1804 ;*---------------------------------------------------------------------*/ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1805 (defvar flyspell-auto-correct-previous-pos nil |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1806 "Holds the start of the first incorrect word before point.") |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1807 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1808 ;*---------------------------------------------------------------------*/ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1809 ;* flyspell-auto-correct-previous-hook ... */ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1810 ;*---------------------------------------------------------------------*/ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1811 (defun flyspell-auto-correct-previous-hook () |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1812 "Hook to track successive calls to `flyspell-auto-correct-previous-word'. |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1813 Sets `flyspell-auto-correct-previous-pos' to nil" |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1814 (interactive) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1815 (remove-hook 'pre-command-hook (function flyspell-auto-correct-previous-hook) t) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1816 (unless (eq this-command (function flyspell-auto-correct-previous-word)) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1817 (setq flyspell-auto-correct-previous-pos nil))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1818 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1819 ;*---------------------------------------------------------------------*/ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1820 ;* flyspell-auto-correct-previous-word ... */ |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1821 ;*---------------------------------------------------------------------*/ |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1822 (defun flyspell-auto-correct-previous-word (position) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1823 "*Auto correct the first mispelled word that occurs before point. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1824 But don't look beyond what's visible on the screen." |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1825 (interactive "d") |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1826 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1827 (let (top bot) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1828 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1829 (move-to-window-line 0) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1830 (setq top (point)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1831 (move-to-window-line -1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1832 (setq bot (point))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1833 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1834 (save-restriction |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1835 (narrow-to-region top bot) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1836 (overlay-recenter (point)) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1837 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1838 (add-hook 'pre-command-hook |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1839 (function flyspell-auto-correct-previous-hook) t t) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1840 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1841 (unless flyspell-auto-correct-previous-pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1842 ;; only reset if a new overlay exists |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1843 (setq flyspell-auto-correct-previous-pos nil) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1844 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1845 (let ((overlay-list (overlays-in (point-min) position)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1846 (new-overlay 'dummy-value)) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1847 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1848 ;; search for previous (new) flyspell overlay |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1849 (while (and new-overlay |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1850 (or (not (flyspell-overlay-p new-overlay)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1851 ;; check if its face has changed |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1852 (not (eq (get-char-property |
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1853 (overlay-start new-overlay) 'face) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1854 'flyspell-incorrect)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1855 (setq new-overlay (car-safe overlay-list)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1856 (setq overlay-list (cdr-safe overlay-list))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1857 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1858 ;; if nothing new exits new-overlay should be nil |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1859 (if new-overlay ;; the length of the word may change so go to the start |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1860 (setq flyspell-auto-correct-previous-pos |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1861 (overlay-start new-overlay))))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1862 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1863 (when flyspell-auto-correct-previous-pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1864 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1865 (goto-char flyspell-auto-correct-previous-pos) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1866 (let ((ispell-following-word t)) ;; point is at start |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1867 (if (numberp flyspell-auto-correct-previous-pos) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1868 (goto-char flyspell-auto-correct-previous-pos)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1869 (flyspell-auto-correct-word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1870 ;; the point may have moved so reset this |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1871 (setq flyspell-auto-correct-previous-pos (point)))))))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1872 |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1873 ;*---------------------------------------------------------------------*/ |
22611 | 1874 ;* flyspell-correct-word ... */ |
1875 ;*---------------------------------------------------------------------*/ | |
1876 (defun flyspell-correct-word (event) | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1877 "Pop up a menu of possible corrections for a misspelled word. |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1878 The word checked is the word at the mouse position." |
22611 | 1879 (interactive "e") |
1880 ;; use the correct dictionary | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1881 (flyspell-accept-buffer-local-defs) |
22611 | 1882 ;; retain cursor location (I don't know why but save-excursion here fails). |
1883 (let ((save (point))) | |
1884 (mouse-set-point event) | |
1885 (let ((cursor-location (point)) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1886 (word (flyspell-get-word nil))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1887 (if (consp word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1888 (let ((start (car (cdr word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1889 (end (car (cdr (cdr word)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1890 (word (car word)) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1891 poss) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1892 ;; now check spelling of word. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1893 (process-send-string ispell-process "%\n") ;put in verbose mode |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1894 (process-send-string ispell-process (concat "^" word "\n")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1895 ;; wait until ispell has processed word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1896 (while (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1897 (accept-process-output ispell-process) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1898 (not (string= "" (car ispell-filter))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1899 (setq ispell-filter (cdr ispell-filter)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1900 (if (consp ispell-filter) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1901 (setq poss (ispell-parse-output (car ispell-filter)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1902 (cond |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1903 ((or (eq poss t) (stringp poss)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1904 ;; don't correct word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1905 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1906 ((null poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1907 ;; ispell error |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1908 (error "Ispell: error in Ispell process")) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1909 ((featurep 'xemacs) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1910 (flyspell-xemacs-popup |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1911 event poss word cursor-location start end save)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1912 (t |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1913 ;; The word is incorrect, we have to propose a replacement. |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1914 (flyspell-do-correct (flyspell-emacs-popup event poss word) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1915 poss word cursor-location start end save))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1916 (ispell-pdict-save t)))))) |
22611 | 1917 |
1918 ;*---------------------------------------------------------------------*/ | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1919 ;* flyspell-do-correct ... */ |
22611 | 1920 ;*---------------------------------------------------------------------*/ |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1921 (defun flyspell-do-correct (replace poss word cursor-location start end save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1922 "The popup menu callback." |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1923 ;; Originally, the XEmacs code didn't do the (goto-char save) here and did |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1924 ;; it instead right after calling the function. |
22611 | 1925 (cond ((eq replace 'ignore) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1926 (goto-char save) |
22611 | 1927 nil) |
1928 ((eq replace 'save) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1929 (goto-char save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1930 (ispell-send-string (concat "*" word "\n")) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1931 ;; This was added only to the XEmacs side in revision 1.18 of |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1932 ;; flyspell. I assume its absence on the Emacs side was an |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1933 ;; oversight. --Stef |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1934 (ispell-send-string "#\n") |
22611 | 1935 (flyspell-unhighlight-at cursor-location) |
1936 (setq ispell-pdict-modified-p '(t))) | |
1937 ((or (eq replace 'buffer) (eq replace 'session)) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1938 (ispell-send-string (concat "@" word "\n")) |
22611 | 1939 (flyspell-unhighlight-at cursor-location) |
1940 (if (null ispell-pdict-modified-p) | |
1941 (setq ispell-pdict-modified-p | |
1942 (list ispell-pdict-modified-p))) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1943 (goto-char save) |
22611 | 1944 (if (eq replace 'buffer) |
1945 (ispell-add-per-file-word-list word))) | |
1946 (replace | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1947 ;; This was added only to the Emacs side. I assume its absence on |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1948 ;; the XEmacs side was an oversight. --Stef |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1949 (flyspell-unhighlight-at cursor-location) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1950 (let ((old-max (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1951 (new-word (if (atom replace) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1952 replace |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1953 (car replace))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1954 (cursor-location (+ (- (length word) (- end start)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1955 cursor-location))) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1956 (unless (equal new-word (car poss)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1957 (delete-region start end) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1958 (goto-char start) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1959 (funcall flyspell-insert-function new-word) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1960 (if flyspell-abbrev-p |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1961 (flyspell-define-abbrev word new-word))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1962 ;; In the original Emacs code, this was only called in the body |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1963 ;; of the if. I arbitrarily kept the XEmacs behavior instead. |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1964 (flyspell-ajust-cursor-point save cursor-location old-max))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1965 (t |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1966 (goto-char save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1967 nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1968 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1969 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1970 ;* flyspell-ajust-cursor-point ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1971 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1972 (defun flyspell-ajust-cursor-point (save cursor-location old-max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1973 (if (>= save cursor-location) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1974 (let ((new-pos (+ save (- (point-max) old-max)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1975 (goto-char (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1976 ((< new-pos (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1977 (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1978 ((> new-pos (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1979 (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1980 (t new-pos)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1981 (goto-char save))) |
22611 | 1982 |
1983 ;*---------------------------------------------------------------------*/ | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1984 ;* flyspell-emacs-popup ... */ |
22611 | 1985 ;*---------------------------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1986 (defun flyspell-emacs-popup (event poss word) |
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
1987 "The Emacs popup menu." |
22611 | 1988 (if (not event) |
1989 (let* ((mouse-pos (mouse-position)) | |
1990 (mouse-pos (if (nth 1 mouse-pos) | |
1991 mouse-pos | |
1992 (set-mouse-position (car mouse-pos) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1993 (/ (frame-width) 2) 2) |
22611 | 1994 (mouse-position)))) |
1995 (setq event (list (list (car (cdr mouse-pos)) | |
1996 (1+ (cdr (cdr mouse-pos)))) | |
1997 (car mouse-pos))))) | |
1998 (let* ((corrects (if flyspell-sort-corrections | |
1999 (sort (car (cdr (cdr poss))) 'string<) | |
2000 (car (cdr (cdr poss))))) | |
2001 (cor-menu (if (consp corrects) | |
2002 (mapcar (lambda (correct) | |
2003 (list correct correct)) | |
2004 corrects) | |
2005 '())) | |
2006 (affix (car (cdr (cdr (cdr poss))))) | |
2007 (base-menu (let ((save (if (consp affix) | |
2008 (list | |
2009 (list (concat "Save affix: " (car affix)) | |
2010 'save) | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
2011 '("Accept (session)" session) |
22611 | 2012 '("Accept (buffer)" buffer)) |
2013 '(("Save word" save) | |
2014 ("Accept (session)" session) | |
2015 ("Accept (buffer)" buffer))))) | |
2016 (if (consp cor-menu) | |
2017 (append cor-menu (cons "" save)) | |
2018 save))) | |
2019 (menu (cons "flyspell correction menu" base-menu))) | |
2020 (car (x-popup-menu event | |
2021 (list (format "%s [%s]" word (or ispell-local-dictionary | |
2022 ispell-dictionary)) | |
2023 menu))))) | |
2024 | |
2025 ;*---------------------------------------------------------------------*/ | |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
2026 ;* flyspell-xemacs-popup ... */ |
22611 | 2027 ;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2028 (defun flyspell-xemacs-popup (event poss word cursor-location start end save) |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
2029 "The XEmacs popup menu." |
22611 | 2030 (let* ((corrects (if flyspell-sort-corrections |
2031 (sort (car (cdr (cdr poss))) 'string<) | |
2032 (car (cdr (cdr poss))))) | |
2033 (cor-menu (if (consp corrects) | |
2034 (mapcar (lambda (correct) | |
2035 (vector correct | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2036 (list 'flyspell-do-correct |
22611 | 2037 correct |
2038 (list 'quote poss) | |
2039 word | |
2040 cursor-location | |
2041 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2042 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2043 save) |
22611 | 2044 t)) |
2045 corrects) | |
2046 '())) | |
2047 (affix (car (cdr (cdr (cdr poss))))) | |
2048 (menu (let ((save (if (consp affix) | |
2049 (vector | |
2050 (concat "Save affix: " (car affix)) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2051 (list 'flyspell-do-correct |
22611 | 2052 ''save |
2053 (list 'quote poss) | |
2054 word | |
2055 cursor-location | |
2056 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2057 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2058 save) |
22611 | 2059 t) |
2060 (vector | |
2061 "Save word" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2062 (list 'flyspell-do-correct |
22611 | 2063 ''save |
2064 (list 'quote poss) | |
2065 word | |
2066 cursor-location | |
2067 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2068 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2069 save) |
22611 | 2070 t))) |
2071 (session (vector "Accept (session)" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2072 (list 'flyspell-do-correct |
22611 | 2073 ''session |
2074 (list 'quote poss) | |
2075 word | |
2076 cursor-location | |
2077 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2078 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2079 save) |
22611 | 2080 t)) |
2081 (buffer (vector "Accept (buffer)" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2082 (list 'flyspell-do-correct |
22611 | 2083 ''buffer |
2084 (list 'quote poss) | |
2085 word | |
2086 cursor-location | |
2087 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2088 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2089 save) |
22611 | 2090 t))) |
2091 (if (consp cor-menu) | |
2092 (append cor-menu (list "-" save session buffer)) | |
2093 (list save session buffer))))) | |
2094 (popup-menu (cons (format "%s [%s]" word (or ispell-local-dictionary | |
2095 ispell-dictionary)) | |
2096 menu)))) | |
2097 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2098 ;*---------------------------------------------------------------------*/ |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
2099 ;* Some example functions for real autocorrecting */ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2100 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2101 (defun flyspell-maybe-correct-transposition (beg end poss) |
37008 | 2102 "Check replacements for transposed characters. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2103 |
37008 | 2104 If the text between BEG and END is equal to a correction suggested by |
2105 Ispell, after transposing two adjacent characters, correct the text, | |
2106 and return t. | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2107 |
37008 | 2108 The third arg POSS is either the symbol 'doublon' or a list of |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2109 possible corrections as returned by `ispell-parse-output'. |
22611 | 2110 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2111 This function is meant to be added to `flyspell-incorrect-hook'." |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
2112 (when (consp poss) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2113 (catch 'done |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2114 (let ((str (buffer-substring beg end)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2115 (i 0) (len (- end beg)) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2116 (while (< (1+ i) len) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2117 (setq tmp (aref str i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2118 (aset str i (aref str (1+ i))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2119 (aset str (1+ i) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2120 (when (member str (nth 2 poss)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2121 (save-excursion |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2122 (goto-char (+ beg i 1)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2123 (transpose-chars 1)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2124 (throw 'done t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2125 (setq tmp (aref str i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2126 (aset str i (aref str (1+ i))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2127 (aset str (1+ i) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2128 (setq i (1+ i)))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2129 nil))) |
37008 | 2130 |
2131 (defun flyspell-maybe-correct-doubling (beg end poss) | |
2132 "Check replacements for doubled characters. | |
2133 | |
2134 If the text between BEG and END is equal to a correction suggested by | |
2135 Ispell, after removing a pair of doubled characters, correct the text, | |
2136 and return t. | |
2137 | |
2138 The third arg POSS is either the symbol 'doublon' or a list of | |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2139 possible corrections as returned by `ispell-parse-output'. |
37008 | 2140 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2141 This function is meant to be added to `flyspell-incorrect-hook'." |
37008 | 2142 (when (consp poss) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2143 (catch 'done |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2144 (let ((str (buffer-substring beg end)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2145 (i 0) (len (- end beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2146 (while (< (1+ i) len) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2147 (when (and (= (aref str i) (aref str (1+ i))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2148 (member (concat (substring str 0 (1+ i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2149 (substring str (+ i 2))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2150 (nth 2 poss))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2151 (goto-char (+ beg i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2152 (delete-char 1) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2153 (throw 'done t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2154 (setq i (1+ i)))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2155 nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2156 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2157 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2158 ;* flyspell-already-abbrevp ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2159 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2160 (defun flyspell-already-abbrevp (table word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2161 (let ((sym (abbrev-symbol word table))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2162 (and sym (symbolp sym)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2163 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2164 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2165 ;* flyspell-change-abbrev ... */ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2166 ;*---------------------------------------------------------------------*/ |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2167 (defun flyspell-change-abbrev (table old new) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2168 (set (abbrev-symbol old table) new)) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
2169 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2170 (provide 'flyspell) |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37008
diff
changeset
|
2171 |
58263
b838f6a6cb4d
(flyspell-mouse-map): Pop the menu
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58001
diff
changeset
|
2172 ;; arch-tag: 05d915b9-e9cf-44fb-9137-fc28f5eaab2a |
22611 | 2173 ;;; flyspell.el ends here |