| Age | Commit message (Collapse) | Author |
|
|
|
- Minor cleanup
- cape-char--translation: Take prefix keys as argument instead of regexp
- Add eval-and-compile, such that function is available at compile-/runtime
- Extract annotation, docsig and exit function
- Improve docsig function for combined characters
|
|
This lets the translation hash to be computed within the macro rather
than after the macro is expanded.
I kept the name `hash` for the variable symbol to conform to the style
of the other macro variables/functions in let.
|
|
Also note that the purity declaration is also removed.
Suggested from PR review comments.
> If we remove that, which is possible because of your vastly simpler
> implementation, the macro can be used, which is a significant
> improvement over the status quo
The reason for the change in this commit is because of the improved
implementation for the translation-hash function (several commits ago).
|
|
...so resulting byte code is simpler, as suggested by minad in PR review.
|
|
This fixes the void-function errors. Efficiency wise IMO it's pretty
much on par with the function implementation. But when the current
translation function having `eval-when-compile` around it, this
suppresses the cape-char--translation-hash symbol definition is void
errors.
There are possibly more targeted fixes to this problem, and we'll
probably be changing the `eval-when-compile` in the future anyway, but I
think this change isn't really a "hack" to fix it -- just an alternate
solution for `*--ensure-*` functions (macros).
|
|
|
|
- Rather than putting details on the hash contents as comments, put
them in the docstring so the user of the function can see it without
viewing source
- Call `quail-use-package` before the let block since it doesn't rely
on the variables bound in let
- No need to set `quail-current-package` ourselves
- map-list (previously bound in let) is only used once, so now it's
put inline in quail-build-decode-map call
- Formatting refactors
|
|
Note that this is not an atomic commit :')
- Previously filtered out translations that are stored as a vector but
with only one element. Now those are included with that element as the
translation.
- Some translations (particularly emoji of country flags) cannot
preserve their string when converted to char then back to string. For
cases like these they are now stored as strings in the hash table. All
other translations are still stored as chars (to save space in
storing the hash).
One can possibly use (= (string-width value-str) 2) to check, but some
strings that satisfy this condition also satisfy string-char
reversability, so the naive (string= (char-to-string value-char)
value-str) is used.
This directly allows for completing emoji country flags. I did not
look into any other benefits of this regarding other input methods.
Because of this change, new helper functions cape-char --ensure-str
and --ensure-char are introduced to ace clarity when updating
cape-char--define.
- Moved (require 'quail) into the translation function.
(resolves review comment)
- Better doc string and naming of translation function: This clarifies
from the function name that a hash is returned -- better for when the
function becomes a public API.
- Reverted removing regexp argument from translation function. This
allows filtering out name-value translation pairs from the hash that
do not match the required prefixes. Waste of space to keep those
translations around in the hash.
(resolves review comment)
|
|
This uses quail functions to obtain the hash rather than parsing the
output of describe-input-method, which makes it more stable since
relying on emacs library data structures is better than relying on help
output formats.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stefan Monnier had recommended that a while ago. While Elisp symbols are
commonly referred to as symbols in Emacs, we reduce confusion that way. Cape
also provides `cape-elisp-block', such that the renaming improves consistency.
|
|
|
|
|
|
|
|
completion--some is private and performs unnecessary error handling. The
assumption is that none of the merged tables throws an error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Resetting `completion-regexp-list' is necessary since the candidate computation
could itself use `all-completions'. Ideally such usage of `all-completions'
would rebind `completion-regexp-list' to nil itself, but it is safer to ensure
this from outside.
|
|
|
|
|
|
|
|
|