From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: bug of display-table & make-glyph-code Date: Fri, 07 Sep 2007 11:47:17 +0300 Message-ID: References: <200708271732.22306.zslevin@gmail.com> <46DD9F41.8090700@gmx.at> <87bqch1nhz.fsf@kfs-lx.testafd.dk> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1189154852 917 80.91.229.12 (7 Sep 2007 08:47:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2007 08:47:32 +0000 (UTC) Cc: zslevin@gmail.com, emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 07 10:47:30 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ITZUv-0000VE-UP for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2007 10:47:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ITZUu-0007B1-7g for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2007 04:47:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ITZUq-00078x-QR for emacs-devel@gnu.org; Fri, 07 Sep 2007 04:47:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ITZUp-00075h-5h for emacs-devel@gnu.org; Fri, 07 Sep 2007 04:47:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ITZUp-00075Z-1T for emacs-devel@gnu.org; Fri, 07 Sep 2007 04:47:23 -0400 Original-Received: from heller.inter.net.il ([213.8.233.23]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ITZUo-0003YF-90 for emacs-devel@gnu.org; Fri, 07 Sep 2007 04:47:22 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-249-223.inter.net.il [83.130.249.223]) by heller.inter.net.il (MOS 3.7.3a-GA) with ESMTP id DOH63514 (AUTH halo1); Fri, 7 Sep 2007 11:47:16 +0300 (IDT) In-reply-to: (message from Kenichi Handa on Fri, 07 Sep 2007 14:11:35 +0900) X-Detected-Kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:78122 Archived-At: > From: Kenichi Handa > Date: Fri, 07 Sep 2007 14:11:35 +0900 > Cc: rgm@gnu.org, zslevin@gmail.com, rms@gnu.org, rudalics@gmx.at, > emacs-devel@gnu.org > > I started to study the glyph related codes, and ran into the > function create-glyph (disp-table.el). It is a strange > function, and I don't understand how to utilize it. Could > someone please explain it? I'm not sure what is there to explain, since the code looks quite self-explanatory, if read in together with the "Glyphs" node in the ELisp manual. Perhaps I'm missing something; if the below doesn't help, please ask specific questions. `create-glyph' is used on a character terminal to create a glyph that is displayed instead of some character C. The way you use it is like this: (aset standard-display-table c (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B"))))) This sets up the slot for C in standard-display-table to send to the terminal the string `(concat "\e(0" (char-to-string gc) "\e(B")))' (where GC is a code of some other character). standard-display-table needs an integer code of a glyph to put in the slot used to display C. Therefore, `create-glyph' returns such an integer, which is an index into a glyph table. In the glyph table, the first 256 slots are left unused, to avoid affecting the ASCII and unibyte non-ASCII ranges. Starting from entry #256 (zero-based), `create-glyph' adds a new entry for its argument (which is a string to be sent to the terminal when a specific character is displayed), and stores that string argument in glyph-table. Thereafter, when character C is to be displayed, Emacs will look it up in standard-display-table and see that its slot has a glyph index. Emacs will then look up that index's slot in glyph-table, fetch the string stored at that slot, and send the string to the terminal. Presumably, the string uses character terminal escape sequences to produce the desired effect, such as underlining the character etc. Did I manage to answer your question?