Add some smartparens keys to python-mode

This commit is contained in:
Tom Willemse 2013-05-15 15:59:45 +02:00
parent ea4b5f561f
commit cc4bdd72d7

View file

@ -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 "<C-left>") 'sp-forward-barf-sexp)
(local-set-key (kbd "<C-right>") '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