changeset 58918:2ee970dcd072

* emacs-lisp/lisp.el (beginning-of-defun, end-of-defun): Do not push mark when mark is active in transient-mark-mode. * emacs-lisp/lisp.el (mark-sexp, mark-defun): Extend the region when mark is active in transient-mark-mode, regardless of the last command. Doc fix. * emacs-lisp/lisp.el (mark-sexp): Reverse the condition for preserving direction, to mark forward instead of backward when mark is equal to point (e.g. when C-SPC C-M-SPC is typed in t-m-m).
author Juri Linkov <juri@jurta.org>
date Mon, 13 Dec 2004 03:09:59 +0000
parents 44dfc09c6b67
children ee363a1523f3
files lisp/emacs-lisp/lisp.el
diffstat 1 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el	Mon Dec 13 03:08:52 2004 +0000
+++ b/lisp/emacs-lisp/lisp.el	Mon Dec 13 03:09:59 2004 +0000
@@ -73,17 +73,18 @@
   "Set mark ARG sexps from point.
 The place mark goes is the same place \\[forward-sexp] would
 move to with the same argument.
-If this command is repeated, it marks the next ARG sexps after the ones
-already marked."
+If this command is repeated or mark is active in Transient Mark mode,
+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)))
+		     (if (< (mark) (point)) -1 1)))
 	 (set-mark
 	  (save-excursion
-	   (goto-char (mark))
-	   (forward-sexp arg)
-	   (point))))
+	    (goto-char (mark))
+	    (forward-sexp arg)
+	    (point))))
 	(t
 	 (push-mark
 	  (save-excursion
@@ -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)
@@ -289,10 +294,11 @@
 (defun mark-defun ()
   "Put mark at end of this defun, point at beginning.
 The defun marked is the one that contains point or follows point.
-If this command is repeated, marks more defuns after the ones
-already marked."
+If this command is repeated or mark is active in Transient Mark mode,
+it 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))