From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Display of undisplayable characters: \U01F3A8 instead of diamond Date: Mon, 29 Aug 2022 16:00:57 +0300 Message-ID: <83y1v7w6eu.fsf@gnu.org> References: <87edx28cl1.fsf@disroot.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1707"; mail-complaints-to="usenet@ciao.gmane.io" Cc: akib@disroot.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 29 15:05:51 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSeSc-0000JA-8m for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 15:05:50 +0200 Original-Received: from localhost ([::1]:58218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSeSa-0007D1-Pz for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Aug 2022 09:05:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeNh-0005Ky-MO for emacs-devel@gnu.org; Mon, 29 Aug 2022 09:00:45 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeNh-0002ql-Do; Mon, 29 Aug 2022 09:00:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=hbXCsBYRKm3PAqIIWjbkgXBnP4M3uVIJzDRTBWr4r1g=; b=DwjyZaMlW9ft bEx6zkJ+QihvX6T+cLd8ExiUBJyxpZvmgzncYyGyxhwT9aolMGZmojOU94P577nE/PzF/bPSRU84n FUoKKKmt57BHWepBIM5ka1JVQUwgj8BRaFbvrN6tXW/+ONdPYWNLDXNjEUkMsfnDWrnI0WBZElSzx t1pPHBLTrMZs3n8haksIcKxPqeyLL2XY0ZLX+IHzzFo0rb1Di18rq/uagH/WLdn9CvbPZfdgln1iH qvwDQceKvs+hTSSfcg5vt0PA/XbGHCFbsm1OS4jwx/8nbQhhRC+070TCQTAOrB61DTvy5VRKdIRig YVB4vIixpFVCW8UO7lnJdw==; Original-Received: from [87.69.77.57] (port=3112 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSeNa-0007gP-2C; Mon, 29 Aug 2022 09:00:39 -0400 In-Reply-To: (message from Richard Stallman on Sun, 28 Aug 2022 23:36:01 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294284 Archived-At: > From: Richard Stallman > Cc: emacs-devel@gnu.org > Date: Sun, 28 Aug 2022 23:36:01 -0400 > > > --8<---------------cut here---------------start------------->8--- > > (set-char-table-extra-slot glyphless-char-display 0 'thin-space) > > --8<---------------cut here---------------end--------------->8--- > > > This shows a single space character. > > Could a variant of that display a diamond instead of a space? No, because displaying a non-ASCII character on a text-mode terminal requires to encode it. And since the extra-slot of that char-table is used for fallback display of characters for which the usual encoding doesn't work, nothing but ASCII characters can be safely put there. But you can have a different ASCII character there, like '*', for example (it will be displayed with a special face, to make it stand out). > but what is so bad about sending a glyph that the terminal can't > display? What bad results does it cause? It could mess up the display, because sending commands to the terminal driver also involves sequences of unprintable bytes. We don't send unprintable characters to the terminal for that reason. > Or how about fixing it by sending an official code for that diamond glyph? I don't see a reason to have a general-purpose feature in Emacs display like that. For starters, I don't think terminals in general use the U+FFFD "diamond" in such cases. It sounds like your personal preference, specifically for the Linux console. In which case I can suggest a simple customization to do this in your Emacs sessions. Put the following into your init file: (defun setup-diamonds () (let ((table (or standard-display-table (setq standard-display-table (make-display-table))))) (set-char-table-range table '(#x100 . #x10FFFF) (vconcat (list (make-glyph-code #xFFFD 'homoglyph)))))) This arranges for all the characters beyond 255 to be displayed as the diamond with a special face. (You can, of course, adjust the range of characters for which this is done according to your needs, or have several disjoint ranges instead of just one.) Would that be good enough for your use patterns?