From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: evaluating numbers Date: Fri, 15 Nov 2019 15:54:46 +0100 Message-ID: References: <875zjw2emg.fsf@gmx.net> <618B38D9-CD34-4200-8CA1-1A6B0922A83A@traduction-libre.org> <871ruk2d3f.fsf@gmx.net> <3C929D7B-1C10-4713-9EDA-55C80FC36AD8@traduction-libre.org> <835zjvg385.fsf@gnu.org> <83sgmyd6rw.fsf@gnu.org> <835zjucwbz.fsf@gnu.org> <628A3663-BDD3-47C5-B4F4-E260FD900691@traduction-libre.org> <83o8xla50f.fsf@gnu.org> <8336ex9sow.fsf@gnu.org> <4836980E-C425-466C-BB86-5E962C4B3F96@traduction-libre.org> <83zhgy7qxq.fsf@gnu.org> <83lfsi5z1s.fsf@gnu.org> <83imnm480f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="221134"; mail-complaints-to="usenet@blaine.gmane.org" Cc: jean.christophe.helary@traduction-libre.org, yuri.v.khan@gmail.com, Paul Eggert , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 15 15:55:27 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVd0R-000vMd-CL for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 15:55:27 +0100 Original-Received: from localhost ([::1]:40236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVd0P-00017v-M0 for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 09:55:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVczs-00017a-LP for emacs-devel@gnu.org; Fri, 15 Nov 2019 09:54:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVczq-0007yc-Gt for emacs-devel@gnu.org; Fri, 15 Nov 2019 09:54:51 -0500 Original-Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:34112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVczq-0007xd-Aq; Fri, 15 Nov 2019 09:54:50 -0500 Original-Received: by mail-wr1-x42a.google.com with SMTP id e6so11326496wrw.1; Fri, 15 Nov 2019 06:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to :message-id:mime-version; bh=dTdjH6S9bAFVVyTm2Rdv5XDYkKywcwxAO+eHEJ8DzTQ=; b=STE71DJBIMNmWYrsvuv76Sox/PLV1P3Y5wMh9khVuCe9yPAgy2TzW3HrWlba2Z+rv5 wlFa/Zy33ZOZqm5Fj5m9IpY2/EYfndXsgmQBkqfYwW4THi8TKblL5CSg1WnfZ9+1qYKW hTJsm1Qx+LgUHs+J64XbcJw+mE45TFUZD69bPhl8CW9aX+vmK+BZ+SYUD/AeFWFZM5gp 5gj3hPrOOO0PtGy0qg3UXMIqQdxlsYxwvcWN2yoe4hpyHrVc84EzQoQsuXoIILvlWO2u zB5Okt2V//CB/c4AHPR5dR+s77OWVWcP2f7q/URtuFG4CQN0b03icjCviiNaYcusTgh1 K59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references :gmane-reply-to-list:date:in-reply-to:message-id:mime-version; bh=dTdjH6S9bAFVVyTm2Rdv5XDYkKywcwxAO+eHEJ8DzTQ=; b=W/MB/5DoC5X/YZu8UeP+fu/8EmKAWWNr+pRxWiVO8Wv+gH+WtXxY1O/d1Yos9ywvsf kYUorABAuAp3+2UtjPRt/1m0k1QLnEJKxjwGzUn7KhDE+8NO/2aXNdgqDZAUZxkvxdFQ x5mXvOwEcVBhtLPQCsjzGnnlTYpfB8kUC964EW63pTgeb93kjtPL3yJJPyrjY+egLHgm pjlnKe4orEP0c83VEPb4xjYARHsqncOyImTw62MScbiUpUu5G5vMmjbIlhqq37P4c7d1 nHvuJ18oZOdmzuXeK48ay7csG8Drk9J/Ak3JZnTHTPa7kGwzRuH1geD127F0SvIS9Mib Ijdg== X-Gm-Message-State: APjAAAVyJiQBT0SMM9F7xfFK1su2g/nm/yfQ9M9YvkjUDp4gD1WnzeZr /NSXJjE6z09YGoy4OqTWrsU= X-Google-Smtp-Source: APXvYqzO3F9gkE3KMEG6oRfoErpfdOadAJ4UesI2X124dEo14T7Y3givUGgfSKr+lSFYFvoR5/t9og== X-Received: by 2002:a5d:4a45:: with SMTP id v5mr12690610wrs.288.1573829688125; Fri, 15 Nov 2019 06:54:48 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id x7sm14021596wrg.63.2019.11.15.06.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 06:54:47 -0800 (PST) Gmane-Reply-To-List: yes In-Reply-To: <83imnm480f.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Nov 2019 20:39:44 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242231 Archived-At: >>>>> On Thu, 14 Nov 2019 20:39:44 +0200, Eli Zaretskii 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)))