Always evaluate active templates at the insertion point#200
Always evaluate active templates at the insertion point#200martenlienen wants to merge 1 commit intominad:mainfrom
Conversation
This ensures that :when conditions are evaluated at consistent positions between prefix expansion and template insertion with ~tempel-insert~.
|
With the current architecture, this is a circular requirement, I believe. One solution that I see would be to change |
|
What I mean is that we could call Another better solution might be to call |
|
I can implement the first solution. That would be quite easy, though I don't like so much that it would introduce two different notions of prefix ( |
|
Closing this in favor of #201, which keeps the tempo compatibility introduced in 46d4f54 and makes it more robust by always considering all possible prefixes. So if one has templates for |
At the moment,
tempel--templatesis evaluated without fixing point to a consistent location. This means thattempel-expandandtempel-inserthave different expansions available at the same "mental" location if their:whenrelies on point. This PR evaluates available templates (and thus:whenconditions) at the potential insertion points for the template. I chose this as the canonical evaluation point because it does not depend on the template prefix and it ensures that the following template is available at the beginning of line as I would intuitively expect:The one limitation of this change is that it required me to revert 46d4f54. Evaluating available templates at the insertion point requires us to move point there, which means that we have to know the potential prefix that we are expanding. This precludes the prefix from depending on the templates. However, I looked through issues and pull requests and did not find any explanation for this change in the first place. In my opinion, making prefix checking configurable in other ways would be more robust and evaluating conditions with a consistent point seems more important (see intuitive example above) than expansion prefixes depending on templates.
I have an FSF copyright assignment for Emacs and ELPA packages.