]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
update ob-restclient
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 24 Apr 2026 16:53:25 +0000 (18:53 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 24 Apr 2026 16:53:25 +0000 (18:53 +0200)
elpa/ob-restclient-20231228.1403/ob-restclient-autoloads.el [deleted file]
elpa/ob-restclient-20231228.1403/ob-restclient-pkg.el [deleted file]
elpa/ob-restclient-20231228.1403/ob-restclient.el [deleted file]
elpa/ob-restclient-20250806.2153/ob-restclient-autoloads.el [new file with mode: 0644]
elpa/ob-restclient-20250806.2153/ob-restclient-pkg.el [new file with mode: 0644]
elpa/ob-restclient-20250806.2153/ob-restclient.el [new file with mode: 0644]
elpa/ob-restclient-readme.txt [deleted file]

diff --git a/elpa/ob-restclient-20231228.1403/ob-restclient-autoloads.el b/elpa/ob-restclient-20231228.1403/ob-restclient-autoloads.el
deleted file mode 100644 (file)
index a503d93..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-;;; ob-restclient-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
-;; Generated by the `loaddefs-generate' function.
-
-;; This file is part of GNU Emacs.
-
-;;; Code:
-
-(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
-
-
-\f
-;;; 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)")
-(autoload 'org-babel-variable-assignments:restclient "ob-restclient" "\
-Return a list of statements assigning variables specified in PARAMS.
-
-(fn PARAMS)")
-(register-definition-prefixes "ob-restclient" '("org-babel-"))
-\f
-;;; End of scraped data
-
-(provide 'ob-restclient-autoloads)
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; no-native-compile: t
-;; coding: utf-8-emacs-unix
-;; End:
-
-;;; ob-restclient-autoloads.el ends here
diff --git a/elpa/ob-restclient-20231228.1403/ob-restclient-pkg.el b/elpa/ob-restclient-20231228.1403/ob-restclient-pkg.el
deleted file mode 100644 (file)
index 1c08d32..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-(define-package "ob-restclient" "20231228.1403" "org-babel functions for restclient-mode"
-  '((restclient "0"))
-  :commit "8183f8af08838854cf145ca4855b373f3e7c44b0" :authors
-  '(("Alf Lervåg"))
-  :maintainers
-  '(("Alf Lervåg"))
-  :maintainer
-  '("Alf Lervåg")
-  :keywords
-  '("literate programming" "reproducible research")
-  :url "https://github.com/alf/ob-restclient.el")
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/elpa/ob-restclient-20231228.1403/ob-restclient.el b/elpa/ob-restclient-20231228.1403/ob-restclient.el
deleted file mode 100644 (file)
index 39f60c2..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-;;; ob-restclient.el --- org-babel functions for restclient-mode -*- lexical-binding: t -*-
-
-;; Copyright (C) Alf Lervåg
-
-;; Author: Alf Lervåg
-;; Keywords: literate programming, reproducible research
-;; Homepage: https://github.com/alf/ob-restclient.el
-;; Version: 0.03
-;; 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 'org-table)
-(require 'restclient)
-
-(defvar org-babel-default-header-args:restclient
-  `((:results . "raw"))
-  "Default arguments for evaluating a restclient block.")
-
-(defcustom org-babel-restclient--jq-path "jq"
-  "The path to `jq', for post-processing. Uses the PATH by default"
-  :type '(string)
-  :group 'org-babel)
-
-;;;###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-response-body-only (org-babel-restclient--should-hide-headers-p params))
-          (restclient-same-buffer-response-name (buffer-name))
-         (raw-only (org-babel-restclient--raw-payload-p params))
-         (suppress-response-buffer (fboundp #'restclient-http-send-current-suppress-response-buffer))
-          (display-buffer-alist
-           (cons
-            '("\\*temp\\*" display-buffer-no-window (allow-no-window . t))
-            display-buffer-alist)))
-
-      (insert (buffer-name))
-      (with-temp-buffer
-       (insert
-        (org-babel-expand-body:generic
-         body params
-         (org-babel-variable-assignments:restclient params)))
-        (goto-char (point-min))
-        (delete-trailing-whitespace)
-        (goto-char (point-min))
-        (restclient-http-parse-current-and-do 'restclient-http-do raw-only t suppress-response-buffer))
-
-      (while restclient-within-call
-        (sleep-for 0.05))
-
-      (goto-char (point-min))
-      (when (equal (buffer-name) (buffer-string))
-        (error "Restclient encountered an error"))
-
-      (when-let* ((jq-header (assoc :jq params))
-                  (jq-path "jq")
-                 (jq-args (or (cdr (assoc :jq-args params)) "")))
-        (shell-command-on-region
-         (point-min)
-         (point-max)
-         (format "%s %s--args %s" org-babel-restclient--jq-path
-                (if (assq :jq-args params) (format "%s " jq-args) "")
-                 (shell-quote-argument (cdr jq-header)))
-         results-buffer
-         t))
-
-      ;; widen if jq but not pure payload
-      (when (and (assq :jq params)
-                 (not (assq :noheaders params))
-                 (not (org-babel-restclient--return-pure-payload-result-p params)))
-        (widen))
-
-      (if (member "table" (cdr (assoc :result-params params)))
-          (let* ((separator '(4))
-                (result
-                 (condition-case err
-                     (let ((pmax (point-max)))
-                       ;; If the buffer is empty, don't bother trying to
-                       ;; convert the table.
-                       (when (> pmax 1)
-                         (org-table-convert-region (point-min) pmax separator)
-                         (delq nil
-                               (mapcar (lambda (row)
-                                         (and (not (eq row 'hline))
-                                              (mapcar #'org-babel-string-read row)))
-                                       (org-table-to-lisp)))))
-                   (error
-                    (display-warning 'org-babel
-                                     (format "Error reading results: %S" err)
-                                     :error)
-                    nil))))
-           (pcase result
-             (`((,scalar)) scalar)
-             (`((,_ ,_ . ,_)) result)
-             (`(,scalar) scalar)
-             (_ result)))
-        (when (not (org-babel-restclient--return-pure-payload-result-p params))
-          (org-babel-restclient--wrap-result))
-        (buffer-string)))))
-
-;;;###autoload
-(defun org-babel-variable-assignments:restclient (params)
-  "Return a list of statements assigning variables specified in PARAMS."
-  (mapcar
-   (lambda (pair)
-     (let ((name (car pair))
-           (value (cdr pair))
-          (format-string ":%s = %s\n"))
-       (when (string-match-p "\n" value)
-        (setq format-string ":%s = <<\n%s\n#\n"))
-       (format format-string name value)))
-   (org-babel--get-vars params)))
-
-(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))
-    (unless (and (bolp) (eolp))
-      (insert "\n"))
-    (insert "#+END_SRC\n")))
-
-(defun org-babel-restclient--should-hide-headers-p (params)
-  "Return `t' if headers should be hidden."
-  (or (org-babel-restclient--return-pure-payload-result-p params)
-                (assq :noheaders params)
-                (assq :jq params)))
-
-(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))))
-
-(defun org-babel-prep-session:restclient (_session _params)
-  "Return an error because restclient does not support sessions."
-  (error "Restclient does not support sessions"))
-
-(defun org-babel-restclient--raw-payload-p (params)
-  "Return t if the `:results' key in PARAMS contain `file'."
-  (let ((result-type (cdr (assoc :results params))))
-    (when result-type
-      (and (not (org-babel-restclient--should-hide-headers-p params))
-           (string-match "file" result-type)))))
-
-(provide 'ob-restclient)
-;;; ob-restclient.el ends here
diff --git a/elpa/ob-restclient-20250806.2153/ob-restclient-autoloads.el b/elpa/ob-restclient-20250806.2153/ob-restclient-autoloads.el
new file mode 100644 (file)
index 0000000..a503d93
--- /dev/null
@@ -0,0 +1,37 @@
+;;; ob-restclient-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
+;; Generated by the `loaddefs-generate' function.
+
+;; This file is part of GNU Emacs.
+
+;;; Code:
+
+(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
+
+
+\f
+;;; 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)")
+(autoload 'org-babel-variable-assignments:restclient "ob-restclient" "\
+Return a list of statements assigning variables specified in PARAMS.
+
+(fn PARAMS)")
+(register-definition-prefixes "ob-restclient" '("org-babel-"))
+\f
+;;; End of scraped data
+
+(provide 'ob-restclient-autoloads)
+
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; no-native-compile: t
+;; coding: utf-8-emacs-unix
+;; End:
+
+;;; ob-restclient-autoloads.el ends here
diff --git a/elpa/ob-restclient-20250806.2153/ob-restclient-pkg.el b/elpa/ob-restclient-20250806.2153/ob-restclient-pkg.el
new file mode 100644 (file)
index 0000000..64b666d
--- /dev/null
@@ -0,0 +1,8 @@
+;; -*- no-byte-compile: t; lexical-binding: nil -*-
+(define-package "ob-restclient" "20250806.2153"
+  "Org-babel functions for restclient-mode."
+  '((restclient "0"))
+  :url "https://github.com/alf/ob-restclient.el"
+  :commit "94dd9cd98ff50717135ed5089afb378616faf11a"
+  :revdesc "94dd9cd98ff5"
+  :keywords '("literate programming" "reproducible research"))
diff --git a/elpa/ob-restclient-20250806.2153/ob-restclient.el b/elpa/ob-restclient-20250806.2153/ob-restclient.el
new file mode 100644 (file)
index 0000000..067a9cf
--- /dev/null
@@ -0,0 +1,187 @@
+;;; ob-restclient.el --- org-babel functions for restclient-mode -*- lexical-binding: t -*-
+
+;; Copyright (C) Alf Lervåg
+
+;; Author: Alf Lervåg
+;; Keywords: literate programming, reproducible research
+;; Homepage: https://github.com/alf/ob-restclient.el
+;; Package-Version: 20250806.2153
+;; Package-Revision: 94dd9cd98ff5
+;; 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 'org-table)
+(require 'restclient)
+
+(defvar org-babel-default-header-args:restclient
+  `((:results . "raw"))
+  "Default arguments for evaluating a restclient block.")
+
+(defcustom org-babel-restclient--jq-path "jq"
+  "The path to `jq', for post-processing. Uses the PATH by default"
+  :type '(string)
+  :group 'org-babel)
+
+;;;###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-response-body-only (org-babel-restclient--should-hide-headers-p params))
+          (restclient-same-buffer-response-name (buffer-name))
+          ;; The latest version of restclient puts the result buffer into view mode.
+          ;; This prevents us from wrapping the result, so we must hook in and exit view-mode.
+          (restclient-response-loaded-hook 'org-babel-restclient--maybe-exit-view-mode)
+         (raw-only (org-babel-restclient--raw-payload-p params))
+         (suppress-response-buffer (fboundp #'restclient-http-send-current-suppress-response-buffer))
+          (display-buffer-alist
+           (cons
+            '("\\*temp\\*" display-buffer-no-window (allow-no-window . t))
+            display-buffer-alist)))
+
+      (insert (buffer-name))
+      (with-temp-buffer
+       (insert
+        (org-babel-expand-body:generic
+         body params
+         (org-babel-variable-assignments:restclient params)))
+        (goto-char (point-min))
+        (delete-trailing-whitespace)
+        (goto-char (point-min))
+        (restclient-http-parse-current-and-do 'restclient-http-do raw-only t suppress-response-buffer))
+
+      (while restclient-within-call
+        (sleep-for 0.05))
+
+      (goto-char (point-min))
+      (when (equal (buffer-name) (buffer-string))
+        (error "Restclient encountered an error"))
+
+      (when-let* ((jq-header (assoc :jq params))
+                  (jq-path "jq")
+                 (jq-args (or (cdr (assoc :jq-args params)) "")))
+        (shell-command-on-region
+         (point-min)
+         (point-max)
+         (format "%s %s--args %s" org-babel-restclient--jq-path
+                (if (assq :jq-args params) (format "%s " jq-args) "")
+                 (shell-quote-argument (cdr jq-header)))
+         results-buffer
+         t))
+
+      ;; widen if jq but not pure payload
+      (when (and (assq :jq params)
+                 (not (assq :noheaders params))
+                 (not (org-babel-restclient--return-pure-payload-result-p params)))
+        (widen))
+
+      (if (member "table" (cdr (assoc :result-params params)))
+          (let* ((separator '(4))
+                (result
+                 (condition-case err
+                     (let ((pmax (point-max)))
+                       ;; If the buffer is empty, don't bother trying to
+                       ;; convert the table.
+                       (when (> pmax 1)
+                         (org-table-convert-region (point-min) pmax separator)
+                         (delq nil
+                               (mapcar (lambda (row)
+                                         (and (not (eq row 'hline))
+                                              (mapcar #'org-babel-string-read row)))
+                                       (org-table-to-lisp)))))
+                   (error
+                    (display-warning 'org-babel
+                                     (format "Error reading results: %S" err)
+                                     :error)
+                    nil))))
+           (pcase result
+             (`((,scalar)) scalar)
+             (`((,_ ,_ . ,_)) result)
+             (`(,scalar) scalar)
+             (_ result)))
+        (when (not (org-babel-restclient--return-pure-payload-result-p params))
+          (org-babel-restclient--wrap-result))
+        (buffer-string)))))
+
+;;;###autoload
+(defun org-babel-variable-assignments:restclient (params)
+  "Return a list of statements assigning variables specified in PARAMS."
+  (mapcar
+   (lambda (pair)
+     (let ((name (car pair))
+           (value (cdr pair))
+          (format-string ":%s = %s\n"))
+       (when (string-match-p "\n" value)
+        (setq format-string ":%s = <<\n%s\n#\n"))
+       (format format-string name value)))
+   (org-babel--get-vars params)))
+
+(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))
+    (unless (and (bolp) (eolp))
+      (insert "\n"))
+    (insert "#+END_SRC\n")))
+
+(defun org-babel-restclient--should-hide-headers-p (params)
+  "Return `t' if headers should be hidden."
+  (or (org-babel-restclient--return-pure-payload-result-p params)
+                (assq :noheaders params)
+                (assq :jq params)))
+
+(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))))
+
+(defun org-babel-prep-session:restclient (_session _params)
+  "Return an error because restclient does not support sessions."
+  (error "Restclient does not support sessions"))
+
+(defun org-babel-restclient--raw-payload-p (params)
+  "Return t if the `:results' key in PARAMS contain `file'."
+  (let ((result-type (cdr (assoc :results params))))
+    (when result-type
+      (and (not (org-babel-restclient--should-hide-headers-p params))
+           (string-match "file" result-type)))))
+
+(defun org-babel-restclient--maybe-exit-view-mode ()
+  (when view-mode
+    (view-mode-exit)))
+
+(provide 'ob-restclient)
+;;; ob-restclient.el ends here
diff --git a/elpa/ob-restclient-readme.txt b/elpa/ob-restclient-readme.txt
deleted file mode 100644 (file)
index 1b64ad8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-This is a very simple first iteration at integrating restclient.el
-and org-mode.
-
-Requirements:
-restclient.el