diff --git a/README.org b/README.org index f6181f0..853f4eb 100644 --- a/README.org +++ b/README.org @@ -1125,25 +1125,39 @@ widened buffer states. ** Smart character-pair handling +The [[https://smartparens.readthedocs.io/en/latest/index.html][smartparens documentation]] targets experienced Emacs users. The following +links show how to put the documentation to practical use: +1. [[https://gist.github.com/oantolin][Omar Antolin's gist: my-smartparens-config.el]] +2. [[https://xenodium.com/emacs-smartparens-auto-indent/index.html][How to enable smartparens in the minibuffer after eval-expression]] + #+begin_src emacs-lisp (unless noninteractive + ;; To disables pairing of the quote character for lisp modes, + ;; require smartparens-config instead of smartparens. (when (require 'smartparens-config nil 'noerror) - ;; Requiring smartparens-config disables pairing of the quote - ;; character for lisp modes, contrary to requiring smartparens. (custom-set-variables '(sp-base-key-bindings 'sp) '(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) ("C-)" . sp-forward-slurp-sexp)))) - (add-hook 'prog-mode-hook #'smartparens-mode) - (add-hook 'text-mode-hook #'smartparens-mode) + (dolist (hook '(prog-mode-hook + text-mode-hook)) + (add-hook hook #'smartparens-mode)) + ;; Hook on the specific `eval-expression-minibuffer-setup-hook' + ;; and not on the general `minibuffer-setup-hook'. (dolist (hook '(emacs-lisp-mode-hook eval-expression-minibuffer-setup-hook ielm-mode-hook + inferior-emacs-lisp-mode-hook python-mode-hook)) (add-hook hook #'smartparens-strict-mode)) + ;; Makes only sense after `eval-expression-minibuffer-setup-hook'. + (sp-with-modes '(fundamental-mode ; first usage. + minibuffer-inactive-mode) ; later usage. + (sp-local-pair "'" nil :actions nil)) + ;; https://xenodium.com/emacs-smartparens-auto-indent/index.html (defun indent-between-pair (&rest _ignored) (newline)