Mercurial > emacs
annotate lisp/textmodes/flyspell.el @ 102729:ca92073db2a9
(Focus Events): Most X window managers don't use focus-follows-mouse
nowadays.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 25 Mar 2009 14:18:31 +0000 |
parents | 5d5d7ede9176 |
children | 61ab76316844 |
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 |
74509 | 3 ;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, |
100908 | 4 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
22611 | 5 |
56522
6ed4179ba08b
Update author email address.
Richard M. Stallman <rms@gnu.org>
parents:
55731
diff
changeset
|
6 ;; Author: Manuel Serrano <Manuel.Serrano@sophia.inria.fr> |
55731 | 7 ;; Maintainer: FSF |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
8 ;; Keywords: convenience |
22611 | 9 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37008
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
22611 | 11 |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94474
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
22611 | 13 ;; it under the terms of the GNU General Public License as published by |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94474
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94474
diff
changeset
|
15 ;; (at your option) any later version. |
22611 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94474
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
22611 | 24 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
25 ;;; Commentary: |
22611 | 26 ;; |
27 ;; 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
|
28 ;; checking. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
29 ;; |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
30 ;; 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
|
31 ;; 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
|
32 ;; |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
33 ;; 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
|
34 ;; M-x flyspell-prog-mode. |
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
35 ;; 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
|
36 ;; |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
37 ;; 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
|
38 ;; 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
|
39 ;; |
22611 | 40 ;; Some user variables control the behavior of flyspell. They are |
41 ;; those defined under the `User variables' comment. | |
42 | |
43 ;;; Code: | |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
44 |
22611 | 45 (require 'ispell) |
46 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
47 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
48 ;;* Group ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
49 ;;*---------------------------------------------------------------------*/ |
22611 | 50 (defgroup flyspell nil |
37008 | 51 "Spell checking on the fly." |
22611 | 52 :tag "FlySpell" |
53 :prefix "flyspell-" | |
43383
d21a74d23497
2002-02-17 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43148
diff
changeset
|
54 :group 'ispell |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
55 :group 'processes) |
22611 | 56 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
57 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
58 ;;* User configuration ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
59 ;;*---------------------------------------------------------------------*/ |
22611 | 60 (defcustom flyspell-highlight-flag t |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
61 "How Flyspell should indicate misspelled words. |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
62 Non-nil means use highlight, nil means use minibuffer messages." |
22611 | 63 :group 'flyspell |
64 :type 'boolean) | |
65 | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
66 (defcustom flyspell-mark-duplications-flag t |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
67 "Non-nil means Flyspell reports a repeated word as an error. |
83819
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
68 See `flyspell-mark-duplications-exceptions' to add exceptions to this rule. |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
69 Detection of repeated words is not implemented in |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
70 \"large\" regions; see `flyspell-large-region'." |
22611 | 71 :group 'flyspell |
72 :type 'boolean) | |
73 | |
83819
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
74 (defcustom flyspell-mark-duplications-exceptions |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
75 '(("francais" . ("nous" "vous"))) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
76 "A list of exceptions for duplicated words. |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
77 It should be a list of (LANGUAGE . EXCEPTION-LIST). LANGUAGE is matched |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
78 against the current dictionary and EXCEPTION-LIST is a list of strings. |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
79 The duplicated word is downcased before it is compared with the exceptions." |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
80 :group 'flyspell |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
81 :type '(alist :key-type string :value-type (repeat string))) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
82 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
83 (defcustom flyspell-sort-corrections nil |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
84 "Non-nil means, sort the corrections alphabetically before popping them." |
22611 | 85 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
86 :version "21.1" |
22611 | 87 :type 'boolean) |
88 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
89 (defcustom flyspell-duplicate-distance -1 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
90 "The maximum distance for finding duplicates of unrecognized words. |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
91 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
|
92 if the same spelling occurs elsewhere in the buffer, |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
93 Flyspell uses a different face (`flyspell-duplicate') to highlight it. |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
94 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
|
95 -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
|
96 0 means do not search for duplicate unrecognized spellings." |
22611 | 97 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
98 :version "21.1" |
93800
7aae3fb72148
(flyspell-duplicate-distance): Improve custom type.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
92933
diff
changeset
|
99 :type '(choice (const :tag "no limit" -1) |
7aae3fb72148
(flyspell-duplicate-distance): Improve custom type.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
92933
diff
changeset
|
100 number)) |
22611 | 101 |
102 (defcustom flyspell-delay 3 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
103 "The number of seconds to wait before checking, after a \"delayed\" command." |
22611 | 104 :group 'flyspell |
105 :type 'number) | |
106 | |
107 (defcustom flyspell-persistent-highlight t | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
108 "Non-nil means misspelled words remain highlighted until corrected. |
22946
cfde96067373
(flyspell-persistent-highlight): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22891
diff
changeset
|
109 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
|
110 is highlighted." |
22611 | 111 :group 'flyspell |
112 :type 'boolean) | |
113 | |
114 (defcustom flyspell-highlight-properties t | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
115 "Non-nil means highlight incorrect words even if a property exists for this word." |
22611 | 116 :group 'flyspell |
117 :type 'boolean) | |
118 | |
119 (defcustom flyspell-default-delayed-commands | |
120 '(self-insert-command | |
121 delete-backward-char | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
122 backward-or-forward-delete-char |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
123 delete-char |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
124 scrollbar-vertical-drag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
125 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
|
126 "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
|
127 See `flyspell-delayed-commands'." |
22611 | 128 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
129 :version "21.1" |
22611 | 130 :type '(repeat (symbol))) |
131 | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
132 (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
|
133 "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
|
134 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
|
135 whose length is specified by `flyspell-delay'." |
22611 | 136 :group 'flyspell |
137 :type '(repeat (symbol))) | |
138 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
139 (defcustom flyspell-default-deplacement-commands |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
140 '(next-line |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
141 previous-line |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
142 scroll-up |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
143 scroll-down) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
144 "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
|
145 See `flyspell-deplacement-commands'." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
146 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
147 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
148 :type '(repeat (symbol))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
149 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
150 (defcustom flyspell-deplacement-commands nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
151 "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
|
152 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
|
153 command was not the very same command." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
154 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
155 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
156 :type '(repeat (symbol))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
157 |
22611 | 158 (defcustom flyspell-issue-welcome-flag t |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
159 "Non-nil means that Flyspell should display a welcome message when started." |
22611 | 160 :group 'flyspell |
161 :type 'boolean) | |
162 | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
163 (defcustom flyspell-issue-message-flag t |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
164 "Non-nil means that Flyspell emits messages when checking words." |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
165 :group 'flyspell |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
166 :type 'boolean) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
167 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
168 (defcustom flyspell-incorrect-hook nil |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
169 "List of functions to be called when incorrect words are encountered. |
65662
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
170 Each function is given three arguments. The first two |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
171 arguments are the beginning and the end of the incorrect region. |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
172 The third is either the symbol `doublon' or the list |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
173 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
|
174 |
65662
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
175 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
|
176 incorrect." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
177 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
178 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
179 :type 'hook) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
180 |
40933
29830f44be6a
(flyspell-default-dictionary): Allow nil as value, and make nil the default.
Richard M. Stallman <rms@gnu.org>
parents:
40898
diff
changeset
|
181 (defcustom flyspell-default-dictionary nil |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
182 "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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 Ispell's ultimate default dictionary." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
189 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
190 :version "21.1" |
40942
52f0b9d1d57b
(flyspell-default-dictionary): Fix previous change.
Pavel Janík <Pavel@Janik.cz>
parents:
40938
diff
changeset
|
191 :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
|
192 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
193 (defcustom flyspell-tex-command-regexp |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
194 "\\(\\(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
|
195 "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
|
196 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
197 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
198 :type 'string) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
199 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
200 (defcustom flyspell-check-tex-math-command nil |
73652
497f9d6319e7
(flyspell-check-tex-math-command): Use "non-nil" in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
73480
diff
changeset
|
201 "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
|
202 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
|
203 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
|
204 http://strw.leidenuniv.nl/~dominik/Tools" |
22611 | 205 :group 'flyspell |
206 :type 'boolean) | |
207 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
208 (defcustom flyspell-dictionaries-that-consider-dash-as-word-delimiter |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
209 '("francais" "deutsch8" "norsk") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
210 "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
|
211 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
212 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
213 :type '(repeat (string))) |
22611 | 214 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
215 (defcustom flyspell-abbrev-p |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
216 nil |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
217 "If non-nil, add correction to abbreviation table." |
22611 | 218 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
219 :version "21.1" |
22611 | 220 :type 'boolean) |
221 | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
222 (defcustom flyspell-use-global-abbrev-table-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
223 nil |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
224 "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
|
225 :group 'flyspell |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
226 :version "21.1" |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
227 :type 'boolean) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
228 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
229 (defcustom flyspell-mode-line-string " Fly" |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
230 "String displayed on the modeline when flyspell is active. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
231 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
|
232 :group 'flyspell |
42622
2c67c90f9b6d
(flyspell-mode-line-string): Fix custom type.
Richard M. Stallman <rms@gnu.org>
parents:
42456
diff
changeset
|
233 :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
|
234 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
235 (defcustom flyspell-large-region 1000 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
236 "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
|
237 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
|
238 `flyspell-region' checks the words sequentially using regular |
ef6efcaaf3c3
(flyspell-large-region): Clarify docstring.
Stephen Eglen <stephen@gnu.org>
parents:
60855
diff
changeset
|
239 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
|
240 spawned for speed. |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
241 |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
242 Doubled words are not detected in a large region, because Ispell |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
243 does not check for them. |
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
244 |
62868
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" |
64994
50a2100bf749
(flyspell-large-region): Fix doc and custom type.
Richard M. Stallman <rms@gnu.org>
parents:
64970
diff
changeset
|
248 :type '(choice number (const :tag "All small" nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
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) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
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 |
102233
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
265 (defvar flyspell-mode-map) |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
266 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
267 (defcustom flyspell-use-meta-tab t |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
268 "Non-nil means that flyspell uses M-TAB to correct word." |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
269 :group 'flyspell |
102233
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
270 :type 'boolean |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
271 :initialize 'custom-initialize-default |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
272 :set (lambda (sym val) |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
273 (define-key flyspell-mode-map "\M-\t" |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
274 (if (set sym val) |
5d5d7ede9176
(flyspell-use-meta-tab): Add a custom :set function. (Bug#2429)
Glenn Morris <rgm@gnu.org>
parents:
102170
diff
changeset
|
275 'flyspell-auto-correct-word)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
276 |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
277 (defcustom flyspell-auto-correct-binding |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
278 [(control ?\;)] |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
279 "The key binding for flyspell auto correction." |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
280 :group 'flyspell) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
281 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
282 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
283 ;;* Mode specific options */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
284 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
285 ;;* Mode specific options enable users to disable flyspell on */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
286 ;;* certain word depending of the emacs mode. For instance, when */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
287 ;;* using flyspell with mail-mode add the following expression */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
288 ;;* in your .emacs file: */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
289 ;;* (add-hook 'mail-mode */ |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
290 ;;* '(lambda () (setq flyspell-generic-check-word-predicate */ |
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
291 ;;* 'mail-mode-flyspell-verify))) */ |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
292 ;;*---------------------------------------------------------------------*/ |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
293 (defvar flyspell-generic-check-word-predicate nil |
22611 | 294 "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
|
295 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
|
296 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
|
297 property of the major mode name.") |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
298 (make-variable-buffer-local 'flyspell-generic-check-word-predicate) |
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
299 (defvaralias 'flyspell-generic-check-word-p |
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
300 'flyspell-generic-check-word-predicate) |
22611 | 301 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
302 ;;*--- mail mode -------------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
303 (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
|
304 (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) |
85765
f1a78e8d37f0
* textmodes/flyspell.el (message-signature-separator):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85114
diff
changeset
|
305 (defvar message-signature-separator) |
22611 | 306 (defun mail-mode-flyspell-verify () |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
307 "Function used for `flyspell-generic-check-word-predicate' in Mail mode." |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
308 (let ((header-end (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
309 (goto-char (point-min)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
310 (re-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
311 (concat "^" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
312 (regexp-quote mail-header-separator) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
313 "$") |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
314 nil t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
315 (point))) |
95898
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
316 (signature-begin |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
317 (if (not (boundp 'message-signature-separator)) |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
318 (point-max) |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
319 (save-excursion |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
320 (goto-char (point-max)) |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
321 (re-search-backward message-signature-separator nil t) |
22320e063151
(mail-mode-flyspell-verify):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94670
diff
changeset
|
322 (point))))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
323 (cond ((< (point) header-end) |
35338
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
324 (and (save-excursion (beginning-of-line) |
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
325 (looking-at "^Subject:")) |
3ee28dccba1d
(mail-mode-flyspell-verify): Check in
Gerd Moellmann <gerd@gnu.org>
parents:
34925
diff
changeset
|
326 (> (point) (match-end 0)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
327 ((> (point) signature-begin) |
34925
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
328 nil) |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
329 (t |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
330 (save-excursion |
6043184119bc
(mail-mode-flyspell-verify): Spell-check
Gerd Moellmann <gerd@gnu.org>
parents:
33787
diff
changeset
|
331 (beginning-of-line) |
60855
8386904a5a5f
(mail-mode-flyspell-verify): Fix regexp syntax.
Richard M. Stallman <rms@gnu.org>
parents:
60459
diff
changeset
|
332 (not (looking-at "[>}|]\\|To:"))))))) |
22611 | 333 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
334 ;;*--- texinfo mode ----------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
335 (put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify) |
22611 | 336 (defun texinfo-mode-flyspell-verify () |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
337 "Function used for `flyspell-generic-check-word-predicate' in Texinfo mode." |
22611 | 338 (save-excursion |
339 (forward-word -1) | |
340 (not (looking-at "@")))) | |
341 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
342 ;;*--- tex mode --------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
343 (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
|
344 (defun tex-mode-flyspell-verify () |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
345 "Function used for `flyspell-generic-check-word-predicate' in LaTeX mode." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
346 (and |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
347 (not (save-excursion |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
348 (re-search-backward "^[ \t]*%%%[ \t]+Local" nil t))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
349 (not (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
350 (let ((this (point-marker)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
351 (e (progn (end-of-line) (point-marker)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
352 (beginning-of-line) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
353 (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
|
354 (and (>= this (match-beginning 0)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
355 (<= this (match-end 0)) ))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
356 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
357 ;;*--- sgml mode -------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
358 (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
|
359 (put 'html-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) |
92933
fc82b6139b36
* textmodes/flyspell.el (nxml-mode): Add the right.
Bastien Guerry <bzg@altern.org>
parents:
87649
diff
changeset
|
360 (put 'nxml-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
361 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
362 (defun sgml-mode-flyspell-verify () |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
363 "Function used for `flyspell-generic-check-word-predicate' in SGML mode." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
364 (not (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
365 (let ((this (point-marker)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
366 (s (progn (beginning-of-line) (point-marker))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
367 (e (progn (end-of-line) (point-marker)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
368 (or (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
369 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
370 (and (re-search-forward "[^<]*>" e t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
371 (= (match-beginning 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
372 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
373 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
374 (and (re-search-backward "<[^>]*" s t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
375 (= (match-end 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
376 (and (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
377 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
378 (and (re-search-forward "[^&]*;" e t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
379 (= (match-beginning 0) this))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
380 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
381 (goto-char this) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
382 (and (re-search-backward "&[^;]*" s t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
383 (= (match-end 0) this))))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
384 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
385 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
386 ;;* Programming mode */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
387 ;;*---------------------------------------------------------------------*/ |
33787
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
388 (defvar flyspell-prog-text-faces |
d16b29f737a7
(flyspell-prog-text-faces): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33426
diff
changeset
|
389 '(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
|
390 "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
|
391 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
392 (defun flyspell-generic-progmode-verify () |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
393 "Used for `flyspell-generic-check-word-predicate' in programming modes." |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
394 (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
|
395 (memq f flyspell-prog-text-faces))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
396 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
397 ;;;###autoload |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
398 (defun flyspell-prog-mode () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
399 "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
|
400 (interactive) |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
401 (setq flyspell-generic-check-word-predicate |
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
402 'flyspell-generic-progmode-verify) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
403 (flyspell-mode 1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
404 (run-hooks 'flyspell-prog-mode-hook)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
405 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
406 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
407 ;;* Overlay compatibility */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
408 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
409 (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
|
410 (autoload 'overlayp "overlay" "Overlay compatibility kit." t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
411 (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
|
412 (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
|
413 (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
|
414 (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
|
415 (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
|
416 (autoload 'previous-overlay-change "overlay" "Overlay compatibility kit." t) |
22611 | 417 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
418 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
419 ;;* The minor mode declaration. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
420 ;;*---------------------------------------------------------------------*/ |
27787
d40d47971e6b
(flyspell-mouse-map): Change definition
Dave Love <fx@gnu.org>
parents:
24943
diff
changeset
|
421 (defvar flyspell-mouse-map |
d40d47971e6b
(flyspell-mouse-map): Change definition
Dave Love <fx@gnu.org>
parents:
24943
diff
changeset
|
422 (let ((map (make-sparse-keymap))) |
102170
312d8aba5a08
(flyspell-mouse-map): Undefine mouse-2 to avoid yanks (Bug#2408).
Chong Yidong <cyd@stupidchicken.com>
parents:
101239
diff
changeset
|
423 (if (featurep 'xemacs) |
312d8aba5a08
(flyspell-mouse-map): Undefine mouse-2 to avoid yanks (Bug#2408).
Chong Yidong <cyd@stupidchicken.com>
parents:
101239
diff
changeset
|
424 (define-key map [button2] #'flyspell-correct-word) |
312d8aba5a08
(flyspell-mouse-map): Undefine mouse-2 to avoid yanks (Bug#2408).
Chong Yidong <cyd@stupidchicken.com>
parents:
101239
diff
changeset
|
425 (define-key map [down-mouse-2] #'flyspell-correct-word) |
312d8aba5a08
(flyspell-mouse-map): Undefine mouse-2 to avoid yanks (Bug#2408).
Chong Yidong <cyd@stupidchicken.com>
parents:
101239
diff
changeset
|
426 (define-key map [mouse-2] 'undefined)) |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
427 map) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
428 "Keymap for Flyspell to put on erroneous words.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
429 |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
430 (defvar flyspell-mode-map |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
431 (let ((map (make-sparse-keymap))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
432 (if flyspell-use-meta-tab |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
433 (define-key map "\M-\t" 'flyspell-auto-correct-word)) |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
434 (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
435 (define-key map [(control ?\,)] 'flyspell-goto-next-error) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
436 (define-key map [(control ?\.)] 'flyspell-auto-correct-word) |
73907
37d2c9383035
(flyspell-mode-map): Bind C-c $ instead of M-RET.
Richard M. Stallman <rms@gnu.org>
parents:
73779
diff
changeset
|
437 (define-key map [?\C-c ?$] 'flyspell-correct-word-before-point) |
63817
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
438 map) |
032f69088e2e
(flyspell-use-local-map): Variable deleted.
Richard M. Stallman <rms@gnu.org>
parents:
63405
diff
changeset
|
439 "Minor mode keymap for Flyspell mode--for the whole buffer.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
440 |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
441 ;; dash character machinery |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
442 (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
|
443 "*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
|
444 (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
|
445 (defvar flyspell-dash-dictionary nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
446 (make-variable-buffer-local 'flyspell-dash-dictionary) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
447 (defvar flyspell-dash-local-dictionary nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
448 (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
|
449 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
450 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
451 ;;* Highlighting */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
452 ;;*---------------------------------------------------------------------*/ |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
453 (defface flyspell-incorrect |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
454 '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
455 (t (:bold t))) |
76984
c5ea5d1e6950
(flyspell-duplicate, flyspell-incorrect): Revert 2006-01-27 change.
Chong Yidong <cyd@stupidchicken.com>
parents:
76741
diff
changeset
|
456 "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
|
457 :group 'flyspell) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
458 ;; backward-compatibility alias |
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
459 (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
460 |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
461 (defface flyspell-duplicate |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
462 '((((class color)) (:foreground "Gold3" :bold t :underline t)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
463 (t (:bold t))) |
76984
c5ea5d1e6950
(flyspell-duplicate, flyspell-incorrect): Revert 2006-01-27 change.
Chong Yidong <cyd@stupidchicken.com>
parents:
76741
diff
changeset
|
464 "Face used for marking a misspelled word that appears twice in the buffer. |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
465 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
|
466 :group 'flyspell) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
467 ;; backward-compatibility alias |
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
468 (put 'flyspell-duplicate-face 'face-alias 'flyspell-duplicate) |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
469 |
22611 | 470 (defvar flyspell-overlay nil) |
471 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
472 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
473 ;;* flyspell-mode ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
474 ;;*---------------------------------------------------------------------*/ |
64970
877705ac17d3
(flyspell-mode): Autoload a defvar.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
475 ;;;###autoload(defvar flyspell-mode nil) |
22611 | 476 ;;;###autoload |
63120
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
477 (define-minor-mode flyspell-mode |
22611 | 478 "Minor mode performing on-the-fly spelling checking. |
57605
6738a2db2167
(flyspell-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56767
diff
changeset
|
479 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
|
480 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
|
481 With no argument, this command toggles Flyspell mode. |
78482
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
482 With a prefix argument ARG, turn Flyspell minor mode on if ARG is positive, |
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
483 otherwise turn it off. |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
484 |
22611 | 485 Bindings: |
486 \\[ispell-word]: correct words (using Ispell). | |
487 \\[flyspell-auto-correct-word]: automatically correct word. | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
488 \\[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
|
489 \\[flyspell-correct-word] (or down-mouse-2): popup correct words. |
22611 | 490 |
491 Hooks: | |
94474
9e177181ff37
(flyspell-mode-on): Remove redundant (flyspell-mode-hook) run.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
94303
diff
changeset
|
492 This runs `flyspell-mode-hook' after flyspell mode is entered or exit. |
22611 | 493 |
494 Remark: | |
495 `flyspell-mode' uses `ispell-mode'. Thus all Ispell options are | |
97785
77a81df8971f
(flyspell-mode) Fix docstring
Agustin Martin <agustin.martin@hispalinux.es>
parents:
97742
diff
changeset
|
496 valid. For instance, a different dictionary can be used by |
22611 | 497 invoking `ispell-change-dictionary'. |
498 | |
499 Consider using the `ispell-parser' to check your text. For instance | |
500 consider adding: | |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
501 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) |
22611 | 502 in your .emacs file. |
503 | |
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
|
504 \\[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
|
505 \\[flyspell-buffer] checks the whole buffer." |
63120
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
506 :lighter flyspell-mode-line-string |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
507 :keymap flyspell-mode-map |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
508 :group 'flyspell |
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
509 (if flyspell-mode |
78685
81b279307e4b
(flyspell-mode): Catch errors in flyspell-mode-on.
Richard M. Stallman <rms@gnu.org>
parents:
78482
diff
changeset
|
510 (condition-case () |
81b279307e4b
(flyspell-mode): Catch errors in flyspell-mode-on.
Richard M. Stallman <rms@gnu.org>
parents:
78482
diff
changeset
|
511 (flyspell-mode-on) |
81b279307e4b
(flyspell-mode): Catch errors in flyspell-mode-on.
Richard M. Stallman <rms@gnu.org>
parents:
78482
diff
changeset
|
512 (error (message "Enabling Flyspell mode gave an error") |
81b279307e4b
(flyspell-mode): Catch errors in flyspell-mode-on.
Richard M. Stallman <rms@gnu.org>
parents:
78482
diff
changeset
|
513 (flyspell-mode -1))) |
63120
803cbfc5da39
(flyspell-mode): Use define-minor-mode.
Lute Kamstra <lute@gnu.org>
parents:
63100
diff
changeset
|
514 (flyspell-mode-off))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
515 |
71100
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
516 ;;;###autoload |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
517 (defun turn-on-flyspell () |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
518 "Unconditionally turn on Flyspell mode." |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
519 (flyspell-mode 1)) |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
520 |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
521 ;;;###autoload |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
522 (defun turn-off-flyspell () |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
523 "Unconditionally turn off Flyspell mode." |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
524 (flyspell-mode -1)) |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
525 |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
526 (custom-add-option 'text-mode-hook 'turn-on-flyspell) |
83b8d9f95633
* textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): New
Reiner Steib <Reiner.Steib@gmx.de>
parents:
70815
diff
changeset
|
527 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
528 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
529 ;;* flyspell-buffers ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
530 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
531 ;;* For remembering buffers running flyspell */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
532 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
533 (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
|
534 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
535 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
536 ;;* flyspell-minibuffer-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
537 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
538 (defun flyspell-minibuffer-p (buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
539 "Is BUFFER a minibuffer?" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
540 (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
|
541 (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
|
542 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
543 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
544 ;;* flyspell-accept-buffer-local-defs ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
545 ;;*---------------------------------------------------------------------*/ |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
546 (defvar flyspell-last-buffer nil |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
547 "The buffer in which the last flyspell operation took place.") |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
548 |
68053
5770fac9a117
(flyspell-accept-buffer-local-defs): Add an
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67858
diff
changeset
|
549 (defun flyspell-accept-buffer-local-defs (&optional force) |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
550 ;; When flyspell-word is used inside a loop (e.g. when processing |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
551 ;; flyspell-changes), the calls to `ispell-accept-buffer-local-defs' end |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
552 ;; up dwarfing everything else, so only do it when the buffer has changed. |
68053
5770fac9a117
(flyspell-accept-buffer-local-defs): Add an
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67858
diff
changeset
|
553 (when (or force (not (eq flyspell-last-buffer (current-buffer)))) |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
554 (setq flyspell-last-buffer (current-buffer)) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
555 ;; Strange problem: If buffer in current window has font-lock turned on, |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
556 ;; but SET-BUFFER was called to point to an invisible buffer, this ispell |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
557 ;; call will reset the buffer to the buffer in the current window. |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
558 ;; However, it only happens at startup (fix by Albert L. Ting). |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
559 (save-current-buffer |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
560 (ispell-accept-buffer-local-defs)) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
561 (unless (and (eq flyspell-dash-dictionary ispell-dictionary) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
562 (eq flyspell-dash-local-dictionary ispell-local-dictionary)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
563 ;; The dictionary has changed |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
564 (setq flyspell-dash-dictionary ispell-dictionary) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
565 (setq flyspell-dash-local-dictionary ispell-local-dictionary) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
566 (setq flyspell-consider-dash-as-word-delimiter-flag |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
567 (member (or ispell-local-dictionary ispell-dictionary) |
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
568 flyspell-dictionaries-that-consider-dash-as-word-delimiter))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
569 |
74519
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
570 (defun flyspell-hack-local-variables-hook () |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
571 ;; When local variables are loaded, see if the dictionary context |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
572 ;; has changed. |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
573 (flyspell-accept-buffer-local-defs 'force)) |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
574 |
68196
9b4c8f5efab7
(flyspell-kill-ispell-hook): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68053
diff
changeset
|
575 (defun flyspell-kill-ispell-hook () |
9b4c8f5efab7
(flyspell-kill-ispell-hook): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68053
diff
changeset
|
576 (setq flyspell-last-buffer nil) |
9b4c8f5efab7
(flyspell-kill-ispell-hook): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68053
diff
changeset
|
577 (dolist (buf (buffer-list)) |
68197
979bd3539a58
(flyspell-kill-ispell-hook): Fix braino.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68196
diff
changeset
|
578 (with-current-buffer buf |
979bd3539a58
(flyspell-kill-ispell-hook): Fix braino.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68196
diff
changeset
|
579 (kill-local-variable 'flyspell-word-cache-word)))) |
68196
9b4c8f5efab7
(flyspell-kill-ispell-hook): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68053
diff
changeset
|
580 |
68237
aa1b3e649cc8
(ispell-kill-ispell-hook): Add to the hook when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68197
diff
changeset
|
581 ;; Make sure we flush our caches when needed. Do it here rather than in |
aa1b3e649cc8
(ispell-kill-ispell-hook): Add to the hook when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68197
diff
changeset
|
582 ;; flyspell-mode-on, since flyspell-region may be used without ever turning |
aa1b3e649cc8
(ispell-kill-ispell-hook): Add to the hook when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68197
diff
changeset
|
583 ;; on flyspell-mode. |
aa1b3e649cc8
(ispell-kill-ispell-hook): Add to the hook when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68197
diff
changeset
|
584 (add-hook 'ispell-kill-ispell-hook 'flyspell-kill-ispell-hook) |
aa1b3e649cc8
(ispell-kill-ispell-hook): Add to the hook when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68197
diff
changeset
|
585 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
586 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
587 ;;* flyspell-mode-on ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
588 ;;*---------------------------------------------------------------------*/ |
22611 | 589 (defun flyspell-mode-on () |
23234 | 590 "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." |
94303
e0b01f455de0
* ispell.el (ispell-set-spellchecker-params): New function to make sure
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93800
diff
changeset
|
591 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
592 (setq ispell-highlight-face 'flyspell-incorrect) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
593 ;; 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
|
594 (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
|
595 (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
|
596 (ispell-change-dictionary flyspell-default-dictionary))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
597 ;; 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
|
598 ;; 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
|
599 ;; be forgotten! |
68053
5770fac9a117
(flyspell-accept-buffer-local-defs): Add an
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67858
diff
changeset
|
600 ;; Pass the `force' argument for the case where flyspell was active already |
5770fac9a117
(flyspell-accept-buffer-local-defs): Add an
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67858
diff
changeset
|
601 ;; but the buffer's local-defs have been edited. |
5770fac9a117
(flyspell-accept-buffer-local-defs): Add an
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67858
diff
changeset
|
602 (flyspell-accept-buffer-local-defs 'force) |
45184
fe852d8d5495
(make-flyspell-overlay): Add help text to flyspell overlays.
Pavel Janík <Pavel@Janik.cz>
parents:
43444
diff
changeset
|
603 ;; we put the `flyspell-delayed' property on some commands |
22611 | 604 (flyspell-delay-commands) |
45184
fe852d8d5495
(make-flyspell-overlay): Add help text to flyspell overlays.
Pavel Janík <Pavel@Janik.cz>
parents:
43444
diff
changeset
|
605 ;; 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
|
606 (flyspell-deplacement-commands) |
22611 | 607 ;; 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
|
608 (add-hook 'post-command-hook (function flyspell-post-command-hook) t t) |
22611 | 609 ;; 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
|
610 (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
|
611 ;; we bound flyspell action to after-change hook |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
612 (add-hook 'after-change-functions 'flyspell-after-change-function nil t) |
74519
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
613 ;; we bound flyspell action to hack-local-variables-hook |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
614 (add-hook 'hack-local-variables-hook |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
615 (function flyspell-hack-local-variables-hook) t t) |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
616 ;; set flyspell-generic-check-word-predicate 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
|
617 (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
|
618 (if mode-predicate |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
619 (setq flyspell-generic-check-word-predicate mode-predicate))) |
22611 | 620 ;; the welcome message |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
621 (if (and flyspell-issue-message-flag |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
622 flyspell-issue-welcome-flag |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
623 (interactive-p)) |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
624 (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
|
625 nil 'non-ascii))) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
626 (message "%s" |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
627 (if binding |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
628 (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
|
629 (key-description binding)) |
94474
9e177181ff37
(flyspell-mode-on): Remove redundant (flyspell-mode-hook) run.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
94303
diff
changeset
|
630 "Welcome to flyspell. Use Mouse-2 to correct words."))))) |
22611 | 631 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
632 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
633 ;;* flyspell-delay-commands ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
634 ;;*---------------------------------------------------------------------*/ |
22611 | 635 (defun flyspell-delay-commands () |
23234 | 636 "Install the standard set of Flyspell delayed commands." |
84926
a3f296488aca
(flyspell-delay-commands, flyspell-deplacement-commands):
Juanma Barranquero <lekktu@gmail.com>
parents:
83819
diff
changeset
|
637 (mapc 'flyspell-delay-command flyspell-default-delayed-commands) |
22611 | 638 (mapcar 'flyspell-delay-command flyspell-delayed-commands)) |
639 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
640 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
641 ;;* flyspell-delay-command ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
642 ;;*---------------------------------------------------------------------*/ |
22611 | 643 (defun flyspell-delay-command (command) |
23234 | 644 "Set COMMAND to be delayed, for Flyspell. |
22611 | 645 When flyspell `post-command-hook' is invoked because a delayed command |
37008 | 646 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
|
647 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
|
648 (interactive "SDelay Flyspell after Command: ") |
22611 | 649 (put command 'flyspell-delayed t)) |
650 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
651 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
652 ;;* flyspell-deplacement-commands ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
653 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
654 (defun flyspell-deplacement-commands () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
655 "Install the standard set of Flyspell deplacement commands." |
84926
a3f296488aca
(flyspell-delay-commands, flyspell-deplacement-commands):
Juanma Barranquero <lekktu@gmail.com>
parents:
83819
diff
changeset
|
656 (mapc 'flyspell-deplacement-command flyspell-default-deplacement-commands) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
657 (mapcar 'flyspell-deplacement-command flyspell-deplacement-commands)) |
22611 | 658 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
659 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
660 ;;* flyspell-deplacement-command ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
661 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
662 (defun flyspell-deplacement-command (command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
663 "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
|
664 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
|
665 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
|
666 not the very same deplacement command." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
667 (interactive "SDeplacement Flyspell after Command: ") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
668 (put command 'flyspell-deplacement t)) |
22611 | 669 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
670 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
671 ;;* flyspell-word-cache ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
672 ;;*---------------------------------------------------------------------*/ |
22611 | 673 (defvar flyspell-word-cache-start nil) |
674 (defvar flyspell-word-cache-end nil) | |
675 (defvar flyspell-word-cache-word nil) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
676 (defvar flyspell-word-cache-result '_) |
22611 | 677 (make-variable-buffer-local 'flyspell-word-cache-start) |
678 (make-variable-buffer-local 'flyspell-word-cache-end) | |
679 (make-variable-buffer-local 'flyspell-word-cache-word) | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
680 (make-variable-buffer-local 'flyspell-word-cache-result) |
22611 | 681 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
682 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
683 ;;* The flyspell pre-hook, store the current position. In the */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
684 ;;* post command hook, we will check, if the word at this position */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
685 ;;* has to be spell checked. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
686 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
687 (defvar flyspell-pre-buffer nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
688 (defvar flyspell-pre-point nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
689 (defvar flyspell-pre-column nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
690 (defvar flyspell-pre-pre-buffer nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
691 (defvar flyspell-pre-pre-point nil) |
101239
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
692 (make-variable-buffer-local 'flyspell-pre-point) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
693 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
694 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
695 ;;* flyspell-previous-command ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
696 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
697 (defvar flyspell-previous-command nil |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
698 "The last interactive command checked by Flyspell.") |
22611 | 699 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
700 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
701 ;;* flyspell-pre-command-hook ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
702 ;;*---------------------------------------------------------------------*/ |
22611 | 703 (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
|
704 "Save the current buffer and point for Flyspell's post-command hook." |
22611 | 705 (interactive) |
706 (setq flyspell-pre-buffer (current-buffer)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
707 (setq flyspell-pre-point (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
708 (setq flyspell-pre-column (current-column))) |
22611 | 709 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
710 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
711 ;;* flyspell-mode-off ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
712 ;;*---------------------------------------------------------------------*/ |
23234 | 713 ;;;###autoload |
22611 | 714 (defun flyspell-mode-off () |
23234 | 715 "Turn Flyspell mode off." |
22611 | 716 ;; we remove the hooks |
22962
f4509374e88e
(flyspell-command-hook): Option deleted.
Richard M. Stallman <rms@gnu.org>
parents:
22946
diff
changeset
|
717 (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
|
718 (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t) |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
719 (remove-hook 'after-change-functions 'flyspell-after-change-function t) |
74519
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
720 (remove-hook 'hack-local-variables-hook |
2fcd50508b52
(flyspell-hack-local-variables-hook): New. Force buffer local defs evaluation
Eli Zaretskii <eliz@gnu.org>
parents:
74509
diff
changeset
|
721 (function flyspell-hack-local-variables-hook) t) |
22611 | 722 ;; we remove all the flyspell hilightings |
723 (flyspell-delete-all-overlays) | |
724 ;; we have to erase pre cache variables | |
725 (setq flyspell-pre-buffer nil) | |
726 (setq flyspell-pre-point nil) | |
727 ;; we mark the mode as killed | |
728 (setq flyspell-mode nil)) | |
729 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
730 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
731 ;;* flyspell-check-pre-word-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
732 ;;*---------------------------------------------------------------------*/ |
22611 | 733 (defun flyspell-check-pre-word-p () |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
734 "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
|
735 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
|
736 before the current command." |
22611 | 737 (cond |
738 ((or (not (numberp flyspell-pre-point)) | |
739 (not (bufferp flyspell-pre-buffer)) | |
740 (not (buffer-live-p flyspell-pre-buffer))) | |
741 nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
742 ((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
|
743 (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
|
744 nil) |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
745 ((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
|
746 (eq (char-syntax (char-after flyspell-pre-point)) ?w)) |
22611 | 747 (= flyspell-pre-point (point)) |
748 (= flyspell-pre-point (+ (point) 1))) | |
749 nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
750 ((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
|
751 (not executing-kbd-macro) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
752 (or (get this-command 'flyspell-delayed) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
753 (and (get this-command 'flyspell-deplacement) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
754 (eq flyspell-previous-command this-command))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
755 (or (= (current-column) 0) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
756 (= (current-column) flyspell-pre-column) |
97742
5c765f31d8e0
(flyspell-check-pre-word-p): Make sure flyspell-pre-point is valid to
Chong Yidong <cyd@stupidchicken.com>
parents:
95898
diff
changeset
|
757 ;; If other post-command-hooks change the buffer, |
5c765f31d8e0
(flyspell-check-pre-word-p): Make sure flyspell-pre-point is valid to
Chong Yidong <cyd@stupidchicken.com>
parents:
95898
diff
changeset
|
758 ;; flyspell-pre-point can lie past eob (bug#468). |
5c765f31d8e0
(flyspell-check-pre-word-p): Make sure flyspell-pre-point is valid to
Chong Yidong <cyd@stupidchicken.com>
parents:
95898
diff
changeset
|
759 (null (char-after flyspell-pre-point)) |
30428
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 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
771 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
772 ;;* The flyspell after-change-hook, store the change position. In */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
773 ;;* the post command hook, we will check, if the word at this */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
774 ;;* position has to be spell checked. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
775 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
776 (defvar flyspell-changes nil) |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
777 (make-variable-buffer-local 'flyspell-changes) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
778 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
779 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
780 ;;* flyspell-after-change-function ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
781 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
782 (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
|
783 "Save the current buffer and point for Flyspell's post-command hook." |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
784 (push (cons start stop) flyspell-changes)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
785 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
786 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
787 ;;* flyspell-check-changed-word-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
788 ;;*---------------------------------------------------------------------*/ |
30428
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 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
806 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
807 ;;* flyspell-check-word-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
808 ;;*---------------------------------------------------------------------*/ |
30428
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 |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
823 (not (looking-at "-")))))) |
30428
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 |
65962
e51817a5ce66
(flyspell-check-word-p):
Richard M. Stallman <rms@gnu.org>
parents:
65958
diff
changeset
|
833 (and (not unread-command-events) |
e51817a5ce66
(flyspell-check-word-p):
Richard M. Stallman <rms@gnu.org>
parents:
65958
diff
changeset
|
834 (sit-for flyspell-delay))) |
30428
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 (t t))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
837 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
838 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
839 ;;* flyspell-debug-signal-no-check ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
840 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
841 (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
|
842 (setq debug-on-error t) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
843 (with-current-buffer (get-buffer-create "*flyspell-debug*") |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
844 (erase-buffer) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
845 (insert "NO-CHECK:\n") |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
846 (insert (format " %S : %S\n" msg obj)))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
847 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
848 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
849 ;;* flyspell-debug-signal-pre-word-checked ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
850 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
851 (defun flyspell-debug-signal-pre-word-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
852 (setq debug-on-error t) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
853 (with-current-buffer (get-buffer-create "*flyspell-debug*") |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
854 (insert "PRE-WORD:\n") |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
855 (insert (format " pre-point : %S\n" flyspell-pre-point)) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
856 (insert (format " pre-buffer : %S\n" flyspell-pre-buffer)) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
857 (insert (format " cache-start: %S\n" flyspell-word-cache-start)) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
858 (insert (format " cache-end : %S\n" flyspell-word-cache-end)) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
859 (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
|
860 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
861 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
862 ;;* flyspell-debug-signal-word-checked ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
863 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
864 (defun flyspell-debug-signal-word-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
865 (setq debug-on-error t) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
866 (let ((oldbuf (current-buffer)) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
867 (point (point))) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
868 (with-current-buffer (get-buffer-create "*flyspell-debug*") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
869 (insert "WORD:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
870 (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
|
871 (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
|
872 (get this-command 'flyspell-delayed)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
873 (insert (format " point : %S\n" point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
874 (insert (format " prev-char : [%c] %S\n" |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
875 (with-current-buffer oldbuf |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
876 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
877 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
878 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
879 (char-after (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
880 ? ))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
881 c)) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
882 (with-current-buffer oldbuf |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
883 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
884 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
885 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
886 (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
|
887 (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
|
888 (not (looking-at "\\-"))) 2)))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
889 c)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
890 (insert (format " because : %S\n" |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
891 (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
892 ((not (and (symbolp this-command) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
893 (get this-command 'flyspell-delayed))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
894 ;; the current command is not delayed, that |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
895 ;; 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
|
896 'not-delayed) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
897 ((with-current-buffer oldbuf |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
898 (let ((c (if (> (point) (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
899 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
900 (backward-char 1) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
901 (and (looking-at (flyspell-get-not-casechars)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
902 (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
|
903 (not (looking-at "\\-")))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
904 c)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
905 ;; 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
|
906 'separator) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
907 ((not (integerp flyspell-delay)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
908 ;; 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
|
909 'no-delay) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
910 (t |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
911 'sit-for)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
912 (goto-char (point-max))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
913 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
914 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
915 ;;* flyspell-debug-signal-changed-checked ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
916 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
917 (defun flyspell-debug-signal-changed-checked () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
918 (setq debug-on-error t) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
919 (let ((point (point))) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
920 (with-current-buffer (get-buffer-create "*flyspell-debug*") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
921 (insert "CHANGED WORD:\n") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
922 (insert (format " point : %S\n" point)) |
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 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
925 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
926 ;;* flyspell-post-command-hook ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
927 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
928 ;;* It is possible that we check several words: */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
929 ;;* 1- the current word is checked if the predicate */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
930 ;;* FLYSPELL-CHECK-WORD-P is true */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
931 ;;* 2- the word that used to be the current word before the */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
932 ;;* THIS-COMMAND is checked if: */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
933 ;;* a- the previous word is different from the current word */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
934 ;;* b- the previous word as not just been checked by the */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
935 ;;* previous FLYSPELL-POST-COMMAND-HOOK */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
936 ;;* 3- the words changed by the THIS-COMMAND that are neither the */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
937 ;;* previous word nor the current word */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
938 ;;*---------------------------------------------------------------------*/ |
22611 | 939 (defun flyspell-post-command-hook () |
940 "The `post-command-hook' used by flyspell to check a word in-the-fly." | |
941 (interactive) | |
101239
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
942 (when flyspell-mode |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
943 (let ((command this-command) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
944 ;; Prevent anything we do from affecting the mark. |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
945 deactivate-mark) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
946 (if (flyspell-check-pre-word-p) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
947 (with-current-buffer flyspell-pre-buffer |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
948 '(flyspell-debug-signal-pre-word-checked) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
949 (save-excursion |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
950 (goto-char flyspell-pre-point) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
951 (flyspell-word)))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
952 (if (flyspell-check-word-p) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
953 (progn |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
954 '(flyspell-debug-signal-word-checked) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
955 (flyspell-word) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
956 ;; we remember which word we have just checked. |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
957 ;; this will be used next time we will check a word |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
958 ;; to compare the next current word with the word |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
959 ;; that as been registered in the pre-command-hook |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
960 ;; that is these variables are used within the predicate |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
961 ;; FLYSPELL-CHECK-PRE-WORD-P |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
962 (setq flyspell-pre-pre-buffer (current-buffer)) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
963 (setq flyspell-pre-pre-point (point))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
964 (progn |
101239
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
965 (setq flyspell-pre-pre-buffer nil) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
966 (setq flyspell-pre-pre-point nil) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
967 ;; when a word is not checked because of a delayed command |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
968 ;; we do not disable the ispell cache. |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
969 (if (and (symbolp this-command) (get this-command 'flyspell-delayed)) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
970 (progn |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
971 (setq flyspell-word-cache-end -1) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
972 (setq flyspell-word-cache-result '_))))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
973 (while (and (not (input-pending-p)) (consp flyspell-changes)) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
974 (let ((start (car (car flyspell-changes))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
975 (stop (cdr (car flyspell-changes)))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
976 (if (flyspell-check-changed-word-p start stop) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
977 (save-excursion |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
978 '(flyspell-debug-signal-changed-checked) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
979 (goto-char start) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
980 (flyspell-word))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
981 (setq flyspell-changes (cdr flyspell-changes)))) |
059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100987
diff
changeset
|
982 (setq flyspell-previous-command command)))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
983 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
984 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
985 ;;* flyspell-notify-misspell ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
986 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
987 (defun flyspell-notify-misspell (word poss) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
988 (let ((replacements (if (stringp poss) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
989 poss |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
990 (if flyspell-sort-corrections |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
991 (sort (car (cdr (cdr poss))) 'string<) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
992 (car (cdr (cdr poss))))))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
993 (if flyspell-issue-message-flag |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
994 (message "misspelling `%s' %S" word replacements)))) |
22611 | 995 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
996 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
997 ;;* flyspell-word-search-backward ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
998 ;;*---------------------------------------------------------------------*/ |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
999 (defun flyspell-word-search-backward (word bound) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1000 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1001 (let ((r '()) |
73406
9b6f22920434
* textmodes/flyspell.el (flyspell-word-search-backward): Set
Chong Yidong <cyd@stupidchicken.com>
parents:
72924
diff
changeset
|
1002 (inhibit-point-motion-hooks t) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1003 p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1004 (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
|
1005 (let ((lw (flyspell-get-word '()))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1006 (if (and (consp lw) (string-equal (car lw) word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1007 (setq r p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1008 (goto-char p)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1009 r))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1010 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1011 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1012 ;;* flyspell-word-search-forward ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1013 ;;*---------------------------------------------------------------------*/ |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1014 (defun flyspell-word-search-forward (word bound) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1015 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1016 (let ((r '()) |
73406
9b6f22920434
* textmodes/flyspell.el (flyspell-word-search-backward): Set
Chong Yidong <cyd@stupidchicken.com>
parents:
72924
diff
changeset
|
1017 (inhibit-point-motion-hooks t) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1018 p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1019 (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
|
1020 (let ((lw (flyspell-get-word '()))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1021 (if (and (consp lw) (string-equal (car lw) word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1022 (setq r p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1023 (goto-char (1+ p))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1024 r))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1025 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1026 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1027 ;;* flyspell-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1028 ;;*---------------------------------------------------------------------*/ |
22611 | 1029 (defun flyspell-word (&optional following) |
1030 "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
|
1031 (interactive (list ispell-following-word)) |
94303
e0b01f455de0
* ispell.el (ispell-set-spellchecker-params): New function to make sure
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93800
diff
changeset
|
1032 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists |
22611 | 1033 (save-excursion |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1034 ;; use the correct dictionary |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
1035 (flyspell-accept-buffer-local-defs) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1036 (let* ((cursor-location (point)) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1037 (flyspell-word (flyspell-get-word following)) |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1038 start end poss word ispell-filter) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1039 (if (or (eq flyspell-word nil) |
70815
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
1040 (and (fboundp flyspell-generic-check-word-predicate) |
1b4ea61692ff
(flyspell-generic-check-word-p): Make this the alias for the
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
69379
diff
changeset
|
1041 (not (funcall flyspell-generic-check-word-predicate)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1042 t |
22611 | 1043 (progn |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1044 ;; destructure return flyspell-word info list. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1045 (setq start (car (cdr flyspell-word)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1046 end (car (cdr (cdr flyspell-word))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1047 word (car flyspell-word)) |
22611 | 1048 ;; before checking in the directory, we check for doublons. |
1049 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1050 ((and (or (not (eq ispell-parser 'tex)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1051 (and (> start (point-min)) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1052 (not (memq (char-after (1- start)) '(?\} ?\\))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1053 flyspell-mark-duplications-flag |
83819
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1054 (not (catch 'exception |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1055 (dolist (except flyspell-mark-duplications-exceptions) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1056 (and (string= (or ispell-local-dictionary |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1057 ispell-dictionary) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1058 (car except)) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1059 (member (downcase word) (cdr except)) |
a3c6b2cd98cc
(flyspell-mark-duplications-exceptions): New variable. List of
Michaël Cadilhac <michael.cadilhac@lrde.org>
parents:
78482
diff
changeset
|
1060 (throw 'exception t))))) |
22611 | 1061 (save-excursion |
73462
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1062 (goto-char start) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1063 (let* ((bound |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1064 (- start |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1065 (- end start) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1066 (- (skip-chars-backward " \t\n\f")))) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1067 (p (when (>= bound (point-min)) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1068 (flyspell-word-search-backward word bound)))) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1069 (and p (/= p start))))) |
22611 | 1070 ;; yes, this is a doublon |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1071 (flyspell-highlight-incorrect-region start end 'doublon) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1072 nil) |
22611 | 1073 ((and (eq flyspell-word-cache-start start) |
1074 (eq flyspell-word-cache-end end) | |
1075 (string-equal flyspell-word-cache-word word)) | |
1076 ;; this word had been already checked, we skip | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1077 flyspell-word-cache-result) |
22611 | 1078 ((and (eq ispell-parser 'tex) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1079 (flyspell-tex-command-p flyspell-word)) |
22611 | 1080 ;; this is a correct word (because a tex command) |
1081 (flyspell-unhighlight-at start) | |
1082 (if (> end start) | |
1083 (flyspell-unhighlight-at (- end 1))) | |
1084 t) | |
1085 (t | |
1086 ;; we setup the cache | |
1087 (setq flyspell-word-cache-start start) | |
1088 (setq flyspell-word-cache-end end) | |
1089 (setq flyspell-word-cache-word word) | |
1090 ;; now check spelling of word. | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1091 (ispell-send-string "%\n") |
22611 | 1092 ;; put in verbose mode |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1093 (ispell-send-string (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) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1097 ;; Wait until ispell has processed word. Since this code is often |
67178
db5dfb03d180
(flyspell-last-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66932
diff
changeset
|
1098 ;; executed from post-command-hook but the ispell process may not |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1099 ;; be responsive, it's important to make sure we re-enable C-g. |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1100 (with-local-quit |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1101 (while (progn |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1102 (accept-process-output ispell-process) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1103 (not (string= "" (car ispell-filter)))))) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1104 ;; (ispell-send-string "!\n") |
22611 | 1105 ;; back to terse mode. |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1106 ;; Remove leading empty element |
22611 | 1107 (setq ispell-filter (cdr ispell-filter)) |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1108 ;; ispell process should return something after word is sent. |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1109 ;; Tag word as valid (i.e., skip) otherwise |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1110 (or ispell-filter |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1111 (setq ispell-filter '(*))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1112 (if (consp ispell-filter) |
22611 | 1113 (setq poss (ispell-parse-output (car ispell-filter)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1114 (let ((res (cond ((eq poss t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1115 ;; correct |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1116 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1117 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1118 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1119 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1120 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1121 ((and (stringp poss) flyspell-highlight-flag) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1122 ;; correct |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1123 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1124 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1125 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1126 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1127 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1128 ((null poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1129 (setq flyspell-word-cache-result t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1130 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1131 (if (> end start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1132 (flyspell-unhighlight-at (- end 1))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1133 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1134 ((or (and (< flyspell-duplicate-distance 0) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1135 (or (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1136 (goto-char start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1137 (flyspell-word-search-backward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1138 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1139 (point-min))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1140 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1141 (goto-char end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1142 (flyspell-word-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1143 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1144 (point-max))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1145 (and (> flyspell-duplicate-distance 0) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1146 (or (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1147 (goto-char start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1148 (flyspell-word-search-backward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1149 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1150 (- start |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1151 flyspell-duplicate-distance))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1152 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1153 (goto-char end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1154 (flyspell-word-search-forward |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1155 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1156 (+ end |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1157 flyspell-duplicate-distance)))))) |
65662
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1158 ;; This is a misspelled word which occurs |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1159 ;; twice within flyspell-duplicate-distance. |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1160 (setq flyspell-word-cache-result nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1161 (if flyspell-highlight-flag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1162 (flyspell-highlight-duplicate-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1163 start end poss) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
1164 (message "duplicate `%s'" word)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1165 nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1166 (t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1167 (setq flyspell-word-cache-result nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1168 ;; incorrect highlight the location |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1169 (if flyspell-highlight-flag |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1170 (flyspell-highlight-incorrect-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1171 start end poss) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1172 (flyspell-notify-misspell word poss)) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1173 nil)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1174 ;; return to original location |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1175 (goto-char cursor-location) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1176 (if ispell-quit (setq ispell-quit nil)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1177 res)))))))) |
22611 | 1178 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1179 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1180 ;;* flyspell-math-tex-command-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1181 ;;* ------------------------------------------------------------- */ |
98200
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1182 ;;* This function uses the texmathp package to check if point */ |
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1183 ;;* is within a TeX math environment. `texmathp' can yield errors */ |
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1184 ;;* if the document is currently not valid TeX syntax. */ |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1185 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1186 (defun flyspell-math-tex-command-p () |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1187 (when (fboundp 'texmathp) |
98200
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1188 (if flyspell-check-tex-math-command |
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1189 nil |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1190 (condition-case nil |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
1191 (texmathp) |
98200
4f3b2bef6df0
(flyspell-math-tex-command-p): Always catch errors raised in
Chong Yidong <cyd@stupidchicken.com>
parents:
97785
diff
changeset
|
1192 (error nil))))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1193 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1194 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1195 ;;* flyspell-tex-command-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1196 ;;*---------------------------------------------------------------------*/ |
22611 | 1197 (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
|
1198 "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
|
1199 (or (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1200 (let ((b (car (cdr word)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1201 (and (re-search-backward "\\\\" (- (point) 100) t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1202 (or (= (match-end 0) b) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1203 (and (goto-char (match-end 0)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1204 (looking-at flyspell-tex-command-regexp) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1205 (>= (match-end 0) b)))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1206 (flyspell-math-tex-command-p))) |
22611 | 1207 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1208 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1209 ;;* flyspell-casechars-cache ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1210 ;;*---------------------------------------------------------------------*/ |
22611 | 1211 (defvar flyspell-casechars-cache nil) |
1212 (defvar flyspell-ispell-casechars-cache nil) | |
1213 (make-variable-buffer-local 'flyspell-casechars-cache) | |
1214 (make-variable-buffer-local 'flyspell-ispell-casechars-cache) | |
1215 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1216 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1217 ;;* flyspell-get-casechars ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1218 ;;*---------------------------------------------------------------------*/ |
22611 | 1219 (defun flyspell-get-casechars () |
1220 "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
|
1221 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
|
1222 this function changes the last char of the `ispell-casechars' string." |
22611 | 1223 (let ((ispell-casechars (ispell-get-casechars))) |
1224 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1225 ((eq ispell-parser 'tex) |
22611 | 1226 (setq flyspell-ispell-casechars-cache ispell-casechars) |
1227 (setq flyspell-casechars-cache | |
1228 (concat (substring ispell-casechars | |
1229 0 | |
1230 (- (length ispell-casechars) 1)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1231 "]")) |
22611 | 1232 flyspell-casechars-cache) |
1233 (t | |
1234 (setq flyspell-ispell-casechars-cache ispell-casechars) | |
1235 (setq flyspell-casechars-cache ispell-casechars) | |
1236 flyspell-casechars-cache)))) | |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1237 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1238 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1239 ;;* flyspell-get-not-casechars-cache ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1240 ;;*---------------------------------------------------------------------*/ |
22611 | 1241 (defvar flyspell-not-casechars-cache nil) |
1242 (defvar flyspell-ispell-not-casechars-cache nil) | |
1243 (make-variable-buffer-local 'flyspell-not-casechars-cache) | |
1244 (make-variable-buffer-local 'flyspell-ispell-not-casechars-cache) | |
1245 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1246 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1247 ;;* flyspell-get-not-casechars ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1248 ;;*---------------------------------------------------------------------*/ |
22611 | 1249 (defun flyspell-get-not-casechars () |
1250 "This function builds a string that is the regexp of non-word chars." | |
1251 (let ((ispell-not-casechars (ispell-get-not-casechars))) | |
1252 (cond | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1253 ((eq ispell-parser 'tex) |
22611 | 1254 (setq flyspell-ispell-not-casechars-cache ispell-not-casechars) |
1255 (setq flyspell-not-casechars-cache | |
1256 (concat (substring ispell-not-casechars | |
1257 0 | |
1258 (- (length ispell-not-casechars) 1)) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1259 "]")) |
22611 | 1260 flyspell-not-casechars-cache) |
1261 (t | |
1262 (setq flyspell-ispell-not-casechars-cache ispell-not-casechars) | |
1263 (setq flyspell-not-casechars-cache ispell-not-casechars) | |
1264 flyspell-not-casechars-cache)))) | |
1265 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1266 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1267 ;;* flyspell-get-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1268 ;;*---------------------------------------------------------------------*/ |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1269 (defun flyspell-get-word (following &optional extra-otherchars) |
22611 | 1270 "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
|
1271 If optional argument FOLLOWING is non-nil or if `flyspell-following-word' |
22611 | 1272 is non-nil when called interactively, then the following word |
1273 \(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
|
1274 Optional second argument contains otherchars that can be included in word |
22611 | 1275 many times. |
1276 | |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1277 Word syntax described by `flyspell-dictionary-alist' (which see)." |
22611 | 1278 (let* ((flyspell-casechars (flyspell-get-casechars)) |
1279 (flyspell-not-casechars (flyspell-get-not-casechars)) | |
1280 (ispell-otherchars (ispell-get-otherchars)) | |
1281 (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
|
1282 (word-regexp (concat flyspell-casechars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1283 "+\\(" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1284 (if (not (string= "" ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1285 (concat ispell-otherchars "?")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1286 (if extra-otherchars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1287 (concat extra-otherchars "?")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1288 flyspell-casechars |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1289 "+\\)" |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1290 (if (or ispell-many-otherchars-p |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1291 extra-otherchars) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1292 "*" "?"))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1293 did-it-once prevpt |
22611 | 1294 start end word) |
1295 ;; find the word | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1296 (if (not (looking-at flyspell-casechars)) |
22611 | 1297 (if following |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1298 (re-search-forward flyspell-casechars nil t) |
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1299 (re-search-backward flyspell-casechars nil t))) |
22611 | 1300 ;; move to front of word |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1301 (re-search-backward flyspell-not-casechars nil 'start) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1302 (while (and (or (and (not (string= "" ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1303 (looking-at ispell-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1304 (and extra-otherchars (looking-at extra-otherchars))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1305 (not (bobp)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1306 (or (not did-it-once) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1307 ispell-many-otherchars-p) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1308 (not (eq prevpt (point)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1309 (if (and extra-otherchars (looking-at extra-otherchars)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1310 (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
|
1311 (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
|
1312 (if (looking-at flyspell-casechars) |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1313 (re-search-backward flyspell-not-casechars nil 'move))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1314 (setq did-it-once t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1315 prevpt (point)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1316 (backward-char 1) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1317 (if (looking-at flyspell-casechars) |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1318 (re-search-backward flyspell-not-casechars nil 'move) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1319 (backward-char -1)))) |
22611 | 1320 ;; Now mark the word and save to string. |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1321 (if (not (re-search-forward word-regexp nil t)) |
22611 | 1322 nil |
1323 (progn | |
1324 (setq start (match-beginning 0) | |
1325 end (point) | |
36129
4c28e9406f50
(flyspell-get-word): Return string without
Dave Love <fx@gnu.org>
parents:
36120
diff
changeset
|
1326 word (buffer-substring-no-properties start end)) |
22611 | 1327 (list word start end))))) |
1328 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1329 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1330 ;;* flyspell-small-region ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1331 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1332 (defun flyspell-small-region (beg end) |
22611 | 1333 "Flyspell text between BEG and END." |
1334 (save-excursion | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1335 (if (> beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1336 (let ((old beg)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1337 (setq beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1338 (setq end old))) |
22611 | 1339 (goto-char beg) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1340 (let ((count 0)) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1341 (while (< (point) end) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1342 (if (and flyspell-issue-message-flag (= count 100)) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1343 (progn |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1344 (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
|
1345 (* 100 (/ (float (- (point) beg)) (- end beg)))) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1346 (setq count 0)) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1347 (setq count (+ 1 count))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1348 (flyspell-word) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1349 (sit-for 0) |
22612
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1350 (let ((cur (point))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1351 (forward-word 1) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1352 (if (and (< (point) end) (> (point) (+ cur 1))) |
6def3da74c7c
Delete defcustom definition.
Richard M. Stallman <rms@gnu.org>
parents:
22611
diff
changeset
|
1353 (backward-char 1))))) |
22611 | 1354 (backward-char 1) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1355 (if flyspell-issue-message-flag (message "Spell Checking completed.")) |
22611 | 1356 (flyspell-word))) |
1357 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1358 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1359 ;;* flyspell-external-ispell-process ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1360 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1361 (defvar flyspell-external-ispell-process '() |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
1362 "The external Flyspell Ispell process.") |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1363 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1364 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1365 ;;* flyspell-external-ispell-buffer ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1366 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1367 (defvar flyspell-external-ispell-buffer '()) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1368 (defvar flyspell-large-region-buffer '()) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1369 (defvar flyspell-large-region-beg (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1370 (defvar flyspell-large-region-end (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1371 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1372 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1373 ;;* flyspell-external-point-words ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1374 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1375 (defun flyspell-external-point-words () |
65958
2fb78041ad35
(flyspell-external-point-words): Simplify logic, and don't try to
Richard M. Stallman <rms@gnu.org>
parents:
65835
diff
changeset
|
1376 "Mark words from a buffer listing incorrect words in order of appearance. |
2fb78041ad35
(flyspell-external-point-words): Simplify logic, and don't try to
Richard M. Stallman <rms@gnu.org>
parents:
65835
diff
changeset
|
1377 The list of incorrect words should be in `flyspell-external-ispell-buffer'. |
2fb78041ad35
(flyspell-external-point-words): Simplify logic, and don't try to
Richard M. Stallman <rms@gnu.org>
parents:
65835
diff
changeset
|
1378 \(We finish by killing that buffer and setting the variable to nil.) |
2fb78041ad35
(flyspell-external-point-words): Simplify logic, and don't try to
Richard M. Stallman <rms@gnu.org>
parents:
65835
diff
changeset
|
1379 The buffer to mark them in is `flyspell-large-region-buffer'." |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1380 (let (words-not-found |
67858
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1381 (ispell-otherchars (ispell-get-otherchars)) |
69254
877f109009ca
(flyspell-external-point-words): Be case-sensitive.
Eli Zaretskii <eliz@gnu.org>
parents:
68424
diff
changeset
|
1382 (buffer-scan-pos flyspell-large-region-beg) |
69379
385f9e668650
(flyspell-external-point-words, flyspell-process-localwords): Fix last changes.
Eli Zaretskii <eliz@gnu.org>
parents:
69270
diff
changeset
|
1383 case-fold-search) |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1384 (with-current-buffer flyspell-external-ispell-buffer |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1385 (goto-char (point-min)) |
67858
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1386 ;; Loop over incorrect words, in the order they were reported, |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1387 ;; which is also the order they appear in the buffer being checked. |
67729
88f36bfe01f5
(flyspell-check-word-p): Don't quote - in a regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67595
diff
changeset
|
1388 (while (re-search-forward "\\([^\n]+\\)\n" nil t) |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1389 ;; Bind WORD to the next one. |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1390 (let ((word (match-string 1)) (wordpos (point))) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1391 ;; Here there used to be code to see if WORD is the same |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1392 ;; as the previous iteration, and count the number of consecutive |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1393 ;; identical words, and the loop below would search for that many. |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1394 ;; That code seemed to be incorrect, and on principle, should |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1395 ;; be unnecessary too. -- rms. |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1396 (if flyspell-issue-message-flag |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1397 (message "Spell Checking...%d%% [%s]" |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1398 (* 100 (/ (float (point)) (point-max))) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1399 word)) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1400 (with-current-buffer flyspell-large-region-buffer |
67858
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1401 (goto-char buffer-scan-pos) |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1402 (let ((keep t)) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1403 ;; Iterate on string search until string is found as word, |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1404 ;; not as substring |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1405 (while keep |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1406 (if (search-forward word |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1407 flyspell-large-region-end t) |
67858
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1408 (let* ((found-list |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1409 (save-excursion |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1410 ;; Move back into the match |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1411 ;; so flyspell-get-word will find it. |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1412 (forward-char -1) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1413 (flyspell-get-word nil))) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1414 (found (car found-list)) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1415 (found-length (length found)) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1416 (misspell-length (length word))) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1417 (when (or |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1418 ;; Size matches, we really found it. |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1419 (= found-length misspell-length) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1420 ;; Matches as part of a boundary-char separated word |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1421 (member word |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1422 (split-string found ispell-otherchars)) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1423 ;; Misspelling has higher length than |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1424 ;; what flyspell considers the |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1425 ;; word. Caused by boundary-chars |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1426 ;; mismatch. Validating seems safe. |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1427 (< found-length misspell-length) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1428 ;; ispell treats beginning of some TeX |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1429 ;; commands as nroff control sequences |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1430 ;; and strips them in the list of |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1431 ;; misspelled words thus giving a |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1432 ;; non-existent word. Skip if ispell |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1433 ;; is used, string is a TeX command |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1434 ;; (char before beginning of word is |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1435 ;; backslash) and none of the previous |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1436 ;; contitions match |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1437 (and (not ispell-really-aspell) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1438 (save-excursion |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1439 (goto-char (- (nth 1 found-list) 1)) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1440 (if (looking-at "[\\]" ) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1441 t |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1442 nil)))) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1443 (setq keep nil) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1444 (flyspell-word) |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1445 ;; Search for next misspelled word will begin from |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1446 ;; end of last validated match. |
35ea50aa6020
(flyspell-external-point-words):
Richard M. Stallman <rms@gnu.org>
parents:
67729
diff
changeset
|
1447 (setq buffer-scan-pos (point)))) |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1448 ;; Record if misspelling is not found and try new one |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1449 (add-to-list 'words-not-found |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1450 (concat " -> " word " - " |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1451 (int-to-string wordpos))) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1452 (setq keep nil))))))) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1453 ;; we are done |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1454 (if flyspell-issue-message-flag (message "Spell Checking completed."))) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1455 ;; Warn about not found misspellings |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1456 (dolist (word words-not-found) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1457 (message "%s: word not found" word)) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1458 ;; Kill and forget the buffer with the list of incorrect words. |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1459 (kill-buffer flyspell-external-ispell-buffer) |
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1460 (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
|
1461 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1462 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1463 ;;* flyspell-process-localwords ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1464 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1465 ;;* This function is used to prevent marking of words explicitly */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1466 ;;* declared correct. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1467 ;;*---------------------------------------------------------------------*/ |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1468 (defun flyspell-process-localwords (misspellings-buffer) |
69379
385f9e668650
(flyspell-external-point-words, flyspell-process-localwords): Fix last changes.
Eli Zaretskii <eliz@gnu.org>
parents:
69270
diff
changeset
|
1469 (let (localwords case-fold-search |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1470 (ispell-casechars (ispell-get-casechars))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1471 ;; Get localwords from the original buffer |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1472 (save-excursion |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1473 (goto-char (point-min)) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1474 ;; Localwords parsing copied from ispell.el. |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1475 (while (search-forward ispell-words-keyword nil t) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1476 (let ((end (save-excursion (end-of-line) (point))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1477 string) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1478 ;; buffer-local words separated by a space, and can contain |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1479 ;; any character other than a space. Not rigorous enough. |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1480 (while (re-search-forward " *\\([^ ]+\\)" end t) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1481 (setq string (buffer-substring-no-properties (match-beginning 1) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1482 (match-end 1))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1483 ;; This can fail when string contains a word with invalid chars. |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1484 ;; Error handling needs to be added between Ispell and Emacs. |
67254
a52ff1637e2f
(flyspell-external-point-words): Consider a misspelling as found in the string
Eli Zaretskii <eliz@gnu.org>
parents:
67178
diff
changeset
|
1485 (if (and (< 1 (length string)) |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1486 (equal 0 (string-match ispell-casechars string))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1487 (push string localwords)))))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1488 ;; Remove localwords matches from misspellings-buffer. |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1489 ;; The usual mechanism of communicating the local words to ispell |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1490 ;; does not affect the special ispell process used by |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1491 ;; flyspell-large-region. |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1492 (with-current-buffer misspellings-buffer |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1493 (save-excursion |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1494 (dolist (word localwords) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1495 (goto-char (point-min)) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1496 (let ((regexp (concat "^" word "\n"))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1497 (while (re-search-forward regexp nil t) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1498 (delete-region (match-beginning 0) (match-end 0))))))))) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1499 |
72924
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1500 ;;* --------------------------------------------------------------- |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1501 ;;* flyspell-check-region-doublons |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1502 ;;* --------------------------------------------------------------- |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1503 (defun flyspell-check-region-doublons (beg end) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1504 "Check for adjacent duplicated words (doublons) in the given region." |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1505 (save-excursion |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1506 (goto-char beg) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1507 (flyspell-word) ; Make sure current word is checked |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1508 (backward-word 1) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1509 (while (and (< (point) end) |
73480
93f756e426b8
* textmodes/flyspell.el (flyspell-check-region-doublons): Fix last
Chong Yidong <cyd@stupidchicken.com>
parents:
73462
diff
changeset
|
1510 (re-search-forward "\\<\\(\\w+\\)\\>[ \n\t\f]+\\1\\>" |
72924
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1511 end 'move)) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1512 (flyspell-word) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1513 (backward-word 1)) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1514 (flyspell-word))) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1515 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1516 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1517 ;;* flyspell-large-region ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1518 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1519 (defun flyspell-large-region (beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1520 (let* ((curbuf (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1521 (buffer (get-buffer-create "*flyspell-region*"))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1522 (setq flyspell-external-ispell-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1523 (setq flyspell-large-region-buffer curbuf) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1524 (setq flyspell-large-region-beg beg) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1525 (setq flyspell-large-region-end end) |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1526 (flyspell-accept-buffer-local-defs) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1527 (set-buffer buffer) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1528 (erase-buffer) |
37008 | 1529 ;; 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
|
1530 (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
|
1531 (set-buffer curbuf) |
94303
e0b01f455de0
* ispell.el (ispell-set-spellchecker-params): New function to make sure
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93800
diff
changeset
|
1532 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists |
86953
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1533 ;; Local dictionary becomes the global dictionary in use. |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1534 (setq ispell-current-dictionary |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1535 (or ispell-local-dictionary ispell-dictionary)) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1536 (setq ispell-current-personal-dictionary |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1537 (or ispell-local-pdict ispell-personal-dictionary)) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1538 (let ((args (ispell-get-ispell-args)) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1539 (encoding (ispell-get-coding-system)) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1540 c) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1541 (if (and ispell-current-dictionary ; use specified dictionary |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1542 (not (member "-d" args))) ; only define if not overridden |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1543 (setq args |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1544 (append (list "-d" ispell-current-dictionary) args))) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1545 (if ispell-current-personal-dictionary ; use specified pers dict |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1546 (setq args |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1547 (append args |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1548 (list "-p" |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1549 (expand-file-name |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1550 ispell-current-personal-dictionary))))) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1551 (setq args (append args ispell-extra-args)) |
100500
e7cd485b79ff
(ispell-really-hunspell): new variable to signal hunspell
Agustin Martin <agustin.martin@hispalinux.es>
parents:
98200
diff
changeset
|
1552 |
e7cd485b79ff
(ispell-really-hunspell): new variable to signal hunspell
Agustin Martin <agustin.martin@hispalinux.es>
parents:
98200
diff
changeset
|
1553 ;; If we are using recent aspell or hunspell, make sure we use the right encoding |
e7cd485b79ff
(ispell-really-hunspell): new variable to signal hunspell
Agustin Martin <agustin.martin@hispalinux.es>
parents:
98200
diff
changeset
|
1554 ;; for communication. ispell or older aspell/hunspell does not support this |
100987
34edfe1ce294
ispell.el (ispell-encoding8-command): New variable
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100908
diff
changeset
|
1555 (if ispell-encoding8-command |
86953
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1556 (setq args |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1557 (append args |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1558 (list |
100987
34edfe1ce294
ispell.el (ispell-encoding8-command): New variable
Agustin Martin <agustin.martin@hispalinux.es>
parents:
100908
diff
changeset
|
1559 (concat ispell-encoding8-command |
86953
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1560 (symbol-name |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1561 encoding)))))) |
100500
e7cd485b79ff
(ispell-really-hunspell): new variable to signal hunspell
Agustin Martin <agustin.martin@hispalinux.es>
parents:
98200
diff
changeset
|
1562 |
86953
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1563 (let ((process-coding-system-alist (list (cons "\\.*" encoding)))) |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1564 (setq c (apply 'ispell-call-process-region beg |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1565 end |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1566 ispell-program-name |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1567 nil |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1568 buffer |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1569 nil |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1570 (if ispell-really-aspell "list" "-l") |
3508192ca0a3
Agustin Martin <agustin.martin at hispalinux.es>
Glenn Morris <rgm@gnu.org>
parents:
85765
diff
changeset
|
1571 args))) |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53420
diff
changeset
|
1572 (if (eq c 0) |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1573 (progn |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1574 (flyspell-process-localwords buffer) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1575 (with-current-buffer curbuf |
72924
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1576 (flyspell-delete-region-overlays beg end) |
d50645027830
* textmodes/flyspell.el (flyspell-check-region-doublons): New
Chong Yidong <cyd@stupidchicken.com>
parents:
72857
diff
changeset
|
1577 (flyspell-check-region-doublons beg end)) |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1578 (flyspell-external-point-words)) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1579 (error "Can't check region..."))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1580 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1581 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1582 ;;* flyspell-region ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1583 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1584 ;;* Because `ispell -a' is too slow, it is not possible to use */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1585 ;;* it on large region. Then, when ispell is invoked on a large */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1586 ;;* text region, a new `ispell -l' process is spawned. The */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1587 ;;* pointed out words are then searched in the region a checked with */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1588 ;;* regular flyspell means. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1589 ;;*---------------------------------------------------------------------*/ |
36120
927cbaaa27f8
(flyspell-region, flyspell-buffer):
Gerd Moellmann <gerd@gnu.org>
parents:
35617
diff
changeset
|
1590 ;;;###autoload |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1591 (defun flyspell-region (beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1592 "Flyspell text between BEG and END." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1593 (interactive "r") |
94303
e0b01f455de0
* ispell.el (ispell-set-spellchecker-params): New function to make sure
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93800
diff
changeset
|
1594 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1595 (if (= beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1596 () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1597 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1598 (if (> beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1599 (let ((old beg)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1600 (setq beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1601 (setq end old))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1602 (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
|
1603 (flyspell-large-region beg end) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1604 (flyspell-small-region beg end))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1605 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1606 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1607 ;;* flyspell-buffer ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1608 ;;*---------------------------------------------------------------------*/ |
36120
927cbaaa27f8
(flyspell-region, flyspell-buffer):
Gerd Moellmann <gerd@gnu.org>
parents:
35617
diff
changeset
|
1609 ;;;###autoload |
22611 | 1610 (defun flyspell-buffer () |
1611 "Flyspell whole buffer." | |
1612 (interactive) | |
1613 (flyspell-region (point-min) (point-max))) | |
1614 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1615 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1616 ;;* old next error position ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1617 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1618 (defvar flyspell-old-buffer-error nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1619 (defvar flyspell-old-pos-error nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1620 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1621 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1622 ;;* flyspell-goto-next-error ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1623 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1624 (defun flyspell-goto-next-error () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1625 "Go to the next previously detected error. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1626 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
|
1627 FLYSPELL-BUFFER." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1628 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1629 (let ((pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1630 (max (point-max))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1631 (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
|
1632 (eq pos flyspell-old-pos-error)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1633 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1634 (if (= flyspell-old-pos-error max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1635 ;; goto beginning of buffer |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1636 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1637 (message "Restarting from beginning of buffer") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1638 (goto-char (point-min))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1639 (forward-word 1)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1640 (setq pos (point)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1641 ;; seek the next error |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1642 (while (and (< pos max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1643 (let ((ovs (overlays-at pos)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1644 (r '())) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1645 (while (and (not r) (consp ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1646 (if (flyspell-overlay-p (car ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1647 (setq r t) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1648 (setq ovs (cdr ovs)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1649 (not r))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1650 (setq pos (1+ pos))) |
37008 | 1651 ;; 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
|
1652 (setq flyspell-old-pos-error pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1653 (setq flyspell-old-buffer-error (current-buffer)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1654 (goto-char pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1655 (if (= pos max) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1656 (message "No more miss-spelled word!")))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1657 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1658 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1659 ;;* flyspell-overlay-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1660 ;;*---------------------------------------------------------------------*/ |
22611 | 1661 (defun flyspell-overlay-p (o) |
78482
80e300a489d6
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
1662 "Return true if O is an overlay used by flyspell." |
22611 | 1663 (and (overlayp o) (overlay-get o 'flyspell-overlay))) |
1664 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1665 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1666 ;;* flyspell-delete-region-overlays, flyspell-delete-all-overlays */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1667 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1668 ;;* Remove overlays introduced by flyspell. */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1669 ;;*---------------------------------------------------------------------*/ |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1670 (defun flyspell-delete-region-overlays (beg end) |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1671 "Delete overlays used by flyspell in a given region." |
66930
bf55d63c7dd6
(flyspell-delete-region-overlays): Use remove-overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66855
diff
changeset
|
1672 (remove-overlays beg end 'flyspell-overlay t)) |
22611 | 1673 |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1674 |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1675 (defun flyspell-delete-all-overlays () |
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1676 "Delete all the overlays used by flyspell." |
67595
ce27da2c8c63
(flyspell-external-point-words): Use save-excursion to ensure we don't
Richard M. Stallman <rms@gnu.org>
parents:
67254
diff
changeset
|
1677 (remove-overlays (point-min) (point-max) 'flyspell-overlay t)) |
66855
30d90742b0a8
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
Richard M. Stallman <rms@gnu.org>
parents:
66736
diff
changeset
|
1678 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1679 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1680 ;;* flyspell-unhighlight-at ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1681 ;;*---------------------------------------------------------------------*/ |
22611 | 1682 (defun flyspell-unhighlight-at (pos) |
1683 "Remove the flyspell overlay that are located at POS." | |
1684 (if flyspell-persistent-highlight | |
1685 (let ((overlays (overlays-at pos))) | |
1686 (while (consp overlays) | |
1687 (if (flyspell-overlay-p (car overlays)) | |
1688 (delete-overlay (car overlays))) | |
1689 (setq overlays (cdr overlays)))) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1690 (if (flyspell-overlay-p flyspell-overlay) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1691 (delete-overlay flyspell-overlay)))) |
22611 | 1692 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1693 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1694 ;;* flyspell-properties-at-p ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1695 ;;* ------------------------------------------------------------- */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1696 ;;* Is there an highlight properties at position pos? */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1697 ;;*---------------------------------------------------------------------*/ |
22891
780c3ef895d7
(flyspell-duplicate-distance): Doc fix; change default to 10000.
Richard M. Stallman <rms@gnu.org>
parents:
22844
diff
changeset
|
1698 (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
|
1699 "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
|
1700 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
|
1701 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
|
1702 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
|
1703 (let ((prop (text-properties-at pos)) |
22611 | 1704 (keep t)) |
1705 (while (and keep (consp prop)) | |
1706 (if (and (eq (car prop) 'local-map) (consp (cdr prop))) | |
1707 (setq prop (cdr (cdr prop))) | |
1708 (setq keep nil))) | |
1709 (consp prop))) | |
1710 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1711 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1712 ;;* make-flyspell-overlay ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1713 ;;*---------------------------------------------------------------------*/ |
22611 | 1714 (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
|
1715 "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
|
1716 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
|
1717 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
|
1718 for the overlay." |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1719 (let ((overlay (make-overlay beg end nil t nil))) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1720 (overlay-put overlay 'face face) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1721 (overlay-put overlay 'mouse-face mouse-face) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1722 (overlay-put overlay 'flyspell-overlay t) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1723 (overlay-put overlay 'evaporate t) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1724 (overlay-put overlay 'help-echo "mouse-2: correct word at point") |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1725 (overlay-put overlay 'keymap flyspell-mouse-map) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1726 (when (eq face 'flyspell-incorrect) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1727 (and (stringp flyspell-before-incorrect-word-string) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1728 (overlay-put overlay 'before-string |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1729 flyspell-before-incorrect-word-string)) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1730 (and (stringp flyspell-after-incorrect-word-string) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1731 (overlay-put overlay 'after-string |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1732 flyspell-after-incorrect-word-string))) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1733 overlay)) |
43016
ee78d55b45f4
Minor formatting fixes in preparation of merging new version.
Pavel Janík <Pavel@Janik.cz>
parents:
42684
diff
changeset
|
1734 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1735 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1736 ;;* flyspell-highlight-incorrect-region ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1737 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1738 (defun flyspell-highlight-incorrect-region (beg end poss) |
65662
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1739 "Set up an overlay on a misspelled word, in the buffer from BEG to END. |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1740 POSS is usually a list of possible spelling/correction lists, |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1741 as returned by `ispell-parse-output'. |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1742 It can also be the symbol `doublon', in the case where the word |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1743 is itself incorrect, but suspiciously repeated." |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1744 (let ((inhibit-read-only t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1745 (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
|
1746 'flyspell-incorrect-hook beg end poss) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1747 (if (or flyspell-highlight-properties |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1748 (not (flyspell-properties-at-p beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1749 (progn |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1750 ;; 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
|
1751 ;; beginning at the word start position |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1752 (if (< (1+ beg) end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1753 (let ((os (overlays-in (1+ beg) end))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1754 (while (consp os) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1755 (if (flyspell-overlay-p (car os)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1756 (delete-overlay (car os))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1757 (setq os (cdr os))))) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1758 ;; we cleanup current overlay at the same position |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1759 (flyspell-unhighlight-at beg) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1760 ;; 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
|
1761 (setq flyspell-overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1762 (make-flyspell-overlay |
73462
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1763 beg end |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1764 (if (eq poss 'doublon) 'flyspell-duplicate 'flyspell-incorrect) |
9b076439f58a
* textmodes/flyspell.el (flyspell-word): Skip past all previous
Chong Yidong <cyd@stupidchicken.com>
parents:
73406
diff
changeset
|
1765 'highlight))))))) |
22611 | 1766 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1767 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1768 ;;* flyspell-highlight-duplicate-region ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1769 ;;*---------------------------------------------------------------------*/ |
56767
448c214b700f
(flyspell-word): Use set-process-query-on-exit-flag.
Richard M. Stallman <rms@gnu.org>
parents:
56522
diff
changeset
|
1770 (defun flyspell-highlight-duplicate-region (beg end poss) |
65662
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1771 "Set up an overlay on a duplicate misspelled word, in the buffer from BEG to END. |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1772 POSS is a list of possible spelling/correction lists, |
f621d74f5b9a
(flyspell-incorrect-hook, flyspell-highlight-incorrect-region)
Richard M. Stallman <rms@gnu.org>
parents:
65583
diff
changeset
|
1773 as returned by `ispell-parse-output'." |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1774 (let ((inhibit-read-only t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1775 (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
|
1776 'flyspell-incorrect-hook beg end poss) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1777 (if (or flyspell-highlight-properties |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1778 (not (flyspell-properties-at-p beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1779 (progn |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1780 ;; we cleanup current overlay at the same position |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1781 (flyspell-unhighlight-at beg) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1782 ;; 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
|
1783 (setq flyspell-overlay |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1784 (make-flyspell-overlay beg end |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1785 'flyspell-duplicate |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
1786 'highlight))))))) |
22611 | 1787 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1788 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1789 ;;* flyspell-auto-correct-cache ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1790 ;;*---------------------------------------------------------------------*/ |
22611 | 1791 (defvar flyspell-auto-correct-pos nil) |
1792 (defvar flyspell-auto-correct-region nil) | |
1793 (defvar flyspell-auto-correct-ring nil) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1794 (defvar flyspell-auto-correct-word nil) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1795 (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
|
1796 (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
|
1797 (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
|
1798 (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
|
1799 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1800 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1801 ;;* flyspell-check-previous-highlighted-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1802 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1803 (defun flyspell-check-previous-highlighted-word (&optional arg) |
37008 | 1804 "Correct the closer misspelled word. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1805 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
|
1806 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
|
1807 misspelled words backwards." |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1808 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1809 (let ((pos1 (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1810 (pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1811 (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
|
1812 ov ovs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1813 (if (catch 'exit |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1814 (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
|
1815 (not (= pos pos1))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1816 (setq pos1 pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1817 (if (> pos (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1818 (progn |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1819 (setq ovs (overlays-at (1- pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1820 (while (consp ovs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1821 (setq ov (car ovs)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1822 (setq ovs (cdr ovs)) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1823 (if (and (flyspell-overlay-p ov) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1824 (= 0 (setq arg (1- arg)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1825 (throw 'exit t))))))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1826 (save-excursion |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1827 (goto-char pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1828 (ispell-word)) |
35617
da38a879b6fe
Doc fixes. Add :version to new options.
Dave Love <fx@gnu.org>
parents:
35338
diff
changeset
|
1829 (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
|
1830 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1831 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1832 ;;* flyspell-display-next-corrections ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1833 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1834 (defun flyspell-display-next-corrections (corrections) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1835 (let ((string "Corrections:") |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1836 (l corrections) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1837 (pos '())) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1838 (while (< (length string) 80) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1839 (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
|
1840 (setq pos (cons (+ 1 (length string)) pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1841 (setq string (concat string " " (car l))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1842 (setq l (cdr l))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1843 (while (consp pos) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1844 (let ((num (car pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1845 (put-text-property num |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1846 (+ num (length flyspell-auto-correct-word)) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
1847 'face 'flyspell-incorrect |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1848 string)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1849 (setq pos (cdr pos))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1850 (if (fboundp 'display-message) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1851 (display-message 'no-log string) |
65583
703495630901
Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents:
64994
diff
changeset
|
1852 (message "%s" string)))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1853 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1854 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1855 ;;* flyspell-abbrev-table ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1856 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1857 (defun flyspell-abbrev-table () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1858 (if flyspell-use-global-abbrev-table-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1859 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
|
1860 (or local-abbrev-table global-abbrev-table))) |
22611 | 1861 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1862 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1863 ;;* flyspell-define-abbrev ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1864 ;;*---------------------------------------------------------------------*/ |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1865 (defun flyspell-define-abbrev (name expansion) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1866 (let ((table (flyspell-abbrev-table))) |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1867 (when table |
77381
b2648f8ce834
(flyspell-define-abbrev): Downcase abbrev before defining it.
Glenn Morris <rgm@gnu.org>
parents:
76984
diff
changeset
|
1868 (define-abbrev table (downcase name) expansion)))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1869 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1870 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1871 ;;* flyspell-auto-correct-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1872 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1873 (defun flyspell-auto-correct-word () |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1874 "Correct the current word. |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1875 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
|
1876 (interactive) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1877 (let ((pos (point)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1878 (old-max (point-max))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1879 ;; use the correct dictionary |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1880 (flyspell-accept-buffer-local-defs) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1881 (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
|
1882 (consp flyspell-auto-correct-region)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1883 ;; 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
|
1884 (let* ((start (car flyspell-auto-correct-region)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1885 (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
|
1886 (flyspell-unhighlight-at start) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1887 (delete-region start (+ start len)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1888 (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
|
1889 (let* ((word (car flyspell-auto-correct-ring)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1890 (len (length word))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1891 (rplacd flyspell-auto-correct-region len) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1892 (goto-char start) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1893 (if flyspell-abbrev-p |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1894 (if (flyspell-already-abbrevp (flyspell-abbrev-table) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1895 flyspell-auto-correct-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1896 (flyspell-change-abbrev (flyspell-abbrev-table) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1897 flyspell-auto-correct-word |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1898 word) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1899 (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
|
1900 (funcall flyspell-insert-function word) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1901 (flyspell-word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1902 (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
|
1903 (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
|
1904 (setq flyspell-auto-correct-pos (point))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
1905 ;; fetch the word to be checked |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1906 (let ((word (flyspell-get-word nil))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1907 (if (consp word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1908 (let ((start (car (cdr word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1909 (end (car (cdr (cdr word)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1910 (word (car word)) |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1911 poss ispell-filter) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1912 (setq flyspell-auto-correct-word word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1913 ;; now check spelling of word. |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1914 (ispell-send-string "%\n") ;put in verbose mode |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1915 (ispell-send-string (concat "^" word "\n")) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1916 ;; wait until ispell has processed word. |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1917 (while (progn |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1918 (accept-process-output ispell-process) |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1919 (not (string= "" (car ispell-filter))))) |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1920 ;; Remove leading empty element |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1921 (setq ispell-filter (cdr ispell-filter)) |
72857
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1922 ;; ispell process should return something after word is sent. |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1923 ;; Tag word as valid (i.e., skip) otherwise |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1924 (or ispell-filter |
6cd2742162f9
(flyspell-word, flyspell-correct-word)
Richard M. Stallman <rms@gnu.org>
parents:
71100
diff
changeset
|
1925 (setq ispell-filter '(*))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1926 (if (consp ispell-filter) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1927 (setq poss (ispell-parse-output (car ispell-filter)))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1928 (cond |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1929 ((or (eq poss t) (stringp poss)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1930 ;; don't correct word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1931 t) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1932 ((null poss) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1933 ;; ispell error |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1934 (error "Ispell: error in Ispell process")) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1935 (t |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1936 ;; 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
|
1937 (let ((replacements (if flyspell-sort-corrections |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1938 (sort (car (cdr (cdr poss))) 'string<) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1939 (car (cdr (cdr poss)))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1940 (setq flyspell-auto-correct-region nil) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1941 (if (consp replacements) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1942 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1943 (let ((replace (car replacements))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1944 (let ((new-word replace)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1945 (if (not (equal new-word (car poss))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1946 (progn |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1947 ;; the save the current replacements |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1948 (setq flyspell-auto-correct-region |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1949 (cons start (length new-word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1950 (let ((l replacements)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1951 (while (consp (cdr l)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1952 (setq l (cdr l))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1953 (rplacd l (cons (car poss) replacements))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1954 (setq flyspell-auto-correct-ring |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1955 replacements) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1956 (flyspell-unhighlight-at start) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1957 (delete-region start end) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1958 (funcall flyspell-insert-function new-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1959 (if flyspell-abbrev-p |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1960 (if (flyspell-already-abbrevp |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1961 (flyspell-abbrev-table) word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1962 (flyspell-change-abbrev |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1963 (flyspell-abbrev-table) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1964 word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1965 new-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1966 (flyspell-define-abbrev word |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1967 new-word))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1968 (flyspell-word) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1969 (flyspell-display-next-corrections |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1970 (cons new-word flyspell-auto-correct-ring)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1971 (flyspell-ajust-cursor-point pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1972 (point) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1973 old-max)))))))))) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1974 (setq flyspell-auto-correct-pos (point)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1975 (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
|
1976 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1977 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1978 ;;* flyspell-auto-correct-previous-pos ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1979 ;;*---------------------------------------------------------------------*/ |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1980 (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
|
1981 "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
|
1982 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1983 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1984 ;;* flyspell-auto-correct-previous-hook ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1985 ;;*---------------------------------------------------------------------*/ |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1986 (defun flyspell-auto-correct-previous-hook () |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1987 "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
|
1988 Sets `flyspell-auto-correct-previous-pos' to nil" |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1989 (interactive) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
1990 (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
|
1991 (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
|
1992 (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
|
1993 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1994 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1995 ;;* flyspell-auto-correct-previous-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1996 ;;*---------------------------------------------------------------------*/ |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
1997 (defun flyspell-auto-correct-previous-word (position) |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
1998 "Auto correct the first mispelled word that occurs before point. |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
1999 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
|
2000 (interactive "d") |
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
2001 |
77524
7be6bca439a5
(flyspell-auto-correct-previous-word): Use window-start and
Chong Yidong <cyd@stupidchicken.com>
parents:
77381
diff
changeset
|
2002 (let ((top (window-start)) |
7be6bca439a5
(flyspell-auto-correct-previous-word): Use window-start and
Chong Yidong <cyd@stupidchicken.com>
parents:
77381
diff
changeset
|
2003 (bot (window-end))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2004 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2005 (save-restriction |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2006 (narrow-to-region top bot) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2007 (overlay-recenter (point)) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
2008 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2009 (add-hook 'pre-command-hook |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2010 (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
|
2011 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2012 (unless flyspell-auto-correct-previous-pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2013 ;; only reset if a new overlay exists |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2014 (setq flyspell-auto-correct-previous-pos nil) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2015 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2016 (let ((overlay-list (overlays-in (point-min) position)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2017 (new-overlay 'dummy-value)) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2018 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2019 ;; search for previous (new) flyspell overlay |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2020 (while (and new-overlay |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2021 (or (not (flyspell-overlay-p new-overlay)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2022 ;; check if its face has changed |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2023 (not (eq (get-char-property |
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2024 (overlay-start new-overlay) 'face) |
63230
e64fc04555a1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Miles Bader <miles@gnu.org>
parents:
63122
diff
changeset
|
2025 'flyspell-incorrect)))) |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2026 (setq new-overlay (car-safe overlay-list)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2027 (setq overlay-list (cdr-safe overlay-list))) |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2028 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2029 ;; if nothing new exits new-overlay should be nil |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2030 (if new-overlay ;; the length of the word may change so go to the start |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2031 (setq flyspell-auto-correct-previous-pos |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2032 (overlay-start new-overlay))))) |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
2033 |
62868
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2034 (when flyspell-auto-correct-previous-pos |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2035 (save-excursion |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2036 (goto-char flyspell-auto-correct-previous-pos) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2037 (let ((ispell-following-word t)) ;; point is at start |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2038 (if (numberp flyspell-auto-correct-previous-pos) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2039 (goto-char flyspell-auto-correct-previous-pos)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2040 (flyspell-auto-correct-word)) |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2041 ;; the point may have moved so reset this |
3114c221f6b4
(flyspell-version): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
61380
diff
changeset
|
2042 (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
|
2043 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2044 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2045 ;;* flyspell-correct-word ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2046 ;;*---------------------------------------------------------------------*/ |
73779
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2047 |
22611 | 2048 (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
|
2049 "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
|
2050 The word checked is the word at the mouse position." |
22611 | 2051 (interactive "e") |
2052 (let ((save (point))) | |
2053 (mouse-set-point event) | |
73779
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2054 (flyspell-correct-word-before-point event save))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2055 |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2056 (defun flyspell-correct-word-before-point (&optional event opoint) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2057 "Pop up a menu of possible corrections for misspelled word before point. |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2058 If EVENT is non-nil, it is the mouse event that invoked this operation; |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2059 that controls where to put the menu. |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2060 If OPOINT is non-nil, restore point there after adjusting it for replacement." |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2061 (interactive) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2062 (unless (mouse-position) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2063 (error "Pop-up menus do not work on this terminal")) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2064 ;; use the correct dictionary |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2065 (flyspell-accept-buffer-local-defs) |
77801
ac2665c1975b
(flyspell-correct-word-before-point): Don't let opoint be nil.
Richard M. Stallman <rms@gnu.org>
parents:
77524
diff
changeset
|
2066 (or opoint (setq opoint (point-marker))) |
73779
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2067 (let ((cursor-location (point)) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2068 (word (flyspell-get-word nil))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2069 (if (consp word) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2070 (let ((start (car (cdr word))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2071 (end (car (cdr (cdr word)))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2072 (word (car word)) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2073 poss ispell-filter) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2074 ;; now check spelling of word. |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2075 (ispell-send-string "%\n") ;put in verbose mode |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2076 (ispell-send-string (concat "^" word "\n")) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2077 ;; wait until ispell has processed word |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2078 (while (progn |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2079 (accept-process-output ispell-process) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2080 (not (string= "" (car ispell-filter))))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2081 ;; Remove leading empty element |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2082 (setq ispell-filter (cdr ispell-filter)) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2083 ;; ispell process should return something after word is sent. |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2084 ;; Tag word as valid (i.e., skip) otherwise |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2085 (or ispell-filter |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2086 (setq ispell-filter '(*))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2087 (if (consp ispell-filter) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2088 (setq poss (ispell-parse-output (car ispell-filter)))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2089 (cond |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2090 ((or (eq poss t) (stringp poss)) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2091 ;; don't correct word |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2092 t) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2093 ((null poss) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2094 ;; ispell error |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2095 (error "Ispell: error in Ispell process")) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2096 ((featurep 'xemacs) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2097 (flyspell-xemacs-popup |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2098 poss word cursor-location start end opoint)) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2099 (t |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2100 ;; The word is incorrect, we have to propose a replacement. |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2101 (flyspell-do-correct (flyspell-emacs-popup event poss word) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2102 poss word cursor-location start end opoint))) |
ab4757475733
(flyspell-correct-word-before-point):
Richard M. Stallman <rms@gnu.org>
parents:
73652
diff
changeset
|
2103 (ispell-pdict-save t))))) |
22611 | 2104 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2105 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2106 ;;* flyspell-do-correct ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2107 ;;*---------------------------------------------------------------------*/ |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2108 (defun flyspell-do-correct (replace poss word cursor-location start end save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2109 "The popup menu callback." |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2110 ;; Originally, the XEmacs code didn't do the (goto-char save) here and did |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2111 ;; it instead right after calling the function. |
22611 | 2112 (cond ((eq replace 'ignore) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2113 (goto-char save) |
22611 | 2114 nil) |
2115 ((eq replace 'save) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2116 (goto-char save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2117 (ispell-send-string (concat "*" word "\n")) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2118 ;; This was added only to the XEmacs side in revision 1.18 of |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2119 ;; flyspell. I assume its absence on the Emacs side was an |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2120 ;; oversight. --Stef |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2121 (ispell-send-string "#\n") |
22611 | 2122 (flyspell-unhighlight-at cursor-location) |
2123 (setq ispell-pdict-modified-p '(t))) | |
2124 ((or (eq replace 'buffer) (eq replace 'session)) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2125 (ispell-send-string (concat "@" word "\n")) |
22611 | 2126 (flyspell-unhighlight-at cursor-location) |
2127 (if (null ispell-pdict-modified-p) | |
2128 (setq ispell-pdict-modified-p | |
2129 (list ispell-pdict-modified-p))) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2130 (goto-char save) |
22611 | 2131 (if (eq replace 'buffer) |
2132 (ispell-add-per-file-word-list word))) | |
2133 (replace | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2134 ;; This was added only to the Emacs side. I assume its absence on |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2135 ;; the XEmacs side was an oversight. --Stef |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2136 (flyspell-unhighlight-at cursor-location) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2137 (let ((old-max (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2138 (new-word (if (atom replace) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2139 replace |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2140 (car replace))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2141 (cursor-location (+ (- (length word) (- end start)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2142 cursor-location))) |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2143 (unless (equal new-word (car poss)) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2144 (delete-region start end) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2145 (goto-char start) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2146 (funcall flyspell-insert-function new-word) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2147 (if flyspell-abbrev-p |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2148 (flyspell-define-abbrev word new-word))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2149 ;; In the original Emacs code, this was only called in the body |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2150 ;; of the if. I arbitrarily kept the XEmacs behavior instead. |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2151 (flyspell-ajust-cursor-point save cursor-location old-max))) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2152 (t |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2153 (goto-char save) |
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2154 nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2155 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2156 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2157 ;;* flyspell-ajust-cursor-point ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2158 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2159 (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
|
2160 (if (>= save cursor-location) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2161 (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
|
2162 (goto-char (cond |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2163 ((< new-pos (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2164 (point-min)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2165 ((> new-pos (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2166 (point-max)) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2167 (t new-pos)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2168 (goto-char save))) |
22611 | 2169 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2170 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2171 ;;* flyspell-emacs-popup ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2172 ;;*---------------------------------------------------------------------*/ |
22844
1104a715c324
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
Richard M. Stallman <rms@gnu.org>
parents:
22648
diff
changeset
|
2173 (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
|
2174 "The Emacs popup menu." |
77801
ac2665c1975b
(flyspell-correct-word-before-point): Don't let opoint be nil.
Richard M. Stallman <rms@gnu.org>
parents:
77524
diff
changeset
|
2175 (unless window-system |
ac2665c1975b
(flyspell-correct-word-before-point): Don't let opoint be nil.
Richard M. Stallman <rms@gnu.org>
parents:
77524
diff
changeset
|
2176 (error "This command requires pop-up dialogs")) |
22611 | 2177 (if (not event) |
2178 (let* ((mouse-pos (mouse-position)) | |
2179 (mouse-pos (if (nth 1 mouse-pos) | |
2180 mouse-pos | |
2181 (set-mouse-position (car mouse-pos) | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2182 (/ (frame-width) 2) 2) |
22611 | 2183 (mouse-position)))) |
2184 (setq event (list (list (car (cdr mouse-pos)) | |
2185 (1+ (cdr (cdr mouse-pos)))) | |
2186 (car mouse-pos))))) | |
2187 (let* ((corrects (if flyspell-sort-corrections | |
2188 (sort (car (cdr (cdr poss))) 'string<) | |
2189 (car (cdr (cdr poss))))) | |
2190 (cor-menu (if (consp corrects) | |
2191 (mapcar (lambda (correct) | |
2192 (list correct correct)) | |
2193 corrects) | |
2194 '())) | |
2195 (affix (car (cdr (cdr (cdr poss))))) | |
68314
e5fac4fecc67
(flyspell-emacs-popup, flypell-xemacs-popup): Default to disabling the
Eli Zaretskii <eliz@gnu.org>
parents:
68237
diff
changeset
|
2196 show-affix-info |
e5fac4fecc67
(flyspell-emacs-popup, flypell-xemacs-popup): Default to disabling the
Eli Zaretskii <eliz@gnu.org>
parents:
68237
diff
changeset
|
2197 (base-menu (let ((save (if (and (consp affix) show-affix-info) |
22611 | 2198 (list |
2199 (list (concat "Save affix: " (car affix)) | |
2200 'save) | |
43064
aad0b1eb2142
(flyspell-issue-message-flag): New user option.
Pavel Janík <Pavel@Janik.cz>
parents:
43016
diff
changeset
|
2201 '("Accept (session)" session) |
22611 | 2202 '("Accept (buffer)" buffer)) |
2203 '(("Save word" save) | |
2204 ("Accept (session)" session) | |
2205 ("Accept (buffer)" buffer))))) | |
2206 (if (consp cor-menu) | |
2207 (append cor-menu (cons "" save)) | |
2208 save))) | |
2209 (menu (cons "flyspell correction menu" base-menu))) | |
2210 (car (x-popup-menu event | |
2211 (list (format "%s [%s]" word (or ispell-local-dictionary | |
2212 ispell-dictionary)) | |
2213 menu))))) | |
2214 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2215 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2216 ;;* flyspell-xemacs-popup ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2217 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2218 (defun flyspell-xemacs-popup (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
|
2219 "The XEmacs popup menu." |
22611 | 2220 (let* ((corrects (if flyspell-sort-corrections |
2221 (sort (car (cdr (cdr poss))) 'string<) | |
2222 (car (cdr (cdr poss))))) | |
2223 (cor-menu (if (consp corrects) | |
2224 (mapcar (lambda (correct) | |
2225 (vector correct | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2226 (list 'flyspell-do-correct |
22611 | 2227 correct |
2228 (list 'quote poss) | |
2229 word | |
2230 cursor-location | |
2231 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2232 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2233 save) |
22611 | 2234 t)) |
2235 corrects) | |
2236 '())) | |
2237 (affix (car (cdr (cdr (cdr poss))))) | |
68314
e5fac4fecc67
(flyspell-emacs-popup, flypell-xemacs-popup): Default to disabling the
Eli Zaretskii <eliz@gnu.org>
parents:
68237
diff
changeset
|
2238 show-affix-info |
e5fac4fecc67
(flyspell-emacs-popup, flypell-xemacs-popup): Default to disabling the
Eli Zaretskii <eliz@gnu.org>
parents:
68237
diff
changeset
|
2239 (menu (let ((save (if (and (consp affix) show-affix-info) |
22611 | 2240 (vector |
2241 (concat "Save affix: " (car affix)) | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2242 (list 'flyspell-do-correct |
22611 | 2243 ''save |
2244 (list 'quote poss) | |
2245 word | |
2246 cursor-location | |
2247 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2248 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2249 save) |
22611 | 2250 t) |
2251 (vector | |
2252 "Save word" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2253 (list 'flyspell-do-correct |
22611 | 2254 ''save |
2255 (list 'quote poss) | |
2256 word | |
2257 cursor-location | |
2258 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2259 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2260 save) |
22611 | 2261 t))) |
2262 (session (vector "Accept (session)" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2263 (list 'flyspell-do-correct |
22611 | 2264 ''session |
2265 (list 'quote poss) | |
2266 word | |
2267 cursor-location | |
2268 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2269 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2270 save) |
22611 | 2271 t)) |
2272 (buffer (vector "Accept (buffer)" | |
63100
d3c552b53ce8
(flyspell-auto-correct-binding, flyspell-incorrect-face)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62976
diff
changeset
|
2273 (list 'flyspell-do-correct |
22611 | 2274 ''buffer |
2275 (list 'quote poss) | |
2276 word | |
2277 cursor-location | |
2278 start | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2279 end |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2280 save) |
22611 | 2281 t))) |
2282 (if (consp cor-menu) | |
2283 (append cor-menu (list "-" save session buffer)) | |
2284 (list save session buffer))))) | |
2285 (popup-menu (cons (format "%s [%s]" word (or ispell-local-dictionary | |
2286 ispell-dictionary)) | |
2287 menu)))) | |
2288 | |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2289 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2290 ;;* Some example functions for real autocorrecting */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2291 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2292 (defun flyspell-maybe-correct-transposition (beg end poss) |
37008 | 2293 "Check replacements for transposed characters. |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2294 |
37008 | 2295 If the text between BEG and END is equal to a correction suggested by |
2296 Ispell, after transposing two adjacent characters, correct the text, | |
2297 and return t. | |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2298 |
37008 | 2299 The third arg POSS is either the symbol 'doublon' or a list of |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2300 possible corrections as returned by `ispell-parse-output'. |
22611 | 2301 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2302 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
|
2303 (when (consp poss) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2304 (catch 'done |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2305 (let ((str (buffer-substring beg end)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2306 (i 0) (len (- end beg)) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2307 (while (< (1+ i) len) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2308 (setq tmp (aref str i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2309 (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
|
2310 (aset str (1+ i) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2311 (when (member str (nth 2 poss)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2312 (save-excursion |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2313 (goto-char (+ beg i 1)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2314 (transpose-chars 1)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2315 (throw 'done t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2316 (setq tmp (aref str i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2317 (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
|
2318 (aset str (1+ i) tmp) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2319 (setq i (1+ i)))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2320 nil))) |
37008 | 2321 |
2322 (defun flyspell-maybe-correct-doubling (beg end poss) | |
2323 "Check replacements for doubled characters. | |
2324 | |
2325 If the text between BEG and END is equal to a correction suggested by | |
2326 Ispell, after removing a pair of doubled characters, correct the text, | |
2327 and return t. | |
2328 | |
2329 The third arg POSS is either the symbol 'doublon' or a list of | |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2330 possible corrections as returned by `ispell-parse-output'. |
37008 | 2331 |
63405
c603dad06977
(flyspell-incorrect-hook, flyspell-maybe-correct-transposition,
Juanma Barranquero <lekktu@gmail.com>
parents:
63230
diff
changeset
|
2332 This function is meant to be added to `flyspell-incorrect-hook'." |
37008 | 2333 (when (consp poss) |
55432
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2334 (catch 'done |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2335 (let ((str (buffer-substring beg end)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2336 (i 0) (len (- end beg))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2337 (while (< (1+ i) len) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2338 (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
|
2339 (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
|
2340 (substring str (+ i 2))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2341 (nth 2 poss))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2342 (goto-char (+ beg i)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2343 (delete-char 1) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2344 (throw 'done t)) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2345 (setq i (1+ i)))) |
2f1fd122c9fe
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
53477
diff
changeset
|
2346 nil))) |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2347 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2348 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2349 ;;* flyspell-already-abbrevp ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2350 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2351 (defun flyspell-already-abbrevp (table word) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2352 (let ((sym (abbrev-symbol word table))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2353 (and sym (symbolp sym)))) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2354 |
66932
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2355 ;;*---------------------------------------------------------------------*/ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2356 ;;* flyspell-change-abbrev ... */ |
29c20df6248f
Fix commenting convention. Remove unnecessary leading * in custom docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66930
diff
changeset
|
2357 ;;*---------------------------------------------------------------------*/ |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2358 (defun flyspell-change-abbrev (table old new) |
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2359 (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
|
2360 |
30428
b7b96f09059d
Update to author's version 1.5d.
Gerd Moellmann <gerd@gnu.org>
parents:
27787
diff
changeset
|
2361 (provide 'flyspell) |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37008
diff
changeset
|
2362 |
58263
b838f6a6cb4d
(flyspell-mouse-map): Pop the menu
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58001
diff
changeset
|
2363 ;; arch-tag: 05d915b9-e9cf-44fb-9137-fc28f5eaab2a |
22611 | 2364 ;;; flyspell.el ends here |