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

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

Re: avoid interpretation of \n, \t, ... in string


From: Peter Tury
Subject: Re: avoid interpretation of \n, \t, ... in string
Date: Wed, 28 Jan 2009 04:24:22 -0800 (PST)
User-agent: G2/1.0

Hi,

Pascal J. Bourguignon wrote:

> Switch to Common Lisp.  There's no reader macro in emacs lisp, so you
> cannot do much about it.  In Common Lisp, you can trivially implement

I think this will be a longer journey sometime in the future. CL is on
my "todo" list for some time ;-)

> Ok, another way to do it would be to store your paths in a file, and
> to read it:
>
> (defun read-paths (file)
>   (with-temp-buffer
>     (insert-file-contents file)
>     (delete "" (split-string (buffer-substring-no-properties
>                               (point-min) (point-max))
>                    "[\n\r]+"))))

Great, thanks!
I've checked it and found that in fact `buffer-substring-no-
properties' does the trick here. So my original question can be
reformulated now:

---> is there a way to get string (text) representation in a form as
`buffer-substring-no-properties' do it, i.e. duplicating single `\'-s
automatically (without(!) interpreting "pseudo-escape-sequences" (\n,
\t, ...) in the original text)?

BTW
when we come to external files (e.g. directories.txt) I have to
mention that my current workaround is to automate the problematic step
outside of Emacs: I have a simple .bat file (what does the vob
mounting) and call it from Emacs...

> Note that this is a serrious proposition. Myself, I use a
[...]
> so I can write all my scripts, whatever the language, independently of
> any directory location, and thus they can run identically on the

Very nice, thanks for the idea! I'll keep this way-of-working in my
mind.

Thanks,
P


reply via email to

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