aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-12-27 04:09:09 +0000
committerRichard M. Stallman1998-12-27 04:09:09 +0000
commite5e89e484c07d5c3db5a15bda4e000de7d4c0a83 (patch)
tree9d2510d5384043cd92828ce202811ceab4d744ac
parentdd0ffc284b9cc0ca92ae50fb40840478d413640b (diff)
downloademacs-e5e89e484c07d5c3db5a15bda4e000de7d4c0a83.tar.gz
emacs-e5e89e484c07d5c3db5a15bda4e000de7d4c0a83.zip
(what-cursor-position): Print character encoding also.
-rw-r--r--lisp/simple.el76
1 files changed, 46 insertions, 30 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 5012d600d75..4c314ad52e2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -513,39 +513,55 @@ Each language environment may show different external character components."
513 pos total percent beg end col hscroll) 513 pos total percent beg end col hscroll)
514 (message "point=%d of %d(%d%%) column %d %s" 514 (message "point=%d of %d(%d%%) column %d %s"
515 pos total percent col hscroll)) 515 pos total percent col hscroll))
516 (if detail 516 (let* ((coding-system buffer-file-coding-system)
517 (let* ((internal (split-char char)) 517 (encoding
518 (charset (char-charset char)) 518 (encode-coding-string (char-to-string char) coding-system t))
519 (slot (assq charset charset-origin-alist)) 519 (encoding-string-hex
520 external) 520 (mapconcat (lambda (ch) (format "0x%x" ch)) encoding " "))
521 (if slot 521 (encoding-msg
522 (setq external (list (nth 1 slot) (funcall (nth 2 slot) char))) 522 (if (and coding-system
523 (if (eq charset 'composition) 523 (not (and (= (length encoding) 1)
524 (setq internal '("composite-character")) 524 (= (aref encoding 0) char))))
525 (setq external (cons (charset-short-name charset) 525 (format "(0%o, %d, 0x%x, ext %s)"
526 (copy-sequence (cdr internal)))) 526 char char char
527 (if (= (charset-iso-graphic-plane charset) 1) 527 encoding-string-hex)
528 (progn 528 (format "(%s, %s, %s)"
529 (setcar (cdr external) (+ (nth 1 external) 128)) 529 encoding-string-oct
530 (if (nth 2 external) 530 encoding-string-dec
531 (setcar (nthcdr 2 external) 531 encoding-string-hex))))
532 (+ (nth 2 external) 128))))))) 532 (if detail
533 (message "Char: %s (0%o, %d, 0x%x) %s %s" 533 (let* ((internal (split-char char))
534 (if (< char 256) 534 (charset (char-charset char))
535 (single-key-description char) 535 (slot (assq charset charset-origin-alist))
536 (char-to-string char)) 536 external)
537 char char char (or internal "") (or external ""))) 537 (if slot
538 (if (or (/= beg 1) (/= end (1+ total))) 538 (setq external (list (nth 1 slot) (funcall (nth 2 slot) char)))
539 (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) <%d - %d> column %d %s" 539 (if (eq charset 'composition)
540 (setq internal '("composite-character"))
541 (setq external (cons (charset-short-name charset)
542 (copy-sequence (cdr internal))))
543 (if (= (charset-iso-graphic-plane charset) 1)
544 (progn
545 (setcar (cdr external) (+ (nth 1 external) 128))
546 (if (nth 2 external)
547 (setcar (nthcdr 2 external)
548 (+ (nth 2 external) 128)))))))
549 (message "Char: %s %s %s %s"
550 (if (< char 256)
551 (single-key-description char)
552 (char-to-string char))
553 encoding-msg (or internal "") (or external "")))
554 (if (or (/= beg 1) (/= end (1+ total)))
555 (message "Char: %s %s point=%d of %d(%d%%) <%d - %d> column %d %s"
556 (if (< char 256)
557 (single-key-description char)
558 (char-to-string char))
559 encoding-msg pos total percent beg end col hscroll)
560 (message "Char: %s %s point=%d of %d(%d%%) column %d %s"
540 (if (< char 256) 561 (if (< char 256)
541 (single-key-description char) 562 (single-key-description char)
542 (char-to-string char)) 563 (char-to-string char))
543 char char char pos total percent beg end col hscroll) 564 encoding-msg pos total percent col hscroll)))))))
544 (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) column %d %s"
545 (if (< char 256)
546 (single-key-description char)
547 (char-to-string char))
548 char char char pos total percent col hscroll))))))
549 565
550(defun fundamental-mode () 566(defun fundamental-mode ()
551 "Major mode not specialized for anything in particular. 567 "Major mode not specialized for anything in particular.