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

Surrounding behavior with active region #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion helm-c-yasnippet.el
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ space match anyword greedy"
(candidate-transformer . (lambda (candidates)
(helm-yas-get-transformed-list helm-yas-cur-snippets-alist helm-yas-initial-input)))
(action . (("Insert snippet" . (lambda (template)
(yas-expand-snippet template helm-yas-point-start helm-yas-point-end)
(let ((start helm-yas-point-start)
(end helm-yas-point-end))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these variables are set by helm-yas-get-cmp-context, I wasn't sure if I should have changed that. Please let me know if that's the case.

(when mark-active
(setq start (region-beginning) end (region-end))) ; works as a surrounding snippet if mark is active
(yas-expand-snippet template start end))
(when helm-yas-display-msg-after-complete
(message "this snippet is bound to [ %s ]"
(helm-yas-get-key-by-template template helm-yas-cur-snippets-alist)))))
Expand Down