Mercurial > emacs
annotate lisp/mouse.el @ 5020:94de08fd8a7c
(Fnext_single_property_change): Fix missing \n\.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Mon, 15 Nov 1993 06:41:45 +0000 |
| parents | 8ed435ca9650 |
| children | 38980ea73075 |
| rev | line source |
|---|---|
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1 ;;; mouse.el --- window system-independent mouse support. |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
758
diff
changeset
|
2 |
|
2070
95996f2ad1c6
(posn-timestamp, posn-col-row, posn-point, posn-window):
Richard M. Stallman <rms@gnu.org>
parents:
1980
diff
changeset
|
3 ;;; Copyright (C) 1993 Free Software Foundation, Inc. |
|
840
113281b361ec
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
791
diff
changeset
|
4 |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
758
diff
changeset
|
5 ;; Maintainer: FSF |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
758
diff
changeset
|
6 ;; Keywords: hardware |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
758
diff
changeset
|
7 |
| 465 | 8 ;;; This file is part of GNU Emacs. |
| 66 | 9 |
| 465 | 10 ;;; GNU Emacs is free software; you can redistribute it and/or modify |
| 11 ;;; it under the terms of the GNU General Public License as published by | |
| 705 | 12 ;;; the Free Software Foundation; either version 2, or (at your option) |
| 465 | 13 ;;; any later version. |
| 66 | 14 |
| 465 | 15 ;;; GNU Emacs is distributed in the hope that it will be useful, |
| 16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 ;;; GNU General Public License for more details. | |
| 66 | 19 |
| 465 | 20 ;;; You should have received a copy of the GNU General Public License |
| 21 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
| 22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 66 | 23 |
|
2308
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
24 ;;; Commentary: |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
25 |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
26 ;; This package provides various useful commands (including help |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
27 ;; system access) through the mouse. All this code assumes that mouse |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
28 ;; interpretation has been abstracted into Emacs input events. |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
29 ;; |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
30 ;; The code is rather X-dependent. |
|
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
31 |
|
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2070
diff
changeset
|
32 ;;; Code: |
|
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2070
diff
changeset
|
33 |
| 465 | 34 ;;; Utility functions. |
| 35 | |
| 36 ;;; Indent track-mouse like progn. | |
| 37 (put 'track-mouse 'lisp-indent-function 0) | |
| 66 | 38 |
| 465 | 39 |
| 40 (defun mouse-delete-window (click) | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
41 "Delete the window you click on. |
| 465 | 42 This must be bound to a mouse click." |
| 1113 | 43 (interactive "e") |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
44 (delete-window (posn-window (event-start click)))) |
| 465 | 45 |
|
1421
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
46 (defun mouse-tear-off-window (click) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
47 "Delete the window clicked on, and create a new frame displaying its buffer." |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
48 (interactive "e") |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
49 (let* ((window (posn-window (event-start click))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
50 (buf (window-buffer window)) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
51 (frame (new-frame))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
52 (select-frame frame) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
53 (switch-to-buffer buf) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
54 (delete-window window))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
55 |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
56 (defun mouse-delete-other-windows () |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
57 "Delete all window except the one you click on." |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
58 (interactive "@") |
| 66 | 59 (delete-other-windows)) |
| 60 | |
| 465 | 61 (defun mouse-split-window-vertically (click) |
| 62 "Select Emacs window mouse is on, then split it vertically in half. | |
| 63 The window is split at the line clicked on. | |
| 64 This command must be bound to a mouse click." | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
65 (interactive "@e") |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
66 (let ((start (event-start click))) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
67 (select-window (posn-window start)) |
|
3712
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
68 (let ((new-height (if (eq (posn-point start) 'vertical-scroll-bar) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
69 (scroll-bar-scale (posn-col-row start) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
70 (1- (window-height))) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
71 (1+ (cdr (posn-col-row (event-end click)))))) |
|
1980
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
72 (first-line window-min-height) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
73 (last-line (- (window-height) window-min-height))) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
74 (if (< last-line first-line) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
75 (error "window too short to split") |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
76 (split-window-vertically |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
77 (min (max new-height first-line) last-line)))))) |
| 66 | 78 |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
79 (defun mouse-split-window-horizontally (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
80 "Select Emacs window mouse is on, then split it horizontally in half. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
81 The window is split at the column clicked on. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
82 This command must be bound to a mouse click." |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
83 (interactive "@e") |
|
1980
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
84 (let ((start (event-start click))) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
85 (select-window (posn-window start)) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
86 (let ((new-width (1+ (car (posn-col-row (event-end click))))) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
87 (first-col window-min-width) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
88 (last-col (- (window-width) window-min-width))) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
89 (if (< last-col first-col) |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
90 (error "window too narrow to split") |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
91 (split-window-horizontally |
|
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
92 (min (max new-width first-col) last-col)))))) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
93 |
|
4554
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
94 (defun mouse-set-point (event) |
| 465 | 95 "Move point to the position clicked on with the mouse. |
|
4554
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
96 This should be bound to a mouse click event type." |
| 1113 | 97 (interactive "e") |
|
4554
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
98 ;; Use event-end in case called from mouse-drag-region. |
|
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
99 ;; If EVENT is a click, event-end and event-start give same value. |
|
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
100 (let ((posn (event-end event))) |
|
4490
8362b57424dc
(mouse-set-point): Error if click in inactive minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
4472
diff
changeset
|
101 (and (window-minibuffer-p (posn-window posn)) |
|
8362b57424dc
(mouse-set-point): Error if click in inactive minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
4472
diff
changeset
|
102 (not (minibuffer-window-active-p (posn-window posn))) |
|
8362b57424dc
(mouse-set-point): Error if click in inactive minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
4472
diff
changeset
|
103 (error "Minibuffer window is not active")) |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
104 (select-window (posn-window posn)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
105 (if (numberp (posn-point posn)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
106 (goto-char (posn-point posn))))) |
| 66 | 107 |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
108 (defun mouse-set-region (click) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
109 "Set the region to the text dragged over, and copy to kill ring. |
|
4554
cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
Richard M. Stallman <rms@gnu.org>
parents:
4532
diff
changeset
|
110 This should be bound to a mouse drag event." |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
111 (interactive "e") |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
112 (let ((posn (event-start click)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
113 (end (event-end click))) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
114 (select-window (posn-window posn)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
115 (if (numberp (posn-point posn)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
116 (goto-char (posn-point posn))) |
|
2799
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
117 ;; If mark is highlighted, no need to bounce the cursor. |
|
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
118 (or (and transient-mark-mode |
|
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
119 (eq (framep (selected-frame)) 'x)) |
|
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
120 (sit-for 1)) |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
121 (push-mark) |
|
2802
02c75b605550
(mouse-set-region): Call set-mark to activate mark.
Richard M. Stallman <rms@gnu.org>
parents:
2799
diff
changeset
|
122 (set-mark (point)) |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
123 (if (numberp (posn-point end)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
124 (goto-char (posn-point end))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
125 ;; Don't set this-command to kill-region, so that a following |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
126 ;; C-w will not double the text in the kill ring. |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
127 (let (this-command) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
128 (copy-region-as-kill (mark) (point))))) |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
129 |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
130 (defvar mouse-scroll-delay 0.25 |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
131 "*The pause between scroll steps caused by mouse drags, in seconds. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
132 If you drag the mouse beyond the edge of a window, Emacs scrolls the |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
133 window to bring the text beyond that edge into view, with a delay of |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
134 this many seconds between scroll steps. Scrolling stops when you move |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
135 the mouse back into the window, or release the button. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
136 This variable's value may be non-integral. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
137 Setting this to zero causes Emacs to scroll as fast as it can.") |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
138 |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
139 (defun mouse-scroll-subr (jump &optional overlay start) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
140 "Scroll the selected window JUMP lines at a time, until new input arrives. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
141 If OVERLAY is an overlay, let it stretch from START to the far edge of |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
142 the newly visible text. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
143 Upon exit, point is at the far edge of the newly visible text." |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
144 (while (progn |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
145 (goto-char (window-start)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
146 (if (not (zerop (vertical-motion jump))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
147 (progn |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
148 (set-window-start (selected-window) (point)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
149 (if (natnump jump) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
150 (progn |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
151 (goto-char (window-end (selected-window))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
152 ;; window-end doesn't reflect the window's new |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
153 ;; start position until the next redisplay. Hurrah. |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
154 (vertical-motion (1- jump))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
155 (goto-char (window-start (selected-window)))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
156 (if overlay |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
157 (move-overlay overlay start (point))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
158 (if (not (eobp)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
159 (sit-for mouse-scroll-delay)))))) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
160 (point)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
161 |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
162 (defvar mouse-drag-overlay (make-overlay 1 1)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
163 (overlay-put mouse-drag-overlay 'face 'region) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
164 |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
165 (defvar mouse-selection-click-count nil) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
166 |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
167 (defun mouse-drag-region (start-event) |
|
2799
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
168 "Set the region to the text that the mouse is dragged over. |
|
4532
c2afed091afb
(mouse-drag-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4490
diff
changeset
|
169 Highlight the drag area as you move the mouse. |
|
c2afed091afb
(mouse-drag-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4490
diff
changeset
|
170 This must be bound to a button-down mouse event. |
|
c2afed091afb
(mouse-drag-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4490
diff
changeset
|
171 In Transient Mark mode, the highlighting remains once you |
|
c2afed091afb
(mouse-drag-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4490
diff
changeset
|
172 release the mouse button. Otherwise, it does not." |
|
3566
dc2b64ef30dc
(mouse-drag-region-1): Un-comment-out this function.
Richard M. Stallman <rms@gnu.org>
parents:
3420
diff
changeset
|
173 (interactive "e") |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
174 (let* ((start-posn (event-start start-event)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
175 (start-point (posn-point start-posn)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
176 (start-window (posn-window start-posn)) |
|
3961
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
177 (start-frame (window-frame start-window)) |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
178 (bounds (window-edges start-window)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
179 (top (nth 1 bounds)) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
180 (bottom (if (window-minibuffer-p start-window) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
181 (nth 3 bounds) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
182 ;; Don't count the mode line. |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
183 (1- (nth 3 bounds)))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
184 (click-count (1- (event-click-count start-event)))) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
185 (setq mouse-selection-click-count click-count) |
|
4490
8362b57424dc
(mouse-set-point): Error if click in inactive minibuffer.
Richard M. Stallman <rms@gnu.org>
parents:
4472
diff
changeset
|
186 (mouse-set-point start-event) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
187 (let ((range (mouse-start-end start-point start-point click-count))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
188 (move-overlay mouse-drag-overlay (car range) (nth 1 range) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
189 (window-buffer start-window))) |
|
4200
3f5f55401364
(mouse-drag-region): Use deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents:
4081
diff
changeset
|
190 (deactivate-mark) |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
191 (let (event end end-point) |
|
3566
dc2b64ef30dc
(mouse-drag-region-1): Un-comment-out this function.
Richard M. Stallman <rms@gnu.org>
parents:
3420
diff
changeset
|
192 (track-mouse |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
193 (while (progn |
|
3961
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
194 (setq event (read-event)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
195 (or (mouse-movement-p event) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
196 (eq (car-safe event) 'switch-frame))) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
197 (if (eq (car-safe event) 'switch-frame) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
198 nil |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
199 (setq end (event-end event) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
200 end-point (posn-point end)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
201 |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
202 (cond |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
203 |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
204 ;; Ignore switch-frame events. |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
205 ((eq (car-safe event) 'switch-frame)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
206 |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
207 ;; Are we moving within the original window? |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
208 ((and (eq (posn-window end) start-window) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
209 (integer-or-marker-p end-point)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
210 (goto-char end-point) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
211 (let ((range (mouse-start-end start-point (point) click-count))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
212 (move-overlay mouse-drag-overlay (car range) (nth 1 range)))) |
|
3961
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
213 |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
214 ;; Are we moving on a different window on the same frame? |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
215 ((and (windowp (posn-window end)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
216 (eq (window-frame (posn-window end)) start-frame)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
217 (let ((mouse-row |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
218 (+ (nth 1 (window-edges (posn-window end))) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
219 (cdr (posn-col-row end))))) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
220 (cond |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
221 ((< mouse-row top) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
222 (mouse-scroll-subr |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
223 (- mouse-row top) mouse-drag-overlay start-point)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
224 ((and (not (eobp)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
225 (>= mouse-row bottom)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
226 (mouse-scroll-subr (1+ (- mouse-row bottom)) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
227 mouse-drag-overlay start-point))))) |
|
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
228 |
|
4577
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
229 (t |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
230 (let ((mouse-y (cdr (cdr (mouse-position)))) |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
231 (menu-bar-lines (or (cdr (assq 'menu-bar-lines |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
232 (frame-parameters))) |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
233 0))) |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
234 |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
235 ;; Are we on the menu bar? |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
236 (and (integerp mouse-y) (< mouse-y menu-bar-lines) |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
237 (mouse-scroll-subr (- mouse-y menu-bar-lines) |
|
c071de572565
(mouse-drag-region): Mouse in menu bar means scroll up.
Richard M. Stallman <rms@gnu.org>
parents:
4563
diff
changeset
|
238 mouse-drag-overlay start-point)))))))) |
|
3961
e828d5f28ca2
* mouse.el (mouse-drag-region): Correctly handle drags which enter
Jim Blandy <jimb@redhat.com>
parents:
3928
diff
changeset
|
239 |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
240 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
241 (eq (posn-window (event-end event)) start-window) |
|
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
242 (numberp (posn-point (event-end event)))) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
243 (let ((fun (key-binding (vector (car event))))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
244 (if (memq fun '(mouse-set-region mouse-set-point)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
245 (if (not (= (overlay-start mouse-drag-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
246 (overlay-end mouse-drag-overlay))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
247 (let (this-command) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
248 (push-mark (overlay-start mouse-drag-overlay) t t) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
249 (goto-char (overlay-end mouse-drag-overlay)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
250 (copy-region-as-kill (point) (mark t))) |
|
4906
e3f09fe7f08f
(mouse-drag-region): Set this-command to mouse-set-point
Richard M. Stallman <rms@gnu.org>
parents:
4788
diff
changeset
|
251 (goto-char (overlay-end mouse-drag-overlay)) |
|
e3f09fe7f08f
(mouse-drag-region): Set this-command to mouse-set-point
Richard M. Stallman <rms@gnu.org>
parents:
4788
diff
changeset
|
252 (setq this-command 'mouse-set-point)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
253 (if (fboundp fun) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
254 (funcall fun event))))) |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
255 (delete-overlay mouse-drag-overlay)))) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
256 |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
257 ;; Commands to handle xterm-style multiple clicks. |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
258 |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
259 (defun mouse-skip-word (dir) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
260 "Skip over word, over whitespace, or over identical punctuation. |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
261 If DIR is positive skip forward; if negative, skip backward." |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
262 (let* ((char (following-char)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
263 (syntax (char-to-string (char-syntax char)))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
264 (if (or (string= syntax "w") (string= syntax " ")) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
265 (if (< dir 0) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
266 (skip-syntax-backward syntax) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
267 (skip-syntax-forward syntax)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
268 (if (< dir 0) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
269 (while (and (not (bobp)) (= (preceding-char) char)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
270 (forward-char -1)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
271 (while (and (not (eobp)) (= (following-char) char)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
272 (forward-char 1)))))) |
|
3928
c5f9d7f928a7
* mouse.el (mouse-drag-region-1): Commented out.
Jim Blandy <jimb@redhat.com>
parents:
3899
diff
changeset
|
273 |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
274 ;; Return a list of region bounds based on START and END according to MODE. |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
275 ;; If MODE is 0 then set point to (min START END), mark to (max START END). |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
276 ;; If MODE is 1 then set point to start of word at (min START END), |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
277 ;; mark to end of word at (max START END). |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
278 ;; If MODE is 2 then do the same for lines. |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
279 (defun mouse-start-end (start end mode) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
280 (if (> start end) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
281 (let ((temp start)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
282 (setq start end |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
283 end temp))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
284 (cond ((= mode 0) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
285 (list start end)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
286 ((and (= mode 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
287 (= start end) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
288 (not (eobp)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
289 (= (char-syntax (char-after start)) ?\()) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
290 (list start (save-excursion (forward-sexp 1) (point)))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
291 ((and (= mode 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
292 (= start end) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
293 (not (eobp)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
294 (= (char-syntax (char-after start)) ?\))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
295 (list (save-excursion |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
296 (goto-char (1+ start)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
297 (backward-sexp 1) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
298 (point)) |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
299 (1+ start))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
300 ((= mode 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
301 (list (save-excursion |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
302 (goto-char start) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
303 (mouse-skip-word -1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
304 (point)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
305 (save-excursion |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
306 (goto-char end) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
307 (mouse-skip-word 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
308 (point)))) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
309 ((= mode 2) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
310 (list (save-excursion |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
311 (goto-char start) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
312 (beginning-of-line 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
313 (point)) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
314 (save-excursion |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
315 (goto-char end) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
316 (forward-line 1) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
317 (point)))))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
318 |
|
3712
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
319 ;; Subroutine: set the mark where CLICK happened, |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
320 ;; but don't do anything else. |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
321 (defun mouse-set-mark-fast (click) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
322 (let ((posn (event-start click))) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
323 (select-window (posn-window posn)) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
324 (if (numberp (posn-point posn)) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
325 (push-mark (posn-point posn) t t)))) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
326 |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
327 ;; Momentarily show where the mark is, if highlighting doesn't show it. |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
328 (defun mouse-show-mark () |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
329 (or transient-mark-mode |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
330 (save-excursion |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
331 (goto-char (mark t)) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
332 (sit-for 1)))) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
333 |
| 465 | 334 (defun mouse-set-mark (click) |
| 335 "Set mark at the position clicked on with the mouse. | |
| 336 Display cursor at that position for a second. | |
| 337 This must be bound to a mouse click." | |
| 1113 | 338 (interactive "e") |
| 66 | 339 (let ((point-save (point))) |
| 340 (unwind-protect | |
| 465 | 341 (progn (mouse-set-point click) |
|
3119
0d4886af9262
(mouse-set-mark): Activate the mark.
Richard M. Stallman <rms@gnu.org>
parents:
2802
diff
changeset
|
342 (push-mark nil t t) |
|
0d4886af9262
(mouse-set-mark): Activate the mark.
Richard M. Stallman <rms@gnu.org>
parents:
2802
diff
changeset
|
343 (or transient-mark-mode |
|
0d4886af9262
(mouse-set-mark): Activate the mark.
Richard M. Stallman <rms@gnu.org>
parents:
2802
diff
changeset
|
344 (sit-for 1))) |
| 66 | 345 (goto-char point-save)))) |
| 346 | |
| 465 | 347 (defun mouse-kill (click) |
| 348 "Kill the region between point and the mouse click. | |
| 349 The text is saved in the kill ring, as with \\[kill-region]." | |
| 1113 | 350 (interactive "e") |
|
1765
1cc3ee5afc82
(mouse-save-then-kill): When deleting, avoid delay
Richard M. Stallman <rms@gnu.org>
parents:
1728
diff
changeset
|
351 (let ((click-posn (posn-point (event-start click)))) |
| 1039 | 352 (if (numberp click-posn) |
| 353 (kill-region (min (point) click-posn) | |
| 354 (max (point) click-posn))))) | |
| 66 | 355 |
| 705 | 356 (defun mouse-yank-at-click (click arg) |
| 357 "Insert the last stretch of killed text at the position clicked on. | |
| 358 Prefix arguments are interpreted as with \\[yank]." | |
| 1113 | 359 (interactive "e\nP") |
| 705 | 360 (mouse-set-point click) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
361 (setq this-command 'yank) |
| 705 | 362 (yank arg)) |
| 363 | |
| 364 (defun mouse-kill-ring-save (click) | |
| 465 | 365 "Copy the region between point and the mouse click in the kill ring. |
| 366 This does not delete the region; it acts like \\[kill-ring-save]." | |
| 1113 | 367 (interactive "e") |
|
3712
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
368 (mouse-set-mark-fast click) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
369 (kill-ring-save (point) (mark t)) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
370 (mouse-show-mark)) |
| 66 | 371 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
372 ;;; This function used to delete the text between point and the mouse |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
373 ;;; whenever it was equal to the front of the kill ring, but some |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
374 ;;; people found that confusing. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
375 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
376 ;;; A list (TEXT START END), describing the text and position of the last |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
377 ;;; invocation of mouse-save-then-kill. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
378 (defvar mouse-save-then-kill-posn nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
379 |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
380 (defun mouse-save-then-kill-delete-region (beg end) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
381 ;; Delete just one char, so in case buffer is being modified |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
382 ;; for the first time, the undo list records that fact. |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
383 (delete-region beg |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
384 (+ beg (if (> end beg) 1 -1))) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
385 (let ((buffer-undo-list buffer-undo-list)) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
386 ;; Undo that deletion--but don't change the undo list! |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
387 (primitive-undo 1 buffer-undo-list) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
388 ;; Now delete the rest of the specified region, |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
389 ;; but don't record it. |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
390 (setq buffer-undo-list t) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
391 (delete-region beg end)) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
392 (if (not (eq buffer-undo-list t)) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
393 (let ((tail buffer-undo-list)) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
394 ;; Search back in buffer-undo-list for the string |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
395 ;; that came from the first delete-region. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
396 (while (and tail (not (stringp (car (car tail))))) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
397 (setq tail (cdr tail))) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
398 ;; Replace it with an entry for the entire deleted text. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
399 (and tail |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
400 (setcar tail (cons (car kill-ring) (min beg end))))))) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
401 |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
402 (defun mouse-save-then-kill (click) |
|
1765
1cc3ee5afc82
(mouse-save-then-kill): When deleting, avoid delay
Richard M. Stallman <rms@gnu.org>
parents:
1728
diff
changeset
|
403 "Save text to point in kill ring; the second time, kill the text. |
|
1cc3ee5afc82
(mouse-save-then-kill): When deleting, avoid delay
Richard M. Stallman <rms@gnu.org>
parents:
1728
diff
changeset
|
404 If the text between point and the mouse is the same as what's |
|
1cc3ee5afc82
(mouse-save-then-kill): When deleting, avoid delay
Richard M. Stallman <rms@gnu.org>
parents:
1728
diff
changeset
|
405 at the front of the kill ring, this deletes the text. |
|
1cc3ee5afc82
(mouse-save-then-kill): When deleting, avoid delay
Richard M. Stallman <rms@gnu.org>
parents:
1728
diff
changeset
|
406 Otherwise, it adds the text to the kill ring, like \\[kill-ring-save], |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
407 which prepares for a second click to delete the text. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
408 |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
409 If you have selected words or lines, this command extends the |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
410 selection through the word or line clicked on. If you do this |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
411 again in a different position, it extends the selection again. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
412 If you do this twice in the same position, the selection is killed." |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
413 (interactive "e") |
|
3712
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
414 (let ((click-posn (posn-point (event-start click))) |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
415 ;; Don't let a subsequent kill command append to this one: |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
416 ;; prevent setting this-command to kill-region. |
|
9e0f49a8f967
(mouse-set-mark-fast): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3566
diff
changeset
|
417 (this-command this-command)) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
418 (if (> mouse-selection-click-count 0) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
419 (if (not (and (eq last-command 'mouse-save-then-kill) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
420 (equal click-posn |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
421 (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
422 ;; Find both ends of the object selected by this click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
423 (let* ((range |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
424 (mouse-start-end click-posn click-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
425 mouse-selection-click-count))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
426 ;; Move whichever end is closer to the click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
427 ;; That's what xterm does, and it seems reasonable. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
428 (if (< (abs (- click-posn (mark t))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
429 (abs (- click-posn (point)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
430 (set-mark (car range)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
431 (goto-char (nth 1 range))) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
432 ;; We have already put the old region in the kill ring. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
433 ;; Replace it with the extended region. |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
434 ;; (It would be annoying to make a separate entry.) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
435 (setcar kill-ring (buffer-substring (point) (mark t))) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
436 (if interprogram-cut-function |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
437 (funcall interprogram-cut-function (car kill-ring))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
438 ;; Arrange for a repeated mouse-3 to kill this region. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
439 (setq mouse-save-then-kill-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
440 (list (car kill-ring) (point) click-posn)) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
441 (mouse-show-mark)) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
442 ;; If we click this button again without moving it, |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
443 ;; that time kill. |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
444 (mouse-save-then-kill-delete-region (point) (mark))) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
445 (if (and (eq last-command 'mouse-save-then-kill) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
446 mouse-save-then-kill-posn |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
447 (eq (car mouse-save-then-kill-posn) (car kill-ring)) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
448 (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn))) |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
449 ;; If this is the second time we've called |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
450 ;; mouse-save-then-kill, delete the text from the buffer. |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
451 (mouse-save-then-kill-delete-region (point) (mark)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
452 (if (or (eq last-command 'mouse-save-then-kill) |
|
4906
e3f09fe7f08f
(mouse-drag-region): Set this-command to mouse-set-point
Richard M. Stallman <rms@gnu.org>
parents:
4788
diff
changeset
|
453 (and mark-active transient-mark-mode) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
454 (and (eq last-command 'mouse-drag-region) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
455 (or mark-even-if-inactive |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
456 (not transient-mark-mode)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
457 ;; We have a selection or suitable region, so adjust it. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
458 (let* ((posn (event-start click)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
459 (new (posn-point posn))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
460 (select-window (posn-window posn)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
461 (if (numberp new) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
462 (progn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
463 ;; Move whichever end of the region is closer to the click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
464 ;; That is what xterm does, and it seems reasonable. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
465 (if (< (abs (- new (point))) (abs (- new (mark t)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
466 (goto-char new) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
467 (set-mark new)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
468 (setq deactivate-mark nil))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
469 (setcar kill-ring (buffer-substring (point) (mark t))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
470 (if interprogram-cut-function |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
471 (funcall interprogram-cut-function (car kill-ring)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
472 ;; We just have point, so set mark here. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
473 (mouse-set-mark-fast click) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
474 (kill-ring-save (point) (mark t)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
475 (mouse-show-mark)) |
|
4751
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
476 (setq mouse-save-then-kill-posn |
|
c63ce262aa4d
(mouse-save-then-kill): If follows a multi-click selection,
Richard M. Stallman <rms@gnu.org>
parents:
4738
diff
changeset
|
477 (list (car kill-ring) (point) click-posn)))))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
478 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
479 (global-set-key [M-mouse-1] 'mouse-start-secondary) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
480 (global-set-key [M-drag-mouse-1] 'mouse-set-secondary) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
481 (global-set-key [M-down-mouse-1] 'mouse-drag-secondary) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
482 (global-set-key [M-mouse-3] 'mouse-secondary-save-then-kill) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
483 (global-set-key [M-mouse-2] 'mouse-kill-secondary) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
484 |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
485 ;; An overlay which records the current secondary selection |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
486 ;; or else is deleted when there is no secondary selection. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
487 ;; May be nil. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
488 (defvar mouse-secondary-overlay nil) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
489 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
490 ;; A marker which records the specified first end for a secondary selection. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
491 ;; May be nil. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
492 (defvar mouse-secondary-start nil) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
493 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
494 (defun mouse-start-secondary (click) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
495 "Set one end of the secondary selection to the position clicked on. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
496 Use \\[mouse-secondary-save-then-kill] to set the other end |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
497 and complete the secondary selection." |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
498 (interactive "e") |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
499 (let ((posn (event-start click))) |
|
3823
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
500 (save-excursion |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
501 (set-buffer (window-buffer (posn-window posn))) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
502 ;; Cancel any preexisting secondary selection. |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
503 (if mouse-secondary-overlay |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
504 (delete-overlay mouse-secondary-overlay)) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
505 (if (numberp (posn-point posn)) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
506 (progn |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
507 (or mouse-secondary-start |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
508 (setq mouse-secondary-start (make-marker))) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
509 (move-marker mouse-secondary-start (posn-point posn))))))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
510 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
511 (defun mouse-set-secondary (click) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
512 "Set the secondary selection to the text that the mouse is dragged over. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
513 This must be bound to a mouse drag event." |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
514 (interactive "e") |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
515 (let ((posn (event-start click)) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
516 beg |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
517 (end (event-end click))) |
|
3823
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
518 (save-excursion |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
519 (set-buffer (window-buffer (posn-window posn))) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
520 (if (numberp (posn-point posn)) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
521 (setq beg (posn-point posn))) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
522 (if mouse-secondary-overlay |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
523 (move-overlay mouse-secondary-overlay beg (posn-point end)) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
524 (setq mouse-secondary-overlay (make-overlay beg (posn-point end)))) |
|
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
525 (overlay-put mouse-secondary-overlay 'face 'secondary-selection)))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
526 |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
527 (defun mouse-drag-secondary (start-event) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
528 "Set the secondary selection to the text that the mouse is dragged over. |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
529 Highlight the drag area as you move the mouse. |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
530 This must be bound to a button-down mouse event." |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
531 (interactive "e") |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
532 (let* ((start-posn (event-start start-event)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
533 (start-point (posn-point start-posn)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
534 (start-window (posn-window start-posn)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
535 (start-frame (window-frame start-window)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
536 (bounds (window-edges start-window)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
537 (top (nth 1 bounds)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
538 (bottom (if (window-minibuffer-p start-window) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
539 (nth 3 bounds) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
540 ;; Don't count the mode line. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
541 (1- (nth 3 bounds)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
542 (click-count (1- (event-click-count start-event)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
543 (save-excursion |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
544 (set-buffer (window-buffer start-window)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
545 (setq mouse-selection-click-count click-count) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
546 (or mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
547 (setq mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
548 (make-overlay (point) (point)))) |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
549 (overlay-put mouse-secondary-overlay 'face 'secondary-selection) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
550 (if (> click-count 0) |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
551 ;; Double or triple press: make an initial selection |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
552 ;; of one word or line. |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
553 (let ((range (mouse-start-end start-point start-point click-count))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
554 (set-marker mouse-secondary-start nil) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
555 (move-overlay mouse-secondary-overlay 1 1 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
556 (window-buffer start-window)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
557 (move-overlay mouse-secondary-overlay (car range) (nth 1 range) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
558 (window-buffer start-window))) |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
559 ;; Single-press: cancel any preexisting secondary selection. |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
560 (or mouse-secondary-start |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
561 (setq mouse-secondary-start (make-marker))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
562 (set-marker mouse-secondary-start start-point) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
563 (delete-overlay mouse-secondary-overlay)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
564 (let (event end end-point) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
565 (track-mouse |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
566 (while (progn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
567 (setq event (read-event)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
568 (or (mouse-movement-p event) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
569 (eq (car-safe event) 'switch-frame))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
570 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
571 (if (eq (car-safe event) 'switch-frame) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
572 nil |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
573 (setq end (event-end event) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
574 end-point (posn-point end)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
575 (cond |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
576 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
577 ;; Ignore switch-frame events. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
578 ((eq (car-safe event) 'switch-frame)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
579 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
580 ;; Are we moving within the original window? |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
581 ((and (eq (posn-window end) start-window) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
582 (integer-or-marker-p end-point)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
583 (if (/= start-point end-point) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
584 (set-marker mouse-secondary-start nil)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
585 (let ((range (mouse-start-end start-point end-point |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
586 click-count))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
587 (move-overlay mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
588 (car range) (nth 1 range)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
589 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
590 ;; Are we moving on a different window on the same frame? |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
591 ((and (windowp (posn-window end)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
592 (eq (window-frame (posn-window end)) start-frame)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
593 (let ((mouse-row |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
594 (+ (nth 1 (window-edges (posn-window end))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
595 (cdr (posn-col-row end))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
596 (cond |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
597 ((< mouse-row top) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
598 (mouse-scroll-subr |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
599 (- mouse-row top) mouse-secondary-overlay start-point)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
600 ((and (not (eobp)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
601 (>= mouse-row bottom)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
602 (mouse-scroll-subr (1+ (- mouse-row bottom)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
603 mouse-drag-overlay start-point))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
604 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
605 (t |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
606 (let ((mouse-y (cdr (cdr (mouse-position)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
607 (menu-bar-lines (or (cdr (assq 'menu-bar-lines |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
608 (frame-parameters))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
609 0))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
610 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
611 ;; Are we on the menu bar? |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
612 (and (integerp mouse-y) (< mouse-y menu-bar-lines) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
613 (mouse-scroll-subr (- mouse-y menu-bar-lines) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
614 mouse-secondary-overlay start-point)))))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
615 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
616 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
617 (eq (posn-window (event-end event)) start-window) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
618 (numberp (posn-point (event-end event)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
619 (if (marker-position mouse-secondary-start) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
620 (save-window-excursion |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
621 (delete-overlay mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
622 (select-window start-window) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
623 (save-excursion |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
624 (goto-char mouse-secondary-start) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
625 (sit-for 1))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
626 (kill-ring-save (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
627 (overlay-end mouse-secondary-overlay)))))))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
628 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
629 (defun mouse-kill-secondary () |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
630 "Kill the text in the secondary selection." |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
631 (interactive "*") |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
632 (kill-region (overlay-start mouse-secondary-overlay) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
633 (overlay-end mouse-secondary-overlay)) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
634 (delete-overlay mouse-secondary-overlay) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
635 (setq mouse-secondary-overlay nil)) |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
636 |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
637 (defun mouse-secondary-save-then-kill (click) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
638 "Save text to point in kill ring; the second time, kill the text. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
639 If the text between point and the mouse is the same as what's |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
640 at the front of the kill ring, this deletes the text. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
641 Otherwise, it adds the text to the kill ring, like \\[kill-ring-save], |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
642 which prepares for a second click to delete the text. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
643 |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
644 If you have selected words or lines, this command extends the |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
645 selection through the word or line clicked on. If you do this |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
646 again in a different position, it extends the selection again. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
647 If you do this twice in the same position, the selection is killed." |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
648 (interactive "e") |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
649 (let ((posn (event-start click)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
650 (click-posn (posn-point (event-start click))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
651 ;; Don't let a subsequent kill command append to this one: |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
652 ;; prevent setting this-command to kill-region. |
|
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
653 (this-command this-command)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
654 (if (> mouse-selection-click-count 0) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
655 (if (not (and (eq last-command 'mouse-secondary-save-then-kill) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
656 (equal click-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
657 (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
658 ;; Find both ends of the object selected by this click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
659 (let* ((range |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
660 (mouse-start-end click-posn click-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
661 mouse-selection-click-count))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
662 ;; Move whichever end is closer to the click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
663 ;; That's what xterm does, and it seems reasonable. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
664 (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
665 (abs (- click-posn (overlay-end mouse-secondary-overlay)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
666 (move-overlay mouse-secondary-overlay (car range) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
667 (overlay-end mouse-secondary-overlay)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
668 (move-overlay mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
669 (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
670 (nth 1 range))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
671 ;; We have already put the old region in the kill ring. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
672 ;; Replace it with the extended region. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
673 ;; (It would be annoying to make a separate entry.) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
674 (setcar kill-ring (buffer-substring |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
675 (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
676 (overlay-end mouse-secondary-overlay))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
677 (if interprogram-cut-function |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
678 (funcall interprogram-cut-function (car kill-ring))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
679 ;; Arrange for a repeated mouse-3 to kill this region. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
680 (setq mouse-save-then-kill-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
681 (list (car kill-ring) (point) click-posn))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
682 ;; If we click this button again without moving it, |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
683 ;; that time kill. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
684 (progn |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
685 (mouse-save-then-kill-delete-region |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
686 (overlay-start mouse-secondary-overlay) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
687 (overlay-end mouse-secondary-overlay)) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
688 (delete-overlay mouse-secondary-overlay))) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
689 (if (and (eq last-command 'mouse-secondary-save-then-kill) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
690 mouse-save-then-kill-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
691 (eq (car mouse-save-then-kill-posn) (car kill-ring)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
692 (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
693 ;; If this is the second time we've called |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
694 ;; mouse-secondary-save-then-kill, delete the text from the buffer. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
695 (progn |
|
5007
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
696 (mouse-save-then-kill-delete-region |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
697 (overlay-start mouse-secondary-overlay) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
698 (overlay-end mouse-secondary-overlay)) |
|
8ed435ca9650
(mouse-save-then-kill-delete-region): Take args BEG and END.
Richard M. Stallman <rms@gnu.org>
parents:
4906
diff
changeset
|
699 (delete-overlay mouse-secondary-overlay)) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
700 (if (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
701 ;; We have a selection, so adjust it. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
702 (progn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
703 (select-window (posn-window posn)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
704 (if (numberp click-posn) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
705 (progn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
706 ;; Move whichever end of the region is closer to the click. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
707 ;; That is what xterm does, and it seems reasonable. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
708 (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
709 (abs (- click-posn (overlay-end mouse-secondary-overlay)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
710 (move-overlay mouse-secondary-overlay click-posn |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
711 (overlay-end mouse-secondary-overlay)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
712 (move-overlay mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
713 (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
714 click-posn)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
715 (setq deactivate-mark nil))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
716 (setcar kill-ring (buffer-substring |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
717 (overlay-start mouse-secondary-overlay) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
718 (overlay-end mouse-secondary-overlay))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
719 (if interprogram-cut-function |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
720 (funcall interprogram-cut-function (car kill-ring)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
721 (if mouse-secondary-start |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
722 ;; All we have is one end of a selection, |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
723 ;; so put the other end here. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
724 (let ((start (+ 0 mouse-secondary-start))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
725 (set-buffer (window-buffer (posn-window (event-start click)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
726 (kill-ring-save start click-posn) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
727 (if mouse-secondary-overlay |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
728 (move-overlay mouse-secondary-overlay start click-posn) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
729 (setq mouse-secondary-overlay (make-overlay start click-posn))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
730 (overlay-put mouse-secondary-overlay 'face 'secondary-selection)))) |
|
3823
7747dabf897f
(mouse-secondary-save-then-kill): Don't switch windows.
Richard M. Stallman <rms@gnu.org>
parents:
3808
diff
changeset
|
731 (setq mouse-save-then-kill-posn |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
732 (list (car kill-ring) (point) click-posn)))))) |
|
3808
d852157f581a
(mouse-start-secondary): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3712
diff
changeset
|
733 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
734 (defun mouse-buffer-menu (event) |
|
1728
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
735 "Pop up a menu of buffers for selection with the mouse. |
|
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
736 This switches buffers in the window that you clicked on, |
|
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
737 and selects that window." |
| 1113 | 738 (interactive "e") |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
739 (let ((menu |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
740 (list "Buffer Menu" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
741 (cons "Select Buffer" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
742 (let ((tail (buffer-list)) |
|
3899
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
743 (maxbuf 0) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
744 head) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
745 (while tail |
|
3899
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
746 (or (eq ?\ (aref (buffer-name (car tail)) 0)) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
747 (setq maxbuf |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
748 (max maxbuf |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
749 (length (buffer-name (car tail)))))) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
750 (setq tail (cdr tail))) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
751 (setq tail (buffer-list)) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
752 (while tail |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
753 (let ((elt (car tail))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
754 (if (not (string-match "^ " |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
755 (buffer-name elt))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
756 (setq head (cons |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
757 (cons |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
758 (format |
|
3899
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
759 (format "%%%ds %%s%%s %%s" |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
760 maxbuf) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
761 (buffer-name elt) |
|
3899
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
762 (if (buffer-modified-p elt) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
763 "*" " ") |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
764 (save-excursion |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
765 (set-buffer elt) |
|
a0655a72182b
(mouse-buffer-menu): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3823
diff
changeset
|
766 (if buffer-read-only "%" " ")) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
767 (or (buffer-file-name elt) "")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
768 elt) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
769 head)))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
770 (setq tail (cdr tail))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
771 (reverse head)))))) |
|
1728
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
772 (let ((buf (x-popup-menu event menu)) |
|
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
773 (window (posn-window (event-start event)))) |
|
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
774 (if buf |
|
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
775 (progn |
|
3420
08adfe96ca93
(mouse-buffer-menu): Don't select the event's window,
Richard M. Stallman <rms@gnu.org>
parents:
3231
diff
changeset
|
776 (or (framep window) (select-window window)) |
|
1728
2a49d509b30d
(mouse-buffer-menu): Select the window clicked on.
Richard M. Stallman <rms@gnu.org>
parents:
1421
diff
changeset
|
777 (switch-to-buffer buf)))))) |
| 66 | 778 |
|
1980
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
779 ;;; These need to be rewritten for the new scroll bar implementation. |
| 66 | 780 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
781 ;;;!! ;; Commands for the scroll bar. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
782 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
783 ;;;!! (defun mouse-scroll-down (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
784 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
785 ;;;!! (scroll-down (1+ (cdr (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
786 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
787 ;;;!! (defun mouse-scroll-up (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
788 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
789 ;;;!! (scroll-up (1+ (cdr (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
790 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
791 ;;;!! (defun mouse-scroll-down-full () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
792 ;;;!! (interactive "@") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
793 ;;;!! (scroll-down nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
794 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
795 ;;;!! (defun mouse-scroll-up-full () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
796 ;;;!! (interactive "@") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
797 ;;;!! (scroll-up nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
798 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
799 ;;;!! (defun mouse-scroll-move-cursor (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
800 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
801 ;;;!! (move-to-window-line (1+ (cdr (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
802 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
803 ;;;!! (defun mouse-scroll-absolute (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
804 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
805 ;;;!! (let* ((pos (car event)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
806 ;;;!! (position (car pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
807 ;;;!! (length (car (cdr pos)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
808 ;;;!! (if (<= length 0) (setq length 1)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
809 ;;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
810 ;;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
811 ;;;!! position) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
812 ;;;!! length) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
813 ;;;!! scale-factor))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
814 ;;;!! (goto-char newpos) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
815 ;;;!! (recenter '(4))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
816 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
817 ;;;!! (defun mouse-scroll-left (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
818 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
819 ;;;!! (scroll-left (1+ (car (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
820 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
821 ;;;!! (defun mouse-scroll-right (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
822 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
823 ;;;!! (scroll-right (1+ (car (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
824 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
825 ;;;!! (defun mouse-scroll-left-full () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
826 ;;;!! (interactive "@") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
827 ;;;!! (scroll-left nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
828 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
829 ;;;!! (defun mouse-scroll-right-full () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
830 ;;;!! (interactive "@") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
831 ;;;!! (scroll-right nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
832 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
833 ;;;!! (defun mouse-scroll-move-cursor-horizontally (click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
834 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
835 ;;;!! (move-to-column (1+ (car (mouse-coords click))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
836 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
837 ;;;!! (defun mouse-scroll-absolute-horizontally (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
838 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
839 ;;;!! (let* ((pos (car event)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
840 ;;;!! (position (car pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
841 ;;;!! (length (car (cdr pos)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
842 ;;;!! (set-window-hscroll (selected-window) 33))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
843 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
844 ;;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
845 ;;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
846 ;;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
847 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
848 ;;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
849 ;;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
850 ;;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
851 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
852 ;;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
853 ;;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
854 ;;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
855 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
856 ;;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
857 ;;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
858 ;;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
859 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
860 ;;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
861 ;;;!! (global-set-key [horizontal-scroll-bar mouse-2] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
862 ;;;!! 'mouse-scroll-absolute-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
863 ;;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
864 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
865 ;;;!! (global-set-key [horizontal-slider mouse-1] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
866 ;;;!! 'mouse-scroll-move-cursor-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
867 ;;;!! (global-set-key [horizontal-slider mouse-2] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
868 ;;;!! 'mouse-scroll-move-cursor-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
869 ;;;!! (global-set-key [horizontal-slider mouse-3] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
870 ;;;!! 'mouse-scroll-move-cursor-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
871 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
872 ;;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
873 ;;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
874 ;;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
875 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
876 ;;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
877 ;;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
878 ;;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
879 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
880 ;;;!! (global-set-key [horizontal-scroll-bar S-mouse-2] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
881 ;;;!! 'mouse-split-window-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
882 ;;;!! (global-set-key [mode-line S-mouse-2] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
883 ;;;!! 'mouse-split-window-horizontally) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
884 ;;;!! (global-set-key [vertical-scroll-bar S-mouse-2] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
885 ;;;!! 'mouse-split-window) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
886 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
887 ;;;!! ;;;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
888 ;;;!! ;;;; Here are experimental things being tested. Mouse events |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
889 ;;;!! ;;;; are of the form: |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
890 ;;;!! ;;;; ((x y) window screen-part key-sequence timestamp) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
891 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
892 ;;;!! ;;;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
893 ;;;!! ;;;; Dynamically track mouse coordinates |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
894 ;;;!! ;;;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
895 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
896 ;;;!! ;;(defun track-mouse (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
897 ;;;!! ;; "Track the coordinates, absolute and relative, of the mouse." |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
898 ;;;!! ;; (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
899 ;;;!! ;; (while mouse-grabbed |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
900 ;;;!! ;; (let* ((pos (read-mouse-position (selected-screen))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
901 ;;;!! ;; (abs-x (car pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
902 ;;;!! ;; (abs-y (cdr pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
903 ;;;!! ;; (relative-coordinate (coordinates-in-window-p |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
904 ;;;!! ;; (list (car pos) (cdr pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
905 ;;;!! ;; (selected-window)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
906 ;;;!! ;; (if (consp relative-coordinate) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
907 ;;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
908 ;;;!! ;; (car relative-coordinate) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
909 ;;;!! ;; (car (cdr relative-coordinate))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
910 ;;;!! ;; (message "mouse: [%d %d]" abs-x abs-y))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
911 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
912 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
913 ;;;!! ;; Dynamically put a box around the line indicated by point |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
914 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
915 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
916 ;;;!! ;;(require 'backquote) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
917 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
918 ;;;!! ;;(defun mouse-select-buffer-line (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
919 ;;;!! ;; (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
920 ;;;!! ;; (let ((relative-coordinate |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
921 ;;;!! ;; (coordinates-in-window-p (car event) (selected-window))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
922 ;;;!! ;; (abs-y (car (cdr (car event))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
923 ;;;!! ;; (if (consp relative-coordinate) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
924 ;;;!! ;; (progn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
925 ;;;!! ;; (save-excursion |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
926 ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
927 ;;;!! ;; (x-draw-rectangle |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
928 ;;;!! ;; (selected-screen) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
929 ;;;!! ;; abs-y 0 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
930 ;;;!! ;; (save-excursion |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
931 ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
932 ;;;!! ;; (end-of-line) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
933 ;;;!! ;; (push-mark nil t) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
934 ;;;!! ;; (beginning-of-line) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
935 ;;;!! ;; (- (region-end) (region-beginning))) 1)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
936 ;;;!! ;; (sit-for 1) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
937 ;;;!! ;; (x-erase-rectangle (selected-screen)))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
938 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
939 ;;;!! ;;(defvar last-line-drawn nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
940 ;;;!! ;;(defvar begin-delim "[^ \t]") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
941 ;;;!! ;;(defvar end-delim "[^ \t]") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
942 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
943 ;;;!! ;;(defun mouse-boxing (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
944 ;;;!! ;; (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
945 ;;;!! ;; (save-excursion |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
946 ;;;!! ;; (let ((screen (selected-screen))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
947 ;;;!! ;; (while (= (x-mouse-events) 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
948 ;;;!! ;; (let* ((pos (read-mouse-position screen)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
949 ;;;!! ;; (abs-x (car pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
950 ;;;!! ;; (abs-y (cdr pos)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
951 ;;;!! ;; (relative-coordinate |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
952 ;;;!! ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
953 ;;;!! ;; (selected-window))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
954 ;;;!! ;; (begin-reg nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
955 ;;;!! ;; (end-reg nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
956 ;;;!! ;; (end-column nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
957 ;;;!! ;; (begin-column nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
958 ;;;!! ;; (if (and (consp relative-coordinate) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
959 ;;;!! ;; (or (not last-line-drawn) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
960 ;;;!! ;; (not (= last-line-drawn abs-y)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
961 ;;;!! ;; (progn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
962 ;;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
963 ;;;!! ;; (if (= (following-char) 10) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
964 ;;;!! ;; () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
965 ;;;!! ;; (progn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
966 ;;;!! ;; (setq begin-reg (1- (re-search-forward end-delim))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
967 ;;;!! ;; (setq begin-column (1- (current-column))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
968 ;;;!! ;; (end-of-line) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
969 ;;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
970 ;;;!! ;; (setq end-column (1+ (current-column))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
971 ;;;!! ;; (message "%s" (buffer-substring begin-reg end-reg)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
972 ;;;!! ;; (x-draw-rectangle screen |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
973 ;;;!! ;; (setq last-line-drawn abs-y) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
974 ;;;!! ;; begin-column |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
975 ;;;!! ;; (- end-column begin-column) 1)))))))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
976 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
977 ;;;!! ;;(defun mouse-erase-box () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
978 ;;;!! ;; (interactive) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
979 ;;;!! ;; (if last-line-drawn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
980 ;;;!! ;; (progn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
981 ;;;!! ;; (x-erase-rectangle (selected-screen)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
982 ;;;!! ;; (setq last-line-drawn nil)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
983 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
984 ;;;!! ;;; (defun test-x-rectangle () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
985 ;;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
986 ;;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
987 ;;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
988 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
989 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
990 ;;;!! ;; Here is how to do double clicking in lisp. About to change. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
991 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
992 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
993 ;;;!! (defvar double-start nil) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
994 ;;;!! (defconst double-click-interval 300 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
995 ;;;!! "Max ticks between clicks") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
996 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
997 ;;;!! (defun double-down (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
998 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
999 ;;;!! (if double-start |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1000 ;;;!! (let ((interval (- (nth 4 event) double-start))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1001 ;;;!! (if (< interval double-click-interval) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1002 ;;;!! (progn |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1003 ;;;!! (backward-up-list 1) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1004 ;;;!! ;; (message "Interval %d" interval) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1005 ;;;!! (sleep-for 1))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1006 ;;;!! (setq double-start nil)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1007 ;;;!! (setq double-start (nth 4 event)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1008 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1009 ;;;!! (defun double-up (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1010 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1011 ;;;!! (and double-start |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1012 ;;;!! (> (- (nth 4 event ) double-start) double-click-interval) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1013 ;;;!! (setq double-start nil))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1014 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1015 ;;;!! ;;; (defun x-test-doubleclick () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1016 ;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1017 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1018 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1019 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1020 ;;;!! ;; |
|
1980
263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1021 ;;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1022 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1023 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1024 ;;;!! (defvar scrolled-lines 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1025 ;;;!! (defconst scroll-speed 1) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1026 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1027 ;;;!! (defun incr-scroll-down (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1028 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1029 ;;;!! (setq scrolled-lines 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1030 ;;;!! (incremental-scroll scroll-speed)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1031 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1032 ;;;!! (defun incr-scroll-up (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1033 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1034 ;;;!! (setq scrolled-lines 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1035 ;;;!! (incremental-scroll (- scroll-speed))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1036 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1037 ;;;!! (defun incremental-scroll (n) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1038 ;;;!! (while (= (x-mouse-events) 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1039 ;;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1040 ;;;!! (scroll-down n) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1041 ;;;!! (sit-for 300 t))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1042 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1043 ;;;!! (defun incr-scroll-stop (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1044 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1045 ;;;!! (message "Scrolled %d lines" scrolled-lines) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1046 ;;;!! (setq scrolled-lines 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1047 ;;;!! (sleep-for 1)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1048 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1049 ;;;!! ;;; (defun x-testing-scroll () |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1050 ;;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1051 ;;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1052 ;;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1053 ;;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1054 ;;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1055 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1056 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1057 ;;;!! ;; Some playthings suitable for picture mode? They need work. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1058 ;;;!! ;; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1059 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1060 ;;;!! (defun mouse-kill-rectangle (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1061 ;;;!! "Kill the rectangle between point and the mouse cursor." |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1062 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1063 ;;;!! (let ((point-save (point))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1064 ;;;!! (save-excursion |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1065 ;;;!! (mouse-set-point event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1066 ;;;!! (push-mark nil t) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1067 ;;;!! (if (> point-save (point)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1068 ;;;!! (kill-rectangle (point) point-save) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1069 ;;;!! (kill-rectangle point-save (point)))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1070 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1071 ;;;!! (defun mouse-open-rectangle (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1072 ;;;!! "Kill the rectangle between point and the mouse cursor." |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1073 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1074 ;;;!! (let ((point-save (point))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1075 ;;;!! (save-excursion |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1076 ;;;!! (mouse-set-point event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1077 ;;;!! (push-mark nil t) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1078 ;;;!! (if (> point-save (point)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1079 ;;;!! (open-rectangle (point) point-save) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1080 ;;;!! (open-rectangle point-save (point)))))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1081 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1082 ;;;!! ;; Must be a better way to do this. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1083 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1084 ;;;!! (defun mouse-multiple-insert (n char) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1085 ;;;!! (while (> n 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1086 ;;;!! (insert char) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1087 ;;;!! (setq n (1- n)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1088 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1089 ;;;!! ;; What this could do is not finalize until button was released. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1090 ;;;!! |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1091 ;;;!! (defun mouse-move-text (event) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1092 ;;;!! "Move text from point to cursor position, inserting spaces." |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1093 ;;;!! (interactive "@e") |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1094 ;;;!! (let* ((relative-coordinate |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1095 ;;;!! (coordinates-in-window-p (car event) (selected-window)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1096 ;;;!! (if (consp relative-coordinate) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1097 ;;;!! (cond ((> (current-column) (car relative-coordinate)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1098 ;;;!! (delete-char |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1099 ;;;!! (- (car relative-coordinate) (current-column)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1100 ;;;!! ((< (current-column) (car relative-coordinate)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1101 ;;;!! (mouse-multiple-insert |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1102 ;;;!! (- (car relative-coordinate) (current-column)) " ")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1103 ;;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1104 |
|
4081
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1105 ;; Choose a completion with the mouse. |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1106 |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1107 ;; Delete the longest partial match for STRING |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1108 ;; that can be found before POINT. |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1109 (defun mouse-delete-max-match (string) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1110 (let ((len (min (length string) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1111 (- (point-max) (point-min))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1112 (goto-char (max (point-min) (- (point) (length string)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1113 (while (and (> len 0) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1114 (let ((tail (buffer-substring (point) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1115 (+ (point) len)))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1116 (not (string= tail (substring string 0 len))))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1117 (setq len (1- len)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1118 (forward-char 1)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1119 (delete-char len))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1120 |
|
4081
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1121 (defun mouse-choose-completion (event) |
|
4371
fb0e37e7afae
(mouse-choose-completion): Actually choose that alternative,
Richard M. Stallman <rms@gnu.org>
parents:
4294
diff
changeset
|
1122 "Click on an alternative in the `*Completions*' buffer to choose it." |
|
4081
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1123 (interactive "e") |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1124 (let ((buffer (window-buffer)) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1125 choice) |
|
4081
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1126 (save-excursion |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1127 (set-buffer (window-buffer (posn-window (event-start event)))) |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1128 (save-excursion |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1129 (goto-char (posn-point (event-start event))) |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1130 (skip-chars-backward "^ \t\n") |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1131 (let ((beg (point))) |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1132 (skip-chars-forward "^ \t\n") |
|
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1133 (setq choice (buffer-substring beg (point)))))) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1134 (set-buffer buffer) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1135 (mouse-delete-max-match choice) |
|
4592
168bcc1aeea3
(mouse-choose-completion): Really go to minibuffer; no save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
4577
diff
changeset
|
1136 (insert choice) |
|
4788
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1137 (and (equal buffer (window-buffer (minibuffer-window))) |
|
3182c0f7ace4
(mouse-delete-max-match): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4751
diff
changeset
|
1138 (minibuffer-complete-and-exit)))) |
|
4081
da352b92ca90
(mouse-choose-completion): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3961
diff
changeset
|
1139 |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1140 ;; Font selection. |
| 465 | 1141 |
|
4294
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1142 (defun font-menu-add-default () |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1143 (let* ((default (cdr (assq 'font (frame-parameters (selected-frame))))) |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1144 (font-alist x-fixed-font-alist) |
|
4563
b9118969ce28
(font-menu-add-default): Use list, not cons, for new elt.
Richard M. Stallman <rms@gnu.org>
parents:
4562
diff
changeset
|
1145 (elt (or (assoc "Misc" font-alist) (nth 1 font-alist)))) |
|
4294
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1146 (if (assoc "Default" elt) |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1147 (delete (assoc "Default" elt) elt)) |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1148 (setcdr elt |
|
4562
477fbf60722b
(font-menu-add-default): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
4554
diff
changeset
|
1149 (cons (list "Default" |
|
4294
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1150 (cdr (assq 'font (frame-parameters (selected-frame))))) |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1151 (cdr elt))))) |
|
644e33e3ab38
(font-menu-add-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4274
diff
changeset
|
1152 |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1153 (defvar x-fixed-font-alist |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1154 '("Font menu" |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1155 ("Misc" |
|
4274
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1156 ("6x10" "-misc-fixed-medium-r-semicondensed--10-110-75-75-c-60-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1157 ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1158 ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1159 ("lucida 13" |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1160 "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1161 ("7x13" "-misc-fixed-medium-r-normal--13-120-75-75-c-70-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1162 ("7x14" "-misc-fixed-medium-r-normal--14-130-75-75-c-70-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1163 ("9x15" "-misc-fixed-medium-r-normal--15-140-*-*-c-*-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1164 ("") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1165 ("clean 8x8" "-schumacher-clean-medium-r-normal--*-80-*-*-c-*-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1166 ("clean 8x14" "-schumacher-clean-medium-r-normal--*-140-*-*-c-*-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1167 ("clean 8x10" "-schumacher-clean-medium-r-normal--*-100-*-*-c-*-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1168 ("clean 8x16" "-schumacher-clean-medium-r-normal--*-160-*-*-c-*-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1169 ("") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1170 ("sony 8x16" "-sony-fixed-medium-r-normal--16-120-100-100-c-80-*-1") |
|
6e46ab2ea271
(x-fixed-font-alist): Give some fonts long patterns.
Richard M. Stallman <rms@gnu.org>
parents:
4221
diff
changeset
|
1171 ("") |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1172 ("fixed" "fixed") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1173 ("10x20" "10x20") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1174 ("11x18" "11x18") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1175 ("12x24" "12x24")) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1176 ;;; We don't seem to have these; who knows what they are. |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1177 ;;; ("fg-18" "fg-18") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1178 ;;; ("fg-25" "fg-25") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1179 ;;; ("lucidasanstypewriter-12" "lucidasanstypewriter-12") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1180 ;;; ("lucidasanstypewriter-bold-14" "lucidasanstypewriter-bold-14") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1181 ;;; ("lucidasanstypewriter-bold-24" "lucidasanstypewriter-bold-24") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1182 ;;; ("lucidatypewriter-bold-r-24" "-b&h-lucidatypewriter-bold-r-normal-sans-24-240-75-75-m-140-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1183 ;;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1184 ("Courier" |
|
3231
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1185 ("8" "-adobe-courier-medium-r-normal--*-80-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1186 ("10" "-adobe-courier-medium-r-normal--*-100-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1187 ("12" "-adobe-courier-medium-r-normal--*-120-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1188 ("14" "-adobe-courier-medium-r-normal--*-140-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1189 ("18" "-adobe-courier-medium-r-normal--*-180-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1190 ("24" "-adobe-courier-medium-r-normal--*-240-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1191 ("8 bold" "-adobe-courier-bold-r-normal--*-80-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1192 ("10 bold" "-adobe-courier-bold-r-normal--*-100-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1193 ("12 bold" "-adobe-courier-bold-r-normal--*-120-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1194 ("14 bold" "-adobe-courier-bold-r-normal--*-140-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1195 ("18 bold" "-adobe-courier-bold-r-normal--*-180-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1196 ("24 bold" "-adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1197 ("8 slant" "-adobe-courier-medium-o-normal--*-80-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1198 ("10 slant" "-adobe-courier-medium-o-normal--*-100-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1199 ("12 slant" "-adobe-courier-medium-o-normal--*-120-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1200 ("14 slant" "-adobe-courier-medium-o-normal--*-140-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1201 ("18 slant" "-adobe-courier-medium-o-normal--*-180-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1202 ("24 slant" "-adobe-courier-medium-o-normal--*-240-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1203 ("8 bold slant" "-adobe-courier-bold-o-normal--*-80-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1204 ("10 bold slant" "-adobe-courier-bold-o-normal--*-100-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1205 ("12 bold slant" "-adobe-courier-bold-o-normal--*-120-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1206 ("14 bold slant" "-adobe-courier-bold-o-normal--*-140-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1207 ("18 bold slant" "-adobe-courier-bold-o-normal--*-180-*-*-m-*-iso8859-1") |
|
fb322590dda0
(x-fixed-font-alist): Specify field 7, not field 6.
Richard M. Stallman <rms@gnu.org>
parents:
3119
diff
changeset
|
1208 ("24 bold slant" "-adobe-courier-bold-o-normal--*-240-*-*-m-*-iso8859-1")) |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1209 ) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1210 "X fonts suitable for use in Emacs.") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1211 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1212 (defun mouse-set-font (&optional font) |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1213 "Select an emacs font from a list of known good fonts" |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1214 (interactive |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1215 (x-popup-menu last-nonmenu-event x-fixed-font-alist)) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1216 (if font |
|
4220
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1217 (progn (modify-frame-parameters (selected-frame) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1218 (list (cons 'font font))) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1219 ;; Update some standard faces too. |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1220 (set-face-font 'bold nil (selected-frame)) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1221 (make-face-bold 'bold (selected-frame) t) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1222 (set-face-font 'italic nil (selected-frame)) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1223 (make-face-italic 'italic (selected-frame) t) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1224 (set-face-font 'bold-italic nil (selected-frame)) |
|
c89f55065260
(mouse-set-font): Update faces bold, italic and bold-italic.
Richard M. Stallman <rms@gnu.org>
parents:
4200
diff
changeset
|
1225 (make-face-bold-italic 'bold-italic (selected-frame) t)))) |
| 465 | 1226 |
| 1227 ;;; Bindings for mouse commands. | |
| 1228 | |
|
2799
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
1229 (define-key global-map [down-mouse-1] 'mouse-drag-region) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1230 (global-set-key [mouse-1] 'mouse-set-point) |
|
2799
93a5aef19835
(mouse-drag-region): New command, on down-mouse-1.
Richard M. Stallman <rms@gnu.org>
parents:
2632
diff
changeset
|
1231 (global-set-key [drag-mouse-1] 'mouse-set-region) |
|
1057
d9775f33488d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1056
diff
changeset
|
1232 |
|
4738
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
1233 ;; These are tested for in mouse-drag-region. |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
1234 (global-set-key [double-mouse-1] 'mouse-set-point) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
1235 (global-set-key [triple-mouse-1] 'mouse-set-point) |
|
76a2ea569de5
(mouse-set-region): Put region in kill ring.
Richard M. Stallman <rms@gnu.org>
parents:
4592
diff
changeset
|
1236 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1237 (global-set-key [mouse-2] 'mouse-yank-at-click) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1238 (global-set-key [mouse-3] 'mouse-save-then-kill) |
| 705 | 1239 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1240 ;; By binding these to down-going events, we let the user use the up-going |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1241 ;; event to make the selection, saving a click. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1242 (global-set-key [C-down-mouse-1] 'mouse-buffer-menu) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1243 (global-set-key [C-down-mouse-3] 'mouse-set-font) |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
1244 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1245 ;; Replaced with dragging mouse-1 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1246 ;; (global-set-key [S-mouse-1] 'mouse-set-mark) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
1247 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1248 (global-set-key [mode-line mouse-1] 'mouse-delete-other-windows) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1249 (global-set-key [mode-line mouse-3] 'mouse-delete-window) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1250 (global-set-key [mode-line S-mouse-2] 'mouse-split-window-horizontally) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1251 |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
1252 ;; Define the mouse help menu tree. |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
1253 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1254 (defvar help-menu-map '(keymap "Help")) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1255 (global-set-key [C-down-mouse-2] help-menu-map) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1256 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1257 (defvar help-apropos-map (make-sparse-keymap "Is there a command that...")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1258 (defvar help-keys-map (make-sparse-keymap "Key Commands <==> Functions")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1259 (defvar help-manual-map (make-sparse-keymap "Manual and tutorial")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1260 (defvar help-misc-map (make-sparse-keymap "Odds and ends")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1261 (defvar help-modes-map (make-sparse-keymap "Modes")) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1765
diff
changeset
|
1262 (defvar help-admin-map (make-sparse-keymap "Administrivia")) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1263 |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1264 (define-key help-menu-map [apropos] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1265 (cons "@Is there a command that..." help-apropos-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1266 (define-key help-menu-map [keys] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1267 (cons "@Key Commands <==> Functions" help-keys-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1268 (define-key help-menu-map [manuals] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1269 (cons "@Manual and tutorial" help-manual-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1270 (define-key help-menu-map [misc] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1271 (cons "@Odds and ends" help-misc-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1272 (define-key help-menu-map [modes] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1273 (cons "@Modes" help-modes-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
1274 (define-key help-menu-map [admin] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
1275 (cons "@Administrivia" help-admin-map)) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1276 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1277 (define-key help-apropos-map "c" '("Command Apropos" . command-apropos)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1278 (define-key help-apropos-map "a" '("Apropos" . apropos)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1279 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1280 (define-key help-keys-map "b" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1281 '("List all keystroke commands" . describe-bindings)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1282 (define-key help-keys-map "c" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1283 '("Describe key briefly" . describe-key-briefly)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1284 (define-key help-keys-map "k" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1285 '("Describe key verbose" . describe-key)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1286 (define-key help-keys-map "f" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1287 '("Describe Lisp function" . describe-function)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1288 (define-key help-keys-map "w" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1289 '("Where is this command" . where-is)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1290 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1291 (define-key help-manual-map "i" '("Info system" . info)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1292 (define-key help-manual-map "t" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1293 '("Invoke Emacs tutorial" . help-with-tutorial)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1294 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1295 (define-key help-misc-map "l" '("Last 100 Keystrokes" . view-lossage)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1296 (define-key help-misc-map "s" '("Describe syntax table" . describe-syntax)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1297 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1298 (define-key help-modes-map "m" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1299 '("Describe current major mode" . describe-mode)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1300 (define-key help-modes-map "b" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1301 '("List all keystroke commands" . describe-bindings)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1302 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1303 (define-key help-admin-map "n" |
|
4463
2a1f8e922ec8
(help-admin-map): Fix menu item text.
Richard M. Stallman <rms@gnu.org>
parents:
4449
diff
changeset
|
1304 '("View Emacs news" . view-emacs-news)) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1305 (define-key help-admin-map "l" |
|
4463
2a1f8e922ec8
(help-admin-map): Fix menu item text.
Richard M. Stallman <rms@gnu.org>
parents:
4449
diff
changeset
|
1306 '("View Emacs copying conditions" . describe-copying)) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1307 (define-key help-admin-map "d" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1308 '("Describe distribution" . describe-distribution)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1309 (define-key help-admin-map "w" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
1310 '("Describe (non)warranty" . describe-no-warranty)) |
| 584 | 1311 |
| 1312 (provide 'mouse) | |
| 1313 | |
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1314 ;;; mouse.el ends here |
