[Top][All Lists]

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

Re: How to walk a Lisp_String?

From: Manuel Giraud
Subject: Re: How to walk a Lisp_String?
Date: Fri, 02 Sep 2022 09:18:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 01 Sep 2022 22:45:12 +0200
>> I'm working into lwlib only.  So I've made a function to get the frame
>> of the menu widget (mw).  I'm also converting the char* display_string
>> of each menu entry to a Lisp_String with make_string (note: I don't know
>> if I should have done that but it seems the way to get a proper
>> multi-byte string from a char*).
> make_multibyte_string is better, I think.

make_string seems to be a higher level interface: it calls
make_unibyte_string or make_multibyte_string whether the string is uni-
or multi-byte.

> And I don't think I understand how you get the Lisp string to have the
> face information.  The original C char* string cannot have that
> information as part of the string's data, so where will the face data
> for the Lisp string come from?

I don't understand your question.  I thought it was the job of
FACE_FOR_CHAR: you give it a char and a frame and it returns the face
for this char in this frame.  What am I missing?


> For the faces part, I think face_at_string_position is a better
> interface.  It returns a face ID, from which you can get to the
> corresponding 'struct face' via FACE_FROM_ID.

Thanks, it is a much better interface.
Manuel Giraud

reply via email to

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