all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: 6411@debbugs.gnu.org
Subject: bug#6411: Ispell string or comment
Date: Sat, 12 Jun 2010 19:57:43 +0200	[thread overview]
Message-ID: <AANLkTin9thf2rJXsGI0drj-8wTOI8lv5ecXK1vVmEP3L@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 127 bytes --]

Here is a suggestion for a function ispell-comment-or-string for spell
checking of current comment or string, see attachement.

[-- Attachment #2: ispell-comment-0.diff --]
[-- Type: text/x-patch, Size: 1537 bytes --]

=== modified file 'lisp/textmodes/ispell.el'
--- trunk/lisp/textmodes/ispell.el	2010-05-13 10:36:03 +0000
+++ patched/lisp/textmodes/ispell.el	2010-06-12 17:53:38 +0000
@@ -3266,11 +3266,21 @@
 
 
 ;;;###autoload
-(defun ispell-comments-and-strings ()
+(defun ispell-comments-and-strings (only-current)
   "Check comments and strings in the current buffer for spelling errors."
-  (interactive)
+  (interactive (list nil))
+  (let (state done)
+    (if (not only-current)
   (goto-char (point-min))
-  (let (state done)
+      (let* ((here (point))
+             (state (parse-partial-sexp (point-min) (point)))
+             (inside (or (nth 3 state) (nth 4 state)))
+             (start (when inside (nth 8 state))))
+        (if start
+            (goto-char start)
+          (setq done t)
+          (goto-char here)
+          (message "Not inside a string or comment"))))
     (while (not done)
       (setq done t)
       (setq state (parse-partial-sexp (point) (point-max)
@@ -3282,8 +3292,14 @@
 	    (if (or (nth 3 state) (nth 4 state))
 		(error "Unterminated string or comment"))
 	    (save-excursion
-	      (setq done (not (ispell-region start (point))))))))))
+	      (setq done (not (ispell-region start (point)))))))
+      (when only-current (setq done t)))))
 
+;;;###autoload
+(defun ispell-comment-or-string ()
+  "Check comments or strings at point for spelling errors."
+  (interactive)
+  (ispell-comments-and-strings t))
 
 ;;;###autoload
 (defun ispell-buffer ()


             reply	other threads:[~2010-06-12 17:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12 17:57 Lennart Borgman [this message]
2010-06-22 15:00 ` bug#6411: Ispell string or comment Agustin Martin
2019-08-21 14:07 ` Stefan Kangas
2019-08-21 17:08   ` Eli Zaretskii
2019-08-21 20:57     ` Stefan Kangas
2020-04-08 19:23     ` bug#6411: Ispell string or comment, " Štěpán Němec
2020-04-09  6:21       ` Eli Zaretskii
2020-04-09 14:48         ` Štěpán Němec
2020-04-09 17:06           ` Eli Zaretskii
2020-04-09 17:11             ` Eli Zaretskii
2020-04-09 18:44             ` Štěpán Němec
2020-04-09 19:01               ` Eli Zaretskii
2020-04-09 19:56                 ` Štěpán Němec
2020-04-10  6:22                   ` Eli Zaretskii
2020-08-26 11:27         ` Štěpán Němec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTin9thf2rJXsGI0drj-8wTOI8lv5ecXK1vVmEP3L@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=6411@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.