aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2009-01-20 02:15:43 +0000
committerKenichi Handa2009-01-20 02:15:43 +0000
commit2d3e4f023eceaa85b1374146375f3b90e6ef1b99 (patch)
treeb6c4cbebb2454547f9039ad9b515a642ef4a497d
parent959de43b7845f434cb56ea61d70b0df8517d0f53 (diff)
downloademacs-2d3e4f023eceaa85b1374146375f3b90e6ef1b99.tar.gz
emacs-2d3e4f023eceaa85b1374146375f3b90e6ef1b99.zip
(describe-char): Improve description of eight-bit
char in a unibyte buffer.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/descr-text.el114
2 files changed, 68 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4304949d6db..0cda430b400 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-01-20 Kenichi Handa <handa@m17n.org>
2
3 * descr-text.el (describe-char): Improve description of eight-bit
4 char in a unibyte buffer.
5
12009-01-20 Glenn Morris <rgm@gnu.org> 62009-01-20 Glenn Morris <rgm@gnu.org>
2 7
3 * emacs-lisp/authors.el (authors-aliases, authors-fixed-case): 8 * emacs-lisp/authors.el (authors-aliases, authors-fixed-case):
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 022acd67b9e..96ef2458e42 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -379,7 +379,9 @@ as well as widgets, buttons, overlays, and text properties."
379 (if (>= pos (point-max)) 379 (if (>= pos (point-max))
380 (error "No character follows specified position")) 380 (error "No character follows specified position"))
381 (let* ((char (char-after pos)) 381 (let* ((char (char-after pos))
382 (charset (or (get-text-property pos 'charset) (char-charset char))) 382 (eight-bit-p (and (not enable-multibyte-characters) (>= char 128)))
383 (charset (if eight-bit-p 'eight-bit
384 (or (get-text-property pos 'charset) (char-charset char))))
383 (composition (find-composition pos nil nil t)) 385 (composition (find-composition pos nil nil t))
384 (component-chars nil) 386 (component-chars nil)
385 (display-table (or (window-display-table) 387 (display-table (or (window-display-table)
@@ -404,9 +406,11 @@ as well as widgets, buttons, overlays, and text properties."
404 (kill-buffer tmp-buf)))) 406 (kill-buffer tmp-buf))))
405 item-list max-width code) 407 item-list max-width code)
406 408
407 (or (setq code (encode-char char charset)) 409 (if multibyte-p
408 (setq charset (char-charset char) 410 (or (setq code (encode-char char charset))
409 code (encode-char char charset))) 411 (setq charset (char-charset char)
412 code (encode-char char charset)))
413 (setq code char))
410 (setq item-list 414 (setq item-list
411 `(("character" 415 `(("character"
412 ,(format "%s (%d, #o%o, #x%x)" 416 ,(format "%s (%d, #o%o, #x%x)"
@@ -444,34 +448,40 @@ as well as widgets, buttons, overlays, and text properties."
444 (internal-describe-syntax-value syntax) 448 (internal-describe-syntax-value syntax)
445 (buffer-string)))) 449 (buffer-string))))
446 ("category" 450 ("category"
447 ,@(let ((category-set (char-category-set char))) 451 ,@(if (not eight-bit-p)
448 (if category-set 452 (let ((category-set (char-category-set char)))
449 (describe-char-categories category-set) 453 (if category-set
450 '("-- none --")))) 454 (describe-char-categories category-set)
455 '("-- none --")))))
451 ("to input" 456 ("to input"
452 ,@(let ((key-list (and (eq input-method-function 457 ,@(if (not eight-bit-p)
453 'quail-input-method) 458 (let ((key-list (and (eq input-method-function
454 (quail-find-key char)))) 459 'quail-input-method)
455 (if (consp key-list) 460 (quail-find-key char))))
456 (list "type" 461 (if (consp key-list)
457 (mapconcat #'(lambda (x) (concat "\"" x "\"")) 462 (list "type"
458 key-list " or ") 463 (mapconcat #'(lambda (x) (concat "\"" x "\""))
459 "with" 464 key-list " or ")
460 `(insert-text-button 465 "with"
461 ,current-input-method 466 `(insert-text-button
462 'type 'help-input-method 467 ,current-input-method
463 'help-args '(,current-input-method)))))) 468 'type 'help-input-method
469 'help-args '(,current-input-method)))))))
464 ("buffer code" 470 ("buffer code"
465 ,(encoded-string-description 471 ,(if multibyte-p
466 (string-as-unibyte (char-to-string char)) nil)) 472 (encoded-string-description
473 (string-as-unibyte (char-to-string char)) nil)
474 (format "#x%02X" char)))
467 ("file code" 475 ("file code"
468 ,@(let* ((coding buffer-file-coding-system) 476 ,@(if multibyte-p
469 (encoded (encode-coding-char char coding charset))) 477 (let* ((coding buffer-file-coding-system)
470 (if encoded 478 (encoded (encode-coding-char char coding charset)))
471 (list (encoded-string-description encoded coding) 479 (if encoded
472 (format "(encoded by coding system %S)" coding)) 480 (list (encoded-string-description encoded coding)
473 (list "not encodable by coding system" 481 (format "(encoded by coding system %S)" coding))
474 (symbol-name coding))))) 482 (list "not encodable by coding system"
483 (symbol-name coding))))
484 (list (format "#x%02X" char))))
475 ("display" 485 ("display"
476 ,(cond 486 ,(cond
477 (disp-vector 487 (disp-vector
@@ -529,9 +539,10 @@ as well as widgets, buttons, overlays, and text properties."
529 `(insert-text-button 539 `(insert-text-button
530 ,(symbol-name face) 540 ,(symbol-name face)
531 'type 'help-face 'help-args '(,face)))))) 541 'type 'help-face 'help-args '(,face))))))
532 ,@(let ((unicodedata (describe-char-unicode-data char))) 542 ,@(if (not eight-bit-p)
533 (if unicodedata 543 (let ((unicodedata (describe-char-unicode-data char)))
534 (cons (list "Unicode data" " ") unicodedata))))) 544 (if unicodedata
545 (cons (list "Unicode data" " ") unicodedata))))))
535 (setq max-width (apply #'max (mapcar #'(lambda (x) 546 (setq max-width (apply #'max (mapcar #'(lambda (x)
536 (if (cadr x) (length (car x)) 0)) 547 (if (cadr x) (length (car x)) 0))
537 item-list))) 548 item-list)))
@@ -665,25 +676,26 @@ as well as widgets, buttons, overlays, and text properties."
665 (insert "\nSee the variable `reference-point-alist' for " 676 (insert "\nSee the variable `reference-point-alist' for "
666 "the meaning of the rule.\n"))) 677 "the meaning of the rule.\n")))
667 678
668 (insert (if (not describe-char-unidata-list) 679 (unless eight-bit-p
669 "\nCharacter code properties are not shown: " 680 (insert (if (not describe-char-unidata-list)
670 "\nCharacter code properties: ")) 681 "\nCharacter code properties are not shown: "
671 (insert-text-button 682 "\nCharacter code properties: "))
672 "customize what to show" 683 (insert-text-button
673 'action (lambda (&rest ignore) 684 "customize what to show"
674 (customize-variable 685 'action (lambda (&rest ignore)
675 'describe-char-unidata-list))) 686 (customize-variable
676 (insert "\n") 687 'describe-char-unidata-list)))
677 (dolist (elt (if (eq describe-char-unidata-list t) 688 (insert "\n")
678 (nreverse (mapcar 'car char-code-property-alist)) 689 (dolist (elt (if (eq describe-char-unidata-list t)
679 describe-char-unidata-list)) 690 (nreverse (mapcar 'car char-code-property-alist))
680 (let ((val (get-char-code-property char elt)) 691 describe-char-unidata-list))
681 description) 692 (let ((val (get-char-code-property char elt))
682 (when val 693 description)
683 (setq description (char-code-property-description elt val)) 694 (when val
684 (insert (if description 695 (setq description (char-code-property-description elt val))
685 (format " %s: %s (%s)\n" elt val description) 696 (insert (if description
686 (format " %s: %s\n" elt val)))))) 697 (format " %s: %s (%s)\n" elt val description)
698 (format " %s: %s\n" elt val)))))))
687 699
688 (if text-props-desc (insert text-props-desc)) 700 (if text-props-desc (insert text-props-desc))
689 (setq help-xref-stack-item (list 'help-insert-string (buffer-string))) 701 (setq help-xref-stack-item (list 'help-insert-string (buffer-string)))