]> code.delx.au - gnu-emacs/blobdiff - lisp/scroll-bar.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / scroll-bar.el
index 4801f9e02d42b263a288d3084ca030ffc29a0a4a..0a373058f667d48a2ddba213c06a5e714eb20003 100644 (file)
@@ -1,7 +1,7 @@
 ;;; scroll-bar.el --- window system-independent scroll bar support
 
 ;; Copyright (C) 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: hardware
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -75,6 +75,7 @@ SIDE must be the symbol `left' or `right'."
 ;;;; Helpful functions for enabling and disabling scroll bars.
 
 (defvar scroll-bar-mode)
+(defvar previous-scroll-bar-mode nil)
 
 (defvar scroll-bar-mode-explicit nil
   "Non-nil means `set-scroll-bar-mode' should really do something.
@@ -85,6 +86,9 @@ This is nil while loading `scroll-bar.el', and t afterward.")
 
 (defun set-scroll-bar-mode (value)
   "Set `scroll-bar-mode' to VALUE and put the new value into effect."
+  (if scroll-bar-mode
+      (setq previous-scroll-bar-mode scroll-bar-mode))
+
   (setq scroll-bar-mode value)
 
   (when scroll-bar-mode-explicit
@@ -124,7 +128,8 @@ turn off scroll bars; otherwise, turn on scroll bars."
                               (not scroll-bar-mode)
                             (setq flag (prefix-numeric-value flag))
                             (or (not (numberp flag)) (>= flag 0)))
-                          default-frame-scroll-bars)))
+                          (or previous-scroll-bar-mode
+                              default-frame-scroll-bars))))
 
 (defun toggle-scroll-bar (arg)
   "Toggle whether or not the selected frame has vertical scroll bars.