annotate lisp/scroll-bar.el @ 18879:8b226efb9a8b

(jka-compr-insert-file-contents): Bind coding-system-for-read. (jka-compr-write-region): Bind coding-system-for-write. Set buffer-file-type if dos or nt. (jka-compr-call-process): Bind coding-system-for-read and coding-system-for-write.
author Richard M. Stallman <rms@gnu.org>
date Sun, 20 Jul 1997 04:50:25 +0000
parents f0c705a82dca
children 86c0d896480e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1981
diff changeset
1 ;;; scroll-bar.el --- window system-independent scroll bar support.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
2
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
4
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
5 ;; Maintainer: FSF
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
6 ;; Keywords: hardware
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
7
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
8 ;; This file is part of GNU Emacs.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
9
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
13 ;; any later version.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
14
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
18 ;; GNU General Public License for more details.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
19
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
20 ;; You should have received a copy of the GNU General Public License
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
23 ;; Boston, MA 02111-1307, USA.
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
24
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
25 ;;; Commentary:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
26
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
27 ;; Window-system-independent bindings of mouse clicks on the scroll bar.
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
28 ;; Presently emulates the scroll-bar behavior of xterm.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12040
diff changeset
29
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
30 ;;; Code:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
31
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1772
diff changeset
32 (require 'mouse)
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1772
diff changeset
33
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
34
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
35 ;;;; Utilities.
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
36
7222
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
37 (defun scroll-bar-event-ratio (event)
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
38 "Given a scroll bar event EVENT, return the scroll bar position as a ratio.
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
39 The value is a cons cell (PORTION . WHOLE) containing two integers
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
40 whose ratio gives the event's vertical position in the scroll bar, with 0
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
41 referring to the top and 1 to the bottom."
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
42 (nth 2 event))
3dae5675cd3e (scroll-bar-event-ratio): New function.
Richard M. Stallman <rms@gnu.org>
parents: 4469
diff changeset
43
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
44 (defun scroll-bar-scale (num-denom whole)
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
45 "Given a pair (NUM . DENOM) and WHOLE, return (/ (* NUM WHOLE) DENOM).
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
46 This is handy for scaling a position on a scroll bar into real units,
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
47 like buffer positions. If SCROLL-BAR-POS is the (PORTION . WHOLE) pair
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
48 from a scroll bar event, then (scroll-bar-scale SCROLL-BAR-POS
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
49 \(buffer-size)) is the position in the current buffer corresponding to
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
50 that scroll bar position."
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
51 ;; We multiply before we divide to maintain precision.
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
52 ;; We use floating point because the product of a large buffer size
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
53 ;; with a large scroll bar portion can easily overflow a lisp int.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
54 (truncate (/ (* (float (car num-denom)) whole) (cdr num-denom))))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
55
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
56
1954
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
57 ;;;; Helpful functions for enabling and disabling scroll bars.
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
58
18480
f0c705a82dca (scroll-bar-mode): Extra defvar to avoid warning.
Richard M. Stallman <rms@gnu.org>
parents: 18479
diff changeset
59 (defvar scroll-bar-mode)
f0c705a82dca (scroll-bar-mode): Extra defvar to avoid warning.
Richard M. Stallman <rms@gnu.org>
parents: 18479
diff changeset
60
18479
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
61 (defun set-scroll-bar-mode (ignore value)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
62 "Set `scroll-bar-mode' to VALUE and put the new value into effect."
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
63 (setq scroll-bar-mode value)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
64
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
65 ;; Apply it to default-frame-alist.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
66 (let ((parameter (assq 'vertical-scroll-bars default-frame-alist)))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
67 (if (consp parameter)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
68 (setcdr parameter scroll-bar-mode)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
69 (setq default-frame-alist
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
70 (cons (cons 'vertical-scroll-bars scroll-bar-mode)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
71 default-frame-alist))))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
72
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
73 ;; Apply it to existing frames.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
74 (let ((frames (frame-list)))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
75 (while frames
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
76 (modify-frame-parameters
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
77 (car frames)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
78 (list (cons 'vertical-scroll-bars scroll-bar-mode)))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
79 (setq frames (cdr frames)))))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
80
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
81 (defcustom scroll-bar-mode 'left
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
82 "*Specify whether to have vertical scroll bars, and on which side.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
83 Possible values are nil (no scroll bars), `left' (scroll bars on left)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
84 and `right' (scroll bars on right).
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
85 When you set the variable in a Lisp program, it takes effect for new frames,
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
86 and for existing frames when `toggle-scroll-bar' is used.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
87 When you set this with the customization buffer,
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
88 it takes effect immediately for all frames."
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
89 :type '(choice (const :tag "none (nil)")
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
90 (const left)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
91 (const right))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
92 :group 'frames
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
93 :set 'set-scroll-bar-mode)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
94
1954
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
95 (defun scroll-bar-mode (flag)
18479
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
96 "Toggle display of vertical scroll bars on all frames.
1954
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
97 This command applies to all frames that exist and frames to be
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
98 created in the future.
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
99 With a numeric argument, if the argument is negative,
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
100 turn off scroll bars; otherwise, turn on scroll bars."
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
101 (interactive "P")
4469
abb585cf9188 (scroll-bar-mode): If FLAG is non-nil, set it to its prefix-numeric-value.
Roland McGrath <roland@gnu.org>
parents: 3613
diff changeset
102 (if flag (setq flag (prefix-numeric-value flag)))
3613
f37a9c897699 * scroll-bar.el (scroll-bar-mode): Variable deleted.
Jim Blandy <jimb@redhat.com>
parents: 3588
diff changeset
103
18479
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
104 ;; Tweedle the variable according to the argument.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
105 (set-scroll-bar-mode nil
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
106 (if (null flag) (not scroll-bar-mode)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
107 (and (or (not (numberp flag)) (>= flag 0))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
108 'left))))
3613
f37a9c897699 * scroll-bar.el (scroll-bar-mode): Variable deleted.
Jim Blandy <jimb@redhat.com>
parents: 3588
diff changeset
109
18479
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
110 (defun toggle-scroll-bar (arg)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
111 "Toggle whether or not the selected frame has vertical scroll bars.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
112 With arg, turn vertical scroll bars on if and only if arg is positive.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
113 The variable `scroll-bar-mode' controls which side the scroll bars are on
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
114 when they are turned on; if it is nil, they go on the left."
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
115 (interactive "P")
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
116 (if (null arg)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
117 (setq arg
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
118 (if (cdr (assq 'vertical-scroll-bars
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
119 (frame-parameters (selected-frame))))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
120 -1 1)))
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
121 (modify-frame-parameters (selected-frame)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
122 (list (cons 'vertical-scroll-bars
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
123 (if (> arg 0)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
124 (or scroll-bar-mode 'left))))))
3613
f37a9c897699 * scroll-bar.el (scroll-bar-mode): Variable deleted.
Jim Blandy <jimb@redhat.com>
parents: 3588
diff changeset
125
18479
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
126 (defun toggle-horizontal-scroll-bar (arg)
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
127 "Toggle whether or not the selected frame has horizontal scroll bars.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
128 With arg, turn horizontal scroll bars on if and only if arg is positive.
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
129 Horizontal scroll bars aren't implemented yet."
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
130 (interactive "P")
dedaafd841c0 (toggle-scroll-bar): Moved from frame.el.
Richard M. Stallman <rms@gnu.org>
parents: 15264
diff changeset
131 (error "Horizontal scroll bars aren't implemented yet"))
1954
059d99d03aae * term/x-win.el (scroll-bar-mode, scroll-bar-mode): Move these
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
132
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
133 ;;;; Buffer navigation using the scroll bar.
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
134
2698
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
135 ;;; This was used for up-events on button 2, but no longer.
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
136 (defun scroll-bar-set-window-start (event)
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
137 "Set the window start according to where the scroll bar is dragged.
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
138 EVENT should be a scroll bar click or drag event."
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
139 (interactive "e")
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1772
diff changeset
140 (let* ((end-position (event-end event))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
141 (window (nth 0 end-position))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
142 (portion-whole (nth 2 end-position)))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
143 (save-excursion
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
144 (set-buffer (window-buffer window))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
145 (save-excursion
3588
9685f1d5545b * scroll-bar.el (scroll-bar-set-window-start): Remember that the
Jim Blandy <jimb@redhat.com>
parents: 3508
diff changeset
146 (goto-char (+ (point-min)
9685f1d5545b * scroll-bar.el (scroll-bar-set-window-start): Remember that the
Jim Blandy <jimb@redhat.com>
parents: 3508
diff changeset
147 (scroll-bar-scale portion-whole
9685f1d5545b * scroll-bar.el (scroll-bar-set-window-start): Remember that the
Jim Blandy <jimb@redhat.com>
parents: 3508
diff changeset
148 (- (point-max) (point-min)))))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
149 (beginning-of-line)
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
150 (set-window-start window (point))))))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
151
15215
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
152 (defun scroll-bar-drag-position (portion-whole)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
153 "Calculate new window start for drag event."
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
154 (save-excursion
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
155 (goto-char (+ (point-min)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
156 (scroll-bar-scale portion-whole
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
157 (- (point-max) (point-min)))))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
158 (beginning-of-line)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
159 (point)))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
160
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
161 (defun scroll-bar-maybe-set-window-start (event)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
162 "Set the window start according to where the scroll bar is dragged.
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
163 Only change window start if the new start is substantially different.
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
164 EVENT should be a scroll bar click or drag event."
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
165 (interactive "e")
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
166 (let* ((end-position (event-end event))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
167 (window (nth 0 end-position))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
168 (portion-whole (nth 2 end-position))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
169 (next-portion-whole (cons (1+ (car portion-whole))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
170 (cdr portion-whole)))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
171 portion-start
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
172 next-portion-start
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
173 (current-start (window-start window)))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
174 (save-excursion
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
175 (set-buffer (window-buffer window))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
176 (setq portion-start (scroll-bar-drag-position portion-whole))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
177 (setq next-portion-start (max
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
178 (scroll-bar-drag-position next-portion-whole)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
179 (1+ portion-start)))
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
180 (if (or (> current-start next-portion-start)
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
181 (< current-start portion-start))
15264
0eb55cad57c6 (scroll-bar-maybe-set-window-start): Always set
Karl Heuer <kwzh@gnu.org>
parents: 15215
diff changeset
182 (set-window-start window portion-start)
0eb55cad57c6 (scroll-bar-maybe-set-window-start): Always set
Karl Heuer <kwzh@gnu.org>
parents: 15215
diff changeset
183 ;; Always set window start, to ensure scroll bar position is updated.
0eb55cad57c6 (scroll-bar-maybe-set-window-start): Always set
Karl Heuer <kwzh@gnu.org>
parents: 15215
diff changeset
184 (set-window-start window current-start)))))
15215
681866822119 (scroll-bar-drag-position): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
185
2698
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
186 ;; Scroll the window to the proper position for EVENT.
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
187 (defun scroll-bar-drag-1 (event)
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
188 (let* ((start-position (event-start event))
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
189 (window (nth 0 start-position))
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
190 (portion-whole (nth 2 start-position)))
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
191 (save-excursion
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
192 (set-buffer (window-buffer window))
3508
dea00c8a47a6 (scroll-bar-drag-1):
Richard M. Stallman <rms@gnu.org>
parents: 3129
diff changeset
193 ;; Calculate position relative to the accessible part of the buffer.
dea00c8a47a6 (scroll-bar-drag-1):
Richard M. Stallman <rms@gnu.org>
parents: 3129
diff changeset
194 (goto-char (+ (point-min)
dea00c8a47a6 (scroll-bar-drag-1):
Richard M. Stallman <rms@gnu.org>
parents: 3129
diff changeset
195 (scroll-bar-scale portion-whole
dea00c8a47a6 (scroll-bar-drag-1):
Richard M. Stallman <rms@gnu.org>
parents: 3129
diff changeset
196 (- (point-max) (point-min)))))
2698
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
197 (beginning-of-line)
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
198 (set-window-start window (point)))))
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
199
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
200 (defun scroll-bar-drag (event)
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
201 "Scroll the window by dragging the scroll bar slider.
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
202 If you click outside the slider, the window scrolls to bring the slider there."
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
203 (interactive "e")
11145
fb77829412af (scroll-bar-drag): Bind echo-keystrokes to 0.
Richard M. Stallman <rms@gnu.org>
parents: 10555
diff changeset
204 (let* (done
fb77829412af (scroll-bar-drag): Bind echo-keystrokes to 0.
Richard M. Stallman <rms@gnu.org>
parents: 10555
diff changeset
205 (echo-keystrokes 0))
10555
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
206 (or point-before-scroll
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
207 (setq point-before-scroll (point)))
12040
e293764039a5 (scroll-bar-drag): Call scroll-bar-drag-1
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
208 ;; Our scrolling can move point; don't let that clear point-before-scroll.
10555
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
209 (let (point-before-scroll)
12040
e293764039a5 (scroll-bar-drag): Call scroll-bar-drag-1
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
210 (scroll-bar-drag-1 event)
10555
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
211 (track-mouse
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
212 (while (not done)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
213 (setq event (read-event))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
214 (if (eq (car-safe event) 'mouse-movement)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
215 (setq event (read-event)))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
216 (cond ((eq (car-safe event) 'scroll-bar-movement)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
217 (scroll-bar-drag-1 event))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
218 (t
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
219 ;; Exit when we get the drag event; ignore that event.
12040
e293764039a5 (scroll-bar-drag): Call scroll-bar-drag-1
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
220 (setq done t)))))
e293764039a5 (scroll-bar-drag): Call scroll-bar-drag-1
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
221 (sit-for 0))))
2698
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
222
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
223 (defun scroll-bar-scroll-down (event)
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
224 "Scroll the window's top line down to the location of the scroll bar click.
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
225 EVENT should be a scroll bar click."
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
226 (interactive "e")
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
227 (let ((old-selected-window (selected-window)))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
228 (unwind-protect
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
229 (progn
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1772
diff changeset
230 (let* ((end-position (event-end event))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
231 (window (nth 0 end-position))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
232 (portion-whole (nth 2 end-position)))
10555
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
233 (let (point-before-scroll)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
234 (select-window window))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
235 (or point-before-scroll
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
236 (setq point-before-scroll (point)))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
237 (let (point-before-scroll)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
238 (scroll-down
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
239 (scroll-bar-scale portion-whole (1- (window-height)))))))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
240 (select-window old-selected-window))))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
241
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
242 (defun scroll-bar-scroll-up (event)
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
243 "Scroll the line next to the scroll bar click to the top of the window.
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
244 EVENT should be a scroll bar click."
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
245 (interactive "e")
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
246 (let ((old-selected-window (selected-window)))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
247 (unwind-protect
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
248 (progn
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1772
diff changeset
249 (let* ((end-position (event-end event))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
250 (window (nth 0 end-position))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
251 (portion-whole (nth 2 end-position)))
10555
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
252 (let (point-before-scroll)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
253 (select-window window))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
254 (or point-before-scroll
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
255 (setq point-before-scroll (point)))
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
256 (let (point-before-scroll)
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
257 (scroll-up
39e925f8beaa (scroll-bar-drag-1): Set point-before-scroll properly.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
258 (scroll-bar-scale portion-whole (1- (window-height)))))))
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
259 (select-window old-selected-window))))
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
260
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
261
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
262 ;;;; Bindings.
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
263
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
264 ;;; For now, we'll set things up to work like xterm.
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
265 (global-set-key [vertical-scroll-bar mouse-1] 'scroll-bar-scroll-up)
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
266 (global-set-key [vertical-scroll-bar drag-mouse-1] 'scroll-bar-scroll-up)
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
267
2698
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
268 (global-set-key [vertical-scroll-bar down-mouse-2] 'scroll-bar-drag)
6940c6b5d988 (scroll-bar-drag, scroll-bar-drag-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
269
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
270 (global-set-key [vertical-scroll-bar mouse-3] 'scroll-bar-scroll-down)
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
271 (global-set-key [vertical-scroll-bar drag-mouse-3] 'scroll-bar-scroll-down)
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
272
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
273
1973
3a08dacd8bfb These are in preparation for a more thorough renaming to occur soon.
Jim Blandy <jimb@redhat.com>
parents: 1954
diff changeset
274 (provide 'scroll-bar)
1772
86f58433c8aa * scrollbar.el: New file.
Jim Blandy <jimb@redhat.com>
parents: 1768
diff changeset
275
1981
bde0ca7e33b3 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1973
diff changeset
276 ;;; scroll-bar.el ends here