1
0
Fork 0

[oni-org] Only expand snippets if the key is at start of line

This commit is contained in:
Tom Willemse 2021-06-30 15:22:57 -07:00
parent f57409a57f
commit 554aad49b5

View file

@ -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)