unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: transient-mark-mode in 22.0
Date: Thu, 09 Jun 2005 17:39:29 -0400	[thread overview]
Message-ID: <jwv8y1jqqyt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1118265475.26257.16.camel@turtle.as.arizona.edu> (JD Smith's message of "Wed, 08 Jun 2005 14:17:55 -0700")

>> 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

      parent reply	other threads:[~2005-06-09 21:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 17:24 transient-mark-mode in 22.0 JD Smith
2005-06-08 12:02 ` Richard Stallman
2005-06-08 21:17   ` JD Smith
2005-06-09 14:41     ` Richard Stallman
2005-06-09 17:54       ` JD Smith
2005-06-10 22:37         ` Richard Stallman
2005-06-10 22:49           ` JD Smith
2005-06-11 23:16             ` Richard Stallman
2005-06-12 16:29             ` Stefan Monnier
2005-06-12 16:09           ` Stefan Monnier
2005-06-13 15:02             ` Richard Stallman
2005-06-09 21:39     ` Stefan Monnier [this message]

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=jwv8y1jqqyt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /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).