aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2008-06-29 14:42:35 +0000
committerKenichi Handa2008-06-29 14:42:35 +0000
commit7a6744749f8652ecba327a218bbc202cb6601948 (patch)
treec56346980ad785d939a53a694cc5af42ceaa4f8e
parentfe44f0091c1f55dd774d9a85b92a3aa9cb629773 (diff)
downloademacs-7a6744749f8652ecba327a218bbc202cb6601948.tar.gz
emacs-7a6744749f8652ecba327a218bbc202cb6601948.zip
(describe-char-display): Always return a string.
(describe-char-padded-string): New function. (describe-char): Adjusted for the change of describe-char-display. Use describe-char-padded-string.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/descr-text.el80
2 files changed, 54 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c81b63998da..b3ad16a8130 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-06-29 Kenichi Handa <handa@m17n.org>
2
3 * descr-text.el (describe-char-display): Always return a string.
4 (describe-char-padded-string): New function.
5 (describe-char): Adjusted for the change of
6 describe-char-display. Use describe-char-padded-string.
7
12008-06-29 Andreas Schwab <schwab@suse.de> 82008-06-29 Andreas Schwab <schwab@suse.de>
2 9
3 * vc-dir.el (vc-dir): Make backend argument optional and use 10 * vc-dir.el (vc-dir): Make backend argument optional and use
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 527989d9961..3d655d8d83a 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -323,25 +323,34 @@ This function is semi-obsolete. Use `get-char-code-property'."
323 323
324;; Return information about how CHAR is displayed at the buffer 324;; Return information about how CHAR is displayed at the buffer
325;; position POS. If the selected frame is on a graphic display, 325;; position POS. If the selected frame is on a graphic display,
326;; return a cons (FONTNAME . GLYPH-CODE) where GLYPH-CODE is a 326;; return a string "FONT-DRIVER:FONT-NAME (GLYPH-CODE)" where:
327;; hexadigit string representing the glyph-ID. Otherwise, return a 327;; FONT-DRIVER is the font-driver name,
328;; string describing the terminal codes for the character. 328;; FONT-NAME is the font name,
329;; GLYPH-CODE is a hexadigit string representing the glyph-ID.
330;; Otherwise, return a string describing the terminal codes for the
331;; character.
329(defun describe-char-display (pos char) 332(defun describe-char-display (pos char)
330 (if (display-graphic-p (selected-frame)) 333 (if (display-graphic-p (selected-frame))
331 (let ((char-font-info (internal-char-font pos char))) 334 (let ((char-font-info (internal-char-font pos char)))
332 (if char-font-info 335 (if char-font-info
333 (if (integerp (cdr char-font-info)) 336 (let ((type (font-get (car char-font-info) :type))
334 (setcdr char-font-info (format "%02X" (cdr char-font-info))) 337 (name (font-xlfd-name (car char-font-info)))
335 (setcdr char-font-info 338 (code (cdr char-font-info)))
336 (format "%04X%04X" 339 (if (integerp code)
337 (cadr char-font-info) (cddr char-font-info))))) 340 (format "%s:%s (#x%02X)" type name code)
338 char-font-info) 341 (format "%s:%s (#x%04X%04X)"
342 type name (car code) (cdr code))))))
339 (let* ((coding (terminal-coding-system)) 343 (let* ((coding (terminal-coding-system))
340 (encoded (encode-coding-char char coding))) 344 (encoded (encode-coding-char char coding)))
341 (if encoded 345 (if encoded
342 (encoded-string-description encoded coding))))) 346 (encoded-string-description encoded coding)))))
343 347
344 348
349;; Return a string of CH with composition for padding on both sides.
350;; It is displayed without overlapping with the left/right columns.
351(defsubst describe-char-padded-string (ch)
352 (compose-string (string ch) 0 1 (format "\t%c\t" ch)))
353
345;;;###autoload 354;;;###autoload
346(defun describe-char (pos) 355(defun describe-char (pos)
347 "Describe the character after POS (interactively, the character after point). 356 "Describe the character after POS (interactively, the character after point).
@@ -481,10 +490,7 @@ as well as widgets, buttons, overlays, and text properties."
481 (let ((display (describe-char-display pos char))) 490 (let ((display (describe-char-display pos char)))
482 (if (display-graphic-p (selected-frame)) 491 (if (display-graphic-p (selected-frame))
483 (if display 492 (if display
484 (concat 493 (concat "by this font (glyph code)\n " display)
485 "by this font (glyph code)\n"
486 (format " %s (#x%s)"
487 (car display) (cdr display)))
488 "no font available") 494 "no font available")
489 (if display 495 (if display
490 (format "terminal code %s" display) 496 (format "terminal code %s" display)
@@ -555,8 +561,7 @@ as well as widgets, buttons, overlays, and text properties."
555 (insert (glyph-char (car (aref disp-vector i))) ?: 561 (insert (glyph-char (car (aref disp-vector i))) ?:
556 (propertize " " 'display '(space :align-to 5)) 562 (propertize " " 'display '(space :align-to 5))
557 (if (cdr (aref disp-vector i)) 563 (if (cdr (aref disp-vector i))
558 (format "%s (#x%s)" (cadr (aref disp-vector i)) 564 (cdr (aref disp-vector i))
559 (cddr (aref disp-vector i)))
560 "-- no font --") 565 "-- no font --")
561 "\n") 566 "\n")
562 (let ((face (glyph-face (car (aref disp-vector i))))) 567 (let ((face (glyph-face (car (aref disp-vector i)))))
@@ -577,13 +582,21 @@ as well as widgets, buttons, overlays, and text properties."
577 (if (car composition) 582 (if (car composition)
578 (if (cadr composition) 583 (if (cadr composition)
579 (insert " with the surrounding characters \"" 584 (insert " with the surrounding characters \""
580 (car composition) "\" and \"" 585 (mapconcat 'describe-char-padded-string
581 (cadr composition) "\"") 586 (car composition) "")
587 "\" and \""
588 (mapconcat 'describe-char-padded-string
589 (cadr composition) "")
590 "\"")
582 (insert " with the preceding character(s) \"" 591 (insert " with the preceding character(s) \""
583 (car composition) "\"")) 592 (mapconcat 'describe-char-padded-string
593 (car composition) "")
594 "\""))
584 (if (cadr composition) 595 (if (cadr composition)
585 (insert " with the following character(s) \"" 596 (insert " with the following character(s) \""
586 (cadr composition) "\""))) 597 (mapconcat 'describe-char-padded-string
598 (cadr composition) "")
599 "\"")))
587 (if (and (vectorp (nth 2 composition)) 600 (if (and (vectorp (nth 2 composition))
588 (vectorp (aref (nth 2 composition) 0))) 601 (vectorp (aref (nth 2 composition) 0)))
589 (progn 602 (progn
@@ -593,26 +606,27 @@ as well as widgets, buttons, overlays, and text properties."
593 "\nby these glyphs:\n") 606 "\nby these glyphs:\n")
594 (mapc (lambda (x) (insert (format " %S\n" x))) 607 (mapc (lambda (x) (insert (format " %S\n" x)))
595 (nth 2 composition))) 608 (nth 2 composition)))
596 (insert " by the rule:\n\t(" 609 (insert " by the rule:\n\t(")
597 (mapconcat (lambda (x) 610 (let ((first t))
598 (if (consp x) (format "%S" x) 611 (mapc (lambda (x)
599 (if (= x ?\t) 612 (if first (setq first nil)
600 (single-key-description x) 613 (insert " "))
601 (string ?? x)))) 614 (if (consp x) (insert (format "%S" x))
602 (nth 2 composition) 615 (if (= x ?\t) (insert (single-key-description x))
603 " ") 616 (insert ??)
604 ")") 617 (insert (describe-char-padded-string x)))))
605 (insert "\nThe component character(s) are displayed by ") 618 (nth 2 composition)))
619 (insert ")\nThe component character(s) are displayed by ")
606 (if (display-graphic-p (selected-frame)) 620 (if (display-graphic-p (selected-frame))
607 (progn 621 (progn
608 (insert "these fonts (glyph codes):") 622 (insert "these fonts (glyph codes):")
609 (dolist (elt component-chars) 623 (dolist (elt component-chars)
610 (if (/= (car elt) ?\t) 624 (if (/= (car elt) ?\t)
611 (insert "\n " (car elt) ?: 625 (insert "\n "
626 (describe-char-padded-string (car elt))
627 ?:
612 (propertize " " 'display '(space :align-to 5)) 628 (propertize " " 'display '(space :align-to 5))
613 (if (cdr elt) 629 (or (cdr elt) "-- no font --")))))
614 (format "%s (#x%s)" (cadr elt) (cddr elt))
615 "-- no font --")))))
616 (insert "these terminal codes:") 630 (insert "these terminal codes:")
617 (dolist (elt component-chars) 631 (dolist (elt component-chars)
618 (insert "\n " (car elt) ":" 632 (insert "\n " (car elt) ":"