GNU bug report logs - #10129
24.0.91; [PATCH] `C-u C-x =' should show position info

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Thu, 24 Nov 2011 18:53:01 UTC

Severity: normal

Tags: patch

Found in version 24.0.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10129 in the body.
You can then email your comments to 10129 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10129; Package emacs. (Thu, 24 Nov 2011 18:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Nov 2011 18:53:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.91; [PATCH] `C-u C-x =' should show position info
Date: Thu, 24 Nov 2011 10:50:36 -0800
[Message part 1 (text/plain, inline)]
`C-x =' shows information about the current position, including its
relation to the buffer size, its column, the region limits, and
horizontal scroll amount.
 
That position info is missing from the *Help* display for `C-u C-x ='.
It is only shown in the message, which is ephemeral and can easily be
overwritten.
 
The attached patch remedies this by including the position information
in *Help*.  The patch also updates the doc string accordingly (and
corrects improper grammar such as "Is POS is taken...").

In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600) of 2011-11-21 on MARVIN
 Windowing system distributor `Microsoft Corp.', version 5.1.2600
 configured using `configure --with-gcc (4.6) --no-opt --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-2.10.1/include --ldflags
 -LD:/devel/emacs/libs/gnutls-2.10.1/lib'
 
[descr-text-2011-11-24a.patch (application/octet-stream, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 28 Jan 2012 10:38:02 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Sat, 28 Jan 2012 10:38:02 GMT) Full text and rfc822 format available.

Message #10 received at 10129-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 10129-done <at> debbugs.gnu.org
Subject: Re: Character FOO
Date: Sat, 28 Jan 2012 12:34:08 +0200
> From: "Drew Adams" <drew.adams <at> oracle.com>
> Cc: <emacs-devel <at> gnu.org>
> Date: Wed, 25 Jan 2012 08:58:21 -0800
> 
> Why not apply this patch as well, while you're at it:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10129

Done.  I modified your patch slightly, mainly to make it more
consistent with what "C-x =" displays.  I also updated the doc string
to bring it in line with what is in fact displayed.  The actual patch
I committed is below.

Note that your patch was backwards; please in the future use

  diff -c OLD NEW

not the other way around.

Thanks.

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-01-28 09:52:24 +0000
+++ lisp/ChangeLog	2012-01-28 10:27:28 +0000
@@ -1,3 +1,11 @@
+2012-01-28  Drew Adams  <drew.adams <at> oracle.com>
+
+	* descr-text.el (describe-char): Show information about POS, in
+	addition to information about the character at POS.  Improve and
+	update the doc string.  Change "code point" to "code point in
+	charset", to avoid confusion with the character's Unicode code
+	point shown above that.  (Bug#10129)
+
 2012-01-28  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* descr-text.el (describe-char): Show the raw character, not only

=== modified file 'lisp/descr-text.el'
--- lisp/descr-text.el	2012-01-28 09:52:24 +0000
+++ lisp/descr-text.el	2012-01-28 10:27:28 +0000
@@ -376,12 +376,21 @@ This function is semi-obsolete.  Use `ge
 
 ;;;###autoload
 (defun describe-char (pos &optional buffer)
-  "Describe the character after POS (interactively, the character after point).
-Is POS is taken to be in buffer BUFFER or current buffer if nil.
-The information includes character code, charset and code points in it,
-syntax, category, how the character is encoded in a file,
-character composition information (if relevant),
-as well as widgets, buttons, overlays, and text properties."
+  "Describe position POS (interactively, point) and the char after POS.
+POS is taken to be in BUFFER, or the current buffer if BUFFER is nil.
+The information is displayed in buffer `*Help*'.
+
+The position information includes POS; the total size of BUFFER; the
+region limits, if narrowed; the column number; and the horizontal
+scroll amount, if the buffer is horizontally scrolled.
+
+The character information includes the character code; charset and
+code points in it; syntax; category; how the character is encoded in
+BUFFER and in BUFFER's file; character composition information (if
+relevant); the font and font glyphs used to display the character;
+the character's canonical name and other properties defined by the
+Unicode Data Base; and widgets, buttons, overlays, and text properties
+relevant to POS."
   (interactive "d")
   (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
   (let ((src-buf (current-buffer)))
@@ -511,7 +520,25 @@ as well as widgets, buttons, overlays, a
             (setq composition nil)))
 
       (setq item-list
-            `(("character"
+            `(("position"
+               ,(let* ((beg      (point-min))
+                       (end      (point-max))
+                       (total    (buffer-size))
+                       (percent  (if (> total 50000) ; Avoid overflow multiplying by 100
+                                     (/ (+ (/ total 200) (1- pos))  (max (/ total 100) 1))
+                                   (/ (+ (/ total 2) (* 100 (1- pos)))  (max total 1))))
+                       (hscroll  (if (= (window-hscroll) 0)
+                                     ""
+                                   (format ", Hscroll: %d" (window-hscroll))))
+                       (col      (current-column)))
+                  (if (or (/= beg 1)  (/= end (1+ total)))
+                      (format "%d of %d (%d%%), restriction: <%d-%d>, column: %d%s"
+                              pos total percent col beg end hscroll)
+                    (if (= pos end)
+                        (format "%d of %d (EOB), column: %d%s" pos total col hscroll)
+                      (format "%d of %d (%d%%), column: %d%s"
+                              pos total percent col hscroll)))))
+              ("character"
                ,(format "%s (displayed as %s) (codepoint %d, #o%o, #x%x)"
 			char-description
                         (apply 'propertize char-description
@@ -522,7 +549,7 @@ as well as widgets, buttons, overlays, a
                   ,(symbol-name charset)
                   'type 'help-character-set 'help-args '(,charset))
                ,(format "(%s)" (charset-description charset)))
-              ("code point"
+              ("code point in charset"
                ,(let ((str (if (integerp code)
                                (format (if (< code 256) "0x%02X" "0x%04X")
                                        code)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10129; Package emacs. (Sat, 28 Jan 2012 10:59:02 GMT) Full text and rfc822 format available.

Message #13 received at 10129 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: 10129 <at> debbugs.gnu.org
Subject: Re: bug#10129: Character FOO
Date: Sat, 28 Jan 2012 12:55:40 +0200
> Date: Sat, 28 Jan 2012 12:34:08 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 10129-done <at> debbugs.gnu.org
> 
> > From: "Drew Adams" <drew.adams <at> oracle.com>
> > Cc: <emacs-devel <at> gnu.org>
> > Date: Wed, 25 Jan 2012 08:58:21 -0800
> > 
> > Why not apply this patch as well, while you're at it:
> > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10129
> 
> Done.

Forgot to tell: the change is in revision 106975 on the trunk.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 25 Feb 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 71 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.