First, let me say I am new to orgmode and emacs. I am sure I am not providing all the relevant information for the problem, so please let me know what can I add here.
I am using emacs 26.3, and I use spacemacs
.
The problem is:
smartparens
is not working well in orgmode.
This is what I see when I type the left parenthesis (
When I add a parenthesis after a whitespace) (
When I add a parenthesis with no whitespace()
when I type \(
it works well:
When I add \ and parenthesis after a whitespace \(\)
In both cases the tab
key does not work to get me out of the parenthesis.
My user-config
has this to load smartparens
;; smartparens
(with-eval-after-load 'smartparens
(sp-with-modes 'org-mode
(sp-local-pair "$" "$")
(sp-local-pair "" "" :actions '(rem))
(sp-local-pair "=" "=" :actions '(rem))
(sp-local-pair "" "" :actions '(rem))
(sp-local-pair "\\left(" "\\right)" :trigger "\\l(" :post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "\\left[" "\\right]" :trigger "\\l[" :post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "\\left\\{" "\\right\\}" :trigger "\\l{" :post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "\\left|" "\\right|" :trigger "\\l|" :post-handlers '(sp-latex-insert-spaces-inside-pair))
(sp-local-pair "(" ")")
(sp-local-pair "\\(" "\\)")
(sp-local-pair "\\[" "\\]")))
(add-hook 'org-mode-hook 'smartparens-mode)
smartparens
(although the manual does not mention it). In particular ,TAB
is bound toorg-cycle
in Org mode buffers, so there is probably a conflict there.(sp-local-pair "" "" :actions '(rem))
lines? I would suggest you begin with(require 'smartparens-config)
and move on from there. Also, I don't think sp binds theTAB
key to anything. Maybe you can try thesp-up-sexp
command to move out of the parentheses.user-config
and put(require 'smartparens-config)
and it indeed worked. Then I tweaked what I wanted to get the desired behavior. I will post an answer below. Thanks!