]> code.delx.au - gnu-emacs/blobdiff - lisp/scroll-bar.el
* server.el (server-buffer-done): Avoid changing the buffer when
[gnu-emacs] / lisp / scroll-bar.el
index 4801f9e02d42b263a288d3084ca030ffc29a0a4a..f12e0b42b9459ae9fd8100724c00c789c6f5e2ca 100644 (file)
@@ -1,17 +1,17 @@
 ;;; 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, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: hardware
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -75,6 +73,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 +84,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 +126,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.
@@ -355,5 +358,5 @@ EVENT should be a scroll bar click."
 \f
 (provide 'scroll-bar)
 
-;;; arch-tag: 6f1d01d0-0b1e-4bf8-86db-d491e0f399f3
+;; arch-tag: 6f1d01d0-0b1e-4bf8-86db-d491e0f399f3
 ;;; scroll-bar.el ends here