aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/lisp.el39
-rw-r--r--lisp/simple.el21
-rw-r--r--lisp/textmodes/paragraphs.el37
4 files changed, 72 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2343d88cb7..a4ed23eef5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2002-02-15 Kai Gro,A_(Bjohann <[email protected]>
+
+ * simple.el (mark-word): Mark more if repeated.
+ * textmodes/paragraphs.el (mark-paragraph): Ditto.
+ (mark-end-of-sentence): Ditto.
+
2002-02-15 Per Abrahamsen <[email protected]>
* wid-edit.el (widgetp): Made it more robust.
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index deab27f34e..a815eddfd7 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -76,13 +76,18 @@ move to with the same argument.
If this command is repeated, it marks the next ARG sexps after the ones
already marked."
(interactive "p")
- (push-mark
- (save-excursion
- (if (and (eq last-command this-command) (mark t))
- (goto-char (mark)))
- (forward-sexp (or arg 1))
- (point))
- nil t))
+ (cond ((and (eq last-command this-command) (mark t))
+ (set-mark
+ (save-excursion
+ (goto-char (mark))
+ (forward-sexp (or arg 1))
+ (point))))
+ (t
+ (push-mark
+ (save-excursion
+ (forward-sexp (or arg 1))
+ (point))
+ nil t))))
(defun forward-list (&optional arg)
"Move forward across one balanced group of parentheses.
@@ -250,13 +255,21 @@ is called as a function to find the defun's end."
(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."
+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."
(interactive)
- (push-mark (point))
- (end-of-defun)
- (push-mark (point) nil t)
- (beginning-of-defun)
- (re-search-backward "^\n" (- (point) 1) t))
+ (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))))
(defun narrow-to-defun (&optional arg)
"Make text outside current defun invisible.
diff --git a/lisp/simple.el b/lisp/simple.el
index ff36a7c187..6708af57a2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2812,13 +2812,22 @@ With argument, do this that many times."
(forward-word (- arg)))
(defun mark-word (arg)
- "Set mark arg words away from point."
+ "Set mark arg words away from point.
+If this command is repeated, it marks the next ARG words after the ones
+already marked."
(interactive "p")
- (push-mark
- (save-excursion
- (forward-word arg)
- (point))
- nil t))
+ (cond ((and (eq last-command this-command) (mark t))
+ (set-mark
+ (save-excursion
+ (goto-char (mark))
+ (forward-word arg)
+ (point))))
+ (t
+ (push-mark
+ (save-excursion
+ (forward-word arg)
+ (point))
+ nil t))))
(defun kill-word (arg)
"Kill characters forward until encountering the end of a word.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index ed9a78696f..91d9b1699f 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -325,14 +325,23 @@ With argument ARG, puts mark at end of a following paragraph, so that
the number of paragraphs marked equals ARG.
If ARG is negative, point is put at end of this paragraph, mark is put
-at beginning of this or a previous paragraph."
+at beginning of this or a previous paragraph.
+
+If this command is repeated, it marks the next ARG paragraphs after (or
+before, if arg is negative) the ones already marked."
(interactive "p")
- (unless arg (setq arg 1))
- (when (zerop arg)
- (error "Cannot mark zero paragraphs"))
- (forward-paragraph arg)
- (push-mark nil t t)
- (backward-paragraph arg))
+ (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))))
(defun kill-paragraph (arg)
"Kill forward to end of paragraph.
@@ -424,13 +433,17 @@ With arg, repeat, or kill forward to Nth end of sentence if negative arg -N."
(kill-region (point) (progn (backward-sentence arg) (point))))
(defun mark-end-of-sentence (arg)
- "Put mark at end of sentence. Arg works as in `forward-sentence'."
+ "Put mark at end of sentence. Arg works as in `forward-sentence'.
+If this command is repeated, it marks the next ARG sentences after the
+ones already marked."
(interactive "p")
(push-mark
- (save-excursion
- (forward-sentence arg)
- (point))
- nil t))
+ (save-excursion
+ (if (and (eq last-command this-command) (mark t))
+ (goto-char (mark)))
+ (forward-sentence arg)
+ (point))
+ nil t))
(defun transpose-sentences (arg)
"Interchange this (next) and previous sentence."