1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 100_ispell.el_ispell-comment-or-string.dpatch by Lennart Borgman
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: function ispell-comment-or-string for spell checking of current comment or string
8
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' dictionaries-common~/support/emacsen/ispell.el dictionaries-common/support/emacsen/ispell.el
9
--- dictionaries-common~/support/emacsen/ispell.el 2010-06-16 14:23:09.000000000 +0200
10
+++ dictionaries-common/support/emacsen/ispell.el 2010-06-17 11:57:11.000000000 +0200
11
@@ -3266,11 +3266,21 @@
15
-(defun ispell-comments-and-strings ()
16
+(defun ispell-comments-and-strings (only-current)
17
"Check comments and strings in the current buffer for spelling errors."
19
- (goto-char (point-min))
20
+ (interactive (list nil))
22
+ (if (not only-current)
23
+ (goto-char (point-min))
24
+ (let* ((here (point))
25
+ (state (parse-partial-sexp (point-min) (point)))
26
+ (inside (or (nth 3 state) (nth 4 state)))
27
+ (start (when inside (nth 8 state))))
32
+ (message "Not inside a string or comment"))))
35
(setq state (parse-partial-sexp (point) (point-max)
36
@@ -3282,8 +3292,14 @@
37
(if (or (nth 3 state) (nth 4 state))
38
(error "Unterminated string or comment"))
40
- (setq done (not (ispell-region start (point))))))))))
41
+ (setq done (not (ispell-region start (point)))))))
42
+ (when only-current (setq done t)))))
45
+(defun ispell-comment-or-string ()
46
+ "Check comments or strings at point for spelling errors."
48
+ (ispell-comments-and-strings t))
51
(defun ispell-buffer ()