annotate lisp/textmodes/flyspell.el @ 67178:db5dfb03d180

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