Commit ada464a7 authored by Jim Blandy's avatar Jim Blandy
Browse files

* scroll-bar.el (scroll-bar-mode): Variable deleted.

	(scroll-bar-mode): Function changed to consult default-frame-alist
	instead of the variable.
parent 1c595d45
...@@ -48,9 +48,6 @@ that scroll bar position." ...@@ -48,9 +48,6 @@ that scroll bar position."
;;;; Helpful functions for enabling and disabling scroll bars. ;;;; Helpful functions for enabling and disabling scroll bars.
;;; This is not documented because you can't change the
;;; mode properly by setting it.
(defvar scroll-bar-mode t)
(defun scroll-bar-mode (flag) (defun scroll-bar-mode (flag)
"Toggle display of vertical scroll bars on each frame. "Toggle display of vertical scroll bars on each frame.
...@@ -59,25 +56,36 @@ created in the future. ...@@ -59,25 +56,36 @@ created in the future.
With a numeric argument, if the argument is negative, With a numeric argument, if the argument is negative,
turn off scroll bars; otherwise, turn on scroll bars." turn off scroll bars; otherwise, turn on scroll bars."
(interactive "P") (interactive "P")
(setq scroll-bar-mode (if (null flag) (not scroll-bar-mode)
(or (not (numberp flag)) (>= flag 0)))) ;; Obtain the current setting by looking at default-frame-alist.
(mapcar (let ((scroll-bar-mode
(function (let ((assq (assq 'vertical-scroll-bars default-frame-alist)))
(lambda (param-name) (if assq (cdr assq) t))))
(let ((parameter (assq param-name default-frame-alist)))
(if (consp parameter) ;; Tweedle it according to the argument.
(setcdr parameter scroll-bar-mode) (setq scroll-bar-mode (if (null flag) (not scroll-bar-mode)
(setq default-frame-alist (or (not (numberp flag)) (>= flag 0))))
(cons (cons param-name scroll-bar-mode)
default-frame-alist)))))) ;; Apply it to default-frame-alist.
'(vertical-scroll-bars horizontal-scroll-bars)) (mapcar
(let ((frames (frame-list))) (function
(while frames (lambda (param-name)
(modify-frame-parameters (let ((parameter (assq param-name default-frame-alist)))
(car frames) (if (consp parameter)
(list (cons 'vertical-scroll-bars scroll-bar-mode) (setcdr parameter scroll-bar-mode)
(cons 'horizontal-scroll-bars scroll-bar-mode))) (setq default-frame-alist
(setq frames (cdr frames))))) (cons (cons param-name scroll-bar-mode)
default-frame-alist))))))
'(vertical-scroll-bars horizontal-scroll-bars))
;; Apply it to existing frames.
(let ((frames (frame-list)))
(while frames
(modify-frame-parameters
(car frames)
(list (cons 'vertical-scroll-bars scroll-bar-mode)
(cons 'horizontal-scroll-bars scroll-bar-mode)))
(setq frames (cdr frames))))))
;;;; Buffer navigation using the scroll bar. ;;;; Buffer navigation using the scroll bar.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment