help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's wrong with this code??


From: Santanu
Subject: Re: What's wrong with this code??
Date: Wed, 08 Dec 2010 15:08:49 -0000
User-agent: G2/1.0

On May 18, 7:37 pm, Frédéric Perrin  <fred...@SPAM.resel.fr> wrote:
> Santanu <thisissant...@gmail.com> writes:
> > On May 18, 2:20 am, Andreas Politz <poli...@fh-trier.de> wrote:
> >> Santanu <thisissant...@gmail.com> writes:
> >> > Can you tell me what is wrong with this code:
> >> > -------------------
> >> > (setq
> >> >    go-packages-installed
> >> >    (split-string
> >> >     (shell-command-to-string
> >> >      "cd $GOROOT/src/pkg && find . -iname *.go | sed -e 's|^\./||g; s|/
> >> > [^/]*\.go||g' | sort | uniq"\
> >> > )))
>
> >> You have to escape the backslash characters, because of string
> >> expansion.
>
> > BTW, can you also explain a bit what it means when I don't put the
> > double backslash character, and instead use a single backslash? I
> > ask this because my original code (the incorrect one above) did
> > produce some correct results.
>
> The first expression in the sed was « s|^./||g; » (which didn't hurt,
> because it seems that you don't have directories whoose name contains
> only a single letter), and the second wes « s|/[^/]*.go||g », with the
> LHS matching strings such as « /svgo ».

Ah... I see. Now I understand. So, basically, just a singe '\'
character in an elisp
regexp string acts as if it wasn't even there in the first place.

Thank you for the explanation.

Regards,
Santanu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]