From b4b85569b486848109dd7db277135802f60c2f9e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 19 Feb 2019 19:05:49 -0500 Subject: [PATCH] lang/org: expand snippet on TAB in visual mode --- modules/lang/org/autoload/org.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/lang/org/autoload/org.el b/modules/lang/org/autoload/org.el index e5172b047..00c7d706c 100644 --- a/modules/lang/org/autoload/org.el +++ b/modules/lang/org/autoload/org.el @@ -400,12 +400,15 @@ another level of headings on each invocation." (defun +org|yas-expand-maybe () "Tries to expand a yasnippet snippet, if one is available. Made for `org-tab-first-hook'." - (when (and (or (not (bound-and-true-p evil-mode)) - (eq evil-state 'insert)) - (bound-and-true-p yas-minor-mode) - (yas--templates-for-key-at-point)) - (call-interactively #'yas-expand) - t)) + (when (bound-and-true-p yas-minor-mode) + (cond ((and (or (not (bound-and-true-p evil-mode)) + (eq evil-state 'insert)) + (yas--templates-for-key-at-point)) + (call-interactively #'yas-expand) + t) + ((use-region-p) + (call-interactively #'yas-insert-snippet) + t)))) ;;;###autoload (defun +org|cycle-only-current-subtree (&optional arg)