From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: "C-a" the first character in each line? Date: Sun, 24 Jun 2007 21:32:53 -0400 Organization: Symantec Message-ID: References: <1182693577.251257.35950@u2g2000hsc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1182735640 25725 80.91.229.12 (25 Jun 2007 01:40:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 25 Jun 2007 01:40:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 25 03:40:39 2007 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.50) id 1I2dZA-0001Z9-3u for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Jun 2007 03:40:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2dZ9-0000n0-Ic for geh-help-gnu-emacs@m.gmane.org; Sun, 24 Jun 2007 21:40:31 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!nx01.iad01.newshosting.com!newshosting.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 24 Jun 2007 20:32:53 -0500 Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody User-Agent: MT-NewsWatcher/3.5.2 (PPC Mac OS X) X-Copies-To: never Original-Lines: 51 Original-NNTP-Posting-Host: 24.34.108.171 Original-X-Trace: sv3-UMKKN0cRkMiN0go22yNWcfOEkhu55UEUCR6lbF2GewPWkafzGpHkWXq064Do63dIZ1Sfl9jIJnAeDkK!ptbAO5hvkIuaBRqBvXHzDDVxMcLjhnWAkPcfs2elY6ZkQ1+dKvbZW78nTK8Wbbir/eToWRTLUrtz!19oN6HsqR14+DG4tWh6LzZ1t+K/aSAiskdV6DJcanw== Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Original-Xref: shelby.stanford.edu gnu.emacs.help:149673 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:45258 Archived-At: In article <1182693577.251257.35950@u2g2000hsc.googlegroups.com>, weber wrote: > On Jun 24, 10:20 am, Nikos Apostolakis wrote: > > Hello group, > > > > in the scratch buffer I did > > > > ----------------- > > (while (search-forward-regexp "^\\(.\\)" nil t) > > (replace-match "\% \1")) > > > > laa > > moo > > nii > > ----------------- > > > > I expected > > > > % > > % laa > > % moo > > % nii > > > > but isnstead I get > > > > % ^A > > % ^Aaa > > % ^Aoo > > % ^Aii > > > > where ^A stands for the character "C-a". > > > > What am I missing? > > > > TIA, > > Nikos > > Dunno why, but \\1 instead of \1 solves it. Because \ is used as an escape prefix for both Elisp strings and regular expressions. It's first processed by the Elisp string parser, which uses \ to represent characters by their ASCII code, and \\ to represent a literal \. You need to use the latter to get the \ passed through to the regexp processor. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***