Elixir: move function to packages-funcs.el and prefix it

This commit is contained in:
syl20bnr 2016-02-14 23:15:39 -05:00
parent c476c03360
commit 86003bfc75
2 changed files with 18 additions and 8 deletions

View file

@ -102,23 +102,17 @@
(spacemacs|add-company-hook elixir-mode)
(spacemacs|add-company-hook alchemist-iex-mode))
(defun elixir-do-end-close-action (id action context)
(when (eq action 'insert)
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode)))
(defun elixir/post-init-smartparens ()
(sp-with-modes '(elixir-mode)
(sp-local-pair "->" "end"
:when '(("RET"))
:post-handlers '(:add elixir-do-end-close-action)
:post-handlers '(:add spacemacs//elixir-do-end-close-action)
:actions '(insert)))
(sp-with-modes '(elixir-mode)
(sp-local-pair "do" "end"
:when '(("SPC" "RET"))
:post-handlers '(:add elixir-do-end-close-action)
:post-handlers '(:add spacemacs//elixir-do-end-close-action)
:actions '(insert))))
(defun elixir/init-elixir-mode ()

View file

@ -0,0 +1,16 @@
;;; packages-funcs.el --- Elixir Layer packages functions File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacemacs//elixir-do-end-close-action (id action context)
(when (eq action 'insert)
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode)))