all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: setting text properties for strings (or string variables)?
  2003-06-04 21:17 setting text properties for strings (or string variables)? Florian von Savigny
@ 2003-06-04 20:35 ` Jesper Harder
  2003-06-04 22:52   ` Florian von Savigny
  2003-06-04 21:05 ` Kevin Rodgers
  2003-06-04 21:17 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Jesper Harder @ 2003-06-04 20:35 UTC (permalink / raw)


Florian von Savigny <florian265@uboot.com> writes:

> That kindles me to ask if there is no function to set the text
> properties for a (sub)string. The available functions which set text
> properties seem to work only on buffers.


,----[ C-h f propertize RET ]
| propertize is a built-in function.
| (propertize STRING &rest PROPERTIES)
| 
| Return a copy of STRING with text properties added.
| First argument is the string to copy.
| Remaining arguments form a sequence of PROPERTY VALUE pairs for text
| properties to add to the result.
| 
`----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setting text properties for strings (or string variables)?
  2003-06-04 21:17 setting text properties for strings (or string variables)? Florian von Savigny
  2003-06-04 20:35 ` Jesper Harder
@ 2003-06-04 21:05 ` Kevin Rodgers
  2003-06-04 23:00   ` Florian von Savigny
  2003-06-04 21:17 ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2003-06-04 21:05 UTC (permalink / raw)


Florian von Savigny wrote:

> That kindles me to ask if there is no function to set the text
> properties for a (sub)string. The available functions which set text
> properties seem to work only on buffers.

| set-text-properties is a built-in function.
| (set-text-properties START END PROPERTIES &optional OBJECT)
|
| Completely replace properties of text from START to END.
| The third argument PROPERTIES is the new property list.
| The optional fourth argument, OBJECT,
| is the string or buffer containing the text.
      ^^^^^^^^^^^^^^^^^^^^
| If OBJECT is omitted or nil, it defaults to the current buffer.
| If PROPERTIES is nil, the effect is to remove all properties from
| the designated part of OBJECT.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* setting text properties for strings (or string variables)?
@ 2003-06-04 21:17 Florian von Savigny
  2003-06-04 20:35 ` Jesper Harder
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Florian von Savigny @ 2003-06-04 21:17 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 962 bytes --]


The Elisp manual says:

<quote>
   Like a buffer, a string can contain text properties for the
characters in it, as well as the characters themselves. All the Lisp
primitives that copy text from strings to buffers or other strings
also copy the properties of the characters being copied.
</quote>

That kindles me to ask if there is no function to set the text
properties for a (sub)string. The available functions which set text
properties seem to work only on buffers.

I am asking because I want to insert a string into a buffer and
provide it with '(face underline) on the fly. It seems more cumbersome
to calculate the buffer positions in order to use (set-text-property
beg end '(face underline)).

-- 


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setting text properties for strings (or string variables)?
  2003-06-04 21:17 setting text properties for strings (or string variables)? Florian von Savigny
  2003-06-04 20:35 ` Jesper Harder
  2003-06-04 21:05 ` Kevin Rodgers
@ 2003-06-04 21:17 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2003-06-04 21:17 UTC (permalink / raw)


>>>>> "Florian" == Florian von Savigny <florian265@uboot.com> writes:
> That kindles me to ask if there is no function to set the text
> properties for a (sub)string. The available functions which set text
> properties seem to work only on buffers.

Huh?  They pretty much all work on both.  See the `object' argument.


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setting text properties for strings (or string variables)?
  2003-06-04 20:35 ` Jesper Harder
@ 2003-06-04 22:52   ` Florian von Savigny
  0 siblings, 0 replies; 6+ messages in thread
From: Florian von Savigny @ 2003-06-04 22:52 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]


Thanks, Jesper -- looks like updating to Emacs 21 is worth the
trouble...


Jesper Harder <harder@myrealbox.com> writes:


> ,----[ C-h f propertize RET ]
> | propertize is a built-in function.
> | (propertize STRING &rest PROPERTIES)
> | 
> | Return a copy of STRING with text properties added.
> | First argument is the string to copy.
> | Remaining arguments form a sequence of PROPERTY VALUE pairs for text
> | properties to add to the result.
> | 
> `----

-- 


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setting text properties for strings (or string variables)?
  2003-06-04 21:05 ` Kevin Rodgers
@ 2003-06-04 23:00   ` Florian von Savigny
  0 siblings, 0 replies; 6+ messages in thread
From: Florian von Savigny @ 2003-06-04 23:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 692 bytes --]


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> | The optional fourth argument, OBJECT,
> | is the string or buffer containing the text.
>       ^^^^^^^^^^^^^^^^^^^^


Oops, I'm so embarrassed... 8-/ the explanation for me asking the
question anyway can only be somehow psychological, since I did not see
precisely what I felt ought to be there...

Many thanks anyway (who knows when I would have noticed it), and sorry
for bothering you...


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-06-04 23:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-04 21:17 setting text properties for strings (or string variables)? Florian von Savigny
2003-06-04 20:35 ` Jesper Harder
2003-06-04 22:52   ` Florian von Savigny
2003-06-04 21:05 ` Kevin Rodgers
2003-06-04 23:00   ` Florian von Savigny
2003-06-04 21:17 ` Stefan Monnier

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.