diff options
| author | Martin Rudalics | 2014-09-05 12:29:34 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2014-09-05 12:29:34 +0200 |
| commit | 510a4a4e93a06557c62dcb622f8f8e9c3d533f53 (patch) | |
| tree | 95af00ed2046c6a9769958b4494bc8502990d0a0 /lisp | |
| parent | 04b134e174b7ce4ce49f26c56791d92dd08fbee1 (diff) | |
| download | emacs-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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 14 | ||||
| -rw-r--r-- | lisp/scroll-bar.el | 28 |
3 files changed, 35 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2cc27412da4..c6469006b81 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-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 | |||
| 1 | 2014-09-05 Stefan Monnier <monnier@iro.umontreal.ca> | 10 | 2014-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). |
| 149 | With a prefix argument ARG, enable Horizontal Scroll Bar mode if | 156 | With 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. |