aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-09-20 16:15:27 +0200
committerStefan Monnier2010-09-20 16:15:27 +0200
commita9cb95dd4e146169211978a22b04607db19615e8 (patch)
treef9e3ed7836a3d690102c539c2a798271d153b4a9
parentde558d10c284d496921ee6a2c53274fa883f4770 (diff)
downloademacs-a9cb95dd4e146169211978a22b04607db19615e8.tar.gz
emacs-a9cb95dd4e146169211978a22b04607db19615e8.zip
* lisp/textmodes/ispell.el (ispell-start, ispell-end): Rename from `start'
and `end'. (ispell-region, ispell-process-line): Update users.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/textmodes/ispell.el45
2 files changed, 28 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d73f03a2cf1..518502e0be4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12010-09-20 Stefan Monnier <monnier@iro.umontreal.ca> 12010-09-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * textmodes/ispell.el (ispell-start, ispell-end): Rename from `start'
4 and `end'.
5 (ispell-region, ispell-process-line): Update users.
6
3 * textmodes/reftex-parse.el (reftex-what-macro): Don't hardcode 7 * textmodes/reftex-parse.el (reftex-what-macro): Don't hardcode
4 point-min==1. 8 point-min==1.
5 9
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 8fe42b320c6..c773aadd3d8 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2816,7 +2816,11 @@ a new one will be started when needed."
2816 (setq ispell-current-dictionary dict 2816 (setq ispell-current-dictionary dict
2817 ispell-current-personal-dictionary pdict)))) 2817 ispell-current-personal-dictionary pdict))))
2818 2818
2819;;; Spelling of comments are checked when ispell-check-comments is non-nil. 2819;; Avoid error messages when compiling for these dynamic variables.
2820(defvar ispell-start)
2821(defvar ispell-end)
2822
2823;; Spelling of comments are checked when ispell-check-comments is non-nil.
2820 2824
2821;;;###autoload 2825;;;###autoload
2822(defun ispell-region (reg-start reg-end &optional recheckp shift) 2826(defun ispell-region (reg-start reg-end &optional recheckp shift)
@@ -2893,18 +2897,20 @@ Return nil if spell session is quit,
2893 (if (marker-position skip-region-start) 2897 (if (marker-position skip-region-start)
2894 (min skip-region-start ispell-region-end) 2898 (min skip-region-start ispell-region-end)
2895 (marker-position ispell-region-end)))) 2899 (marker-position ispell-region-end))))
2896 (let* ((start (point)) 2900 (let* ((ispell-start (point))
2897 (end (save-excursion (end-of-line) (min (point) reg-end))) 2901 (ispell-end (save-excursion
2898 (string (ispell-get-line start end in-comment))) 2902 (end-of-line) (min (point) reg-end)))
2903 (string (ispell-get-line
2904 ispell-start ispell-end in-comment)))
2899 (if in-comment ; account for comment chars added 2905 (if in-comment ; account for comment chars added
2900 (setq start (- start (length in-comment)) 2906 (setq ispell-start (- ispell-start (length in-comment))
2901 in-comment nil)) 2907 in-comment nil))
2902 (setq end (point)) ; "end" tracks region retrieved. 2908 (setq ispell-end (point)) ; "end" tracks region retrieved.
2903 (if string ; there is something to spell check! 2909 (if string ; there is something to spell check!
2904 ;; (special start end) 2910 ;; (special start end)
2905 (setq shift (ispell-process-line string 2911 (setq shift (ispell-process-line string
2906 (and recheckp shift)))) 2912 (and recheckp shift))))
2907 (goto-char end))))) 2913 (goto-char ispell-end)))))
2908 (if ispell-quit 2914 (if ispell-quit
2909 nil 2915 nil
2910 (or shift 0))) 2916 (or shift 0)))
@@ -3136,17 +3142,13 @@ Returns a string with the line data."
3136 (point) (+ (point) len)) 3142 (point) (+ (point) len))
3137 coding))))) 3143 coding)))))
3138 3144
3139;; Avoid error messages when compiling for these dynamic variables.
3140;; FIXME: dynamically scoped vars should have an "ispell-" prefix.
3141(defvar start)
3142(defvar end)
3143
3144(defun ispell-process-line (string shift) 3145(defun ispell-process-line (string shift)
3145 "Send STRING, a line of text, to ispell and processes the result. 3146 "Send STRING, a line of text, to ispell and processes the result.
3146This will modify the buffer for spelling errors. 3147This will modify the buffer for spelling errors.
3147Requires variables START and END to be defined in its lexical scope. 3148Requires variables ISPELL-START and ISPELL-END to be defined in its
3149dynamic scope.
3148Returns the sum SHIFT due to changes in word replacements." 3150Returns the sum SHIFT due to changes in word replacements."
3149 ;;(declare special start end) 3151 ;;(declare special ispell-start ispell-end)
3150 (let (poss accept-list) 3152 (let (poss accept-list)
3151 (if (not (numberp shift)) 3153 (if (not (numberp shift))
3152 (setq shift 0)) 3154 (setq shift 0))
@@ -3169,10 +3171,10 @@ Returns the sum SHIFT due to changes in word replacements."
3169 ;; Markers can move with highlighting! This destroys 3171 ;; Markers can move with highlighting! This destroys
3170 ;; end of region markers line-end and ispell-region-end 3172 ;; end of region markers line-end and ispell-region-end
3171 (let ((word-start 3173 (let ((word-start
3172 (copy-marker (+ start ispell-offset (car (cdr poss))))) 3174 (copy-marker (+ ispell-start ispell-offset (car (cdr poss)))))
3173 (word-len (length (car poss))) 3175 (word-len (length (car poss)))
3174 (line-end (copy-marker end)) 3176 (line-end (copy-marker ispell-end))
3175 (line-start (copy-marker start)) 3177 (line-start (copy-marker ispell-start))
3176 recheck-region replace) 3178 recheck-region replace)
3177 (goto-char word-start) 3179 (goto-char word-start)
3178 ;; Adjust the horizontal scroll & point 3180 ;; Adjust the horizontal scroll & point
@@ -3279,11 +3281,12 @@ Returns the sum SHIFT due to changes in word replacements."
3279 (file-name-nondirectory ispell-program-name) 3281 (file-name-nondirectory ispell-program-name)
3280 (or ispell-current-dictionary "default")))) 3282 (or ispell-current-dictionary "default"))))
3281 (sit-for 0) 3283 (sit-for 0)
3282 (setq start (marker-position line-start) 3284 (setq ispell-start (marker-position line-start)
3283 end (marker-position line-end)) 3285 ispell-end (marker-position line-end))
3284 ;; Adjust markers when end of region lost from highlighting. 3286 ;; Adjust markers when end of region lost from highlighting.
3285 (if (and (not recheck-region) (< end (+ word-start word-len))) 3287 (if (and (not recheck-region)
3286 (setq end (+ word-start word-len))) 3288 (< ispell-end (+ word-start word-len)))
3289 (setq ispell-end (+ word-start word-len)))
3287 (if (= word-start ispell-region-end) 3290 (if (= word-start ispell-region-end)
3288 (set-marker ispell-region-end (+ word-start word-len))) 3291 (set-marker ispell-region-end (+ word-start word-len)))
3289 ;; going out of scope - unneeded 3292 ;; going out of scope - unneeded