* Interactive function displaying face attributes
@ 2022-08-09 18:24 carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 18:33 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-08-09 18:24 UTC (permalink / raw)
To: Help Gnu Emacs
I am writing this function to display face attributes. The function works interactively accepting a string from the user obtained from `completing-read'.
For `char-after-point' I want to display the face attribute of the character after point. Having seen that there can be more than one face at point, what can I do?
(defun descface (face)
"Describe the typeface properties of FACE."
(interactive
(list
(let* ( (cseq '("char-after-point" "mode-line-inactive" "mode-line" "default")) )
(completing-read "Face: " cseq nil t "mode-line"))))
(cond ((equal face "char-after-point")
(plist-get (text-properties-at (point)) 'face))
(t (describe-face face)))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 18:24 Interactive function displaying face attributes carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-08-09 18:33 ` Eli Zaretskii
2022-08-09 18:53 ` carlmarcos--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-08-09 18:33 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 9 Aug 2022 20:24:21 +0200 (CEST)
> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>
>
> I am writing this function to display face attributes. The function works interactively accepting a string from the user obtained from `completing-read'.
What is that string? If it's a face, then we already have
describe-face.
> For `char-after-point' I want to display the face attribute of the
> character after point.
Did you try "M-x describe-text-properties"?
> Having seen that there can be more than one face at point, what can I do?
No, the face at a given buffer position can have only one value.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 18:33 ` Eli Zaretskii
@ 2022-08-09 18:53 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 18:59 ` Eli Zaretskii
[not found] ` <83v8r1s0ow.fsf@gnu.org-N930CPX----2>
0 siblings, 2 replies; 8+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-08-09 18:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 9, 2022, 18:33 by eliz@gnu.org:
>> Date: Tue, 9 Aug 2022 20:24:21 +0200 (CEST)
>> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>>
>>
>> I am writing this function to display face attributes. The function works interactively accepting a string from the user obtained from `completing-read'.
>>
>
> What is that string? If it's a face, then we already have
> describe-face.
>
The string is an element in the list passed in completing-read.
>> For `char-after-point' I want to display the face attribute of the
>> character after point.
>>
>
> Did you try "M-x describe-text-properties"?
>
No, have done `describe-face'
>> Having seen that there can be more than one face at point, what can I do?
>>
> No, the face at a given buffer position can have only one value.
>
If `hl-line-mode' is enabled, would that result in multiple faces at point?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 18:53 ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-08-09 18:59 ` Eli Zaretskii
[not found] ` <83v8r1s0ow.fsf@gnu.org-N930CPX----2>
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2022-08-09 18:59 UTC (permalink / raw)
To: carlmarcos; +Cc: help-gnu-emacs
> Date: Tue, 9 Aug 2022 20:53:32 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> Aug 9, 2022, 18:33 by eliz@gnu.org:
>
> >> Date: Tue, 9 Aug 2022 20:24:21 +0200 (CEST)
> >> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> >>
> >>
> >> I am writing this function to display face attributes. The function works interactively accepting a string from the user obtained from `completing-read'.
> >>
> >
> > What is that string? If it's a face, then we already have
> > describe-face.
> >
> The string is an element in the list passed in completing-read.
And what are the members of that list? Are they faces?
IOW, do you want a function that displays attributes of a face? If
so, describe-face is your friend.
> >> For `char-after-point' I want to display the face attribute of the
> >> character after point.
> >>
> >
> > Did you try "M-x describe-text-properties"?
> >
> No, have done `describe-face'
Well, how about trying describe-text-properties?
> >> Having seen that there can be more than one face at point, what can I do?
> >>
> > No, the face at a given buffer position can have only one value.
> >
> If `hl-line-mode' is enabled, would that result in multiple faces at point?
No, there's just one. But there might be other sources of face
information besides the buffer text itself. See the node "Displaying
Faces" in the ELisp manual. (Btw, describe-text-properties will show
the other sources of face information as well.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
[not found] ` <83v8r1s0ow.fsf@gnu.org-N930CPX----2>
@ 2022-08-09 19:21 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 19:32 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-08-09 19:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 9, 2022, 18:59 by eliz@gnu.org:
>> Date: Tue, 9 Aug 2022 20:53:32 +0200 (CEST)
>> From: carlmarcos@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> Aug 9, 2022, 18:33 by eliz@gnu.org:
>>
>> >> Date: Tue, 9 Aug 2022 20:24:21 +0200 (CEST)
>> >> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>> >>
>> >>
>> >> I am writing this function to display face attributes. The function works interactively accepting a string from the user obtained from `completing-read'.
>> >>
>> >
>> > What is that string? If it's a face, then we already have
>> > describe-face.
>> >
>> The string is an element in the list passed in completing-read.
>>
>
> And what are the members of that list? Are they faces?
>
They are strings telling users what faces to display. Would need some call to intern
in the function body for some options (e.g. mode-line) when calling the appropriate function.
> IOW, do you want a function that displays attributes of a face? If
> so, describe-face is your friend.
>
Yes, I have been using `describe-face' on `mode-line' and `mode-line-inactive'.
What about face after point? What could I call? Same `describe-face'? And what would be the correct face name?
>> >> For `char-after-point' I want to display the face attribute of the
>> >> character after point.
>> >>
>> >
>> > Did you try "M-x describe-text-properties"?
>> >
>> No, have done `describe-face'
>>
>
> Well, how about trying describe-text-properties?
>
>> >> Having seen that there can be more than one face at point, what can I do?
>> >>
>> > No, the face at a given buffer position can have only one value.
>> >
>> If `hl-line-mode' is enabled, would that result in multiple faces at point?
>>
>
> No, there's just one. But there might be other sources of face
> information besides the buffer text itself. See the node "Displaying
> Faces" in the ELisp manual. (Btw, describe-text-properties will show
> the other sources of face information as well.)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 19:21 ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-08-09 19:32 ` Eli Zaretskii
2022-08-09 20:25 ` carlmarcos--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-08-09 19:32 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 9 Aug 2022 21:21:17 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> Aug 9, 2022, 18:59 by eliz@gnu.org:
>
> What about face after point? What could I call? Same `describe-face'?
Yes, I think so.
> And what would be the correct face name?
(get-text-property (point) 'face)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 19:32 ` Eli Zaretskii
@ 2022-08-09 20:25 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-10 12:35 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-08-09 20:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 9, 2022, 19:32 by eliz@gnu.org:
>> Date: Tue, 9 Aug 2022 21:21:17 +0200 (CEST)
>> From: carlmarcos@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> Aug 9, 2022, 18:59 by eliz@gnu.org:
>>
>> What about face after point? What could I call? Same `describe-face'?
>>
>
> Yes, I think so.
>
>> And what would be the correct face name?
>>
>
> (get-text-property (point) 'face)
>
Eli, I have done the following
How can I fix the problem with using `describe-face' for "text-property"?
(defun laxy-descface (face)
"Describe the typeface properties of FACE."
(interactive
(list
(let* ( (cseq '("text-property" "mode-line-inactive" "mode-line")) )
(completing-read "Face_property: " cseq nil t "mode-line"))))
(pcase form
("text-property"
(describe-face (get-text-property (point) 'face)))
("mode-line-inactive"
(describe-face (intern face)))
("mode-line"
(describe-face (intern face)))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Interactive function displaying face attributes
2022-08-09 20:25 ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-08-10 12:35 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2022-08-10 12:35 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 9 Aug 2022 22:25:07 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> > (get-text-property (point) 'face)
> >
> Eli, I have done the following
>
> How can I fix the problem with using `describe-face' for "text-property"?
What needs fixing there, exactly?
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-08-10 12:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09 18:24 Interactive function displaying face attributes carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 18:33 ` Eli Zaretskii
2022-08-09 18:53 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 18:59 ` Eli Zaretskii
[not found] ` <83v8r1s0ow.fsf@gnu.org-N930CPX----2>
2022-08-09 19:21 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-09 19:32 ` Eli Zaretskii
2022-08-09 20:25 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-10 12:35 ` Eli Zaretskii
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.