aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-02-02 23:19:11 +0000
committerRichard M. Stallman1994-02-02 23:19:11 +0000
commit6a2e3631e3c9b64b6aa9cf4051f11e8033feef7d (patch)
tree1fa254a076cb2dc4aed82bfa804d2b2e1d5ba045
parentf0e7011766509885d5bf9556e670ce4f0b09b395 (diff)
downloademacs-6a2e3631e3c9b64b6aa9cf4051f11e8033feef7d.tar.gz
emacs-6a2e3631e3c9b64b6aa9cf4051f11e8033feef7d.zip
(mouse-sel-version): Don't base version number on
RCS revision. Updated to version 2.0. (mouse-sel-set-selection-function, mouse-sel-get-selection-function, mouse-sel-check-selection-function): Check whether X11 functions are bound when setting defaults. (mouse-extend): Check whether modify-frame-parameters is bound before calling it. Add support to kill region with double-mouse-3.
-rw-r--r--lisp/mouse-sel.el48
1 files changed, 27 insertions, 21 deletions
diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el
index d4467a0e997..96a8e5b617f 100644
--- a/lisp/mouse-sel.el
+++ b/lisp/mouse-sel.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Mike Williams <mikew@gopher.dosli.govt.nz> 5;; Author: Mike Williams <mikew@gopher.dosli.govt.nz>
6;; Keywords: mouse 6;; Keywords: mouse
7;; Version: $Revision: 1.20 $ 7;; Version: 2.0
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -18,7 +18,7 @@
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details. 19;; GNU General Public License for more details.
20 20
21;;; Commentary: 21;;; Commentary: ===========================================================
22;; 22;;
23;; This module provides multi-click mouse support for GNU Emacs versions 23;; This module provides multi-click mouse support for GNU Emacs versions
24;; 19.18 and later. I've tried to make it behave more like standard X 24;; 19.18 and later. I've tried to make it behave more like standard X
@@ -42,15 +42,19 @@
42;; 42;;
43;; * Clicking mouse-2 pastes contents of primary selection. 43;; * Clicking mouse-2 pastes contents of primary selection.
44;; 44;;
45;; * Pressing mouse-2 while selecting or extending copies selected text 45;; * Pressing mouse-2 while selecting or extending copies selection
46;; to the kill ring. Pressing mouse-1 or mouse-3 kills it. 46;; to the kill ring. Pressing mouse-1 or mouse-3 kills it.
47;;
48;; * Double-clicking mouse-3 also kills selection.
47;; 49;;
48;; This module requires my thingatpt.el module, version 1.14 or later, which 50;; This module requires my thingatpt.el module, which it uses to find the
49;; it uses to find the bounds of words, lines, sexps, etc. 51;; bounds of words, lines, sexps, etc.
50;; 52;;
51;; Thanks to KevinB@bartley.demon.co.uk for his useful input. 53;; Thanks to KevinB@bartley.demon.co.uk for his useful input.
52;; 54;;
53;; You may also want to use one or more of following: 55;;--- Customisation -------------------------------------------------------
56;;
57;; * You may want to use none or more of following:
54;; 58;;
55;; ;; Enable region highlight 59;; ;; Enable region highlight
56;; (transient-mark-mode 1) 60;; (transient-mark-mode 1)
@@ -61,8 +65,6 @@
61;; ;; Enable pending-delete 65;; ;; Enable pending-delete
62;; (delete-selection-mode 1) 66;; (delete-selection-mode 1)
63;; 67;;
64;;--- Customisation -------------------------------------------------------
65;;
66;; * You can control the way mouse-sel binds it's keys by setting the value 68;; * You can control the way mouse-sel binds it's keys by setting the value
67;; of mouse-sel-default-bindings before loading mouse-sel. 69;; of mouse-sel-default-bindings before loading mouse-sel.
68;; 70;;
@@ -141,7 +143,7 @@
141;; nesting level. This also means the selection cannot be extended out 143;; nesting level. This also means the selection cannot be extended out
142;; of the enclosing nesting level. This is INTENTIONAL. 144;; of the enclosing nesting level. This is INTENTIONAL.
143 145
144;;; Code: 146;;; Code: =================================================================
145 147
146(provide 'mouse-sel) 148(provide 'mouse-sel)
147 149
@@ -150,10 +152,8 @@
150 152
151;;=== Version ============================================================= 153;;=== Version =============================================================
152 154
153(defconst mouse-sel-version (substring "$Revision: 1.20 $" 11 -2) 155(defconst mouse-sel-version "2.0"
154 "The revision number of mouse-sel (as string). The complete RCS id is: 156 "The version number of mouse-sel (as string).")
155
156 $Id: mouse-sel.el,v 1.20 1993/09/30 23:57:32 mike Exp $")
157 157
158;;=== User Variables ====================================================== 158;;=== User Variables ======================================================
159 159
@@ -186,21 +186,21 @@ Ie. 4 clicks = 1 click, 5 clicks = 2 clicks, etc.")
186used on windowing systems other than X Windows.") 186used on windowing systems other than X Windows.")
187 187
188(defvar mouse-sel-set-selection-function 188(defvar mouse-sel-set-selection-function
189 (if (eq window-system 'x) 189 (if (fboundp 'x-set-selection)
190 (function (lambda (s) (x-set-selection 'PRIMARY s))) 190 (function (lambda (s) (x-set-selection 'PRIMARY s)))
191 (function (lambda (s) (setq mouse-sel-selection s)))) 191 (function (lambda (s) (setq mouse-sel-selection s))))
192 "Function to call to set selection. 192 "Function to call to set selection.
193Called with one argument, the text to select.") 193Called with one argument, the text to select.")
194 194
195(defvar mouse-sel-get-selection-function 195(defvar mouse-sel-get-selection-function
196 (if (eq window-system 'x) 196 (if (fboundp 'x-get-selection)
197 'x-get-selection 197 'x-get-selection
198 (function (lambda () mouse-sel-selection))) 198 (function (lambda () mouse-sel-selection)))
199 "Function to call to get the selection. 199 "Function to call to get the selection.
200Called with no argument, it should return the selected text.") 200Called with no argument.")
201 201
202(defvar mouse-sel-check-selection-function 202(defvar mouse-sel-check-selection-function
203 (if (eq window-system 'x) 203 (if (fboundp 'x-selection-owner-p)
204 'x-selection-owner-p 204 'x-selection-owner-p
205 nil) 205 nil)
206 "Function to check whether emacs still owns the selection. 206 "Function to check whether emacs still owns the selection.
@@ -278,7 +278,8 @@ This should be bound to a down-mouse event."
278 (overlay-get mouse-drag-overlay 'face)) 278 (overlay-get mouse-drag-overlay 'face))
279 279
280 ;; Bar cursor 280 ;; Bar cursor
281 (modify-frame-parameters (selected-frame) '((cursor-type . bar))) 281 (if (fboundp 'modify-frame-parameters)
282 (modify-frame-parameters (selected-frame) '((cursor-type . bar))))
282 283
283 ;; Handle dragging 284 ;; Handle dragging
284 (unwind-protect 285 (unwind-protect
@@ -390,11 +391,16 @@ This should be bound to a down-mouse event."
390 ((memq (car-safe last-input-event) '(down-mouse-1 down-mouse-3)) 391 ((memq (car-safe last-input-event) '(down-mouse-1 down-mouse-3))
391 (kill-region overlay-start overlay-end) 392 (kill-region overlay-start overlay-end)
392 (deactivate-mark) 393 (deactivate-mark)
393 (read-event) (read-event))))) 394 (read-event) (read-event))
395 ((eq (car-safe last-input-event) 'double-mouse-3)
396 (kill-region overlay-start overlay-end)
397 (deactivate-mark)))))
394 398
395 ;; Restore cursor 399 ;; Restore cursor
396 (modify-frame-parameters (selected-frame) 400 (if (fboundp 'modify-frame-parameters)
397 (list (cons 'cursor-type orig-cursor-type))) 401 (modify-frame-parameters
402 (selected-frame) (list (cons 'cursor-type orig-cursor-type))))
403
398 ;; Remove overlay 404 ;; Remove overlay
399 (or mouse-sel-retain-highlight 405 (or mouse-sel-retain-highlight
400 (delete-overlay mouse-drag-overlay))))) 406 (delete-overlay mouse-drag-overlay)))))