spacemacs/layers/+tools/restclient/packages.el

70 lines
2.2 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- restclient Layer Packages File
;;
2018-01-04 07:00:25 +00:00
;; Copyright (c) 2012-2018 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
(setq restclient-packages
'(
2017-07-03 07:52:54 +00:00
(company-restclient :requires company)
golden-ratio
ob-http
2016-11-07 15:00:07 +00:00
ob-restclient
restclient
2017-07-03 07:52:54 +00:00
(restclient-helm :requires helm)
))
(defun restclient/pre-init-golden-ratio ()
(spacemacs|use-package-add-hook golden-ratio
:post-config (add-to-list 'golden-ratio-exclude-modes "restclient-mode")))
(defun restclient/pre-init-ob-http ()
2016-04-03 04:35:15 +00:00
(spacemacs|use-package-add-hook org
:post-config
(use-package ob-http
:init (add-to-list 'org-babel-load-languages '(http . t)))))
2014-11-27 19:59:24 +00:00
(defun restclient/init-ob-http ()
(when restclient-use-org
(add-to-list 'auto-mode-alist '("\\.http\\'" . org-mode))))
(defun restclient/pre-init-ob-restclient ()
2016-11-07 15:00:07 +00:00
(spacemacs|use-package-add-hook org
:post-config
(use-package ob-restclient
:init (add-to-list 'org-babel-load-languages '(restclient . t)))))
(defun restclient/init-ob-restclient ())
2016-11-07 15:00:07 +00:00
2014-11-27 19:59:24 +00:00
(defun restclient/init-restclient ()
(use-package restclient
:defer t
:init
(progn
(unless restclient-use-org
(add-to-list 'auto-mode-alist '("\\.http\\'" . restclient-mode)))
(spacemacs/set-leader-keys-for-major-mode 'restclient-mode
"n" 'restclient-jump-next
"p" 'restclient-jump-prev
"s" 'restclient-http-send-current-stay-in-window
"S" 'restclient-http-send-current
"r" 'spacemacs/restclient-http-send-current-raw-stay-in-window
"R" 'restclient-http-send-current-raw
"y" 'restclient-copy-curl-command))))
(defun restclient/init-company-restclient ()
(use-package company-restclient
:defer t
Refactor and simplify company backends declaration Enabling a company backend for a specific mode was a tedious tasks with code scattered at different locations, one for local variable definitions, one for company hook function definitions and another where the backends were pushed to the local variables (which was problematic, since we ended up pushing the same backends over and over again with `SPC f e R`, pushes have been replaced by add-to-list calls in the new macro). All these steps are now put together at one place with the new macro spacemacs|add-company-backends, check its docstring for more info on its arguments. This macro also allows to define arbitrary buffer local variables to tune company for specific modes (similar to layer variables via a keyword :variables) The code related to company backends management has been moved to the auto-completion layer in the funcs.el file. A nice side effect of this move is that it enforces correct encapsulation of company backends related code. We can now easily detect if there is some configuration leakage when the auto-completion layer is not used. But we loose macro expansion at file loading time (not sue it is a big concern though). The function spacemacs|enable-auto-complete was never used so it has been deleted which led to the deletion of the now empty file core-auto-completion.el. The example in LAYERS.org regarding auto-completion is now out of date and has been deleted. An example to setup auto-completion is provided in the README.org file of the auto-completion layer.
2017-01-02 05:39:04 +00:00
:init (spacemacs|add-company-backends
:backends company-restclient
:modes restclient-mode)))
(defun restclient/init-restclient-helm ()
(use-package restclient-helm
:defer t
:init (spacemacs/set-leader-keys-for-major-mode 'restclient-mode
"ji" 'helm-restclient)))