diff options
author | Martin Rudalics <rudalics@gmx.at> | 2014-09-05 12:29:34 +0200 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2014-09-05 12:29:34 +0200 |
commit | 510a4a4e93a06557c62dcb622f8f8e9c3d533f53 (patch) | |
tree | 95af00ed2046c6a9769958b4494bc8502990d0a0 /lisp/scroll-bar.el | |
parent | 04b134e174b7ce4ce49f26c56791d92dd08fbee1 (diff) | |
download | emacs-510a4a4e93a06557c62dcb622f8f8e9c3d533f53.tar.gz |
Add and use function horizontal-scroll-bars-available-p.
* scroll-bar.el (horizontal-scroll-bars-available-p): New
function.
(horizontal-scroll-bar-mode): Rewrite using
horizontal-scroll-bars-available-p.
* menu-bar.el (menu-bar-showhide-scroll-bar-menu): Rewrite using
horizontal-scroll-bars-available-p.
Diffstat (limited to 'lisp/scroll-bar.el')
-rw-r--r-- | lisp/scroll-bar.el | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 588ac3b0f8a..63713c24a64 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -144,6 +144,13 @@ created in the future." (if v (or previous-scroll-bar-mode default-frame-scroll-bars)))))) +(defun horizontal-scroll-bars-available-p () + "Return non-nil when horizontal scroll bars are available on this system." + (and (display-graphic-p) + (boundp 'x-toolkit-scroll-bars) + x-toolkit-scroll-bars + (not (eq (window-system) 'ns)))) + (define-minor-mode horizontal-scroll-bar-mode "Toggle horizontal scroll bars on all frames (Horizontal Scroll Bar mode). With a prefix argument ARG, enable Horizontal Scroll Bar mode if @@ -155,14 +162,19 @@ created in the future." :init-value nil :global t :group 'frames - (dolist (frame (frame-list)) - (set-frame-parameter - frame 'horizontal-scroll-bars horizontal-scroll-bar-mode)) - ;; Handle `default-frame-alist' entry. - (setq default-frame-alist - (cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode) - (assq-delete-all 'horizontal-scroll-bars - default-frame-alist)))) + (if (and horizontal-scroll-bar-mode + (not (horizontal-scroll-bars-available-p))) + (progn + (setq horizontal-scroll-bar-mode nil) + (message "Horizontal scroll bars are not implemented on this system")) + (dolist (frame (frame-list)) + (set-frame-parameter + frame 'horizontal-scroll-bars horizontal-scroll-bar-mode)) + ;; Handle `default-frame-alist' entry. + (setq default-frame-alist + (cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode) + (assq-delete-all 'horizontal-scroll-bars + default-frame-alist))))) (defun toggle-scroll-bar (arg) "Toggle whether or not the selected frame has vertical scroll bars. |