aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-08-30 16:05:47 +0000
committerRichard M. Stallman2004-08-30 16:05:47 +0000
commit4f4ce5976e0922de725f83663a7975b387356d86 (patch)
tree3664ddb0a08bbf7b9004019eb19476a6e9b0298c
parent85d392cbe017a930006c84c02a59687e9b0d6585 (diff)
downloademacs-4f4ce5976e0922de725f83663a7975b387356d86.tar.gz
emacs-4f4ce5976e0922de725f83663a7975b387356d86.zip
(prin1-char): Don't turn S-a into A.
Don't return a string that would read as the wrong character code.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/lisp-mode.el40
2 files changed, 30 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5168f53d1cb..fab95b30909 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12004-08-30 Richard M. Stallman <rms@gnu.org>
2
3 * emacs-lisp/lisp-mode.el (prin1-char): Don't turn S-a into A.
4 Don't return a string that would read as the wrong character code.
5
12004-08-29 Kim F. Storm <storm@cua.dk> 62004-08-29 Kim F. Storm <storm@cua.dk>
2 7
3 * emulation/cua-base.el (cua-auto-expand-rectangles): Remove 8 * emulation/cua-base.el (cua-auto-expand-rectangles): Remove
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index d6f601cd121..e2aac327ddc 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -460,26 +460,36 @@ 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))) 463 (mods (event-modifiers char))
464 string)
464 ;; Prevent ?A from turning into ?\S-a. 465 ;; Prevent ?A from turning into ?\S-a.
465 (if (and (memq 'shift mods) 466 (if (and (memq 'shift mods)
467 (zerop (logand char ?\S-\^@))
466 (not (let ((case-fold-search nil)) 468 (not (let ((case-fold-search nil))
467 (char-equal c (upcase c))))) 469 (char-equal c (upcase c)))))
468 (setq c (upcase c) mods nil)) 470 (setq c (upcase c) mods nil))
469 (concat 471 ;; What string are we considering using?
470 "?" 472 (condition-case nil
471 (mapconcat 473 (setq string
472 (lambda (modif) 474 (concat
473 (cond ((eq modif 'super) "\\s-") 475 "?"
474 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) 476 (mapconcat
475 mods "") 477 (lambda (modif)
476 (cond 478 (cond ((eq modif 'super) "\\s-")
477 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) 479 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-))))
478 ((eq c 127) "\\C-?") 480 mods "")
479 (t 481 (cond
480 (condition-case nil 482 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
481 (string c) 483 ((eq c 127) "\\C-?")
482 (error nil)))))))) 484 (t
485 (string c)))))
486 (error nil))
487 ;; Verify the string reads a CHAR, not to some other character.
488 ;; If it doesn't, return nil instead.
489 (and string
490 (= (car (read-from-string string)) char)
491 string))))
492
483 493
484(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) 494(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
485 "Evaluate sexp before point; print value in minibuffer. 495 "Evaluate sexp before point; print value in minibuffer.