Article View: gnu.emacs.help
Article #189236Re: Atom Query Replace
From: Pete Halverson
Date: Tue, 16 Apr 1991 18:13
Date: Tue, 16 Apr 1991 18:13
26 lines
2068 bytes
2068 bytes
In article <ACEVEDO.91Apr14134830@hydrox-cookie.mit.edu> acevedo@athena.mit.edu (Gabriel) writes:
>
> => Anyone have a GNU implementation of the Atom Query Replace command
> => available with ZEMACS on the Symbolics Lisp Machines? In case you
> => are wondering, this command only replaces atoms, and is great for
> => renaming variables in code. Thanks in advance...Jeff
>
>No that I know of, but you can easily simulate it with regular
>expressions and syntax tables. An "atom" is basically a non-symbol
>character, followed by a word, followed by another non-symbol character.
However you can't use syntax codes to distinguish an atom from the contents
of a string, e.g. the Zmacs command lets you change all occurences of
MAXIMUM to MAX-VALUE in the following, without modifying the string:
(defun print-max (maximum)
(format t "~&The maximum value is ~d." maximum))
You could probably do the equivalent in Elisp fairly neatly by interleaving
regexp searches with calls to PARSE-PARTIAL-SEXP to check what state the
point is in, but it would take some work to get right.
--
===============================================================================
Pete Halverson INET: halverson@crd.ge.com
GE Corporate R&D Center UUCP: uunet!crd.ge.com!halverson
Schenectady, NY
Technical Details
Message-ID:
<18558@crdgw1.crd.ge.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!altair!halversReferences:
<1991Apr11.211036.15528@aero.org> <ACEVEDO.91Apr14134830@hydrox-cookie.mit.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,fe317d6997c35879 X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-04-16 23:12:36 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!altair!halvers From: halvers@altair.crd.ge.com (Pete Halverson) Newsgroups: gnu.emacs.help Subject: Re: Atom Query Replace Message-ID: <18558@crdgw1.crd.ge.com> Date: 16 Apr 91 18:13:39 GMT References: <1991Apr11.211036.15528@aero.org> <ACEVEDO.91Apr14134830@hydrox-cookie.mit.edu> Sender: news@crdgw1.crd.ge.com Reply-To: halverson@crd.ge.com (Pete Halverson) Organization: General Electric Corporate R&D Center Lines: 26