Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transform on exit #594

Closed
wants to merge 2 commits into from

Conversation

Skrylar
Copy link

@Skrylar Skrylar commented Jul 30, 2015

Prospectively fixes #381

I tried the following snippet (requires s.el) for pascal source code without the patch:

# -*- mode: snippet; require-final-newline: nil -*-
# name: procedure
# key: p
# group: control
# binding: direct-keybinding
# --
procedure ${1:DoSomething$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)}($2);
begin
$0
end;

Casing is not adjusted correctly when leaving the $1 mirror. With this patch applied, it will correctly update the mirror. I have longer snippets where such transformed mirrors take place in more than one location, each mirror is properly updated in those cases as well. An example of such a snippet:

# -*- mode: snippet; require-final-newline: nil -*-
# name: property
# key: property
# group: types
# binding: direct-keybinding
# --
function $3 : $2;
procedure $4(${5:some-property$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)}: $2);
property ${1:some-property$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)} : ${2:some-type$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)} Read ${3:get-$1$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)} Write ${4:set-$1$(if yas-moving-away-p (s-upper-camel-case yas-text) yas-text)};

I took this patch from Google Groups, updated it to the yas- namespace and removed the inhibition of update hooks when moving between mirrors. I have been using this configuration for several weeks without incident; it may be useful for others.

https://groups.google.com/forum/#!original/smart-snippet/HEJ5JLIXhp8/DQTdvDHhOHIJ

nriley and others added 2 commits July 29, 2015 19:56
Updated to yas- namespace by Joshua Cearley <joshua.cearley@gmail.com>

Taken from a patch at http://groups.google.com/forum/#ltopic/smart-snippet/HEJ5JLIXhp8
It breaks the update for mirrors, so I took it out.
@npostavs
Copy link
Collaborator

npostavs commented May 5, 2016

I'm planning to apply this simpler patch instead: #689.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG? Transformation upon yas-moving-away-p doesn't update the field
3 participants