From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Roche Newsgroups: gmane.emacs.help Subject: Re: quoting a block of text with ">" Date: Thu, 30 Sep 2010 09:16:35 -0400 Message-ID: <87lj6j5q30.fsf@pobox.com> References: <83ocbfpr51.fsf@gnu.org> <77ccee74e9578ebd4936450a706a61fa.squirrel@webmail.tripperjones.com> Reply-To: help-gnu-emacs@gnu.org, Tom Roche NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285852640 31327 80.91.229.12 (30 Sep 2010 13:17:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Sep 2010 13:17:20 +0000 (UTC) To: help-gnu-emacs@gnu.org, Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 30 15:17:19 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P1J0e-0007tc-WA for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Sep 2010 15:17:17 +0200 Original-Received: from localhost ([127.0.0.1]:53944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1J0e-0005Kz-CC for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Sep 2010 09:17:16 -0400 Original-Received: from [140.186.70.92] (port=40734 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1J05-0005KE-3T for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 09:16:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P1J03-0005Dj-Fa for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 09:16:40 -0400 Original-Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:34133 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P1J03-0005Dc-Dh for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 09:16:39 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id B5DF5CA91B; Thu, 30 Sep 2010 09:16:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:reply-to:date:message-id :mime-version:content-type; s=sasl; bh=HKxWUZcJpQbY9DafuWJXitum6 MA=; b=Z1heAf6tgi0rxCF91FZ49+3nwckxxKBfS7Skc4jNr75xXhREnyLy8Q+n3 RYdbXukITP59jIQPjHz9gBEmDfKnenSWtJaysI0xDJAfxriKWBTRNNJNxlLUqXe1 vcleszfS+gAs9MZJQpMRJGhlJkvKPmldYJaabT5Nm1t9O0Ytr8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :in-reply-to:references:reply-to:date:message-id:mime-version :content-type; q=dns; s=sasl; b=ovokh2BaDp+dIM36hObf0ti56S8kfX0I LwtwO/O+yg4FkzmLqf+dj4plUbHS1p8iUe2VRAPKr5fBaOnJeF36POAe/XOir05z lR+cCRCnbx/WDu84OydS/XOrZzgJ0mm92gx8bkqRLvLAxxqUpy0BvHJ0VxK50HYY 4tYMvG557YE= Original-Received: from b-pb-sasl-quonix. (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id A4A68CA919; Thu, 30 Sep 2010 09:16:37 -0400 (EDT) Original-Received: from tlrPanP5.pobox.com (unknown [69.134.240.67]) by b-sasl-quonix.pobox.com (Postfix) with ESMTPA id 0B281CA912; Thu, 30 Sep 2010 09:16:35 -0400 (EDT) In-Reply-To: User-Agent: GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0) X-Pobox-Relay-ID: F4A691A4-CC94-11DF-9C29-DDE5016DD5F0-07218935!b-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75044 Archived-At: Stever Wed, 29 Sep 2010 11:59:19 -0700 >>> is there any function where I can highlight a block of text and >>> put a ">" in front of it. Or, for that matter, easily * put an arbitrary number of ">" in front, i.e. quote to a level. * remove an arbitrary number of ">" in front, i.e. unquote Fortunately, it seems that, in emacs as in perl, TMTOWTDI: Eli Zaretskii Thu, 30 Sep 2010 10:33:30 +0200 >> It's part of mail-indent-citation (in sendmail.el): >> (save-excursion >> (let ((end (set-marker (make-marker) (region-end)))) >> (goto-char (region-beginning)) >> (while (< (point) end) >> (insert mail-yank-prefix) >> (forward-line 1)))) >> mail-yank-prefix is "> " in this case. Sergei Organov Thu, 30 Sep 2010 12:44:42 +0400 > While not obvious, `string-rectangle' is your friend here: > string-rectangle is an interactive autoloaded Lisp function in > `rect.el'. > It is bound to C-x r t. > (string-rectangle START END STRING) > Replace rectangle contents with STRING on each line. > The length of STRING need not be the same as the rectangle width. > Put cursor at the beginning of the first line of the region, set the > mark, move cursor to the _beginning_ of the last line, then > press > C-x r t > > (there is a space entered after ">"). The way I find more obvious is to set ">" to be the comment character in the mode you're using for editing. You can do that various ways, e.g. (I'm sure there are others) * with the sequence [M-x set-variable, comment-start, ">"]. Note the need to enter the quotes literally. * set as a local variable in a file, e.g. append the text > Local Variables: > Mode:text > comment-start:">" The advantage of this approach is, when one wants to quote a region, one thinks of quoting as commenting, and just does comment-region (bound, perhaps by default, to M-#). This means also that * unquoting == C-u M-# * quote to level=n == C-u n M-# HTH, Tom Roche