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 beg/end variable binding during exit hook #215

Closed
wants to merge 1 commit into from

Conversation

lewang
Copy link
Contributor

@lewang lewang commented Feb 21, 2012

...xit-snippet-hook.

The documentation claims this is the case, but code doesn't follow.

…r-exit-snippet-hook.

The documentation claims this is the case, but code doesn't follow.
joaotavora added a commit that referenced this pull request Feb 22, 2012
@joaotavora
Copy link
Owner

I understand the issue, fixed it with a simpler change (yas/snippet-beg and yas/snippet-end should be defvars anyway.

Out of curiosity, what is your use case for the snippet exit hook?

Also, your commit changed some trailing whitespace. These cleanups are more than welcome, but please present them in a separate commit.

@joaotavora joaotavora closed this Feb 22, 2012
@lewang
Copy link
Contributor Author

lewang commented Feb 24, 2012

re: farfetched. You know what kind of people use Emacs right? ;)

For my specific case, I went another way and the exit hook doesn't modify buffer any more. In general though, it's conceivably useful for Javascript example, starting with "(fn|)" of "(fn|);" and expanding to:

(function (arg1, arg2) {

})(arg1, arg2)

I want to add the semi-colon if it's not already there.

@lewang
Copy link
Contributor Author

lewang commented Feb 24, 2012

As a side note, instead of doing this, I'm using autopair to add the semi-colon where appropriate according to js2-mode.

see: http://stackoverflow.com/questions/9241523/emacs-is-it-possible-to-automatically-insert-semicolons-in-js2-mode

@joaotavora
Copy link
Owner

re: re: farfetched. Ahahaha, you're totally right :-D

OK I see, you want to add text outside the expansion area of the snippet! then the snippet exit hook is the way to go yes.

I'm very curious though, how you use autopair (another extension I maintain...) to add semicolons...

@lewang
Copy link
Contributor Author

lewang commented Feb 28, 2012

I've posted a gist

@joaotavora
Copy link
Owner

Fantastic!

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.

None yet

2 participants