emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106975: Fix bug #10129: add position


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106975: Fix bug #10129: add positional information to "C-u C-x =".
Date: Sat, 28 Jan 2012 12:27:28 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106975
fixes bug(s): http://debbugs.gnu.org/10129
author: Drew Adams <address@hidden>
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-01-28 12:27:28 +0200
message:
  Fix bug #10129: add positional information to "C-u C-x =".
  
   lisp/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.
modified:
  lisp/ChangeLog
  lisp/descr-text.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-28 09:52:24 +0000
+++ b/lisp/ChangeLog    2012-01-28 10:27:28 +0000
@@ -1,3 +1,11 @@
+2012-01-28  Drew Adams  <address@hidden>
+
+       * 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  <address@hidden>
 
        * descr-text.el (describe-char): Show the raw character, not only

=== modified file 'lisp/descr-text.el'
--- a/lisp/descr-text.el        2012-01-28 09:52:24 +0000
+++ b/lisp/descr-text.el        2012-01-28 10:27:28 +0000
@@ -376,12 +376,21 @@
 
 ;;;###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 @@
             (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 @@
                   ,(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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]