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

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

Re: Is there something between `prin1-to-string' and `princ'?


From: Thorsten Jolitz
Subject: Re: Is there something between `prin1-to-string' and `princ'?
Date: Wed, 25 Sep 2013 15:23:07 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

"Pascal J. Bourguignon" <address@hidden> writes:

> Thorsten Jolitz <address@hidden> writes:
>
>> Hi List, 
>> or even better
>>
>> ,-----------------------------------
>> | ... :CATEGORY "tmp2" :title ("C2") ...
>> `-----------------------------------
>>
>> but there seems to be no print command or configuration option that
>> gives me strings quoted, but text without properties at the same time?
>
> I'm afraid, you'll have to strip the properties before printing.
> cf.:   substring-no-properties
>
> (defun sexp-remove-string-properties (sexp)
>    (cond
>       ((stringp sexp) (substring-no-properties sexp))
>       ((atom sexp) sexp)
>       (t (cons (sexp-remove-string-properties (car sexp))
>                (sexp-remove-string-properties (cdr sexp))))))
>
> (prin1-to-string
>   (sexp-remove-string-properties    
>     '(:category "tmp2" :title (#("C2 " 0 3 (:parent nil))))))
> --> "(:category \"tmp2\" :title (\"C2 \"))"

Exactly what I need, thank you!

-- 
cheers,
Thorsten




reply via email to

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