about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2023-06-13 13:03:00 +0100
committerDavid Morgan <djm_uk@protonmail.com>2023-06-13 13:03:00 +0100
commit7a7dae3d1a06a1a87f6a59f3829ca384aafbe504 (patch)
tree772f5e2cbbd6639f7e2751073e4a90f889ca3f4d
parentaf00aa773ce91af7ed8f1d5f8f72a8d07ba61974 (diff)
downloaddotfiles-7a7dae3d1a06a1a87f6a59f3829ca384aafbe504.tar.gz
Advise sp-mark-sexp instead of using extra function
-rw-r--r--.emacs.d/lisp/init-smartparens.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/.emacs.d/lisp/init-smartparens.el b/.emacs.d/lisp/init-smartparens.el
index f72aec5..571fef3 100644
--- a/.emacs.d/lisp/init-smartparens.el
+++ b/.emacs.d/lisp/init-smartparens.el
@@ -65,11 +65,15 @@ Equivalent to raising then wrapping."
             ((= paren-char ?\{) (sp-wrap-curly))
             ((= paren-char ?\[) (sp-wrap-square))
             (t (error "Not in a list")))))
-  (defun sp-mark-to-end-of-sexp ()
-    "Mark all the way to the end of the current sexp."
-    (interactive)
-    (call-interactively 'set-mark-command)
-    (sp-end-of-sexp))
+  (defun sp-mark-sexp-advice (origin &rest args)
+    (if (sp--raw-argument-p (car args))
+        (push-mark
+         (save-excursion
+           (sp-end-of-sexp)
+           (point))
+         nil t)
+      (apply origin args)))
+  (advice-add 'sp-mark-sexp :around 'sp-mark-sexp-advice)
   (unbind-key "M-?" 'smartparens-mode-map)
   (unbind-key "M-?" 'sp-keymap)
   :bind (:map smartparens-mode-map
@@ -91,7 +95,6 @@ Equivalent to raising then wrapping."
               ("C-S-e" . sp-end-of-sexp)
               ("M-E" . sp-end-of-sexp)
               ("M-R" . kill-around-sexp)
-              ("C-M-S-SPC" . sp-mark-to-end-of-sexp)
               ("C-c C-S-d" . duplicate-sexp-after-point)
               ("C-c M-(" . wrap-round-from-behind)))