unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Subject: Printing elisp char literals
Date: Mon, 26 May 2003 16:27:55 -0400	[thread overview]
Message-ID: <200305262027.h4QKRtlO001787@rum.cs.yale.edu> (raw)


Let's say I have an integer.  How can I check whether it's a char ?
`char-valid-p' is only part of the answer, because I'd like to know
if the integer is a char-with-modifiers also.  The best I could come
up with right now is:

   (char-valid-p (logand char ?\x3fffff))

Is the mask available somewhere or do I simply have to hardcode it
like that ?

Furthermore, in order to print this integer in a form like ?\C-a,
what should I do ?  The best I could come up with is:

    (let ((s (single-key-description char)))
      (while (string-match "\\`\\(\\\\[MCAHSs]-\\)*\\(\\)[MCAHSs]-." s)
        (setq s (replace-match "\\" t t s 2)))
      (concat "?" s))


-- Stefan

             reply	other threads:[~2003-05-26 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-26 20:27 Stefan Monnier [this message]
2003-05-26 20:49 ` Printing elisp char literals David Kastrup
2003-05-27 10:39   ` Stephen J. Turnbull
2003-05-27  0:02 ` Miles' patch still fixes xfaces.c Robert J. Chassell
2003-05-27 22:40   ` Richard Stallman
2003-05-28  0:46     ` Robert J. Chassell
2003-05-31 19:52       ` Richard Stallman
2003-05-31 21:43         ` Robert J. Chassell

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=200305262027.h4QKRtlO001787@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    /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).