emacs-devel
[Top][All Lists]
Advanced

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

Re: `inhibit-mark-movement'


From: Juri Linkov
Subject: Re: `inhibit-mark-movement'
Date: Wed, 08 Dec 2004 19:59:23 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Paul Pogonyshev <address@hidden> 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/





reply via email to

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