From 36fa108b877f0d550fabf80c907e8839855c07aa Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 23 Nov 2023 19:49:51 +0100 Subject: [PATCH] update smartparens and dash Signed-off-by: Andreas Gerler --- bba.org | 4 +- .../dash-autoloads.el | 0 .../dash-pkg.el | 4 +- .../dash.el | 28 +- .../dash.info | 0 .../dir | 0 .../smartparens-autoloads.el | 7 +- .../smartparens-c.el | 7 + .../smartparens-clojure.el | 4 +- .../smartparens-config.el | 22 +- .../smartparens-crystal.el | 0 .../smartparens-elixir.el | 6 +- .../smartparens-erlang.el | 55 +++ .../smartparens-ess.el | 2 +- .../smartparens-go.el | 0 .../smartparens-haskell.el | 2 +- .../smartparens-html.el | 2 +- .../smartparens-javascript.el | 2 +- .../smartparens-latex.el | 2 +- .../smartparens-lua.el | 2 +- .../smartparens-markdown.el | 2 +- .../smartparens-ml.el | 6 +- .../smartparens-org.el | 2 +- .../smartparens-pkg.el | 4 +- .../smartparens-python.el | 4 +- .../smartparens-racket.el | 2 +- .../smartparens-rst.el | 2 +- .../smartparens-ruby.el | 3 +- .../smartparens-rust.el | 2 +- .../smartparens-scala.el | 2 +- .../smartparens-swift.el | 0 .../smartparens-text.el | 2 +- .../smartparens-unison.el | 57 +++ .../smartparens.el | 426 ++++++++++-------- .../sp-sublimetext-like.el | 0 35 files changed, 417 insertions(+), 246 deletions(-) rename elpa/{dash-20230502.1324 => dash-20230714.723}/dash-autoloads.el (100%) rename elpa/{dash-20230502.1324 => dash-20230714.723}/dash-pkg.el (69%) rename elpa/{dash-20230502.1324 => dash-20230714.723}/dash.el (99%) rename elpa/{dash-20230502.1324 => dash-20230714.723}/dash.info (100%) rename elpa/{dash-20230502.1324 => dash-20230714.723}/dir (100%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-autoloads.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-c.el (88%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-clojure.el (96%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-config.el (86%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-crystal.el (100%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-elixir.el (98%) create mode 100644 elpa/smartparens-20230529.1017/smartparens-erlang.el rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-ess.el (99%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-go.el (100%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-haskell.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-html.el (99%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-javascript.el (97%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-latex.el (99%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-lua.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-markdown.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-ml.el (95%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-org.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-pkg.el (74%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-python.el (97%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-racket.el (97%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-rst.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-ruby.el (99%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-rust.el (99%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-scala.el (98%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-swift.el (100%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens-text.el (98%) create mode 100644 elpa/smartparens-20230529.1017/smartparens-unison.el rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/smartparens.el (97%) rename elpa/{smartparens-20220623.1523 => smartparens-20230529.1017}/sp-sublimetext-like.el (100%) diff --git a/bba.org b/bba.org index f2cb85bd..7bd74211 100644 --- a/bba.org +++ b/bba.org @@ -316,8 +316,8 @@ Some key bindings taken from [[https://ebzzry.github.io/emacs-pairs.html][emacs- #+BEGIN_SRC emacs-lisp (if (>= emacs-major-version 24) (progn - (add-to-list 'load-path "~/.emacs.d/elpa/smartparens-20220623.1523") - (add-to-list 'load-path "~/.emacs.d/elpa/dash-20210826.1149") + (add-to-list 'load-path "~/.emacs.d/elpa/smartparens-20230529.1017") + (add-to-list 'load-path "~/.emacs.d/elpa/dash-20230714.723") (require 'smartparens) (smartparens-global-mode 1) (defmacro def-pairs (pairs) diff --git a/elpa/dash-20230502.1324/dash-autoloads.el b/elpa/dash-20230714.723/dash-autoloads.el similarity index 100% rename from elpa/dash-20230502.1324/dash-autoloads.el rename to elpa/dash-20230714.723/dash-autoloads.el diff --git a/elpa/dash-20230502.1324/dash-pkg.el b/elpa/dash-20230714.723/dash-pkg.el similarity index 69% rename from elpa/dash-20230502.1324/dash-pkg.el rename to elpa/dash-20230714.723/dash-pkg.el index dc5b0e80..e2592b7c 100644 --- a/elpa/dash-20230502.1324/dash-pkg.el +++ b/elpa/dash-20230714.723/dash-pkg.el @@ -1,6 +1,6 @@ -(define-package "dash" "20230502.1324" "A modern list library for Emacs" +(define-package "dash" "20230714.723" "A modern list library for Emacs" '((emacs "24")) - :commit "96eaba028ac069ea0e5cc70de15b0229126a054a" :authors + :commit "f46268c75cb7c18361d3cee942cd4dc14a03aef4" :authors '(("Magnar Sveen" . "magnars@gmail.com")) :maintainers '(("Magnar Sveen" . "magnars@gmail.com")) diff --git a/elpa/dash-20230502.1324/dash.el b/elpa/dash-20230714.723/dash.el similarity index 99% rename from elpa/dash-20230502.1324/dash.el rename to elpa/dash-20230714.723/dash.el index f02a5345..d9007175 100644 --- a/elpa/dash-20230502.1324/dash.el +++ b/elpa/dash-20230714.723/dash.el @@ -607,7 +607,7 @@ Its anaphoric counterpart is `--keep'." (defun -non-nil (list) "Return a copy of LIST with all nil items removed." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (--filter it list)) (defmacro --map-indexed (form list) @@ -856,7 +856,7 @@ See also: `-splice', `-insert-at'" The last 2 elements of ARGS are used as the final cons of the result, so if the final element of ARGS is not a list, the result is a dotted list. With no ARGS, return nil." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (let* ((len (length args)) (tail (nthcdr (- len 2) args)) (last (cdr tail))) @@ -871,7 +871,7 @@ is a dotted list. With no ARGS, return nil." This is like `cons', but operates on the end of list. If any ELEMENTS are given, append them to the list as well." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (-concat list (list elem) elements)) (defmacro --first (form list) @@ -1172,7 +1172,7 @@ modulo the length of the list. If STEP is a number, only each STEPth item in the resulting section is returned. Defaults to 1." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (let ((length (length list)) (new-list nil)) ;; to defaults to the end of the list @@ -1247,7 +1247,7 @@ Return a copy of LIST if it contains N items or fewer. Return nil if N is zero or less. See also: `-take-last'." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (--take-while (< it-index n) list)) (defun -take-last (n list) @@ -1256,7 +1256,7 @@ Return a copy of LIST if it contains N items or fewer. Return nil if N is zero or less. See also: `-take'." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (copy-sequence (last list n))) (defalias '-drop #'nthcdr @@ -1273,7 +1273,7 @@ Return a copy of LIST if N is zero or less. Return nil if LIST contains N items or fewer. See also: `-drop'." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (nbutlast (copy-sequence list) n)) (defun -split-at (n list) @@ -1283,7 +1283,7 @@ new list of the first N elements of LIST, and DROP is the remaining elements of LIST (not a copy). TAKE and DROP are like the results of `-take' and `-drop', respectively, but the split is done in a single list traversal." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (let (result) (--each-while list (< it-index n) (push (pop list) result)) @@ -1641,7 +1641,7 @@ elements of LIST. Keys are compared by `equal'." (defun -interpose (sep list) "Return a new list of all elements in LIST separated by SEP." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (let (result) (when list (!cons (car list) result) @@ -1653,7 +1653,7 @@ elements of LIST. Keys are compared by `equal'." (defun -interleave (&rest lists) "Return a new list of the first item in each list, then the second etc." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (when lists (let (result) (while (-none? 'null lists) @@ -2919,7 +2919,7 @@ Return nil if `-compare-fn' is not a known test function." (declare (side-effect-free error-free)) ;; In theory this could also recognize values that are custom ;; `hash-table-test's, but too often the :test name is different - ;; from the equality function, so it doesn't seem worthwile. + ;; from the equality function, so it doesn't seem worthwhile. (car (memq (or -compare-fn #'equal) '(equal eq eql)))) (defvar dash--short-list-length 32 @@ -3321,7 +3321,7 @@ backward compatibility and is otherwise deprecated." (defun -repeat (n x) "Return a new list of length N with each element being X. Return nil if N is less than 1." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (and (>= n 0) (make-list n x))) (defun -sum (list) @@ -3396,7 +3396,7 @@ Starts from START and adds STEP each time. The default START is zero, the default STEP is 1. This function takes its name from the corresponding primitive in the APL language." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (unless (natnump count) (signal 'wrong-type-argument (list #'natnump count))) (or start (setq start 0)) @@ -3628,7 +3628,7 @@ Non-branch nodes are simply copied." The new list has the same elements and structure but all cons are replaced with new ones. This is useful when you need to clone a structure such as plist or alist." - (declare (pure t) (side-effect-free t)) + (declare (side-effect-free t)) (-tree-map #'identity list)) ;;; Combinators diff --git a/elpa/dash-20230502.1324/dash.info b/elpa/dash-20230714.723/dash.info similarity index 100% rename from elpa/dash-20230502.1324/dash.info rename to elpa/dash-20230714.723/dash.info diff --git a/elpa/dash-20230502.1324/dir b/elpa/dash-20230714.723/dir similarity index 100% rename from elpa/dash-20230502.1324/dir rename to elpa/dash-20230714.723/dir diff --git a/elpa/smartparens-20220623.1523/smartparens-autoloads.el b/elpa/smartparens-20230529.1017/smartparens-autoloads.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-autoloads.el rename to elpa/smartparens-20230529.1017/smartparens-autoloads.el index b6b42bfb..5135ae0d 100644 --- a/elpa/smartparens-20220623.1523/smartparens-autoloads.el +++ b/elpa/smartparens-20230529.1017/smartparens-autoloads.el @@ -387,9 +387,10 @@ Turn off `show-smartparens-mode'." t nil) ;;;*** -;;;### (autoloads nil nil ("smartparens-c.el" "smartparens-go.el" -;;;;;; "smartparens-javascript.el" "smartparens-ml.el" "smartparens-pkg.el" -;;;;;; "smartparens-racket.el") (0 0 0 0)) +;;;### (autoloads nil nil ("smartparens-c.el" "smartparens-erlang.el" +;;;;;; "smartparens-go.el" "smartparens-javascript.el" "smartparens-ml.el" +;;;;;; "smartparens-pkg.el" "smartparens-racket.el" "smartparens-unison.el") +;;;;;; (0 0 0 0)) ;;;*** diff --git a/elpa/smartparens-20220623.1523/smartparens-c.el b/elpa/smartparens-20230529.1017/smartparens-c.el similarity index 88% rename from elpa/smartparens-20220623.1523/smartparens-c.el rename to elpa/smartparens-20230529.1017/smartparens-c.el index eeb96b5a..d23f3b22 100644 --- a/elpa/smartparens-20220623.1523/smartparens-c.el +++ b/elpa/smartparens-20230529.1017/smartparens-c.el @@ -1,5 +1,7 @@ ;;; smartparens-c.el --- Additional configuration for C/C++ mode. -*- lexical-binding: t; -*- ;; +;; Copyright (C) 2019-2020, 2022 Naoya Yamashita, Matus Goljer +;; ;; Author: Naoya Yamashita ;; Maintainer: Matus Goljer ;; Created: 23 June 2019 @@ -48,5 +50,10 @@ (sp-local-pair "/*" "*/" :post-handlers '(("| " "SPC") ("* ||\n[i]" "RET")))) +;; inline formulas for doxygen +(sp-with-modes sp-c-modes + (sp-local-pair "\\f[" "\\f]" :when '(sp-in-comment-p)) + (sp-local-pair "\\f$" "\\f$" :when '(sp-in-comment-p))) + (provide 'smartparens-c) ;;; smartparens-c.el ends here diff --git a/elpa/smartparens-20220623.1523/smartparens-clojure.el b/elpa/smartparens-20230529.1017/smartparens-clojure.el similarity index 96% rename from elpa/smartparens-20220623.1523/smartparens-clojure.el rename to elpa/smartparens-20230529.1017/smartparens-clojure.el index e07e650d..4408e8ae 100644 --- a/elpa/smartparens-20220623.1523/smartparens-clojure.el +++ b/elpa/smartparens-20230529.1017/smartparens-clojure.el @@ -1,5 +1,7 @@ ;;; smartparens-clojure.el --- Additional configuration for Clojure mode. -*- lexical-binding: t; -*- -;; + +;; Copyright (C) 2016, 2018-2019 Vitalie Spinu, Matus Goljer + ;; Author: Vitalie Spinu ;; Maintainer: Matus Goljer ;; Created: 14 July 2016 diff --git a/elpa/smartparens-20220623.1523/smartparens-config.el b/elpa/smartparens-20230529.1017/smartparens-config.el similarity index 86% rename from elpa/smartparens-20220623.1523/smartparens-config.el rename to elpa/smartparens-20230529.1017/smartparens-config.el index 3b8e8f59..7bfcfe08 100644 --- a/elpa/smartparens-20220623.1523/smartparens-config.el +++ b/elpa/smartparens-20230529.1017/smartparens-config.el @@ -1,6 +1,6 @@ ;;; smartparens-config.el --- Default configuration for smartparens package -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2016 Matus Goljer +;; Copyright (C) 2013-2020, 2022-2023 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer @@ -70,12 +70,27 @@ ID, ACTION, CONTEXT." ;; do not consider punctuation (not (looking-at "[?.,;!]")))))))) -;; emacs is lisp hacking enviroment, so we set up some most common +;; emacs is lisp hacking environment, so we set up some most common ;; lisp modes too (sp-with-modes sp-lisp-modes ;; disable ', it's the quote character! (sp-local-pair "'" nil :actions nil)) +(eval-after-load 'org + '(progn + (defun sp-lisp-in-lisp-src-block-p (_id _action _context) + (when (org-in-src-block-p) + (let* ((el (org-element-at-point)) + (lang (org-element-property :language el)) + (mode (intern (concat + (if (string= lang "elisp") "emacs-lisp" lang) + "-mode")))) + (memq mode sp-lisp-modes)))) + + ;; Disable ' pairing in lisp org source blocks + (sp-local-pair 'org-mode "'" "'" + :unless '(:add sp-lisp-in-lisp-src-block-p)))) + (sp-with-modes (-difference sp-lisp-modes sp-clojure-modes) ;; also only use the pseudo-quote inside strings where it serve as ;; hyperlink. @@ -105,7 +120,9 @@ ID, ACTION, CONTEXT." (eval-after-load 'clojure-mode '(require 'smartparens-clojure)) (eval-after-load 'crystal-mode '(require 'smartparens-crystal)) (eval-after-load 'elixir-mode '(require 'smartparens-elixir)) +(eval-after-load 'elixir-ts-mode '(require 'smartparens-elixir)) (eval-after-load 'enh-ruby-mode '(require 'smartparens-ruby)) +(eval-after-load 'erlang-mode '(require 'smartparens-erlang)) (eval-after-load 'ess '(require 'smartparens-ess)) (eval-after-load 'go-mode '(require 'smartparens-go)) (eval-after-load 'haskell-interactive-mode '(require 'smartparens-haskell)) @@ -129,6 +146,7 @@ ID, ACTION, CONTEXT." (eval-after-load 'text-mode '(require 'smartparens-text)) (eval-after-load 'tuareg '(require 'smartparens-ml)) (eval-after-load 'fsharp-mode '(require 'smartparens-ml)) +(eval-after-load 'unisonlang-mode '(require 'smartparens-unison)) (--each '(js js2-mode) (eval-after-load it '(require 'smartparens-javascript))) (provide 'smartparens-config) diff --git a/elpa/smartparens-20220623.1523/smartparens-crystal.el b/elpa/smartparens-20230529.1017/smartparens-crystal.el similarity index 100% rename from elpa/smartparens-20220623.1523/smartparens-crystal.el rename to elpa/smartparens-20230529.1017/smartparens-crystal.el diff --git a/elpa/smartparens-20220623.1523/smartparens-elixir.el b/elpa/smartparens-20230529.1017/smartparens-elixir.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-elixir.el rename to elpa/smartparens-20230529.1017/smartparens-elixir.el index 820c8df1..bf416486 100644 --- a/elpa/smartparens-20220623.1523/smartparens-elixir.el +++ b/elpa/smartparens-20230529.1017/smartparens-elixir.el @@ -1,6 +1,6 @@ ;;; smartparens-elixir.el --- Configuration for Elixir. -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Matúš Goljer +;; Copyright (C) 2017-2018, 2020 Matúš Goljer ;; Author: Matúš Goljer ;; Maintainer: Matúš Goljer @@ -27,7 +27,7 @@ (require 'smartparens) -(--each '(elixir-mode) +(--each '(elixir-mode elixir-ts-mode) (add-to-list 'sp-sexp-suffix (list it 'regexp ""))) (defvar sp-elixir-builtins @@ -135,7 +135,7 @@ ID, ACTION, CONTEXT." (indent-according-to-mode) (move-marker m nil nil)))) -(sp-with-modes 'elixir-mode +(sp-with-modes '(elixir-mode elixir-ts-mode) (sp-local-pair "do" "end" :when '(("SPC" "RET" "")) :skip-match 'sp-elixir-skip-def-p diff --git a/elpa/smartparens-20230529.1017/smartparens-erlang.el b/elpa/smartparens-20230529.1017/smartparens-erlang.el new file mode 100644 index 00000000..767ecb4b --- /dev/null +++ b/elpa/smartparens-20230529.1017/smartparens-erlang.el @@ -0,0 +1,55 @@ +;;; smartparens-erlang.el --- Additional configuration for erlang-mode. -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Johnny Ruiz + +;; Created: 6 September 2022 +;; Keywords: abbrev convenience editing +;; URL: https://github.com/Fuco1/smartparens + +;; This file is not part of GNU Emacs. + +;;; License: + +;; This file is part of Smartparens. + +;; Smartparens is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; Smartparens is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with Smartparens. If not, see . + +;;; Commentary: + +;; This file provides some additional configuration for Erlang. To use +;; it, simply add: +;; +;; (require 'smartparens-config) +;; +;; alternatively, you can explicitly load these preferences: +;; +;; (require 'smartparens-erlang) +;; +;; in your configuration. + +;; For more info, see github readme at +;; https://github.com/Fuco1/smartparens + +;;; Code: +(require 'smartparens) + +(declare-function erlang-mode "erlang-mode") + +(sp-with-modes 'erlang-mode + (sp-local-pair "`" "'" + :when '(sp-in-comment-p))) + +(provide 'smartparens-erlang) + +;;; smartparens-erlang.el ends here diff --git a/elpa/smartparens-20220623.1523/smartparens-ess.el b/elpa/smartparens-20230529.1017/smartparens-ess.el similarity index 99% rename from elpa/smartparens-20220623.1523/smartparens-ess.el rename to elpa/smartparens-20230529.1017/smartparens-ess.el index 25ba4558..9d5de2c4 100644 --- a/elpa/smartparens-20220623.1523/smartparens-ess.el +++ b/elpa/smartparens-20230529.1017/smartparens-ess.el @@ -1,6 +1,6 @@ ;;; smartparens-ess.el --- Smartparens Extension for Emacs Speaks Statistics -*- lexical-binding: t; -*- -;; Copyright (c) 2015-2016 Bernhard Pröll +;; Copyright (c) 2016-2018, 2020-2021 Bernhard Pröll, Matus Goljer ;; Author: Bernhard Pröll ;; Maintainer: Bernhard Pröll diff --git a/elpa/smartparens-20220623.1523/smartparens-go.el b/elpa/smartparens-20230529.1017/smartparens-go.el similarity index 100% rename from elpa/smartparens-20220623.1523/smartparens-go.el rename to elpa/smartparens-20230529.1017/smartparens-go.el diff --git a/elpa/smartparens-20220623.1523/smartparens-haskell.el b/elpa/smartparens-20230529.1017/smartparens-haskell.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-haskell.el rename to elpa/smartparens-20230529.1017/smartparens-haskell.el index 47a9ab58..0e229510 100644 --- a/elpa/smartparens-20220623.1523/smartparens-haskell.el +++ b/elpa/smartparens-20230529.1017/smartparens-haskell.el @@ -1,6 +1,6 @@ ;;; smartparens-haskell.el --- Additional configuration for Haskell based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2015 Michael Xavier +;; Copyright (C) 2015, 2017-2018 Michael Xavier, Matus Goljer ;; Author: Michael Xavier ;; Maintainer: Michael Xavier diff --git a/elpa/smartparens-20220623.1523/smartparens-html.el b/elpa/smartparens-20230529.1017/smartparens-html.el similarity index 99% rename from elpa/smartparens-20220623.1523/smartparens-html.el rename to elpa/smartparens-20230529.1017/smartparens-html.el index 3ba64060..6f7549f6 100644 --- a/elpa/smartparens-20220623.1523/smartparens-html.el +++ b/elpa/smartparens-20230529.1017/smartparens-html.el @@ -1,6 +1,6 @@ ;;; smartparens-html.el --- Additional configuration for HTML based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2014 Matus Goljer +;; Copyright (C) 2013-2014, 2017-2018 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-javascript.el b/elpa/smartparens-20230529.1017/smartparens-javascript.el similarity index 97% rename from elpa/smartparens-20220623.1523/smartparens-javascript.el rename to elpa/smartparens-20230529.1017/smartparens-javascript.el index aa024d68..95e6e5dc 100644 --- a/elpa/smartparens-20220623.1523/smartparens-javascript.el +++ b/elpa/smartparens-20230529.1017/smartparens-javascript.el @@ -1,6 +1,6 @@ ;;; smartparens-javascript.el --- Additional configuration for JavaScript based modes. -*- lexical-binding: t; -*- -;; Copyright (c) 2017 Marinin Tim +;; Copyright (c) 2017-2019 Marinin Tim ;; Author: Tim Marinin ;; Maintainer: Tim Marinin ;; Created: 2017-03-03 diff --git a/elpa/smartparens-20220623.1523/smartparens-latex.el b/elpa/smartparens-20230529.1017/smartparens-latex.el similarity index 99% rename from elpa/smartparens-20220623.1523/smartparens-latex.el rename to elpa/smartparens-20230529.1017/smartparens-latex.el index 61d9a00c..339f2d20 100644 --- a/elpa/smartparens-20220623.1523/smartparens-latex.el +++ b/elpa/smartparens-20230529.1017/smartparens-latex.el @@ -1,6 +1,6 @@ ;;; smartparens-latex.el --- Additional configuration for (La)TeX based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2016 Matus Goljer +;; Copyright (C) 2013-2019 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-lua.el b/elpa/smartparens-20230529.1017/smartparens-lua.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-lua.el rename to elpa/smartparens-20230529.1017/smartparens-lua.el index 29621a6c..0b7512a3 100644 --- a/elpa/smartparens-20220623.1523/smartparens-lua.el +++ b/elpa/smartparens-20230529.1017/smartparens-lua.el @@ -1,6 +1,6 @@ ;;; smartparens-lua.el --- Additional configuration for Lua based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2014 Matus Goljer +;; Copyright (C) 2013-2014, 2016-2018 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-markdown.el b/elpa/smartparens-20230529.1017/smartparens-markdown.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-markdown.el rename to elpa/smartparens-20230529.1017/smartparens-markdown.el index b097fb5d..772dc331 100644 --- a/elpa/smartparens-20220623.1523/smartparens-markdown.el +++ b/elpa/smartparens-20230529.1017/smartparens-markdown.el @@ -1,6 +1,6 @@ ;;; smartparens-markdown.el --- Additional configuration for Markdown based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Matus Goljer +;; Copyright (C) 2017-2018 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-ml.el b/elpa/smartparens-20230529.1017/smartparens-ml.el similarity index 95% rename from elpa/smartparens-20220623.1523/smartparens-ml.el rename to elpa/smartparens-20230529.1017/smartparens-ml.el index ee066deb..a03c1062 100644 --- a/elpa/smartparens-20220623.1523/smartparens-ml.el +++ b/elpa/smartparens-20230529.1017/smartparens-ml.el @@ -1,7 +1,7 @@ ;;; smartparens-ml.el --- Additional configuration for ML languages -*- lexical-binding: t; -*- -;; Copyright (C) 2016-2017 Ta Quang Trung -;; Copyright (C) 2017 Matus Goljer +;; Copyright (C) 2016-2019 Ta Quang Trung +;; Copyright (C) 2017, 2022 Matus Goljer ;; Author: Ta Quang Trung ;; Matus Goljer @@ -63,7 +63,7 @@ (sp-local-pair "{|" "|}" ) ;; multi-line string (sp-local-pair "[|" "|]" ) ;; array (sp-local-pair "sig" "end" ) ;; signature - (sp-local-pair "module" "end" ) ;; module + (sp-local-pair "struct" "end" ) ;; module (sp-local-pair "(*" "*)" )) ;; comment ;; Ignore punctuation, so we can split ~(foo) to ~foo. diff --git a/elpa/smartparens-20220623.1523/smartparens-org.el b/elpa/smartparens-20230529.1017/smartparens-org.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-org.el rename to elpa/smartparens-20230529.1017/smartparens-org.el index 87dfeca3..8b864b1d 100644 --- a/elpa/smartparens-20220623.1523/smartparens-org.el +++ b/elpa/smartparens-20230529.1017/smartparens-org.el @@ -1,6 +1,6 @@ ;;; smartparens-org.el --- Configuration for Org mode. -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Matúš Goljer +;; Copyright (C) 2017-2019 Matúš Goljer ;; Author: Matúš Goljer ;; Maintainer: Matúš Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-pkg.el b/elpa/smartparens-20230529.1017/smartparens-pkg.el similarity index 74% rename from elpa/smartparens-20220623.1523/smartparens-pkg.el rename to elpa/smartparens-20230529.1017/smartparens-pkg.el index a2b66c5e..14574d7b 100644 --- a/elpa/smartparens-20220623.1523/smartparens-pkg.el +++ b/elpa/smartparens-20230529.1017/smartparens-pkg.el @@ -1,7 +1,7 @@ -(define-package "smartparens" "20220623.1523" "Automatic insertion, wrapping and paredit-like navigation with user defined pairs." +(define-package "smartparens" "20230529.1017" "Automatic insertion, wrapping and paredit-like navigation with user defined pairs." '((dash "2.13.0") (cl-lib "0.3")) - :commit "8b6a3c3b31afd5b3f846e09859b5fc62eb06e7c1" :authors + :commit "79a338db115f441cd47bb91e6f75816c5e78a772" :authors '(("Matus Goljer" . "matus.goljer@gmail.com")) :maintainer '("Matus Goljer" . "matus.goljer@gmail.com") diff --git a/elpa/smartparens-20220623.1523/smartparens-python.el b/elpa/smartparens-20230529.1017/smartparens-python.el similarity index 97% rename from elpa/smartparens-20220623.1523/smartparens-python.el rename to elpa/smartparens-20230529.1017/smartparens-python.el index 93698ce5..dbe63338 100644 --- a/elpa/smartparens-20220623.1523/smartparens-python.el +++ b/elpa/smartparens-20230529.1017/smartparens-python.el @@ -1,6 +1,6 @@ ;;; smartparens-python.el --- Additional configuration for Python based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2015-2016 Matus Goljer +;; Copyright (C) 2015-2018, 2020, 2022-2023 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer @@ -51,7 +51,7 @@ "smartparens settings for python-mode" :group 'smartparens) -(defcustom sp-python-insert-colon-in-function-definitions t +(defcustom sp-python-insert-colon-in-function-definitions nil "If non-nil, auto-insert a colon after parens insertion in definition. Supported definitions are: diff --git a/elpa/smartparens-20220623.1523/smartparens-racket.el b/elpa/smartparens-20230529.1017/smartparens-racket.el similarity index 97% rename from elpa/smartparens-20220623.1523/smartparens-racket.el rename to elpa/smartparens-20230529.1017/smartparens-racket.el index 08af6760..903a7e38 100644 --- a/elpa/smartparens-20220623.1523/smartparens-racket.el +++ b/elpa/smartparens-20230529.1017/smartparens-racket.el @@ -1,6 +1,6 @@ ;;; smartparens-racket.el --- Additional configuration for Racket based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2015 Vikraman Choudhury +;; Copyright (C) 2015, 2018 Vikraman Choudhury ;; Author: Vikraman Choudhury ;; Maintainer: Vikraman Choudhury diff --git a/elpa/smartparens-20220623.1523/smartparens-rst.el b/elpa/smartparens-20230529.1017/smartparens-rst.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-rst.el rename to elpa/smartparens-20230529.1017/smartparens-rst.el index ceac6a63..650607f0 100644 --- a/elpa/smartparens-20220623.1523/smartparens-rst.el +++ b/elpa/smartparens-20230529.1017/smartparens-rst.el @@ -1,6 +1,6 @@ ;;; smartparens-rst.el --- Additional configuration for rst based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2019 Matus Goljer +;; Copyright (C) 2019-2020 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20220623.1523/smartparens-ruby.el b/elpa/smartparens-20230529.1017/smartparens-ruby.el similarity index 99% rename from elpa/smartparens-20220623.1523/smartparens-ruby.el rename to elpa/smartparens-20230529.1017/smartparens-ruby.el index 3ba86716..237eea90 100644 --- a/elpa/smartparens-20220623.1523/smartparens-ruby.el +++ b/elpa/smartparens-20230529.1017/smartparens-ruby.el @@ -1,6 +1,6 @@ ;;; smartparens-ruby.el --- Additional configuration for Ruby based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2013-2014 Jean-Louis Giordano +;; Copyright (C) 2013-2014, 2016-2018, 2020, 2023 Jean-Louis Giordano, Matus Goljer ;; Author: Jean-Louis Giordano ;; Maintainer: Matus Goljer @@ -118,6 +118,7 @@ ID, ACTION, CONTEXT." ID, ACTION, CONTEXT." (-let (((&plist :arg arg :enc enc) sp-handler-context)) (when (equal action 'barf-backward) + (goto-char (sp-get enc :beg)) (sp-ruby-delete-indentation 1) (indent-according-to-mode) (save-excursion diff --git a/elpa/smartparens-20220623.1523/smartparens-rust.el b/elpa/smartparens-20230529.1017/smartparens-rust.el similarity index 99% rename from elpa/smartparens-20220623.1523/smartparens-rust.el rename to elpa/smartparens-20230529.1017/smartparens-rust.el index e3f46ceb..42996d84 100644 --- a/elpa/smartparens-20220623.1523/smartparens-rust.el +++ b/elpa/smartparens-20230529.1017/smartparens-rust.el @@ -1,6 +1,6 @@ ;;; smartparens-rust.el --- Additional configuration for Rust based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2015 Wilfred Hughes +;; Copyright (C) 2015-2019 Wilfred Hughes ;; Created: 3 November 2015 ;; Keywords: abbrev convenience editing diff --git a/elpa/smartparens-20220623.1523/smartparens-scala.el b/elpa/smartparens-20230529.1017/smartparens-scala.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-scala.el rename to elpa/smartparens-20230529.1017/smartparens-scala.el index 96f8c7ef..14a114a1 100644 --- a/elpa/smartparens-20220623.1523/smartparens-scala.el +++ b/elpa/smartparens-20230529.1017/smartparens-scala.el @@ -1,6 +1,6 @@ ;;; smartparens-scala.el --- Additional configuration for Scala based modes. -*- lexical-binding: t; -*- -;; Copyright (C) 2015 Greg Nwosu +;; Copyright (C) 2015-2018, 2021 Greg Nwosu ;; Author: Greg Nwosu ;; Maintainer: Greg Nwosu diff --git a/elpa/smartparens-20220623.1523/smartparens-swift.el b/elpa/smartparens-20230529.1017/smartparens-swift.el similarity index 100% rename from elpa/smartparens-20220623.1523/smartparens-swift.el rename to elpa/smartparens-20230529.1017/smartparens-swift.el diff --git a/elpa/smartparens-20220623.1523/smartparens-text.el b/elpa/smartparens-20230529.1017/smartparens-text.el similarity index 98% rename from elpa/smartparens-20220623.1523/smartparens-text.el rename to elpa/smartparens-20230529.1017/smartparens-text.el index 91c07be1..a5f79cc2 100644 --- a/elpa/smartparens-20220623.1523/smartparens-text.el +++ b/elpa/smartparens-20230529.1017/smartparens-text.el @@ -1,6 +1,6 @@ ;;; smartparens-latex.el --- Additional configuration for text-mode. -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Matus Goljer +;; Copyright (C) 2017-2018 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer diff --git a/elpa/smartparens-20230529.1017/smartparens-unison.el b/elpa/smartparens-20230529.1017/smartparens-unison.el new file mode 100644 index 00000000..9161c972 --- /dev/null +++ b/elpa/smartparens-20230529.1017/smartparens-unison.el @@ -0,0 +1,57 @@ +;;; smartparens-unison.el --- Additional configuration for Unison -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Joseph Morag + +;; Author: Joseph Morag +;; Maintainer: Joseph Morag +;; Created: 04 December 2022 +;; Keywords: smartparens, unison +;; URL: https://github.com/Fuco1/smartparens + +;; This file is not part of GNU Emacs. + +;;; License: + +;; This file is part of Smartparens. + +;; Smartparens is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; Smartparens is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with Smartparens. If not, see . + +;;; Commentary: + +;; This file provides some additional configuration for Unison. +;; To use it, simply add: +;; +;; (require 'smartparens-unison) +;; +;; into your configuration. You can use this in conjunction with the +;; default config or your own configuration. +;; +;; If you have good ideas about what should be added please file an +;; issue on the github tracker. +;; +;; For more info, see github readme at +;; https://github.com/Fuco1/smartparens + +;;; Code: + +(require 'smartparens) + +(sp-with-modes '(unisonlang-mode) + ;; Disable ' because it is used as a shortcut to wrap a value in + ;; lambda () -> value + ;; to make it lazy + (sp-local-pair "'" nil :actions nil)) + +(provide 'smartparens-unison) +;;; smartparens-unison.el ends here diff --git a/elpa/smartparens-20220623.1523/smartparens.el b/elpa/smartparens-20230529.1017/smartparens.el similarity index 97% rename from elpa/smartparens-20220623.1523/smartparens.el rename to elpa/smartparens-20230529.1017/smartparens.el index fd580645..bf99f5f7 100644 --- a/elpa/smartparens-20220623.1523/smartparens.el +++ b/elpa/smartparens-20230529.1017/smartparens.el @@ -1,10 +1,11 @@ ;;; smartparens.el --- Automatic insertion, wrapping and paredit-like navigation with user defined pairs. -*- lexical-binding: t -*- -;; Copyright (C) 2012-2016 Matus Goljer +;; Copyright (C) 2012-2023 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer ;; Created: 17 Nov 2012 +;; Version: 1.11.0 ;; Keywords: abbrev convenience editing ;; URL: https://github.com/Fuco1/smartparens @@ -56,6 +57,7 @@ (require 'dash) (require 'thingatpt) (require 'help-mode) ;; for help-xref-following #85 +(require 'loadhist) (declare-function cua-replace-region "cua-base") ; FIXME: remove this when we drop support for old emacs (declare-function cua-delete-region "cua-base") @@ -128,12 +130,8 @@ better orientation." sp-use-paredit-bindings sp-use-smartparens-bindings )) - (commands (cl-loop for i in (cdr - (assoc-string - (file-truename (locate-library "smartparens")) - (--map (cons (file-truename (car it)) (cdr it)) - load-history))) - if (and (consp i) (eq (car i) 'defun) (commandp (cdr i))) + (commands (cl-loop for i in (cdr (feature-symbols 'smartparens)) + if (and (eq (car-safe i) 'defun) (commandp (cdr i))) collect (cdr i)))) (with-current-buffer (get-buffer-create "*Smartparens cheat sheet*") (let ((standard-output (current-buffer)) @@ -459,14 +457,14 @@ rely on the value of this variable anywhere else!") ;; TODO: get rid of this (defvar-local sp-wrap-point nil - "Save the value of point before attemt to wrap a region. + "Save the value of point before attempt to wrap a region. Used for restoring the original state if the wrapping is cancelled.") ;; TODO: get rid of this (defvar-local sp-wrap-mark nil - "Save the value of mark before attemt to wrap a region. + "Save the value of mark before attempt to wrap a region. Used for restoring the original state if the wrapping is cancelled.") @@ -724,8 +722,22 @@ You can enable pre-set bindings by customizing (progn (sp--init) (add-hook 'self-insert-uses-region-functions 'sp-wrap--can-wrap-p nil 'local) + ;; Unfortunately, some modes rebind "inserting" keys to their + ;; own handlers but do not hand over the insertion back to + ;; `self-insert-command', rather, they insert via `insert'. + ;; Therefore, we need to call this handler in + ;; `post-command-hook' too (inside + ;; `sp--post-command-hook-handler'). The list + ;; `sp--special-self-insert-commands' specifies which commands + ;; to handle specially. + (add-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler nil 'local) + (add-hook 'pre-command-hook 'sp--save-pre-command-state nil 'local) + (add-hook 'post-command-hook 'sp--post-command-hook-handler nil 'local) (run-hooks 'smartparens-enabled-hook)) (remove-hook 'self-insert-uses-region-functions 'sp-wrap--can-wrap-p 'local) + (remove-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler 'local) + (remove-hook 'pre-command-hook 'sp--save-pre-command-state 'local) + (remove-hook 'post-command-hook 'sp--post-command-hook-handler 'local) (run-hooks 'smartparens-disabled-hook))) (defvar smartparens-strict-mode-map @@ -851,7 +863,7 @@ See `sp--init'." (defun sp--update-local-pairs () "Update local pairs after change or at mode initialization. -This commands load all the parent major mode definitions and +This command loads all the parent major mode definitions and merges them into current buffer's `sp-local-pairs'." ;; Combine all the definitions from the most ancient parent to the ;; most recent parent @@ -1178,6 +1190,14 @@ position (before or after the region). :group 'smartparens) ;; navigation & manip custom +(defcustom sp-barf-move-point-with-delimiter t + "If non-nil, move point when it would end outside the sexp after barf. + +This way, a barf operation can be immediately followed by an +opposite slurp to undo it." + :type 'boolean + :group 'smartparens) + (defcustom sp-navigate-consider-sgml-tags '( html-mode ) @@ -1310,14 +1330,14 @@ cease to be configurable." Each item is a list with three properties: - major mode -- a constant symbol 'regexp or 'syntax +- a constant symbol \\='regexp or \\='syntax - a regexp or a string containing syntax class codes. -If the second argument is 'regexp, the third argument is +If the second argument is \\='regexp, the third argument is interpreted as a regexp to search backward from the start of an expression. -If the second argument is 'syntax, the third argument is +If the second argument is \\='syntax, the third argument is interpreted as string containing syntax codes that will be skipped. @@ -1336,14 +1356,14 @@ by specifying its :prefix property." Each item is a list with three properties: - major mode -- a constant symbol 'regexp or 'syntax +- a constant symbol \\='regexp or \\='syntax - a regexp or a string containing syntax class codes. -If the second argument is 'regexp, the third argument is +If the second argument is \\='regexp, the third argument is interpreted as a regexp to search forward from the end of an expression. -If the second argument is 'syntax, the third argument is +If the second argument is \\='syntax, the third argument is interpreted as string containing syntax codes that will be skipped. @@ -1377,7 +1397,7 @@ Note: the old default behaviour was the reverse, it would split the sexp, but this is hardly ever what you want. You can add a post-handler on string pair and check for -'split-string action to add concatenation operators of the +\\='split-string action to add concatenation operators of the language you work in (in each `major-mode' you can have a separate hook). @@ -1385,21 +1405,21 @@ For example, in PHP the string concatenation operator is a dot (.), so you would add: (defun my-php-post-split-handler (_ action _) - (when (eq action 'split-sexp) + (when (eq action \\='split-sexp) (just-one-space) (insert \". . \") (backward-char 3))) - (sp-local-pair 'php-mode \"'\" nil - :post-handlers '(my-php-post-split-handler)) + (sp-local-pair \\='php-mode \"\\='\" nil + :post-handlers \\='(my-php-post-split-handler)) Then - echo 'foo |baz'; + echo \\='foo |baz\\='; results in - echo 'foo' . | . 'baz';" + echo \\='foo\\=' . | . \\='baz\\=';" :type 'boolean :group 'smartparens) @@ -1411,7 +1431,7 @@ If non-nil, `sp-kill-hybrid-sexp' will delete all whitespace up until next hybrid sexp if the point is at the end of line or on a blank line. -When it is set to 'kill, whitespace will be appended to the sexp +When it is set to \\='kill, whitespace will be appended to the sexp in kill ring." :type '(choice (const :tag "Delete" t) @@ -1458,7 +1478,8 @@ The value of `comment-start' is used if the major mode is not found." :group 'smartparens) (defcustom sp-highlight-wrap-tag-overlay t - "If non-nil, wrap tag overlays are highlighted during editing of the wrapping tag pair." + "If non-nil, wrap tag overlays are highlighted during editing +of the wrapping tag pair." :type 'boolean :group 'smartparens) @@ -1471,7 +1492,7 @@ matching paren in the echo area if not visible on screen." (defcustom sp-message-width 'frame "Length of information and error messages to display. -If set to 'frame (the default), messages are chosen based of the +If set to \\='frame (the default), messages are chosen based of the frame width. t means chose the default (verbose) message, nil means mute. Integers specify the maximum width." :type '(choice (const :tag "Fit to frame" frame) @@ -1502,7 +1523,7 @@ kill \"subwords\" when `subword-mode' is active." (defun sp--delete-selection-supersede-p () "Decide if the current command should delete the region or not. -This check is used as value of 'delete-selection property on the +This check is used as value of \\='delete-selection property on the command symbol." (if (or (equal current-prefix-arg '(4)) (sp-region-ok-p (region-beginning) (region-end))) @@ -1534,14 +1555,14 @@ This check is added to the special hook ;; the advice in time. (defadvice cua-replace-region (around fix-sp-wrap activate) "Fix `sp-wrap' in `cua-selection-mode'." - (if (sp-wrap--can-wrap-p) + (if (and smartparens-mode (sp-wrap--can-wrap-p)) (cua--fallback) ad-do-it)) (defadvice cua-delete-region (around fix-sp-delete-region activate) "If `smartparens-strict-mode' is enabled, perform a region check before deleting." - (if smartparens-strict-mode + (if (and smartparens-mode smartparens-strict-mode) (progn (unless (or current-prefix-arg (sp-region-ok-p (region-beginning) (region-end))) @@ -1744,13 +1765,6 @@ insert the modes." (progn ,@(mapcar (lambda (form) (append (list (car form) modes) (cdr form))) forms))))) -(font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(" - (regexp-opt '("sp-with-modes" - "sp-get" - "sp-compare-sexps") t) - "\\_>") - (1 font-lock-keyword-face)))) - (defmacro sp--with-case-sensitive (&rest body) "Ensure that searching done within BODY is case-sensitive. @@ -2305,7 +2319,7 @@ this pair. Possible values are: - wrap - wrap an active region with the pair defined by opening delimiter if this is typed while region is active. - autoskip - if the sexp is active or `sp-autoskip-closing-pair' is - set to 'always, skip over the closing delimiter if user types its + set to \\='always, skip over the closing delimiter if user types its characters in order. - navigate - enable this pair for navigation/highlight and strictness checks @@ -2441,9 +2455,9 @@ modes, use this property on `sp-local-pair' instead." (sp--update-pair-list pair t)) (when (or wrap bind) (global-set-key (read-kbd-macro (or wrap bind)) `(lambda (&optional arg) - (interactive "P") + (interactive "*P") (sp-wrap-with-pair ,open)))) - (when insert (global-set-key (kbd insert) `(lambda () (interactive) (sp-insert-pair ,open))))) + (when insert (global-set-key (kbd insert) `(lambda () (interactive "*") (sp-insert-pair ,open))))) (sp--update-local-pairs-everywhere) sp-pairs) @@ -2497,7 +2511,7 @@ the global list is replaced. If you wish to both add and remove things with single call, use \"((:add ...) (:rem ...))\" as an argument. Therefore, - :when '(:add my-test) + :when \\='(:add my-test) would mean \"use the global settings for this pair, but also this additional test\". If no value is provided for list arguments, @@ -2561,11 +2575,11 @@ addition, there is a global per major-mode option, see (when (or wrap bind) (define-key map (read-kbd-macro (or wrap bind)) `(lambda (&optional arg) - (interactive "P") + (interactive "*P") (sp-wrap-with-pair ,open)))) (when insert (define-key map (kbd insert) - `(lambda () (interactive) (sp-insert-pair ,open)))))))) + `(lambda () (interactive "*") (sp-insert-pair ,open)))))))) (sp--update-local-pairs-everywhere (-flatten (list modes))) sp-pairs) @@ -2692,17 +2706,21 @@ works again as usual.") (defvar-local sp-wrap-tag-overlays nil "Cons pair of tag wrap overlays.") -(defvar sp-pair-overlay-keymap (make-sparse-keymap) +(defvar sp-pair-overlay-keymap + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-g") + '(menu-item nil sp-remove-active-pair-overlay :filter + (lambda (cmd) + (unless (bound-and-true-p company-my-keymap) + cmd)))) + map) "Keymap for the pair overlays.") -(define-key sp-pair-overlay-keymap (kbd "C-g") - '(menu-item nil sp-remove-active-pair-overlay :filter - (lambda (cmd) - (unless (bound-and-true-p company-my-keymap) - cmd)))) -(defvar sp-wrap-overlay-keymap (make-sparse-keymap) +(defvar sp-wrap-overlay-keymap + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-g") 'sp-wrap-cancel) + map) "Keymap for the wrap overlays.") -(define-key sp-wrap-overlay-keymap (kbd "C-g") 'sp-wrap-cancel) (defun sp--overlays-at (&optional pos) "Wrapper around `overlays-at' to get smartparens overlays. @@ -2905,13 +2923,15 @@ On escape action use the value of CONTEXT." (texmathp))) (defun sp-point-before-eol-p (_id action _context) - "Return t if point is followed by optional white spaces and end of line, nil otherwise. + "Return t if point is followed by optional white spaces and end of +line, nil otherwise. This predicate is only tested on \"insert\" action." (when (eq action 'insert) (sp--looking-at-p "\\s-*$"))) (defun sp-point-after-bol-p (id action _context) - "Return t if point follows beginning of line and possibly white spaces, nil otherwise. + "Return t if point follows beginning of line and possibly white +spaces, nil otherwise. This predicate is only tested on \"insert\" action." (when (eq action 'insert) (sp--looking-back-p (concat "^\\s-*" (regexp-quote id))))) @@ -3246,14 +3266,6 @@ last form; otherwise do nothing." (unless action (setq sp-last-operation 'sp-self-insert)))))))))) -;; Unfortunately, some modes rebind "inserting" keys to their own -;; handlers but do not hand over the insertion back to -;; `self-insert-command', rather, they insert via `insert'. -;; Therefore, we need to call this handler in `post-command-hook' too. -;; The list `sp--special-self-insert-commands' specifies which -;; commands to handle specially. -(add-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler) - ;; TODO: make a proper data structure for state tracking and describe ;; why we need each of these. (defun sp--save-pre-command-state () @@ -3263,8 +3275,6 @@ last form; otherwise do nothing." (setq sp-pre-command-point (point)) (setq sp-buffer-modified-p (buffer-modified-p)))) -(add-hook 'pre-command-hook 'sp--save-pre-command-state) - (defun sp--get-pair-list () "Get all non-stringlike pairs. @@ -3369,7 +3379,7 @@ anything." (regexp-opt (--map (car it) pair-list)) "^\\<$")) -(defun sp--get-last-wraped-region (beg end open close) +(defun sp--make-last-wraped-region (beg end open close) "Return `sp-get-sexp' style plist about the last wrapped region. Note: this function does not retrieve the actual value of @@ -3379,7 +3389,6 @@ provided values." (e (make-marker))) (set-marker b beg) (set-marker e end) - (set-marker-insertion-type e t) `(:beg ,b :end ,e :op ,open :cl ,close :prefix ""))) ;; Wrapping is basically the same thing as insertion, only the closing @@ -3533,7 +3542,7 @@ OPEN and CLOSE are the delimiters." (sp--replace-overlay-text oend close) (setq sp-last-operation 'sp-wrap-region) (setq sp-last-wrapped-region - (sp--get-last-wraped-region + (sp--make-last-wraped-region (overlay-start obeg) (overlay-end oend) open close)) (cond @@ -3752,7 +3761,7 @@ In other words, if any pair can be inserted using a trigger, only pairs insertable by trigger are returned. ACTION is an implementation detail. Usually it has the value -'insert when we determine pairs to insert. On repeated wrapping +\\='insert when we determine pairs to insert. On repeated wrapping however we pass the value 'wrap. This will be refactored away in the upcoming version." (setq looking-fn (or looking-fn 'sp--looking-back-p)) @@ -3970,7 +3979,7 @@ active region." ((= 2 sp-wrap-repeat-last))) (memq sp-last-operation '(sp-self-insert sp-wrap-region)) (or (= (point) (+ b oplen acolen)) - (= (point) e))) + (= (point) (+ e acolen)))) (delete-char (- acolen)) (if (< (point) e) (progn (goto-char (+ b oplen)) @@ -3978,7 +3987,7 @@ active region." (goto-char (- e cllen)) (insert (cdr active-pair)) (setq sp-last-wrapped-region - (sp--get-last-wraped-region + (sp--make-last-wraped-region (+ b oplen) (point) (car active-pair) (cdr active-pair))) (goto-char (+ b oplen acolen))) @@ -3987,8 +3996,8 @@ active region." (goto-char e) (insert (cdr active-pair)) (setq sp-last-wrapped-region - (sp--get-last-wraped-region - b e (car active-pair) (cdr active-pair)))) + (sp--make-last-wraped-region + b (+ e acolen) (car active-pair) (cdr active-pair)))) (setq sp-last-operation 'sp-wrap-region) (sp--run-hook-with-args (car active-pair) :post-handlers 'wrap) sp-last-operation))))) @@ -4022,7 +4031,7 @@ call this state \"active sexp\". The setting expression become inactive. For example, pressing ( is followed by inserting the pair (|). If -we then type 'word' and follow by ), the result should be (word)| +we then type \\='word\\=' and follow by ), the result should be (word)| instead of (word)|). This behaviour can be customized by various settings of @@ -4031,7 +4040,7 @@ This behaviour can be customized by various settings of Additionally, this behaviour can be selectively disabled for specific pairs by removing their \"autoskip\" action. You can achieve this by using `sp-pair' or `sp-local-pair' with -\":actions '(:rem autoskip)\"." +\":actions \\='(:rem autoskip)\"." (sp--with-case-sensitive (when (or (and (eq sp-autoskip-closing-pair t) sp-pair-overlay-list @@ -4882,6 +4891,32 @@ counting (stack) algorithm." (setq hit :no-more))))) re))) +(defun sp-get-string-or-nested-string (&optional back) + "Get a string with `sp-get-string' or `sp-get-stringlike-expression'. + +It might happen that the string delimiter we are looking at is +nested inside another string delimited by string fences (for +example nested \" and ' in python). In this case we can't use +`sp-get-string' parser because it would pick up the outer string. + +So if we are inside a string and `syntax-ppss' returns t as +delimiter we need to use `sp-get-stringlike-expression'. The +same situation happens when the character following the point has +syntax class 7 (string) or char syntax 34 (same thing as syntax +class but less general), but the character different from what +`syntax-ppss' returns as the outer string delimiter." + (if (let ((in-string (sp-point-in-string))) + (or (eq t in-string) + (and (not (eq in-string nil)) + (not (eq in-string (char-after)))))) + (save-excursion + (save-restriction + (widen) + (-let (((beg . end) (sp-get-quoted-string-bounds))) + (narrow-to-region beg end)) + (sp-get-stringlike-expression back))) + (sp-get-string back))) + (defun sp-use-textmode-stringlike-parser-p () "Test if we should use textmode stringlike parser or not." (let ((modes (-filter 'symbolp sp-navigate-use-textmode-stringlike-parser)) @@ -4903,20 +4938,8 @@ on it when calling directly." ;; `sp-get-string' (if (and delimiter (= (length delimiter) 1) - ;; TODO: this "smart" behaviour is duplicated in - ;; `sp-get-thing', maybe the whole string parsing could - ;; be extracted to some common function (actually we - ;; should probably use this one from `sp-get-thing') (eq (char-syntax (string-to-char delimiter)) 34)) - (if (eq t (sp-point-in-string)) - ;; TODO: this is duplicated in `sp-get-thing', move to a function - (save-excursion - (save-restriction - (widen) - (-let (((beg . end) (sp-get-quoted-string-bounds))) - (narrow-to-region beg end)) - (sp-get-stringlike-expression back))) - (sp-get-string back)) + (sp-get-string-or-nested-string back) (sp-get-stringlike-expression back)))) (defun sp-get-expression (&optional back) @@ -5545,12 +5568,13 @@ combine it with: You can also bind the output of this function directly to a key, like: - (global-set-key (kbd ...) (sp-restrict-to-pairs-interactive \"{\" 'sp-down-sexp)) + (global-set-key (kbd ...) + (sp-restrict-to-pairs-interactive \"{\" \\='sp-down-sexp)) This will be a function that descends down only into { } pair, ignoring all others." (lambda (&optional _arg) - (interactive "P") + (interactive "*P") (sp-restrict-to-pairs pairs function))) (defun sp-restrict-to-object-interactive (object function) @@ -5568,13 +5592,13 @@ combine it with: You can also bind the output of this function directly to a key, like: (global-set-key (kbd ...) (sp-restrict-to-object-interactive - 'sp-prefix-pair-object - 'sp-forward-sexp)) + \\='sp-prefix-pair-object + \\='sp-forward-sexp)) This will be a function that navigates only by using paired expressions, ignoring strings and sgml tags." (lambda (&optional _arg) - (interactive "P") + (interactive "*P") (sp-restrict-to-object object function))) (defun sp-prefix-tag-object (&optional _arg) @@ -5686,14 +5710,7 @@ expressions are considered." (sp-get-sexp t)) ((and (eq (syntax-class (syntax-after (1- (point)))) 7) (not (sp-char-is-escaped-p (1- (point))))) - (if (eq t (sp-point-in-string)) - (save-excursion - (save-restriction - (widen) - (-let (((beg . end) (sp-get-quoted-string-bounds))) - (narrow-to-region beg end)) - (sp-get-stringlike-expression t))) - (sp-get-string t))) + (sp-get-string-or-nested-string t)) ((sp--valid-initial-delimiter-p (sp--looking-back (sp--get-stringlike-regexp) nil)) (sp-get-expression t)) ;; We might be somewhere inside the prefix of the @@ -5737,22 +5754,7 @@ expressions are considered." ;; `sp-get-stringlike-or-textmode-expression' ((and (eq (syntax-class (syntax-after (point))) 7) (not (sp-char-is-escaped-p))) - ;; It might happen that the string delimiter we are - ;; looking at is nested inside another string - ;; delimited by string fences (for example nested " - ;; and ' in python). In this case we can't use - ;; `sp-get-string' parser because it would pick up the - ;; outer string. So if we are inside a string and - ;; `syntax-ppss' returns t as delimiter we need to use - ;; `sp-get-stringlike-expression' - (if (eq t (sp-point-in-string)) - (save-excursion - (save-restriction - (widen) - (-let (((beg . end) (sp-get-quoted-string-bounds))) - (narrow-to-region beg end)) - (sp-get-stringlike-expression nil))) - (sp-get-string nil))) + (sp-get-string-or-nested-string nil)) ((sp--valid-initial-delimiter-p (sp--looking-at (sp--get-stringlike-regexp))) (sp-get-expression nil)) ;; it can still be that we are looking at a /prefix/ of a @@ -6480,7 +6482,7 @@ between the successive kills.") If `evil-mode' is active, copying a region will also add it to the 0 register. Additionally, if command was prefixed with a register, copy the region to that register." - (interactive) + (interactive "*") (let ((result (if dont-kill (copy-region-as-kill beg end) @@ -6549,7 +6551,7 @@ Examples: Note: prefix argument is shown after the example in \"comment\". Assumes `sp-navigate-consider-symbols' equal to t." - (interactive "P") + (interactive "*P") (let* ((raw (sp--raw-argument-p arg)) (arg (prefix-numeric-value arg)) (n (abs arg)) @@ -6668,7 +6670,7 @@ Examples: blab (foo (bar baz) quux)| -> blab | (1 2 3 |4 5 6) -> (|4 5 6) ;; \\[universal-argument]" - (interactive "P") + (interactive "*P") (sp-kill-sexp (sp--negate-argument arg) dont-kill)) (defun sp-copy-sexp (&optional arg) @@ -6697,7 +6699,7 @@ current one and put the point in front of it. Otherwise get the enclosing sexp and clone it below the current enclosing sexp." - (interactive) + (interactive "*") (-when-let (ok (let ((sexp (sp-get-thing))) (if (not (equal (sp-get sexp :op) "")) sexp @@ -6733,8 +6735,9 @@ the point is in (see `sp-get-hybrid-sexp'). With ARG numeric prefix 0 (zero) just call `kill-line'. -You can customize the behaviour of this command by toggling -`sp-hybrid-kill-excessive-whitespace'. +You can customize the behaviour of this command by customizing +`sp-hybrid-kill-excessive-whitespace' and +`sp-hybrid-kill-entire-symbol'. Examples: @@ -6753,7 +6756,7 @@ Examples: foo | (bar -> foo | ;; C-0 baz) baz)" - (interactive "P") + (interactive "*P") (let* ((raw (sp--raw-argument-p arg)) (arg (prefix-numeric-value arg)) (orig-indent (save-excursion @@ -6816,7 +6819,7 @@ Examples: (progn (progn (some |long sexp)) -> |)" - (interactive) + (interactive "*") (beginning-of-line) (sp-kill-hybrid-sexp nil) (let ((empty-last-line (save-excursion (beginning-of-line) (eobp)))) @@ -6860,7 +6863,7 @@ Examples: ​ |(baz quux) |(foo bar) foo bar baz| -> foo baz| bar ;; -1" - (interactive "P") + (interactive "*P") (let* ((arg (prefix-numeric-value arg)) (n (abs arg))) ;; if we're inside a symbol, we need to move out of it first @@ -6899,7 +6902,7 @@ Examples: foo bar baz -> quux flux |quux flux foo bar baz\\n|" - (interactive "P") + (interactive "*P") (if (numberp arg) (transpose-lines arg) (let* ((next (save-excursion @@ -6929,7 +6932,7 @@ Examples: -> (a, x = big_function_call(a, b) = read_user_input() b)" - (interactive) + (interactive "*") (let* ((cur (sp-get-hybrid-sexp)) (next (save-excursion (goto-char (sp-get cur :end)) @@ -6950,7 +6953,7 @@ typed text will become the last item of the previous sexp. This acts similarly to `sp-add-to-previous-sexp' but with special handling of empty lines." - (interactive) + (interactive "*") (let* ((hsexp (sp-get-hybrid-sexp)) (prev-sexp (save-excursion (goto-char (sp-get hsexp :beg)) @@ -6977,7 +6980,7 @@ the closing delimiter after the last item in the list. This acts similarly to `sp-forward-barf-sexp' but with special handling of empty lines." - (interactive) + (interactive "*") (-when-let (enc (sp-get-enclosing-sexp)) (save-excursion ;; if we're looking at whitespace and end of sexp, move the @@ -7025,7 +7028,7 @@ works better in \"line-based\" languages like C or Java. Because the structure is much looser in these languages, this command currently does not support all the prefix argument triggers that `sp-forward-slurp-sexp' does." - (interactive) + (interactive "*") (let (slurped-within-line) (-if-let* ((enc (sp-get-enclosing-sexp)) (bsexp (save-excursion @@ -7114,7 +7117,7 @@ Examples: ((|foo) bar baz quux) -> ((|foo bar baz quux)) ;; with \\[universal-argument] \"foo| bar\" \"baz quux\" -> \"foo| bar baz quux\"" - (interactive "P") + (interactive "*P") (if (> (prefix-numeric-value arg) 0) (let ((n (abs (prefix-numeric-value arg))) (enc (sp-get-enclosing-sexp)) @@ -7198,7 +7201,8 @@ Examples: (sp-backward-slurp-sexp (sp--negate-argument arg)))) (defun sp-backward-slurp-sexp (&optional arg) - "Add the sexp preceding the current list in it by moving the opening delimiter. + "Add the sexp preceding the current list in it by moving the +opening delimiter. If the current list is the first in a parent list, extend that list (and possibly apply recursively until we can extend a list @@ -7209,7 +7213,8 @@ If arg is N, apply this function that many times. If arg is negative -N, extend the closing pair instead (that is, forward). -If ARG is raw prefix \\[universal-argument], extend all the way to the beginning of the parent list. +If ARG is raw prefix \\[universal-argument], extend all the way +to the beginning of the parent list. If both the current expression and the expression to be slurped are strings, they are joined together. @@ -7225,7 +7230,7 @@ Examples: (foo bar baz (|quux)) -> ((foo bar baz |quux)) ;; with \\[universal-argument] \"foo bar\" \"baz |quux\" -> \"foo bar baz |quux\"" - (interactive "P") + (interactive "*P") (if (> (prefix-numeric-value arg) 0) (let ((n (abs (prefix-numeric-value arg))) (enc (sp-get-enclosing-sexp)) @@ -7327,7 +7332,7 @@ Examples: (blab (foo bar) |baz quux) -> (blab (foo bar |baz quux)) ;; \\[universal-argument] (foo bar) (baz |quux) -> (foo bar (baz |quux)) ;; \\[universal-argument] \\[universal-argument]" - (interactive "P") + (interactive "*P") (save-excursion (cond ((equal arg '(16)) @@ -7360,7 +7365,7 @@ Examples: (foo bar |(bar quux) blab) -> ((foo bar |bar quux) blab) ;; \\[universal-argument] (foo |bar) (baz quux) -> ((foo |bar) baz quux) ;; \\[universal-argument] \\[universal-argument]" - (interactive "P") + (interactive "*P") (save-excursion (cond ((equal arg '(16)) @@ -7384,6 +7389,11 @@ closing delimiter of the list. If the current list is empty, do nothing. +If the setting `sp-barf-move-point-with-delimiter' is non-nil, +move the point together with the closing delimiter if the point +would end up outside of the enclosing sexp. This way the barf +can be always followed by a slurp to undo the change. + Examples: (prefix arg in comment) (foo bar| baz) -> (foo bar|) baz ;; nil (defaults to 1) @@ -7393,10 +7403,11 @@ Examples: (prefix arg in comment) (1 2 3| 4 5 6) -> (1 2 3|) 4 5 6 ;; \\[universal-argument] (or numeric prefix 3) (foo bar| baz) -> foo (bar| baz) ;; -1" - (interactive "P") + (interactive "*P") (let* ((raw (sp--raw-argument-p arg)) (old-arg arg) - (arg (prefix-numeric-value arg))) + (arg (prefix-numeric-value arg)) + (new-cl-position nil)) (if (> arg 0) (if (sp-point-in-blank-sexp) (sp-message :blank-sexp) @@ -7423,8 +7434,12 @@ Examples: (prefix arg in comment) (sp-do-move-cl (point)) (sp--keep-indentation (sp--indent-region :beg :end)) + (setq new-cl-position (- (point) :cl-l)) (sp--run-hook-with-args :op :post-handlers 'barf-forward - (list :arg arg :enc enc)))))) + (list :arg arg :enc enc))))) + (when (and sp-barf-move-point-with-delimiter + (< new-cl-position (point))) + (goto-char new-cl-position))) (sp-backward-barf-sexp (sp--negate-argument old-arg))))) (defun sp-backward-barf-sexp (&optional arg) @@ -7440,10 +7455,11 @@ Examples: ([foo bar] |baz) -> [foo bar] (|baz) (1 2 3 |4 5 6) -> 1 2 3 (|4 5 6) ;; \\[universal-argument] (or 3)" - (interactive "P") + (interactive "*P") (let* ((raw (sp--raw-argument-p arg)) (old-arg arg) - (arg (prefix-numeric-value arg))) + (arg (prefix-numeric-value arg)) + (new-cl-position nil)) (if (> arg 0) (if (sp-point-in-blank-sexp) (sp-message :blank-sexp) @@ -7467,10 +7483,19 @@ Examples: (sp--run-hook-with-args :op :pre-handlers 'barf-backward (list :arg arg :enc enc))) (sp-get (sp-get-enclosing-sexp) - (sp-do-move-op (point)) + ;; make sure that we end up on the same place, since + ;; sp-do-move-op might move the point to the start of + ;; the previous sexp (the one barfed out) + (save-excursion (sp-do-move-op (point))) + ;; skip the opening to end up inside the sexp + (forward-char (+ :op-l :prefix-l)) (sp--indent-region :beg :end) + (setq new-cl-position (point)) (sp--run-hook-with-args :op :post-handlers 'barf-backward - (list :arg arg :enc enc)))))) + (list :arg arg :enc enc))))) + (when (and sp-barf-move-point-with-delimiter + (> new-cl-position (point))) + (goto-char new-cl-position))) (sp-forward-barf-sexp (sp--negate-argument old-arg))))) ;; TODO: get rid of the macro anyway, it's stupid! @@ -7731,21 +7756,23 @@ Examples: (foo |bar baz) -> [foo |bar baz] ;; [ (foo |bar baz) -> [(foo |bar baz)] ;; \\[universal-argument] [" - (interactive (list - (catch 'done - (let ((available-pairs (sp--get-pair-list-context 'wrap)) - ev ac (pair-prefix "")) - (while (not ac) - (setq ev (read-event (format "Rewrap with: %s" pair-prefix) t)) - (if (and (equal pair-prefix "") - (eq ev 'return)) - (throw 'done nil)) - (setq pair-prefix (concat pair-prefix (format-kbd-macro (vector ev)))) - (unless (--any? (string-prefix-p pair-prefix (car it)) available-pairs) - (user-error "Impossible pair prefix selected: %s" pair-prefix)) - (setq ac (--first (equal pair-prefix (car it)) available-pairs))) - ac)) - current-prefix-arg)) + (interactive (if buffer-read-only + (user-error "Buffer is read-only") + (list + (catch 'done + (let ((available-pairs (sp--get-pair-list-context 'wrap)) + ev ac (pair-prefix "")) + (while (not ac) + (setq ev (read-event (format "Rewrap with: %s" pair-prefix) t)) + (if (and (equal pair-prefix "") + (eq ev 'return)) + (throw 'done nil)) + (setq pair-prefix (concat pair-prefix (format-kbd-macro (vector ev)))) + (unless (--any? (string-prefix-p pair-prefix (car it)) available-pairs) + (user-error "Impossible pair prefix selected: %s" pair-prefix)) + (setq ac (--first (equal pair-prefix (car it)) available-pairs))) + ac)) + current-prefix-arg))) (if (not pair) (sp-unwrap-sexp) (-when-let (enc (sp-get-enclosing-sexp)) @@ -7760,13 +7787,13 @@ Examples: (unless keep-old (delete-char :op-l)) (setq sp-last-wrapped-region - (sp--get-last-wraped-region + (sp--make-last-wraped-region :beg (+ :end (length (car pair)) (length (cdr pair)) (- :op-l) (- :cl-l)) - (car pair) (cdr pair))))) + (car pair) (cdr pair))))) (sp--run-hook-with-args (car pair) :post-handlers 'rewrap-sexp (list :parent (sp-get enc :op)))))) @@ -7781,7 +7808,7 @@ Examples: (foo [|bar] baz) -> [foo (|bar) baz] ;; 1 (foo {bar [|baz] quux} quack) -> [foo {bar (|baz) quux} quack] ;; 2" - (interactive "p") + (interactive "*p") (let ((enc (sp-get-enclosing-sexp)) (encp (sp-get-enclosing-sexp (1+ arg)))) (if (and enc encp) @@ -7846,8 +7873,8 @@ Examples: (f|oo [bar] baz) -> (foo [|] baz) - {|'foo': 'bar'} -> {'|': 'bar'}" - (interactive) + {|\\='foo\\=': \\='bar\\='} -> {\\='|\\=': \\='bar\\='}" + (interactive "*") (-when-let (ok (sp-get-sexp)) (sp-get ok (kill-region :beg-in :end-in) @@ -7867,7 +7894,7 @@ Examples: (f|oo [bar] baz) -> (|) {'f|oo': 'bar'} -> {'|': 'bar'}" - (interactive) + (interactive "*") (-when-let (ok (sp-get-enclosing-sexp)) (sp-get ok (if (sp-point-in-blank-sexp) @@ -7903,7 +7930,7 @@ Examples: (foo bar| baz) -> foo bar| baz |(foo) (bar) (baz) -> |(foo) bar (baz) ;; 2" - (interactive "p") + (interactive "*p") (setq arg (or arg 1)) (let ((sp-navigate-consider-symbols nil)) (let ((ok (save-excursion (sp-forward-sexp arg)))) @@ -7924,7 +7951,7 @@ Examples: (foo bar)| (baz) -> foo bar| (baz) (foo) (bar) (baz)| -> foo (bar) (baz) ;; 3" - (interactive "p") + (interactive "*p") (sp-unwrap-sexp (- (or arg 1)))) (defun sp-splice-sexp (&optional arg) @@ -7940,7 +7967,7 @@ Examples: (foo |(bar baz) quux) -> foo |(bar baz) quux (foo (bar| baz) quux) -> foo (bar| baz) quux ;; 2" - (interactive "p") + (interactive "*p") (setq arg (or arg 1)) (-when-let (ok (sp-get-enclosing-sexp arg)) (if (equal ";" (sp-get ok :prefix)) @@ -7955,7 +7982,7 @@ Examples: "Save the text in the region between BEG and END inside EXPR, then delete EXPR and insert the saved text. -If optional argument JUPM-END is equal to the symbol 'end move +If optional argument JUPM-END is equal to the symbol \\='end move the point after the re-inserted text." (let (str p) (setq str (buffer-substring-no-properties beg end)) @@ -7988,7 +8015,7 @@ Examples: Note that to kill only the content and not the enclosing delimiters you can use \\[universal-argument] \\[sp-backward-kill-sexp]. See `sp-backward-kill-sexp' for more information." - (interactive "p") + (interactive "*p") (while (> arg 0) (sp-splice-sexp-killing-around '(4)) (setq arg (1- arg)))) @@ -8010,7 +8037,7 @@ Examples: Note that to kill only the content and not the enclosing delimiters you can use \\[universal-argument] \\[sp-kill-sexp]. See `sp-kill-sexp' for more information." - (interactive "p") + (interactive "*p") (while (> arg 0) (let ((ok (sp-get-enclosing-sexp 1))) (if ok @@ -8053,7 +8080,7 @@ Examples: (- (car x) |a 3) -> (car x)| ;; with arg = -1 (foo (bar |baz) quux) -> |(bar baz) ;; with arg = \\[universal-argument] \\[universal-argument]" - (interactive "P") + (interactive "*P") (cond ((equal arg '(-4)) (sp-splice-sexp-killing-forward 1)) @@ -8160,7 +8187,7 @@ We want to move the `while' before the `let'. ​ (do-thing 3))) (do-thing 3))) (forward-char (sp-get env |:op-l)) -> (sp-get env (forward-char |:op-l))" - (interactive "p") + (interactive "*p") (save-excursion (when (sp-point-in-symbol) (sp-forward-symbol)) @@ -8210,7 +8237,7 @@ Examples: ​ |(do-stuff 2)) (do-stuff 2)) foo bar (concat |baz quux) -> (concat |foo bar baz quux) ;; 2" - (interactive "p") + (interactive "*p") (sp-forward-whitespace) (let* ((old (point)) (raise (progn @@ -8227,7 +8254,8 @@ Examples: (sp-forward-whitespace)) (defun sp-emit-sexp (&optional arg) - "Move all expression preceding point except the first one out of the current list. + "Move all expression preceding point except the first one out of +the current list. With ARG positive N, keep that many expressions from the start of the current list. @@ -8245,7 +8273,7 @@ Examples: ​ (while not-done-yet (execute-only-once) ​ (execute-only-once) -> (while not-done-yet ;; arg = 2 ​ |(execute-in-loop)) |(execute-in-loop))" - (interactive "p") + (interactive "*p") (let (save-text) (save-excursion (sp-beginning-of-sexp) @@ -8274,7 +8302,7 @@ With ARG being raw prefix argument \\[universal-argument], extract all the expre up until the end of enclosing list. If the raw prefix is negative, this behaves as \\[universal-argument] `sp-backward-barf-sexp'." - (interactive "P") + (interactive "*P") (if (equal arg '(-4)) (sp-backward-barf-sexp '(4)) (sp-select-next-thing arg) @@ -8323,7 +8351,7 @@ expressions up until the start of enclosing list." ;; this is uch uglier than the "before" version, since the ;; calculations forward have to account for the deleted text. Figure ;; out a way to make it smoother. - (interactive "P") + (interactive "*P") (sp-select-next-thing arg) (sp--with-case-sensitive (let ((enc (sp-get-enclosing-sexp)) @@ -8403,7 +8431,7 @@ Examples: ([foo |bar baz] quux) -> ([foo] |[bar baz] quux) (foo bar| baz quux) -> (foo) (bar|) (baz) (quux) ;; \\[universal-argument]" - (interactive "P") + (interactive "*P") (cond ((equal arg '(4)) (-when-let ((first-item . rest-items) (sp-get-list-items)) @@ -8486,7 +8514,7 @@ Examples: [foo] [bar] |[baz] -> [foo bar |baz] ;; -2 (foo bar (baz)| (quux) (blob bluq)) -> (foo bar (baz| quux blob bluq)) ;; \\[universal-argument]" - (interactive "P") + (interactive "*P") (let* ((raw (sp--raw-argument-p arg)) (arg (prefix-numeric-value arg)) (n (abs arg)) @@ -8719,14 +8747,16 @@ considered balanced expressions." (sp-select-next-thing (sp--negate-argument arg) point)) (defun sp-select-next-thing-exchange (&optional arg point) - "Just like `sp-select-next-thing' but run `exchange-point-and-mark' afterwards." + "Just like `sp-select-next-thing' but run `exchange-point-and-mark' +afterwards." (interactive "P") (prog1 (sp-select-next-thing arg point) (exchange-point-and-mark))) (defun sp-select-previous-thing-exchange (&optional arg point) - "Just like `sp-select-previous-thing' but run `exchange-point-and-mark' afterwards." + "Just like `sp-select-previous-thing' but run `exchange-point-and-mark' +afterwards." (interactive "P") (prog1 (sp-select-previous-thing arg point) @@ -8792,7 +8822,7 @@ Examples: (foo (|) bar) -> (foo | bar) |(foo bar) -> (|foo bar)" - (interactive "P") + (interactive "*P") (sp--with-case-sensitive (let* ((raw (sp--raw-argument-p arg)) ;; if you edit 10 gigabyte files in Emacs, you're gonna have @@ -8877,7 +8907,7 @@ Examples: (foo (|) bar) -> (foo | bar) (foo bar)| -> (foo bar|)" - (interactive "P") + (interactive "*P") (if (and sp-autodelete-wrap (eq sp-last-operation 'sp-wrap-region)) (sp-backward-unwrap-sexp) @@ -9003,7 +9033,7 @@ With ARG being Negative number -N, repeat that many times in backward direction. See `sp-forward-symbol' for what constitutes a symbol." - (interactive "p") + (interactive "*p") (sp--with-case-sensitive (if (> arg 0) (while (> arg 0) @@ -9040,7 +9070,7 @@ With ARG being positive number N, repeat that many times. With ARG being Negative number -N, repeat that many times in backward direction." - (interactive "p") + (interactive "*p") (sp-kill-symbol arg t)) (defun sp-delete-symbol (&optional arg word) @@ -9054,7 +9084,7 @@ With ARG being Negative number -N, repeat that many times in backward direction. See `sp-forward-symbol' for what constitutes a symbol." - (interactive "p") + (interactive "*p") (let* ((kill-ring kill-ring) (select-enable-clipboard nil)) (sp-kill-symbol arg word))) @@ -9068,7 +9098,7 @@ With ARG being positive number N, repeat that many times. With ARG being Negative number -N, repeat that many times in backward direction." - (interactive "p") + (interactive "*p") (sp-delete-symbol arg t)) (defun sp-backward-kill-symbol (&optional arg word) @@ -9080,7 +9110,7 @@ With ARG being Negative number -N, repeat that many times in forward direction. See `sp-backward-symbol' for what constitutes a symbol." - (interactive "p") + (interactive "*p") (sp--with-case-sensitive (if (> arg 0) (while (> arg 0) @@ -9117,7 +9147,7 @@ With ARG being positive number N, repeat that many times. With ARG being Negative number -N, repeat that many times in backward direction." - (interactive "p") + (interactive "*p") (sp-backward-kill-symbol arg t)) (defun sp-backward-delete-symbol (&optional arg word) @@ -9131,7 +9161,7 @@ With ARG being Negative number -N, repeat that many times in forward direction. See `sp-backward-symbol' for what constitutes a symbol." - (interactive "p") + (interactive "*p") (let* ((kill-ring kill-ring) (select-enable-clipboard nil)) (sp-backward-kill-symbol arg word))) @@ -9145,7 +9175,7 @@ With ARG being positive number N, repeat that many times. With ARG being Negative number -N, repeat that many times in backward direction." - (interactive "p") + (interactive "*p") (sp-backward-delete-symbol arg t)) (defun sp-delete-region (beg end) @@ -9155,7 +9185,7 @@ BEG and END are the bounds of region to be deleted. If that text is unbalanced, signal an error instead. With a prefix argument, skip the balance check." - (interactive "r") + (interactive "*r") (when (or current-prefix-arg (sp-region-ok-p beg end) (user-error (sp-message :unbalanced-region :return))) @@ -9169,7 +9199,7 @@ BEG and END are the bounds of region to be killed. If that text is unbalanced, signal an error instead. With a prefix argument, skip the balance check." - (interactive "r") + (interactive "*r") (when (or current-prefix-arg (sp-region-ok-p beg end) (user-error (sp-message :unbalanced-region :return))) @@ -9184,7 +9214,7 @@ paragraph instead, and with ARG, justify as well. Otherwise, reindent the current defun, and adjust the position of the point." - (interactive "P") + (interactive "*P") (if (sp-point-in-string-or-comment) (fill-paragraph arg) (let ((column (current-column)) @@ -9230,7 +9260,7 @@ If in a string, just insert a literal newline. If in a comment and if followed by invalid structure, call `indent-new-comment-line' to keep the invalid structure in a comment." - (interactive) + (interactive "*") (cond ((sp-point-in-string) (newline)) @@ -9245,7 +9275,7 @@ comment." (defun sp-comment () "Insert the comment character and adjust hanging sexps such that it doesn't break structure." - (interactive) + (interactive "*") (if (sp-point-in-string-or-comment) (if (= 1 (length (single-key-description last-command-event))) ;; pretty hacky (insert (single-key-description last-command-event)) @@ -9287,17 +9317,17 @@ comment." (defun sp-wrap-round () "Wrap following sexp in round parentheses." - (interactive) + (interactive "*") (sp-wrap-with-pair "(")) (defun sp-wrap-square () "Wrap following sexp in square brackets." - (interactive) + (interactive "*") (sp-wrap-with-pair "[")) (defun sp-wrap-curly () "Wrap following sexp in curly braces." - (interactive) + (interactive "*") (sp-wrap-with-pair "{")) @@ -9409,7 +9439,8 @@ support custom pairs." (interactive)) (defun sp-highlight-current-sexp (_arg) - "Highlight the expression returned by the next command, preserving point position." + "Highlight the expression returned by the next command, preserving +point position." (interactive "P") (let* ((cmd (read-key-sequence "" t)) (com (key-binding cmd))) @@ -9624,7 +9655,6 @@ has been created." (defadvice haskell-indentation-delete-backward-char (before sp-delete-pair-advice activate) (save-match-data (sp-delete-pair (ad-get-arg 0)))) -(add-hook 'post-command-hook 'sp--post-command-hook-handler) (sp--set-base-key-bindings) (sp--update-override-key-bindings) diff --git a/elpa/smartparens-20220623.1523/sp-sublimetext-like.el b/elpa/smartparens-20230529.1017/sp-sublimetext-like.el similarity index 100% rename from elpa/smartparens-20220623.1523/sp-sublimetext-like.el rename to elpa/smartparens-20230529.1017/sp-sublimetext-like.el -- 2.47.3