X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/11fdef7d0cf3ef1ce30d1cd09ca9ca9a2b099d20..f1e06f7bffc1407f7e597f714b2969fc6d1d8eed:/lisp/scroll-bar.el diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 54f2ba765b..2990e8e5ff 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -1,8 +1,8 @@ ;;; scroll-bar.el --- window system-independent scroll bar support -;; Copyright (C) 1993-1995, 1999-2011 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 1999-2014 Free Software Foundation, Inc. -;; Maintainer: FSF +;; Maintainer: emacs-devel@gnu.org ;; Keywords: hardware ;; Package: emacs @@ -29,7 +29,7 @@ ;;; Code: (require 'mouse) -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) ;;;; Utilities. @@ -81,7 +81,8 @@ SIDE must be the symbol `left' or `right'." 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." + "Set the scroll bar mode to VALUE and put the new value into effect. +See the `scroll-bar-mode' variable for possible values to use." (if scroll-bar-mode (setq previous-scroll-bar-mode scroll-bar-mode)) @@ -111,17 +112,22 @@ Setting the variable with a customization buffer also takes effect." ;; If it is set again, that is for real. (setq scroll-bar-mode-explicit t) -(defun get-scroll-bar-mode () scroll-bar-mode) -(defsetf get-scroll-bar-mode set-scroll-bar-mode) +(defun get-scroll-bar-mode () + (declare (gv-setter set-scroll-bar-mode)) + scroll-bar-mode) + (define-minor-mode scroll-bar-mode - "Toggle display of vertical scroll bars on all frames. + "Toggle vertical scroll bars on all frames (Scroll Bar mode). +With a prefix argument ARG, enable Scroll Bar mode if ARG is +positive, and disable it otherwise. If called from Lisp, enable +the mode if ARG is omitted or nil. + This command applies to all frames that exist and frames to be -created in the future. -With a numeric argument, if the argument is positive -turn on scroll bars; otherwise turn off scroll bars." - :variable (eq (get-scroll-bar-mode) - (or previous-scroll-bar-mode - default-frame-scroll-bars))) +created in the future." + :variable ((get-scroll-bar-mode) + . (lambda (v) (set-scroll-bar-mode + (if v (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.