Closed torgeir closed 6 years ago
Oh, thanks! Caching them is a great idea. My one concern is that if a user modifies the company-emoji-aliases
custom variable, those won't take effect until Emacs is restarted. Any idea how we might get around that?
Oh, I didn't realize that. Detecting a defcustom change isn't possible afaik.. We could expose a function to add aliases and regenerate the list when its done? And change the cached list to a defvar
Sorry for the delay in replying! That sounds promising, if you want to try making that change.
I won't have time to have a go at this in the near future, feel free to close it
@dunn You can use a :set
keyword to recreate the list of emojis when the aliases have changed.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Definitions.html
So this took a while :grin:
The last commit prefixes the cached list of emojis and uses :set
as per @wyuenho's suggestion to recreate the cached list on company-emoji-aliases
change.
And on second thoughts I really don't see how this is nescessary as the aliases are looked up at runtime when invoking company-emoji
, before the list of emojis is consulted.
https://github.com/dunn/company-emoji/blob/master/company-emoji.el#L192-L193
Yeah, it has no effect. Reverted it to keep only the namespaced var. Seems to work fine on my end, with added user aliases appearing instantly.
Thanks so much!
Cache the list of emojis between company complete calls to speed up completion.