unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Printing elisp char literals
@ 2003-05-26 20:27 Stefan Monnier
  2003-05-26 20:49 ` David Kastrup
  2003-05-27  0:02 ` Miles' patch still fixes xfaces.c Robert J. Chassell
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2003-05-26 20:27 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-31 21:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-26 20:27 Printing elisp char literals Stefan Monnier
2003-05-26 20:49 ` 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

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).