aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-12-15 01:09:50 +0000
committerMiles Bader2000-12-15 01:09:50 +0000
commit24b0afdc47d638af5a5616b079ef36d73ff82b9c (patch)
tree3ab606805721d3cd7e83f5a41adb10361eeedf45
parent97dff879ca7aeb61a9d014d9cee7dd0ab173d127 (diff)
downloademacs-24b0afdc47d638af5a5616b079ef36d73ff82b9c.tar.gz
emacs-24b0afdc47d638af5a5616b079ef36d73ff82b9c.zip
(ispell-overlay-window): Ensure that the new window is really the right size.
Use vertical-motion rather than forward-line. (ispell-help): Don't use ispell-mode-line-window-height-fudge. (ispell-command-loop, ispell-show-choices): Use the variable ispell-choices-win-default-height, rather than the function. (ispell-choices-win-default-height): Function removed. (ispell-mode-line-window-height-fudge): Function removed.
-rw-r--r--lisp/textmodes/ispell.el48
1 files changed, 24 insertions, 24 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 72907525d52..c631175e61e 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -222,13 +222,6 @@
222 (not (boundp 'epoch::version)) 222 (not (boundp 'epoch::version))
223 (defalias 'ispell-check-version 'check-ispell-version)) 223 (defalias 'ispell-check-version 'check-ispell-version))
224 224
225(if (fboundp 'mode-line-window-height-fudge)
226 (defalias 'ispell-mode-line-window-height-fudge
227 'mode-line-window-height-fudge)
228 (defun ispell-mode-line-window-height-fudge ()
229 "Return 1 if running on a `graphics capable' display, otherwise 0."
230 (if ispell-graphic-p 1 0)))
231
232;;; ********************************************************************** 225;;; **********************************************************************
233;;; The following variables should be set according to personal preference 226;;; The following variables should be set according to personal preference
234;;; and location of binaries: 227;;; and location of binaries:
@@ -1488,14 +1481,6 @@ If so, ask if it needs to be saved."
1488 (setq ispell-pdict-modified-p nil)) 1481 (setq ispell-pdict-modified-p nil))
1489 1482
1490 1483
1491(defun ispell-choices-win-default-height ()
1492 "Return the default height of the `*Choices*' window for this display.
1493This is the value of of the variable `ispell-choices-win-default-height',
1494plus a possible fudge factor to work around problems with mode-lines that
1495obscure the last buffer line on graphics capable displays."
1496 (+ ispell-choices-win-default-height (ispell-mode-line-window-height-fudge)))
1497
1498
1499(defun ispell-command-loop (miss guess word start end) 1484(defun ispell-command-loop (miss guess word start end)
1500 "Display possible corrections from list MISS. 1485 "Display possible corrections from list MISS.
1501GUESS lists possibly valid affix construction of WORD. 1486GUESS lists possibly valid affix construction of WORD.
@@ -1511,11 +1496,11 @@ indicates whether the dictionary has been modified when option `a' or `i' is
1511used. 1496used.
1512Global `ispell-quit' set to start location to continue spell session." 1497Global `ispell-quit' set to start location to continue spell session."
1513 (let ((count ?0) 1498 (let ((count ?0)
1514 (line (ispell-choices-win-default-height)) 1499 (line ispell-choices-win-default-height)
1515 (max-lines (- (window-height) 4)) ; ensure 4 context lines. 1500 (max-lines (- (window-height) 4)) ; ensure 4 context lines.
1516 (choices miss) 1501 (choices miss)
1517 (window-min-height (min window-min-height 1502 (window-min-height (min window-min-height
1518 (ispell-choices-win-default-height))) 1503 ispell-choices-win-default-height))
1519 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m )) 1504 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))
1520 (dedicated (window-dedicated-p (selected-window))) 1505 (dedicated (window-dedicated-p (selected-window)))
1521 (skipped 0) 1506 (skipped 0)
@@ -1686,7 +1671,7 @@ Global `ispell-quit' set to start location to continue spell session."
1686 new-word) 1671 new-word)
1687 miss (lookup-words new-word) 1672 miss (lookup-words new-word)
1688 choices miss 1673 choices miss
1689 line (ispell-choices-win-default-height)) 1674 line ispell-choices-win-default-height)
1690 (while (and choices ; adjust choices window. 1675 (while (and choices ; adjust choices window.
1691 (< (if (> (+ 7 (current-column) 1676 (< (if (> (+ 7 (current-column)
1692 (length (car choices)) 1677 (length (car choices))
@@ -1788,9 +1773,9 @@ Global `ispell-quit' set to start location to continue spell session."
1788 ;; without scrolling the spelled window when possible 1773 ;; without scrolling the spelled window when possible
1789 (let ((window-line (- line (window-height choices-window))) 1774 (let ((window-line (- line (window-height choices-window)))
1790 (visible (progn (vertical-motion -1) (point)))) 1775 (visible (progn (vertical-motion -1) (point))))
1791 (if (< line (ispell-choices-win-default-height)) 1776 (if (< line ispell-choices-win-default-height)
1792 (setq window-line (+ window-line 1777 (setq window-line (+ window-line
1793 (- (ispell-choices-win-default-height) 1778 (- ispell-choices-win-default-height
1794 line)))) 1779 line))))
1795 (move-to-window-line 0) 1780 (move-to-window-line 0)
1796 (vertical-motion window-line) 1781 (vertical-motion window-line)
@@ -1800,7 +1785,7 @@ Global `ispell-quit' set to start location to continue spell session."
1800 (select-window (previous-window)) ; *Choices* window 1785 (select-window (previous-window)) ; *Choices* window
1801 (enlarge-window window-line))) 1786 (enlarge-window window-line)))
1802 ;; Overlay *Choices* window when it isn't showing 1787 ;; Overlay *Choices* window when it isn't showing
1803 (ispell-overlay-window (max line (ispell-choices-win-default-height)))) 1788 (ispell-overlay-window (max line ispell-choices-win-default-height)))
1804 (switch-to-buffer ispell-choices-buffer) 1789 (switch-to-buffer ispell-choices-buffer)
1805 (goto-char (point-min))))) 1790 (goto-char (point-min)))))
1806 1791
@@ -1873,8 +1858,7 @@ SPC: Accept word this time.
1873 (save-window-excursion 1858 (save-window-excursion
1874 (if ispell-help-in-bufferp 1859 (if ispell-help-in-bufferp
1875 (progn 1860 (progn
1876 (ispell-overlay-window 1861 (ispell-overlay-window 4)
1877 (+ 4 (ispell-mode-line-window-height-fudge)))
1878 (switch-to-buffer (get-buffer-create "*Ispell Help*")) 1862 (switch-to-buffer (get-buffer-create "*Ispell Help*"))
1879 (insert (concat help-1 "\n" help-2 "\n" help-3)) 1863 (insert (concat help-1 "\n" help-2 "\n" help-3))
1880 (sit-for 5) 1864 (sit-for 5)
@@ -2064,7 +2048,7 @@ The variable `ispell-highlight-face' selects the face to use for highlighting."
2064Ensure that the line above point is still visible but otherwise avoid 2048Ensure that the line above point is still visible but otherwise avoid
2065scrolling the current window. Leave the new window selected." 2049scrolling the current window. Leave the new window selected."
2066 (save-excursion 2050 (save-excursion
2067 (let ((oldot (save-excursion (forward-line -1) (point))) 2051 (let ((oldot (save-excursion (vertical-motion -1) (point)))
2068 (top (save-excursion (move-to-window-line height) (point)))) 2052 (top (save-excursion (move-to-window-line height) (point))))
2069 ;; If line above old point (line starting at oldot) would be 2053 ;; If line above old point (line starting at oldot) would be
2070 ;; hidden by new window, scroll it to just below new win 2054 ;; hidden by new window, scroll it to just below new win
@@ -2077,6 +2061,22 @@ scrolling the current window. Leave the new window selected."
2077 (split-window nil height) 2061 (split-window nil height)
2078 (modify-frame-parameters frame '((unsplittable . t)))) 2062 (modify-frame-parameters frame '((unsplittable . t))))
2079 (split-window nil height)) 2063 (split-window nil height))
2064 (let ((deficit
2065 ;; Number of lines the window is still too short. We
2066 ;; ensure that there are at least (1- HEIGHT) lines
2067 ;; visible in the window.
2068 (- height
2069 (cond ((fboundp 'window-text-height)
2070 (1+ (window-text-height)))
2071 (ispell-graphic-p
2072 (1- (window-height)))
2073 (t
2074 (window-height))))))
2075 (when (> deficit 0)
2076 (enlarge-window deficit)
2077 (goto-char top)
2078 (vertical-motion deficit)
2079 (setq top (min (point) oldot))))
2080 (set-window-start (next-window) top)))) 2080 (set-window-start (next-window) top))))
2081 2081
2082 2082