[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`mouse-drag-cursor-type' suggestion
From: |
John Paul Wallington |
Subject: |
`mouse-drag-cursor-type' suggestion |
Date: |
Thu, 07 Nov 2002 21:56:26 +0000 |
In my .emacs file I have this little hack (I have a box cursor):
;;LispWorks-style cursor-type change on down-mouse-1
(defadvice mouse-drag-region
(around change-cursor-type-on-down-mouse-1 activate compile)
"Change `cursor-type' to bar whilst <down-mouse-1>."
(let ((cursor-type '(bar . 2)))
ad-do-it))
I like the effect. Perhaps it could be offered as a customizable
variable in Emacs. A patch follows. WDYT?
--- /build-emacs/emacs/lisp/mouse.el.~1.241.~ Wed May 29 17:36:55 2002
+++ /build-emacs/emacs/lisp/mouse.el Thu Nov 7 21:35:42 2002
@@ -692,9 +692,30 @@
(defvar mouse-selection-click-count-buffer nil)
+(defcustom mouse-drag-cursor-type t
+ "Cursor to use while `mouse-drag-region' is running.
+`mouse-drag-region' is bound to \\[mouse-drag-region].
+
+Values are interpreted as follows:
+
+ t use the default cursor
+ nil don't display a cursor
+ bar display a bar cursor with default width
+ (bar . WIDTH) display a bar cursor with width WIDTH
+ ANYTHING ELSE display a box cursor."
+ :type '(choice (const :tag "Default cursor" t)
+ (const :tag "Bar cursor, default width" bar)
+ (cons :tag "Bar cursor, specify width"
+ (const :tag "Bar cursor" bar)
+ (integer :tag "Width (in pixels)" 1))
+ (const :tag "Box cursor" box)
+ (const :tag "No cursor" nil))
+ :group 'mouse)
+
(defun mouse-drag-region (start-event)
"Set the region to the text that the mouse is dragged over.
Highlight the drag area as you move the mouse.
+The cursor obeys `mouse-drag-cursor-type'.
This must be bound to a button-down mouse event.
In Transient Mark mode, the highlighting remains as long as the mark
remains active. Otherwise, it remains until the next input event.
@@ -711,7 +732,10 @@
(display-buffer (current-buffer)))
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
- (mouse-drag-region-1 start-event))))
+ (let ((cursor-type (if (eq mouse-drag-cursor-type t)
+ cursor-type
+ mouse-drag-cursor-type)))
+ (mouse-drag-region-1 start-event)))))
(defun mouse-drag-region-1 (start-event)
(mouse-minibuffer-check start-event)
--
John Paul Wallington
- `mouse-drag-cursor-type' suggestion,
John Paul Wallington <=