From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arnaldo Mandel Newsgroups: gmane.emacs.help Subject: Re: quoting a block of text with ">" Date: Thu, 30 Sep 2010 06:54:07 -0300 Message-ID: References: <77ccee74e9578ebd4936450a706a61fa.squirrel@webmail.tripperjones.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1285868334 12416 80.91.229.12 (30 Sep 2010 17:38:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Sep 2010 17:38:54 +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 19:38:53 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 1P1N5l-0004BW-Ua for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Sep 2010 19:38:50 +0200 Original-Received: from localhost ([127.0.0.1]:60887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1N5l-0003W7-9B for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Sep 2010 13:38:49 -0400 Original-Received: from [140.186.70.92] (port=49221 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1Fq7-0002Mp-GD for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 05:54:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P1Fq5-000306-Nv for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 05:54:11 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:55871) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P1Fq5-0002zc-IU for help-gnu-emacs@gnu.org; Thu, 30 Sep 2010 05:54:09 -0400 Original-Received: by wyb36 with SMTP id 36so2182941wyb.0 for ; Thu, 30 Sep 2010 02:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=g8OkR5GS9iew6pZgcXmmMqvzTvBA6ze6ht9LyH+bCLg=; b=K+4wzJqS9SFSfzdRQ9ppzyUPEu5g0agUCZEuL0Bi2sulTEjicxbImib10lfikdO4o/ ZGVP+FdW9RZqI1PdKECuOv1hDAu+Hb0QoTuyc7Sz0Dj4jhe49AuJT9EELD6HozZYlJCY D85xDznQYHty0kC7MX27BR9MVCgXO+tIdE8QQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=htniWJT48CvD2Btb+Gka6ABehOEHEs75vznFHo3/99ujotmBv1wAQ9FwClYG8TmD6V ExqNFJ/VX+r0ks5tyUMsR9c3iEXcfepFWDXy9sVAiit6V3CSjjqsk8RCDMKtcDGEir1I LaBU7GYlB5oqCXwsWwVNk1E1qsJUBwr66ZsqQ= Original-Received: by 10.227.127.149 with SMTP id g21mr2556649wbs.218.1285840447277; Thu, 30 Sep 2010 02:54:07 -0700 (PDT) Original-Received: by 10.216.36.17 with HTTP; Thu, 30 Sep 2010 02:54:07 -0700 (PDT) In-Reply-To: <77ccee74e9578ebd4936450a706a61fa.squirrel@webmail.tripperjones.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Thu, 30 Sep 2010 13:37:53 -0400 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:75046 Archived-At: On Wed, Sep 29, 2010 at 3:59 PM, Stever wrote: > I can't seem to find this function in my version of emacs, but I assume > there is one. is there any function where I can highlight a block of text > and put a ">" in front of it. So something like: I also like this functionality, and have had the command below bound to a function key for two decades. The comments are included for a correct attribution of authorship. ;From: erlkonig@walt.cc.utexas.edu (Christopher North-Keys) ;Newsgroups: comp.emacs ;Message-ID: <16516@ut-emx.UUCP> ;Date: 3 Aug 89 00:57:14 GMT ;; Prefix region (for rmail, in particular) -- simple & robust. ;; Christopher North-Keys, 1989 (defun prefix-region (start end string) "Insert STRING, default '> ', at the start of each line in or intersecting region while preserving indentation. Called from a program, takes three arguments,START, END and STRING." (interactive "r\nsString: ") (if (or (equal string "") (equal string nil)) (setq string "> ")) ;; Adjust start and end to extremes of ;; lines so lines don't get broken. (goto-char end) (end-of-line) (setq end (point)) (goto-char start) (beginning-of-line) (setq start (point)) ;; There is another command, replace-regexp, that did not work well. ;; If you narrowed as one would expect, you could not widen to the ;; previous narrow. Saving the old narrow extremes failed, as this ;; routine expands the region. Sadmaking. (let (line) (setq lines (count-lines start end)) (while (> lines 0) (insert string) (search-forward "\n") (setq lines (- lines 1)) ))) Arnaldo