emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Marking with the mouse


From: Stefan Monnier
Subject: Marking with the mouse
Date: 09 Sep 2003 16:38:56 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Someone in gnu.emacs.help recently complained about the weird behavior of
the highlighting when you drag the mouse while pressing mouse-1:
the selected text is highlighted during the drag but the highlighting
disappears immediately after that.  I was thinking that maybe it's a good
idea to use the transient transient-mark-mode in this case, so that marking
with the mouse always behaves like transient-mark-mode.  This is based on
the idea that those who dislike transient-mark-mode probably don't often use
the mouse to select the region.

Any comment ?


        Stefan


--- mouse.el.~1.243.~   Mon Sep  8 19:10:04 2003
+++ mouse.el    Tue Sep  9 16:34:00 2003
@@ -1,6 +1,6 @@
 ;;; mouse.el --- window system-independent mouse support
 
-;; Copyright (C) 1993, 1994, 1995, 1999, 2000, 2001
+;; Copyright (C) 1993, 1994, 1995, 1999, 2000, 2001, 2003
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -622,6 +622,8 @@
     (mouse-set-region-1)))
 
 (defun mouse-set-region-1 ()
+  ;; Set transient-mark-mode for a little while.
+  (setq transient-mark-mode 'lambda)
   (setq mouse-last-region-beg (region-beginning))
   (setq mouse-last-region-end (region-end))
   (setq mouse-last-region-tick (buffer-modified-tick)))
@@ -702,8 +704,8 @@
 If the click is in the echo area, display the `*Messages*' buffer."
   (interactive "e")
   (let ((w (posn-window (event-start start-event))))
-    (if (not (or (not (window-minibuffer-p w))
-                (minibuffer-window-active-p w)))
+    (if (and (window-minibuffer-p w)
+            (not (minibuffer-window-active-p w)))
        (save-excursion
          (read-event)
          (set-buffer "*Messages*")
@@ -858,8 +860,7 @@
                         (or end-point
                             (= (window-start start-window)
                                start-window-start)))
-               (setq unread-command-events
-                     (cons event unread-command-events)))))
+               (push event unread-command-events))))
        (delete-overlay mouse-drag-overlay)))))
 
 ;; Commands to handle xterm-style multiple clicks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]