diff options
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 14 | ||||
| -rw-r--r-- | lisp/scroll-bar.el | 28 | 
4 files changed, 37 insertions, 16 deletions
| @@ -240,6 +240,8 @@ optional repeat-count argument.  ** Emacs can now draw horizontal scroll bars on some platforms that  provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows.  Horizontal scroll bars are turned off by default. +*** New function `horizontal-scroll-bars-available-p' telling whether +    horizontal scroll bars are available on the underlying system.  *** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll      bars on all existing and future frames.  *** 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 @@ +2014-09-05  Martin Rudalics  <rudalics@gmx.at> + +	* 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. +  2014-09-05  Stefan Monnier  <monnier@iro.umontreal.ca>  	* 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.")        '(menu-item "Horizontal"                    menu-bar-horizontal-scroll-bar                    :help "Horizontal scroll bar" -                  :visible (display-graphic-p) -                  :button (:radio . (eq (cdr (assq 'horizontal-scroll-bars -                                                   (frame-parameters))) -					t)))) +                  :visible (horizontal-scroll-bars-available-p) +                  :button (:radio . (cdr (assq 'horizontal-scroll-bars +					       (frame-parameters))))))      (bindings--define-key menu [none-horizontal]        '(menu-item "None-horizontal"                    menu-bar-no-horizontal-scroll-bar                    :help "Turn off horizontal scroll bars" -                  :visible (display-graphic-p) -                  :button (:radio . (eq (cdr (assq 'horizontal-scroll-bars -                                                   (frame-parameters))) -					nil)))) +                  :visible (horizontal-scroll-bars-available-p) +                  :button (:radio . (not (cdr (assq 'horizontal-scroll-bars +                                                   (frame-parameters)))))))      (bindings--define-key menu [right]        '(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."  			    (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. | 
