[oni-org] Only expand snippets if the key is at start of line
This commit is contained in:
parent
f57409a57f
commit
554aad49b5
1 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; 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)
|
;; 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
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -108,6 +108,13 @@ installs it will always be ~."
|
||||||
(let ((base-dir "~"))
|
(let ((base-dir "~"))
|
||||||
(expand-file-name file-name 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 ()
|
(defun oni-org-setup-prettify-symbols-mode ()
|
||||||
"Set up prettify symbols mode for org mode."
|
"Set up prettify symbols mode for org mode."
|
||||||
(setq-local prettify-symbols-alist
|
(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-tag-faces)
|
||||||
(add-hook 'org-mode-hook #'oni-org-set-todo-keyword-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 'electric-quote-local-mode)
|
||||||
(add-hook 'org-mode-hook 'flyspell-mode)
|
(add-hook 'org-mode-hook 'flyspell-mode)
|
||||||
(add-hook 'org-mode-hook 'olivetti-mode)
|
(add-hook 'org-mode-hook 'olivetti-mode)
|
||||||
|
|
Loading…
Reference in a new issue