-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
I'm experiencing inconsistent behavior when using custom quote pairs with :trigger
and :actions '(insert wrap)
in org-mode
.
Goal
I want Smartparens to insert or wrap „“
instead of ""
when typing "
in org-mode
only when a specific minor mode (org-hugo-auto-export-mode)
is enabled. This works for plain insertion, but fails when wrapping a region — Smartparens doesn't wrap at all. Specifically, with the configuration below, I receive:
my/smartparens-use-default-quotes
:
| -> "|" (insertion as intended)
foo| (region marked) -> "foo"| (wrapping as intended)
my/smartparens-use-german-quotes
:
| -> „|“ (insertion as intended)
foo| (region marked) -> „“| (replacing instead of wrapping)
Configuration
(defun my/reset-smartparens-quote-triggers ()
(sp-local-pair 'org-mode "\"" "\"" :trigger "\"" :actions :rem)
(sp-local-pair 'org-mode "„" "“" :trigger "\"" :actions :rem)
(sp--update-local-pairs))
(defun my/smartparens-use-german-quotes ()
(my/reset-smartparens-quote-triggers)
(sp-local-pair 'org-mode "„" "“"
:trigger "\""
:actions '(insert wrap)))
(defun my/smartparens-use-default-quotes ()
(my/reset-smartparens-quote-triggers)
(sp-local-pair 'org-mode "\"" "\""
:trigger "\""
:actions '(insert wrap)))
(add-hook 'org-hugo-auto-export-mode-hook
(lambda ()
(if org-hugo-auto-export-mode
(my/smartparens-use-german-quotes)
(my/smartparens-use-default-quotes))))
Any ideas? Am I misusing the :trigger system or is there a bug with region wrapping and custom pairs?
Thanks a lot!
Metadata
Metadata
Assignees
Labels
Projects
Status