Closed gilbertw1 closed 6 years ago
Comments:
aya-case-fold
to be off? Seems like a straight upgrade.cl-lib
in place of seq functions (seq-some
, seq-filter
) etc.alist-get
was introduced, please check.Hey,
Thanks!
I've replaced the seq-*
functions with cl-*
functions, and I've replaced the alist-get
function calls as well. Let me know how you' like me to handle 1.
make it on by default
Let's do it like that.
What's your target minimum version?
24.3.
Cool, I've defaulted the feature to on by default.
Thanks.
This pull request adds support for the option
aya-case-fold
. This option essentially allows auto-yasnippet to create templates where variables that are identical apart from the case of the first character are linked together to a single variable with case in the resulting snippet is preserved.I know that sounds like a mouthful, but the easiest way to see the behavior is in this screencast (first with this setting disabled, then again with it enabled):
I modeled this feature after the ability to find and replace text while preserving the case of the initial character: https://www.emacswiki.org/emacs/CaseFoldSearch.
The code is fairly straightforward. I'm now returning an alist from
aya--parse
that contains theid
of the match, it'svalue
, anducase
(whether or not the value was uppercase or not). That alist is used to both recreate the current line with proper casing and create a yas template that conditionally uppercases the value to match the original casing.