unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: `inhibit-mark-movement'
Date: Wed, 08 Dec 2004 19:59:23 +0200	[thread overview]
Message-ID: <871xe0y8lg.fsf@jurta.org> (raw)
In-Reply-To: <200412081740.48280.pogonyshev@gmx.net> (Paul Pogonyshev's message of "Wed, 8 Dec 2004 17:40:48 +0200")

Paul Pogonyshev <pogonyshev@gmx.net> writes:
> What I'm trying to suggest is that commands should not modify active
> mark in Transient Mark mode _by side effect_.  Commands like M-h are
> fine to modify mark, because they _activate_ it.

Yes, such commands are fine to modify mark.  But they should not
_reset_ it.  If I have selected a few words with M-@ in
transient-mark-mode, and have adjusted the beginning of the region
with a simple point movement command, I expect that the next M-@ will
continue to extend the region at its end, not to start a new one as it
currently does if consecutive commands are not the same.

Just a few days ago I looked at mark activation commands, and fixed
them (`mark-word', `mark-sexp', `mark-paragraph', `mark-defun') to
support transient-mark-mode.  The patch is below.  It could be
installed as well.

> I didn't try your patch, but looks like it implements exactly what
> I'm trying to explain.  Except that I proposed to make this
> behaviour optional.  However, this behaviour seems much more natural
> to me, so maybe customization is not necessary if we don't mind
> surprising a few users.

Very likely this behavior is what most users of transient-mark-mode
would expect.

Index: lisp/emacs-lisp/lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.58
diff -u -r1.58 lisp.el
--- lisp/emacs-lisp/lisp.el	12 Oct 2004 16:05:55 -0000	1.58
+++ lisp/emacs-lisp/lisp.el	8 Dec 2004 17:32:50 -0000
@@ -76,7 +76,8 @@
 If this command is repeated, it marks the next ARG sexps after the ones
 already marked."
   (interactive "P")
-  (cond ((and (eq last-command this-command) (mark t))
+  (cond ((or (and (eq last-command this-command) (mark t))
+	     (and transient-mark-mode mark-active))
 	 (setq arg (if arg (prefix-numeric-value arg)
 		     (if (> (mark) (point)) 1 -1)))
 	 (set-mark
@@ -292,7 +297,8 @@
 If this command is repeated, marks more defuns after the ones
 already marked."
   (interactive)
-  (cond ((and (eq last-command this-command) (mark t))
+  (cond ((or (and (eq last-command this-command) (mark t))
+	     (and transient-mark-mode mark-active))
 	 (set-mark
 	  (save-excursion
 	    (goto-char (mark))

Index: lisp/textmodes/paragraphs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/paragraphs.el,v
retrieving revision 1.75
diff -u -r1.75 paragraphs.el
--- lisp/textmodes/paragraphs.el	9 Oct 2004 18:49:01 -0000	1.75
+++ lisp/textmodes/paragraphs.el	8 Dec 2004 17:16:52 -0000
@@ -363,7 +363,8 @@
   (unless arg (setq arg 1))
   (when (zerop arg)
     (error "Cannot mark zero paragraphs"))
-  (cond ((and (eq last-command this-command) (mark t))
+  (cond ((or (and (eq last-command this-command) (mark t))
+	     (and transient-mark-mode mark-active))
 	 (set-mark
 	  (save-excursion
 	    (goto-char (mark))

Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.669
diff -u -r1.669 simple.el
--- lisp/simple.el	3 Dec 2004 22:26:13 -0000	1.669
+++ lisp/simple.el	8 Dec 2004 17:37:26 -0000
@@ -3528,7 +3600,8 @@
 If this command is repeated, it marks the next ARG words after the ones
 already marked."
   (interactive "p")
-  (cond ((and (eq last-command this-command) (mark t))
+  (cond ((or (and (eq last-command this-command) (mark t))
+	     (and transient-mark-mode mark-active))
 	 (set-mark
 	  (save-excursion
 	    (goto-char (mark))

-- 
Juri Linkov
http://www.jurta.org/emacs/

  parent reply	other threads:[~2004-12-08 17:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-08  0:56 `inhibit-mark-movement' Paul Pogonyshev
2004-12-08  3:08 ` `inhibit-mark-movement' Stefan Monnier
2004-12-08 15:40   ` `inhibit-mark-movement' Paul Pogonyshev
2004-12-08 16:59     ` `inhibit-mark-movement' Stefan Monnier
2004-12-08 17:59     ` Juri Linkov [this message]
2004-12-08 19:22       ` `inhibit-mark-movement' Stefan Monnier
2004-12-09  1:48         ` `inhibit-mark-movement' Juri Linkov
2004-12-13 19:51           ` `inhibit-mark-movement' Richard Stallman
2004-12-13 23:17             ` `inhibit-mark-movement' Stefan Monnier
2004-12-14 10:55               ` `inhibit-mark-movement' Juri Linkov
2004-12-14 11:24                 ` `inhibit-mark-movement' Stefan Monnier
2004-12-17 16:11         ` `inhibit-mark-movement' Juri Linkov
2004-12-20 10:56           ` `inhibit-mark-movement' Richard Stallman
2004-12-08  3:29 ` `inhibit-mark-movement' Juri Linkov
2004-12-08  3:46 ` `inhibit-mark-movement' Juri Linkov

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=871xe0y8lg.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).