[Top][All Lists]

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

RE: cannot understand Elisp manual node Glyphs

From: Drew Adams
Subject: RE: cannot understand Elisp manual node Glyphs
Date: Fri, 9 Feb 2007 16:40:00 -0800

> Specifying faces thru glyph codes is kludgy and perhaps obsolete.  I
> think it calls for a total redesign, perhaps not before Emacs 23.
> It was added at a time when there was no other way to specify faces
> for buffer text.  It doesn't seem very useful to me now.  So maybe we
> should delete it instead of redesigning it.
> What are the purposes for which people want to use it now?

To repeat why I started this thread: I modify a display-table entry for ^L,
to display text like this: "Section (Printable Page)" instead of "^L" or

I couldn't figure out how to apply a face to that display-table entry.
Thanks to the explanations in the mailing list, in particular from Kim, I
can now do it, and I now understand the doc better. The doc is not clear in
this regard, IMO.

Can I do the same thing somehow without specifying a face through a glyph

Thanks to Kim's one-line convenience function, my code is clear:

(defun ^L-display-table-entry ()
  "Returns the display-table entry for the Control-l (`^L') character.
A vector determining how a Control-l character is displayed.
Either a vector of characters or nil.  The characters are displayed in
place of the Control-l character.  nil means `^L' is displayed."
  (vconcat (mapcar (lambda (c) (make-glyph-code c '^L-highlight))
                   "          Section (Printable Page)          ")))

;; Proposed Emacs helper function from Kim
(defun make-glyph-code (char &optional face)
  "Return a glyph code representing char CHAR with face FACE."
  (if face (logior char (lsh (face-id face) 19)) char))

(aset standard-display-table ?\014 (^L-display-table-entry))

A screenshot is attached. An explanation and the full code are here:

Attachment: drew-emacs-pretty-control-l.png
Description: PNG image

reply via email to

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