emacs-devel
[Top][All Lists]
Advanced

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

Re: reverting CJK input methods


From: Kenichi Handa
Subject: Re: reverting CJK input methods
Date: Fri, 30 Apr 2004 22:26:18 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Juri Linkov <address@hidden> writes:

> Miles Bader <address@hidden> writes:
>>  I think this would be nice to add to the output for `C-u C-x ='.
>> 
>>    character: ö (04366, 2294, 0x8f6, U+00F6)
>>      charset: latin-iso8859-1
>>           (Right-Hand Part of Latin Alphabet 1 (ISO/IEC 8859-1): ISO-IR-100.)
>>       ...
>>    keystroke: ö can be input by typing ";"
>>               (using the `german' input method)
>>       ...

> This would be very useful.

> BTW, another useful feature of `describe-char' is the ability
> to display information on a character displayed in the *Help*
> buffer itself.

> The recent changes in descr-text.el allow to do this, but buttons
> in the *Help* buffer become broken, because only text properties
> are copied, but not overlays.  To avoid problems of self-referencing
> to the same buffer, I propose to display information on characters of
> the *Help* buffer in a separate buffer whose name is generated by
> `(generate-new-buffer-name "*Help*")':

Ah, I didn't notice that failure.  How about the attached
change instead?  Perhaps we should also setup "[back]"
widget, but I forgot how to do that.  :-(

---
Ken'ichi HANDA
address@hidden

*** descr-text.el       21 Apr 2004 10:22:12 +0900      1.21
--- descr-text.el       30 Apr 2004 22:19:22 +0900      
***************
*** 465,470 ****
--- 465,471 ----
    (if (>= pos (point-max))
        (error "No character follows specified position"))
    (let* ((char (char-after pos))
+        (char-string (buffer-substring pos (1+ pos)))
         (charset (char-charset char))
         (buffer (current-buffer))
         (composition (find-composition pos nil nil t))
***************
*** 474,489 ****
                            standard-display-table))
         (disp-vector (and display-table (aref display-table char)))
         (multibyte-p enable-multibyte-characters)
!        text-prop-description
         item-list max-width unicode)
      (if (eq charset 'unknown)
!       (setq item-list
!             `(("character"
!                ,(format "%s (0%o, %d, 0x%x) -- invalid character code"
!                         (if (< char 256)
!                             (single-key-description char)
!                           (char-to-string char))
!                         char char char))))
  
        (if (or (< char 256)
              (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
--- 475,485 ----
                            standard-display-table))
         (disp-vector (and display-table (aref display-table char)))
         (multibyte-p enable-multibyte-characters)
!        (overlays (mapcar #'(lambda (o) (overlay-properties o))
!                          (overlays-at pos)))
         item-list max-width unicode)
      (if (eq charset 'unknown)
!       (setq item-list '"character")
  
        (if (or (< char 256)
              (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
***************
*** 491,504 ****
          (setq unicode (or (get-char-property pos 'untranslated-utf-8)
                            (encode-char char 'ucs))))
        (setq item-list
!           `(("character"
!              ,(format "%s (0%o, %d, 0x%x%s)" (if (< char 256)
!                                                (single-key-description char)
!                                              (char-to-string char))
!                       char char char
!                       (if unicode
!                           (format ", U+%04X" unicode)
!                         "")))
              ("charset"
               ,(symbol-name charset)
               ,(format "(%s)" (charset-description charset)))
--- 487,493 ----
          (setq unicode (or (get-char-property pos 'untranslated-utf-8)
                            (encode-char char 'ucs))))
        (setq item-list
!           `(("character")
              ("charset"
               ,(symbol-name charset)
               ,(format "(%s)" (charset-description charset)))
***************
*** 583,600 ****
                      (cons (list "Unicode data" " ") unicodedata))))))
      (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x)))
                                         item-list)))
!     (setq text-prop-description
!         (with-temp-buffer
!           (let ((buf (current-buffer)))
!             (save-excursion
!               (set-buffer buffer)
!               (describe-text-properties pos buf)))
!           (buffer-string)))
  
      (with-output-to-temp-buffer "*Help*"
        (with-current-buffer standard-output
        (set-buffer-multibyte multibyte-p)
        (let ((formatter (format "%%%ds:" max-width)))
          (dolist (elt item-list)
            (when (cadr elt)
              (insert (format formatter (car elt)))
--- 572,602 ----
                      (cons (list "Unicode data" " ") unicodedata))))))
      (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x)))
                                         item-list)))
!     (pop item-list)
  
      (with-output-to-temp-buffer "*Help*"
        (with-current-buffer standard-output
        (set-buffer-multibyte multibyte-p)
        (let ((formatter (format "%%%ds:" max-width)))
+         (insert (format formatter "character") " ")
+         (setq pos (point))
+         (insert char-string
+                 (format " (`%s', 0%o, %d, 0x%x"
+                         (if (< char 256)
+                             (single-key-description char)
+                           (char-to-string char))
+                         char char char)
+                 (if (eq charset 'unknown)
+                     ") -- invalid character code\n"
+                   (if unicode
+                       (format ", U+%04X)\n" unicode)
+                     ")\n")))
+         (mapc #'(lambda (props)
+                   (let ((o (make-overlay pos (1+ pos))))
+                     (while props
+                       (overlay-put o (car props) (nth 1 props))
+                       (setq props (cddr props)))))
+               overlays)
          (dolist (elt item-list)
            (when (cadr elt)
              (insert (format formatter (car elt)))
***************
*** 665,671 ****
          (insert "\nSee the variable `reference-point-alist' for "
                  "the meaning of the rule.\n"))
  
!       (insert text-prop-description)
        (describe-text-mode)))))
  
  (defalias 'describe-char-after 'describe-char)
--- 667,673 ----
          (insert "\nSee the variable `reference-point-alist' for "
                  "the meaning of the rule.\n"))
  
!       (describe-text-properties pos (current-buffer))
        (describe-text-mode)))))
  
  (defalias 'describe-char-after 'describe-char)




reply via email to

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