aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-16 21:31:39 +0000
committerRichard M. Stallman1993-05-16 21:31:39 +0000
commita48fc390191db99588f34bfc7c41f87e538cadca (patch)
tree8aeb40d3263e296c80359a17da729e3b9103187f
parent08348502aeda83cb6fe58cd1a1da7a6d95ca8d74 (diff)
downloademacs-a48fc390191db99588f34bfc7c41f87e538cadca.tar.gz
emacs-a48fc390191db99588f34bfc7c41f87e538cadca.zip
(ispell): Deactivate mark before the Ispell run.
(ispell-point): Delete the sit-for; it was confusing. (ispell): Don't use save-excursion; just restore current buffer. (ispell-next): Don't save-excursion or save-window-excursion. (ispell-point): Don't save-excursion. (ispell-window-configuration): New variable. (ispell-show-choices): Set it if not nil. (ispell-next): Initialize to nil. Restore at end.
-rw-r--r--lisp/textmodes/ispell4.el55
1 files changed, 37 insertions, 18 deletions
diff --git a/lisp/textmodes/ispell4.el b/lisp/textmodes/ispell4.el
index 0ad99c1e92a..079e821a193 100644
--- a/lisp/textmodes/ispell4.el
+++ b/lisp/textmodes/ispell4.el
@@ -53,6 +53,10 @@ to look for the next message from the ISPELL program.")
53;be on the bad-words list 53;be on the bad-words list
54(defvar ispell-recently-accepted nil) 54(defvar ispell-recently-accepted nil)
55 55
56;; Non-nil means we have started showing an alternatives window.
57;; This is the window config from before then.
58(defvar ispell-window-configuration)
59
56;t when :dump command needed 60;t when :dump command needed
57(defvar ispell-dump-needed nil) 61(defvar ispell-dump-needed nil)
58 62
@@ -225,10 +229,16 @@ q, \\[keyboard-quit] Leave the command loop. You can come back later with \\[is
225 (setq buf (get-buffer buf)) 229 (setq buf (get-buffer buf))
226 (if (null buf) 230 (if (null buf)
227 (error "Can't find buffer")) 231 (error "Can't find buffer"))
232 ;; Deactivate the mark, because we'll do it anyway if we change something,
233 ;; and a region highlight while in the Ispell loop is distracting.
234 (if transient-mark-mode
235 (progn
236 (setq mark-active nil)
237 (run-hooks 'deactivate-mark-hook)))
228 (save-excursion 238 (save-excursion
229 (set-buffer buf) 239 (set-buffer buf)
230 (let ((filename buffer-file-name) 240 (let ((filename buffer-file-name)
231 (delete-temp nil)) 241 (delete-temp nil))
232 (unwind-protect 242 (unwind-protect
233 (progn 243 (progn
234 (cond ((null filename) 244 (cond ((null filename)
@@ -244,10 +254,10 @@ q, \\[keyboard-quit] Leave the command loop. You can come back later with \\[is
244 (ispell-cmd ":tex") 254 (ispell-cmd ":tex")
245 (ispell-cmd ":generic")) 255 (ispell-cmd ":generic"))
246 (ispell-cmd (format ":file %s %d %d" filename start end))) 256 (ispell-cmd (format ":file %s %d %d" filename start end)))
247 (if delete-temp 257 (if delete-temp
248 (condition-case () 258 (condition-case ()
249 (delete-file filename) 259 (delete-file filename)
250 (file-error nil))))) 260 (file-error nil)))))
251 (message "Parsing ispell output ...") 261 (message "Parsing ispell output ...")
252 (ispell-flush-bad-words) 262 (ispell-flush-bad-words)
253 (let (pos bad-words) 263 (let (pos bad-words)
@@ -273,17 +283,21 @@ q, \\[keyboard-quit] Leave the command loop. You can come back later with \\[is
273(defun ispell-next () 283(defun ispell-next ()
274 "Resume command loop for most recent ispell command." 284 "Resume command loop for most recent ispell command."
275 (interactive) 285 (interactive)
286 (setq ispell-window-configuration nil)
276 (unwind-protect 287 (unwind-protect
277 (catch 'quit 288 (catch 'quit
278 (save-window-excursion 289 ;; There used to be a save-excursion here,
279 (save-excursion 290 ;; but that was annoying: it's better if point doesn't move
280 (let (next) 291 ;; when you type q.
281 (while (markerp (setq next (car ispell-bad-words))) 292 (let (next)
282 (switch-to-buffer (marker-buffer next)) 293 (while (markerp (setq next (car ispell-bad-words)))
283 (push-mark) 294 (switch-to-buffer (marker-buffer next))
284 (ispell-point next "at saved position.") 295 (push-mark)
285 (setq ispell-bad-words (cdr ispell-bad-words)) 296 (ispell-point next "at saved position.")
286 (set-marker next nil)))))) 297 (setq ispell-bad-words (cdr ispell-bad-words))
298 (set-marker next nil))))
299 (if ispell-window-configuration
300 (set-window-configuration ispell-window-configuration))
287 (cond ((null ispell-bad-words) 301 (cond ((null ispell-bad-words)
288 (error "Ispell has not yet been run.")) 302 (error "Ispell has not yet been run."))
289 ((markerp (car ispell-bad-words)) 303 ((markerp (car ispell-bad-words))
@@ -368,7 +382,9 @@ With a prefix argument, resume handling of the previous Ispell command."
368 (let ((wend (make-marker)) 382 (let ((wend (make-marker))
369 rescan 383 rescan
370 end) 384 end)
371 (save-excursion 385 ;; There used to be a save-excursion here,
386 ;; but that was annoying: it's better if point doesn't move
387 ;; when you type q.
372 (goto-char start) 388 (goto-char start)
373 (ispell-find-word-start) ;find correct word start 389 (ispell-find-word-start) ;find correct word start
374 (setq start (point-marker)) 390 (setq start (point-marker))
@@ -386,8 +402,9 @@ With a prefix argument, resume handling of the previous Ispell command."
386 (setq rescan nil) 402 (setq rescan nil)
387 (setq word (buffer-substring start wend)) 403 (setq word (buffer-substring start wend))
388 (cond ((ispell-still-bad word) 404 (cond ((ispell-still-bad word)
389 (goto-char start);just to show user where we are working 405;;; This just causes confusion. -- rms.
390 (sit-for 0) 406;;; (goto-char start)
407;;; (sit-for 0)
391 (message (format "Ispell checking %s" word)) 408 (message (format "Ispell checking %s" word))
392 (ispell-cmd word) 409 (ispell-cmd word)
393 (let ((message (ispell-next-message))) 410 (let ((message (ispell-next-message)))
@@ -411,7 +428,7 @@ With a prefix argument, resume handling of the previous Ispell command."
411 (erase-buffer)))) 428 (erase-buffer))))
412 (set-marker start nil) 429 (set-marker start nil)
413 (set-marker end nil) 430 (set-marker end nil)
414 (set-marker wend nil)))) 431 (set-marker wend nil)))
415 432
416(defun ispell-still-bad (word) 433(defun ispell-still-bad (word)
417 (let ((words ispell-recently-accepted) 434 (let ((words ispell-recently-accepted)
@@ -431,6 +448,8 @@ With a prefix argument, resume handling of the previous Ispell command."
431 (resize (eq selwin (next-window))) 448 (resize (eq selwin (next-window)))
432 (buf (get-buffer-create "*ispell choices*")) 449 (buf (get-buffer-create "*ispell choices*"))
433 w) 450 w)
451 (or ispell-window-configuration
452 (setq ispell-window-configuration (current-window-configuration)))
434 (setq w (display-buffer buf)) 453 (setq w (display-buffer buf))
435 (buffer-disable-undo buf) 454 (buffer-disable-undo buf)
436 (if resize 455 (if resize