Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 8803:18bf41f29a7d
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 16 Sep 1994 23:10:44 +0000 |
parents | e4e6dc1e1be8 |
children | 33a3f424c8c3 |
comparison
equal
deleted
inserted
replaced
8802:7fcda87193a3 | 8803:18bf41f29a7d |
---|---|
707 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))") | 707 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))") |
708 | 708 |
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 ;;; ********************************************************************** |
715 | 717 |
716 | 718 |
774 (or quietly | 776 (or quietly |
775 (message "%s is correct because of root %s" | 777 (message "%s is correct because of root %s" |
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 |
782 (if ispell-highlight-p ;highlight word | 786 (if ispell-highlight-p ;highlight word |
783 (ispell-highlight-spelling-error start end t)) | 787 (ispell-highlight-spelling-error start end t)) |
1299 (fset 'ispell-highlight-spelling-error | 1303 (fset 'ispell-highlight-spelling-error |
1300 (symbol-function | 1304 (symbol-function |
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 |
1308 | 1313 |
1309 (defun ispell-overlay-window (height) | 1314 (defun ispell-overlay-window (height) |
1855 (defun ispell-complete-word-interior-frag () | 1860 (defun ispell-complete-word-interior-frag () |
1856 "Completes word matching character sequence inside a word." | 1861 "Completes word matching character sequence inside a word." |
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. | |
1894 With prefix arg, turn Ispell minor mode on iff arg is positive. | |
1895 | |
1896 In Ispell minor mode, pressing SPC or RET | |
1897 warns 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 |
1863 ;;; ********************************************************************** | 1916 ;;; ********************************************************************** |
1864 ;;; Original from D. Quinlan, E. Bradford, A. Albert, and M. Ernst | 1917 ;;; Original from D. Quinlan, E. Bradford, A. Albert, and M. Ernst |