diff options
| author | Richard M. Stallman | 1999-07-09 18:00:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-07-09 18:00:24 +0000 |
| commit | f165ac6642751893b53f5c8e9ebaddb9fe3e20a9 (patch) | |
| tree | e6e142c1b17db7414f5dd1265bd04b0485678cfe | |
| parent | 191100f2aa7d0cffac2ab6ba91ae634e7e3f9c65 (diff) | |
| download | emacs-f165ac6642751893b53f5c8e9ebaddb9fe3e20a9.tar.gz emacs-f165ac6642751893b53f5c8e9ebaddb9fe3e20a9.zip | |
(hscroll-minibuffer-hook): New function.
(hscroll-global-mode): Add and remove that hook.
Set hscroll-old-truncate-was-global's default value.
| -rw-r--r-- | lisp/hscroll.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/hscroll.el b/lisp/hscroll.el index 04c582fbee1..1afce940556 100644 --- a/lisp/hscroll.el +++ b/lisp/hscroll.el | |||
| @@ -196,20 +196,25 @@ will have no effect on it). | |||
| 196 | ;; it was off | 196 | ;; it was off |
| 197 | (progn | 197 | (progn |
| 198 | (setq hscroll-old-truncate-default (default-value truncate-lines)) | 198 | (setq hscroll-old-truncate-default (default-value truncate-lines)) |
| 199 | (setq hscroll-old-truncate-was-global t) | 199 | (setq-default hscroll-old-truncate-was-global t) |
| 200 | (setq-default truncate-lines t) | 200 | (setq-default truncate-lines t) |
| 201 | (add-hook 'minibuffer-setup-hook 'hscroll-minibuffer-hook) | ||
| 201 | (setq hscroll-timer | 202 | (setq hscroll-timer |
| 202 | (run-with-idle-timer 0 t 'hscroll-window-maybe)))) | 203 | (run-with-idle-timer 0 t 'hscroll-window-maybe)))) |
| 203 | ;; turn it off | 204 | ;; turn it off |
| 204 | (if hscroll-mode | 205 | (if hscroll-mode |
| 205 | ;; it was on | 206 | ;; it was on |
| 206 | (progn | 207 | (progn |
| 208 | (remove-hook 'minibuffer-setup-hook 'hscroll-minibuffer-hook) | ||
| 207 | (setq-default truncate-lines hscroll-old-truncate-default) | 209 | (setq-default truncate-lines hscroll-old-truncate-default) |
| 208 | (cancel-timer hscroll-timer)))) | 210 | (cancel-timer hscroll-timer)))) |
| 209 | 211 | ||
| 210 | (setq-default hscroll-mode newmode) | 212 | (setq-default hscroll-mode newmode) |
| 211 | (force-mode-line-update t))) | 213 | (force-mode-line-update t))) |
| 212 | 214 | ||
| 215 | (defun hscroll-minibuffer-hook () | ||
| 216 | (setq truncate-lines hscroll-old-truncate-default)) | ||
| 217 | |||
| 213 | (defun hscroll-window-maybe () | 218 | (defun hscroll-window-maybe () |
| 214 | "Scroll horizontally if point is off or nearly off the edge of the window. | 219 | "Scroll horizontally if point is off or nearly off the edge of the window. |
| 215 | This is called automatically when in HScroll mode, but it can be explicitly | 220 | This is called automatically when in HScroll mode, but it can be explicitly |