annotate lisp/sun-fns.el @ 17247:351006378b51

(Fopen_network_stream): Use same socket for in and out.
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Mar 1997 03:52:53 +0000
parents 83f275dcd93a
children 0c7ab61707c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; sun-fns.el --- subroutines of Mouse handling for Sun windows
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
3 ;; Copyright (C) 1987 Free Software Foundation, Inc.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
5 ;; Author: Jeff Peck <peck@sun.com>
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: hardware
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
7
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; any later version.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
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: 14040
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
23 ;; Boston, MA 02111-1307, USA.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
25 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
26
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
27 ;; Submitted Mar. 1987, Jeff Peck
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
28 ;; Sun Microsystems Inc. <peck@sun.com>
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
29 ;; Conceived Nov. 1986, Stan Jefferson,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
30 ;; Computer Science Lab, SRI International.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
31 ;; GoodIdeas Feb. 1987, Steve Greenbaum
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
32 ;; & UpClicks Reasoning Systems, Inc.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
33 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
34 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
35 ;; Functions for manipulating via the mouse and mouse-map definitions
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
36 ;; for accessing them. Also definitions of mouse menus.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
37 ;; This file you should freely modify to reflect you personal tastes.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
38 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
39 ;; First half of file defines functions to implement mouse commands,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
40 ;; Don't delete any of those, just add what ever else you need.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
41 ;; Second half of file defines mouse bindings, do whatever you want there.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
43 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
44 ;; Mouse Functions.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
45 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
46 ;; These functions follow the sun-mouse-handler convention of being called
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
47 ;; with three arguments: (window x-pos y-pos)
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
48 ;; This makes it easy for a mouse executed command to know where the mouse is.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
49 ;; Use the macro "eval-in-window" to execute a function
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
50 ;; in a temporarily selected window.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
51 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
52 ;; If you have a function that must be called with other arguments
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
53 ;; bind the mouse button to an s-exp that contains the necessary parameters.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
54 ;; See "minibuffer" bindings for examples.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
55 ;;
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
56
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
57 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
58
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
59 (require 'sun-mouse)
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 707
diff changeset
60
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (defconst cursor-pause-milliseconds 300
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 "*Number of milliseconds to display alternate cursor (usually the mark)")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (defun indicate-region (&optional pause)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 "Bounce cursor to mark for cursor-pause-milliseconds and back again"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (or pause (setq pause cursor-pause-milliseconds))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (let ((point (point)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 (goto-char (mark))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (sit-for-millisecs pause)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 ;(update-display)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 ;(sleep-for-millisecs pause)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 (goto-char point)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 ;;; Text buffer operations
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (defun mouse-move-point (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 "Move point to mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (select-window window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (move-to-loc x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (if (memq last-command ; support the mouse-copy/delete/yank
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 '(mouse-copy mouse-delete mouse-yank-move))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (setq this-command 'mouse-yank-move))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (defun mouse-set-mark (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 "Set mark at mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (eval-in-window window ;; use this to get the unwind protect
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (let ((point (point)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (move-to-loc x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (set-mark (point))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (goto-char point)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (indicate-region)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (defun mouse-set-mark-and-select (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 "Set mark at mouse cursor, and select that window."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (select-window window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (mouse-set-mark window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (defun mouse-set-mark-and-stuff (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 "Set mark at mouse cursor, and put region in stuff buffer."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 (mouse-set-mark-and-select w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 (sun-select-region (region-beginning) (region-end)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 ;;; Simple mouse dragging stuff: marking with button up
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (defvar *mouse-drag-window* nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (defvar *mouse-drag-x* -1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (defvar *mouse-drag-y* -1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (defun mouse-drag-move-point (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 "Move point to mouse cursor, and allow dragging."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (mouse-move-point window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (setq *mouse-drag-window* window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 *mouse-drag-x* x
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 *mouse-drag-y* y))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (defun mouse-drag-set-mark-stuff (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 "The up click handler that goes with mouse-drag-move-point.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 If mouse is in same WINDOW but at different X or Y than when
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 mouse-drag-move-point was last executed, set the mark at mouse
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 and put the region in the stuff buffer."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 (if (and (eq *mouse-drag-window* window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (not (and (equal *mouse-drag-x* x)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (equal *mouse-drag-y* y))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (mouse-set-mark-and-stuff window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (setq this-command last-command)) ; this was just an upclick no-op.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (defun mouse-select-or-drag-move-point (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 "Select window if not selected, otherwise do mouse-drag-move-point."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (if (eq (selected-window) window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (mouse-drag-move-point window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (mouse-select-window window x y)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 ;;;
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 841
diff changeset
142 ;;; esoterica:
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 (defun mouse-exch-pt-and-mark (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 "Exchange point and mark."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (select-window window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (exchange-point-and-mark)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (defun mouse-call-kbd-macro (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 "Invokes last keyboard macro at mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (mouse-move-point window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 (call-last-kbd-macro)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (defun mouse-mark-thing (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 "Set point and mark to text object using syntax table.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 The resulting region is put in the sun-window stuff buffer.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 Left or right Paren syntax marks an s-expression.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 Clicking at the end of a line marks the line including a trailing newline.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 If it doesn't recognize one of these it marks the character at point."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 (mouse-move-point window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 (if (eobp) (open-line 1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 (let* ((char (char-after (point)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 (syntax (char-syntax char)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (cond
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 ((eq syntax ?w) ; word.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 (forward-word 1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 (set-mark (point))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 (forward-word -1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 ;; try to include a single following whitespace (is this a good idea?)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 ;; No, not a good idea since inconsistent.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 ;;(if (eq (char-syntax (char-after (mark))) ?\ )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 ;; (set-mark (1+ (mark))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 ((eq syntax ?\( ) ; open paren.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 (mark-sexp 1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 ((eq syntax ?\) ) ; close paren.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (forward-char 1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 (mark-sexp -1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 (exchange-point-and-mark))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 ((eolp) ; mark line if at end.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 (set-mark (1+ (point)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 (beginning-of-line 1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 (t ; mark character
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 (set-mark (1+ (point)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 (indicate-region)) ; display region boundary.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 (sun-select-region (region-beginning) (region-end))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 (defun mouse-kill-thing (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 "Kill thing at mouse, and put point there."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 (mouse-mark-thing window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 (kill-region-and-unmark (region-beginning) (region-end))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 (defun mouse-kill-thing-there (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 "Kill thing at mouse, leave point where it was.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 See mouse-mark-thing for a description of the objects recognized."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (eval-in-window window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (save-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 (mouse-mark-thing window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (kill-region (region-beginning) (region-end))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (defun mouse-save-thing (window x y &optional quiet)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 "Put thing at mouse in kill ring.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 See mouse-mark-thing for a description of the objects recognized."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (mouse-mark-thing window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 (copy-region-as-kill (region-beginning) (region-end))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (if (not quiet) (message "Thing saved"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (defun mouse-save-thing-there (window x y &optional quiet)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 "Put thing at mouse in kill ring, leave point as is.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 See mouse-mark-thing for a description of the objects recognized."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (eval-in-window window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (save-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (mouse-save-thing window x y quiet))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 ;;; Mouse yanking...
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 (defun mouse-copy-thing (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 "Put thing at mouse in kill ring, yank to point.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 See mouse-mark-thing for a description of the objects recognized."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (setq last-command 'not-kill) ;Avoids appending to previous kills.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (mouse-save-thing-there window x y t)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (yank)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (setq this-command 'yank))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (defun mouse-move-thing (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 "Kill thing at mouse, yank it to point.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 See mouse-mark-thing for a description of the objects recognized."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 (setq last-command 'not-kill) ;Avoids appending to previous kills.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (mouse-kill-thing-there window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (yank)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (setq this-command 'yank))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (defun mouse-yank-at-point (&optional window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 "Yank from kill-ring at point; then cycle thru kill ring."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (if (eq last-command 'yank)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (let ((before (< (point) (mark))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 (delete-region (point) (mark))
707
e4253da532fb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 658
diff changeset
244 (insert (current-kill 1))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 (if before (exchange-point-and-mark)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (yank))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (setq this-command 'yank))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 (defun mouse-yank-at-mouse (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 "Yank from kill-ring at mouse; then cycle thru kill ring."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 (mouse-move-point window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 (mouse-yank-at-point window x y))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (defun mouse-save/delete/yank (&optional window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 "Context sensitive save/delete/yank.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 Consecutive clicks perform as follows:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 * first click saves region to kill ring,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 * second click kills region,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 * third click yanks from kill ring,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 * subsequent clicks cycle thru kill ring.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 If mouse-move-point is performed after the first or second click,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 the next click will do a yank, etc. Except for a possible mouse-move-point,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 this command is insensitive to mouse location."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (cond
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 ((memq last-command '(mouse-delete yank mouse-yank-move)) ; third+ click
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (mouse-yank-at-point))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 ((eq last-command 'mouse-copy) ; second click
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (kill-region (region-beginning) (region-end))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 (setq this-command 'mouse-delete))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 (t ; first click
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 (copy-region-as-kill (region-beginning) (region-end))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (message "Region saved")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (setq this-command 'mouse-copy))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 ))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (defun mouse-split-horizontally (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 "Splits the window horizontally at mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 (eval-in-window window (split-window-horizontally (1+ x))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (defun mouse-split-vertically (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 "Split the window vertically at the mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 (eval-in-window window (split-window-vertically (1+ y))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (defun mouse-select-window (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 "Selects the window, restoring point."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 (select-window window))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 (defun mouse-delete-other-windows (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 "Deletes all windows except the one mouse is in."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (delete-other-windows window))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 (defun mouse-delete-window (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 "Deletes the window mouse is in."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (delete-window window))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 (defun mouse-undo (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 "Invokes undo in the window mouse is in."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (eval-in-window window (undo)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 ;;; Scroll operations
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 ;;; The move-to-window-line is used below because otherwise
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 ;;; scrolling a non-selected process window with the mouse, after
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 ;;; the process has written text past the bottom of the window,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 ;;; gives an "End of buffer" error, and then scrolls. The
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 ;;; move-to-window-line seems to force recomputing where things are.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 (defun mouse-scroll-up (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 "Scrolls the window upward."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (eval-in-window window (move-to-window-line 1) (scroll-up nil)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (defun mouse-scroll-down (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 "Scrolls the window downward."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 (eval-in-window window (scroll-down nil)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (defun mouse-scroll-proportional (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 "Scrolls the window proportionally corresponding to window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 relative X divided by window width."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (eval-in-window window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (if (>= x (1- (window-width)))
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 3591
diff changeset
323 ;; When x is maximum (equal to or 1 less than window width),
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 ;; goto end of buffer. We check for this special case
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 841
diff changeset
325 ;; because the calculated goto-char often goes short of the
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 ;; end due to roundoff error, and we often really want to go
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 ;; to the end.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 (goto-char (point-max))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (goto-char (+ (point-min) ; For narrowed regions.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 (* x (/ (- (point-max) (point-min))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 (1- (window-width))))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (beginning-of-line))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (what-cursor-position) ; Report position.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 ))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (defun mouse-line-to-top (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 "Scrolls the line at the mouse cursor up to the top."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (eval-in-window window (scroll-up y)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 (defun mouse-top-to-line (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 "Scrolls the top line down to the mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 (eval-in-window window (scroll-down y)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 (defun mouse-line-to-bottom (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 "Scrolls the line at the mouse cursor to the bottom."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 (eval-in-window window (scroll-up (+ y (- 2 (window-height))))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 (defun mouse-bottom-to-line (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 "Scrolls the bottom line up to the mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 (eval-in-window window (scroll-down (+ y (- 2 (window-height))))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 (defun mouse-line-to-middle (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 "Scrolls the line at the mouse cursor to the middle."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (eval-in-window window (scroll-up (- y -1 (/ (window-height) 2)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (defun mouse-middle-to-line (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 "Scrolls the line at the middle to the mouse cursor."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (eval-in-window window (scroll-up (- (/ (window-height) 2) y 1))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 ;;; main emacs menu.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (defmenu expand-menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 ("Vertically" mouse-expand-vertically *menu-window*)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 ("Horizontally" mouse-expand-horizontally *menu-window*))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (defmenu delete-window-menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 ("This One" delete-window *menu-window*)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 ("All Others" delete-other-windows *menu-window*))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (defmenu mouse-help-menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 ("Text Region"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 mouse-help-region *menu-window* *menu-x* *menu-y* 'text)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 ("Scrollbar"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 mouse-help-region *menu-window* *menu-x* *menu-y* 'scrollbar)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 ("Modeline"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 mouse-help-region *menu-window* *menu-x* *menu-y* 'modeline)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 ("Minibuffer"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 mouse-help-region *menu-window* *menu-x* *menu-y* 'minibuffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 (defmenu emacs-quit-menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 ("Suspend" suspend-emacstool)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 ("Quit" save-buffers-kill-emacs))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 (defmenu emacs-menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 ("Emacs Menu")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 ("Stuff Selection" sun-yank-selection)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 ("Expand" . expand-menu)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 ("Delete Window" . delete-window-menu)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 ("Previous Buffer" mouse-select-previous-buffer *menu-window*)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 ("Save Buffers" save-some-buffers)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 ("List Directory" list-directory nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 ("Dired" dired nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 ("Mouse Help" . mouse-help-menu)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 ("Quit" . emacs-quit-menu))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401 (defun emacs-menu-eval (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 "Pop-up menu of editor commands."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 (sun-menu-evaluate window (1+ x) (1- y) 'emacs-menu))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 (defun mouse-expand-horizontally (window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 (eval-in-window window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407 (enlarge-window 4 t)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (update-display) ; Try to redisplay, since can get confused.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 ))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 (defun mouse-expand-vertically (window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (eval-in-window window (enlarge-window 4)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 (defun mouse-select-previous-buffer (window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 "Switch buffer in mouse window to most recently selected buffer."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 (eval-in-window window (switch-to-buffer (other-buffer))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 ;;; minibuffer menu
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 (defmenu minibuffer-menu
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 841
diff changeset
422 ("Minibuffer" message "Just some miscellaneous minibuffer commands")
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 ("Stuff" sun-yank-selection)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 ("Do-It" exit-minibuffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 ("Abort" abort-recursive-edit)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 ("Suspend" suspend-emacs))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 (defun minibuffer-menu-eval (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 "Pop-up menu of commands."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 (sun-menu-evaluate window x (1- y) 'minibuffer-menu))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 (defun mini-move-point (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 ;; -6 is good for most common cases
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 (mouse-move-point window (- x 6) 0))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (defun mini-set-mark-and-stuff (window x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 ;; -6 is good for most common cases
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 (mouse-set-mark-and-stuff window (- x 6) 0))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 ;;; Buffer-mode Mouse commands
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 (defun Buffer-at-mouse (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 "Calls Buffer-menu-buffer from mouse click."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 (save-window-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 (mouse-move-point w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 (beginning-of-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 (Buffer-menu-buffer t)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 (defun mouse-buffer-bury (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 "Bury the indicated buffer."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454 (bury-buffer (Buffer-at-mouse w x y))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 (defun mouse-buffer-select (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 "Put the indicated buffer in selected window."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 (switch-to-buffer (Buffer-at-mouse w x y))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (list-buffers)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 (defun mouse-buffer-delete (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 "mark indicated buffer for delete"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 (save-window-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 (mouse-move-point w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 (Buffer-menu-delete)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 ))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 (defun mouse-buffer-execute (w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 "execute buffer-menu selections"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (save-window-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 (mouse-move-point w x y)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 (Buffer-menu-execute)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 ))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 (defun enable-mouse-in-buffer-list ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 "Call this to enable mouse selections in *Buffer List*
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 LEFT puts the indicated buffer in the selected window.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 MIDDLE buries the indicated buffer.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 RIGHT marks the indicated buffer for deletion.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482 MIDDLE-RIGHT deletes the marked buffers.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 To unmark a buffer marked for deletion, select it with LEFT."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 (save-window-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 (list-buffers) ; Initialize *Buffer List*
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 (set-buffer "*Buffer List*")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 (local-set-mouse '(text middle) 'mouse-buffer-bury)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 (local-set-mouse '(text left) 'mouse-buffer-select)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 (local-set-mouse '(text right) 'mouse-buffer-delete)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 (local-set-mouse '(text middle right) 'mouse-buffer-execute)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 ;;;*******************************************************************
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 ;;; Global Mouse Bindings.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 ;;; There is some sense to this mouse binding madness:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 ;;; LEFT and RIGHT scrolls are inverses.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 ;;; SHIFT makes an opposite meaning in the scroll bar.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 ;;; SHIFT is an alternative to DOUBLE (but double chords do not exist).
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 ;;; META makes the scrollbar functions work in the text region.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 ;;; MIDDLE operates the mark
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 ;;; LEFT operates at point
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 ;;; META commands are generally non-destructive,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 ;;; SHIFT is a little more dangerous.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 ;;; CONTROL is for the really complicated ones.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511 ;;; CONTROL-META-SHIFT-RIGHT gives help on that region.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514 ;;; Text Region mousemap
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516 ;; The basics: Point, Mark, Menu, Sun-Select:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517 (global-set-mouse '(text left) 'mouse-drag-move-point)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
518 (global-set-mouse '(text up left) 'mouse-drag-set-mark-stuff)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519 (global-set-mouse '(text shift left) 'mouse-exch-pt-and-mark)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520 (global-set-mouse '(text double left) 'mouse-exch-pt-and-mark)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 (global-set-mouse '(text middle) 'mouse-set-mark-and-stuff)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 (global-set-mouse '(text right) 'emacs-menu-eval)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 (global-set-mouse '(text shift right) '(sun-yank-selection))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 (global-set-mouse '(text double right) '(sun-yank-selection))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528 ;; The Slymoblics multi-command for Save, Kill, Copy, Move:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
529 (global-set-mouse '(text shift middle) 'mouse-save/delete/yank)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
530 (global-set-mouse '(text double middle) 'mouse-save/delete/yank)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532 ;; Save, Kill, Copy, Move Things:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 ;; control-left composes with control middle/right to produce copy/move
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534 (global-set-mouse '(text control middle ) 'mouse-save-thing-there)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
535 (global-set-mouse '(text control right ) 'mouse-kill-thing-there)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 (global-set-mouse '(text control left) 'mouse-yank-at-point)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 (global-set-mouse '(text control middle left) 'mouse-copy-thing)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538 (global-set-mouse '(text control right left) 'mouse-move-thing)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 (global-set-mouse '(text control right middle) 'mouse-mark-thing)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541 ;; The Universal mouse help command (press all buttons):
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 (global-set-mouse '(text shift control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
543 (global-set-mouse '(text double control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 ;;; Meta in Text Region is like meta version in scrollbar:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 (global-set-mouse '(text meta left) 'mouse-line-to-top)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547 (global-set-mouse '(text meta shift left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 (global-set-mouse '(text meta double left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 (global-set-mouse '(text meta middle) 'mouse-line-to-middle)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550 (global-set-mouse '(text meta shift middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
551 (global-set-mouse '(text meta double middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552 (global-set-mouse '(text meta control middle) 'mouse-split-vertically)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553 (global-set-mouse '(text meta right) 'mouse-top-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
554 (global-set-mouse '(text meta shift right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 (global-set-mouse '(text meta double right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
556
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 ;; Miscellaneous:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558 (global-set-mouse '(text meta control left) 'mouse-call-kbd-macro)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559 (global-set-mouse '(text meta control right) 'mouse-undo)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562 ;;; Scrollbar mousemap.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 ;;; Are available in the Scrollbar Region, or with Meta Text (or Meta Scrollbar)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 (global-set-mouse '(scrollbar left) 'mouse-line-to-top)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (global-set-mouse '(scrollbar shift left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 (global-set-mouse '(scrollbar double left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 (global-set-mouse '(scrollbar middle) 'mouse-line-to-middle)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 (global-set-mouse '(scrollbar shift middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 (global-set-mouse '(scrollbar double middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 (global-set-mouse '(scrollbar control middle) 'mouse-split-vertically)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 (global-set-mouse '(scrollbar right) 'mouse-top-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (global-set-mouse '(scrollbar shift right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 (global-set-mouse '(scrollbar double right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 (global-set-mouse '(scrollbar meta left) 'mouse-line-to-top)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 (global-set-mouse '(scrollbar meta shift left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 (global-set-mouse '(scrollbar meta double left) 'mouse-line-to-bottom)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581 (global-set-mouse '(scrollbar meta middle) 'mouse-line-to-middle)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 (global-set-mouse '(scrollbar meta shift middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 (global-set-mouse '(scrollbar meta double middle) 'mouse-middle-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 (global-set-mouse '(scrollbar meta control middle) 'mouse-split-vertically)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 (global-set-mouse '(scrollbar meta right) 'mouse-top-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 (global-set-mouse '(scrollbar meta shift right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 (global-set-mouse '(scrollbar meta double right) 'mouse-bottom-to-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 ;; And the help menu:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 (global-set-mouse '(scrollbar shift control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591 (global-set-mouse '(scrollbar double control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594 ;;; Modeline mousemap.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 ;;; Note: meta of any single button selects window.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598 (global-set-mouse '(modeline left) 'mouse-scroll-up)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 (global-set-mouse '(modeline meta left) 'mouse-select-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 (global-set-mouse '(modeline middle) 'mouse-scroll-proportional)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 (global-set-mouse '(modeline meta middle) 'mouse-select-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 (global-set-mouse '(modeline control middle) 'mouse-split-horizontally)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 (global-set-mouse '(modeline right) 'mouse-scroll-down)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 (global-set-mouse '(modeline meta right) 'mouse-select-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 ;;; control-left selects this window, control-right deletes it.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 (global-set-mouse '(modeline control left) 'mouse-delete-other-windows)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 (global-set-mouse '(modeline control right) 'mouse-delete-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612 ;; in case of confusion, just select it:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 (global-set-mouse '(modeline control left right)'mouse-select-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615 ;; even without confusion (and without the keyboard) select it:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 (global-set-mouse '(modeline left right) 'mouse-select-window)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
618 ;; And the help menu:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
619 (global-set-mouse '(modeline shift control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 (global-set-mouse '(modeline double control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
621
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 ;;; Minibuffer Mousemap
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 ;;; Demonstrating some variety:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 (global-set-mouse '(minibuffer left) 'mini-move-point)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 (global-set-mouse '(minibuffer middle) 'mini-set-mark-and-stuff)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630 (global-set-mouse '(minibuffer shift middle) '(select-previous-complex-command))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 (global-set-mouse '(minibuffer double middle) '(select-previous-complex-command))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 (global-set-mouse '(minibuffer control middle) '(next-complex-command 1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 (global-set-mouse '(minibuffer meta middle) '(previous-complex-command 1))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 (global-set-mouse '(minibuffer right) 'minibuffer-menu-eval)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637 (global-set-mouse '(minibuffer shift control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638 (global-set-mouse '(minibuffer double control meta right) 'mouse-help-region)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 35
diff changeset
640 (provide 'sun-fns)
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
641
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
642 ;;; sun-fns.el ends here