doomemacs/modules/lang/rest/config.el
Henrik Lissner 76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00

36 lines
1.2 KiB
EmacsLisp

;;; lang/rest/config.el -*- lexical-binding: t; -*-
(use-package! restclient
:mode ("\\.http\\'" . restclient-mode)
:config
(set-popup-rule! "^\\*HTTP Response" :size 0.4 :quit 'other)
;; line numbers aren't enabled by default in fundamental-mode-derived modes
(add-hook 'restclient-mode-hook #'display-line-numbers-mode)
(setq-hook! 'restclient-mode-hook
imenu-generic-expression '((nil "^[A-Z]+\s+.+" 0)))
;; Forces underlying SSL verification to prompt for self-signed or invalid
;; certs, rather than silently reject them.
(defun +rest*permit-self-signed-ssl (orig-fn &rest args)
(let (gnutls-verify-error tls-checktrust)
(apply orig-fn args)))
(advice-add #'restclient-http-do :around #'+rest*permit-self-signed-ssl)
(map! :map restclient-mode-map
:n [return] #'+rest/dwim-at-point
:n "za" #'restclient-toggle-body-visibility
:n "zm" #'+rest/fold-all
:n "zr" #'outline-show-all
:localleader
"e" #'restclient-http-send-current
"E" #'restclient-http-send-current-raw
"c" #'restclient-copy-curl-command))
(use-package! company-restclient
:when (featurep! :completion company)
:after restclient
:config (set-company-backend! 'restclient-mode 'company-restclient))