* elispQ: How can I extract text from #("text" ... )
@ 2008-04-04 2:04 Mirko
2008-04-04 4:14 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Mirko @ 2008-04-04 2:04 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I am parsing an xml file using xml.el, and I am getting for attributes
values such as:
#("Typically only electric field is assigned" 0 41 (face font-lock-
string-face fontified t)))
Now, these are variables of type string. How can I extract just the
text from it?
Thank you,
Mirko
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: elispQ: How can I extract text from #("text" ... )
2008-04-04 2:04 elispQ: How can I extract text from #("text" ... ) Mirko
@ 2008-04-04 4:14 ` Drew Adams
[not found] ` <mailman.9966.1207282652.18990.help-gnu-emacs@gnu.org>
2008-04-05 3:30 ` Tim X
2 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2008-04-04 4:14 UTC (permalink / raw)
To: 'Mirko', help-gnu-emacs
> values such as:
> #("Typically only electric field is assigned" 0 41 (face font-lock-
> string-face fontified t)))
>
> Now, these are variables of type string. How can I extract just the
> text from it?
You can use function `substring-no-properties' to give you a plain string that
has no face or other properties.
But you might not need to. What do you want to do with the resulting text
(string)?
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.9966.1207282652.18990.help-gnu-emacs@gnu.org>]
* Re: elispQ: How can I extract text from #("text" ... )
[not found] ` <mailman.9966.1207282652.18990.help-gnu-emacs@gnu.org>
@ 2008-04-04 11:00 ` Mirko
2008-04-04 14:11 ` Drew Adams
[not found] ` <mailman.9985.1207318373.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 14+ messages in thread
From: Mirko @ 2008-04-04 11:00 UTC (permalink / raw)
To: help-gnu-emacs
On Apr 4, 12:14 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > values such as:
> > #("Typically only electric field is assigned" 0 41 (face font-lock-
> > string-face fontified t)))
>
> > Now, these are variables of type string. How can I extract just the
> > text from it?
>
> You can use function `substring-no-properties' to give you a plain string that
> has no face or other properties.
>
> But you might not need to. What do you want to do with the resulting text
> (string)?
Thanks,
I compare its contents to some text strings using string= or insert
them into a buffer. I am converting a freemind mindmap to a latex
(beamer) file.
Mirko
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: elispQ: How can I extract text from #("text" ... )
2008-04-04 11:00 ` Mirko
@ 2008-04-04 14:11 ` Drew Adams
[not found] ` <mailman.9985.1207318373.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2008-04-04 14:11 UTC (permalink / raw)
To: 'Mirko', help-gnu-emacs
> > > values such as:
> > > #("Typically only electric field is assigned" 0 41 (face
> > > font-lock-string-face fontified t)))
> >
> > > Now, these are variables of type string. How can I
> > > extract just the text from it?
> >
> > You can use function `substring-no-properties' to give you
> > a plain string that has no face or other properties.
> >
> > But you might not need to. What do you want to do with the
> ? resulting text (string)?
>
> I compare its contents to some text strings using string= or insert
> them into a buffer. I am converting a freemind mindmap to a latex
> (beamer) file.
AFAIK, string= ignores text properties and should do what you want.
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.9985.1207318373.18990.help-gnu-emacs@gnu.org>]
* Re: elispQ: How can I extract text from #("text" ... )
[not found] ` <mailman.9985.1207318373.18990.help-gnu-emacs@gnu.org>
@ 2008-04-04 15:24 ` Mirko
2008-04-04 15:57 ` Drew Adams
[not found] ` <mailman.9990.1207324736.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 14+ messages in thread
From: Mirko @ 2008-04-04 15:24 UTC (permalink / raw)
To: help-gnu-emacs
On Apr 4, 10:11 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > > values such as:
> > > > #("Typically only electric field is assigned" 0 41 (face
> > > > font-lock-string-face fontified t)))
>
> > > > Now, these are variables of type string. How can I
> > > > extract just the text from it?
>
> > > You can use function `substring-no-properties' to give you
> > > a plain string that has no face or other properties.
>
> > > But you might not need to. What do you want to do with the
> > ? resulting text (string)?
>
> > I compare its contents to some text strings using string= or insert
> > them into a buffer. I am converting a freemind mindmap to a latex
> > (beamer) file.
>
> AFAIK, string= ignores text properties and should do what you want.
It does work, you are right. It is that all the extra stuff is really
not necessary in my application. And it obscures debugging.
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: elispQ: How can I extract text from #("text" ... )
2008-04-04 15:24 ` Mirko
@ 2008-04-04 15:57 ` Drew Adams
[not found] ` <mailman.9990.1207324736.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2008-04-04 15:57 UTC (permalink / raw)
To: 'Mirko', help-gnu-emacs
> > AFAIK, string= ignores text properties and should do what
> > you want.
>
> It does work, you are right. It is that all the extra stuff is really
> not necessary in my application. And it obscures debugging.
Then I guess your options are to either (1) prevent the string from having a
text property to begin with or (2) remove the text property.
For #1, you need to find where that happens. #2 is straightforward:
(substring-no-properties string-w-text-props)
Depending on what you are doing, you might alternatively use a print function to
insert text (without faces) in a buffer.:
(with-output-to-temp-buffer "foo" (princ some-text))
And if you are getting the text from a buffer in the first place, you can use
`buffer-substring-no-properties' instead of `buffer-substring'. See also
`insert-buffer-substring-no-properties'.
HTH
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.9990.1207324736.18990.help-gnu-emacs@gnu.org>]
* Re: elispQ: How can I extract text from #("text" ... )
[not found] ` <mailman.9990.1207324736.18990.help-gnu-emacs@gnu.org>
@ 2008-04-04 17:15 ` Mirko
2008-04-04 18:28 ` Drew Adams
[not found] ` <mailman.9998.1207333808.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 14+ messages in thread
From: Mirko @ 2008-04-04 17:15 UTC (permalink / raw)
To: help-gnu-emacs
On Apr 4, 11:57 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > AFAIK, string= ignores text properties and should do what
> > > you want.
>
> > It does work, you are right. It is that all the extra stuff is really
> > not necessary in my application. And it obscures debugging.
>
> Then I guess your options are to either (1) prevent the string from having a
> text property to begin with or (2) remove the text property.
>
> For #1, you need to find where that happens. #2 is straightforward:
>
> (substring-no-properties string-w-text-props)
>
> Depending on what you are doing, you might alternatively use a print function to
> insert text (without faces) in a buffer.:
>
> (with-output-to-temp-buffer "foo" (princ some-text))
>
> And if you are getting the text from a buffer in the first place, you can use
> `buffer-substring-no-properties' instead of `buffer-substring'. See also
> `insert-buffer-substring-no-properties'.
>
> HTH
Thanks for the pointers to those functions. I will communicate with
the xml.el maintainer to see if he sees anything problem in
implementing them. But I can always fall back to the (substring-no-
properties).
Out of curiosity, do you know where is the #( syntax described? I
could not find it in the manual.
Thanks again,
Mirko
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: elispQ: How can I extract text from #("text" ... )
2008-04-04 17:15 ` Mirko
@ 2008-04-04 18:28 ` Drew Adams
2008-04-05 15:45 ` Eli Zaretskii
[not found] ` <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>
[not found] ` <mailman.9998.1207333808.18990.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 14+ messages in thread
From: Drew Adams @ 2008-04-04 18:28 UTC (permalink / raw)
To: 'Mirko', help-gnu-emacs
> Out of curiosity, do you know where is the #( syntax described? I
> could not find it in the manual.
Elisp manual, node Text Props and Strings.
BTW, how did you look for it? `C-s #' finds it pretty quickly.
Perhaps Eli will add an index entry to the manual for this (there are other
entries for #, but not this one).
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: elispQ: How can I extract text from #("text" ... )
2008-04-04 18:28 ` Drew Adams
@ 2008-04-05 15:45 ` Eli Zaretskii
[not found] ` <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2008-04-05 15:45 UTC (permalink / raw)
To: help-gnu-emacs
> From: "Drew Adams" <drew.adams@oracle.com>
> Cc: "'Eli Zaretskii'" <eliz@gnu.org>
> Date: Fri, 4 Apr 2008 11:28:44 -0700
>
> Perhaps Eli will add an index entry to the manual for this (there are other
> entries for #, but not this one).
Done.
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>]
* Re: elispQ: How can I extract text from #("text" ... )
[not found] ` <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>
@ 2008-05-04 1:28 ` David Combs
2008-05-04 4:10 ` Eli Zaretskii
2008-05-05 14:17 ` Joel J. Adamson
0 siblings, 2 replies; 14+ messages in thread
From: David Combs @ 2008-05-04 1:28 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>,
Eli Zaretskii <eliz@gnu.org> wrote:
>> From: "Drew Adams" <drew.adams@oracle.com>
>> Cc: "'Eli Zaretskii'" <eliz@gnu.org>
>> Date: Fri, 4 Apr 2008 11:28:44 -0700
>>
>> Perhaps Eli will add an index entry to the manual for this (there are other
>> entries for #, but not this one).
>
>Done.
>
>
Where is this most-most-most-recent copy of the elisp man?
Thanks!
David
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: elispQ: How can I extract text from #("text" ... )
2008-05-04 1:28 ` David Combs
@ 2008-05-04 4:10 ` Eli Zaretskii
2008-05-05 14:17 ` Joel J. Adamson
1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2008-05-04 4:10 UTC (permalink / raw)
To: help-gnu-emacs
> From: dkcombs@panix.com (David Combs)
> Date: Sun, 4 May 2008 01:28:21 +0000 (UTC)
>
> In article <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>,
> Eli Zaretskii <eliz@gnu.org> wrote:
> >> From: "Drew Adams" <drew.adams@oracle.com>
> >> Cc: "'Eli Zaretskii'" <eliz@gnu.org>
> >> Date: Fri, 4 Apr 2008 11:28:44 -0700
> >>
> >> Perhaps Eli will add an index entry to the manual for this (there are other
> >> entries for #, but not this one).
> >
> >Done.
> >
> >
>
> Where is this most-most-most-recent copy of the elisp man?
In the Emacs CVS.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: elispQ: How can I extract text from #("text" ... )
2008-05-04 1:28 ` David Combs
2008-05-04 4:10 ` Eli Zaretskii
@ 2008-05-05 14:17 ` Joel J. Adamson
1 sibling, 0 replies; 14+ messages in thread
From: Joel J. Adamson @ 2008-05-05 14:17 UTC (permalink / raw)
To: David Combs; +Cc: help-gnu-emacs
dkcombs@panix.com (David Combs) writes:
> In article <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>,
> Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: "Drew Adams" <drew.adams@oracle.com>
>>> Cc: "'Eli Zaretskii'" <eliz@gnu.org>
>>> Date: Fri, 4 Apr 2008 11:28:44 -0700
>>>
>>> Perhaps Eli will add an index entry to the manual for this (there are other
>>> entries for #, but not this one).
>>
>>Done.
>>
>>
>
> Where is this most-most-most-recent copy of the elisp man?
Did you mean to type a comma?
,----
| Where is this most-most-most-recent copy of the elisp, man?
`----
The manual is in info format; it comes with the most recent versions of
Emacs (in CVS) and you should be able to read it with "\C-h mElisp".
,----
| # man elisp
`----
should get you
,----
| No manual entry for elisp
`----
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj
The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.9998.1207333808.18990.help-gnu-emacs@gnu.org>]
* Re: elispQ: How can I extract text from #("text" ... )
[not found] ` <mailman.9998.1207333808.18990.help-gnu-emacs@gnu.org>
@ 2008-04-05 1:16 ` Mirko
0 siblings, 0 replies; 14+ messages in thread
From: Mirko @ 2008-04-05 1:16 UTC (permalink / raw)
To: help-gnu-emacs
On Apr 4, 2:28 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > Out of curiosity, do you know where is the #( syntax described? I
> > could not find it in the manual.
>
> Elisp manual, node Text Props and Strings.
>
> BTW, how did you look for it? `C-s #' finds it pretty quickly.
>
> Perhaps Eli will add an index entry to the manual for this (there are other
> entries for #, but not this one).
I was looking for #( in the index. I also browsed through several
sections including the onw for substring-no-properties, but did not
see the #( mentioned -- might have overlooked it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: elispQ: How can I extract text from #("text" ... )
2008-04-04 2:04 elispQ: How can I extract text from #("text" ... ) Mirko
2008-04-04 4:14 ` Drew Adams
[not found] ` <mailman.9966.1207282652.18990.help-gnu-emacs@gnu.org>
@ 2008-04-05 3:30 ` Tim X
2 siblings, 0 replies; 14+ messages in thread
From: Tim X @ 2008-04-05 3:30 UTC (permalink / raw)
To: help-gnu-emacs
Mirko <mvukovic@nycap.rr.com> writes:
> Hi,
>
> I am parsing an xml file using xml.el, and I am getting for attributes
> values such as:
> #("Typically only electric field is assigned" 0 41 (face font-lock-
> string-face fontified t)))
>
> Now, these are variables of type string. How can I extract just the
> text from it?
>
I'm not sure I understand what your trying to do. The result you are
getting looks like an elisp list structure to me. You should be able to
extract what you want using car, cdr and friends.
e.g
(setq my-var ("Typically only electric field is assigned" 0 41 (face font-lock-
string-face fontified t)))
(car my-var)
=> "Typically only electric field is assigned"
(cdr my-var)
=> (0 41 (face font-lock-string-face fontified t))
etc
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-05-05 14:17 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04 2:04 elispQ: How can I extract text from #("text" ... ) Mirko
2008-04-04 4:14 ` Drew Adams
[not found] ` <mailman.9966.1207282652.18990.help-gnu-emacs@gnu.org>
2008-04-04 11:00 ` Mirko
2008-04-04 14:11 ` Drew Adams
[not found] ` <mailman.9985.1207318373.18990.help-gnu-emacs@gnu.org>
2008-04-04 15:24 ` Mirko
2008-04-04 15:57 ` Drew Adams
[not found] ` <mailman.9990.1207324736.18990.help-gnu-emacs@gnu.org>
2008-04-04 17:15 ` Mirko
2008-04-04 18:28 ` Drew Adams
2008-04-05 15:45 ` Eli Zaretskii
[not found] ` <mailman.10042.1207410333.18990.help-gnu-emacs@gnu.org>
2008-05-04 1:28 ` David Combs
2008-05-04 4:10 ` Eli Zaretskii
2008-05-05 14:17 ` Joel J. Adamson
[not found] ` <mailman.9998.1207333808.18990.help-gnu-emacs@gnu.org>
2008-04-05 1:16 ` Mirko
2008-04-05 3:30 ` Tim X
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.