diff options
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/descr-text.el | 43 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-01-28 Eli Zaretskii <eliz@gnu.org> | 9 | 2012-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. |
| 380 | Is POS is taken to be in buffer BUFFER or current buffer if nil. | 380 | POS is taken to be in BUFFER, or the current buffer if BUFFER is nil. |
| 381 | The information includes character code, charset and code points in it, | 381 | The information is displayed in buffer `*Help*'. |
| 382 | syntax, category, how the character is encoded in a file, | 382 | |
| 383 | character composition information (if relevant), | 383 | The position information includes POS; the total size of BUFFER; the |
| 384 | as well as widgets, buttons, overlays, and text properties." | 384 | region limits, if narrowed; the column number; and the horizontal |
| 385 | scroll amount, if the buffer is horizontally scrolled. | ||
| 386 | |||
| 387 | The character information includes the character code; charset and | ||
| 388 | code points in it; syntax; category; how the character is encoded in | ||
| 389 | BUFFER and in BUFFER's file; character composition information (if | ||
| 390 | relevant); the font and font glyphs used to display the character; | ||
| 391 | the character's canonical name and other properties defined by the | ||
| 392 | Unicode Data Base; and widgets, buttons, overlays, and text properties | ||
| 393 | relevant 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) |