summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>1997-12-03 17:20:13 +0000
committerGerd Moellmann <gerd@gnu.org>1997-12-03 17:20:13 +0000
commit30532bba573d4812e6b2dddf7a314898b6afa440 (patch)
tree5c0fd6dddab3b028b110d2a5ec459debf74467a4 /lisp/textmodes
parent8d6fbb746e0c66a35f4e4b87349876340091e827 (diff)
downloademacs-30532bba573d4812e6b2dddf7a314898b6afa440.tar.gz
New function ispell-comments-and-strings.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/ispell.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index be445f276cc..60cf46da30d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -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 @@ With prefix argument, set the default directory."
(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 ()