al-parens.el 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ;;; al-parens.el --- Additional functionality for working with parentheses
  2. ;; Copyright © 2015-2016 Alex Kost
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;; This program is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;;; Code:
  14. (require 'smartparens)
  15. ;;;###autoload
  16. (defun al/kill-sexp (&optional arg)
  17. "Kill sexp forward.
  18. Similar to `kill-sexp', except if ARG is a raw prefix
  19. \\[universal-argument], kill from point to the end of current
  20. list/string, as `sp-kill-sexp' does."
  21. (interactive "P")
  22. (if (equal arg '(4))
  23. (progn (kill-sexp) (sp-kill-sexp arg))
  24. (kill-sexp (prefix-numeric-value arg))))
  25. ;;;###autoload
  26. (defun al/backward-kill-sexp (&optional arg)
  27. "Kill sexp backward.
  28. Similar to `backward-kill-sexp', except if ARG is a raw prefix
  29. \\[universal-argument], kill from point to the end of current
  30. list/string, as `sp-backward-kill-sexp' does."
  31. (interactive "P")
  32. (if (equal arg '(4))
  33. (progn (backward-kill-sexp) (sp-backward-kill-sexp arg))
  34. (backward-kill-sexp (prefix-numeric-value arg))))
  35. (provide 'al-parens)
  36. ;;; al-parens.el ends here