From 521ff7ac1a4af02b643831d4d2c938abec9d8388 Mon Sep 17 00:00:00 2001 From: Undead Kernel Date: Thu, 29 Aug 2019 15:43:53 +0200 Subject: [PATCH] lang/org: smarter smartparens in org src blocks While point is in a babel src block, do not autoexpand emphasis markers. --- modules/lang/org/config.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index fd7ec11ae..c62497341 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -774,13 +774,17 @@ compelling reason, so..." (skip-chars-backward "*") (bolp)))) + (defun +org-sp-in-src-block-p (_id action _context) + (and (eq action 'insert) + (org-in-src-block-p))) + ;; make delimiter auto-closing a little more conservative (sp-with-modes 'org-mode - (sp-local-pair "*" "*" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-point-at-bol-p)) - (sp-local-pair "_" "_" :unless '(:add sp-point-before-word-p sp-in-math-p)) - (sp-local-pair "/" "/" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-point-in-checkbox-p)) - (sp-local-pair "~" "~" :unless '(:add sp-point-before-word-p)) - (sp-local-pair "=" "=" :unless '(:add sp-point-before-word-p sp-in-math-p))))) + (sp-local-pair "*" "*" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-point-at-bol-p +org-sp-in-src-block-p)) + (sp-local-pair "_" "_" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-in-src-block-p)) + (sp-local-pair "/" "/" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-point-in-checkbox-p +org-sp-in-src-block-p)) + (sp-local-pair "~" "~" :unless '(:add sp-point-before-word-p +org-sp-in-src-block-p)) + (sp-local-pair "=" "=" :unless '(:add sp-point-before-word-p sp-in-math-p +org-sp-in-src-block-p))))) ;;