emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allow mark-paragraph to mark more than 1 paragraph


From: Kai Großjohann
Subject: Re: Allow mark-paragraph to mark more than 1 paragraph
Date: Thu, 29 Nov 2001 18:02:40 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1.50 (i686-pc-linux-gnu)

address@hidden (Kai Großjohann) writes:

> I suggest to extend mark-paragraph so that it can mark more than one
> paragraph.

What do you think about the following change?  It's clear that the
documentation needs work.

2001-11-29  Kai Grossjohann  <address@hidden>

        * textmodes/paragraphs.el (mark-paragraph): Allow prefix arg.

Index: lisp/textmodes/paragraphs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/paragraphs.el,v
retrieving revision 1.57
diff -u -r1.57 paragraphs.el
--- lisp/textmodes/paragraphs.el        2001/10/30 06:46:49     1.57
+++ lisp/textmodes/paragraphs.el        2001/11/29 17:01:27
@@ -317,13 +317,21 @@
   (or arg (setq arg 1))
   (forward-paragraph (- arg)))
 
-(defun mark-paragraph ()
+(defun mark-paragraph (&optional arg)
   "Put point at beginning of this paragraph, mark at end.
-The paragraph marked is the one that contains point or follows point."
-  (interactive)
-  (forward-paragraph 1)
+The paragraph marked is the one that contains point or follows point.
+
+With argument ARG, puts mark where (forward-paragraph ARG) would go.
+
+If ARG is negative, point is put at end of this paragraph, mark is put
+at beginning of this or a previous paragraph."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (when (zerop arg)
+    (error "Cannot mark no paragraphs"))
+  (forward-paragraph arg)
   (push-mark nil t t)
-  (backward-paragraph 1))
+  (backward-paragraph arg))
 
 (defun kill-paragraph (arg)
   "Kill forward to end of paragraph.


kai
-- 
Simplification good!  Oversimplification bad!  (Larry Wall)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]