From: JD Smith <jdsmith@as.arizona.edu>
Subject: mouse.el patch for region tracking
Date: Sat, 31 Dec 2005 00:00:02 -0700 [thread overview]
Message-ID: <CF83CE0F-2AD4-4E2B-B6B4-9725C63066FE@as.arizona.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]
Recently I found that Emacs 22 breaks a simple usage of mouse-drag-
region for defining regions by mouse drag. When transient-mark-mode
is set, mouse-drag-region under Emacs 21 would let you define a
region by dragging, and when the drag is released, it completes (at
which point you can operate on the region). This is somewhat similar
to the XEmacs function 'mouse-track'.
With Emacs 22, several changes were introduced to mouse-drag-region
(unrelated improvements) which broke this apparently unsupported
usage. This breaks a very useful drag-to-inspect functionality in my
IDLWAVE programming mode. The call to mouse-drag-region would not
complete without an additional event after the drag completes.
Since I want all the rich behavior of mouse-drag-region (double- and
triple-click select by word and line, etc.), a very simple fix is to
re-christen 'mouse-drag-region-1' as 'mouse-drag-track', and provide
it an optional argument to enable calling the final event handling
code which was tripping me up. Then I can use this functio
I have to admit having understood little of the code I've wrapped in
'handle-terminating-event', only that it indirectly calls read-event
via 'mouse-show-mark' and thus blocks the return of the function,
thus breaking of my old use of mouse-drag-region. I would appreciate
it if you could look this over and see if it's doing what I want it
to (inasmuch as I've communicated that). In particular the doc
string is a bit weak if this function were to be advertised for more
general usage by programmers.
JD
[-- Attachment #2: mouse_patch_jds.diff --]
[-- Type: application/octet-stream, Size: 2708 bytes --]
*** mouse.el 27 Dec 2005 20:19:29 -0700 1.290
--- mouse.el 30 Dec 2005 21:20:28 -0700
***************
*** 758,764 ****
(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))))
(defun mouse-on-link-p (pos)
--- 758,764 ----
(display-buffer (current-buffer)))
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
! (mouse-drag-track start-event t))))
(defun mouse-on-link-p (pos)
***************
*** 858,864 ****
(let ((range (mouse-start-end start end mode)))
(move-overlay ol (car range) (nth 1 range))))
! (defun mouse-drag-region-1 (start-event)
(mouse-minibuffer-check start-event)
(setq mouse-selection-click-count-buffer (current-buffer))
(let* ((original-window (selected-window))
--- 858,865 ----
(let ((range (mouse-start-end start end mode)))
(move-overlay ol (car range) (nth 1 range))))
! (defun mouse-drag-track (start-event &optional handle-terminating-event)
! "Track mouse drags by highlighting area between point and cursor."
(mouse-minibuffer-check start-event)
(setq mouse-selection-click-count-buffer (current-buffer))
(let* ((original-window (selected-window))
***************
*** 942,948 ****
(integer-or-marker-p end-point))
(mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count))
! (if (consp event)
(let* ((fun (key-binding (vector (car event))))
(do-multi-click (and (> (event-click-count event) 0)
(functionp fun)
--- 943,949 ----
(integer-or-marker-p end-point))
(mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count))
! (if (and (consp event) handle-terminating-event)
(let* ((fun (key-binding (vector (car event))))
(do-multi-click (and (> (event-click-count event) 0)
(functionp fun)
***************
*** 1030,1036 ****
;; Case where the end-event is not a cons cell (it's just a boring
;; char-key-press).
! (delete-overlay mouse-drag-overlay)))))
\f
;; Commands to handle xterm-style multiple clicks.
(defun mouse-skip-word (dir)
--- 1031,1039 ----
;; Case where the end-event is not a cons cell (it's just a boring
;; char-key-press).
! (unless (and transient-mark-mode
! (consp event))
! (delete-overlay mouse-drag-overlay))))))
\f
;; Commands to handle xterm-style multiple clicks.
(defun mouse-skip-word (dir)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next reply other threads:[~2005-12-31 7:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-31 7:00 JD Smith [this message]
2005-12-31 15:13 ` mouse.el patch for region tracking Chong Yidong
2005-12-31 19:19 ` JD Smith
2005-12-31 15:45 ` Andreas Schwab
2005-12-31 16:38 ` Stefan Monnier
2006-01-01 22:48 ` Kim F. Storm
2006-01-01 23:09 ` Stefan Monnier
2006-01-02 9:38 ` Kim F. Storm
2006-01-02 21:20 ` JD Smith
2006-01-03 1:45 ` Stefan Monnier
2006-01-03 4:40 ` JD Smith
2006-01-03 15:37 ` Stefan Monnier
2006-01-03 17:25 ` JD Smith
2006-01-01 2:15 ` Richard M. Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CF83CE0F-2AD4-4E2B-B6B4-9725C63066FE@as.arizona.edu \
--to=jdsmith@as.arizona.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.