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: Wed, 20 Nov 2019 14:00:16 +0100 Message-ID: References: <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> <834kz52mqx.fsf@gnu.org> <8336ep2m17.fsf@gnu.org> <83tv712ltg.fsf@gnu.org> <83r2252jz2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="244721"; mail-complaints-to="usenet@blaine.gmane.org" Cc: jean.christophe.helary@traduction-libre.org, yuri.v.khan@gmail.com, eggert@cs.ucla.edu, rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 20 14:01:57 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 1iXPcJ-0011MK-0S for ged-emacs-devel@m.gmane.org; Wed, 20 Nov 2019 14:01:55 +0100 Original-Received: from localhost ([::1]:57550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXPcF-0003wo-Uo for ged-emacs-devel@m.gmane.org; Wed, 20 Nov 2019 08:01:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33842) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXPas-0003oJ-7i for emacs-devel@gnu.org; Wed, 20 Nov 2019 08:00:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXPaq-0000UE-GU for emacs-devel@gnu.org; Wed, 20 Nov 2019 08:00:25 -0500 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:40271) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXPam-0000R5-Qb; Wed, 20 Nov 2019 08:00:21 -0500 Original-Received: by mail-wr1-x436.google.com with SMTP id q15so15234784wrw.7; Wed, 20 Nov 2019 05:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=e8pdVP7N+qclVn8i5ED2gJWfetNgI9fZM5zqHmEdxt0=; b=Sd1lcrmi7dpeHn7NFLd1bZFPNiz4BbgVAInftg7fF4MFzusEXDdoMTFYZ1i5Bxb9qO KfywcCFozR79pUWFpPHBTZAkKXqHxD8kvPPbrvVQQG0tXsYD9hrcAgi42rDWKjwo0UZE JXof9+KasQLlF8pnXxQylhDzYJNeMx8gRBCkgMBw36gZXxt/YrARa97x6ocvbHQGrzO8 5eJQ8o4iNGixoaQ8pNW3+TQVAEYWe8QEV2W0xSI1YBRCOzc/a7a1oek6WanSfqPHTunB WGMvygi8z/BrCfkjxzwMBqmvG6x/xFGLre0kFd6F4eSuiOM9IiMIAKKr2Vvsi24iBeV5 gdcg== 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:date:in-reply-to :message-id:mime-version; bh=e8pdVP7N+qclVn8i5ED2gJWfetNgI9fZM5zqHmEdxt0=; b=oo/IPK3gzPiBb5g13bODSSWOvKmFJeQV+mJRORX9RkYgifXAUxltPFx8Gv1JHKL7RZ /X3ru/xga5tMFaS6//AJ64pCl0jc/1iBCHCalw06UIn/jTIwRoNsoEsb49e9ZiPFy6Za j23Eb3nhB1zhPKny38MLllSOqN1nqIAVA4c3CxhoPZdK1OEZZTbyYU2dHEgSsWZZHEVx UkvJnyh+OkzDDGjp5bHuAfh4zfptD44Gy8C1/YSGxv3fsC7xVLwHh5bJHSZN2bhPkEGX GqBAx25oV4CvTXjYWfUf/0ABrjYeoPMOtvh8S3yUfGAcLVGGTfwU/m3+mCeBovVxHloA ziVw== X-Gm-Message-State: APjAAAW8EXYAaFRAHOV5a2vL1mJSditHw7nrketLTOEQiaShafQghRZp pymZGiaiX63sVfaezfMK0g4= X-Google-Smtp-Source: APXvYqzSrzK705wJ+9LzIlUMuuEh0di+QVv1g+/ieCCo/VpefqHiJ9gji5o9vuZ/1R+QN6VPi5uH/Q== X-Received: by 2002:a05:6000:18c:: with SMTP id p12mr3146296wrx.154.1574254817915; Wed, 20 Nov 2019 05:00:17 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id a11sm6866329wmh.40.2019.11.20.05.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 05:00:17 -0800 (PST) In-Reply-To: <83r2252jz2.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 18 Nov 2019 19:05:37 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 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:242481 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> On Mon, 18 Nov 2019 19:05:37 +0200, Eli Zaretskii said: >> From: Robert Pluim >> Cc: jean.christophe.helary@traduction-libre.org, eggert@cs.ucla.edu, >> emacs-devel@gnu.org, rms@gnu.org, yuri.v.khan@gmail.com >> Date: Mon, 18 Nov 2019 17:54:18 +0100 >>=20 >> Char: i (105, #o151, #x69, (LATIN SMALL LETTER I)) point=3D55242 of = 379127 (15%) column=3D43 >>=20 >> That seems ... suboptimal to me (at least, I don=CA=BCt like it). Eli> Fine, then let's go with just the name. Latest version attached, which produces output like so: Char: i (105, #o151, #x69, LATIN SMALL LETTER I) point=3D1482 of 1715 (86%)= <860-1716> column=3D13 I=CA=BCll push this weekend if everyone's ok with it. Robert --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Have-what-cursor-position-optionally-show-character-.patch >From 8f8a3888439d959cff60a0cdea2070b1d3ebc15d Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Tue, 19 Nov 2019 11:33:10 +0100 Subject: [PATCH] Have what-cursor-position optionally show character name To: emacs-devel@gnu.org * lisp/simple.el (what-cursor-show-names): New defcustom, default nil. (what-cursor-position): Show character names if what-cursor-show-names is non-nil. * doc/emacs/basic.texi (Position Info): Add what-cursor-show-names description. * etc/NEWS: Announce what-cursor-show-names. --- doc/emacs/basic.texi | 10 ++++++++++ etc/NEWS | 5 +++++ lisp/simple.el | 31 ++++++++++++++++++++++--------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index d0bd46c35f..79a546f9e7 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -696,6 +696,16 @@ Position Info horizontal position of point, in columns counting from the left edge of the window. +@vindex what-cursor-show-names + If the user option @code{what-cursor-show-names} is non-@code{nil}, +the name of the character is shown as well, so the part in parentheses +would become: + +@smallexample +(99, #o143, #x63, LATIN SMALL LETTER C) +@end smallexample + + If the buffer has been narrowed, making some of the text at the beginning and the end temporarily inaccessible, @kbd{C-x =} displays additional text describing the currently accessible range. For diff --git a/etc/NEWS b/etc/NEWS index 4887b8e681..fdfe2d8692 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -231,6 +231,11 @@ To get the old, less-secure behavior, you can set the *** When run by root, emacsclient no longer connects to non-root sockets. (Instead you can use Tramp methods to run root commands in a non-root Emacs.) ++++ +** New user option 'what-cursor-show-names'. +When non-nil, what-cursor-position will show the name of the character +in addition to the decimal/hex/octal representation. Default nil. + +++ ** New function 'network-lookup-address-info'. This does IPv4 and/or IPv6 address lookups on hostnames. diff --git a/lisp/simple.el b/lisp/simple.el index c61ccd511c..a63f2552df 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1389,10 +1389,17 @@ 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 -in octal, decimal and hex. +Also describe the character after point, and give its character +code in octal, decimal and hex, plus its name if +`what-cursor-show-names' is non-nil. For a non-ASCII multibyte character, also give its encoding in the buffer's selected coding system if the coding system encodes the @@ -1404,6 +1411,12 @@ what-cursor-position in *Help* buffer. See also the command `describe-char'." (interactive "P") (let* ((char (following-char)) + (char-name (and what-cursor-show-names + (or (get-char-code-property char 'name) + (get-char-code-property char 'old-name)))) + (char-name-fmt (if char-name + (format ", %s" 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 +1462,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 +1481,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)" + (format "(%d, #o%o, #x%x%s, file %s)" char char char (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))) -- 2.23.0 --=-=-=--