From: Andy Moreton <andrewjmoreton@gmail.com>
To: 30458@debbugs.gnu.org
Subject: bug#30458: 26.0; `ucs-names': No reverse lookup function now
Date: Wed, 14 Feb 2018 19:04:11 +0000 [thread overview]
Message-ID: <vz1po57o0k4.fsf@gmail.com> (raw)
In-Reply-To: <35ab0734-9032-4331-90e8-825f58fba059@default>
On Wed 14 Feb 2018, Drew Adams wrote:
> Before Emacs 26, `ucs-names' was an alist. That meant that you could
> not only look up a character, given its name or code, but you could also
> easily look up a character name, given the character:
>
> (car (rassq CHARACTER (ucs-names)))
>
> How is this done now, with (ucs-names) returning a hash table?
>
> There is now a function `char-from-name', to replace the former forward
> alist lookup (car (assoc CHAR-NAME (ucs-names))). But there doesn't
> seem to be any reverse lookup now for `ucs-names' (e.g. `char-name' or
> `char-name-from-char').
Looking at the implementation of ucs-names, does get-char-code-property
do what you want ?
(char-from-name "GREEK SMALL LETTER LAMBDA")
=> 955
(char-from-name "GREEK SMALL LETTER LAMDA")
=> 955
(get-char-code-property 955 'name)
=> "GREEK SMALL LETTER LAMDA"
(get-char-code-property 955 'old-name)
=> "GREEK SMALL LETTER LAMBDA"
HTH,
AndyM
next prev parent reply other threads:[~2018-02-14 19:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 17:41 bug#30458: 26.0; `ucs-names': No reverse lookup function now Drew Adams
2018-02-14 19:04 ` Andy Moreton [this message]
2018-02-14 21:09 ` Drew Adams
2018-02-15 2:01 ` Noam Postavsky
2021-08-12 14:40 ` bug#30458: hash table reverse-lookup (get-keys VALUE TABLE) => KEYS Lars Ingebrigtsen
2021-08-12 15:08 ` bug#30458: [External] : " Drew Adams
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=vz1po57o0k4.fsf@gmail.com \
--to=andrewjmoreton@gmail.com \
--cc=30458@debbugs.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).