aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2014-09-03 17:10:29 +0200
committerMartin Rudalics2014-09-03 17:10:29 +0200
commit568df136f13451a098d166918b9602cf8dedf976 (patch)
treed9870a3b614c9f10d2f626e7481c796b750f171b
parent62fca47221fc9d248511cd94fbcb41ddb46763e6 (diff)
downloademacs-568df136f13451a098d166918b9602cf8dedf976.tar.gz
emacs-568df136f13451a098d166918b9602cf8dedf976.zip
Clean up initialization and customization of horizontal scroll bars.
* frame.el (frame-initialize): Remove horizontal-scroll-bars from frame-initial-frame-alist. * scroll-bar.el (previous-horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode-explicit) (set-horizontal-scroll-bar-mode, get-horizontal-scroll-bar-mode) (toggle-horizontal-scroll-bar): Remove. (horizontal-scroll-bar-mode): Remove defcustom. (horizontal-scroll-bar-mode): Fix doc-string. (scroll-bar-toolkit-scroll) (scroll-bar-toolkit-horizontal-scroll): Add doc-strings stubs. * buffer.c (scroll-bar-height): Fix typo in doc-string. * frame.c (Vdefault_frame_horizontal_scroll_bars): Remove variable. * nsfns.m (Fx_create_frame): * w32fns.c (Fx_create_frame): * xfns.c (Fx_create_frame): Default horizontal scroll bars to nil.
-rw-r--r--etc/NEWS11
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/frame.el4
-rw-r--r--lisp/scroll-bar.el68
-rw-r--r--src/ChangeLog10
-rw-r--r--src/buffer.c2
-rw-r--r--src/frame.c10
-rw-r--r--src/nsfns.m2
-rw-r--r--src/w32fns.c2
-rw-r--r--src/xfns.c8
10 files changed, 51 insertions, 79 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 1d9f8ca850f..776519fa5cf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -232,6 +232,17 @@ optional repeat-count argument.
232 as the first or last argument of subsequent forms. 232 as the first or last argument of subsequent forms.
233 233
234 234
235* Changes in Frames and Windows Code in Emacs 24.5
236
237** Emacs can now draw horizontal scroll bars on some platforms that
238provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows.
239Horizontal scroll bars are turned off by default. Use the command
240`horizontal-scroll-bar-mode' to toggle them on all frames; the frame
241parameter `horizontal-scroll-bars' to turn them on/off on individual
242frames; the function `set-window-scroll-bars' to turn them on/off on
243individual windows.
244
245
235* Changes in Emacs 24.5 on Non-Free Operating Systems 246* Changes in Emacs 24.5 on Non-Free Operating Systems
236 247
237--- 248---
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 29fec987a2e..d4bb37d32c6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12014-09-03 Martin Rudalics <rudalics@gmx.at>
2
3 * frame.el (frame-initialize): Remove horizontal-scroll-bars
4 from frame-initial-frame-alist.
5 * scroll-bar.el (previous-horizontal-scroll-bar-mode)
6 (horizontal-scroll-bar-mode-explicit)
7 (set-horizontal-scroll-bar-mode, get-horizontal-scroll-bar-mode)
8 (toggle-horizontal-scroll-bar): Remove.
9 (horizontal-scroll-bar-mode): Remove defcustom.
10 (horizontal-scroll-bar-mode): Fix doc-string.
11 (scroll-bar-toolkit-scroll)
12 (scroll-bar-toolkit-horizontal-scroll): Add doc-strings stubs.
13
12014-09-03 Stefan Monnier <monnier@iro.umontreal.ca> 142014-09-03 Stefan Monnier <monnier@iro.umontreal.ca>
2 15
3 * emacs-lisp/package.el (package-generate-description-file): 16 * emacs-lisp/package.el (package-generate-description-file):
diff --git a/lisp/frame.el b/lisp/frame.el
index d528eef6735..f144cf23405 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -174,10 +174,6 @@ This function runs the hook `focus-out-hook'."
174 (progn 174 (progn
175 (setq frame-initial-frame-alist 175 (setq frame-initial-frame-alist
176 (append initial-frame-alist default-frame-alist nil)) 176 (append initial-frame-alist default-frame-alist nil))
177 (or (assq 'horizontal-scroll-bars frame-initial-frame-alist)
178 (setq frame-initial-frame-alist
179 (cons '(horizontal-scroll-bars . t)
180 frame-initial-frame-alist)))
181 (setq frame-initial-frame-alist 177 (setq frame-initial-frame-alist
182 (cons (cons 'window-system initial-window-system) 178 (cons (cons 'window-system initial-window-system)
183 frame-initial-frame-alist)) 179 frame-initial-frame-alist))
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 2dd394fa2af..588ac3b0f8a 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -90,16 +90,11 @@ SIDE must be the symbol `left' or `right'."
90(defvar scroll-bar-mode) 90(defvar scroll-bar-mode)
91(defvar horizontal-scroll-bar-mode) 91(defvar horizontal-scroll-bar-mode)
92(defvar previous-scroll-bar-mode nil) 92(defvar previous-scroll-bar-mode nil)
93(defvar previous-horizontal-scroll-bar-mode nil)
94 93
95(defvar scroll-bar-mode-explicit nil 94(defvar scroll-bar-mode-explicit nil
96 "Non-nil means `set-scroll-bar-mode' should really do something. 95 "Non-nil means `set-scroll-bar-mode' should really do something.
97This is nil while loading `scroll-bar.el', and t afterward.") 96This is nil while loading `scroll-bar.el', and t afterward.")
98 97
99(defvar horizontal-scroll-bar-mode-explicit nil
100 "Non-nil means `set-horizontal-scroll-bar-mode' should really do something.
101This is nil while loading `scroll-bar.el', and t afterward.")
102
103(defun set-scroll-bar-mode (value) 98(defun set-scroll-bar-mode (value)
104 "Set the scroll bar mode to VALUE and put the new value into effect. 99 "Set the scroll bar mode to VALUE and put the new value into effect.
105See the `scroll-bar-mode' variable for possible values to use." 100See the `scroll-bar-mode' variable for possible values to use."
@@ -112,18 +107,6 @@ See the `scroll-bar-mode' variable for possible values to use."
112 (modify-all-frames-parameters (list (cons 'vertical-scroll-bars 107 (modify-all-frames-parameters (list (cons 'vertical-scroll-bars
113 scroll-bar-mode))))) 108 scroll-bar-mode)))))
114 109
115(defun set-horizontal-scroll-bar-mode (value)
116 "Set the horizontal scroll bar mode to VALUE and put the new value into effect.
117See the `horizontal-scroll-bar-mode' variable for possible values to use."
118 (if horizontal-scroll-bar-mode
119 (setq previous-horizontal-scroll-bar-mode horizontal-scroll-bar-mode))
120
121 (setq horizontal-scroll-bar-mode value)
122
123 (when horizontal-scroll-bar-mode-explicit
124 (modify-all-frames-parameters (list (cons 'horizontal-scroll-bars
125 horizontal-scroll-bar-mode)))))
126
127(defcustom scroll-bar-mode default-frame-scroll-bars 110(defcustom scroll-bar-mode default-frame-scroll-bars
128 "Specify whether to have vertical scroll bars, and on which side. 111 "Specify whether to have vertical scroll bars, and on which side.
129Possible values are nil (no scroll bars), `left' (scroll bars on left) 112Possible values are nil (no scroll bars), `left' (scroll bars on left)
@@ -140,32 +123,14 @@ Setting the variable with a customization buffer also takes effect."
140 :initialize 'custom-initialize-default 123 :initialize 'custom-initialize-default
141 :set (lambda (_sym val) (set-scroll-bar-mode val))) 124 :set (lambda (_sym val) (set-scroll-bar-mode val)))
142 125
143(defcustom horizontal-scroll-bar-mode default-frame-horizontal-scroll-bars
144 "Specify whether to have horizontal scroll bars, and on which side.
145To set this variable in a Lisp program, use `set-horizontal-scroll-bar-mode'
146to make it take real effect.
147Setting the variable with a customization buffer also takes effect."
148 :type '(choice (const :tag "none (nil)" nil)
149 (const t))
150 :group 'frames
151 ;; The default value for :initialize would try to use :set
152 ;; when processing the file in cus-dep.el.
153 :initialize 'custom-initialize-default
154 :set (lambda (_sym val) (set-horizontal-scroll-bar-mode val)))
155
156;; We just set scroll-bar-mode, but that was the default. 126;; We just set scroll-bar-mode, but that was the default.
157;; If it is set again, that is for real. 127;; If it is set again, that is for real.
158(setq scroll-bar-mode-explicit t) 128(setq scroll-bar-mode-explicit t)
159(setq horizontal-scroll-bar-mode-explicit t)
160 129
161(defun get-scroll-bar-mode () 130(defun get-scroll-bar-mode ()
162 (declare (gv-setter set-scroll-bar-mode)) 131 (declare (gv-setter set-scroll-bar-mode))
163 scroll-bar-mode) 132 scroll-bar-mode)
164 133
165(defun get-horizontal-scroll-bar-mode ()
166 (declare (gv-setter set-horizontal-scroll-bar-mode))
167 horizontal-scroll-bar-mode)
168
169(define-minor-mode scroll-bar-mode 134(define-minor-mode scroll-bar-mode
170 "Toggle vertical scroll bars on all frames (Scroll Bar mode). 135 "Toggle vertical scroll bars on all frames (Scroll Bar mode).
171With a prefix argument ARG, enable Scroll Bar mode if ARG is 136With a prefix argument ARG, enable Scroll Bar mode if ARG is
@@ -187,10 +152,17 @@ enable the mode if ARG is omitted or nil.
187 152
188This command applies to all frames that exist and frames to be 153This command applies to all frames that exist and frames to be
189created in the future." 154created in the future."
190 :variable ((get-horizontal-scroll-bar-mode) 155 :init-value nil
191 . (lambda (v) (set-horizontal-scroll-bar-mode 156 :global t
192 (if v (or previous-scroll-bar-mode 157 :group 'frames
193 default-frame-horizontal-scroll-bars)))))) 158 (dolist (frame (frame-list))
159 (set-frame-parameter
160 frame 'horizontal-scroll-bars horizontal-scroll-bar-mode))
161 ;; Handle `default-frame-alist' entry.
162 (setq default-frame-alist
163 (cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode)
164 (assq-delete-all 'horizontal-scroll-bars
165 default-frame-alist))))
194 166
195(defun toggle-scroll-bar (arg) 167(defun toggle-scroll-bar (arg)
196 "Toggle whether or not the selected frame has vertical scroll bars. 168 "Toggle whether or not the selected frame has vertical scroll bars.
@@ -209,22 +181,6 @@ when they are turned on; if it is nil, they go on the left."
209 (list (cons 'vertical-scroll-bars 181 (list (cons 'vertical-scroll-bars
210 (if (> arg 0) 182 (if (> arg 0)
211 (or scroll-bar-mode default-frame-scroll-bars)))))) 183 (or scroll-bar-mode default-frame-scroll-bars))))))
212
213(defun toggle-horizontal-scroll-bar (arg)
214 "Toggle whether or not the selected frame has horizontal scroll bars.
215With arg, turn horizontal scroll bars on if and only if arg is positive."
216 (interactive "P")
217 (if (null arg)
218 (setq arg
219 (if (cdr (assq 'horizontal-scroll-bars
220 (frame-parameters (selected-frame))))
221 -1 1))
222 (setq arg (prefix-numeric-value arg)))
223 (modify-frame-parameters
224 (selected-frame)
225 (list (cons 'horizontal-scroll-bars
226 (if (> arg 0)
227 (or horizontal-scroll-bar-mode default-frame-horizontal-scroll-bars))))))
228 184
229;;;; Buffer navigation using the scroll bar. 185;;;; Buffer navigation using the scroll bar.
230 186
@@ -412,6 +368,7 @@ EVENT should be a scroll bar click."
412;;; Tookit scroll bars. 368;;; Tookit scroll bars.
413 369
414(defun scroll-bar-toolkit-scroll (event) 370(defun scroll-bar-toolkit-scroll (event)
371 "Handle event EVENT on vertical scroll bar."
415 (interactive "e") 372 (interactive "e")
416 (let* ((end-position (event-end event)) 373 (let* ((end-position (event-end event))
417 (window (nth 0 end-position)) 374 (window (nth 0 end-position))
@@ -453,6 +410,7 @@ EVENT should be a scroll bar click."
453 (setq point-before-scroll before-scroll)))))) 410 (setq point-before-scroll before-scroll))))))
454 411
455(defun scroll-bar-toolkit-horizontal-scroll (event) 412(defun scroll-bar-toolkit-horizontal-scroll (event)
413 "Handle event EVENT on horizontal scroll bar."
456 (interactive "e") 414 (interactive "e")
457 (let* ((end-position (event-end event)) 415 (let* ((end-position (event-end event))
458 (window (nth 0 end-position)) 416 (window (nth 0 end-position))
diff --git a/src/ChangeLog b/src/ChangeLog
index cfafd9d8fa3..4f189e5be38 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12014-09-03 Martin Rudalics <rudalics@gmx.at>
2
3 * buffer.c (scroll-bar-height): Fix typo in doc-string.
4 * frame.c (Vdefault_frame_horizontal_scroll_bars): Remove
5 variable.
6 * nsfns.m (Fx_create_frame):
7 * w32fns.c (Fx_create_frame):
8 * xfns.c (Fx_create_frame): Default horizontal scroll bars to
9 nil.
10
12014-09-03 Eli Zaretskii <eliz@gnu.org> 112014-09-03 Eli Zaretskii <eliz@gnu.org>
2 12
3 * dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in 13 * dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
diff --git a/src/buffer.c b/src/buffer.c
index 62431cb8fe1..45e614fb449 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5919,7 +5919,7 @@ A value of nil means to use the scroll bar width from the window's frame. */);
5919 DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), 5919 DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height),
5920 Qintegerp, 5920 Qintegerp,
5921 doc: /* Height of this buffer's scroll bars in pixels. 5921 doc: /* Height of this buffer's scroll bars in pixels.
5922A value of nil means to use the scroll bar heiht from the window's frame. */); 5922A value of nil means to use the scroll bar height from the window's frame. */);
5923 5923
5924 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), 5924 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5925 Qvertical_scroll_bar, 5925 Qvertical_scroll_bar,
diff --git a/src/frame.c b/src/frame.c
index 501f01a3122..96617976ecd 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4872,16 +4872,6 @@ Setting this variable does not affect existing frames, only new ones. */);
4872 Vdefault_frame_scroll_bars = Qnil; 4872 Vdefault_frame_scroll_bars = Qnil;
4873#endif 4873#endif
4874 4874
4875 DEFVAR_LISP ("default-frame-horizontal-scroll-bars", Vdefault_frame_horizontal_scroll_bars,
4876 doc: /* Default value for horizontal scroll bars on this window-system. */);
4877#if (defined (HAVE_WINDOW_SYSTEM) \
4878 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
4879 || defined (HAVE_NTGUI)))
4880 Vdefault_frame_horizontal_scroll_bars = Qt;
4881#else
4882 Vdefault_frame_horizontal_scroll_bars = Qnil;
4883#endif
4884
4885 DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion", 4875 DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
4886 scroll_bar_adjust_thumb_portion_p, 4876 scroll_bar_adjust_thumb_portion_p,
4887 doc: /* Adjust thumb for overscrolling for Gtk+ and MOTIF. 4877 doc: /* Adjust thumb for overscrolling for Gtk+ and MOTIF.
diff --git a/src/nsfns.m b/src/nsfns.m
index ca8f4922ccd..052c428fae5 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1244,7 +1244,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1244 "verticalScrollBars", "VerticalScrollBars", 1244 "verticalScrollBars", "VerticalScrollBars",
1245 RES_TYPE_SYMBOL); 1245 RES_TYPE_SYMBOL);
1246 } 1246 }
1247 x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qt, 1247 x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil,
1248 "horizontalScrollBars", "HorizontalScrollBars", 1248 "horizontalScrollBars", "HorizontalScrollBars",
1249 RES_TYPE_SYMBOL); 1249 RES_TYPE_SYMBOL);
1250 x_default_parameter (f, parms, Qforeground_color, build_string ("Black"), 1250 x_default_parameter (f, parms, Qforeground_color, build_string ("Black"),
diff --git a/src/w32fns.c b/src/w32fns.c
index ac0e693e1c0..fee80d24690 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4569,7 +4569,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4569 NULL, NULL, RES_TYPE_NUMBER); 4569 NULL, NULL, RES_TYPE_NUMBER);
4570 x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright, 4570 x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright,
4571 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); 4571 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
4572 x_default_parameter (f, parameters, Qhorizontal_scroll_bars, Qbottom, 4572 x_default_parameter (f, parameters, Qhorizontal_scroll_bars, Qnil,
4573 "horizontalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); 4573 "horizontalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
4574 4574
4575 /* Also do the stuff which must be set before the window exists. */ 4575 /* Also do the stuff which must be set before the window exists. */
diff --git a/src/xfns.c b/src/xfns.c
index 0c07d6cb03d..ec915a69f80 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3112,15 +3112,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3112#endif 3112#endif
3113 "verticalScrollBars", "ScrollBars", 3113 "verticalScrollBars", "ScrollBars",
3114 RES_TYPE_SYMBOL); 3114 RES_TYPE_SYMBOL);
3115 x_default_parameter (f, parms, Qhorizontal_scroll_bars, 3115 x_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil,
3116#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
3117 Qt,
3118#else
3119 Qnil,
3120#endif
3121 "horizontalScrollBars", "ScrollBars", 3116 "horizontalScrollBars", "ScrollBars",
3122 RES_TYPE_SYMBOL); 3117 RES_TYPE_SYMBOL);
3123
3124 /* Also do the stuff which must be set before the window exists. */ 3118 /* Also do the stuff which must be set before the window exists. */
3125 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), 3119 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
3126 "foreground", "Foreground", RES_TYPE_STRING); 3120 "foreground", "Foreground", RES_TYPE_STRING);