From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: npostavs@users.sourceforge.net
Newsgroups: gmane.emacs.bugs
Subject: bug#16828: 24.3.50;
	eval-expression, character representation of integer
	results	time-consuming
Date: Sat, 25 Mar 2017 23:45:22 -0400
Message-ID: <87zig84s6l.fsf@users.sourceforge.net>
References: <CABr8ebbLKP8As7ud-u3wmJ4cuua1NhKX8_yGpfSd7-1p1ez+bA@mail.gmail.com>
	<83mwhk4v48.fsf@gnu.org>
	<CABr8ebYbBF7AgHHsKWtyAi-c6BHvNpBis48+PgcfcZBH1Y-7OA@mail.gmail.com>
	<83txbr2sye.fsf@gnu.org> <87zjljf086.fsf@rosalinde.fritz.box>
	<83a9di3lt1.fsf@gnu.org> <877g8mb3lh.fsf@Rainer.invalid>
	<b4my510yqdt.fsf@jpl.org> <530DBEEE.8060805@gmx.at>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Trace: blaine.gmane.org 1490499916 8169 195.159.176.226 (26 Mar 2017 03:45:16 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 26 Mar 2017 03:45:16 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
Cc: Katsumi Yamaoka <yamaoka@jpl.org>, 16828@debbugs.gnu.org
To: martin rudalics <rudalics@gmx.at>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 26 05:45:11 2017
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1crz75-0001FH-Jf
	for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Mar 2017 05:45:07 +0200
Original-Received: from localhost ([::1]:39466 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1crz7B-0006fr-Go
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 Mar 2017 23:45:13 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54842)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1crz73-0006ch-KM
	for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2017 23:45:06 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1crz70-0006nr-HS
	for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2017 23:45:05 -0400
Original-Received: from debbugs.gnu.org ([208.118.235.43]:46674)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1crz70-0006nf-CM
	for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2017 23:45:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1crz6z-0000Or-UI
	for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2017 23:45:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: npostavs@users.sourceforge.net
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 26 Mar 2017 03:45:01 +0000
Resent-Message-ID: <handler.16828.B16828.14904998501459@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 16828
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
Original-Received: via spool by 16828-submit@debbugs.gnu.org id=B16828.14904998501459
	(code B ref 16828); Sun, 26 Mar 2017 03:45:01 +0000
Original-Received: (at 16828) by debbugs.gnu.org; 26 Mar 2017 03:44:10 +0000
Original-Received: from localhost ([127.0.0.1]:44873 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1crz69-0000NT-TD
	for submit@debbugs.gnu.org; Sat, 25 Mar 2017 23:44:10 -0400
Original-Received: from mail-it0-f54.google.com ([209.85.214.54]:38520)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <npostavs@gmail.com>)
	id 1crz66-0000Mg-51; Sat, 25 Mar 2017 23:44:06 -0400
Original-Received: by mail-it0-f54.google.com with SMTP id y18so23667899itc.1;
	Sat, 25 Mar 2017 20:44:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 
	h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version;
	bh=f6E9rYmku5k1M2yZGuMkWdCYBOUaS87V9I2At4m+hJM=;
	b=adB+wWGNHY0in5JLgN+7AbV5+zbOjk8SQx0vYkDw8ih8Job+EwuDRwsNFLFt4s/jyj
	FiuVh+FGmX9Ew7GqiQkXwKEgzv2FrDBXkNjEbfzKc54sHf7qGVKHxIUqhiD2p7LAAcZ9
	gEyM0SApKW4wJJM+9JLh9OL8H0SPUPVepi2rEqmgAMakZYsNlj9cMia767DomlhtIahI
	hmxt4rexVEhHwaJ59UvuDa+ZtoO2p+F7YYHVlNFkTc4psDxkxFpnrcMmC+FjLqBEfZj1
	Vb/8SxwFIzfnKRmschq6aXca8ntVViVzua1gSbCjP4UAGXyaW7vGSgEoeZ78+fFZE9eJ
	Kb9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:sender:from:to:cc:subject:references:date
	:in-reply-to:message-id:user-agent:mime-version;
	bh=f6E9rYmku5k1M2yZGuMkWdCYBOUaS87V9I2At4m+hJM=;
	b=nppY2/m/MOVTuaoPTbh1BG2f/ri1sJRrm/iuxA0YMVAw3kGNK9+tR2W04NphtPX3Hd
	vqGEmnh0vx40EBmBS1Pwqs4DyhkX4N2Kt/sXAur5X/g4MBchyIHQs3npawEjBGCpxe5C
	gG8TcKk1pjKAJLLcoKD4+7s0DkcA9lP4XHTSYuNxfo012OA7QOOI8fEDRy3rjIYIckim
	K3VCNe/0oYcNqfevbZg9aPJopoTLd9btzve7Zwhr4dbBNtIK9VpFFa3851k/qncvBJza
	AMULXwrZjcOIHV2pqG7aQKOvoCgb46tSyNq9oYDjvKeubUEgDxLasgOjcaC62AXMN6bi
	5mPg==
X-Gm-Message-State: AFeK/H1ielv9RPqgIMPAUbJ4h8UqdZts4dx/yNNdvOrNSObmwdUow50ACKZrYgHwayu+ug==
X-Received: by 10.36.185.87 with SMTP id k23mr559824iti.12.1490499840568;
	Sat, 25 Mar 2017 20:44:00 -0700 (PDT)
Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id
	f196sm2081298itc.2.2017.03.25.20.43.59
	(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
	Sat, 25 Mar 2017 20:43:59 -0700 (PDT)
In-Reply-To: <530DBEEE.8060805@gmx.at> (martin rudalics's message of "Wed, 26
	Feb 2014 11:16:14 +0100")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 208.118.235.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:130966
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/130966>

--=-=-=
Content-Type: text/plain

tags 16828 patch
quit

martin rudalics <rudalics@gmx.at> writes:

>> Especially on Cygwin, it's very annoying when edebugging.  Displaying
>> a character for the number of a point or a result of a calculation is
>> useless.
>
> The most annoying aspect here is that it very often finds a character
> with a superscript and increases the height of my echo area.  Think of
> how valuable this is when debugging code resizing the echo area ;-)

I wonder how it could take so long to fix this silly thing.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=v1-0001-Limit-integers-printed-as-characters-Bug-16828.patch
Content-Description: patch

>From 301202a7963ee377bf0f51f703e0282782c7a6c1 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 25 Mar 2017 23:31:11 -0400
Subject: [PATCH v1] Limit integers printed as characters (Bug#16828)

* lisp/simple.el (eval-expression-print-maximum-character): New
variable.
(eval-expression-print-format): Only display value as character if
it's equal or less than `eval-expression-print-maximum-character'.
* doc/emacs/building.texi (Lisp Eval): Document it.
* etc/NEWS: Announce it.
---
 doc/emacs/building.texi |  6 +++++-
 etc/NEWS                |  4 ++++
 lisp/simple.el          | 14 +++++++++++---
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index ba8eae0759..2ee08e2505 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1485,7 +1485,8 @@ Lisp Eval
 Emacs Lisp expression preceding point in the buffer, and displays the
 value in the echo area.  When the result of an evaluation is an
 integer, it is displayed together with the value in other formats
-(octal, hexadecimal, and character).
+(octal, hexadecimal, and character if
+@code{eval-expression-print-maximum-character} allows it).
 
   If @kbd{M-:} or @kbd{C-x C-e} is given a prefix argument, it inserts
 the value into the current buffer at point, rather than displaying it
@@ -1524,6 +1525,7 @@ Lisp Eval
 
 @vindex eval-expression-print-level
 @vindex eval-expression-print-length
+@vindex eval-expression-print-maximum-character
 @vindex eval-expression-debug-on-error
   The options @code{eval-expression-print-level} and
 @code{eval-expression-print-length} control the maximum depth and
@@ -1533,6 +1535,8 @@ Lisp Eval
 printed in full.  @code{eval-expression-debug-on-error} controls
 whether evaluation errors invoke the debugger when these commands are
 used; its default is @code{t}.
+@code{eval-expression-print-maximum-character} prevents large integers
+from being displayed as characters.
 
 @node Lisp Interaction
 @section Lisp Interaction Buffers
diff --git a/etc/NEWS b/etc/NEWS
index 62d06f3561..c09cc390bb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -334,6 +334,10 @@ always restricting the margin to a quarter of the window.
 ** Emacsclient has a new option -u/--suppress-output.  The option
 suppresses display of return values from the server process.
 
++++
+** The new variable 'eval-expression-print-maximum-character' prevents
+large integers from being displayed as characters.
+
 
 * Editing Changes in Emacs 26.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 681cf83807..599c7ebf30 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1450,6 +1450,13 @@ eval-expression-debug-on-error
   :type 'boolean
   :version "21.1")
 
+(defcustom eval-expression-print-maximum-character 127
+  "The largest integer that will be displayed as a character.
+This affects printing by `eval-expression-print-format'."
+  :group 'lisp
+  :type 'integer
+  :version "26.1")
+
 (defun eval-expression-print-format (value)
   "If VALUE in an integer, return a specially formatted string.
 This string will typically look like \" (#o1, #x1, ?\\C-a)\".
@@ -1460,9 +1467,10 @@ eval-expression-print-format
 	   (or (eq standard-output t)
 	       (zerop (prefix-numeric-value current-prefix-arg))))
       (let ((char-string
-	     (if (and (characterp value)
-		      (char-displayable-p value))
-		 (prin1-char value))))
+             (and (characterp value)
+                  (<= value eval-expression-print-maximum-character)
+                  (char-displayable-p value)
+                  (prin1-char value))))
         (if char-string
             (format " (#o%o, #x%x, %s)" value value char-string)
           (format " (#o%o, #x%x)" value value)))))
-- 
2.11.1


--=-=-=--