diff --git a/core/prelude-core.el b/core/prelude-core.el index 3ed6604..28615c2 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -564,5 +564,11 @@ This follows freedesktop standards, should work in X servers." (t (error "Unknown shell"))))) (find-file-other-window (expand-file-name shell-init-file (getenv "HOME"))))) +(defun prelude-wrap-with (s) + "Create a wrapper function for smartparens using S." + `(lambda (&optional arg) + (interactive "P") + (sp-wrap-with-pair ,s))) + (provide 'prelude-core) ;;; prelude-core.el ends here diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 08f5132..a52c7a1 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -110,10 +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-(") (prelude-wrap-with "(")) ;; FIXME: pick terminal friendly binding -;; (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-[") (prelude-wrap-with "[")) +(define-key prog-mode-map (kbd "M-\"") (prelude-wrap-with "\"")) ;; disable annoying blink-matching-paren (setq blink-matching-paren nil) diff --git a/modules/prelude-lisp.el b/modules/prelude-lisp.el index 2516a13..b54e005 100644 --- a/modules/prelude-lisp.el +++ b/modules/prelude-lisp.el @@ -39,10 +39,10 @@ (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-(") (prelude-wrap-with "(")) ;; FIXME: Pick terminal-friendly binding. -;;(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-[") (prelude-wrap-with "[")) +(define-key lisp-mode-shared-map (kbd "M-\"") (prelude-wrap-with "\"")) ;; a great lisp coding hook (defun prelude-lisp-coding-defaults ()