[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz e7d9513bb9 03/81: Rename
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz e7d9513bb9 03/81: Rename |
Date: |
Wed, 11 May 2022 17:57:57 -0400 (EDT) |
branch: externals/plz
commit e7d9513bb92c0854bf911c9993d8e18bd3eada84
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Rename
It's kind of silly, but at least it's unique, and it's sort of a play
on the idea of "request": "please" -> "plz". I think it's better than
calling it http-lib, because it doesn't presume to name itself as if
it were *the* HTTP library, and it's shorter. (Although if there
weren't already a package on MELPA named "http", I'd probably just use
that.)
---
http-lib.el => plz.el | 94 +++++++++++++++++-----------------
test/{test-http-lib.el => test-plz.el} | 10 ++--
2 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/http-lib.el b/plz.el
similarity index 78%
rename from http-lib.el
rename to plz.el
index b81e399eff..4170616a19 100644
--- a/http-lib.el
+++ b/plz.el
@@ -1,4 +1,4 @@
-;;; http-lib.el --- HTTP library -*- lexical-binding:
t; -*-
+;;; plz.el --- HTTP library -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Adam Porter
@@ -32,12 +32,12 @@
;;;; Structs
-(cl-defstruct http-lib-response
+(cl-defstruct plz-response
version status headers body)
;;;; Constants
-(defconst http-lib-curl-errors
+(defconst plz-curl-errors
;; Copied from elfeed-curl.el.
'((1 . "Unsupported protocol.")
(2 . "Failed to initialize.")
@@ -120,33 +120,33 @@
;;;; Variables
-(defvar-local http-lib-error nil
+(defvar-local plz-error nil
"Callback function for errored completion of request in current curl process
buffer.")
-(defvar-local http-lib-success nil
+(defvar-local plz-success nil
"Callback function for successful completion of request in current curl
process buffer.")
;;;; Customization
-(defgroup http-lib nil
- "Options for `http-lib'."
+(defgroup plz nil
+ "Options for `plz'."
:group 'network)
-(defcustom http-lib-curl-program "curl"
+(defcustom plz-curl-program "curl"
"Name of curl program to call."
:type 'string)
-(defcustom http-lib-curl-default-args
+(defcustom plz-curl-default-args
'("--silent"
"--compressed"
"--location"
- ;; "--write-out" "(http-lib-curl-request . %%{size_header})"
+ ;; "--write-out" "(plz-curl-request . %%{size_header})"
"--connect-timeout" "5"
"--dump-header" "-")
"Default arguments to curl."
:type '(repeat string))
-;; (defcustom http-lib-curl-connection-timeout 5
+;; (defcustom plz-curl-connection-timeout 5
;; "Default connection timeout for HTTP requests made with curl.
;; The --connect-timeout option for curl.")
@@ -155,25 +155,25 @@
;;;; Functions
-(cl-defun http-lib-get (url &key headers _connect-timeout sync
+(cl-defun plz-get (url &key headers _connect-timeout sync
success error)
"FIXME: Docstring."
- (http-lib--request 'get url
+ (plz--request 'get url
:sync sync
:headers headers
;; :connect-timeout timeout
:success success
:error error))
-(cl-defun http-lib-request-async (&rest args)
+(cl-defun plz-request-async (&rest args)
"FIXME: Docstring."
- (apply #'http-lib--request args))
+ (apply #'plz--request args))
-(cl-defun http-lib-request-sync (&rest args)
+(cl-defun plz-request-sync (&rest args)
"FIXME: Docstring."
- (apply #'http-lib--request :sync t args))
+ (apply #'plz--request :sync t args))
-(cl-defun http-lib--request (_method url &key headers _connect-timeout sync
+(cl-defun plz--request (_method url &key headers _connect-timeout sync
success error)
"FIXME: Docstring."
;; Inspired by and copied from `elfeed-curl-retrieve'.
@@ -181,34 +181,34 @@
(process-connection-type nil)
(header-args (cl-loop for (key . value) in headers
collect (format "--header %s: %s" key value)))
- (curl-args (append http-lib-curl-default-args header-args
+ (curl-args (append plz-curl-default-args header-args
(list url))))
(if sync
- (http-lib-request--sync curl-args :success success :error error)
- (http-lib-request--async curl-args :success success :error error))))
+ (plz-request--sync curl-args :success success :error error)
+ (plz-request--async curl-args :success success :error error))))
-(cl-defun http-lib-request--async (curl-args &key success error)
+(cl-defun plz-request--async (curl-args &key success error)
"FIXME: Docstring."
- (with-current-buffer (generate-new-buffer "*http-lib-request-curl*")
- (let ((process (make-process :name "http-lib-request-curl"
+ (with-current-buffer (generate-new-buffer "*plz-request-curl*")
+ (let ((process (make-process :name "plz-request-curl"
:buffer (current-buffer)
- :command (append (list http-lib-curl-program)
curl-args)
+ :command (append (list plz-curl-program)
curl-args)
:connection-type 'pipe
- :sentinel #'http-lib--sentinel
+ :sentinel #'plz--sentinel
:stderr (current-buffer))))
- (setf http-lib-success success
- http-lib-error error)
+ (setf plz-success success
+ plz-error error)
process)))
-(cl-defun http-lib-request--sync (curl-args &key success error)
+(cl-defun plz-request--sync (curl-args &key success error)
"FIXME: Docstring."
- (with-current-buffer (generate-new-buffer "*http-lib-request-curl*")
- (let ((status (apply #'call-process http-lib-curl-program nil t nil
+ (with-current-buffer (generate-new-buffer "*plz-request-curl*")
+ (let ((status (apply #'call-process plz-curl-program nil t nil
curl-args))
- (http-lib-success #'identity))
- (http-lib--sentinel (current-buffer) status))))
+ (plz-success #'identity))
+ (plz--sentinel (current-buffer) status))))
-(defun http-lib--sentinel (process-or-buffer status)
+(defun plz--sentinel (process-or-buffer status)
"FIXME: Docstring."
;; Inspired by and some code copied from `elfeed-curl--sentinel'.
(let ((buffer (cl-etypecase process-or-buffer
@@ -219,20 +219,20 @@
(pcase status
((or 0 "finished\n")
;; Request completed successfully: call success callback with
parsed response.
- (let ((response (http-lib--parse-response buffer)))
- (funcall http-lib-success response)))
+ (let ((response (plz--parse-response buffer)))
+ (funcall plz-success response)))
((rx "exited abnormally with code " (group (1+ digit)))
;; Error: call error callback.
;; FIXME: Call with an error struct.
- (warn "http-lib--sentinel: ERROR: %s" (buffer-string))
+ (warn "plz--sentinel: ERROR: %s" (buffer-string))
;; (let* ((code (string-to-number (match-string 1 status)))
- ;; (message (alist-get code http-lib-curl-errors)))
- ;; (funcall http-lib-error (http-lib--parse-response buffer)))
+ ;; (message (alist-get code plz-curl-errors)))
+ ;; (funcall plz-error (plz--parse-response buffer)))
)))
(kill-buffer buffer))))
-(defun http-lib--parse-response (buffer)
+(defun plz--parse-response (buffer)
"FIXME: Docstring."
(with-current-buffer buffer
(save-excursion
@@ -242,18 +242,18 @@
(group (1+ digit))))
(let* ((http-version (string-to-number (match-string 1)))
(status-code (string-to-number (match-string 2)))
- (headers (http-lib--headers buffer))
+ (headers (plz--headers buffer))
(coding-system (or (when-let* ((it (alist-get "Content-Type"
headers nil nil #'string=)))
(coding-system-from-name it))
'utf-8))
- (body (http-lib--decode-body buffer coding-system)))
- (make-http-lib-response
+ (body (plz--decode-body buffer coding-system)))
+ (make-plz-response
:version http-version
:status status-code
:headers headers
:body body)))))
-(defun http-lib--headers (buffer)
+(defun plz--headers (buffer)
"FIXME: Docstring."
(with-current-buffer buffer
(save-excursion
@@ -267,7 +267,7 @@
limit t)
collect (cons (match-string 1) (match-string 2)))))))
-(defun http-lib--decode-body (buffer coding-system)
+(defun plz--decode-body (buffer coding-system)
"FIXME: Docstring."
(with-current-buffer buffer
(save-excursion
@@ -279,6 +279,6 @@
;;;; Footer
-(provide 'http-lib)
+(provide 'plz)
-;;; http-lib.el ends here
+;;; plz.el ends here
diff --git a/test/test-http-lib.el b/test/test-plz.el
similarity index 78%
rename from test/test-http-lib.el
rename to test/test-plz.el
index d8d780df02..e63932b66b 100644
--- a/test/test-http-lib.el
+++ b/test/test-plz.el
@@ -1,4 +1,4 @@
-;;; test-http-lib.el --- Tests for http-lib -*- lexical-binding: t;
-*-
+;;; test-plz.el --- Tests for plz -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Adam Porter
@@ -41,11 +41,11 @@
;;;; Tests
-(ert-deftest http-lib-get-sync nil
- (http-lib-response-p (http-lib-get "https://httpbin.org/get" :sync t)))
+(ert-deftest plz-get-sync nil
+ (plz-response-p (plz-get "https://httpbin.org/get" :sync t)))
;;;; Footer
-(provide 'test-http-lib)
+(provide 'test-plz)
-;;; test-http-lib.el ends here
+;;; test-plz.el ends here
- [elpa] branch externals/plz created (now 9156de9c59), ELPA Syncer, 2022/05/11
- [elpa] externals/plz e7d9513bb9 03/81: Rename,
ELPA Syncer <=
- [elpa] externals/plz c7c16e2123 04/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz debfc864c8 08/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz f0a0d114a6 01/81: Initial commit, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 2d20ca5030 02/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 5f54b5ebec 06/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 1016279174 07/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 897c5bbfb2 13/81: Improvements, error handling, ELPA Syncer, 2022/05/11
- [elpa] externals/plz e14ea7327d 14/81: Tidying, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 2b7944e0f9 05/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 950a5498cb 16/81: Tidy, ELPA Syncer, 2022/05/11