[Top][All Lists]
[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 05:29:33 +0200 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Paul Pogonyshev <address@hidden> writes:
> In Transient Mark mode commands that use `inhibit-mark-movement'
> variable have one more desirable (to me, at least) behaviour:
>
> When in transient mark mode and the mark is active, don't
> move it. If the mark is inactive, do move it.
>
> The latter is useful because it enable popping to the position
> where command was invoked.
I already encountered the same problem some time ago. I fixed it as
below and really like this. It makes use of transient-mark-mode
more natural: the mark should not be changed when it is active.
If there is a need to set a new mark when the mark is already
active, it's possible to deactivates the current region with C-g,
and set a new mark.
I could install the patch if everyone agrees.
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 03:17:27 -0000
@@ -659,8 +663,10 @@
Don't use this command in Lisp programs!
\(goto-char (point-min)) is faster and avoids clobbering the mark."
(interactive "P")
- (unless (or inhibit-mark-movement (consp arg))
- (push-mark))
+ (or inhibit-mark-movement
+ (consp arg)
+ (and transient-mark-mode mark-active)
+ (push-mark))
(let ((size (- (point-max) (point-min))))
(goto-char (if (and arg (not (consp arg)))
(+ (point-min)
@@ -683,8 +689,10 @@
Don't use this command in Lisp programs!
\(goto-char (point-max)) is faster and avoids clobbering the mark."
(interactive "P")
- (unless (or inhibit-mark-movement (consp arg))
- (push-mark))
+ (or inhibit-mark-movement
+ (consp arg)
+ (and transient-mark-mode mark-active)
+ (push-mark))
(let ((size (- (point-max) (point-min))))
(goto-char (if (and arg (not (consp arg)))
(- (point-max)
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 03:22:13 -0000
@@ -191,9 +192,11 @@
If variable `beginning-of-defun-function' is non-nil, its value
is called as a function to find the defun's beginning."
(interactive "p")
- (and (eq this-command 'beginning-of-defun)
- (or inhibit-mark-movement (eq last-command 'beginning-of-defun)
- (push-mark)))
+ (or inhibit-mark-movement
+ (not (eq this-command 'beginning-of-defun))
+ (eq last-command 'beginning-of-defun)
+ (and transient-mark-mode mark-active)
+ (push-mark))
(and (beginning-of-defun-raw arg)
(progn (beginning-of-line) t)))
@@ -242,9 +245,11 @@
If variable `end-of-defun-function' is non-nil, its value
is called as a function to find the defun's end."
(interactive "p")
- (and (eq this-command 'end-of-defun)
- (or inhibit-mark-movement (eq last-command 'end-of-defun)
- (push-mark)))
+ (or inhibit-mark-movement
+ (not (eq this-command 'end-of-defun))
+ (eq last-command 'end-of-defun)
+ (and transient-mark-mode mark-active)
+ (push-mark))
(if (or (null arg) (= arg 0)) (setq arg 1))
(if end-of-defun-function
(if (> arg 0)
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: `inhibit-mark-movement', (continued)
- Re: `inhibit-mark-movement', Stefan Monnier, 2004/12/08
- Re: `inhibit-mark-movement', Juri Linkov, 2004/12/08
- Re: `inhibit-mark-movement', Stefan Monnier, 2004/12/08
- Re: `inhibit-mark-movement', Juri Linkov, 2004/12/08
- Re: `inhibit-mark-movement', Richard Stallman, 2004/12/13
- Re: `inhibit-mark-movement', Stefan Monnier, 2004/12/13
- Re: `inhibit-mark-movement', Juri Linkov, 2004/12/14
- Re: `inhibit-mark-movement', Stefan Monnier, 2004/12/14
- Re: `inhibit-mark-movement', Juri Linkov, 2004/12/17
- Re: `inhibit-mark-movement', Richard Stallman, 2004/12/20
Re: `inhibit-mark-movement',
Juri Linkov <=
Re: `inhibit-mark-movement', Juri Linkov, 2004/12/07