diff options
| author | Richard M. Stallman | 1994-03-02 04:57:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-02 04:57:23 +0000 |
| commit | 7492978d40aaae0350455fb5b54c9b21ccffba08 (patch) | |
| tree | 777b0859e5500889f55e1e8279621efb3bcffade | |
| parent | 007852e00dd83cb828dece3bf0727089d7f63d26 (diff) | |
| download | emacs-7492978d40aaae0350455fb5b54c9b21ccffba08.tar.gz emacs-7492978d40aaae0350455fb5b54c9b21ccffba08.zip | |
(ispell-message-text-end): New variable.
(ispell-message): Use ispell-message-text-end.
Spell check all of a multi-line subject.
Correct bug whereby internally generated messages were not recognized.
| -rw-r--r-- | lisp/textmodes/ispell.el | 121 |
1 files changed, 78 insertions, 43 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 57c174c630e..27f0d077a83 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1706,8 +1706,26 @@ inside of a word." | |||
| 1706 | ;;; ********************************************************************** | 1706 | ;;; ********************************************************************** |
| 1707 | ;;; Ispell Message | 1707 | ;;; Ispell Message |
| 1708 | ;;; ********************************************************************** | 1708 | ;;; ********************************************************************** |
| 1709 | ;;; Original from Daniel Quinlan, Ethan Bradford, and Alon Albert | 1709 | ;;; Original from D. Quinlan, E. Bradford, A. Albert, and M. Ernst |
| 1710 | 1710 | ||
| 1711 | |||
| 1712 | (defvar ispell-message-text-end | ||
| 1713 | (mapconcat (function identity) | ||
| 1714 | '( | ||
| 1715 | ;; Matches postscript files. | ||
| 1716 | "^%!PS-Adobe-2.0" | ||
| 1717 | ;; Matches uuencoded text | ||
| 1718 | "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM" | ||
| 1719 | ;; Matches shell files (esp. auto-decoding) | ||
| 1720 | "^#! /bin/sh" | ||
| 1721 | ;; Matches difference listing | ||
| 1722 | "diff -c .*\n\\*\\*\\* .*\n--- " | ||
| 1723 | ;; Matches "----------------- cut here" | ||
| 1724 | "^[-=]+\\s cut here") | ||
| 1725 | "\\|") | ||
| 1726 | "*End of text which will be checked in ispell-message. | ||
| 1727 | If it is a string, limit at first occurence of that regular expression. | ||
| 1728 | Otherwise, it must be a function which is called to get the limit.") | ||
| 1711 | 1729 | ||
| 1712 | ;;;###autoload | 1730 | ;;;###autoload |
| 1713 | (defun ispell-message () | 1731 | (defun ispell-message () |
| @@ -1729,33 +1747,43 @@ Or you can bind the function C-c i in gnus or mail by setting | |||
| 1729 | news-reply-mode-hook or mail-mode-hook to the following lambda expression: | 1747 | news-reply-mode-hook or mail-mode-hook to the following lambda expression: |
| 1730 | (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))" | 1748 | (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))" |
| 1731 | (interactive) | 1749 | (interactive) |
| 1732 | (let* ((internal-messagep (save-excursion | 1750 | (save-excursion |
| 1733 | (search-forward mail-header-separator nil t))) | 1751 | (beginning-of-buffer) |
| 1734 | (cite-regexp ;Prefix of inserted text | 1752 | (let* ((internal-messagep |
| 1735 | (cond | 1753 | (search-forward mail-header-separator nil t)) |
| 1736 | ((featurep 'supercite) ; sc 3.0 | 1754 | (limit |
| 1737 | (concat "\\(" (sc-cite-regexp) "\\)" "\\|" | 1755 | (cond |
| 1738 | (ispell-non-empty-string sc-reference-tag-string))) | 1756 | ((not ispell-message-text-end) (point-max)) |
| 1739 | ((featurep 'sc) ; sc 2.3 | 1757 | ((char-or-string-p ispell-message-text-end) |
| 1740 | (concat "\\(" sc-cite-regexp "\\)" "\\|" | 1758 | (if (re-search-forward ispell-message-text-end nil t) |
| 1741 | (ispell-non-empty-string sc-reference-tag-string))) | 1759 | (match-beginning 0) |
| 1742 | ((equal major-mode 'news-reply-mode) ;Gnus | 1760 | (point-max))) |
| 1743 | (concat "In article <" "\\|" | 1761 | (t (min (point-max) (funcall ispell-message-text-end))))) |
| 1744 | (if mail-yank-prefix | 1762 | (cite-regexp ;Prefix of inserted text |
| 1745 | (ispell-non-empty-string mail-yank-prefix) | 1763 | (cond |
| 1746 | "^ \\|^\t"))) | 1764 | ((featurep 'supercite) ; sc 3.0 |
| 1747 | ((equal major-mode 'mh-letter-mode) ; mh mail message | 1765 | (concat "\\(" (sc-cite-regexp) "\\)" "\\|" |
| 1748 | (ispell-non-empty-string mh-ins-buf-prefix)) | 1766 | (ispell-non-empty-string sc-reference-tag-string))) |
| 1749 | ((not internal-messagep) ; Assume n sent us this message. | 1767 | ((featurep 'sc) ; sc 2.3 |
| 1750 | (concat "In [a-zA-Z.]+ you write:" "\\|" | 1768 | (concat "\\(" sc-cite-regexp "\\)" "\\|" |
| 1751 | "In <[^,;&+=]+> [^,;&+=]+ writes:" "\\|" | 1769 | (ispell-non-empty-string sc-reference-tag-string))) |
| 1752 | " *> *")) | 1770 | ((equal major-mode 'news-reply-mode) ;Gnus |
| 1753 | ((boundp 'vm-included-text-prefix) ; VM mail message | 1771 | (concat "In article <" "\\|" |
| 1754 | (concat "[^,;&+=]+ writes:" "\\|" | 1772 | (if mail-yank-prefix |
| 1755 | (ispell-non-empty-string vm-included-text-prefix))) | 1773 | (ispell-non-empty-string mail-yank-prefix) |
| 1756 | (mail-yank-prefix ; vanilla mail message. | 1774 | "^ \\|^\t"))) |
| 1757 | (ispell-non-empty-string mail-yank-prefix)) | 1775 | ((equal major-mode 'mh-letter-mode) ; mh mail message |
| 1758 | (t "^ \\|^\t"))) | 1776 | (ispell-non-empty-string mh-ins-buf-prefix)) |
| 1777 | ((not internal-messagep) ; Assume nn sent us this message. | ||
| 1778 | (concat "In [a-zA-Z.]+ you write:" "\\|" | ||
| 1779 | "In <[^,;&+=]+> [^,;&+=]+ writes:" "\\|" | ||
| 1780 | " *> *")) | ||
| 1781 | ((boundp 'vm-included-text-prefix) ; VM mail message | ||
| 1782 | (concat "[^,;&+=]+ writes:" "\\|" | ||
| 1783 | (ispell-non-empty-string vm-included-text-prefix))) | ||
| 1784 | (mail-yank-prefix ; vanilla mail message. | ||
| 1785 | (ispell-non-empty-string mail-yank-prefix)) | ||
| 1786 | (t "^ \\|^\t"))) | ||
| 1759 | (cite-regexp-start (concat "^[ \t]*$\\|" cite-regexp)) | 1787 | (cite-regexp-start (concat "^[ \t]*$\\|" cite-regexp)) |
| 1760 | (cite-regexp-end (concat "^\\(" cite-regexp "\\)")) | 1788 | (cite-regexp-end (concat "^\\(" cite-regexp "\\)")) |
| 1761 | (old-case-fold-search case-fold-search) | 1789 | (old-case-fold-search case-fold-search) |
| @@ -1769,31 +1797,38 @@ news-reply-mode-hook or mail-mode-hook to the following lambda expression: | |||
| 1769 | (< (point) internal-messagep) | 1797 | (< (point) internal-messagep) |
| 1770 | (and (looking-at "[a-zA-Z---]+:\\|\t\\| ") | 1798 | (and (looking-at "[a-zA-Z---]+:\\|\t\\| ") |
| 1771 | (not (eobp)))) | 1799 | (not (eobp)))) |
| 1772 | (if (and (not (looking-at "Subject: .*Re:")) | 1800 | |
| 1773 | (not (looking-at "Subject: +\\[")) | 1801 | ;; spell check Subject: field without Re:'s. |
| 1774 | (looking-at "Subject:")) ; last so (match-end 0) works right. | 1802 | (if (looking-at "Subject: *") |
| 1775 | ;; spell check Subject: field without Re:'s. | 1803 | (progn |
| 1776 | (let ((case-fold-search old-case-fold-search)) | 1804 | (goto-char (match-end 0)) |
| 1777 | (end-of-line) | 1805 | (if (and (not (looking-at ".*Re\\>")) |
| 1778 | (ispell-region (match-end 0) (point)))) | 1806 | (not (looking-at "\\["))) |
| 1807 | (let ((case-fold-search old-case-fold-search)) | ||
| 1808 | (ispell-region (point) | ||
| 1809 | (progn | ||
| 1810 | (end-of-line) | ||
| 1811 | (while (looking-at "\n[ \t]") | ||
| 1812 | (end-of-line 2)) | ||
| 1813 | (point))))))) | ||
| 1779 | (forward-line 1)) | 1814 | (forward-line 1)) |
| 1780 | (setq case-fold-search nil) | 1815 | (setq case-fold-search nil) |
| 1781 | ;; Skip mail header, particularly for non-english languages. | 1816 | ;; Skip mail header, particularly for non-english languages. |
| 1782 | (if (looking-at mail-header-separator) | 1817 | (if (looking-at mail-header-separator) |
| 1783 | (forward-line 1)) | 1818 | (forward-line 1)) |
| 1784 | (while (not (eobp)) | 1819 | (while (< (point) limit) |
| 1785 | ;; Skip across text cited from other messages. | 1820 | ;; Skip across text cited from other messages. |
| 1786 | (while (and (looking-at cite-regexp-start) | 1821 | (while (and (looking-at cite-regexp-start) |
| 1787 | (not (eobp))) | 1822 | (< (point) limit)) |
| 1788 | (forward-line 1)) | 1823 | (forward-line 1)) |
| 1789 | (if (not (eobp)) | 1824 | (if (< (point) limit) |
| 1790 | ;; Check the next batch of lines that *aren't* cited. | 1825 | ;; Check the next batch of lines that *aren't* cited. |
| 1791 | (let ((end (save-excursion | 1826 | (let ((end (save-excursion |
| 1792 | (if (re-search-forward cite-regexp-end nil 'end) | 1827 | (if (re-search-forward cite-regexp-end limit 'end) |
| 1793 | (beginning-of-line)) | 1828 | (match-beginning 0) |
| 1794 | (point)))) | 1829 | limit)))) |
| 1795 | (ispell-region (point) end) | 1830 | (ispell-region (point) end) |
| 1796 | (goto-char end))))))) | 1831 | (goto-char end)))))))) |
| 1797 | 1832 | ||
| 1798 | (defun ispell-non-empty-string (string) | 1833 | (defun ispell-non-empty-string (string) |
| 1799 | (if (or (not string) (string-equal string "")) | 1834 | (if (or (not string) (string-equal string "")) |