diff lisp/scroll-bar.el @ 1954:059d99d03aae

* 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.
author Jim Blandy <jimb@redhat.com>
date Thu, 25 Feb 1993 00:38:55 +0000
parents 04fb1d3d6992
children 3a08dacd8bfb
line wrap: on
line diff
--- a/lisp/scroll-bar.el	Wed Feb 24 23:37:46 1993 +0000
+++ b/lisp/scroll-bar.el	Thu Feb 25 00:38:55 1993 +0000
@@ -39,6 +39,36 @@
   (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)