smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Added full-width character pairs not recognized

Open sati-bodhi opened this issue 4 years ago • 1 comments

After switching to Castlemacs, custom pairs stopped working.

Expected behavior

「」 is inserted when is typed. 「」 wraps around the selected region when is typed with active region.

Actual behavior

「」 is not recognized as a pair; same goes for other full-width parens on the custom pairs list below. image

Only {{}} is recognized. image

Steps to reproduce the problem

Try the following settings:

Castlemacs default installation:

;; Show parens and other pairs.
(use-package smartparens
  :diminish
  :config
  (require 'smartparens-config)
  (smartparens-global-mode t)
  (show-smartparens-global-mode t))

Custom Pairs

(sp-pair "「" "」")
(sp-pair "「" "」")
(sp-pair "『" "』")
(sp-pair "【" "】")
(sp-pair "《" "》")
(sp-pair "〈" "〉")
(sp-pair "(" ")")
(sp-pair "〔" "〕")
(sp-pair "{{" "}}")

Backtraces if necessary (M-x toggle-debug-on-error)

((python-mode (:open "\"\"\"" :close "\"\"\"" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "\\'" :close "\\'" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "'''" :close "'''" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "\"" :close "\"" :actions (:add) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "'" :close "'" :actions (:add) :when (:add) :unless (sp-in-comment-p sp-in-string-quotes-p) :pre-handlers (:add) ...)) (org-mode (:open "「" :close "」" :actions (:add) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "«" :close "»" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "=" :close "=" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p) :pre-handlers (:add) ...) (:open "~" :close "~" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p) :pre-handlers (:add) ...) (:open "/" :close "/" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p sp-org-point-after-left-square-bracket-p) :pre-handlers (:add) ...) (:open "_" :close "_" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p) :pre-handlers (:add) ...) (:open "*" :close "*" :skip-match sp--org-skip-asterisk :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p sp-point-at-bol-p) ...)) (c++-mode (:open "/*" :close "*/" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "{" :actions (:add) :when (:add) :unless (:add) :pre-handlers (:add) :post-handlers (...))) (c-mode (:open "/*" :close "*/" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "{" :actions (:add) :when (:add) :unless (:add) :pre-handlers (:add) :post-handlers (...))) (gfm-mode (:open "```" :close "```" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add sp-gfm-electric-backquote-p) :pre-handlers (:add) ...) (:open "`" :close "`" :actions (:add) :when (:add) :unless (:add sp-gfm-electric-backquote-p) :pre-handlers (:add) ...) (:open "_" :close "_" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p) :pre-handlers (:add) ...) (:open "**" :close "**" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "*" :close "*" :skip-match sp--gfm-skip-asterisk :actions (wrap insert autoskip navigate) :when (:add) :unless (sp--gfm-point-after-word-p sp-point-at-bol-p) ...)) (markdown-mode (:open "```" :close "```" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "_" :close "_" :actions (wrap insert autoskip navigate) :when (:add) :unless (sp-point-after-word-p) :pre-handlers (:add) ...) (:open "**" :close "**" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...) (:open "*" :close "*" :skip-match sp--gfm-skip-asterisk :actions (wrap insert autoskip navigate) :when (:add) :unless (sp--gfm-point-after-word-p sp-point-at-bol-p) ...)) (motion-mode (:open "|" :close "|" :suffix "" :actions (wrap insert autoskip navigate) :when (sp-ruby-should-insert-pipe-close) :unless (:add) ...) (:open "until" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "while" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "unless" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "if" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "for" :close "end" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) :unless (sp-ruby-in-string-or-word-p sp-in-comment-p) ...) (:open "case" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "module" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "class" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "def" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "begin" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) ...) (enh-ruby-mode (:open "|" :close "|" :suffix "" :actions (wrap insert autoskip navigate) :when (sp-ruby-should-insert-pipe-close) :unless (:add) ...) (:open "until" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "while" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "unless" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "if" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "for" :close "end" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) :unless (sp-ruby-in-string-or-word-p sp-in-comment-p) ...) (:open "case" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "module" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "class" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "def" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "begin" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) ...) (ruby-mode (:open "|" :close "|" :suffix "" :actions (wrap insert autoskip navigate) :when (sp-ruby-should-insert-pipe-close) :unless (:add) ...) (:open "until" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "while" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "unless" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "if" :close "end" :suffix "" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) ...) (:open "for" :close "end" :skip-match sp-ruby-skip-inline-match-p :actions (insert navigate) :when (...) :unless (sp-ruby-in-string-or-word-p sp-in-comment-p) ...) (:open "case" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "module" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "class" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "def" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) (:open "begin" :close "end" :suffix "" :skip-match sp-ruby-skip-method-p :actions (insert navigate) :when (...) ...) ...) (rjsx-mode (:open "<" :close ">" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...)) (js2-jsx-mode (:open "<" :close ">" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...)) (js-jsx-mode (:open "<" :close ">" :actions (wrap insert autoskip navigate) :when (:add) :unless (:add) :pre-handlers (:add) ...)) ...)

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

  • smartparens version:
  • Active major-mode:
  • Emacs version (M-x emacs-version):
  • Spacemacs/Evil/Other starterkit (specify which)/Vanilla:
  • OS:

  • smartparens version: 20200324.2147
  • Active major-mode: emacs-lisp-mode
  • Smartparens strict mode: nil
  • Emacs version (M-x emacs-version): GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02
  • Starterkit/Distribution: Castlemacs
  • OS: darwin

sati-bodhi avatar Mar 29 '20 21:03 sati-bodhi

Reverting to an older version of sp solved the problem.

sati-bodhi avatar Mar 31 '20 12:03 sati-bodhi

I tried it now on Emacs 28.2 and I can navigate with these pairs and they also work with show-smartparens-mode. I don't know how to insert them but assuming it works somehow with self-insert-command they should also pair.

Fuco1 avatar Mar 25 '24 21:03 Fuco1