comparison lisp/textmodes/paragraphs.el @ 59179:4b5e5c2f1ee0

(mark-paragraph): New arg ALLOW-EXTEND enables the feature to extend the existing region.
author Richard M. Stallman <rms@gnu.org>
date Wed, 29 Dec 2004 01:34:31 +0000
parents ee363a1523f3
children a8fa7c632ee4 95879cc1ed20
comparison
equal deleted inserted replaced
59178:abe8f4f2982c 59179:4b5e5c2f1ee0
345 See `forward-paragraph' for more information." 345 See `forward-paragraph' for more information."
346 (interactive "p") 346 (interactive "p")
347 (or arg (setq arg 1)) 347 (or arg (setq arg 1))
348 (forward-paragraph (- arg))) 348 (forward-paragraph (- arg)))
349 349
350 (defun mark-paragraph (&optional arg) 350 (defun mark-paragraph (&optional arg allow-extend)
351 "Put point at beginning of this paragraph, mark at end. 351 "Put point at beginning of this paragraph, mark at end.
352 The paragraph marked is the one that contains point or follows point. 352 The paragraph marked is the one that contains point or follows point.
353 353
354 With argument ARG, puts mark at end of a following paragraph, so that 354 With argument ARG, puts mark at end of a following paragraph, so that
355 the number of paragraphs marked equals ARG. 355 the number of paragraphs marked equals ARG.
356 356
357 If ARG is negative, point is put at end of this paragraph, mark is put 357 If ARG is negative, point is put at end of this paragraph, mark is put
358 at beginning of this or a previous paragraph. 358 at beginning of this or a previous paragraph.
359 359
360 If this command is repeated or mark is active in Transient Mark mode, 360 Interactively, if this command is repeated
361 it marks the next ARG paragraphs after (or before, if arg is negative) 361 or (in Transient Mark mode) if the mark is active,
362 the ones already marked." 362 it marks the next ARG paragraphs after the ones already marked."
363 (interactive "p") 363 (interactive "p\np")
364 (unless arg (setq arg 1)) 364 (unless arg (setq arg 1))
365 (when (zerop arg) 365 (when (zerop arg)
366 (error "Cannot mark zero paragraphs")) 366 (error "Cannot mark zero paragraphs"))
367 (cond ((or (and (eq last-command this-command) (mark t)) 367 (cond ((and allow-extend
368 (and transient-mark-mode mark-active)) 368 (or (and (eq last-command this-command) (mark t))
369 (and transient-mark-mode mark-active)))
369 (set-mark 370 (set-mark
370 (save-excursion 371 (save-excursion
371 (goto-char (mark)) 372 (goto-char (mark))
372 (forward-paragraph arg) 373 (forward-paragraph arg)
373 (point)))) 374 (point))))