From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: query-replace-interactive not documented Date: Sat, 26 Jun 2004 02:12:23 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <874qoz15tx.fsf@mail.jurta.org> References: <20040528.181649.25475113.wl@gnu.org> <87659snbd8.fsf@mail.jurta.org> <87llin98sc.fsf@mail.jurta.org> <87hdtbtnsg.fsf@mail.jurta.org> <87brjhwe2c.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088214729 32611 80.91.224.253 (26 Jun 2004 01:52:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Jun 2004 01:52:09 +0000 (UTC) Cc: David Kastrup , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Jun 26 03:51:59 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Be2MJ-0001ku-00 for ; Sat, 26 Jun 2004 03:51:59 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Be2MJ-0001yl-00 for ; Sat, 26 Jun 2004 03:51:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Be2Nn-0004hY-M5 for emacs-devel@quimby.gnus.org; Fri, 25 Jun 2004 21:53:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Be2Nl-0004hT-6p for emacs-devel@gnu.org; Fri, 25 Jun 2004 21:53:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Be2Nj-0004hH-Et for emacs-devel@gnu.org; Fri, 25 Jun 2004 21:53:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Be2Nj-0004hE-D2 for emacs-devel@gnu.org; Fri, 25 Jun 2004 21:53:27 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Be2Lm-000209-7j; Fri, 25 Jun 2004 21:51:26 -0400 Original-Received: from mail.jurta.org (80-235-34-252-dsl.mus.estpak.ee [80.235.34.252]) by knife.dreamhost.com (Postfix) with ESMTP id 7D3CAE4094; Fri, 25 Jun 2004 18:51:22 -0700 (PDT) Original-To: rms@gnu.org User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25263 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25263 Richard Stallman writes: > ;; Swallow a space after a symbol > ;; if there is a space. > (if (and (or (symbolp (car pos)) > ;; Swallow a space after 'foo > ;; but not after (quote foo). > (and (eq (car-safe (car pos)) 'quote) > (= ?\( (aref to-string 0)))) > (equal " " (substring to-string (cdr pos) > (1+ (cdr pos))))) This code doesn't work in `query-replace-read-args' since this function uses the variable `to' instead of `to-string'. Moreover, I noticed that comments don't correspond to the code: it swallows a space after (quote foo) but not after 'foo. I regret spending time on this useless issue (there are no symbols useful in the replacement string other than `replace-count' which already has an abbreviation \#) but if swallowing a space is so needed I think more appropriate condition would be to swallow a space after any character except close-paren. Index: lisp/replace.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v retrieving revision 1.175 diff -u -r1.175 replace.el --- lisp/replace.el 24 Jun 2004 23:33:59 -0000 1.175 +++ lisp/replace.el 25 Jun 2004 18:22:33 -0000 @@ -112,20 +121,16 @@ (let ((end ;; Swallow a space after a symbol ;; if there is a space. - (if (and (or (symbolp (car pos)) - ;; Swallow a space after 'foo - ;; but not after (quote foo). - (and (eq (car-safe (car pos)) 'quote) - (= ?\( (aref to-string 0)))) - (equal " " (substring to-string (cdr pos) - (1+ (cdr pos))))) + (if (string-match + "[^])] " (substring to (1- (cdr pos)) + (1+ (cdr pos)))) (1+ (cdr pos)) (cdr pos)))) (setq to (substring to end))))) -- Juri Linkov http://www.jurta.org/emacs/