aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2014-09-05 12:29:34 +0200
committerMartin Rudalics2014-09-05 12:29:34 +0200
commit510a4a4e93a06557c62dcb622f8f8e9c3d533f53 (patch)
tree95af00ed2046c6a9769958b4494bc8502990d0a0
parent04b134e174b7ce4ce49f26c56791d92dd08fbee1 (diff)
downloademacs-510a4a4e93a06557c62dcb622f8f8e9c3d533f53.tar.gz
emacs-510a4a4e93a06557c62dcb622f8f8e9c3d533f53.zip
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.
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/menu-bar.el14
-rw-r--r--lisp/scroll-bar.el28
4 files changed, 37 insertions, 16 deletions
diff --git a/etc/NEWS b/etc/NEWS
index bdda3ed0672..3b7516dd819 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -240,6 +240,8 @@ optional repeat-count argument.
240** Emacs can now draw horizontal scroll bars on some platforms that 240** Emacs can now draw horizontal scroll bars on some platforms that
241provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows. 241provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows.
242Horizontal scroll bars are turned off by default. 242Horizontal scroll bars are turned off by default.
243*** New function `horizontal-scroll-bars-available-p' telling whether
244 horizontal scroll bars are available on the underlying system.
243*** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll 245*** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll
244 bars on all existing and future frames. 246 bars on all existing and future frames.
245*** New frame parameters `horizontal-scroll-bars' and 247*** New frame parameters `horizontal-scroll-bars' and
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2cc27412da4..c6469006b81 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12014-09-05 Martin Rudalics <rudalics@gmx.at>
2
3 * scroll-bar.el (horizontal-scroll-bars-available-p): New
4 function.
5 (horizontal-scroll-bar-mode): Rewrite using
6 horizontal-scroll-bars-available-p.
7 * menu-bar.el (menu-bar-showhide-scroll-bar-menu): Rewrite using
8 horizontal-scroll-bars-available-p.
9
12014-09-05 Stefan Monnier <monnier@iro.umontreal.ca> 102014-09-05 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * subr.el (call-process-shell-command, process-file-shell-command): 12 * subr.el (call-process-shell-command, process-file-shell-command):
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 57acbbe648e..9657c5924f9 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -903,19 +903,17 @@ by \"Save Options\" in Custom buffers.")
903 '(menu-item "Horizontal" 903 '(menu-item "Horizontal"
904 menu-bar-horizontal-scroll-bar 904 menu-bar-horizontal-scroll-bar
905 :help "Horizontal scroll bar" 905 :help "Horizontal scroll bar"
906 :visible (display-graphic-p) 906 :visible (horizontal-scroll-bars-available-p)
907 :button (:radio . (eq (cdr (assq 'horizontal-scroll-bars 907 :button (:radio . (cdr (assq 'horizontal-scroll-bars
908 (frame-parameters))) 908 (frame-parameters))))))
909 t))))
910 909
911 (bindings--define-key menu [none-horizontal] 910 (bindings--define-key menu [none-horizontal]
912 '(menu-item "None-horizontal" 911 '(menu-item "None-horizontal"
913 menu-bar-no-horizontal-scroll-bar 912 menu-bar-no-horizontal-scroll-bar
914 :help "Turn off horizontal scroll bars" 913 :help "Turn off horizontal scroll bars"
915 :visible (display-graphic-p) 914 :visible (horizontal-scroll-bars-available-p)
916 :button (:radio . (eq (cdr (assq 'horizontal-scroll-bars 915 :button (:radio . (not (cdr (assq 'horizontal-scroll-bars
917 (frame-parameters))) 916 (frame-parameters)))))))
918 nil))))
919 917
920 (bindings--define-key menu [right] 918 (bindings--define-key menu [right]
921 '(menu-item "On the Right" 919 '(menu-item "On the Right"
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."
144 (if v (or previous-scroll-bar-mode 144 (if v (or previous-scroll-bar-mode
145 default-frame-scroll-bars)))))) 145 default-frame-scroll-bars))))))
146 146
147(defun horizontal-scroll-bars-available-p ()
148 "Return non-nil when horizontal scroll bars are available on this system."
149 (and (display-graphic-p)
150 (boundp 'x-toolkit-scroll-bars)
151 x-toolkit-scroll-bars
152 (not (eq (window-system) 'ns))))
153
147(define-minor-mode horizontal-scroll-bar-mode 154(define-minor-mode horizontal-scroll-bar-mode
148 "Toggle horizontal scroll bars on all frames (Horizontal Scroll Bar mode). 155 "Toggle horizontal scroll bars on all frames (Horizontal Scroll Bar mode).
149With a prefix argument ARG, enable Horizontal Scroll Bar mode if 156With a prefix argument ARG, enable Horizontal Scroll Bar mode if
@@ -155,14 +162,19 @@ created in the future."
155 :init-value nil 162 :init-value nil
156 :global t 163 :global t
157 :group 'frames 164 :group 'frames
158 (dolist (frame (frame-list)) 165 (if (and horizontal-scroll-bar-mode
159 (set-frame-parameter 166 (not (horizontal-scroll-bars-available-p)))
160 frame 'horizontal-scroll-bars horizontal-scroll-bar-mode)) 167 (progn
161 ;; Handle `default-frame-alist' entry. 168 (setq horizontal-scroll-bar-mode nil)
162 (setq default-frame-alist 169 (message "Horizontal scroll bars are not implemented on this system"))
163 (cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode) 170 (dolist (frame (frame-list))
164 (assq-delete-all 'horizontal-scroll-bars 171 (set-frame-parameter
165 default-frame-alist)))) 172 frame 'horizontal-scroll-bars horizontal-scroll-bar-mode))
173 ;; Handle `default-frame-alist' entry.
174 (setq default-frame-alist
175 (cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode)
176 (assq-delete-all 'horizontal-scroll-bars
177 default-frame-alist)))))
166 178
167(defun toggle-scroll-bar (arg) 179(defun toggle-scroll-bar (arg)
168 "Toggle whether or not the selected frame has vertical scroll bars. 180 "Toggle whether or not the selected frame has vertical scroll bars.