GNU bug report logs - #39624
26.3; Inserting text in a specified face

Previous Next

Package: emacs;

Reported by: Greg Hill <gregoryohill <at> gmail.com>

Date: Sat, 15 Feb 2020 21:47:01 UTC

Severity: wishlist

Found in version 26.3

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 39624-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Greg Hill <gregoryohill <at> gmail.com>
Cc: 39624-done <at> debbugs.gnu.org
Subject: Re: bug#39624: 26.3; Inserting text in a specified face
Date: Thu, 20 Feb 2020 18:52:07 +0100
The OP confirmed to me off-list that this bug can be closed, so I'm
doing so.

On Sun, 16 Feb 2020 00:24:49 +0100 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> On Sat, 15 Feb 2020 13:20:01 -0800 Greg Hill <gregoryohill <at> gmail.com> wrote:
>
>> I'm just trying to figure out how to use the 'insert' function to insert
>> one string in the currently active buffer in a specific face like
>> 'custom-comment'). I'm sure it's easy to do, but I have spent
>> several hours searching through all the Info documentation and haven't
>> found a single clue.
>
> Here's one way:
>
> (insert (propertize "Test" 'face 'custom-comment))
>
> And here's how you might have found that in the documentation: If you
> look in the Elisp manual at the node Faces, it says: "One way to
> represent a face is as a property list of attributes", and if you look
> at the node Insertion, it says that most of the insertion functions
> "copy text characters from strings and buffers along with their
> properties".  So properties are a point of intersection between faces
> and insertion.  In the Elisp node Text Properties there is a menu that
> contains the entry Changing Properties with the description "Setting the
> properties of a range of text", which seems to be what you're looking
> for.  And indeed, the node Changing Properties describes the function
> propertize, saying it is "the easiest way to make a string with text
> properties".
>
> Steve Berman




This bug report was last modified 5 years and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.