Mercurial > hg > xemacs
annotate shared/motion4.el @ 45:65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
acquired use-text-not-html from mail-extras
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Wed, 20 Dec 2023 17:59:49 +0000 |
parents | 107d592c5f4a |
children |
rev | line source |
---|---|
0
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
1 ;;; Copyright (C) 1991 Christopher J. Love |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
2 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
3 ;;; This file is for use with Epoch, a modified version of GNU Emacs. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
4 ;;; Requires Epoch 4.0 or later. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
5 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
6 ;;; This code is distributed in the hope that it will be useful, |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
7 ;;; bute WITHOUT ANY WARRANTY. No author or distributor accepts |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
8 ;;; responsibility to anyone for the consequences of using this code |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
9 ;;; or for whether it serves any particular purpose or works at all, |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
10 ;;; unless explicitly stated in a written agreement. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
11 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
12 ;;; Everyone is granted permission to copy, modify and redistribute |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
13 ;;; this code, but only under the conditions described in the |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
14 ;;; GNU Emacs General Public License, except the original author nor his |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
15 ;;; agents are bound by the License in their use of this code. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
16 ;;; (These special rights for the author in no way restrict the rights of |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
17 ;;; others given in the License or this prologue) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
18 ;;; A copy of this license is supposed to have been given to you along |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
19 ;;; with Epoch so you can know your rights and responsibilities. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
20 ;;; It should be in a file named COPYING. Among other things, the |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
21 ;;; copyright notice and this notice must be preserved on all copies. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
22 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
23 ;;; $Revision: 1.2 $ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
24 ;;; $Source: /home/user5/ht/emacs/shared/RCS/motion4.el,v $ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
25 ;;; $Date: 1992/03/18 21:44:10 $ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
26 ;;; $Author: ht $ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
27 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
28 ;;; motion.el - provide draggin/hi-lighting of primary selection |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
29 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
30 ;;; Original version by Alan Carroll |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
31 ;;; Epoch 4.0 modifications by Chris Love |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
32 ;;; Abort-isearch and other ideas from Ken Laprade and others. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
33 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
34 (provide 'motion) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
35 (redisplay-screen) ; fix epoch4.0a race bug? |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
36 (require 'zone) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
37 (require 'mouse) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
38 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
39 ;;; ------------------------------------------------------------------------ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
40 ;;; Interface values |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
41 (defvar horizontal-drag-inc 5 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
42 "Number of columns to scroll when the pointer is to the left or right of the window") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
43 (defvar vertical-drag-inc 2 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
44 "Number of lines to scroll when the pointer is above or below the edge of the window") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
45 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
46 (defvar mouse::downp nil "State variable for mouse dragging internals") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
47 (defvar mouse::last-point -1 "Last location of a motion event") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
48 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
49 (setq epoch::zones-modify-buffer nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
50 (defvar motion::style nil "style used by drag zones") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
51 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
52 (defvar drag-zone nil |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
53 "Epoch zone to be used for hilighting selected text region." |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
54 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
55 (setq-default drag-zone nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
56 (setq-default mouse-down-marker nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
57 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
58 ;;; ------------------------------------------------------------------------ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
59 ;;; Set window-setup-hook to call motion::init(), which sets default |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
60 ;;; style for zone dragging. Default style is underlining; can be changed |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
61 ;;; in .emacs file. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
62 (epoch-add-setup-hook 'motion::init) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
63 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
64 (defun motion::init () |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
65 (and (not motion::style) (setq motion::style (make-style))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
66 (set-style-foreground motion::style (foreground)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
67 (set-style-background motion::style (background)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
68 (set-style-underline motion::style (foreground)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
69 ;; enable the handler |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
70 (push-event 'motion 'motion::handler) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
71 ;; set up hints on all the current screens |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
72 (dolist (s (screen-list t)) (epoch::set-motion-hints t s)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
73 ;; enable hints on future screens |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
74 (push '(motion-hints t) epoch::screen-properties) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
75 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
76 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
77 ;;; ------------------------------------------------------------------------ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
78 (defun set-mouse-marker (&optional location) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
79 (if (null mouse-down-marker) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
80 (setq mouse-down-marker (make-marker)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
81 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
82 (set-marker mouse-down-marker (or location (point))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
83 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
84 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
85 ;;; -------------------------------------------------------------------------- |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
86 ;;; Functions to provide dragging & hilighting. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
87 ;;; arg is a list of ( POINT BUFFER WINDOW SCREEN ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
88 (defun end-mouse-drag (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
89 (setq mouse::last-point -1) ;always do this cleanup |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
90 (when mouse::downp |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
91 (setq mouse::downp nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
92 (mouse::copy-zone drag-zone) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
93 (let ( |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
94 (s (and drag-zone (zone-start drag-zone))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
95 (e (and drag-zone (zone-end drag-zone))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
96 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
97 (if (null s) (setq s 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
98 (if (null e) (setq e 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
99 (if (zonep drag-zone) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
100 (if (<= (point) s) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
101 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
102 (push-mark e t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
103 (goto-char s) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
104 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
105 ;; ELSE point is past drag zone start |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
106 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
107 (push-mark s t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
108 (goto-char e) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
109 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
110 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
111 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
112 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
113 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
114 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
115 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
116 (defun start-mouse-drag (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
117 (when arg |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
118 (setq mouse::downp 'start) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
119 ; (message "%s" arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
120 (mouse::set-point arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
121 (abort-isearch) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
122 (set-mouse-marker) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
123 (setq mouse::last-point (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
124 (if drag-zone |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
125 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
126 (message "ddz") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
127 (delete-zone drag-zone) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
128 (setq drag-zone nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
129 (redisplay-screen) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
130 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
131 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
132 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
133 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
134 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
135 (defun extend-mouse-drag (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
136 (setq mouse::downp 'extend) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
137 (let |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
138 ( |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
139 (m1 (and drag-zone (zone-start drag-zone))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
140 (m2 (and drag-zone (zone-end drag-zone))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
141 (spot (car arg)) ;point of the mouse click. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
142 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
143 (if (null m1) (setq m1 0)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
144 (if (null m2) (setq m2 0)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
145 (cond |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
146 ((or (null drag-zone) (null mouse-down-marker)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
147 (setq drag-zone (add-zone (point) spot motion::style) ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
148 (set-zone-transient drag-zone t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
149 (set-mouse-marker) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
150 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
151 ((<= spot m1) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
152 (setq drag-zone (move-zone drag-zone spot m2) ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
153 (set-mouse-marker m2) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
154 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
155 ((>= spot m2) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
156 (setq drag-zone (move-zone drag-zone m1 spot) ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
157 (set-mouse-marker m1) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
158 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
159 ((<= mouse-down-marker spot) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
160 (setq drag-zone (move-zone drag-zone m1 spot) ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
161 (set-mouse-marker m1) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
162 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
163 (t |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
164 (setq drag-zone (move-zone drag-zone spot m2) ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
165 (set-mouse-marker m2) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
166 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
167 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
168 (epoch::redisplay-screen) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
169 (setq mouse::last-point (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
170 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
171 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
172 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
173 ;;; ------------------------------------------------------------------------ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
174 ;;; Define the handler for dragging, etc. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
175 (defun motion::handler (type value scr) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
176 (if (null mouse-down-marker) (set-mouse-marker)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
177 (if (and (boundp 'mouse::downp) mouse::downp) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
178 (mouse-sweep-update) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
179 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
180 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
181 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
182 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
183 (defun mouse-sweep-update() |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
184 (let* |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
185 ( |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
186 drag-m1 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
187 drag-m2 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
188 pnt |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
189 pos |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
190 x |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
191 y |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
192 (w (selected-window)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
193 (out-of-bounds t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
194 (epoch::event-handler-abort nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
195 (w-edges (window-pixedges w)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
196 (left (car w-edges)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
197 (top (elt w-edges 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
198 (right (- (elt w-edges 2) left 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
199 (bottom (- (elt w-edges 4) top 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
200 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
201 (while |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
202 (and |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
203 out-of-bounds |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
204 (setq pos (query-pointer)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
205 (/= 0 (logand mouse-any-mask (elt pos 2))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
206 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
207 ;;convert to window relative co-ordinates |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
208 (setq x (- (car pos) left)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
209 (setq y (- (elt pos 1) top)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
210 (setq out-of-bounds |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
211 (not (and (<= 0 y) (<= y bottom) (<= 0 x) (<= x right))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
212 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
213 ;; scrolling conditions |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
214 (condition-case errno |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
215 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
216 (if (< y 0) (scroll-down vertical-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
217 (if (> y bottom) (scroll-up vertical-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
218 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
219 (error ) ;nothing, just catch it |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
220 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
221 ;; Disable horizontal scrolling. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
222 ; (if (< x left) (scroll-right horizontal-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
223 ; (if (> x right) (scroll-left horizontal-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
224 (setq y (max 1 (min bottom y))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
225 (setq x (max 0 (min right x))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
226 (setq pnt (car (epoch::coords-to-point (+ x left) (+ y top)))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
227 (when (/= mouse::last-point pnt) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
228 (if (> mouse-down-marker pnt) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
229 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
230 (setq drag-m1 pnt) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
231 (setq drag-m2 (marker-position mouse-down-marker)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
232 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
233 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
234 (setq drag-m1 (marker-position mouse-down-marker)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
235 (setq drag-m2 (1+ pnt)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
236 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
237 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
238 ;; moved this in here so that zone won't get made if |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
239 ;; only motion is jitter within a single character |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
240 ;; this fixes a bunch of bogus (often empty) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
241 ;; entries in the kill ring |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
242 (if drag-zone |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
243 (move-zone drag-zone drag-m1 drag-m2) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
244 (progn (setq drag-zone |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
245 (add-zone drag-m1 drag-m2 motion::style ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
246 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
247 (set-zone-transient drag-zone t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
248 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
249 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
250 (redisplay-screen) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
251 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
252 (setq mouse::last-point pnt) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
253 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
254 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
255 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
256 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
257 ;;; ------------------------------------------------------------------------ |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
258 ;;; Code for selecting lines using motion events. Assumes that the line is |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
259 ;;; left unmarked on zone up |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
260 (defvar mouse::line-zone nil "Zone for selected line") |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
261 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
262 (defun mouse-select-line-start (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
263 (mouse::set-point arg) ;go there |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
264 (setq mouse::last-point (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
265 (let ( bol ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
266 (save-excursion |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
267 (beginning-of-line) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
268 (setq bol (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
269 (end-of-line) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
270 (setq mouse::line-zone (add-zone bol (point) motion::style)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
271 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
272 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
273 (push-event 'motion 'mouse-select-line-update) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
274 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
275 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
276 (defun mouse-select-line-end (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
277 (setq mouse::last-point -1) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
278 (when mouse::line-zone (delete-zone mouse::line-zone)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
279 (pop-event 'motion) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
280 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
281 ;;; |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
282 (defun mouse-select-line-update (type value scr) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
283 (let* |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
284 ( |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
285 y |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
286 pos |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
287 bol |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
288 (out-of-bounds t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
289 (epoch::event-handler-abort nil) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
290 (w-edges (window-pixedges (selected-window))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
291 (top (elt w-edges 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
292 (bottom (- (elt w-edges 4) top 1)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
293 max-vscroll |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
294 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
295 (while |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
296 (and |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
297 out-of-bounds |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
298 (setq pos (query-pointer)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
299 (/= 0 (logand mouse-any-mask (elt pos 2))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
300 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
301 ;;convert to window relative co-ordinates |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
302 (setq y (- (elt pos 1) top)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
303 (setq out-of-bounds (not (and (<= 0 y) (<= y bottom)))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
304 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
305 ;; Scrolling hard, because of possibly shrink-wrapped windows. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
306 ;; set max-vscroll to be the most we could scroll down and not have |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
307 ;; empty lines at the bottom |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
308 (save-excursion |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
309 (move-to-window-line bottom) ;go to the last line in the window |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
310 (setq max-vscroll |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
311 (- vertical-drag-inc (forward-line vertical-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
312 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
313 (if (and (> max-vscroll 0) (eobp) (= 0 (current-column))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
314 (decf max-vscroll) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
315 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
316 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
317 (condition-case errno |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
318 (progn |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
319 (if (< y 0) (scroll-down vertical-drag-inc)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
320 (if (> y bottom) (scroll-up (min max-vscroll vertical-drag-inc))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
321 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
322 ;; CONDITIONS |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
323 (error) ;nothing, just want to catch it |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
324 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
325 (setq y (max 0 (min bottom y))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
326 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
327 ;;move to the new point |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
328 (move-to-window-line y) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
329 (beginning-of-line) (setq bol (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
330 (end-of-line) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
331 (when (/= mouse::last-point (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
332 (move-zone mouse::line-zone bol (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
333 (epoch::redisplay-screen) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
334 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
335 (setq mouse::last-point (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
336 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
337 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
338 ) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
339 ;;; -------------------------------------------------------------------------- |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
340 ;; Stolen from AMC |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
341 (defun mouse::buffer-line (marg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
342 "Show the line number and buffer of the mouse EVENT" |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
343 ;; marg is (point buffer window screen) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
344 ;; Pop over to the clicked buffer |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
345 (save-excursion (set-buffer (cadr marg)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
346 ;; Figure out how far down the mouse point is |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
347 (let ((n (count-lines (point-min) (car marg)))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
348 ;; display it. Include the buffer name for good measure. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
349 (message (format "Line %d in %s" n (buffer-name (cadr marg)))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
350 ))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
351 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
352 ;; Blow out of any current isearch |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
353 (defun abort-isearch () "Abort any isearch in progress." |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
354 (condition-case err |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
355 (throw 'search-done t) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
356 (no-catch nil))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
357 ;;; -------------------------------------------------------------------------- |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
358 ;;; install all our various handlers |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
359 (global-set-mouse mouse-left mouse-down 'start-mouse-drag) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
360 (global-set-mouse mouse-left mouse-shift 'mouse::buffer-line) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
361 (global-set-mouse mouse-left mouse-up 'end-mouse-drag) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
362 (global-set-mouse mouse-right mouse-down 'extend-mouse-drag) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
363 (global-set-mouse mouse-right mouse-up 'end-mouse-drag) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
364 (global-set-mouse mouse-middle mouse-down 'mouse::paste-cut-buffer) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
365 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
366 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
367 (defun mouse-set-spot (arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
368 "Set point at mouse. With double-click, set mark there as well. |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
369 Blinks matching paren if sitting after one. Intended to be bound |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
370 to a window down button." |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
371 (start-mouse-drag arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
372 (let ((buf (current-buffer)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
373 (p (point))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
374 (mouse::set-point arg) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
375 (if (and (equal p (point)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
376 (equal buf (current-buffer))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
377 (if (and (= mouse::clicks 1) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
378 (not (eq (mark) (point)))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
379 (push-mark)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
380 (setq mouse::clicks 0)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
381 (if (eq (char-syntax (preceding-char)) ?\)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
382 (blink-matching-open))) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
383 (abort-isearch)) |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
384 |
107d592c5f4a
DICE versions, used by pers/common, recursive, I think/hope
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
385 |