~ubuntu-branches/ubuntu/oneiric/dictionaries-common/oneiric

« back to all changes in this revision

Viewing changes to debian/patches/100_ispell.el_ispell-comment-or-string.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-08-03 12:28:33 UTC
  • mfrom: (1.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100803122833-rlshuu50b015wc1b
Tags: 1.5.11ubuntu1
* Merge from Debian unstable (LP: #609657). Remaining changes:
  - scripts/system/dc-debconf-select.pl: Drop default debconf priority
    from 'high' to 'medium'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 100_ispell.el_ispell-comment-or-string.dpatch by Lennart Borgman
 
3
##
 
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
 
6
 
 
7
@DPATCH@
 
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 @@
 
12
 
 
13
 
 
14
 ;;;###autoload
 
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."
 
18
-  (interactive)
 
19
-  (goto-char (point-min))
 
20
+  (interactive (list nil))
 
21
   (let (state done)
 
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))))
 
28
+        (if start
 
29
+            (goto-char start)
 
30
+          (setq done t)
 
31
+          (goto-char here)
 
32
+          (message "Not inside a string or comment"))))
 
33
     (while (not done)
 
34
       (setq done t)
 
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"))
 
39
            (save-excursion
 
40
-             (setq done (not (ispell-region start (point))))))))))
 
41
+             (setq done (not (ispell-region start (point)))))))
 
42
+      (when only-current (setq done t)))))
 
43
 
 
44
+;;;###autoload
 
45
+(defun ispell-comment-or-string ()
 
46
+  "Check comments or strings at point for spelling errors."
 
47
+  (interactive)
 
48
+  (ispell-comments-and-strings t))
 
49
 
 
50
 ;;;###autoload
 
51
 (defun ispell-buffer ()