unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jean.christophe.helary@traduction-libre.org,
	yuri.v.khan@gmail.com, Paul Eggert <eggert@cs.ucla.edu>,
	emacs-devel@gnu.org
Subject: Re: evaluating numbers
Date: Fri, 15 Nov 2019 15:54:46 +0100	[thread overview]
Message-ID: <m2ftipdwax.fsf@gmail.com> (raw)
In-Reply-To: <83imnm480f.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Nov 2019 20:39:44 +0200")

>>>>> On Thu, 14 Nov 2019 20:39:44 +0200, Eli Zaretskii <eliz@gnu.org> said:

    Eli> The right way of doing this is "C-u C-x =".  And if we think that this
    Eli> shows way too much info, I'm OK with modifying "C-x =" to show the
    Eli> character name as an optional feature.  These are commands that were
    Eli> specifically designed to describe text; doing that as part of integer
    Eli> evaluation is too general for that.

I like my bikesheds painted in #ff7f00

(what-cursor-position could definitely benefit from some refactoring
of those format strings).

diff --git a/lisp/simple.el b/lisp/simple.el
index e3ac709408..a9d2a152dc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1389,6 +1389,12 @@ line-number-at-pos
         (forward-line 0)
         (1+ (count-lines start (point)))))))
 
+(defcustom what-cursor-show-names nil
+  "Whether to show character names in `what-cursor-position'."
+  :type 'boolean
+  :version "27.1"
+  :group 'editing-basics)
+
 (defun what-cursor-position (&optional detail)
   "Print info on cursor position (on screen and within buffer).
 Also describe the character after point, and give its character code
@@ -1404,6 +1410,9 @@ what-cursor-position
 in *Help* buffer.  See also the command `describe-char'."
   (interactive "P")
   (let* ((char (following-char))
+         (char-name-fmt (if what-cursor-show-names
+                            (format ", ?\\N{%s}" (get-char-code-property char 'name))
+                          ""))
 	 (bidi-fixer
 	  ;; If the character is one of LRE, LRO, RLE, RLO, it will
 	  ;; start a directional embedding, which could completely
@@ -1449,7 +1458,7 @@ what-cursor-position
 	    (setq coding (default-value 'buffer-file-coding-system)))
 	(if (eq (char-charset char) 'eight-bit)
 	    (setq encoding-msg
-		  (format "(%d, #o%o, #x%x, raw-byte)" char char char))
+		  (format "(%d, #o%o, #x%x%s, raw-byte)" char char char char-name-fmt))
 	  ;; Check if the character is displayed with some `display'
 	  ;; text property.  In that case, set under-display to the
 	  ;; buffer substring covered by that property.
@@ -1468,17 +1477,17 @@ what-cursor-position
 	  (setq encoding-msg
 		(if display-prop
 		    (if (not (stringp display-prop))
-			(format "(%d, #o%o, #x%x, part of display \"%s\")"
-				char char char under-display)
-		      (format "(%d, #o%o, #x%x, part of display \"%s\"->\"%s\")"
-			      char char char under-display display-prop))
+			(format "(%d, #o%o, #x%x%s, part of display \"%s\")"
+				char char char char-name-fmt under-display)
+		      (format "(%d, #o%o, #x%x%s, part of display \"%s\"->\"%s\")"
+			      char char char char-name-fmt under-display display-prop))
 		  (if encoded
-		      (format "(%d, #o%o, #x%x, file %s)"
-			      char char char
+		      (format "(%d, #o%o, #x%x%s, file %s)"
+			      char char char char-name-fmt
 			      (if (> (length encoded) 1)
 				  "..."
 				(encoded-string-description encoded coding)))
-		    (format "(%d, #o%o, #x%x)" char char char)))))
+		    (format "(%d, #o%o, #x%x%s)" char char char char-name-fmt)))))
 	(if detail
 	    ;; We show the detailed information about CHAR.
 	    (describe-char (point)))



  parent reply	other threads:[~2019-11-15 14:54 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  9:43 evaluating numbers Jean-Christophe Helary
2019-11-07  9:57 ` Stephen Berman
2019-11-07 10:20   ` Jean-Christophe Helary
2019-11-07 10:30     ` Stephen Berman
2019-11-07 10:40       ` Jean-Christophe Helary
2019-11-07 14:39         ` Eli Zaretskii
2019-11-08  0:36           ` Jean-Christophe Helary
2019-11-08 10:03             ` Eli Zaretskii
2019-11-08 12:23               ` Jean-Christophe Helary
2019-11-08 13:22                 ` Stefan Monnier
2019-11-09  0:20                   ` Jean-Christophe Helary
2019-11-09  7:24                     ` Eli Zaretskii
2019-11-08 13:49                 ` Eli Zaretskii
2019-11-09  0:15                   ` Jean-Christophe Helary
2019-11-09  7:22                     ` Eli Zaretskii
2019-11-09 11:18                       ` Jean-Christophe Helary
2019-11-09 11:48                         ` Eli Zaretskii
2019-11-10  0:59                           ` Jean-Christophe Helary
2019-11-10  8:06                             ` Andreas Schwab
2019-11-10 20:52                               ` Juri Linkov
2019-11-12 20:28                                 ` Juri Linkov
2019-11-12 22:05                                   ` Drew Adams
2019-11-12 22:21                                     ` Eli Zaretskii
2019-11-12 23:30                                       ` Drew Adams
2019-11-13  8:10                                         ` Eli Zaretskii
2019-11-13 14:47                                           ` Drew Adams
2019-11-14 12:45                                   ` Eli Zaretskii
2019-11-14 22:50                                     ` Juri Linkov
2019-11-14 23:40                                       ` Noam Postavsky
2019-11-15  8:14                                       ` Eli Zaretskii
2019-11-14  9:22                             ` Eli Zaretskii
2019-11-14  9:46                               ` Yuri Khan
2019-11-14 11:36                                 ` Jean-Christophe Helary
2019-11-14 13:55                                 ` Stefan Monnier
2019-11-14 13:59                                   ` Noam Postavsky
2019-11-14 14:17                                     ` Stefan Monnier
2019-11-14 21:44                                     ` Juanma Barranquero
2019-11-14 14:03                                   ` Andreas Schwab
2019-11-14 14:10                                 ` Eli Zaretskii
2019-11-14 17:10                                   ` Paul Eggert
2019-11-14 18:32                                     ` Eli Zaretskii
2019-11-14 18:39                                     ` Eli Zaretskii
2019-11-15  8:32                                       ` Štěpán Němec
2019-11-15 14:54                                       ` Robert Pluim [this message]
2019-11-15 15:16                                         ` Eli Zaretskii
2019-11-15 15:32                                           ` Eli Zaretskii
2019-11-15 15:55                                             ` Robert Pluim
2019-11-15 16:00                                               ` Robert Pluim
2019-11-15 16:11                                                 ` Lars Ingebrigtsen
2019-11-15 16:33                                                   ` Robert Pluim
2019-11-15 16:13                                               ` Eli Zaretskii
2019-11-17  2:15                                             ` Richard Stallman
2019-11-17 20:02                                               ` Robert Pluim
2019-11-18 16:25                                                 ` Eli Zaretskii
2019-11-18 16:54                                                   ` Robert Pluim
2019-11-18 17:05                                                     ` Eli Zaretskii
2019-11-20 13:00                                                       ` Robert Pluim
2019-11-20 16:40                                                         ` Eli Zaretskii
2019-11-20 17:09                                                           ` Robert Pluim
2019-11-20 17:45                                                             ` Eli Zaretskii
2019-11-19  6:08                                                 ` Richard Stallman
2019-11-19  9:50                                                   ` Robert Pluim
2019-11-15 15:53                                           ` Robert Pluim
2019-11-15 16:13                                             ` Eli Zaretskii
2019-11-15 16:43                                               ` Robert Pluim
2019-11-15 16:59                                                 ` Eli Zaretskii
2019-11-16 20:40                                       ` Juri Linkov
2019-11-17 17:34                                         ` Eli Zaretskii
2019-11-17 21:16                                           ` Juri Linkov
2019-11-14 22:56                                 ` Juri Linkov
2019-11-09 16:03                         ` Stefan Monnier
2019-11-10  0:22                           ` Jean-Christophe Helary
2019-11-10  4:47                             ` Stefan Monnier
2019-11-13 23:02                               ` Jean-Christophe Helary
2019-11-14 13:52                                 ` Stefan Monnier
2019-11-14  9:20                             ` Eli Zaretskii
2019-11-14 11:35                               ` Jean-Christophe Helary
2019-11-14 13:37                                 ` Noam Postavsky
2019-11-14 14:20                                 ` Eli Zaretskii
2019-11-15 10:36                                   ` Jean-Christophe Helary
2019-11-15 13:03                                     ` Eli Zaretskii
2020-04-28 14:52                                       ` Jean-Christophe Helary
2020-04-28 15:05                                         ` Eli Zaretskii
2020-04-28 17:28                                           ` Paul Eggert
2020-04-28 23:16                                           ` Jean-Christophe Helary
2020-04-29  0:08                                             ` Paul Eggert
2020-04-29  0:21                                               ` Jean-Christophe Helary
2020-04-29  7:08                                             ` Eli Zaretskii
2020-04-29  8:00                                               ` Jean-Christophe Helary
2020-04-29  3:23                                           ` Richard Stallman
2020-04-29  3:49                                             ` Jean-Christophe Helary
2020-04-29  3:51                                             ` Stefan Monnier
2020-04-29 10:09                                               ` Po Lu
2020-04-30  2:34                                               ` Richard Stallman
2020-04-30  3:04                                                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ftipdwax.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jean.christophe.helary@traduction-libre.org \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).