unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org, miles@gnu.org
Subject: Re: reverting CJK input methods
Date: Fri, 30 Apr 2004 22:26:18 +0900 (JST)	[thread overview]
Message-ID: <200404301326.WAA02744@etlken.m17n.org> (raw)
In-Reply-To: <87u0z1puxa.fsf@mail.jurta.org> (message from Juri Linkov on Fri,  30 Apr 2004 14:27:45 +0300)

In article <87u0z1puxa.fsf@mail.jurta.org>, Juri Linkov <juri@jurta.org> writes:

> Miles Bader <miles@lsi.nec.co.jp> 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
handa@m17n.org

*** 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	other threads:[~2004-04-30 13:26 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29 13:03 reverting CJK input methods Werner LEMBERG
2004-04-30  1:42 ` Kenichi Handa
2004-04-30  2:03   ` Miles Bader
2004-04-30  2:59     ` Miles Bader
2004-04-30 11:27       ` Juri Linkov
2004-04-30 13:26         ` Kenichi Handa [this message]
2004-05-01  8:22           ` Juri Linkov
2004-05-02  1:57             ` Kenichi Handa
2004-05-06  5:05               ` with-output-to-temp-buffer [Re: reverting CJK input methods] Kenichi Handa
2004-05-06 11:48                 ` Richard Stallman
2004-05-06 13:10                   ` Kenichi Handa
2004-05-06 14:27                     ` Stefan Monnier
2004-05-06 15:49                       ` Kevin Rodgers
2004-05-06 16:50                         ` Stefan Monnier
2004-05-06 20:57                           ` Kevin Rodgers
2004-05-07  1:53                       ` Kenichi Handa
2004-05-08  1:20                     ` Richard Stallman
2004-05-10 12:13                       ` Kenichi Handa
2004-05-10 14:28                         ` Stefan Monnier
2004-05-11  7:04                           ` Richard Stallman
2004-05-11  7:49                             ` David Kastrup
2004-05-12  7:51                               ` Richard Stallman
2004-05-11 13:39                             ` erase-buffer (was: with-output-to-temp-buffer) Stefan Monnier
2004-05-11 14:44                               ` erase-buffer Juri Linkov
2004-05-11 16:17                                 ` erase-buffer Juri Linkov
2004-05-11 15:32                               ` erase-buffer (was: with-output-to-temp-buffer) David Kastrup
2004-05-11 16:22                                 ` Kevin Rodgers
2004-05-11 19:30                                   ` Stefan Monnier
2004-05-12 21:10                                     ` Kevin Rodgers
2004-05-11 19:37                                   ` Juanma Barranquero
2004-05-11 18:14                                 ` Juanma Barranquero
2004-05-11 23:06                               ` Kenichi Handa
2004-05-11 23:26                                 ` Miles Bader
2004-05-12 19:42                                   ` Richard Stallman
2004-05-12 22:34                                     ` Miles Bader
2004-05-14  9:21                                       ` Richard Stallman
2004-05-11 23:34                                 ` Stefan Monnier
2004-05-11 23:47                                   ` Kenichi Handa
2004-05-12 19:40                               ` Richard Stallman
2004-05-11  1:45                         ` with-output-to-temp-buffer [Re: reverting CJK input methods] Luc Teirlinck
2004-05-11  2:34                           ` Kenichi Handa
2004-05-11  7:01                             ` David Kastrup
2004-05-11  6:55                               ` Kim F. Storm
2004-05-11  8:00                               ` Kenichi Handa
2004-05-12  7:51                               ` Richard Stallman
2004-04-30  5:06     ` reverting CJK input methods Kenichi Handa
2004-04-30 16:50       ` Werner LEMBERG
2004-05-01  9:07         ` Miles Bader
2004-05-01 17:18           ` Werner LEMBERG
2004-05-08  2:56         ` Kenichi Handa
2004-05-08 16:38           ` Werner LEMBERG
2004-05-10  4:40             ` Kenichi Handa
2004-05-12  2:42               ` Kenichi Handa
2004-05-12  8:32                 ` Werner LEMBERG
2004-05-12 11:10                   ` Kenichi Handa
2004-05-01 17:21       ` Werner LEMBERG

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404301326.WAA02744@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).