GNU bug report logs - #30458
hash table reverse-lookup (get-keys VALUE TABLE) => KEYS

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Wed, 14 Feb 2018 17:42:02 UTC

Severity: wishlist

Found in version 26.0

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: 30458 <at> debbugs.gnu.org
Subject: bug#30458: 26.0; `ucs-names': No reverse lookup function now
Date: Wed, 14 Feb 2018 19:04:11 +0000
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





This bug report was last modified 3 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.