bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57693: 29.0.50; Is there a more reliable version of `char-displayabl


From: Robert Pluim
Subject: bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?
Date: Fri, 09 Sep 2022 15:46:40 +0200

>>>>> On Fri, 09 Sep 2022 21:25:35 +0800, Ihor Radchenko <yantar92@gmail.com> 
>>>>> said:

    Ihor> Hello,
    Ihor> In Org, we have recently had a need to check if a Unicode character 
can
    Ihor> be displayed in buffer.

    Ihor> We used the following:
    Ihor> (...
    Ihor>   (if (and (display-graphic-p)
    Ihor>            (char-displayable-p ?⭠)
    Ihor>            (char-displayable-p ?─))
    Ihor>       "⭠ now ───────────────────────────────────────────────"
    Ihor>     "now - - - - - - - - - - - - - - - - - - - - - - - - -")
    Ihor> ...)

    Ihor> However, char-displayable-p returned false-positive for one user:
    Ihor> https://list.orgmode.org/orgmode/87mtddhprr.fsf@localhost/ 

    Ihor> False-positives are indeed not unexpected in char-displayable-p; just 
as
    Ihor> its docstring warns. However, I am now wondering if there is some more
    Ihor> accurate way to know if a character can be actually displayed on 
buffer
    Ihor> or not.

Iʼd look at the guts of `describe-char-display' in
"lisp/descr-text.el" for inspiration (or even use it as is). It takes
a `pos' argument so you may have to wrap it in `with-temp-buffer' +
`insert'.

Robert
-- 





reply via email to

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