branch: externals/plz commit 7e456638a651bab3a814e3ea81742dd917509cbb Author: Adam Porter <a...@alphapapa.net> Commit: Adam Porter <a...@alphapapa.net>
Meta: Move notes to orphan branch --- .gitignore | 1 + NOTES.org | 144 +------------------------------------------------------------ 2 files changed, 2 insertions(+), 143 deletions(-) diff --git a/.gitignore b/.gitignore index 92ae1191e5..e343a998bf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .#* /sandbox/ /.sandbox/ +/worktrees/ diff --git a/NOTES.org b/NOTES.org deleted file mode 100644 index b09634d6a3..0000000000 --- a/NOTES.org +++ /dev/null @@ -1,143 +0,0 @@ -#+TITLE: plz Notes - -* Contents -:PROPERTIES: -:TOC: :include siblings :depth 1 :ignore this -:END: -:CONTENTS: -- [[#tasks][Tasks]] -- [[#ideas][Ideas]] -- [[#api-design][API Design]] -- [[#references][References]] - - [[#similar-projects][Similar projects]] -:END: - -* Tasks - -** DONE Ensure that secrets are not leaked via command line or temp files -CLOSED: [2021-08-15 Sun 15:34] -:LOGBOOK: -- State "DONE" from "TODO" [2021-08-15 Sun 15:34] -:END: - -e.g. =request.el= can leak secrets and other data via the command line and [[https://github.com/tkf/emacs-request/blob/431d14343c61bc51a86c9a9e1acb6c26fe9a6298/request.el#L709][leftover temp files]]. We want to handle this safely. - -[2021-08-15 Sun 15:33] Finally figured out how to do this using ~--config~. It required some trial-and-error, since the curl man page doesn't explain how to pass request bodies over STDIN after the arguments. But it works! - -* Ideas - -** TODO Use finalizers to clean up response buffers -:LOGBOOK: -- State "TODO" from [2020-10-30 Fri 12:58] -:END: - -+ [[info:elisp#Finalizer%20Type][info:elisp#Finalizer Type]] - -This might allow us to avoid or delay putting the response body in a string, which could improve performance. - -** Name - -+ =plz= - - The current name. -+ =curly= - - Since the library is based on curl, it wouldn't be a bad idea to have =curl= in the name, and this isn't too long. - -* API Design - -** Async - -Some sample cases that the API should make easy. - -*** Body as string - -#+BEGIN_SRC elisp - (plz-get url - :with 'body-string - :then (lambda (body-string) - (setf something body-string))) -#+END_SRC - -*** Body as buffer - -#+BEGIN_SRC elisp - ;; Decodes body and narrows buffer to it. - (plz-get url - :with 'buffer - :then (lambda (buffer) - (with-current-buffer buffer - (setf text (buffer-substring (point-min) (point-max)))))) -#+END_SRC - -#+BEGIN_SRC elisp - ;; Narrows buffer to undecoded body, e.g. for binary files. - (plz-get url - :with 'buffer-undecoded ; `buffer-binary'? - :then (lambda (buffer) - (with-current-buffer buffer - (setf binary-content (buffer-substring (point-min) (point-max)))))) -#+END_SRC - -**** Callback with point at body start -:PROPERTIES: -:ID: 1795462e-01bc-4f0b-97ab-3c1b2e75485c -:END: - -Assuming that =plz= has already called =decode-coding-region=, this is straightforward, but the caller shouldn't have to do this extra work. - -#+BEGIN_SRC elisp - (plz-get url - :then (lambda (buffer) - (buffer-substring (point) (point-max)))) -#+END_SRC - -*** Body parsed with function - -#+BEGIN_SRC elisp - ;; Narrows buffer to body, decodes it, calls callback with result of `json-read'. - (plz-get url - :with #'json-read - :then (lambda (json) - (setf something (alist-get 'key json)))) -#+END_SRC - -#+BEGIN_SRC elisp - ;; Narrows buffer to body, decodes it, parses with - ;; `libxml-parse-html-region', calls callback with DOM. - (plz-get url - :with (lambda () - (libxml-parse-html-region (point-min) (point-max) url)) - :then (lambda (dom) - (with-current-buffer (generate-new-buffer "*plz-browse*") - (shr-insert-document dom)))) -#+END_SRC - -*** HTTP response with headers - -* References -:PROPERTIES: -:TOC: :depth 1 -:END: - -** Discussions - -*** [[https://lists.gnu.org/archive/html/emacs-devel/2016-12/msg01070.html][with-url]] - -[2020-12-20 Sun 08:11] At the end of 2016, Lars Ingebrigtsen [[https://lists.gnu.org/archive/html/emacs-devel/2016-12/msg01070.html][proposed]] a ~with-url~ macro that improves on ~url-retrieve~ and ~url-retrieve-synchronously~. It was [[https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg01220.html][mentioned]] by David Engster in [[https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg01217.html][this thread]] from 2020. It looks like it has a nice API. Unfortunately it h [...] - -*** TODO Feedback from Chris Wellons -:PROPERTIES: -:ID: 975f77fa-5233-4b26-970b-e0d64f2aa950 -:END: -:LOGBOOK: -- State "TODO" from [2021-08-20 Fri 05:37] -:END: - -+ [[https://github.com/alphapapa/plz.el/commit/7c27e4bdcd747f0bfc5a6298040739562a941e08#r55075010][Change: Sync with accept-process-output · alphapapa/plz.el@7c27e4b · GitHub]] -+ [[https://github.com/alphapapa/plz.el/commit/0a860d94dcbb103d05f3ee006772a568904fa4de#commitcomment-55151841][Tests: "There be dragons." · alphapapa/plz.el@0a860d9 · GitHub]] - -** Similar projects - -*** [[https://github.com/ebpa/fetch.el][GitHub - ebpa/fetch.el: A simple HTTP request library modeled after the web browser API]] - -A nice-looking wrapper for =url.el=. - diff --git a/NOTES.org b/NOTES.org new file mode 120000 index 0000000000..37b7534b30 --- /dev/null +++ b/NOTES.org @@ -0,0 +1 @@ +worktrees/meta/notes/NOTES.org \ No newline at end of file