* `mouse-drag-cursor-type' suggestion
@ 2002-11-07 21:56 John Paul Wallington
2002-11-09 11:55 ` Richard Stallman
0 siblings, 1 reply; 3+ messages in thread
From: John Paul Wallington @ 2002-11-07 21:56 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `mouse-drag-cursor-type' suggestion
2002-11-07 21:56 `mouse-drag-cursor-type' suggestion John Paul Wallington
@ 2002-11-09 11:55 ` Richard Stallman
2002-11-10 0:49 ` John Paul Wallington
0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2002-11-09 11:55 UTC (permalink / raw)
Cc: emacs-devel
I like the effect. Perhaps it could be offered as a customizable
variable in Emacs. A patch follows. WDYT?
I tried it and noted the drawback that the bar cursor remains after
I stop dragging. That looks wrong.
I thought that adding a call (sit-for 0) at the end of
mouse-drag-region, outside the let, would fix this, but it did not.
Perhaps now redisplay only looks at cursor-type if it needs to
redisplay the cursor for other reasons. If so, it would need to be
changed to notice if the type of cursor has changed, and redisplay the
cursor if so.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `mouse-drag-cursor-type' suggestion
2002-11-09 11:55 ` Richard Stallman
@ 2002-11-10 0:49 ` John Paul Wallington
0 siblings, 0 replies; 3+ messages in thread
From: John Paul Wallington @ 2002-11-10 0:49 UTC (permalink / raw)
Cc: emacs-devel
> I like the effect. Perhaps it could be offered as a customizable
> variable in Emacs. A patch follows. WDYT?
>
> I tried it and noted the drawback that the bar cursor remains after
> I stop dragging. That looks wrong.
Argh. Presently, it only works when transient-mark-mode is on.
I'll investigate further. The variable should probably be called
`mouse-drag-region-cursor-type' rather than `mouse-drag-cursor-type'
too.
--
John Paul Wallington
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-11-10 0:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-07 21:56 `mouse-drag-cursor-type' suggestion John Paul Wallington
2002-11-09 11:55 ` Richard Stallman
2002-11-10 0:49 ` John Paul Wallington
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).