changeset 43384:cc3ba2d0d471

* emacs-lisp/lisp.el (mark-defun): Don't leave multiple marks when repeated. * textmodes/paragraphs.el (mark-paragraph): Ditto.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Sun, 17 Feb 2002 15:07:35 +0000
parents d21a74d23497
children c4bde2dbccae
files lisp/emacs-lisp/lisp.el lisp/textmodes/paragraphs.el
diffstat 2 files changed, 25 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el	Sun Feb 17 12:15:17 2002 +0000
+++ b/lisp/emacs-lisp/lisp.el	Sun Feb 17 15:07:35 2002 +0000
@@ -259,17 +259,18 @@
 If this command is repeated, marks more defuns after the ones
 already marked."
   (interactive)
-  (let (here)
-    (when (and (eq last-command this-command) (mark t))
-      (setq here (point))
-      (goto-char (mark)))
-    (push-mark (point))
-    (end-of-defun)
-    (push-mark (point) nil t)
-    (if here
-	(goto-char here)
-      (beginning-of-defun)
-      (re-search-backward "^\n" (- (point) 1) t))))
+  (cond ((and (eq last-command this-command) (mark t))
+	 (set-mark
+	  (save-excursion
+	    (goto-char (mark))
+	    (end-of-defun)
+	    (point))))
+	(t
+	 (push-mark (point))
+	 (end-of-defun)
+	 (push-mark (point) nil t)
+	 (beginning-of-defun)
+	 (re-search-backward "^\n" (- (point) 1) t))))
 
 (defun narrow-to-defun (&optional arg)
   "Make text outside current defun invisible.
--- a/lisp/textmodes/paragraphs.el	Sun Feb 17 12:15:17 2002 +0000
+++ b/lisp/textmodes/paragraphs.el	Sun Feb 17 15:07:35 2002 +0000
@@ -330,18 +330,19 @@
 If this command is repeated, it marks the next ARG paragraphs after (or
 before, if arg is negative) the ones already marked."
   (interactive "p")
-  (let (here)
-    (unless arg (setq arg 1))
-    (when (zerop arg)
-      (error "Cannot mark zero paragraphs"))
-    (when (and (eq last-command this-command) (mark t))
-      (setq here (point))
-      (goto-char (mark)))
-    (forward-paragraph arg)
-    (push-mark nil t t)
-    (if here
-	(goto-char here)
-      (backward-paragraph arg))))
+  (unless arg (setq arg 1))
+  (when (zerop arg)
+    (error "Cannot mark zero paragraphs"))
+  (cond ((and (eq last-command this-command) (mark t))
+	 (set-mark
+	  (save-excursion
+	    (goto-char (mark))
+	    (forward-paragraph arg)
+	    (point))))
+	(t
+	 (forward-paragraph arg)
+	 (push-mark nil t t)
+	 (backward-paragraph arg))))
 
 (defun kill-paragraph (arg)
   "Kill forward to end of paragraph.