aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org/oni-org.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-06-30 15:22:57 -0700
committerGravatar Tom Willemse2021-06-30 15:22:57 -0700
commit554aad49b5e78a593c32e0f8a76f6a512727c814 (patch)
tree42d4d85df665cd0e4e3defb663467df378d1fdb2 /oni-org/oni-org.el
parentf57409a57f321dbf19baa1bda18e13b940a5ff22 (diff)
downloademacs-config-554aad49b5e78a593c32e0f8a76f6a512727c814.tar.gz
emacs-config-554aad49b5e78a593c32e0f8a76f6a512727c814.zip
[oni-org] Only expand snippets if the key is at start of line
Diffstat (limited to 'oni-org/oni-org.el')
-rw-r--r--oni-org/oni-org.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index 4fc97d6..fab80b2 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2021.0630.112414
+;; Version: 2021.0630.150728
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti)
;; This program is free software; you can redistribute it and/or modify
@@ -108,6 +108,13 @@ installs it will always be ~."
(let ((base-dir "~"))
(expand-file-name file-name base-dir)))
+(defun oni-org-set-yasnippet-condition ()
+ "Change the ‘yas-buffer-local-condition’ variable to work for org.
+This condition requires that the key used for the snippet is
+located at the start of the line."
+ (setq-local yas-buffer-local-condition
+ '(looking-back (rx "\n" (one-or-more (not space))))))
+
(defun oni-org-setup-prettify-symbols-mode ()
"Set up prettify symbols mode for org mode."
(setq-local prettify-symbols-alist
@@ -356,6 +363,7 @@ also move point to the start of the heading."
(add-hook 'org-mode-hook #'oni-org-set-tag-faces)
(add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces)
+(add-hook 'org-mode-hook #'oni-org-set-yasnippet-condition)
(add-hook 'org-mode-hook 'electric-quote-local-mode)
(add-hook 'org-mode-hook 'flyspell-mode)
(add-hook 'org-mode-hook 'olivetti-mode)