From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: mouse.el patch for region tracking Date: Sat, 31 Dec 2005 00:00:02 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/mixed; boundary=Apple-Mail-21-938896507 X-Trace: sea.gmane.org 1136017667 16716 80.91.229.2 (31 Dec 2005 08:27:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 31 Dec 2005 08:27:47 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 31 09:27:45 2005 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Esc5Y-0001pU-Ad for ged-emacs-devel@m.gmane.org; Sat, 31 Dec 2005 09:27:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Esc6z-0005EY-QO for ged-emacs-devel@m.gmane.org; Sat, 31 Dec 2005 03:29:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EsakF-0007He-1V for emacs-devel@gnu.org; Sat, 31 Dec 2005 02:01:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EsakC-0007GC-Ks for emacs-devel@gnu.org; Sat, 31 Dec 2005 02:01:38 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EsakC-0007G3-1b for emacs-devel@gnu.org; Sat, 31 Dec 2005 02:01:36 -0500 Original-Received: from [63.240.77.81] (helo=sccrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Esakq-000625-LC for emacs-devel@gnu.org; Sat, 31 Dec 2005 02:02:16 -0500 Original-Received: from [192.168.1.3] (c-69-252-140-73.hsd1.ar.comcast.net[69.252.140.73]) by comcast.net (sccrmhc11) with SMTP id <20051231070004011005c7dme>; Sat, 31 Dec 2005 07:00:04 +0000 Original-To: emacs-devel@gnu.org X-Mailer: Apple Mail (2.746.2) X-Mailman-Approved-At: Sat, 31 Dec 2005 03:25:41 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:48569 Archived-At: --Apple-Mail-21-938896507 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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 --Apple-Mail-21-938896507 Content-Transfer-Encoding: quoted-printable Content-Type: application/octet-stream; x-unix-mode=0664; name="mouse_patch_jds.diff" Content-Disposition: attachment; filename=mouse_patch_jds.diff ***=20mouse.el=0927=20Dec=202005=2020:19:29=20-0700=091.290=0A---=20= mouse.el=0930=20Dec=202005=2021:20:28=20-0700=09=0A***************=0A***=20= 758,764=20****=0A=20=20=09=20=20(display-buffer=20(current-buffer)))=0A=20= =20=20=20=20=20=20=20;;=20Give=20temporary=20modes=20such=20as=20isearch=20= a=20chance=20to=20turn=20off.=0A=20=20=20=20=20=20=20=20(run-hooks=20= 'mouse-leave-buffer-hook)=0A!=20=20=20=20=20=20=20(mouse-drag-region-1=20= start-event))))=0A=20=20=0A=20=20=0A=20=20(defun=20mouse-on-link-p=20= (pos)=0A---=20758,764=20----=0A=20=20=09=20=20(display-buffer=20= (current-buffer)))=0A=20=20=20=20=20=20=20=20;;=20Give=20temporary=20= modes=20such=20as=20isearch=20a=20chance=20to=20turn=20off.=0A=20=20=20=20= =20=20=20=20(run-hooks=20'mouse-leave-buffer-hook)=0A!=20=20=20=20=20=20=20= (mouse-drag-track=20start-event=20t))))=0A=20=20=0A=20=20=0A=20=20(defun=20= mouse-on-link-p=20(pos)=0A***************=0A***=20858,864=20****=0A=20=20= =20=20(let=20((range=20(mouse-start-end=20start=20end=20mode)))=0A=20=20=20= =20=20=20(move-overlay=20ol=20(car=20range)=20(nth=201=20range))))=0A=20=20= =0A!=20(defun=20mouse-drag-region-1=20(start-event)=0A=20=20=20=20= (mouse-minibuffer-check=20start-event)=0A=20=20=20=20(setq=20= mouse-selection-click-count-buffer=20(current-buffer))=0A=20=20=20=20= (let*=20((original-window=20(selected-window))=0A---=20858,865=20----=0A=20= =20=20=20(let=20((range=20(mouse-start-end=20start=20end=20mode)))=0A=20=20= =20=20=20=20(move-overlay=20ol=20(car=20range)=20(nth=201=20range))))=0A=20= =20=0A!=20(defun=20mouse-drag-track=20(start-event=20=20&optional=20= handle-terminating-event)=0A!=20=20=20=20=20"Track=20mouse=20drags=20by=20= highlighting=20area=20between=20point=20and=20cursor."=0A=20=20=20=20= (mouse-minibuffer-check=20start-event)=0A=20=20=20=20(setq=20= mouse-selection-click-count-buffer=20(current-buffer))=0A=20=20=20=20= (let*=20((original-window=20(selected-window))=0A***************=0A***=20= 942,948=20****=0A=20=20=09=09=20(integer-or-marker-p=20end-point))=0A=20=20= =20=20=20=20=20=20=20=20(mouse-move-drag-overlay=20mouse-drag-overlay=20= start-point=20end-point=20click-count))=0A=20=20=0A!=20=20=20=20=20=20=20= (if=20(consp=20event)=0A=20=20=09=20=20(let*=20((fun=20(key-binding=20= (vector=20(car=20event))))=0A=20=20=09=09=20(do-multi-click=20=20=20(and=20= (>=20(event-click-count=20event)=200)=0A=20=20=09=09=09=09=09(functionp=20= fun)=0A---=20943,949=20----=0A=20=20=09=09=20(integer-or-marker-p=20= end-point))=0A=20=20=20=20=20=20=20=20=20=20(mouse-move-drag-overlay=20= mouse-drag-overlay=20start-point=20end-point=20click-count))=0A=20=20=0A= !=20=20=20=20=20=20=20(if=20(and=20(consp=20event)=20= handle-terminating-event)=0A=20=20=09=20=20(let*=20((fun=20(key-binding=20= (vector=20(car=20event))))=0A=20=20=09=09=20(do-multi-click=20=20=20(and=20= (>=20(event-click-count=20event)=200)=0A=20=20=09=09=09=09=09(functionp=20= fun)=0A***************=0A***=201030,1036=20****=0A=20=20=0A=20=20=20=20=20= =20=20=20=20=20;;=20Case=20where=20the=20end-event=20is=20not=20a=20cons=20= cell=20(it's=20just=20a=20boring=0A=20=20=20=20=20=20=20=20=20=20;;=20= char-key-press).=0A!=20=09(delete-overlay=20mouse-drag-overlay)))))=0A=20= =20=0C=0A=20=20;;=20Commands=20to=20handle=20xterm-style=20multiple=20= clicks.=0A=20=20(defun=20mouse-skip-word=20(dir)=0A---=201031,1039=20= ----=0A=20=20=0A=20=20=20=20=20=20=20=20=20=20;;=20Case=20where=20the=20= end-event=20is=20not=20a=20cons=20cell=20(it's=20just=20a=20boring=0A=20=20= =20=20=20=20=20=20=20=20;;=20char-key-press).=0A!=20=09(unless=20(and=20= transient-mark-mode=20=0A!=20=09=09=20=20=20=20=20(consp=20event))=0A!=20= =09=20=20(delete-overlay=20mouse-drag-overlay))))))=0A=20=20=0C=0A=20=20= ;;=20Commands=20to=20handle=20xterm-style=20multiple=20clicks.=0A=20=20= (defun=20mouse-skip-word=20(dir)=0A= --Apple-Mail-21-938896507 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --Apple-Mail-21-938896507--