From c8b3c5c493e9aa3aa7ddd8ea360508d028c9f2b2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 7 May 2018 19:30:09 +0200 Subject: [PATCH] lang/org: don't insert a second * at BOL --- modules/lang/org/config.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index fc3dac9ed..632c1c23e 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -94,13 +94,17 @@ unfold to point on startup." (defun +org|smartparens-compatibility-config () "Instruct `smartparens' not to impose itself in org-mode." (defun +org-sp-point-in-checkbox-p (_id action _context) - (when (eq action 'insert) - (sp--looking-at-p "\\s-*]"))) + (and (eq action 'insert) + (sp--looking-at-p "\\s-*]"))) + (defun +org-sp-point-at-bol-p (_id action _context) + (and (eq action 'insert) + (eq (char-before) ?*) + (sp--looking-back-p "^\\**" (line-beginning-position)))) ;; make delimiter auto-closing a little more conservative (after! smartparens (sp-with-modes 'org-mode - (sp-local-pair "*" nil :unless '(:add sp-point-before-word-p sp-point-at-bol-p)) + (sp-local-pair "*" nil :unless '(:add sp-point-before-word-p +org-sp-point-at-bol-p)) (sp-local-pair "_" nil :unless '(:add sp-point-before-word-p)) (sp-local-pair "/" nil :unless '(:add sp-point-before-word-p +org-sp-point-in-checkbox-p)) (sp-local-pair "~" nil :unless '(:add sp-point-before-word-p))