In article <[EMAIL PROTECTED]>, "Drew Adams" <[EMAIL PROTECTED]> writes:

> Thanks very much. I have this now - I just added a stub for the generic-char
> case, for now. Please let me know if I misunderstood something.

> (when (keymapp (cdr keys+map))          ; Avoid, e.g. `t'.
>   (map-keymap (lambda (event binding)
>                 (cond ((and (or (commandp binding) (keymapp binding))
>                             (or (not (eq 'self-insert-command  binding))
>                                 (char-valid-p event))) ; Insert normal char.
>                        (push `((,(single-key-description event)
>                                  ,(if (keymapp binding)
>                                       "..." ; Prefix key
>                                       (format "%S" binding)))) ; e.g.
> command.
>                              keys+cmds))
>                       ((and (integerp event)
>                             (generic-char-p event)
>                             (eq 'self-insert-command  binding)) ; Generic
> char.
>                        (ignore))))      ; Placeholder for future use.
>               (cdr keys+map)))

> I'd like to know a way to insert a multibyte char - for example, replace
> `ignore' here with a push of a pseudo-binding name of, say, "multibyte
> char...", and then, when the user subsequently picks a completion candidate
> for that pseudo-binding name, let him complete against the possible
> characters for that character group to insert one. The character group
> (generic char) name would appear as part of the completion candidate - for
> example:

I've just committed a change to make single-key-description
return unique names for generic characters.   And, you can
use a code like this to get characters in a generic
character.

(defun chars-in-generic-char (generic-char)
  "Return a list of characters belonging to GENERIC-CHAR.
An element itself may be a generic character if the charset of
GENERIC-CHAR is 2-dimensional and GENERIC-CHAR specifies no code
points."
  (or (generic-char-p generic-char)
      (error "Not a generic character: %s" generic-char))
  (let* ((split (split-char generic-char))
         (charset (car split))
         (code1 (nth 1 split))
         (chars (charset-chars charset))
         from to l)
    (if (= chars 94)
        (setq from 33 to 126)
      (setq from 32 to 127))
    (if (> code1 0)
        (while (>= to from)
          (push (make-char charset code1 to) l)
          (setq to (1- to)))
      (while (>= to from)
        (push (make-char charset to) l)
        (setq to (1- to))))
    l))

> As I said, this would provide a poor man's means of inserting a multibyte
> character - useful in some contexts, for some people, perhaps. [Quick, how
> do you insert an Ethiopian character or a math summation symbol or a
> paragraph symbol (pilcrow)?] Assuming that you have the proper fonts, this
> would provide a slow but WYSIWYG way to insert any (?) character (even
> character graphics?). (You could still insert the char, even if you didn't
> have the fonts, but you wouldn't see what you were inserting!)

If you have proper fonts, I think M-x list-charset-chars RET
CHARSET-NAME RET and cut&paste is sufficient.

> I tried to find info on inserting multibyte chars in the Elisp manual, but I
> didn't really find an explanation that helped me. If you have a suggestion
> or can point me to where I can read up on inserting such chars (using Lisp),
> please let me know, and maybe I'll take a crack at trying that.

Where is the problem in the Elisp manual about "inserting
multibyte chars"?  You can use the same functions (insert,
insert-char) as ASCII characters to insert them.

---
Kenichi Handa
[EMAIL PROTECTED]


_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to