emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp descr-text.el


From: Kenichi Handa
Subject: [Emacs-diffs] emacs/lisp descr-text.el
Date: Tue, 20 Jan 2009 02:14:58 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   09/01/20 02:14:58

Modified files:
        lisp           : descr-text.el 

Log message:
        (describe-char): Improve description of eight-bit
        char in a unibyte buffer.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/descr-text.el?cvsroot=emacs&r1=1.75&r2=1.76

Patches:
Index: descr-text.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/descr-text.el,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- descr-text.el       19 Jan 2009 15:48:18 -0000      1.75
+++ descr-text.el       20 Jan 2009 02:14:58 -0000      1.76
@@ -379,7 +379,9 @@
   (if (>= pos (point-max))
       (error "No character follows specified position"))
   (let* ((char (char-after pos))
-        (charset (or (get-text-property pos 'charset) (char-charset char)))
+        (eight-bit-p (and (not enable-multibyte-characters) (>= char 128)))
+        (charset (if eight-bit-p 'eight-bit
+                   (or (get-text-property pos 'charset) (char-charset char))))
         (composition (find-composition pos nil nil t))
         (component-chars nil)
         (display-table (or (window-display-table)
@@ -404,9 +406,11 @@
              (kill-buffer tmp-buf))))
         item-list max-width code)
 
+    (if multibyte-p
     (or (setq code (encode-char char charset))
        (setq charset (char-charset char)
              code (encode-char char charset)))
+      (setq code char))
     (setq item-list
          `(("character"
             ,(format "%s (%d, #o%o, #x%x)"
@@ -444,12 +448,14 @@
                  (internal-describe-syntax-value syntax)
                  (buffer-string))))
            ("category"
-            ,@(let ((category-set (char-category-set char)))
+            ,@(if (not eight-bit-p)
+                  (let ((category-set (char-category-set char)))
                 (if category-set
                     (describe-char-categories category-set)
-                  '("-- none --"))))
+                      '("-- none --")))))
            ("to input"
-            ,@(let ((key-list (and (eq input-method-function
+            ,@(if (not eight-bit-p)
+                  (let ((key-list (and (eq input-method-function
                                        'quail-input-method)
                                    (quail-find-key char))))
                 (if (consp key-list)
@@ -460,18 +466,22 @@
                           `(insert-text-button
                             ,current-input-method
                             'type 'help-input-method
-                            'help-args '(,current-input-method))))))
+                                'help-args '(,current-input-method)))))))
            ("buffer code"
-            ,(encoded-string-description
-              (string-as-unibyte (char-to-string char)) nil))
+            ,(if multibyte-p
+                 (encoded-string-description
+                  (string-as-unibyte (char-to-string char)) nil)
+               (format "#x%02X" char)))
            ("file code"
-            ,@(let* ((coding buffer-file-coding-system)
+            ,@(if multibyte-p
+                  (let* ((coding buffer-file-coding-system)
                      (encoded (encode-coding-char char coding charset)))
                 (if encoded
                     (list (encoded-string-description encoded coding)
                           (format "(encoded by coding system %S)" coding))
                   (list "not encodable by coding system"
-                        (symbol-name coding)))))
+                            (symbol-name coding))))
+                (list (format "#x%02X" char))))
            ("display"
             ,(cond
               (disp-vector
@@ -529,9 +539,10 @@
                                     `(insert-text-button
                                       ,(symbol-name face)
                                       'type 'help-face 'help-args '(,face))))))
-           ,@(let ((unicodedata (describe-char-unicode-data char)))
+           ,@(if (not eight-bit-p)
+                 (let ((unicodedata (describe-char-unicode-data char)))
                (if unicodedata
-                   (cons (list "Unicode data" " ") unicodedata)))))
+                       (cons (list "Unicode data" " ") unicodedata))))))
     (setq max-width (apply #'max (mapcar #'(lambda (x)
                                             (if (cadr x) (length (car x)) 0))
                                         item-list)))
@@ -665,6 +676,7 @@
            (insert "\nSee the variable `reference-point-alist' for "
                    "the meaning of the rule.\n")))
 
+       (unless eight-bit-p
        (insert (if (not describe-char-unidata-list)
                     "\nCharacter code properties are not shown: "
                   "\nCharacter code properties: "))
@@ -683,7 +695,7 @@
              (setq description (char-code-property-description elt val))
              (insert (if description
                           (format "  %s: %s (%s)\n" elt val description)
-                        (format "  %s: %s\n" elt val))))))
+                         (format "  %s: %s\n" elt val)))))))
 
         (if text-props-desc (insert text-props-desc))
        (setq help-xref-stack-item (list 'help-insert-string (buffer-string)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]