aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-20 12:23:37 +0000
committerMiles Bader2000-10-20 12:23:37 +0000
commite34850d19f1e959f19bca738dbfa61a49695c88e (patch)
tree745d53719e0de81005c9b4f8be7aa041dd3365f9
parentffb8fabb9ee0279f94d7781b0531bc9cc14b9ae5 (diff)
downloademacs-e34850d19f1e959f19bca738dbfa61a49695c88e.tar.gz
emacs-e34850d19f1e959f19bca738dbfa61a49695c88e.zip
(ispell-mode-line-window-height-fudge):
New function, conditionally aliased to `mode-line-window-height-fudge'. (ispell-help): Use it. (ispell-choices-win-default-height): Don't include mode-line fudge. (ispell-choices-win-default-height): New function. (ispell-show-choices, ispell-command-loop): Use function `ispell-choices-win-default-height' instead of variable.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/textmodes/ispell.el36
2 files changed, 36 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9f2e71098e6..4fab07a0c1e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12000-10-20 Miles Bader <miles@gnu.org>
2
3 * window.el (height-affecting-face-attributes): Use `defconst'.
4
5 * textmodes/ispell.el (ispell-mode-line-window-height-fudge):
6 New function, conditionally aliased to `mode-line-window-height-fudge'.
7 (ispell-help): Use it.
8 (ispell-choices-win-default-height): Don't include mode-line fudge.
9 (ispell-choices-win-default-height): New function.
10 (ispell-show-choices, ispell-command-loop): Use function
11 `ispell-choices-win-default-height' instead of variable.
12
12000-10-20 Miles Bader <miles@lsi.nec.co.jp> 132000-10-20 Miles Bader <miles@lsi.nec.co.jp>
2 14
3 * window.el (mode-line-window-height-fudge): New variable. 15 * window.el (mode-line-window-height-fudge): New variable.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c536cbe4f8d..b85a75ec382 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -222,6 +222,12 @@
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)))
225 231
226;;; ********************************************************************** 232;;; **********************************************************************
227;;; The following variables should be set according to personal preference 233;;; The following variables should be set according to personal preference
@@ -284,12 +290,9 @@ This minimizes redisplay thrashing."
284 :type 'boolean 290 :type 'boolean
285 :group 'ispell) 291 :group 'ispell)
286 292
287(defcustom ispell-choices-win-default-height (if ispell-graphic-p 3 2) 293(defcustom ispell-choices-win-default-height 2
288 "*The default size of the `*Choices*' window, including mode line. 294 "*The default size of the `*Choices*' window, including mode line.
289Must be greater than 1. 295Must be greater than 1."
290A Graphic capable modeline is thicker than a line of text, so it partially
291covers the last line of text in the choices buffer. Include an extra line
292for graphic capable displays to see all of the choices clearly."
293 :type 'integer 296 :type 'integer
294 :group 'ispell) 297 :group 'ispell)
295 298
@@ -1476,6 +1479,14 @@ If so, ask if it needs to be saved."
1476 (setq ispell-pdict-modified-p nil)) 1479 (setq ispell-pdict-modified-p nil))
1477 1480
1478 1481
1482(defun ispell-choices-win-default-height ()
1483 "Return the default height of the `*Choices*' window for this display.
1484This is the value of of the variable `ispell-choices-win-default-height',
1485plus a possible fudge factor to work around problems with mode-lines that
1486obscure the last buffer line on graphics capable displays."
1487 (+ ispell-choices-win-default-height (ispell-mode-line-window-height-fudge)))
1488
1489
1479(defun ispell-command-loop (miss guess word start end) 1490(defun ispell-command-loop (miss guess word start end)
1480 "Display possible corrections from list MISS. 1491 "Display possible corrections from list MISS.
1481GUESS lists possibly valid affix construction of WORD. 1492GUESS lists possibly valid affix construction of WORD.
@@ -1491,11 +1502,11 @@ indicates whether the dictionary has been modified when option `a' or `i' is
1491used. 1502used.
1492Global `ispell-quit' set to start location to continue spell session." 1503Global `ispell-quit' set to start location to continue spell session."
1493 (let ((count ?0) 1504 (let ((count ?0)
1494 (line ispell-choices-win-default-height) 1505 (line (ispell-choices-win-default-height))
1495 (max-lines (- (window-height) 4)) ; ensure 4 context lines. 1506 (max-lines (- (window-height) 4)) ; ensure 4 context lines.
1496 (choices miss) 1507 (choices miss)
1497 (window-min-height (min window-min-height 1508 (window-min-height (min window-min-height
1498 ispell-choices-win-default-height)) 1509 (ispell-choices-win-default-height)))
1499 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m )) 1510 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))
1500 (dedicated (window-dedicated-p (selected-window))) 1511 (dedicated (window-dedicated-p (selected-window)))
1501 (skipped 0) 1512 (skipped 0)
@@ -1666,7 +1677,7 @@ Global `ispell-quit' set to start location to continue spell session."
1666 new-word) 1677 new-word)
1667 miss (lookup-words new-word) 1678 miss (lookup-words new-word)
1668 choices miss 1679 choices miss
1669 line ispell-choices-win-default-height) 1680 line (ispell-choices-win-default-height))
1670 (while (and choices ; adjust choices window. 1681 (while (and choices ; adjust choices window.
1671 (< (if (> (+ 7 (current-column) 1682 (< (if (> (+ 7 (current-column)
1672 (length (car choices)) 1683 (length (car choices))
@@ -1768,9 +1779,9 @@ Global `ispell-quit' set to start location to continue spell session."
1768 ;; without scrolling the spelled window when possible 1779 ;; without scrolling the spelled window when possible
1769 (let ((window-line (- line (window-height choices-window))) 1780 (let ((window-line (- line (window-height choices-window)))
1770 (visible (progn (vertical-motion -1) (point)))) 1781 (visible (progn (vertical-motion -1) (point))))
1771 (if (< line ispell-choices-win-default-height) 1782 (if (< line (ispell-choices-win-default-height))
1772 (setq window-line (+ window-line 1783 (setq window-line (+ window-line
1773 (- ispell-choices-win-default-height 1784 (- (ispell-choices-win-default-height)
1774 line)))) 1785 line))))
1775 (move-to-window-line 0) 1786 (move-to-window-line 0)
1776 (vertical-motion window-line) 1787 (vertical-motion window-line)
@@ -1780,7 +1791,7 @@ Global `ispell-quit' set to start location to continue spell session."
1780 (select-window (previous-window)) ; *Choices* window 1791 (select-window (previous-window)) ; *Choices* window
1781 (enlarge-window window-line))) 1792 (enlarge-window window-line)))
1782 ;; Overlay *Choices* window when it isn't showing 1793 ;; Overlay *Choices* window when it isn't showing
1783 (ispell-overlay-window (max line ispell-choices-win-default-height))) 1794 (ispell-overlay-window (max line (ispell-choices-win-default-height))))
1784 (switch-to-buffer ispell-choices-buffer) 1795 (switch-to-buffer ispell-choices-buffer)
1785 (goto-char (point-min))))) 1796 (goto-char (point-min)))))
1786 1797
@@ -1853,7 +1864,8 @@ SPC: Accept word this time.
1853 (save-window-excursion 1864 (save-window-excursion
1854 (if ispell-help-in-bufferp 1865 (if ispell-help-in-bufferp
1855 (progn 1866 (progn
1856 (ispell-overlay-window (if ispell-graphic-p 5 4)) 1867 (ispell-overlay-window
1868 (+ 4 (ispell-mode-line-window-height-fudge)))
1857 (switch-to-buffer (get-buffer-create "*Ispell Help*")) 1869 (switch-to-buffer (get-buffer-create "*Ispell Help*"))
1858 (insert (concat help-1 "\n" help-2 "\n" help-3)) 1870 (insert (concat help-1 "\n" help-2 "\n" help-3))
1859 (sit-for 5) 1871 (sit-for 5)