GNU bug report logs - #35230
char-displayable-p return code is conflictingly documented

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Thu, 11 Apr 2019 14:50:01 UTC

Severity: minor

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 35230 <at> debbugs.gnu.org
Subject: bug#35230: char-displayable-p return code is conflictingly documented
Date: Fri, 12 Apr 2019 15:51:48 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Thu, 11 Apr 2019 16:49:29 +0200
> 
> (This comes as a result of the stackexchange question at
> https://emacs.stackexchange.com/questions/48810)
> 
> char-displayable-p docstring says
> 
>      Return non-nil if we should be able to display CHAR.
> 
> The elisp manual says something subtly different:
> 
>      This function returns ‘t’ if Emacs ought to be able to display
>      CHAR.  More precisely, if the selected frame’s fontset has a font
>      to display the character set that CHAR belongs to.
> 
> The function itself is more in line with the docstring:

Yes, the manual is wrong and should be fixed.  Non-nil is exactly
right, and callers should not depend on any finer definition of the
return value, as it could be many different non-nil objects.

> (char-displayable-p #xE01EF) => unicode
> 
> since I donʼt have a font with a glyph for that character, so it ends
> up displayed as a box with the unicode code point inside it. The code
> that results in 'unicode has the comment 	     
> 
>     ;; On a text terminal without glyph codes, CHAR is displayable
>     ;; if the coding system for the terminal can encode it.
> 
> but Iʼm very much on a graphical terminal here, not a text terminal.

This is a (known) deficiency in char-displayable-p, but one which is
not easy to fix: no one says that every call to this function asks
about the selected frame, so we cannot unconditionally disable the TTY
branch when on GUI frames.  Perhaps an optional argument could be
added for that purpose, which is the frame for which to make the test.
At least some, if not most, of the calls will still need to omit that
argument, though, because we currently need to know that up front to
set up the quote-style, for example.

Perhaps mentioning this caveat in the manual would be good.

Thanks.




This bug report was last modified 4 years and 223 days ago.

Previous Next


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