all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there something between `prin1-to-string' and `princ'?
Date: Wed, 25 Sep 2013 15:23:07 +0200	[thread overview]
Message-ID: <8738ott4qs.fsf@gmail.com> (raw)
In-Reply-To: 87ob7h125c.fsf@informatimago.com

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> 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	other threads:[~2013-09-25 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2838.1380105265.10748.help-gnu-emacs@gnu.org>
2013-09-25 13:06 ` Is there something between `prin1-to-string' and `princ'? Pascal J. Bourguignon
2013-09-25 13:23   ` Thorsten Jolitz [this message]
2013-09-25 14:59   ` Thorsten Jolitz
2013-09-25 10:33 Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738ott4qs.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.