unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>,
	"Vinicius Jose Latorre" <viniciusjl@ig.com.br>
Cc: "GNU Emacs \(devel\)" <emacs-devel@gnu.org>
Subject: RE: Integer & glyph (trunk and emacs_unicode)
Date: Thu, 15 Nov 2007 19:39:55 -0800	[thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACGEOGCEAA.drew.adams@oracle.com> (raw)
In-Reply-To: <jwv3av7rzs8.fsf-monnier+emacs@gnu.org>

> > (defun make-glyph-code (char &optional face)
> >   "Return a glyph code representing char CHAR with face FACE."
> >   ;; Due to limitations on Emacs integer values, faces with
> >   ;; face id greater that 4091 are silently ignored.
> >   (if (and face (<= (face-id face) #xfff))
> >       (logior char (lsh (face-id face) 19))
> >     char))
>
> > So, it assumes 12 bits for face id and 19 bits for char code,
> > the result is an integer of 31 bits.
>
> I suspect that the "19" used to be something else (e.g. 16 when
> integers were 28bits, so 16+12=28).
>
> In any case, the test should be made more robust by not assuming
> anything about the available range of integers (which has changed over
> the years and can change depending on your config).
> How 'bout
>
>    (let ((id (and face (face-id face)))
>      (if (and (numberp id)
>               ;; Due to limitations on Emacs integer values, only
>               ;; face ids below a certain limit can be used.
>               (= id (lsh (lsh id 19) -19)))
>          (logior char (lsh id 19))
>        char))

I'm not really following this, but is this about the change from `19' to
`22' in this code (this is my own version, to accommodate both the old and
new)?

(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)
                        (if (<= emacs-major-version 22) 19 22)))
    char))

That is, is this related to thread "bug of display-table & make-glyph-code,
2007-09-10?

  reply	other threads:[~2007-11-16  3:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15 21:15 Integer & glyph (trunk and emacs_unicode) Vinicius Jose Latorre
2007-11-15 21:12 ` Stefan Monnier
2007-11-16  3:39   ` Drew Adams [this message]
2007-11-16 13:25     ` Vinicius Jose Latorre
2007-11-17  4:53       ` Richard Stallman
2007-11-17 16:17         ` Kim F. Storm
2007-11-17 23:31           ` Richard Stallman
2007-11-16 18:33 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BNELLINCGFJLDJIKDGACGEOGCEAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=viniciusjl@ig.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).