From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: replace-regexp in lisp function Date: Mon, 18 Jan 2010 15:11:19 +0100 Message-ID: <87636zy03c.fsf@lola.goethe.zz> References: <87aawby3bk.fsf@lola.goethe.zz> <14f08d7e1001180606w26581a69u96eb1def8c7f25c7@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263834710 13914 80.91.229.12 (18 Jan 2010 17:11:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Jan 2010 17:11:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sven Garbade Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 18 18:11:42 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.50) id 1NWv8g-0004By-16 for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Jan 2010 18:11:42 +0100 Original-Received: from localhost ([127.0.0.1]:35038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWv8f-0004bG-Ob for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Jan 2010 12:11:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWv1K-0001s2-Qj for help-gnu-emacs@gnu.org; Mon, 18 Jan 2010 12:04:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWv1F-0001q5-Ri for help-gnu-emacs@gnu.org; Mon, 18 Jan 2010 12:04:06 -0500 Original-Received: from [199.232.76.173] (port=42601 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWv1F-0001pu-EF for help-gnu-emacs@gnu.org; Mon, 18 Jan 2010 12:04:01 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:41933) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWv1E-0000ZO-Ol for help-gnu-emacs@gnu.org; Mon, 18 Jan 2010 12:04:00 -0500 Original-Received: from localhost ([127.0.0.1]:41701 helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NWv1D-00057U-BH; Mon, 18 Jan 2010 12:03:59 -0500 Original-Received: by lola.goethe.zz (Postfix, from userid 1000) id 4CD4E1FDA6; Mon, 18 Jan 2010 15:11:19 +0100 (CET) In-Reply-To: <14f08d7e1001180606w26581a69u96eb1def8c7f25c7@mail.gmail.com> (Sven Garbade's message of "Mon, 18 Jan 2010 15:06:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:71300 Archived-At: Sven Garbade writes: > Hi, > > many thanks. C-x Esc Esc gave me: > > (query-replace-regexp "\\(<<\\)" > (quote (replace-eval-replacement concat "\\1cn" (replace-quote (+ > (line-number-at-pos) replace-count)) ",")) nil > (if (and transient-mark-mode mark-active) (region-beginning)) > (if (and transient-mark-mode mark-active) (region-end))) > > which works inside my function. Looks quite complicate for me... Depending on the application, the expression (if (and transient-mark-mode mark-active) (region-beginning)) and its cousin can get replaced by known values, such as (point-min) and (point-max). -- David Kastrup