From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: stephen@cogsci.ed.ac.uk (Stephen Eglen (CNS)) Newsgroups: gmane.emacs.help Subject: Re: ispelling lisp buffers Date: 29 Jul 2003 14:36:46 +0100 Organization: Division of Informatics, University of Edinburgh Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1059486457 9038 80.91.224.249 (29 Jul 2003 13:47:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2003 13:47:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 29 15:47:35 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19hUoi-0002J7-00 for ; Tue, 29 Jul 2003 15:47:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19hUn2-0002OI-LX for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jul 2003 09:45:20 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!fu-berlin.de!server1.netnews.ja.net!newsfeed.ed.ac.uk!news.cogsci.ed.ac.uk!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: sorley.cogsci.ed.ac.uk Original-X-Trace: pc-news.cogsci.ed.ac.uk 1059485806 50345 129.215.144.53 (29 Jul 2003 13:36:46 GMT) Original-X-Complaints-To: usenet@cogsci.ed.ac.uk Original-NNTP-Posting-Date: 29 Jul 2003 13:36:46 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 Original-Xref: shelby.stanford.edu gnu.emacs.help:115522 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11441 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11441 Klaus Berndl 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 ;;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))))))))))