From: Andreas Gerler Date: Fri, 31 Jan 2020 16:54:27 +0000 (+0100) Subject: update ob-restclient X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=ffe13b78f58b81ca906826989720df3ef81be22f;p=emacsconfig.git update ob-restclient --- diff --git a/elpa/ob-restclient-20190626.1824/ob-restclient-autoloads.el b/elpa/ob-restclient-20190626.1824/ob-restclient-autoloads.el deleted file mode 100644 index a7233078..00000000 --- a/elpa/ob-restclient-20190626.1824/ob-restclient-autoloads.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; ob-restclient-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) - -;;;### (autoloads nil "ob-restclient" "ob-restclient.el" (23994 46442 -;;;;;; 331202 311000)) -;;; Generated autoloads from ob-restclient.el - -(autoload 'org-babel-execute:restclient "ob-restclient" "\ -Execute a block of Restclient code with org-babel. -This function is called by `org-babel-execute-src-block' - -\(fn BODY PARAMS)" nil nil) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; ob-restclient-autoloads.el ends here diff --git a/elpa/ob-restclient-20190626.1824/ob-restclient-pkg.el b/elpa/ob-restclient-20190626.1824/ob-restclient-pkg.el deleted file mode 100644 index cf563df9..00000000 --- a/elpa/ob-restclient-20190626.1824/ob-restclient-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "ob-restclient" "20190626.1824" "org-babel functions for restclient-mode" '((restclient "0")) :commit "53376667eeddb1388fd6c6976f3222e7c8adcd46" :keywords '("literate programming" "reproducible research") :authors '(("Alf Lervåg")) :maintainer '("Alf Lervåg") :url "https://github.com/alf/ob-restclient.el") diff --git a/elpa/ob-restclient-20190626.1824/ob-restclient.el b/elpa/ob-restclient-20190626.1824/ob-restclient.el deleted file mode 100644 index 6da01eb9..00000000 --- a/elpa/ob-restclient-20190626.1824/ob-restclient.el +++ /dev/null @@ -1,109 +0,0 @@ -;;; ob-restclient.el --- org-babel functions for restclient-mode - -;; Copyright (C) Alf Lervåg - -;; Author: Alf Lervåg -;; Keywords: literate programming, reproducible research -;; Package-Version: 20190626.1824 -;; Homepage: https://github.com/alf/ob-restclient.el -;; Version: 0.02 -;; Package-Requires: ((restclient "0")) - -;;; License: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: -;; This is a very simple first iteration at integrating restclient.el -;; and org-mode. - -;;; Requirements: -;; restclient.el - -;;; Code: -(require 'ob) -(require 'ob-ref) -(require 'ob-comint) -(require 'ob-eval) -(require 'restclient) - -(defvar org-babel-default-header-args:restclient - `((:results . "raw")) - "Default arguments for evaluating a restclient block.") - -;;;###autoload -(defun org-babel-execute:restclient (body params) - "Execute a block of Restclient code with org-babel. -This function is called by `org-babel-execute-src-block'" - (message "executing Restclient source code block") - (with-temp-buffer - (let ((results-buffer (current-buffer)) - (restclient-same-buffer-response t) - (restclient-same-buffer-response-name (buffer-name)) - (display-buffer-alist - (cons - '("\\*temp\\*" display-buffer-no-window (allow-no-window . t)) - display-buffer-alist))) - - (insert (buffer-name)) - (with-temp-buffer - (dolist (p params) - (let ((key (car p)) - (value (cdr p))) - (when (eql key :var) - (insert (format ":%s = %s\n" (car value) (cdr value)))))) - (insert body) - (goto-char (point-min)) - (delete-trailing-whitespace) - (goto-char (point-min)) - (restclient-http-parse-current-and-do 'restclient-http-do nil t)) - - (while restclient-within-call - (sleep-for 0.05)) - - (goto-char (point-min)) - (when (search-forward (buffer-name) nil t) - (error "Restclient encountered an error")) - - (if (org-babel-restclient-return-pure-payload-result-p params) - (org-babel-restclient-pure-payload-result) - (org-babel-restclient-wrap-result))))) - -(defun org-babel-restclient-wrap-result () - "Wrap the contents of the buffer in an `org-mode' src block." - (let ((mode-name (substring (symbol-name major-mode) 0 -5))) - (insert (format "#+BEGIN_SRC %s\n" mode-name)) - (goto-char (point-max)) - (insert "#+END_SRC\n") - (buffer-string))) - -(defun org-babel-restclient-pure-payload-result () - "Just return the payload." - (let ((comments-start - (save-excursion - (while (not (looking-at "//")) - (forward-line)) - (point)))) - (buffer-substring (point-min) comments-start))) - -(defun org-babel-restclient-return-pure-payload-result-p (params) - "Return `t' if the `:results' key in PARAMS contains `value' or `table'." - (let ((result-type (cdr (assoc :results params)))) - (when result-type - (string-match "value\\|table" result-type)))) - -(provide 'ob-restclient) -;;; ob-restclient.el ends here diff --git a/elpa/ob-restclient-20200109.730/ob-restclient-autoloads.el b/elpa/ob-restclient-20200109.730/ob-restclient-autoloads.el new file mode 100644 index 00000000..747e57d9 --- /dev/null +++ b/elpa/ob-restclient-20200109.730/ob-restclient-autoloads.el @@ -0,0 +1,28 @@ +;;; ob-restclient-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "ob-restclient" "ob-restclient.el" (0 0 0 0)) +;;; Generated autoloads from ob-restclient.el + +(autoload 'org-babel-execute:restclient "ob-restclient" "\ +Execute a block of Restclient code with org-babel. +This function is called by `org-babel-execute-src-block' + +\(fn BODY PARAMS)" nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-restclient" '("org-babel-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; ob-restclient-autoloads.el ends here diff --git a/elpa/ob-restclient-20200109.730/ob-restclient-pkg.el b/elpa/ob-restclient-20200109.730/ob-restclient-pkg.el new file mode 100644 index 00000000..9e190622 --- /dev/null +++ b/elpa/ob-restclient-20200109.730/ob-restclient-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "ob-restclient" "20200109.730" "org-babel functions for restclient-mode" '((restclient "0")) :commit "c5c22e603531dca48575d0a425fddff16dc0f391" :keywords '("literate programming" "reproducible research") :authors '(("Alf Lervåg")) :maintainer '("Alf Lervåg") :url "https://github.com/alf/ob-restclient.el") diff --git a/elpa/ob-restclient-20200109.730/ob-restclient.el b/elpa/ob-restclient-20200109.730/ob-restclient.el new file mode 100644 index 00000000..de89a0cd --- /dev/null +++ b/elpa/ob-restclient-20200109.730/ob-restclient.el @@ -0,0 +1,113 @@ +;;; ob-restclient.el --- org-babel functions for restclient-mode + +;; Copyright (C) Alf Lervåg + +;; Author: Alf Lervåg +;; Keywords: literate programming, reproducible research +;; Package-Version: 20200109.730 +;; Homepage: https://github.com/alf/ob-restclient.el +;; Version: 0.02 +;; Package-Requires: ((restclient "0")) + +;;; License: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; This is a very simple first iteration at integrating restclient.el +;; and org-mode. + +;;; Requirements: +;; restclient.el + +;;; Code: +(require 'ob) +(require 'ob-ref) +(require 'ob-comint) +(require 'ob-eval) +(require 'restclient) + +(defvar org-babel-default-header-args:restclient + `((:results . "raw")) + "Default arguments for evaluating a restclient block.") + +;;;###autoload +(defun org-babel-execute:restclient (body params) + "Execute a block of Restclient code with org-babel. +This function is called by `org-babel-execute-src-block'" + (message "executing Restclient source code block") + (with-temp-buffer + (let ((results-buffer (current-buffer)) + (restclient-same-buffer-response t) + (restclient-same-buffer-response-name (buffer-name)) + (display-buffer-alist + (cons + '("\\*temp\\*" display-buffer-no-window (allow-no-window . t)) + display-buffer-alist))) + + (insert (buffer-name)) + (with-temp-buffer + (dolist (p params) + (let ((key (car p)) + (value (cdr p))) + (when (eql key :var) + (insert (format ":%s = <<\n%s\n#\n" (car value) (cdr value)))))) + (insert body) + (goto-char (point-min)) + (delete-trailing-whitespace) + (goto-char (point-min)) + (restclient-http-parse-current-and-do 'restclient-http-do nil t)) + + (while restclient-within-call + (sleep-for 0.05)) + + (goto-char (point-min)) + (when (search-forward (buffer-name) nil t) + (error "Restclient encountered an error")) + + (if (org-babel-restclient-return-pure-payload-result-p params) + (org-babel-restclient-pure-payload-result) + (org-babel-restclient-wrap-result))))) + +(defun org-babel-restclient-wrap-result () + "Wrap the contents of the buffer in an `org-mode' src block." + (let ((mode-name (substring (symbol-name major-mode) 0 -5))) + (insert (format "#+BEGIN_SRC %s\n" mode-name)) + (goto-char (point-max)) + (insert "#+END_SRC\n") + (buffer-string))) + +(defun org-babel-restclient-pure-payload-result () + "Just return the payload." + (let ((comments-start + (save-excursion + (goto-char (point-max)) + (while (comment-only-p (line-beginning-position) (line-end-position)) + (forward-line -1)) + ;; Include the last line as well + (forward-line) + (point)))) + (buffer-substring (point-min) comments-start))) + + +(defun org-babel-restclient-return-pure-payload-result-p (params) + "Return `t' if the `:results' key in PARAMS contains `value' or `table'." + (let ((result-type (cdr (assoc :results params)))) + (when result-type + (string-match "value\\|table" result-type)))) + +(provide 'ob-restclient) +;;; ob-restclient.el ends here