[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e37ce9e 18/36: Disable region wrapping for trigger key exp
From: |
Noam Postavsky |
Subject: |
[elpa] master e37ce9e 18/36: Disable region wrapping for trigger key expansion |
Date: |
Sat, 11 Jun 2016 19:21:10 +0000 (UTC) |
branch: master
commit e37ce9e48847bdaad52e55f4d78ddaa0e18c4216
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Disable region wrapping for trigger key expansion
It's too awkward to highlight the relevant text while maneuvering point
in front of the trigger key.
* yasnippet.el (yas-expand-from-trigger-key): Let-bind
yas-wrap-around-region to nil if it was t.
* doc/snippet-expansion.org: Document it.
---
doc/snippet-expansion.org | 6 +++++-
yasnippet.el | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/doc/snippet-expansion.org b/doc/snippet-expansion.org
index f57df95..47a857a 100644
--- a/doc/snippet-expansion.org
+++ b/doc/snippet-expansion.org
@@ -29,7 +29,7 @@
- Expanding from emacs-lisp code
-** Trigger key
+** <<Trigger key>>
[[sym:yas-expand][=yas-expand=]] tries to expand a /snippet abbrev/ (also
known as
/snippet key/) before point.
@@ -91,6 +91,10 @@ the region contents into the =$0= placeholder of a snippet
expanded by
[[#yas-insert-snippet][=yas-insert-snippet=]]. Setting it to a character
value (e.g. =?0=)
will insert the contents of corresponding register.
+Note a setting of t is disabled when expanding via [[trigger key]] since
+it's too awkward to highlight the relevant text while maneuvering
+point in front of the trigger key.
+
Older (versions 0.9.1 and below) of Yasnippet, supported a setting of
=cua= that is equivalent to =?0= but only worked with =cua-mode=
turned on. This setting is still supported for backwards
diff --git a/yasnippet.el b/yasnippet.el
index 423f58a..caef9ca 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2160,7 +2160,12 @@ Optional argument FIELD is for non-interactive use and
is an
object satisfying `yas--field-p' to restrict the expansion to."
(interactive)
(setq yas--condition-cache-timestamp (current-time))
- (let (templates-and-pos)
+ (let ((templates-and-pos nil)
+ ;; Disable region wrapping for trigger key expansion: it's too
+ ;; awkward to have point after the trigger while managing the
+ ;; region contents anyway.
+ (yas-wrap-around-region (if (eq yas-wrap-around-region t) nil
+ yas-wrap-around-region)))
(unless (and yas-expand-only-for-last-commands
(not (member last-command yas-expand-only-for-last-commands)))
(setq templates-and-pos (if field
- [elpa] master updated (ee4cf1e -> 438f5db), Noam Postavsky, 2016/06/11
- [elpa] master 3e67b1b 02/36: yasnippet.el (snippet-mode): Add autoload cookie., Noam Postavsky, 2016/06/11
- [elpa] master c0032e6 08/36: chmod -x doc/yas-doc-helper.el, Noam Postavsky, 2016/06/11
- [elpa] master 14f830a 13/36: Test expansion in an empty buffer, Noam Postavsky, 2016/06/11
- [elpa] master a87ec54 12/36: yasnippet.el (yas-next-field-will-exit-p): New function., Noam Postavsky, 2016/06/11
- [elpa] master 7799aa9 09/36: Document .yas-setup.el, Noam Postavsky, 2016/06/11
- [elpa] master 4f2aa15 05/36: Only kill snippets for text length change, Noam Postavsky, 2016/06/11
- [elpa] master 8771082 03/36: Don't add useless kill ring entries, Noam Postavsky, 2016/06/11
- [elpa] master cc14db3 11/36: Refactor yas-next-field a bit, Noam Postavsky, 2016/06/11
- [elpa] master db4cd31 20/36: Delete active region for trigger key expansion, Noam Postavsky, 2016/06/11
- [elpa] master e37ce9e 18/36: Disable region wrapping for trigger key expansion,
Noam Postavsky <=
- [elpa] master 6180cc4 28/36: Fix field transform application in yas-next-field, Noam Postavsky, 2016/06/11
- [elpa] master 146b161 25/36: Don't indent empty lines in snippet expansion, Noam Postavsky, 2016/06/11
- [elpa] master e9406f5 26/36: Document $> and fix escaping, Noam Postavsky, 2016/06/11
- [elpa] master 6f97316 27/36: Fix outdated and misformatted docs, Noam Postavsky, 2016/06/11
- [elpa] master bd30a30 04/36: yas-dont-activate is a hook, Noam Postavsky, 2016/06/11
- [elpa] master c1b2cb7 17/36: Improve documentation for new register option, Noam Postavsky, 2016/06/11
- [elpa] master 4c6064c 01/36: Avoid potential problems with user's hooks, Noam Postavsky, 2016/06/11
- [elpa] master 5d44a9f 19/36: Revert "Disable region wrapping for trigger key expansion", Noam Postavsky, 2016/06/11
- [elpa] master beb2ba4 21/36: Fix fields following $0 + region insertion, Noam Postavsky, 2016/06/11
- [elpa] master eeb4b62 14/36: Add new tests for multi-line mirror indentation, Noam Postavsky, 2016/06/11