This commit is contained in:
ry
2022-01-11 18:05:13 -08:00
parent 2046befee2
commit 8e7b654716
846 changed files with 71287 additions and 4 deletions

View File

@@ -0,0 +1,58 @@
#+TITLE: lang/rest
#+DATE: March 17, 2017
#+SINCE: v1.3
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#hacks][Hacks]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module adds [[https://en.wikipedia.org/wiki/Representational_state_transfer][REST]] support.
+ Code-completion (~company-restclient~)
+ Code evaluation
+ Imenu support for ~restclient-mode~
+ org-mode: babel support (~ob-restclient~)
#+begin_quote
~restclient-mode~ is tremendously useful for automated or quick testing REST
APIs. My workflow is to open an ~org-mode~ buffer, create a restclient source
block and hack away. ~restclient-mode~ and ~company-restclient~ power this
arcane wizardry.
#+end_quote
** Maintainers
This module has no dedicated maintainers.
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/pashky/restclient.el][restclient]]
+ =:completion company=
+ [[https://github.com/iquiw/company-restclient][company-restclient]]
** Hacks
+ restclient has been modified not to silently reject self-signed or invalid
certificates.
+ Adds imenu support to ~restclient-mode~.
* Prerequisites
This module has no prerequisites.
* Features
# An in-depth list of features, how to use them, and their dependencies.
* Configuration
# How to configure this module, including common problems and how to address them.
* Troubleshooting
# Common issues and their solution, or places to look for help.

View File

@@ -0,0 +1,28 @@
;;; lang/rest/autoload.el -*- lexical-binding: t; -*-
(defun +rest-request-at-point-p (&optional pos)
(save-excursion
(if pos (goto-char pos))
(beginning-of-line)
(and (re-search-forward restclient-method-url-regexp
(line-end-position) t)
(not (nth 4 (syntax-ppss))))))
;;;###autoload
(defun +rest/dwim-at-point ()
"TODO"
(interactive)
(when (+rest-request-at-point-p)
(restclient-http-send-current-stay-in-window)))
;;;###autoload
(defun +rest/fold-all ()
"TODO"
(interactive)
(save-excursion
(goto-char (point-min))
(let ((last (point)))
(while (and (restclient-jump-next)
(not (= last (setq last (point)))))
(unless (overlays-at (line-end-position))
(restclient-toggle-body-visibility))))))

View File

@@ -0,0 +1,35 @@
;;; lang/rest/config.el -*- lexical-binding: t; -*-
(use-package! restclient
:mode ("\\.http\\'" . restclient-mode)
;; line numbers aren't enabled by default in fundamental-mode-derived modes
:hook (restclient-mode . display-line-numbers-mode)
:config
(set-popup-rule! "^\\*HTTP Response" :size 0.4 :quit 'other)
(setq-hook! 'restclient-mode-hook
imenu-generic-expression '((nil "^[A-Z]+\s+.+" 0)))
(defadvice! +rest--permit-self-signed-ssl-a (fn &rest args)
"Forces underlying SSL verification to prompt for self-signed or invalid
certs, rather than reject them silently."
:around #'restclient-http-do
(let (gnutls-verify-error tls-checktrust)
(apply fn args)))
(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))

View File

@@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/rest/packages.el
(package! restclient :pin "176d9cb6552f04d98c33e29fc673862bdf3bca03")
(when (featurep! :completion company)
(package! company-restclient :pin "e5a3ec54edb44776738c13e13e34c85b3085277b"))