From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: cannot understand Elisp manual node Glyphs Date: Wed, 07 Feb 2007 14:29:46 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1170854990 18523 80.91.229.12 (7 Feb 2007 13:29:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2007 13:29:50 +0000 (UTC) Cc: Emacs-Devel To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 07 14:29:33 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 1HEmrb-0003TO-9t for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 14:29:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEmra-0003hh-Q3 for ged-emacs-devel@m.gmane.org; Wed, 07 Feb 2007 08:29:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HEmrN-0003h4-Md for emacs-devel@gnu.org; Wed, 07 Feb 2007 08:29:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HEmrK-0003g2-TJ for emacs-devel@gnu.org; Wed, 07 Feb 2007 08:29:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HEmrK-0003fw-P3 for emacs-devel@gnu.org; Wed, 07 Feb 2007 08:29:14 -0500 Original-Received: from pfepc.post.tele.dk ([195.41.46.237]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HEmrK-0008Hn-Do for emacs-devel@gnu.org; Wed, 07 Feb 2007 08:29:14 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id D136B8A0061; Wed, 7 Feb 2007 14:29:11 +0100 (CET) In-Reply-To: (Drew Adams's message of "Mon\, 5 Feb 2007 15\:11\:21 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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:66063 Archived-At: "Drew Adams" writes: > > It seems to say that the glyphs that I am using, and should be using, have > "simple glyph codes". It does not say what a glyph "code" is, BTW. > > It also says that a simple glyph code specifies both a character and a face. > The character is the code mod 524288; the face number is the code / 524288. > I also find this part highly dubious - mainly by exposing internal representation details. > So how do I use that information, to apply a face to my vector of glyphs? > Maybe that's not the right way to say it. How can I have the glyph vector > that I use to display ^L appear in a particular face? > These functions are handy: (defun make-glyph-with-face (c face) "Return a glyph code representing char C with face FACE." (logior c (lsh (face-id face) 19))) (defun glyph-char (glyph) "Return the character of glyph code GLYPH." (logand glyph #x7ffff)) (defun glyph-face (glyph) "Return the face of glyph code GLYPH, or nil if glyph has no face." (let ((face-id (lsh glyph -19))) (car (delq nil (mapcar (lambda (face) (and (eq (get face 'face) face-id) face)) (face-list)))))) > There seems to be a wide gulf between the kind of info that is available in > this node (glyph codes, face numbers) and practical use of that information. > I imagine that I'm not too far from my quest, but I haven't a clue where to > head. > > ... Perhaps we can improve the manual a bit in the process. I know this is not "the right time", but IMO adding these functions could significantly improve both code and documentation. I guess we wouldn't even need to describe what face numbers are (actually, we don't -- there's no index entry for it). So my proposal is to add thosed functions, to: a) simplify the documentation (and code) b) hide the technical details of glyph faces, and c) allow us to change the implementation later without breaking code: -- Kim F. Storm http://www.cua.dk