aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-02-15 08:53:15 +0000
committerKai Großjohann2002-02-15 08:53:15 +0000
commitcad113ae34fd336c0ea44dacf12c267cdb94d9ce (patch)
treedd65ff473805a1a75a4daa29ce0569317dea3f69
parent66c8296f833ff25ec680feaaaf2ba57f429919de (diff)
downloademacs-cad113ae34fd336c0ea44dacf12c267cdb94d9ce.tar.gz
emacs-cad113ae34fd336c0ea44dacf12c267cdb94d9ce.zip
* lisp/simple.el (mark-word): Mark more if repeated.
* lisp/textmodes/paragraphs.el (mark-paragraph): Ditto. (mark-end-of-sentence): Ditto.
-rw-r--r--etc/NEWS10
-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
-rw-r--r--man/mark.texi23
6 files changed, 93 insertions, 43 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 210fd452cfc..06e6553a54b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -245,9 +245,13 @@ idle time in seconds to wait before starting fontification. For
245example, if you set `jit-lock-defer-time' to 0.25, fontification will 245example, if you set `jit-lock-defer-time' to 0.25, fontification will
246only happen after 0.25s of idle time. 246only happen after 0.25s of idle time.
247 247
248** If you hit M-C-SPC (mark-sexp) repeatedly, the marked region 248+++
249will now be extended each time, so you can mark the next two sexps with 249** Marking commands extend the region when invoked multiple times. If
250M-C-SPC M-C-SPC, for example. 250you hit M-C-SPC (mark-sexp), M-@ (mark-word), M-h (mark-paragraph), or
251C-M-h (mark-defun) repeatedly, the marked region will now be extended
252each time, so you can mark the next two sexps with M-C-SPC M-C-SPC,
253for example. This feature also works for mark-end-of-sentence, if you
254bind that to a key.
251 255
252** In the *Occur* buffer, `o' switches to it in another window, and 256** In the *Occur* buffer, `o' switches to it in another window, and
253C-o displays the current line's occurrence in another window without 257C-o displays the current line's occurrence in another window without
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2343d88cb71..a4ed23eef55 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12002-02-15 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
2
3 * simple.el (mark-word): Mark more if repeated.
4 * textmodes/paragraphs.el (mark-paragraph): Ditto.
5 (mark-end-of-sentence): Ditto.
6
12002-02-15 Per Abrahamsen <abraham@dina.kvl.dk> 72002-02-15 Per Abrahamsen <abraham@dina.kvl.dk>
2 8
3 * wid-edit.el (widgetp): Made it more robust. 9 * wid-edit.el (widgetp): Made it more robust.
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index deab27f34e7..a815eddfd78 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -76,13 +76,18 @@ move to with the same argument.
76If this command is repeated, it marks the next ARG sexps after the ones 76If this command is repeated, it marks the next ARG sexps after the ones
77already marked." 77already marked."
78 (interactive "p") 78 (interactive "p")
79 (push-mark 79 (cond ((and (eq last-command this-command) (mark t))
80 (save-excursion 80 (set-mark
81 (if (and (eq last-command this-command) (mark t)) 81 (save-excursion
82 (goto-char (mark))) 82 (goto-char (mark))
83 (forward-sexp (or arg 1)) 83 (forward-sexp (or arg 1))
84 (point)) 84 (point))))
85 nil t)) 85 (t
86 (push-mark
87 (save-excursion
88 (forward-sexp (or arg 1))
89 (point))
90 nil t))))
86 91
87(defun forward-list (&optional arg) 92(defun forward-list (&optional arg)
88 "Move forward across one balanced group of parentheses. 93 "Move forward across one balanced group of parentheses.
@@ -250,13 +255,21 @@ is called as a function to find the defun's end."
250 255
251(defun mark-defun () 256(defun mark-defun ()
252 "Put mark at end of this defun, point at beginning. 257 "Put mark at end of this defun, point at beginning.
253The defun marked is the one that contains point or follows point." 258The defun marked is the one that contains point or follows point.
259If this command is repeated, marks more defuns after the ones
260already marked."
254 (interactive) 261 (interactive)
255 (push-mark (point)) 262 (let (here)
256 (end-of-defun) 263 (when (and (eq last-command this-command) (mark t))
257 (push-mark (point) nil t) 264 (setq here (point))
258 (beginning-of-defun) 265 (goto-char (mark)))
259 (re-search-backward "^\n" (- (point) 1) t)) 266 (push-mark (point))
267 (end-of-defun)
268 (push-mark (point) nil t)
269 (if here
270 (goto-char here)
271 (beginning-of-defun)
272 (re-search-backward "^\n" (- (point) 1) t))))
260 273
261(defun narrow-to-defun (&optional arg) 274(defun narrow-to-defun (&optional arg)
262 "Make text outside current defun invisible. 275 "Make text outside current defun invisible.
diff --git a/lisp/simple.el b/lisp/simple.el
index ff36a7c1873..6708af57a2c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2812,13 +2812,22 @@ With argument, do this that many times."
2812 (forward-word (- arg))) 2812 (forward-word (- arg)))
2813 2813
2814(defun mark-word (arg) 2814(defun mark-word (arg)
2815 "Set mark arg words away from point." 2815 "Set mark arg words away from point.
2816If this command is repeated, it marks the next ARG words after the ones
2817already marked."
2816 (interactive "p") 2818 (interactive "p")
2817 (push-mark 2819 (cond ((and (eq last-command this-command) (mark t))
2818 (save-excursion 2820 (set-mark
2819 (forward-word arg) 2821 (save-excursion
2820 (point)) 2822 (goto-char (mark))
2821 nil t)) 2823 (forward-word arg)
2824 (point))))
2825 (t
2826 (push-mark
2827 (save-excursion
2828 (forward-word arg)
2829 (point))
2830 nil t))))
2822 2831
2823(defun kill-word (arg) 2832(defun kill-word (arg)
2824 "Kill characters forward until encountering the end of a word. 2833 "Kill characters forward until encountering the end of a word.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index ed9a78696fd..91d9b1699f9 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
325the number of paragraphs marked equals ARG. 325the number of paragraphs marked equals ARG.
326 326
327If ARG is negative, point is put at end of this paragraph, mark is put 327If ARG is negative, point is put at end of this paragraph, mark is put
328at beginning of this or a previous paragraph." 328at beginning of this or a previous paragraph.
329
330If this command is repeated, it marks the next ARG paragraphs after (or
331before, if arg is negative) the ones already marked."
329 (interactive "p") 332 (interactive "p")
330 (unless arg (setq arg 1)) 333 (let (here)
331 (when (zerop arg) 334 (unless arg (setq arg 1))
332 (error "Cannot mark zero paragraphs")) 335 (when (zerop arg)
333 (forward-paragraph arg) 336 (error "Cannot mark zero paragraphs"))
334 (push-mark nil t t) 337 (when (and (eq last-command this-command) (mark t))
335 (backward-paragraph arg)) 338 (setq here (point))
339 (goto-char (mark)))
340 (forward-paragraph arg)
341 (push-mark nil t t)
342 (if here
343 (goto-char here)
344 (backward-paragraph arg))))
336 345
337(defun kill-paragraph (arg) 346(defun kill-paragraph (arg)
338 "Kill forward to end of paragraph. 347 "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."
424 (kill-region (point) (progn (backward-sentence arg) (point)))) 433 (kill-region (point) (progn (backward-sentence arg) (point))))
425 434
426(defun mark-end-of-sentence (arg) 435(defun mark-end-of-sentence (arg)
427 "Put mark at end of sentence. Arg works as in `forward-sentence'." 436 "Put mark at end of sentence. Arg works as in `forward-sentence'.
437If this command is repeated, it marks the next ARG sentences after the
438ones already marked."
428 (interactive "p") 439 (interactive "p")
429 (push-mark 440 (push-mark
430 (save-excursion 441 (save-excursion
431 (forward-sentence arg) 442 (if (and (eq last-command this-command) (mark t))
432 (point)) 443 (goto-char (mark)))
433 nil t)) 444 (forward-sentence arg)
445 (point))
446 nil t))
434 447
435(defun transpose-sentences (arg) 448(defun transpose-sentences (arg)
436 "Interchange this (next) and previous sentence." 449 "Interchange this (next) and previous sentence."
diff --git a/man/mark.texi b/man/mark.texi
index 7cdc5a24fc8..4b3c28814a4 100644
--- a/man/mark.texi
+++ b/man/mark.texi
@@ -278,7 +278,9 @@ Put region around current page (@code{mark-page}).
278@kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next 278@kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next
279word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the 279word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the
280next balanced expression (@pxref{Expressions}). These commands handle 280next balanced expression (@pxref{Expressions}). These commands handle
281arguments just like @kbd{M-f} and @kbd{C-M-f}. 281arguments just like @kbd{M-f} and @kbd{C-M-f}. If you repeat these
282commands, the region is extended. For example, you can type either
283@kbd{C-u 2 M-@@} or @kbd{M-@@ M-@@} to mark the next two words.
282 284
283@kindex C-x h 285@kindex C-x h
284@findex mark-whole-buffer 286@findex mark-whole-buffer
@@ -292,17 +294,20 @@ paragraph. With prefix argument, if the argument's value is positive,
292point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also 294point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also
293marks @var{n} paragraphs, running back form the one surrounding point. 295marks @var{n} paragraphs, running back form the one surrounding point.
294In that last case, point moves forward to the end of that paragraph, 296In that last case, point moves forward to the end of that paragraph,
295and the mark goes at the start of the region. 297and the mark goes at the start of the region. The @kbd{M-h} command
298also supports the extension of the region, similar to @kbd{M-@@} and
299@kbd{C-M-@@}.
296 300
297 @kbd{C-M-h} (@code{mark-defun}) similarly puts point before, and the 301 @kbd{C-M-h} (@code{mark-defun}) similarly puts point before, and the
298mark after, the current (or following) major top-level definition, or 302mark after, the current (or following) major top-level definition, or
299defun (@pxref{Moving by Defuns}). (Currently it only marks one 303defun (@pxref{Moving by Defuns}). (Currently it only marks one defun,
300defun.) @kbd{C-x C-p} (@code{mark-page}) puts point before the 304but repeating it marks more defuns, like for @kbd{M-@@}.) @kbd{C-x
301current page, and mark at the end (@pxref{Pages}). The mark goes 305C-p} (@code{mark-page}) puts point before the current page, and mark
302after the terminating page delimiter (to include it in the region), 306at the end (@pxref{Pages}). The mark goes after the terminating page
303while point goes after the preceding page delimiter (to exclude it). 307delimiter (to include it in the region), while point goes after the
304A numeric argument specifies a later page (if positive) or an earlier 308preceding page delimiter (to exclude it). A numeric argument
305page (if negative) instead of the current page. 309specifies a later page (if positive) or an earlier page (if negative)
310instead of the current page.
306 311
307 Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire 312 Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire
308buffer as the region, by putting point at the beginning and the mark at 313buffer as the region, by putting point at the beginning and the mark at