[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ispelling lisp buffers
From: |
Stephen Eglen (CNS) |
Subject: |
Re: ispelling lisp buffers |
Date: |
29 Jul 2003 14:36:46 +0100 |
Klaus Berndl <klaus.berndl@sdm.de> writes:
> Hi,
>
> is there some smart ispell command which is suitable for ispelling
> source-code like emacs-lisp. Smart means that only comments and maybe strings
> should be ispelled, nothing else!
>
> Thanks for any pointer,
> Klaus
I have this in my .emacs file, not sure if it still works.
Stephen
;;From: Sam Shteingold <sshteingold@cctrading.com>
;;Subject: Spell check only comments and string literals:
;; ispell-comments-strings
;;Newsgroups: gnu.emacs.sources
(defun ispell-comments-strings (beg end)
"Spell-check the comments and string literals in the region.
This quick hack assumes that initially we are inside neither.
Also, it sometimes needs a C-g in the end."
(interactive "r")
(let ((ispell-check-comments t) be)
(save-excursion
(goto-char beg)
(while (< (point) end)
(if
(setq be (re-search-forward
(concat "[^\\]\"\\|" (or comment-start "")) end t))
(ispell-region
be (if (char-equal ?\" (char-after (1- (point))))
(or (re-search-forward "[^\\]\"" end t) (goto-char end))
(if (string= comment-end "")
(progn (end-of-line) (point))
(or (re-search-forward comment-end end t)
(goto-char end))))))))))