[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printing most-negative-fixnum fails
From: |
Juri Linkov |
Subject: |
Re: printing most-negative-fixnum fails |
Date: |
Tue, 11 May 2004 03:17:52 +0300 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Peter Whaite <address@hidden> writes:
> Minor annoyance is that evaluating most-negative-fixnum in *scratch*
> (Lisp Interaction mode) fails...
This bug is caused by calling `(downcase most-negative-fixnum)'
in `event-modifiers' called from `prin1-char'.
I remember it was agreed some time ago that by default C-x C-e should
not display numbers as characters to avoid all related problems.
Below is a patch that introduces an option to control character display.
Also it is useful to display octal and hex values as well, like
for example, C-x = already does.
Index: emacs/lisp/emacs-lisp/lisp-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v
retrieving revision 1.155
diff -u -w -b -r1.155 lisp-mode.el
--- emacs/lisp/emacs-lisp/lisp-mode.el 22 Mar 2004 15:31:46 -0000 1.155
+++ emacs/lisp/emacs-lisp/lisp-mode.el 10 May 2004 22:42:32 -0000
@@ -519,18 +521,25 @@
expr)))))))
(eval-last-sexp-print-value value))))
+(defvar eval-last-sexp-print-char nil
+ "*Non-nil means display the result of evaluation as a character.")
+
(defun eval-last-sexp-print-value (value)
(let ((unabbreviated (let ((print-length nil) (print-level nil))
(prin1-to-string value)))
(print-length eval-expression-print-length)
(print-level eval-expression-print-level)
- (char-string (prin1-char value))
(beg (point))
end)
(prog1
(prin1 value)
- (if (and (eq standard-output t) char-string)
- (princ (concat " = " char-string)))
+ (when (eq standard-output t)
+ (if (integerp value)
+ (princ (format " (0%o, 0x%x)" value value)))
+ (if eval-last-sexp-print-char
+ (let ((char-string (prin1-char value)))
+ (if char-string
+ (princ (concat " = " char-string))))))
(setq end (point))
(when (and (bufferp standard-output)
(or (not (null print-length))
Index: emacs/lisp/emacs-lisp/edebug.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/edebug.el,v
retrieving revision 3.67
diff -u -w -b -r3.67 edebug.el
--- emacs/lisp/emacs-lisp/edebug.el 22 Mar 2004 15:27:46 -0000 3.67
+++ emacs/lisp/emacs-lisp/edebug.el 10 May 2004 22:42:31 -0000
@@ -3692,8 +3692,11 @@
(setq edebug-previous-result
(concat "Result: "
(edebug-safe-prin1-to-string edebug-previous-value)
+ (if (integerp edebug-previous-value)
+ (format " (0%o, 0x%x)" edebug-previous-value
edebug-previous-value))
+ (if eval-last-sexp-print-char
(let ((name (prin1-char edebug-previous-value)))
- (if name (concat " = " name))))))
+ (if name (concat " = " name)))))))
(defun edebug-previous-result ()
"Print the previous result."
--
Juri Linkov
http://www.jurta.org/emacs/
- printing most-negative-fixnum fails, Peter Whaite, 2004/05/06
- Re: printing most-negative-fixnum fails,
Juri Linkov <=
- Re: printing most-negative-fixnum fails, Richard Stallman, 2004/05/11
- Re: printing most-negative-fixnum fails, Juri Linkov, 2004/05/11
- Re: printing most-negative-fixnum fails, Richard Stallman, 2004/05/14
- Re: printing most-negative-fixnum fails, Kenichi Handa, 2004/05/14
- Re: printing most-negative-fixnum fails, Juri Linkov, 2004/05/15
- Re: printing most-negative-fixnum fails, Richard Stallman, 2004/05/15
- Re: printing most-negative-fixnum fails, David Kastrup, 2004/05/15