From: Miles Bader <miles@gnu.org>
To: Kenichi Handa <handa@m17n.org>
Cc: Eli Zaretskii <eliz@gnu.org>, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Input method or help feature needed
Date: Mon, 21 Feb 2011 17:25:49 +0900 [thread overview]
Message-ID: <buofwrhequq.fsf@dhlpc061.dev.necel.com> (raw)
In-Reply-To: <tl762sdde1e.fsf@m17n.org> (Kenichi Handa's message of "Mon, 21 Feb 2011 16:47:57 +0900")
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
Kenichi Handa <handa@m17n.org> writes:
> Creating buttons for each character naively is also slow.
> It may be good if there's a way to create a help-echo on the
> fly.
Like the following? (two patches, one for "lisp/button.el", the other
for your list-script-chars file)
-miles
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to allow button help-echo to be a function --]
[-- Type: text/x-diff, Size: 469 bytes --]
diff -up lisp/button.el.\~1\~ lisp/button.el
--- lisp/button.el.~1~ 2011-01-31 12:33:51.000000000 +0900
+++ lisp/button.el 2011-02-21 17:17:40.408941730 +0900
@@ -463,6 +463,8 @@ Returns the button found."
(if (null button)
(error (if wrap "No buttons!" "No more buttons"))
(let ((msg (and display-message (button-get button 'help-echo))))
+ (when (functionp msg)
+ (setq msg (funcall msg button)))
(when msg
(message "%s" msg)))
button)))
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Patch for list-script-chars to use button function help-echo --]
[-- Type: text/x-diff, Size: 1256 bytes --]
diff -up /tmp/lsc.el.\~1\~ /tmp/lsc.el
--- /tmp/lsc.el.~1~ 2011-02-21 17:22:14.214098588 +0900
+++ /tmp/lsc.el 2011-02-21 17:22:23.365735810 +0900
@@ -1,19 +1,19 @@
(defvar list-script-chars-handler-alist nil)
(define-button-type 'active-char
- 'face '(:background "gray")
+ 'face '(:background "grey10")
'action #'(lambda (button)
- (copy-region-as-kill (button-start button) (button-end button))))
+ (copy-region-as-kill (button-start button) (button-end button)))
+ 'help-echo #'(lambda (button)
+ (let* ((char (char-after (button-start button)))
+ (name (get-char-code-property char 'name)))
+ (format "U+%04X: %s" char name)))
+ 'mouse-face (list :background "yellow"))
(defun make-character-button (char)
(let ((name (get-char-code-property char 'name)))
(when name
- (insert-text-button
- (string char)
- :type 'active-char
- 'help-echo (format "U+%04X: %s" char name)
- ;; We must make this list each time to highlight only one character.
- 'mouse-face (list :background "yellow")))))
+ (insert-text-button (string char) :type 'active-char))))
;; List characters in RANGE in the current buffer assuming that the
;; window width is 80, and tab-width is set to 4.
[-- Attachment #4: Type: text/plain, Size: 65 bytes --]
--
Liberty, n. One of imagination's most precious possessions.
next prev parent reply other threads:[~2011-02-21 8:25 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 19:14 Input method or help feature needed Richard Stallman
2011-02-17 19:27 ` Eli Zaretskii
2011-02-17 19:52 ` Stephen Berman
2011-02-17 20:24 ` Harald Hanche-Olsen
2011-02-18 10:53 ` Eli Zaretskii
2011-02-18 15:46 ` Eli Zaretskii
2011-02-18 20:00 ` Ted Zlatanov
2011-02-17 22:05 ` Stefan Monnier
2011-02-18 21:24 ` Richard Stallman
2011-02-19 7:49 ` Eli Zaretskii
2011-02-19 8:01 ` David Kastrup
2011-02-19 8:37 ` Miles Bader
2011-02-20 0:30 ` Richard Stallman
2011-02-20 0:29 ` Richard Stallman
2011-02-20 3:59 ` Eli Zaretskii
2011-02-20 21:01 ` Richard Stallman
2011-02-18 21:24 ` Richard Stallman
2011-02-17 19:31 ` Justin Lilly
2011-02-17 19:41 ` Tassilo Horn
2011-02-18 21:24 ` Richard Stallman
2011-02-19 7:30 ` Eli Zaretskii
2011-02-19 8:18 ` Stephen J. Turnbull
2011-02-19 8:33 ` Miles Bader
2011-03-04 9:10 ` Kevin Rodgers
2011-02-17 20:26 ` Paul Eggert
2011-02-17 22:50 ` Andreas Schwab
2011-02-18 0:09 ` Miles Bader
2011-02-18 5:13 ` Werner LEMBERG
2011-02-18 8:37 ` tomas
2011-02-18 8:41 ` Miles Bader
2011-02-18 11:27 ` Kenichi Handa
2011-02-20 8:27 ` tomas
2011-02-20 10:41 ` Eli Zaretskii
2011-02-20 11:16 ` David Kastrup
2011-02-20 21:01 ` Richard Stallman
2011-02-20 21:30 ` Eli Zaretskii
2011-02-21 2:53 ` Stephen J. Turnbull
2011-02-21 22:35 ` Richard Stallman
2011-02-21 0:59 ` Kenichi Handa
2011-02-21 7:02 ` Eli Zaretskii
2011-02-21 7:47 ` Kenichi Handa
2011-02-21 8:25 ` Miles Bader [this message]
2011-02-21 8:29 ` Eli Zaretskii
2011-02-21 11:14 ` Kenichi Handa
2011-02-21 12:25 ` Eli Zaretskii
2011-02-22 0:55 ` Kenichi Handa
2011-02-22 1:23 ` Miles Bader
2011-02-21 22:36 ` Richard Stallman
2011-02-21 22:36 ` Richard Stallman
2011-02-18 8:43 ` David Kastrup
2011-02-20 8:30 ` tomas
2011-02-20 10:45 ` Eli Zaretskii
2011-02-18 21:25 ` Richard Stallman
2011-02-19 7:52 ` Eli Zaretskii
2011-02-20 0:29 ` Richard Stallman
2011-02-20 7:43 ` James Cloos
2011-02-20 21:01 ` Richard Stallman
2011-02-20 22:45 ` Harald Hanche-Olsen
2011-02-21 22:35 ` Richard Stallman
2011-02-21 22:35 ` Richard Stallman
2011-02-22 6:05 ` Harald Hanche-Olsen
2011-02-22 20:25 ` Richard Stallman
2011-02-19 19:26 ` James Cloos
2011-02-20 21:00 ` Richard Stallman
2011-02-20 21:33 ` Drew Adams
2011-02-21 22:36 ` Richard Stallman
2011-02-21 22:51 ` Drew Adams
2011-02-22 20:25 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2011-02-18 10:39 Андрей Парамонов
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=buofwrhequq.fsf@dhlpc061.dev.necel.com \
--to=miles@gnu.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.org \
--cc=rms@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).