[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1735a28 02/40: Add region contents to new snippet
From: |
Noam Postavsky |
Subject: |
[elpa] master 1735a28 02/40: Add region contents to new snippet |
Date: |
Wed, 26 Oct 2016 23:06:31 +0000 (UTC) |
branch: master
commit 1735a283d23048cb4e488d2d87edb9ea0f20d76e
Author: songjie dong <address@hidden>
Commit: Noam Postavsky <address@hidden>
Add region contents to new snippet
* yasnippet.el (yas-new-snippet-default): Add yas-selected-text.
(yas-new-snippet): Let-bind yas-selected-text to region content.
Copyright-paperwork-exempt: yes
---
yasnippet.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 8a4ef1d..161c996 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -207,7 +207,7 @@ created with `yas-new-snippet'. "
# name: $1
# key: ${2:${1:$(yas--key-from-desc yas-text)}}
# --
-$0"
+$0`yas-selected-text`"
"Default snippet to use when creating a new snippet.
If nil, don't use any snippet."
:type 'string
@@ -2476,7 +2476,11 @@ where snippets of table might exist."
Expands a snippet-writing snippet, unless the optional prefix arg
NO-TEMPLATE is non-nil."
(interactive "P")
- (let ((guessed-directories (yas--guess-snippet-directories)))
+ (let ((guessed-directories (yas--guess-snippet-directories))
+ (yas-selected-text (or yas-selected-text
+ (and (region-active-p)
+ (buffer-substring-no-properties
+ (region-beginning) (region-end))))))
(switch-to-buffer "*new snippet*")
(erase-buffer)
- [elpa] master updated (f06d730 -> 299efcb), Noam Postavsky, 2016/10/26
- [elpa] master bc80f67 01/40: .travis.yml: Don't notify on success, Noam Postavsky, 2016/10/26
- [elpa] master 6b785e1 08/40: Say how to hide the backquote side-effect warning, Noam Postavsky, 2016/10/26
- [elpa] master 1735a28 02/40: Add region contents to new snippet,
Noam Postavsky <=
- [elpa] master ee4efdb 05/40: Revert "Separate parsing from evaluation of backquote lisp", Noam Postavsky, 2016/10/26
- [elpa] master 85f39ce 06/40: Warn about backquote exprs modifying the buffer, Noam Postavsky, 2016/10/26
- [elpa] master e21420a 04/40: Separate parsing from evaluation of backquote lisp, Noam Postavsky, 2016/10/26
- [elpa] master c744148 03/40: Make yas-describe-tables easier to use from lisp, Noam Postavsky, 2016/10/26
- [elpa] master d218ed8 11/40: Do indent the first line of mirrors, but in correct order, Noam Postavsky, 2016/10/26
- [elpa] master 0db65ee 20/40: Don't clobber match data in modification hooks, Noam Postavsky, 2016/10/26
- [elpa] master dc098cf 25/40: Fix yas--message verbosity levels, Noam Postavsky, 2016/10/26
- [elpa] master 5af9276 27/40: Support yas/ symbols in yas-define-menu, Noam Postavsky, 2016/10/26
- [elpa] master ea9581f 22/40: Fix some quoting problems in doc strings, Noam Postavsky, 2016/10/26
- [elpa] master ee6e7a9 09/40: Fix some compilation warnings, Noam Postavsky, 2016/10/26