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