comparison lisp/descr-text.el @ 97196:15d4d10ad710

(describe-char-display): Call encode-coding-char with the arg CHARSET. (describe-char): Pay attention to the text-property `charset'.
author Kenichi Handa <handa@m17n.org>
date Fri, 01 Aug 2008 12:47:44 +0000
parents 8e17e43e57e9
children 067d03b2ec89
comparison
equal deleted inserted replaced
97195:a9b68f965d97 97196:15d4d10ad710
339 (code (cdr char-font-info))) 339 (code (cdr char-font-info)))
340 (if (integerp code) 340 (if (integerp code)
341 (format "%s:%s (#x%02X)" type name code) 341 (format "%s:%s (#x%02X)" type name code)
342 (format "%s:%s (#x%04X%04X)" 342 (format "%s:%s (#x%04X%04X)"
343 type name (car code) (cdr code)))))) 343 type name (car code) (cdr code))))))
344 (let* ((coding (terminal-coding-system)) 344 (let* ((charset (get-text-property pos 'charset))
345 (encoded (encode-coding-char char coding))) 345 (coding (terminal-coding-system))
346 (encoded (encode-coding-char char coding charset)))
346 (if encoded 347 (if encoded
347 (encoded-string-description encoded coding))))) 348 (encoded-string-description encoded coding charset)))))
348 349
349 350
350 ;; Return a string of CH with composition for padding on both sides. 351 ;; Return a string of CH with composition for padding on both sides.
351 ;; It is displayed without overlapping with the left/right columns. 352 ;; It is displayed without overlapping with the left/right columns.
352 (defsubst describe-char-padded-string (ch) 353 (defsubst describe-char-padded-string (ch)
361 as well as widgets, buttons, overlays, and text properties." 362 as well as widgets, buttons, overlays, and text properties."
362 (interactive "d") 363 (interactive "d")
363 (if (>= pos (point-max)) 364 (if (>= pos (point-max))
364 (error "No character follows specified position")) 365 (error "No character follows specified position"))
365 (let* ((char (char-after pos)) 366 (let* ((char (char-after pos))
366 (charset (char-charset char)) 367 (charset (or (get-text-property pos 'charset) (char-charset char)))
367 (composition (find-composition pos nil nil t)) 368 (composition (find-composition pos nil nil t))
368 (component-chars nil) 369 (component-chars nil)
369 (display-table (or (window-display-table) 370 (display-table (or (window-display-table)
370 buffer-display-table 371 buffer-display-table
371 standard-display-table)) 372 standard-display-table))
386 (describe-text-properties pos tmp-buf) 387 (describe-text-properties pos tmp-buf)
387 (with-current-buffer tmp-buf (buffer-string))) 388 (with-current-buffer tmp-buf (buffer-string)))
388 (kill-buffer tmp-buf)))) 389 (kill-buffer tmp-buf))))
389 item-list max-width code) 390 item-list max-width code)
390 391
391 (setq code (encode-char char charset)) 392 (or (setq code (encode-char char charset))
393 (setq charset (char-charset char)
394 code (encode-char char charset)))
392 (setq item-list 395 (setq item-list
393 `(("character" 396 `(("character"
394 ,(format "%s (%d, #o%o, #x%x)" 397 ,(format "%s (%d, #o%o, #x%x)"
395 (apply 'propertize char-description 398 (apply 'propertize char-description
396 (text-properties-at pos)) 399 (text-properties-at pos))
448 ("buffer code" 451 ("buffer code"
449 ,(encoded-string-description 452 ,(encoded-string-description
450 (string-as-unibyte (char-to-string char)) nil)) 453 (string-as-unibyte (char-to-string char)) nil))
451 ("file code" 454 ("file code"
452 ,@(let* ((coding buffer-file-coding-system) 455 ,@(let* ((coding buffer-file-coding-system)
453 (encoded (encode-coding-char char coding))) 456 (encoded (encode-coding-char char coding charset)))
454 (if encoded 457 (if encoded
455 (list (encoded-string-description encoded coding) 458 (list (encoded-string-description encoded coding)
456 (format "(encoded by coding system %S)" coding)) 459 (format "(encoded by coding system %S)" coding))
457 (list "not encodable by coding system" 460 (list "not encodable by coding system"
458 (symbol-name coding))))) 461 (symbol-name coding)))))