[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looking for some examples
From: |
2QdxY4RzWzUUiLuE |
Subject: |
Re: Looking for some examples |
Date: |
Wed, 6 Oct 2021 13:47:44 -0700 |
On 2021-10-06 at 22:32:15 +0200,
Stephen Berman <stephen.berman@gmx.net> wrote:
> On Wed, 6 Oct 2021 12:30:40 -0700 Patrick Mahan <plmahan@gmail.com> wrote:
>
> > I've looked around on the wiki and googled, but I haven't really found any
> > examples.
> >
> > I am cleaning a bunch of old code with tons of CPP macros of the form -
> > #define MACRONAME(_arg1, _arg2) \
> > do { \
> > /* code */ \
> > } while (0)
> >
> > I am converting these all to inline functions and already have some emacs
> > lisp code written to handle converting everything but the backslashes. I
> > would like to remove the backslashes, but I do not want to leave all that
> > empty whitespace behind. Is there a way to do this using
> > query-replace-regexp that also removes the whitespace?
>
> C-M-% [[:space:]]+\\$ RET RET !
That won't remove the backslashes that *aren't* preceded by whitespace,
which may or may not be a problem in your case. To address that, change
the + (one or more) to a * (zero or more):
C-M-% [[:space:]]*\\$ RET RET !