From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Printing elisp char literals Date: Mon, 26 May 2003 16:27:55 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305262027.h4QKRtlO001787@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053980827 28895 80.91.224.249 (26 May 2003 20:27:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 26 May 2003 20:27:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 26 22:27:03 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19KOYh-0007Vd-00 for ; Mon, 26 May 2003 22:27:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19KOm3-0007pU-00 for ; Mon, 26 May 2003 22:40:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19KOZy-0002Z8-7G for emacs-devel@quimby.gnus.org; Mon, 26 May 2003 16:28:22 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19KOZi-0002Kf-Pg for emacs-devel@gnu.org; Mon, 26 May 2003 16:28:06 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19KOZf-0002DS-DZ for emacs-devel@gnu.org; Mon, 26 May 2003 16:28:03 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19KOZY-0001p3-49 for emacs-devel@gnu.org; Mon, 26 May 2003 16:27:56 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h4QKRtx6001789 for ; Mon, 26 May 2003 16:27:55 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4QKRtlO001787; Mon, 26 May 2003 16:27:55 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14295 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14295 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