Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 104705:e8247765661a
(ispell-accept-output, ispell-command-loop): Use with-current-buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 29 Aug 2009 14:48:10 +0000 |
parents | 91afee51b252 |
children | 7a6d07def086 |
comparison
equal
deleted
inserted
replaced
104704:ac32d8c1536f | 104705:e8247765661a |
---|---|
1520 (error "No Ispell process to read output from!") | 1520 (error "No Ispell process to read output from!") |
1521 (let ((buf ispell-output-buffer) | 1521 (let ((buf ispell-output-buffer) |
1522 ispell-output) | 1522 ispell-output) |
1523 (if (not (bufferp buf)) | 1523 (if (not (bufferp buf)) |
1524 (setq ispell-filter nil) | 1524 (setq ispell-filter nil) |
1525 (save-excursion | 1525 (with-current-buffer buf |
1526 (set-buffer buf) | |
1527 (setq ispell-output (buffer-substring-no-properties | 1526 (setq ispell-output (buffer-substring-no-properties |
1528 (point-min) (point-max)))) | 1527 (point-min) (point-max)))) |
1529 (ispell-filter t ispell-output) | 1528 (ispell-filter t ispell-output) |
1530 (save-excursion | 1529 (with-current-buffer buf |
1531 (set-buffer buf) | |
1532 (erase-buffer))))))) | 1530 (erase-buffer))))))) |
1533 | 1531 |
1534 (defun ispell-send-replacement (misspelled replacement) | 1532 (defun ispell-send-replacement (misspelled replacement) |
1535 "Notify aspell that MISSPELLED should be spelled REPLACEMENT. | 1533 "Notify aspell that MISSPELLED should be spelled REPLACEMENT. |
1536 This allows it to improve the suggestion list based on actual misspellings." | 1534 This allows it to improve the suggestion list based on actual misspellings." |
1869 (dedicated (window-dedicated-p (selected-window))) | 1867 (dedicated (window-dedicated-p (selected-window))) |
1870 (skipped 0) | 1868 (skipped 0) |
1871 char num result textwin dedicated-win) | 1869 char num result textwin dedicated-win) |
1872 | 1870 |
1873 ;; setup the *Choices* buffer with valid data. | 1871 ;; setup the *Choices* buffer with valid data. |
1874 (save-excursion | 1872 (with-current-buffer (get-buffer-create ispell-choices-buffer) |
1875 (set-buffer (get-buffer-create ispell-choices-buffer)) | |
1876 (setq mode-line-format | 1873 (setq mode-line-format |
1877 (concat "-- %b -- word: " word | 1874 (concat "-- %b -- word: " word |
1878 " -- dict: " (or ispell-current-dictionary "default") | 1875 " -- dict: " (or ispell-current-dictionary "default") |
1879 " -- prog: " (file-name-nondirectory ispell-program-name))) | 1876 " -- prog: " (file-name-nondirectory ispell-program-name))) |
1880 ;; XEmacs: no need for horizontal scrollbar in choices window | 1877 ;; XEmacs: no need for horizontal scrollbar in choices window |
2036 (let ((new-word (read-string | 2033 (let ((new-word (read-string |
2037 "Lookup string (`*' is wildcard): " | 2034 "Lookup string (`*' is wildcard): " |
2038 word))) | 2035 word))) |
2039 (if new-word | 2036 (if new-word |
2040 (progn | 2037 (progn |
2041 (save-excursion | 2038 (with-current-buffer (get-buffer-create |
2042 (set-buffer (get-buffer-create | 2039 ispell-choices-buffer) |
2043 ispell-choices-buffer)) | |
2044 (erase-buffer) | 2040 (erase-buffer) |
2045 (setq count ?0 | 2041 (setq count ?0 |
2046 skipped 0 | 2042 skipped 0 |
2047 mode-line-format | 2043 mode-line-format |
2048 (concat "-- %b -- word: " new-word | 2044 (concat "-- %b -- word: " new-word |