Mercurial > emacs
comparison lisp/hscroll.el @ 24939:db6ed843d5e8
(hscroll-minibuffer-hook): New function.
(hscroll-global-mode): Add and remove that hook.
Set hscroll-old-truncate-was-global's default value.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 09 Jul 1999 18:00:24 +0000 |
parents | ebff04ce5d74 |
children | 856179ce1645 |
comparison
equal
deleted
inserted
replaced
24938:a4c871b96d4b | 24939:db6ed843d5e8 |
---|---|
194 ;; turn it on | 194 ;; turn it on |
195 (if (not hscroll-mode) | 195 (if (not hscroll-mode) |
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))) |
214 | |
215 (defun hscroll-minibuffer-hook () | |
216 (setq truncate-lines hscroll-old-truncate-default)) | |
212 | 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 |
216 invoked as well (i.e., it can be bound to a key). | 221 invoked as well (i.e., it can be bound to a key). |