diff options
| -rw-r--r-- | lisp/simple.el | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 7e4a1a4adfe..6ac05b42179 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -484,7 +484,15 @@ and the greater of them is not at the start of a line." | |||
| 484 | 484 | ||
| 485 | (defun what-cursor-position (&optional detail) | 485 | (defun what-cursor-position (&optional detail) |
| 486 | "Print info on cursor position (on screen and within buffer). | 486 | "Print info on cursor position (on screen and within buffer). |
| 487 | With prefix argument, print detailed info of a character on cursor position." | 487 | With prefix argument, print detailed info of a character on cursor position. |
| 488 | |||
| 489 | For the detailed information, Emacs internal character code, Emacs | ||
| 490 | internal character components (the character set name and position | ||
| 491 | code(s)), and the corresponding external character components (the | ||
| 492 | external character set name and external character code(s)) are shown | ||
| 493 | in this order. | ||
| 494 | |||
| 495 | Each language environment may show different external character components." | ||
| 488 | (interactive "P") | 496 | (interactive "P") |
| 489 | (let* ((char (following-char)) | 497 | (let* ((char (following-char)) |
| 490 | (beg (point-min)) | 498 | (beg (point-min)) |
| @@ -505,18 +513,39 @@ With prefix argument, print detailed info of a character on cursor position." | |||
| 505 | pos total percent beg end col hscroll) | 513 | pos total percent beg end col hscroll) |
| 506 | (message "point=%d of %d(%d%%) column %d %s" | 514 | (message "point=%d of %d(%d%%) column %d %s" |
| 507 | pos total percent col hscroll)) | 515 | pos total percent col hscroll)) |
| 508 | (let ((str (if detail (format " %s" (split-char char)) ""))) | 516 | (if detail |
| 517 | (let* ((internal (split-char char)) | ||
| 518 | (charset (char-charset char)) | ||
| 519 | (slot (assq charset charset-origin-alist)) | ||
| 520 | external) | ||
| 521 | (if slot | ||
| 522 | (setq external (list (nth 1 slot) (funcall (nth 2 slot) char))) | ||
| 523 | (if (eq charset 'composition) | ||
| 524 | (setq internal '("composite-character")) | ||
| 525 | (setq external (cons (charset-short-name charset) | ||
| 526 | (copy-sequence (cdr internal)))) | ||
| 527 | (if (= (charset-iso-graphic-plane charset) 1) | ||
| 528 | (progn | ||
| 529 | (setcar (cdr external) (+ (nth 1 external) 128)) | ||
| 530 | (if (nth 2 external) | ||
| 531 | (setcar (nthcdr 2 external) | ||
| 532 | (+ (nth 2 external) 128))))))) | ||
| 533 | (message "Char: %s (0%o, %d, 0x%x) %s %s" | ||
| 534 | (if (< char 256) | ||
| 535 | (single-key-description char) | ||
| 536 | (char-to-string char)) | ||
| 537 | char char char (or internal "") (or external ""))) | ||
| 509 | (if (or (/= beg 1) (/= end (1+ total))) | 538 | (if (or (/= beg 1) (/= end (1+ total))) |
| 510 | (message "Char: %s (0%o, %d, 0x%x) %s point=%d of %d(%d%%) <%d - %d> column %d %s" | 539 | (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) <%d - %d> column %d %s" |
| 511 | (if (< char 256) | 540 | (if (< char 256) |
| 512 | (single-key-description char) | 541 | (single-key-description char) |
| 513 | (char-to-string char)) | 542 | (char-to-string char)) |
| 514 | char char char str pos total percent beg end col hscroll) | 543 | char char char pos total percent beg end col hscroll) |
| 515 | (message "Char: %s (0%o, %d, 0x%x)%s point=%d of %d(%d%%) column %d %s" | 544 | (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) column %d %s" |
| 516 | (if (< char 256) | 545 | (if (< char 256) |
| 517 | (single-key-description char) | 546 | (single-key-description char) |
| 518 | (char-to-string char)) | 547 | (char-to-string char)) |
| 519 | char char char str pos total percent col hscroll)))))) | 548 | char char char pos total percent col hscroll)))))) |
| 520 | 549 | ||
| 521 | (defun fundamental-mode () | 550 | (defun fundamental-mode () |
| 522 | "Major mode not specialized for anything in particular. | 551 | "Major mode not specialized for anything in particular. |