]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/ispell.el
(reporter-dont-compact-list): Doc fix.
[gnu-emacs] / lisp / textmodes / ispell.el
index 0a3b3201f04b89a65eae884032623fe9758196db..8064b5e0582d51966e637d9cfc0c6eb16e7cc501 100644 (file)
@@ -1,20 +1,20 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: emacs-lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; GNU EMACS interface for International Ispell Version 3.1 by Geoff Kuenning.
-;;;
-;;;
+;;; ispell.el --- spell checking using Ispell
+
 ;;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-;;;
-;;;
+
 ;;; Authors         : Ken Stevens <k.stevens@ieee.org>
 ;;; Note: version numbers and time stamp are not updated
 ;;;   when this file is edited for release with GNU Emacs.
-;;; Last Modified On: Mon Feb  6 17:39:38 EST 1995
-;;; Update Revision : 2.36
+;;; Last Modified On: Tue Jun 13 12:05:28 EDT 1995
+;;; Update Revision : 2.37
 ;;; Syntax          : emacs-lisp
 ;;; Status         : Release with 3.1.12+ ispell.
 ;;; Version        : International Ispell Version 3.1 by Geoff Kuenning.
 ;;; Bug Reports            : ispell-el-bugs@itcorp.com
-;;;
+
+;;; Note: version numbers and time stamp are not updated
+;;;   when this file is edited for release with GNU Emacs.
+
 ;;; This file is part of GNU Emacs.
 ;;;
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
 ;;;
 ;;; HISTORY
 ;;;
+;;; Revision 2.37  1995/6/13 12:05:28  stevens
+;;; Removed autoload from ispell-dictionary-alist. *choices* mode-line shows
+;;; misspelled word.  Block skip for pgp & forwarded messages added.
+;;; RMS: the autoload changes had problems and I removed them.
+;;;
 ;;; Revision 2.36  1995/2/6 17:39:38   stevens
 ;;; Properly adjust screen with different ispell-choices-win-default-height
 ;;; settings.  Skips SGML entity references.
@@ -436,6 +441,10 @@ For example, '(\"-W\" \"3\") to cause it to accept all 1-3 character
 words as correct.  See also `ispell-dictionary-alist', which may be used
 for language-specific arguments.")
 
+;;; The preparation of the menu bar menu must be autoloaded
+;;; because otherwise this file gets autoloaded every time Emacs starts
+;;; so that it can set up the menus and determine keyboard equivalents.
+
 ;;;###autoload
 (defvar ispell-dictionary-alist-1      ; sk  9-Aug-1991 18:28
   '((nil                               ; default (english.aff)
@@ -529,7 +538,6 @@ Note that the CASECHARS and OTHERCHARS slots of the alist should
 contain the same character set as casechars and otherchars in the
 language.aff file \(e.g., english.aff\).")
 
-
 ;;;###autoload
 (defvar ispell-menu-map nil "Key map for ispell menu")
 
@@ -546,10 +554,9 @@ language.aff file \(e.g., english.aff\).")
 ;;; due to the fact that menu-bar is loaded much later than loaddefs.
 ;;;       ;; make sure this isn't Lucid Emacs
 ;;;       (featurep 'menu-bar)
-       (string-lessp "19" emacs-version)))
+       (not (string-match "Lucid" emacs-version))))
 
-
-;;; setup dictionary
+;;; Set up dictionary
 ;;;###autoload
 (if ispell-menu-map-needed
     (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
@@ -645,7 +652,7 @@ language.aff file \(e.g., english.aff\).")
 
 
 ;;; The version must be 3.1 or greater for this version of ispell.el
-;;; There is an incompatibility between versin 3.1.12 and lower versions.
+;;; There is an incompatibility between version 3.1.12 and lower versions.
 (defconst ispell-required-version '("3.1." 12)
   "Ispell versions with which this version of ispell.el is known to work.")
 (defvar ispell-offset 1
@@ -736,9 +743,8 @@ a `~' followed by an extended-character mode -- such as `~.tex'.")
 
 (defvar ispell-skip-sgml nil
   "Skips spell checking of SGML tags and entity references when non-nil.
-This variable is set when major-mode is sgml-mode.")
+This variable is set when major-mode is sgml-mode or html-mode.")
 
-;;;###autoload
 (defvar ispell-local-pdict ispell-personal-dictionary
   "A buffer local variable containing the current personal dictionary.
 If non-nil, the value must be a string, which is a file name.
@@ -783,7 +789,8 @@ You can set this variable in hooks in your init file -- eg:
      (not (boundp 'epoch::version))
      (defalias 'ispell 'ispell-buffer))
 
-;;;###autoload (define-key global-map "\M-$" 'ispell-word)
+;;;###autoload
+(define-key global-map "\M-$" 'ispell-word)
 
 ;;;###autoload
 (defun ispell-word (&optional following quietly continue)
@@ -973,7 +980,7 @@ used."
     ;; setup the *Choices* buffer with valid data.
     (save-excursion
       (set-buffer (get-buffer-create ispell-choices-buffer))
-      (setq mode-line-format "--  %b  --")
+      (setq mode-line-format (concat "--  %b  --  word: " word))
       (erase-buffer)
       (if guess
          (progn
@@ -1126,7 +1133,9 @@ used."
                              (erase-buffer)
                              (setq count ?0
                                    skipped 0
-                                   mode-line-format "--  %b  --"
+                                   mode-line-format (concat
+                                                     "--  %b  --  word: "
+                                                     new-word)
                                    miss (lookup-words new-word)
                                    choices miss)
                              (while (and choices ; adjust choices window.
@@ -1587,7 +1596,7 @@ With NO-ERROR, just return non-nil if there was no Ispell running."
     nil))
 
 
-;;; ispell-change-dictionary is set in some people's hooks.  Maybe it should
+;;; ispell-change-dictionary is set in some people's hooks.  Maybe this should
 ;;;  call ispell-init-process rather than wait for a spell checking command?
 
 ;;;###autoload
@@ -2038,21 +2047,50 @@ warns you if the previous word is incorrectly spelled."
   (mapconcat (function identity)
             '(
               ;; Matches postscript files.
-              "^%!PS-Adobe-[23].0"
+              "^%!PS-Adobe-[123].0"
               ;; Matches uuencoded text
               "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM"
               ;; Matches shell files (esp. auto-decoding)
               "^#! /bin/[ck]?sh"
               ;; Matches context difference listing
               "\\(diff -c .*\\)?\n\\*\\*\\* .*\n--- .*\n\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*"
+               ;; Matches reporter.el bug report
+               "^current state:\n==============\n"
               ;; Matches "----------------- cut here"
-              "^[-=_]+\\s ?cut here")
+              ;; and "------- Start of forwarded message"
+              "^[-=_]+\\s ?\\(cut here\\|Start of forwarded message\\)")
             "\\|")
   "*End of text which will be checked in ispell-message.
 If it is a string, limit at first occurrence of that regular expression.
 Otherwise, it must be a function which is called to get the limit.")
 
 
+(defvar ispell-message-start-skip
+  (mapconcat (function identity)
+            '(
+              ;; Matches forwarded messages
+              "^---* Forwarded Message"
+              ;; Matches PGP Public Key block
+              "^---*BEGIN PGP [A-Z ]*--*"
+              )
+            "\\|")
+  "Spelling is skipped inside these start/end groups by ispell-message.
+Assumed that blocks are not mutually inclusive.")
+
+
+(defvar ispell-message-end-skip
+  (mapconcat (function identity)
+            '(
+              ;; Matches forwarded messages
+              "^--- End of Forwarded Message"
+              ;; Matches PGP Public Key block
+              "^---*END PGP [A-Z ]*--*"
+              )
+            "\\|")
+  "Spelling is skipped inside these start/end groups by ispell-message.
+Assumed that blocks are not mutually inclusive.")
+
+
 ;;;###autoload
 (defun ispell-message ()
   "Check the spelling of a mail message or news post.
@@ -2154,10 +2192,12 @@ You can bind this to the key C-c i in GNUS or mail by adding to
                   ;; Check the next batch of lines that *aren't* cited.
                   (end-c (and (re-search-forward cite-regexp-end limit 'end)
                               (match-beginning 0)))
-                  ;; skip a forwarded message
+                  ;; Skip a block of included text.
                   (end-fwd (and (goto-char start)
-                                (re-search-forward "---* Forwarded Message"
-                                                   limit 'end)))
+                                (re-search-forward ispell-message-start-skip
+                                                   limit 'end)
+                                (progn (beginning-of-line)
+                                       (point))))
                   (end (or (and end-c end-fwd (min end-c end-fwd))
                            end-c end-fwd
                            ;; defalut to limit of text.
@@ -2167,7 +2207,7 @@ You can bind this to the key C-c i in GNUS or mail by adding to
              (if (and end-fwd (= end end-fwd))
                  (progn
                    (goto-char end)
-                   (search-forward "--- End of Forwarded Message" limit 'end))
+                   (re-search-forward ispell-message-end-skip limit 'end))
                (goto-char end)))))
       (set-marker limit nil))))
 
@@ -2202,8 +2242,8 @@ Includes latex/nroff modes and extended character mode."
          (eq ispell-parser 'tex))
       (process-send-string ispell-process "+\n") ; set ispell mode to tex
     (process-send-string ispell-process "-\n"))        ; set mode to normal (nroff)
-  ;; Hard-wire test for SGML mode.
-  (setq ispell-skip-sgml (eq 'sgml-mode major-mode))
+  ;; Hard-wire test for SGML & HTML mode.
+  (setq ispell-skip-sgml (memq major-mode '(sgml-mode html-mode)))
   ;; Set default extended character mode for given buffer, if any.
   (let ((extended-char-mode (ispell-get-extended-character-mode)))
     (if extended-char-mode
@@ -2327,7 +2367,7 @@ Both should not be used to define a buffer-local dictionary."
   reg-end)
 
 
-(defconst ispell-version "2.36 -- Mon Feb  6 17:39:38 EST 1995")
+(defconst ispell-version "2.37 -- Tue Jun 13 12:05:28 EDT 1995")
 
 (provide 'ispell)