diff options
| author | Kai Großjohann | 2002-02-15 08:53:15 +0000 |
|---|---|---|
| committer | Kai Großjohann | 2002-02-15 08:53:15 +0000 |
| commit | cad113ae34fd336c0ea44dacf12c267cdb94d9ce (patch) | |
| tree | dd65ff473805a1a75a4daa29ce0569317dea3f69 | |
| parent | 66c8296f833ff25ec680feaaaf2ba57f429919de (diff) | |
| download | emacs-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/NEWS | 10 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 39 | ||||
| -rw-r--r-- | lisp/simple.el | 21 | ||||
| -rw-r--r-- | lisp/textmodes/paragraphs.el | 37 | ||||
| -rw-r--r-- | man/mark.texi | 23 |
6 files changed, 93 insertions, 43 deletions
| @@ -245,9 +245,13 @@ idle time in seconds to wait before starting fontification. For | |||
| 245 | example, if you set `jit-lock-defer-time' to 0.25, fontification will | 245 | example, if you set `jit-lock-defer-time' to 0.25, fontification will |
| 246 | only happen after 0.25s of idle time. | 246 | only happen after 0.25s of idle time. |
| 247 | 247 | ||
| 248 | ** If you hit M-C-SPC (mark-sexp) repeatedly, the marked region | 248 | +++ |
| 249 | will 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 |
| 250 | M-C-SPC M-C-SPC, for example. | 250 | you hit M-C-SPC (mark-sexp), M-@ (mark-word), M-h (mark-paragraph), or |
| 251 | C-M-h (mark-defun) repeatedly, the marked region will now be extended | ||
| 252 | each time, so you can mark the next two sexps with M-C-SPC M-C-SPC, | ||
| 253 | for example. This feature also works for mark-end-of-sentence, if you | ||
| 254 | bind 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 |
| 253 | C-o displays the current line's occurrence in another window without | 257 | C-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 @@ | |||
| 1 | 2002-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 | |||
| 1 | 2002-02-15 Per Abrahamsen <abraham@dina.kvl.dk> | 7 | 2002-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. | |||
| 76 | If this command is repeated, it marks the next ARG sexps after the ones | 76 | If this command is repeated, it marks the next ARG sexps after the ones |
| 77 | already marked." | 77 | already 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. |
| 253 | The defun marked is the one that contains point or follows point." | 258 | The defun marked is the one that contains point or follows point. |
| 259 | If this command is repeated, marks more defuns after the ones | ||
| 260 | already 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. |
| 2816 | If this command is repeated, it marks the next ARG words after the ones | ||
| 2817 | already 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 | |||
| 325 | the number of paragraphs marked equals ARG. | 325 | the number of paragraphs marked equals ARG. |
| 326 | 326 | ||
| 327 | If ARG is negative, point is put at end of this paragraph, mark is put | 327 | If ARG is negative, point is put at end of this paragraph, mark is put |
| 328 | at beginning of this or a previous paragraph." | 328 | at beginning of this or a previous paragraph. |
| 329 | |||
| 330 | If this command is repeated, it marks the next ARG paragraphs after (or | ||
| 331 | before, 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'. |
| 437 | If this command is repeated, it marks the next ARG sentences after the | ||
| 438 | ones 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 |
| 279 | word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the | 279 | word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the |
| 280 | next balanced expression (@pxref{Expressions}). These commands handle | 280 | next balanced expression (@pxref{Expressions}). These commands handle |
| 281 | arguments just like @kbd{M-f} and @kbd{C-M-f}. | 281 | arguments just like @kbd{M-f} and @kbd{C-M-f}. If you repeat these |
| 282 | commands, 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, | |||
| 292 | point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also | 294 | point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also |
| 293 | marks @var{n} paragraphs, running back form the one surrounding point. | 295 | marks @var{n} paragraphs, running back form the one surrounding point. |
| 294 | In that last case, point moves forward to the end of that paragraph, | 296 | In that last case, point moves forward to the end of that paragraph, |
| 295 | and the mark goes at the start of the region. | 297 | and the mark goes at the start of the region. The @kbd{M-h} command |
| 298 | also 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 |
| 298 | mark after, the current (or following) major top-level definition, or | 302 | mark after, the current (or following) major top-level definition, or |
| 299 | defun (@pxref{Moving by Defuns}). (Currently it only marks one | 303 | defun (@pxref{Moving by Defuns}). (Currently it only marks one defun, |
| 300 | defun.) @kbd{C-x C-p} (@code{mark-page}) puts point before the | 304 | but repeating it marks more defuns, like for @kbd{M-@@}.) @kbd{C-x |
| 301 | current page, and mark at the end (@pxref{Pages}). The mark goes | 305 | C-p} (@code{mark-page}) puts point before the current page, and mark |
| 302 | after the terminating page delimiter (to include it in the region), | 306 | at the end (@pxref{Pages}). The mark goes after the terminating page |
| 303 | while point goes after the preceding page delimiter (to exclude it). | 307 | delimiter (to include it in the region), while point goes after the |
| 304 | A numeric argument specifies a later page (if positive) or an earlier | 308 | preceding page delimiter (to exclude it). A numeric argument |
| 305 | page (if negative) instead of the current page. | 309 | specifies a later page (if positive) or an earlier page (if negative) |
| 310 | instead 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 |
| 308 | buffer as the region, by putting point at the beginning and the mark at | 313 | buffer as the region, by putting point at the beginning and the mark at |