Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 56825:dcd7b1b4690d
(prin1-char): Put `shift' modifier into the basic character,
if it has an uppercase form.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 28 Aug 2004 14:00:38 +0000 |
parents | c28ce21eb5ae |
children | ff83c10bdcf0 |
comparison
equal
deleted
inserted
replaced
56824:35774f24f0ab | 56825:dcd7b1b4690d |
---|---|
457 (defun prin1-char (char) | 457 (defun prin1-char (char) |
458 "Return a string representing CHAR as a character rather than as an integer. | 458 "Return a string representing CHAR as a character rather than as an integer. |
459 If CHAR is not a character, return nil." | 459 If CHAR is not a character, return nil." |
460 (and (integerp char) | 460 (and (integerp char) |
461 (eventp char) | 461 (eventp char) |
462 (let ((c (event-basic-type char))) | 462 (let ((c (event-basic-type char)) |
463 (mods (event-modifiers char))) | |
464 ;; Prevent ?A from turning into ?\S-a. | |
465 (if (and (memq 'shift mods) | |
466 (not (let ((case-fold-search nil)) | |
467 (char-equal c (upcase c))))) | |
468 (setq c (upcase c) mods nil)) | |
463 (concat | 469 (concat |
464 "?" | 470 "?" |
465 (mapconcat | 471 (mapconcat |
466 (lambda (modif) | 472 (lambda (modif) |
467 (cond ((eq modif 'super) "\\s-") | 473 (cond ((eq modif 'super) "\\s-") |
468 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) | 474 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) |
469 (event-modifiers char) "") | 475 mods "") |
470 (cond | 476 (cond |
471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) | 477 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) |
472 ((eq c 127) "\\C-?") | 478 ((eq c 127) "\\C-?") |
473 (t | 479 (t |
474 (condition-case nil | 480 (condition-case nil |