diff options
| author | Noam Postavsky | 2016-11-27 14:41:02 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2016-12-06 22:20:23 -0500 |
| commit | 2a3420d94206a97f094580e06c25af91d5949516 (patch) | |
| tree | 725cd913267ceb1cf4dbc0f32671b44876b24f0b /src | |
| parent | 60fe63015165a03a765852f60367e548c1617f89 (diff) | |
| download | emacs-2a3420d94206a97f094580e06c25af91d5949516.tar.gz emacs-2a3420d94206a97f094580e06c25af91d5949516.zip | |
Give test-completion's PREDICATE the hashtable key
For hashtable entries with symbol keys, `test-completion' would convert
the key to a string before calling PREDICATE, unlike `try-completion'
and `all-completions'.
* src/minibuf.c (Ftest_completion): Pass original key from hashtable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 6c694cb3123..7c5af34102b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1736,26 +1736,27 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1736 | else if (HASH_TABLE_P (collection)) | 1736 | else if (HASH_TABLE_P (collection)) |
| 1737 | { | 1737 | { |
| 1738 | struct Lisp_Hash_Table *h = XHASH_TABLE (collection); | 1738 | struct Lisp_Hash_Table *h = XHASH_TABLE (collection); |
| 1739 | Lisp_Object key = Qnil; | ||
| 1740 | i = hash_lookup (h, string, NULL); | 1739 | i = hash_lookup (h, string, NULL); |
| 1741 | if (i >= 0) | 1740 | if (i >= 0) |
| 1742 | tem = HASH_KEY (h, i); | 1741 | { |
| 1742 | tem = HASH_KEY (h, i); | ||
| 1743 | goto found_matching_key; | ||
| 1744 | } | ||
| 1743 | else | 1745 | else |
| 1744 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 1746 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 1745 | if (!NILP (HASH_HASH (h, i)) | 1747 | { |
| 1746 | && (key = HASH_KEY (h, i), | 1748 | if (NILP (HASH_HASH (h, i))) continue; |
| 1747 | SYMBOLP (key) ? key = Fsymbol_name (key) : key, | 1749 | tem = HASH_KEY (h, i); |
| 1748 | STRINGP (key)) | 1750 | Lisp_Object strkey = (SYMBOLP (tem) ? Fsymbol_name (tem) : tem); |
| 1749 | && EQ (Fcompare_strings (string, make_number (0), Qnil, | 1751 | if (!STRINGP (strkey)) continue; |
| 1750 | key, make_number (0) , Qnil, | 1752 | if (EQ (Fcompare_strings (string, Qnil, Qnil, |
| 1751 | completion_ignore_case ? Qt : Qnil), | 1753 | strkey, Qnil, Qnil, |
| 1752 | Qt)) | 1754 | completion_ignore_case ? Qt : Qnil), |
| 1753 | { | 1755 | Qt)) |
| 1754 | tem = key; | 1756 | goto found_matching_key; |
| 1755 | break; | 1757 | } |
| 1756 | } | 1758 | return Qnil; |
| 1757 | if (!STRINGP (tem)) | 1759 | found_matching_key: ; |
| 1758 | return Qnil; | ||
| 1759 | } | 1760 | } |
| 1760 | else | 1761 | else |
| 1761 | return call3 (collection, string, predicate, Qlambda); | 1762 | return call3 (collection, string, predicate, Qlambda); |