aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-16 23:10:44 +0000
committerRichard M. Stallman1994-09-16 23:10:44 +0000
commit0349bab642103ec62bea96c3e12d3e7d6f8a8f4b (patch)
treea4bef435a9dd72af03f114d22f0c638e8966b12c
parent9cc7519111b77a97d0116d3ededc0e686c395f6e (diff)
downloademacs-0349bab642103ec62bea96c3e12d3e7d6f8a8f4b.tar.gz
emacs-0349bab642103ec62bea96c3e12d3e7d6f8a8f4b.zip
(ispell-highlight-spelling-error): Test window-system.
(ispell-check-only): New variable. (ispell-word): Handle ispell-check-only. (ispell-minor-mode): New variable. (ispell-minor-keymap): New map. (ispell-minor-mode): New function.
-rw-r--r--lisp/textmodes/ispell.el55
1 files changed, 54 insertions, 1 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6568e5b25ca..2325998529c 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -709,6 +709,8 @@ You can set this variable in hooks in your init file -- eg:
709(defvar ispell-region-end (make-marker) 709(defvar ispell-region-end (make-marker)
710 "Marker that allows spelling continuations.") 710 "Marker that allows spelling continuations.")
711 711
712(defvar ispell-check-only nil
713 "If non-nil, `ispell-word' does not try to correct the word.")
712 714
713;;; ********************************************************************** 715;;; **********************************************************************
714;;; ********************************************************************** 716;;; **********************************************************************
@@ -776,6 +778,8 @@ or \\[ispell-region] to update the Ispell process."
776 (funcall ispell-format-word word) 778 (funcall ispell-format-word word)
777 (funcall ispell-format-word poss)))) 779 (funcall ispell-format-word poss))))
778 ((null poss) (message "Error in ispell process")) 780 ((null poss) (message "Error in ispell process"))
781 (ispell-check-only ; called from ispell minor mode.
782 (beep))
779 (t ; prompt for correct word. 783 (t ; prompt for correct word.
780 (unwind-protect 784 (unwind-protect
781 (progn 785 (progn
@@ -1301,7 +1305,8 @@ The variable `ispell-highlight-face' selects the face to use for highlighting."
1301 (cond 1305 (cond
1302 ((string-match "Lucid" emacs-version) 1306 ((string-match "Lucid" emacs-version)
1303 'ispell-highlight-spelling-error-lucid) 1307 'ispell-highlight-spelling-error-lucid)
1304 ((and (string-lessp "19" emacs-version) (featurep 'faces)) 1308 ((and (string-lessp "19" emacs-version) (featurep 'faces)
1309 window-system)
1305 'ispell-highlight-spelling-error-overlay) 1310 'ispell-highlight-spelling-error-overlay)
1306 (t 'ispell-highlight-spelling-error-generic)))) 1311 (t 'ispell-highlight-spelling-error-generic))))
1307 1312
@@ -1857,6 +1862,54 @@ Standard ispell choices are then available."
1857 (interactive) 1862 (interactive)
1858 (ispell-complete-word t)) 1863 (ispell-complete-word t))
1859 1864
1865;;; **********************************************************************
1866;;; Ispell Minor Mode
1867;;; **********************************************************************
1868
1869(defvar ispell-minor-mode nil
1870 "Non-nil if Ispell minor mode is enabled.")
1871;; Variable indicating that ispell minor mode is active.
1872(make-variable-buffer-local 'ispell-minor-mode)
1873
1874(or (assq 'ispell-minor-mode minor-mode-alist)
1875 (setq minor-mode-alist
1876 (cons '(ispell-minor-mode " Spell") minor-mode-alist)))
1877
1878(defvar ispell-minor-keymap
1879 (let ((map (make-sparse-keymap)))
1880 (define-key map " " 'ispell-minor-check)
1881 (define-key map "\r" 'ispell-minor-check)
1882 map)
1883 "Keymap used for Ispell minor mode.")
1884
1885(or (not (boundp 'minor-mode-map-alist))
1886 (assoc 'ispell-minor-mode minor-mode-map-alist)
1887 (setq minor-mode-map-alist
1888 (cons (cons 'ispell-minor-mode ispell-minor-keymap)
1889 minor-mode-map-alist)))
1890
1891;;;###autoload
1892(defun ispell-minor-mode (&optional arg)
1893 "Toggle Ispell minor mode.
1894With prefix arg, turn Ispell minor mode on iff arg is positive.
1895
1896In Ispell minor mode, pressing SPC or RET
1897warns you if the previous word is incorrectly spelled."
1898 (interactive "P")
1899 (setq ispell-minor-mode
1900 (not (or (and (null arg) ispell-minor-mode)
1901 (<= (prefix-numeric-value arg) 0))))
1902 (set-buffer-modified-p (buffer-modified-p)))
1903
1904(defun ispell-minor-check ()
1905 ;; Check previous word then continue with the normal binding of this key.
1906 (interactive "*")
1907 (let ((ispell-minor-mode nil)
1908 (ispell-check-only t))
1909 (save-restriction
1910 (narrow-to-region (point-min) (point))
1911 (ispell-word nil t))
1912 (call-interactively (key-binding (this-command-keys)))))
1860 1913
1861;;; ********************************************************************** 1914;;; **********************************************************************
1862;;; Ispell Message 1915;;; Ispell Message