From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: transient-mark-mode in 22.0 Date: Thu, 09 Jun 2005 17:39:29 -0400 Message-ID: References: <1118265475.26257.16.camel@turtle.as.arizona.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118353022 12901 80.91.229.2 (9 Jun 2005 21:37:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Jun 2005 21:37:02 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 09 23:36:54 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DgUhO-0001ya-KO for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2005 23:36:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DgUoN-0001oF-6X for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2005 17:43:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DgUo4-0001mM-Jj for emacs-devel@gnu.org; Thu, 09 Jun 2005 17:43:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DgUo0-0001ku-T7 for emacs-devel@gnu.org; Thu, 09 Jun 2005 17:43:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DgUo0-0001jo-GW for emacs-devel@gnu.org; Thu, 09 Jun 2005 17:43:16 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DgUkh-0008Ky-NT; Thu, 09 Jun 2005 17:39:52 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 43CD32CF41A; Thu, 9 Jun 2005 17:39:33 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id F37954AC008; Thu, 9 Jun 2005 17:39:29 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id DE69CE6C17; Thu, 9 Jun 2005 17:39:29 -0400 (EDT) Original-To: JD Smith In-Reply-To: <1118265475.26257.16.camel@turtle.as.arizona.edu> (JD Smith's message of "Wed, 08 Jun 2005 14:17:55 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.844, requis 5, autolearn=not spam, AWL 0.06, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca 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:38462 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38462 >> I noticed that setting the transient-mark-mode variable no longer does >> anything >> >> As far as I can see, it still does what it always did. >> Did you actually observe that it fails to work? > Only in so far as I expected transient-mark-mode to allow mouse-drag- > region to return upon mouse-up, which it used to do under 21.x. So in > that sense, it fails to work. It may well be that all other features of > transient-mark-mode do work when the variable is set. > In Emacs 21.X, when bound to a mouse-down event, this: > (defun do-drag (event) > (interactive "e") > (let ((transient-mark-mode t)) ; transient mark > (message "DRAG STARTED") > (mouse-drag-region event) > (message "DRAG FINISHED"))) > and this: > (defun do-drag (event) > (interactive "e") > (let ((transient-mark-mode nil)) ; no transient-mark > (message "DRAG STARTED") > (mouse-drag-region event) > (message "DRAG FINISHED"))) > produce different behavior w.r.t. mouse-up. In 22.0, they produce the > same behavior. Unfortunately, it's not the behavior I need. I believe this is due to the change revision 1.252 date: 2004/10/27 17:44:59; author: rms; state: Exp; lines: +49 -48 (mouse-show-mark): Do most processing the same regardless of transient-mark-mode. ---------------------------- This code in mouse-show-mark is also responsible for the problem where flyspell's mouse-2 also does a yank, reported a while back, and probably a few other similar bug reports. Before 1.252 the problem was only affecting users who don't use transient-mark-mode. To fix this problem, I maybe mouse-show-mark should be rewritten to not use (read-event), but instead to use something like pre-command-hook. Looking at the code of mouse-show-mark, it's pretty messed up: - in the code below, (and (consp event) (or (eq (car event) 'switch-frame) (eq (posn-point (event-end event)) 'vertical-scroll-bar)) (let ((keys (vector 'vertical-scroll-bar event))) (and (key-binding keys) (progn (call-interactively (key-binding keys) nil keys) (setq events nil))))))) if the event is `switch-frame', we'll do a key lookup for [vertical-scroll-bar switch-frame] which of course will fail. - since the while loop is expected to execute code such as handle-switch-frame (which it luckily doesn't), the selected buffer might get changed before we reach the end where we do (delete-region (mark t) (point)), so if we fix the above error, we bump into another. - the overlay management has apparently been rendered completely useless by the use of the temporary transient-mark-mode. So all that this code really does is implement the mouse-region-delete-keys. This variable was introduced in 1996, but is not documented anywhere. Does anybody use this? (I expect that people who want such a functionality probably use delete-selection-mode instead anyway). I.e. if could drop mouse-region-delete-keys, then we could completely remove mouse-show-mark and the associated bugs. Stefan