unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: jpw@shootybangbang.com (John Paul Wallington)
Subject: `mouse-drag-cursor-type' suggestion
Date: Thu, 07 Nov 2002 21:56:26 +0000	[thread overview]
Message-ID: <E189udW-0007Hj-00@bundalo.shootybangbang.com> (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

             reply	other threads:[~2002-11-07 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-07 21:56 John Paul Wallington [this message]
2002-11-09 11:55 ` `mouse-drag-cursor-type' suggestion Richard Stallman
2002-11-10  0:49   ` John Paul Wallington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E189udW-0007Hj-00@bundalo.shootybangbang.com \
    --to=jpw@shootybangbang.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).