summaryrefslogtreecommitdiff
path: root/lisp/scroll-bar.el
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-02-25 00:38:55 +0000
committerJim Blandy <jimb@redhat.com>1993-02-25 00:38:55 +0000
commit175e8d047ac45287f334339421115f7f26f38ed5 (patch)
tree74775a6639ce0bd0c4543361d4c0e9b66925193c /lisp/scroll-bar.el
parentd1eb25e481435fea0f33ffee635c6de68b2774ff (diff)
downloademacs-175e8d047ac45287f334339421115f7f26f38ed5.tar.gz
* term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
functions to scrolbar.el. * scrollbar.el (scroll-bar-mode, scroll-bar-mode): Here they are. Make scroll-bar-mode set the {vertical,horizontal}-scrollbars parameters in default-frame-alist, and modify all extant screens using the correct parameter names.
Diffstat (limited to 'lisp/scroll-bar.el')
-rw-r--r--lisp/scroll-bar.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index e0d38e3d30c..63b37a59145 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -39,6 +39,36 @@ that scrollbar position."
(truncate (/ (* (float (car num-denom)) whole) (cdr num-denom))))
+;;;; Helpful functions for enabling and disabling scroll bars.
+(defvar scroll-bar-mode nil)
+
+(defun scroll-bar-mode (flag)
+ "Toggle display of vertical scroll bars on each frame.
+This command applies to all frames that exist and frames to be
+created in the future.
+With a numeric argument, if the argument is negative,
+turn off scroll bars; otherwise, turn on scroll bars."
+ (interactive "P")
+ (setq scroll-bar-mode (if (null flag) (not scroll-bar-mode)
+ (or (not (numberp flag)) (>= flag 0))))
+ (mapcar
+ (function
+ (lambda (param-name)
+ (let ((parameter (assq param-name default-frame-alist)))
+ (if (consp parameter)
+ (setcdr parameter scroll-bar-mode)
+ (setq default-frame-alist
+ (cons (cons param-name scroll-bar-mode)
+ default-frame-alist))))))
+ '(vertical-scrollbars horizontal-scrollbars))
+ (let ((frames (frame-list)))
+ (while frames
+ (modify-frame-parameters
+ (car frames)
+ (list (cons 'vertical-scrollbars scroll-bar-mode)
+ (cons 'horizontal-scrollbars scroll-bar-mode)))
+ (setq frames (cdr frames)))))
+
;;;; Buffer navigation using the scrollbar.
(defun scrollbar-set-window-start (event)