From 9eca62cd760898cf2ef2d1e7505a6bbacd0ea1e8 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Thu, 17 Oct 2013 19:20:28 +0300 Subject: [PATCH] Define a few basic wrapping keybindings --- core/prelude-editor.el | 4 ++++ modules/prelude-lisp.el | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 4b08ac4..7f1a3a8 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -110,6 +110,10 @@ Will only occur if prelude-whitespace is also enabled." (show-smartparens-global-mode +1) +(define-key prog-mode-map (kbd "M-(") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "("))) +(define-key prog-mode-map (kbd "M-[") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "["))) +(define-key prog-mode-map (kbd "M-\"") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "\""))) + ;; disable annoying blink-matching-paren (setq blink-matching-paren nil) diff --git a/modules/prelude-lisp.el b/modules/prelude-lisp.el index 6ba745f..9b23cfb 100644 --- a/modules/prelude-lisp.el +++ b/modules/prelude-lisp.el @@ -38,6 +38,11 @@ ;; Lisp configuration (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) +;; wrap keybindings +(define-key lisp-mode-shared-map (kbd "M-(") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "("))) +(define-key lisp-mode-shared-map (kbd "M-[") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "["))) +(define-key lisp-mode-shared-map (kbd "M-\"") (lambda (&optional arg) (interactive "P") (sp-wrap-with-pair "\""))) + ;; a great lisp coding hook (defun prelude-lisp-coding-defaults () (smartparens-strict-mode +1)