From cc4bdd72d712c325670da67c2533f0e2af765e1d Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 15 May 2013 15:59:45 +0200 Subject: Add some smartparens keys to python-mode --- emacs/init.org | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/emacs/init.org b/emacs/init.org index 7af08ae..53eef49 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -1334,6 +1334,27 @@ (emms-mode-line 1))) #+END_SRC +* Enable some smartparen keybindings in python :smartparens:python: + + Since, for example, HTML mode uses the same keys for similar + functions from the ~tagedit~ package, these keys should only be + enabled for (for the moment) python mode. + + This should be set before the =smartparens-mode= function is added + to the =python-mode-hook= so that the hook will run when smartparens + is turned on. + + #+BEGIN_SRC emacs-lisp + (defun oni:set-smartparens-keys () + (local-set-key (kbd "") 'sp-forward-barf-sexp) + (local-set-key (kbd "") 'sp-forward-slurp-sexp)) + + (defun oni:local-set-smartparens-hook () + (add-hook 'smartparens-mode-hook 'oni:set-smartparens-keys nil t)) + + (add-hook 'python-mode-hook 'oni:local-set-smartparens-hook) + #+END_SRC + * All the rest This still needs to be sorted out and documented, haven't had time -- cgit v1.2.3-54-g00ecf