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