Skip to content

Instantly share code, notes, and snippets.

@steinarb

steinarb/.emacs Secret

Created March 11, 2022 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steinarb/fe442b78fda5d70a2733785c8c50e976 to your computer and use it in GitHub Desktop.
Save steinarb/fe442b78fda5d70a2733785c8c50e976 to your computer and use it in GitHub Desktop.
;; restclient from git to get restclient-jq
(add-to-list 'load-path (expand-file-name "~/git/restclient.el"))
(when (locate-library "restclient")
(require 'restclient)
(require 'restclient-jq)
(restclient-register-result-func "save-body" #'restclient-save-body "Save body to filename given as arg"))
(defun restclient-save-body (args args-offset)
(save-match-data
(let ((filename (expand-file-name args)))
(lambda ()
(with-current-buffer restclient-same-buffer-response-name
(write-region (point-min) (restclient-jq-result-end-point) filename))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment