From 112970db495af2dd542d5b29d72eb39b44a8f127 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Fri, 21 Jul 2023 13:54:53 +0200 Subject: [PATCH] Tweak `smartparens' and improve its documentation --- README.org | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index ae1be1d..6e08465 100644 --- a/README.org +++ b/README.org @@ -6512,10 +6512,11 @@ bound to =quoted-insert=. 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"]] is the first place to look for +1. The [[https://gist.github.com/pvik/8eb5755cc34da0226e3fc23a320a3c95][smartparens cheatsheet]] demonstrates its usage visually. +2. [[https://gist.github.com/oantolin][Omar Antolin's gist "my-smartparens-config.el"]] is the first place to look for how to tweak [[https://github.com/Fuco1/smartparens][smartparens]]. However, the gist may be partially obsolete, since it is not part of his current [[https://github.com/oantolin/emacs-config][Emacs configuration]]. -2. [[https://lists.gnu.org/archive/html/help-gnu-emacs/2014-07/msg00135.html][How to enable smartparens in the minibuffer after eval-expression]] explains +3. [[https://lists.gnu.org/archive/html/help-gnu-emacs/2014-07/msg00135.html][How to enable smartparens in the minibuffer after eval-expression]] explains how the machinery after the first and after later usages of =eval-expression= differ and discusses options how to handle those differences. Listing [[lst:configure-smartparens]] aims to configure [[https://github.com/Fuco1/smartparens][smartparens]] for Elisp, @@ -6524,9 +6525,10 @@ LaTeX, Org, and Python. Despite the provocative post [[https://andreyorst.gitlab.io/posts/2022-02-20-what-if-structural-editing-was-a-mistake/]["What if structural editing was a mistake?"]], [[https://github.com/Fuco1/smartparens][smartparens]] is one of my favorite packages. In particular, [[https://github.com/Fuco1/smartparens][smartparens]] handles matching pairs in Org-mode files with export and source blocks for multiple -formats and languages correctly. Therefore, [[https://smartparens.readthedocs.io/en/latest/index.html?highlight=show-smartparens-mode#getting-started][show-smartparens-mode]] highlights -matching pairs immediately in front or after point in such files correctly, -contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][rainbow-delimiters]]. +formats and languages almost (exceptions are due to ~elisp~ functions like ~<~ +and ~<=~) correctly. Therefore, [[https://smartparens.readthedocs.io/en/latest/index.html?highlight=show-smartparens-mode#getting-started][show-smartparens-mode]] highlights matching pairs +immediately in front or after point in such files correctly, contrary to for +instance [[https://github.com/Fanael/rainbow-delimiters#readme][rainbow-delimiters]]. #+caption[Configure =smartparens=]: #+caption: Configure =smartparens=. @@ -6538,7 +6540,9 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][ (require 'smartparens-config nil 'noerror)) (setopt sp-base-key-bindings 'sp sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) - ("C-)" . sp-forward-slurp-sexp))) + ("C-)" . sp-forward-slurp-sexp) + ("C-M-(" . sp-backward-barf-sexp) + ("C-M-)" . sp-backward-slurp-sexp))) (dolist (hook '(conf-toml-mode-hook prog-mode-hook text-mode-hook)) (add-hook hook #'smartparens-mode))