annotate lisp/hm--html-menus/internal-drag-and-drop.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 0d2f883870bc
children 9f59509498e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1 ;;; $Id: internal-drag-and-drop.el,v 1.2 1997/02/15 22:21:05 steve Exp $
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
2 ;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
3 ;;; Copyright (C) 1996, 1997 Heiko Muenkel
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
4 ;;; email: muenkel@tnt.uni-hannover.de
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
5 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
6 ;;; This program is free software; you can redistribute it and/or modify
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
7 ;;; it under the terms of the GNU General Public License as published by
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
8 ;;; the Free Software Foundation; either version 1, or (at your option)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
9 ;;; any later version.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
10 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
11 ;;; This program is distributed in the hope that it will be useful,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
14 ;;; GNU General Public License for more details.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
15 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
16 ;;; You should have received a copy of the GNU General Public License
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
17 ;;; along with this program; if not, write to the Free Software
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
19 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
20 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
21 ;;; Description:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
22 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
23 ;;; This package provides functions to define and call internal
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
24 ;;; drag and drop actions in the emacs. One could start such an
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
25 ;;; action by clicking with the mouse in the source buffer and
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
26 ;;; then in the destination buffer. The action could depend on
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
27 ;;; the points where you've clicked with the mouse, on the state
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
28 ;;; of the region, the point, the mark and any other properties
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
29 ;;; of the source and the destination buffers. The actions are
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
30 ;;; defined by the variable `idd-actions', which is a buffer local
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
31 ;;; variable. The following is an example for the hm--html-mode:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
32 ;;; (defvar hm--html-idd-actions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
33 ;;; '((nil (((idd-if-major-mode-p . dired-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
34 ;;; (idd-if-dired-file-on-line-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
35 ;;; . ".*\\.\\(gif\\)\\|\\(jpq\\)"))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
36 ;;; hm--html-idd-add-include-image-from-dired-line)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
37 ;;; (((idd-if-major-mode-p . dired-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
38 ;;; (idd-if-dired-no-file-on-line-p . nil))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
39 ;;; hm--html-idd-add-file-link-to-file-on-dired-line)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
40 ;;; (((idd-if-major-mode-p . dired-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
41 ;;; (idd-if-dired-no-file-on-line-p . t))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
42 ;;; hm--html-idd-add-file-link-to-directory-of-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
43 ;;; (((idd-if-major-mode-p . w3-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
44 ;;; (idd-if-url-at-point-p . t))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
45 ;;; hm--html-idd-add-html-link-from-w3-buffer-point)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
46 ;;; (((idd-if-major-mode-p . w3-mode))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
47 ;;; hm--html-idd-add-html-link-to-w3-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
48 ;;; (((idd-if-local-file-p . t))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
49 ;;; hm--html-idd-add-file-link-to-buffer)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
50 ;;; Look at the variable `idd-actions' for further descriptions.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
51 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
52 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
53 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
54 ;;; Installation:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
55 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
56 ;;; Put this file in one of your load path directories.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
57 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
58 ;;; Put the following in your .emacs:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
59 ;;; (autoload 'idd-mouse-drag-and-drop "internal-drag-and-drop"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
60 ;;; "Performs a drag and drop action.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
61 ;;; At first you must click on the source and
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
62 ;;; after that on the destination."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
63 ;;; t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
64 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
65 ;;; Define actions in the variable `idd-actions'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
66 ;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67 ;;; The variable `idd-global-mouse-keys' defines the mouse keys,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
68 ;;; which are bound to the drag and drop command.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
69 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
70 ;;; The variable `idd-drag-and-drop-mouse-binding-type' determines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
71 ;;; if you've to hold a mouse button down during moving the mouse
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
72 ;;; from the source to the destination or not.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
73 ;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
75 (require 'adapt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
76 (require 'cl)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
77
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
78 (defvar idd-global-mouse-keys (if (adapt-emacs19p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
79 [(meta control mouse-1)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
80 [(meta control button1)])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
81 "The mouse keys for the command `idd-mouse-drag-and-drop'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
82 The command `idd-mouse-drag-and-drop' is bound during the loading
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
83 of the package internal-drag-and-drop to this keys in the global
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
84 key map.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
85
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
86 Set it to nil, if you don't want to bind this function during loading.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
87
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
88 If the command is already bound in the global keymap during loading,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
89 then this key sequence will not be bind.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
90
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
91 (defvar idd-global-help-mouse-keys (if (adapt-emacs19p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
92 [(meta control mouse-3)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 [(meta control button3)])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
94 "The mouse keys for the command `idd-help-mouse-drag-and-drop'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95 The command `idd-mouse-drag-and-drop' is bound during the loading
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
96 of the package internal-drag-and-drop to this keys in the global
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
97 key map.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
99 Set it to nil, if you don't want to bind this function during loading.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 If the command is already bound in the global keymap during loading,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102 then this key sequence will not be bind.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
104 (defvar idd-drag-and-drop-mouse-binding-type 'click
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
105 "*The type of the drag and drop mouse binding.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
106 The value maybe `click or 'press-button-during-move.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
107 A value of `click means, that you've to click over the source, leave
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
108 the button and click it again over the destination.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
109 A value of 'press-button-during-move means, that you've to press
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
110 the button down over the source and hold it until the mouse pointer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
111 is over the destination.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
112
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
113 The disadvantage of the `press-button-during-move' type compared with
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
114 the `click' type is, that you can't select a destination region and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
115 therefore a drag and drop action depending on a selected region can't
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
116 be started with that type of mouse binding.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
117
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
118 (defvar idd-actions '((((idd-if-region-active-p . nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
119 (((idd-if-region-active-p . t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
120 idd-action-copy-region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
121
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
122 (((idd-if-region-active-p . t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
123 (((idd-if-region-active-p . t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
124 idd-action-copy-replace-region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
125
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
126 (((idd-if-region-active-p . nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
127 (idd-if-modifiers-p . nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
128 (((idd-if-region-active-p . t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
129 idd-action-move-region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
130
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
131 (((idd-if-region-active-p . t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 (idd-if-modifiers-p . nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
133 (((idd-if-region-active-p . t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
134 idd-action-move-replace-region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
135 )
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 "The list with actions, depending on the source and the destination.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137 The list looks like:
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
138 '((<destination-specification-1> (<source-specification-1> <action-1-1>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
139 (<source-specification-2> <action-1-2>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
140 :
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
141 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
142 (<destination-specification-2> (<source-specification-1> <action-2-1>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
143 (<source-specification-2> <action-2-2>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
144 :
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
145 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
146 :
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
147 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
148 The <source-specification> looks like the following:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
149 '([(<specification-type> <value>)])
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
150 with <specification-type> :== idd-if-minor-mode-p | idd-if-buffer-name-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
151 | idd-if-region-active-p | idd-if-url-at-point-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
152 | idd-if-major-mode-p | idd-if-variable-non-nil-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
153 | idd-if-dired-file-on-line-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
154 | idd-if-dired-no-file-on-line-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
155 | idd-if-local-file-p | idd-if-buffer-name-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
156 | idd-if-modifiers-p | ...
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
157
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
158 The <specification-type> - functions must have two arguments, the first one
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
159 is the source or destination and the second is the <value>. It must return
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
160 nil, if the test wasn't successfull and a number (in general 1), which
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
161 specifies the weight of the test function. The weights of all single tests
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
162 are added to a summary weight and assigned to the action. The action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
163 with the highest weight is called from the action handler. Look at
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
164 the definition of `idd-if-major-mode-p', `idd-if-minor-mode-p' and so on for
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
165 examples. Look at the function `idd-get-source-or-destination-alist', if
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
166 you wan't to know the structure of the 'source-or-destination' argument
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
167 of these functions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
168
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
169 The <destination-specification> looks like <source-specification>,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
170 but in general it could be set to nil in mode specific idd-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
171 lists.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
172
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
173 If <destination-specification-1> or <source-specification-1> is set to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
174 nil, then every source or source matches. `idd-actions' is a
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
175 buffer local variable, which should be at least mode depended. So if
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
176 the <destination-specification-1> is set to nil it says, that the destination
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
177 buffer must only have a specific mode. But however, it's also possible
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
178 to define a general `idd-actions' list, where the destination mode is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
179 specified by `idd-if-major-mode-p'.
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
180
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
181 <action> ist a function, which has two arguments, the first specifies the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
182 source and the second the destination. Look at the function definition
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
183 of `idd-action-copy-region' and `idd-action-copy-replace-region'. They are
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
184 examples for such actions.")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
185
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
186 (make-variable-buffer-local 'idd-actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
187
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
188 (defvar idd-help-instead-of-action nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
189 "*If this variable is t, then a help buffer is displayed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
190 No action will be performed if this variable is t.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
191
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
192 (defvar idd-help-start-action-keymap nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
193 "Keymap used in an extent in the help buffer to start the action.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
194
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
195 (defvar idd-help-source nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
196 "Contains the source of an action. Used only in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
197
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
198 (defvar idd-help-destination nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
199 "Contains the destination of an action. Used only in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
200
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
201 (defvar idd-help-start-extent nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
202 "The start extent in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
203
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
204 (defun idd-compare-a-specification (source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
205 specification)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
206 "Tests if SOURCE-OR-DESTINATION matches the SPECIFICATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
207 It returns a value (1 in general) if both are matching or nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
208 (eval (list (car specification)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
209 'source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
210 '(cdr specification))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
211
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
212 (defun idd-compare-specifications-1 (source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
213 specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
214 value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
215 "Internal function of `idd-compare-specifications'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
216 VALUE is the value of the last matches."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
217 (cond ((not specifications) value)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
218 (t (let ((match (idd-compare-a-specification source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
219 (car specifications))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
220 (cond ((not match) 0)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
221 (t (idd-compare-specifications-1 source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
222 (cdr specifications)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
223 (+ value match))))))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
224
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
225 (defun idd-compare-specifications (source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
226 specifications)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
227 "Determines how good SOURCE-OR-DESTINATION and SPECIFICATIONS are matching.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
228 A return value of zero means, that they don't match. The higher the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
229 return value the better is the matching."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
230 (cond ((not specifications) 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
231 (t (idd-compare-specifications-1 source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
232 specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
233 0))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
234
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
235 (defun idd-get-action-depending-on-source (source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
236 actions-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
237 destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
238 value-action-pair)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
239 "Internal function of `idd-get-action-depending-on-source-and-destination'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
240 (let ((source-value (idd-compare-specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
241 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
242 (car (car actions-depending-on-source)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
243 (cond ((not actions-depending-on-source) value-action-pair)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
244 ((or (= source-value 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
245 (<= (+ destination-value source-value) (car value-action-pair)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
246 (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
247 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
248 (cdr actions-depending-on-source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
249 destination-value
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
250 value-action-pair))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
251 (t (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
252 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
253 (cdr actions-depending-on-source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
254 destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
255 (cons (+ destination-value source-value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
256 (second (car actions-depending-on-source))))))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
257
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
258 (defun idd-get-action-depending-on-source-and-destination (source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
259 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
260 actions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
261 value-action-pair)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
262 "Internal function of `idd-get-action'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
263 VALUE-ACTION-PAIR is a list like (<value> <action>).
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
264 It returns VALUE-ACTION-PAIR, if no other action is found, which has a
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
265 value higher than (car VALUE-ACTION-PAIR)."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
266 (let ((destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
267 (idd-compare-specifications destination (car (car actions)))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
268 (cond ((not actions) value-action-pair)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
269 ((= destination-value 0)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
270 (idd-get-action-depending-on-source-and-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
271 source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
272 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
273 (cdr actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
274 value-action-pair))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
275 (t (idd-get-action-depending-on-source-and-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
276 source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
277 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
278 (cdr actions)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
279 (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
280 source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
281 (cdr (car actions))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
282 destination-value
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
283 value-action-pair))))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
284
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
285 (defun idd-get-action (source destination actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
286 "Returns the action, which depends on the SOURCE and the DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
287 The list ACTIONS contains all possible actions. Look at the variable
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
288 `idd-actions' for a description of the format of this list."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
289 (idd-get-action-depending-on-source-and-destination source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
290 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
291 actions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
292 '(0 . nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
293
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
294 (autoload 'ange-ftp-ftp-path "ange-ftp"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
295 "Parse PATH according to ange-ftp-path-format (which see).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
296 Returns a list (HOST USER PATH), or nil if PATH does not match the format.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
297
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
298 (defun idd-set-point (source-or-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
299 "Sets the point and buffer to SOURCE-OR-DESTINATION."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
300 (set-buffer (cdr (assoc ':buffer source-or-destination)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
301 (goto-char (cdr (assoc ':drag-or-drop-point source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
302
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
303 (defun idd-set-region (source-or-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
304 "Sets the point, mark and buffer to SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
305 The region is active after this function is called."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
306 (set-buffer (cdr (assoc ':buffer source-or-destination)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
307 (goto-char (car (cdr (assoc ':region-active source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
308 (set-mark (cdr (cdr (assoc ':region-active source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
309 (activate-region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
310
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
311
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
312 ;;; Specification type functions for the list `idd-actions'
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
313
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
314 (defun idd-if-region-active-p (source-or-destination value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
315 "Checks if the region in the SOURCE-OR-DESTINATION was active.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
316 It returns 1, if the region was active and VALUE is t, or if
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
317 the region was not active and VALUE is nil. Otherwise it returns
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
318 nil."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
319 (if (cdr (assoc ':region-active source-or-destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
320 (if value 1 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
321 (if value nil 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
322
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
323 (defun idd-get-buffer-url (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
324 "Returns the URL of the buffer specified by SOURCE-OR-DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
325 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
326 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
327 (url-view-url t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
328
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
329 (defun idd-get-url-at-point (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
330 "Returns the URL at the point specified by SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
331 It returns nil, if there is no URL."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
332 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
333 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
334 (w3-view-this-url t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
335
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
336 (defun idd-if-url-at-point-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
337 "Checks if there is an URL at the point of SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
338 If that is t and VALUE is t, or that is nil and VALUE is nil, then 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
339 is returned. Otherwise nil is returned."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
340 (if value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
341 (if (idd-get-url-at-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
342 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
343 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
344 (if (idd-get-url-at-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
345 nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
346 1)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
347
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
348 (defun idd-if-major-mode-p (source-or-destination mode)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
349 "Checks, if the major mode of SOURCE-OR-DESTINATION is MODE.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
350 It returns 1, if that is t and nil otherwise."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
351 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
352 (set-buffer (cdr (assoc ':buffer source-or-destination)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
353 (if (eq major-mode mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
354 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
355 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
356
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
357 (defun idd-if-variable-non-nil-p (source-or-destination variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
358 "Checks, if the variable named VARIABLE isn't t in SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
359 It returns 1, if this is t."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
360 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
361 (set-buffer (cdr (assoc ':buffer source-or-destination)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
362 (if (eval variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
363 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
364 nil)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
365
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
366 (defun idd-if-minor-mode-p (source-or-destination minor-mode-variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
367 "Checks, if the variable MINOR-MODE-VARIABLE is t in SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
368 MINOR-MODE-VARIABLE is the name of the variable!."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
369 (idd-variable-non-nil-p source-or-destination minor-mode-variable))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
370
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
371 (defun idd-get-dired-filename-from-line (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
372 "Returns the filename form the line in a dired buffer.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
373 The position and the buffer is specified by SOURCE-OR-DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
374 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
375 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
376 (dired-get-filename nil t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
377
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
378 (defun idd-if-dired-file-on-line-p (source-or-destination filename-regexp)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
379 "Checks, if the filename on the line match FILENAME-REGEXP.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
380 The function `dired-get-filename' is used, to get the filename from
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
381 the SOURCE-OR-DESTINATION. It returns 1, if it matchs or nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
382 (let ((case-fold-search t))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
383 (if (and (idd-get-dired-filename-from-line source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
384 (string-match filename-regexp
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
385 (idd-get-dired-filename-from-line
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
386 source-or-destination)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
387 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
388 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
389
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
390 (defun idd-if-dired-no-file-on-line-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
391 "Checks, if a filename is in the dired buffer of SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
392 It returns 1, if a filename is on the line and if VALUE is t, or if
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
393 no filename is on the line and VALUE is nil, otherwise it returns
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
394 nil. For the test the function `dired-get-filename' is used."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
395 (if (idd-get-dired-filename-from-line source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
396 (if value nil 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
397 (if value 1 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
398
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
399 (defun idd-get-local-filename (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
400 "Returns the filename of a local file specified by SOURCE-OR-DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
401 (buffer-file-name (cdr (assoc ':buffer source-or-destination))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
402
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
403 (defun idd-get-directory-of-buffer (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
404 "Returns the directory name assigned to the SOURCE-OR-DESTINATION buffer."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
405 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
406 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
407 default-directory))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
408
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
409 (defun idd-if-local-file-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
410 "Checks, if SOURCE-OR-DESTINATION has a file on the local filesystem.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
411 If that is t and VALUE is t, or that is nil and VALUE is nil, then 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
412 is returned. Otherwise nil is returned."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
413 (let ((filename (idd-get-local-filename source-or-destination)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
414 (if (and filename
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
415 (not (ange-ftp-ftp-path filename)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
416 (if value 1 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
417 (if value nil 1))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
418
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
419 (defun idd-if-buffer-name-p (source-or-destination buffer-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
420 "Checks, if SOURCE-OR-DESTINATION has a buffer called BUFFER-NAME.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
421 It returns 1 if this is the case or nil otherwise."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
422 (if (string= buffer-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
423 (buffer-name (cdr (assoc ':buffer source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
424 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
425 nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
426
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
427 (defun idd-list-1-subset-of-list-2 (list-1 list-2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
428 "Returns t, if LIST-1 is a subset of LIST-2."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
429 (cond ((not list-1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
430 ((member (car list-1 list-2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
431 (idd-list-1-subset-of-list-2 (cdr list-1) list-2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
432 (t nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
433
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
434 (defun idd-same-modifiers (list-1 list-2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
435 "Returns t, if both list have the same modifiers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
436 (and (length list-1 list-2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
437 (idd-list-1-subset-of-list-2 list-1-list-2)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
438
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
439 (defun idd-if-modifiers-p (source-or-destination modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
440 "Checks, if the MODIFIERS hold during selecting the SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
441 Returns 1, if the list MODIFIERS contains the same modifiers,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
442 or if any modyfiers are hold and MODIFIERS is t,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
443 or if no modyfiers are hold and MODIFIERS is nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
444 Otherwise nil is returned."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
445 (let ((event-modifiers (event-modifiers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
446 (cdr (assoc ':event source-or-destination)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
447 (cond ((not modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
448 (if event-modifiers nil 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
449 ((listp modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
450 (if (idd-same-elements modifiers event-modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
451 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
452 nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
453 (t (if event-modifiers 1 nil)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
454
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
455 ;;; action functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
456
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
457 (defun idd-action-copy-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
458 "Copy the region from DESTINATION to SOURCE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
459 (idd-set-region source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
460 (let ((region-contents (buffer-substring (point) (mark))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
461 (idd-set-point destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
462 (insert region-contents)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
463
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
464 (defun idd-action-copy-replace-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
465 "Copy the region from SOURCE and replace the DESTINATION region with it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
466 (idd-set-region source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
467 (let ((region-contents (buffer-substring (point) (mark))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
468 (idd-set-region destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
469 (delete-region (point) (mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
470 (insert region-contents)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
471
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
472 (defmacro* idd-with-source-and-destination (source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
473 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
474 &key
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
475 do-in-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
476 do-in-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
477 "Macro, usefull for the definition of action functions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
478 Look at the example `idd-action-move-region'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
479 `(progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
480 (if (idd-if-region-active-p ,source t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
481 (idd-set-region ,source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
482 (idd-set-point ,source))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
483 ,(when do-in-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
484 (cons 'progn do-in-source))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
485 (if (idd-if-region-active-p ,destination t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
486 (idd-set-region ,destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
487 (idd-set-point ,destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
488 ,(when do-in-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
489 (cons 'progn do-in-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
490
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
491 (defun idd-action-move-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
492 "Move the region from SOURCE to DESTINATION."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
493 (let ((region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
494 (idd-with-source-and-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
495 source destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
496 :do-in-source ((setq region (buffer-substring (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
497 (delete-region (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
498 :do-in-destination ((insert region)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
499
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
500
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
501 (defun idd-action-move-replace-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
502 "Delete the region at SOURCE and overwrite the DESTINATION region with it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
503 (let ((region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
504 (idd-with-source-and-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
505 source destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
506 :do-in-source ((setq region (buffer-substring (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
507 (delete-region (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
508 :do-in-destination ((delete-region (point) (mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
509 (insert region)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
510
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
511
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
512 ;;; Performing the drag and drop
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
513
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
514 (defun idd-display-help-about-action (action source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
515 "Display a help buffer with information about the action."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
516 (if (> (car action) 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
517 (if (symbol-function (cdr action))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
518 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
519 (with-displaying-help-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
520 '(lambda ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
521 (set-buffer "*Help*")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
522 (setq idd-help-source source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
523 (setq idd-help-destination destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
524 (insert "Drag and drop action: `")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
525 (let ((start (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
526 (insert (format "%s" (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
527 (setq idd-help-start-extent (make-extent start (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
528 (set-extent-mouse-face idd-help-start-extent 'highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
529 (set-extent-face idd-help-start-extent 'bold)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
530 (set-extent-keymap idd-help-start-extent
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
531 idd-help-start-action-keymap)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
532 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
533 (insert "'\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
534 (insert (format "Source buffer : `%s'\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
535 (buffer-name (cdr (assoc ':buffer source)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
536 (insert (format "Destination buffer : `%s'\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
537 (buffer-name (cdr (assoc ':buffer destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
538 )))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
539 (insert "=================================================="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
540 "====================\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
541 (insert "Look at `idd-actions' in the "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
542 "destination buffer for other actions!\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
543 (insert (format "The documentation of `%s':\n\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
544 (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
545 (insert (documentation (cdr action)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
546 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
547 (error "Error: Action %s isn't a valid function!" (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
548 (message "No valid action defined for this source and this destination!")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
549
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
550 (defun idd-call-action (action source destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
551 "Calls the drag and drop ACTION with its arguments SOURCE and DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
552 (if (> (car action) 0)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
553 (if (symbol-function (cdr action))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
554 (eval (list (cdr action) 'source 'destination))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
555 (error "Error: Action %s isn't a valid function!" (cdr action)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
556 (message "No valid action defined for this source and this destination!")))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
557
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
558 (defun idd-start-help-mouse-drag-and-drop ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
559 "Starts help on `idd-start-mouse-drag-and-drop'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
560 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
561 (let ((idd-help-instead-of-action t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
562 (idd-start-mouse-drag-and-drop)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
563
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
564 (defun idd-start-mouse-drag-and-drop ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
565 "Starts a drag and drop command.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
566 This command could be used to start a drag and drop command without a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
567 button event. Therefore this should not be bind direct to a mouse button."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
568 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
569 (let ((destination-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
570 (drag-and-drop-message "Drag&Drop: Click on the source!"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
571 (message drag-and-drop-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
572 (setq source-event
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
573 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
574 (if (button-press-event-p source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
575 (idd-mouse-drag-and-drop source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
576 (message "Wrong event! Exit drag and drop."))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
577
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
578 (defun idd-help-mouse-drag-and-drop (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
579 "Displays help about the drag and drop action."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
580 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
581 (let ((idd-help-instead-of-action t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
582 (idd-mouse-drag-and-drop source-event)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
583
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
584 (defun idd-mouse-drag-and-drop (source-event)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
585 "Performs a drag and drop action.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
586 It calls the command `idd-mouse-drag-and-drop-click' or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
587 `idd-mouse-drag-and-drop-press-button-during-move' depending on
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
588 the value of `idd-drag-and-drop-mouse-binding-type'."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
589 (interactive "@e")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
590 (if (eq idd-drag-and-drop-mouse-binding-type 'click)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
591 (idd-mouse-drag-and-drop-click source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
592 (idd-mouse-drag-and-drop-press-button-during-move source-event)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
593
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
594 (defun idd-get-source-or-destination-alist (event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
595 "Returns an alist with the description of a source or destination point.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
596 The EVENT must be the button event, which has selected the source or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
597 destination of the drag and drop command.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
598
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
599 The alist has the following structure:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
600 '((:buffer . <buffer-of-the-event>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
601 (:drag-or-drop-point . <closest-point-to-the-event>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
602 (:region-active . <t-or-nil>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
603 (:event . EVENT))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
604
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
605 Note: <closest-point-to-the-event> is (event-closest-point EVENT),
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
606 if the EVENT is a mouse event and if it isn't nil. Otherwise the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
607 point is used."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
608 ; (set-buffer (event-buffer event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
609 (list (cons ':buffer (event-buffer event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
610 (cons ':drag-or-drop-point (set-marker
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
611 (make-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
612 (if (mouse-event-p event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
613 (or (event-closest-point event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
614 (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
615 (point))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
616 (cons ':region-active (if (region-active-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
617 (cons (set-marker (make-marker) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
618 (set-marker (make-marker) (mark)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
619 (cons ':event event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
620 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
621
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
622 (defun idd-mouse-drag-and-drop-press-button-during-move (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
623 "Performs a drag and drop action.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
624 At first you must press the button down over the source and then
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
625 move with the pressed button to the destination, where you must leave
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
626 the button up.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
627 This must be bind to a mouse button. The SOURCE-EVENT must be a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
628 button-press-event.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
629
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
630 The disadvantage of this command compared with the command
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
631 `idd-mouse-drag-and-drop-click' is, that you can't select a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
632 destination region."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
633 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
634 (let ((drag-and-drop-message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
635 "Drag&Drop: Leave the button over the destination!")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
636 (source (idd-get-source-or-destination-alist source-event))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
637 (destination nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
638 (destination-event))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
639 (message drag-and-drop-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
640 (setq destination-event
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
641 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
642 (message "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
643 (cond ((button-release-event-p destination-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
644 (setq destination (idd-get-source-or-destination-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
645 destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
646 (idd-set-point destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
647 (if idd-help-instead-of-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
648 (idd-display-help-about-action (idd-get-action source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
649 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
650 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
651 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
652 destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
653 (idd-call-action (idd-get-action source destination idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
654 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
655 destination)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
656 (t (message "Wrong event! Exit drag and drop.") nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
657
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
658 (defun idd-mouse-drag-and-drop-click (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
659 "Performs a drag and drop action.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
660 At first you must click on the source and after that on the destination.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
661 This must be bind to a mouse button. The SOURCE-EVENT must be a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
662 button-press-event."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
663 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
664 (let ((drag-and-drop-message "Drag&Drop: Click on the destination!")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
665 (source (idd-get-source-or-destination-alist source-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
666 (destination nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
667 (destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
668 (message drag-and-drop-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
669 (if (and (adapt-xemacsp) (mouse-event-p source-event))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
670 (dispatch-event (next-command-event)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
671 (setq destination-event
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
672 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
673 (setq heiko source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
674 (message "")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
675 (cond ((button-press-event-p destination-event)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
676 (mouse-track destination-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
677 (setq destination (idd-get-source-or-destination-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
678 destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
679 (idd-set-point destination)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
680 (if (adapt-emacs19p)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
681 (while (not (button-release-event-p (next-command-event)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
682 (if idd-help-instead-of-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
683 (idd-display-help-about-action (idd-get-action source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
684 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
685 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
686 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
687 destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
688 (idd-call-action (idd-get-action source destination idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
689 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
690 destination)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
691 (t (message "Wrong event! Exit drag and drop.") nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
692
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
693 (defun idd-help-start-action (event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
694 "Used to start the action from the help buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
695 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
696 (idd-set-point idd-help-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
697 (idd-call-action (idd-get-action idd-help-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
698 idd-help-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
699 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
700 idd-help-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
701 idd-help-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
702 (delete-extent idd-help-start-extent))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
703
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
704 ;; keymap for help buffer extents
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
705 (if (not idd-help-start-action-keymap)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
706 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
707 (setq idd-help-start-action-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
708 (make-sparse-keymap 'idd-help-start-action-keymap))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
709 (if (adapt-emacs19p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
710 (define-key idd-help-start-action-keymap [(mouse-2)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
711 'idd-help-start-action)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
712 (define-key idd-help-start-action-keymap "[(button2)]"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
713 'idd-help-start-action))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
714
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
715 ;; global key bindings
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
716 (when idd-global-mouse-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
717 (unless (where-is-internal 'idd-mouse-drag-and-drop global-map t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
718 (define-key global-map idd-global-mouse-keys 'idd-mouse-drag-and-drop))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
719 (unless (where-is-internal 'idd-help-mouse-drag-and-drop global-map t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
720 (define-key global-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
721 idd-global-help-mouse-keys 'idd-help-mouse-drag-and-drop)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
722
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
723
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
724 (provide 'internal-drag-and-drop)