changeset 20389:e15a9b5e0a70

New function ispell-comments-and-strings.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 03 Dec 1997 17:20:13 +0000
parents fa0ae5cb8ab2
children fcca6fe56f9c
files lisp/textmodes/ispell.el
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ispell.el	Wed Dec 03 12:18:20 1997 +0000
+++ b/lisp/textmodes/ispell.el	Wed Dec 03 17:20:13 1997 +0000
@@ -80,6 +80,7 @@
 ;;   ispell-region
 ;;   ispell-buffer
 ;;   ispell-message
+;;   ispell-comments-and-strings
 ;;   ispell-continue
 ;;   ispell-complete-word
 ;;   ispell-complete-word-interior-frag
@@ -1981,6 +1982,25 @@
       (message "Spell-checking done"))))
 
 
+;;;###autoload
+(defun ispell-comments-and-strings ()
+  "Check comments and strings in the current buffer for spelling errors."
+  (interactive)
+  (goto-char (point-min))
+  (let (state done)
+    (while (not done)
+      (setq done t)
+      (setq state (parse-partial-sexp (point) (point-max)
+				      nil nil state 'syntax-table))
+      (when (or (nth 3 state) (nth 4 state))
+	(let ((start (point)))
+	  (setq state (parse-partial-sexp start (point-max)
+					  nil nil state 'syntax-table))
+	  (when (or (nth 3 state) (nth 4 state))
+	    (error "Unterminated string or comment."))
+	  (save-excursion
+	    (setq done (not (ispell-region start (point))))))))))
+
 
 ;;;###autoload
 (defun ispell-buffer ()