emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master db4cd31 20/36: Delete active region for trigger key expans


From: Noam Postavsky
Subject: [elpa] master db4cd31 20/36: Delete active region for trigger key expansion
Date: Sat, 11 Jun 2016 19:21:10 +0000 (UTC)

branch: master
commit db4cd31a1104890b5cb27e6ae230498288b7dd51
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Delete active region for trigger key expansion
    
    This makes yas-expand-from-trigger-key consistent with
    yas-insert-snippet.
    
    * yasnippet.el (yas-expand-from-trigger-key): Expand start end interval
    with active region.
---
 yasnippet.el |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index 423f58a..c1a366b 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2170,9 +2170,13 @@ object satisfying `yas--field-p' to restrict the 
expansion to."
                                     (yas--templates-for-key-at-point))
                                 (yas--templates-for-key-at-point))))
     (if templates-and-pos
-        (yas--expand-or-prompt-for-template (nth 0 templates-and-pos)
-                                            (nth 1 templates-and-pos)
-                                            (nth 2 templates-and-pos))
+        (yas--expand-or-prompt-for-template
+         (nth 0 templates-and-pos)
+         ;; Delete snippet key and active region when expanding.
+         (min (if (use-region-p) (region-beginning) most-positive-fixnum)
+              (nth 1 templates-and-pos))
+         (max (if (use-region-p) (region-end) most-negative-fixnum)
+              (nth 2 templates-and-pos)))
       (yas--fallback))))
 
 (defun yas-expand-from-keymap ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]