aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDrew Adams2012-01-28 12:27:28 +0200
committerEli Zaretskii2012-01-28 12:27:28 +0200
commit7c188927ac3d28dfa2fa79e9dd25de85627b505b (patch)
tree82e8e06abef7ccb39905568dbd07133fba577b09 /lisp
parente0da685ab9eccd5a4e2c5114c980b4ac34ec7675 (diff)
downloademacs-7c188927ac3d28dfa2fa79e9dd25de85627b505b.tar.gz
emacs-7c188927ac3d28dfa2fa79e9dd25de85627b505b.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/descr-text.el43
2 files changed, 43 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b629637a79..e6c2b4ca226 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12012-01-28 Drew Adams <drew.adams@oracle.com>
2
3 * descr-text.el (describe-char): Show information about POS, in
4 addition to information about the character at POS. Improve and
5 update the doc string. Change "code point" to "code point in
6 charset", to avoid confusion with the character's Unicode code
7 point shown above that. (Bug#10129)
8
12012-01-28 Eli Zaretskii <eliz@gnu.org> 92012-01-28 Eli Zaretskii <eliz@gnu.org>
2 10
3 * descr-text.el (describe-char): Show the raw character, not only 11 * descr-text.el (describe-char): Show the raw character, not only
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 9aa061be57b..d2995ab790d 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -376,12 +376,21 @@ This function is semi-obsolete. Use `get-char-code-property'."
376 376
377;;;###autoload 377;;;###autoload
378(defun describe-char (pos &optional buffer) 378(defun describe-char (pos &optional buffer)
379 "Describe the character after POS (interactively, the character after point). 379 "Describe position POS (interactively, point) and the char after POS.
380Is POS is taken to be in buffer BUFFER or current buffer if nil. 380POS is taken to be in BUFFER, or the current buffer if BUFFER is nil.
381The information includes character code, charset and code points in it, 381The information is displayed in buffer `*Help*'.
382syntax, category, how the character is encoded in a file, 382
383character composition information (if relevant), 383The position information includes POS; the total size of BUFFER; the
384as well as widgets, buttons, overlays, and text properties." 384region limits, if narrowed; the column number; and the horizontal
385scroll amount, if the buffer is horizontally scrolled.
386
387The character information includes the character code; charset and
388code points in it; syntax; category; how the character is encoded in
389BUFFER and in BUFFER's file; character composition information (if
390relevant); the font and font glyphs used to display the character;
391the character's canonical name and other properties defined by the
392Unicode Data Base; and widgets, buttons, overlays, and text properties
393relevant to POS."
385 (interactive "d") 394 (interactive "d")
386 (unless (buffer-live-p buffer) (setq buffer (current-buffer))) 395 (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
387 (let ((src-buf (current-buffer))) 396 (let ((src-buf (current-buffer)))
@@ -511,7 +520,25 @@ as well as widgets, buttons, overlays, and text properties."
511 (setq composition nil))) 520 (setq composition nil)))
512 521
513 (setq item-list 522 (setq item-list
514 `(("character" 523 `(("position"
524 ,(let* ((beg (point-min))
525 (end (point-max))
526 (total (buffer-size))
527 (percent (if (> total 50000) ; Avoid overflow multiplying by 100
528 (/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1))
529 (/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))
530 (hscroll (if (= (window-hscroll) 0)
531 ""
532 (format ", Hscroll: %d" (window-hscroll))))
533 (col (current-column)))
534 (if (or (/= beg 1) (/= end (1+ total)))
535 (format "%d of %d (%d%%), restriction: <%d-%d>, column: %d%s"
536 pos total percent col beg end hscroll)
537 (if (= pos end)
538 (format "%d of %d (EOB), column: %d%s" pos total col hscroll)
539 (format "%d of %d (%d%%), column: %d%s"
540 pos total percent col hscroll)))))
541 ("character"
515 ,(format "%s (displayed as %s) (codepoint %d, #o%o, #x%x)" 542 ,(format "%s (displayed as %s) (codepoint %d, #o%o, #x%x)"
516 char-description 543 char-description
517 (apply 'propertize char-description 544 (apply 'propertize char-description
@@ -522,7 +549,7 @@ as well as widgets, buttons, overlays, and text properties."
522 ,(symbol-name charset) 549 ,(symbol-name charset)
523 'type 'help-character-set 'help-args '(,charset)) 550 'type 'help-character-set 'help-args '(,charset))
524 ,(format "(%s)" (charset-description charset))) 551 ,(format "(%s)" (charset-description charset)))
525 ("code point" 552 ("code point in charset"
526 ,(let ((str (if (integerp code) 553 ,(let ((str (if (integerp code)
527 (format (if (< code 256) "0x%02X" "0x%04X") 554 (format (if (< code 256) "0x%02X" "0x%04X")
528 code) 555 code)