[elpa] externals/tmr 4d8c70530c 1/7: tmr-cancel: Fix

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 4d8c70530ce87a3bf76d2d4e383628abdc6d8e99
Author: Damien Cassou 
Commit: Protesilaos Stavrou 

tmr-cancel: Fix

The code was broken after commit 2fc61f9 which was merged by mistake:

2fc61f95950b564cb3ceefe57f1fec339adc2969
Author:   Damien Cassou 
AuthorDate:   Sat May 7 22:39:20 2022 +0200
Commit:   Protesilaos Stavrou 
CommitDate:   Sun May 8 06:48:45 2022 +0300

WIP: Create tabulated-list view + use a struct for tmr--timers
---
 tmr.el | 49 +++--
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/tmr.el b/tmr.el
index d7853c163f..929c6aa8fd 100644
--- a/tmr.el
+++ b/tmr.el
@@ -259,29 +259,34 @@ Read: (info \"(elisp) Desktop Notifications\") for 
details."
   "List of timer objects.
 Populated by `tmr' and then operated on by `tmr-cancel'.")
 
-;; FIXME 2022-05-08: Need to be refactored per commit 2fc61f9.
+(defun tmr--get-timer-by-creation-date (creation-date)
+  "Return the timer which was started at CREATION-DATE."
+  (cl-find creation-date tmr--timers :key #'tmr--timer-creation-date))
+
 ;;;###autoload
-(defun tmr-cancel ()
-  "Cancel timer object set with `tmr' command.
-If there is a single timer, cancel it outright.  If there are
-multiple timers, prompt for one with completion."
-  (interactive)
-  (if-let ((timers tmr--timers))
-  (cond
-   ((= (length timers) 1)
-(let ((cell (car timers)))
-  (cancel-timer (cdr cell))
-  (tmr--log-in-buffer (format "CANCELLED <<%s>>" (car cell)))
-  (setq tmr--timers nil)))
-   ((> (length timers) 1)
-(let* ((selection (completing-read "Cancel timer: " (mapc #'car 
timers) nil t))
-   (cell (assoc selection timers #'string-match-p))
-   (key (car cell))
-   (object (cdr cell)))
-  (cancel-timer object)
-  (tmr--log-in-buffer (format "CANCELLED <<%s>>" key))
-  (setq tmr--timers (delete cell tmr--timers)
-(user-error "No `tmr' to cancel")))
+(defun tmr-cancel (timer)
+  "Cancel TIMER object set with `tmr' command.
+Interactively, let the user choose which timer to cancel with
+completion."
+  (interactive (list (tmr--read-timer)))
+  (if (not timer)
+  (user-error "No `tmr' to cancel")
+(cancel-timer (tmr--timer-timer-object timer))
+(tmr--log-in-buffer (format "CANCELLED <<%s>>" (tmr--long-description 
timer)))
+(setq tmr--timers (cl-delete timer tmr--timers
+
+(defun tmr--read-timer ()
+  "Let the user choose a timer among all timers. Return the selected timer.
+If there is a single timer, use that.  If there are multiple
+timers, prompt for one with completion. If there are no timers,
+return nil."
+  (cond
+   ((= (length tmr--timers) 1)
+(car timers))
+   ((> (length tmr--timers) 1)
+(let* ((timer-descriptions (mapcar #'tmr--long-description tmr--timers))
+   (selection (completing-read "Timer: " timer-descriptions nil t)))
+  (cl-find selection tmr--timers :test #'string= :key 
#'tmr--long-description)
 
 (defun tmr--echo-area (time &optional description)
   "Produce `message' for current `tmr' TIME.



[elpa] externals/tmr b240741a14 4/7: Add Damien Cassou as author

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit b240741a142f99157aea8e7cf14f9fa740dbd26c
Author: Damien Cassou 
Commit: Protesilaos Stavrou 

Add Damien Cassou as author
---
 tmr.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tmr.el b/tmr.el
index 929c6aa8fd..a4fc60512a 100644
--- a/tmr.el
+++ b/tmr.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2020-2022  Free Software Foundation, Inc.
 
 ;; Author: Protesilaos Stavrou 
+;; Damien Cassou ,
 ;; URL: https://git.sr.ht/~protesilaos/tmr
 ;; Mailing list: https://lists.sr.ht/~protesilaos/tmr
 ;; Version: 0.2.3



[elpa] externals/tmr 15089d145e 2/7: tmr-tabulated: Add documentation to the Commentary section

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 15089d145ebdc84239b8646ef4730f65d8608439
Author: Damien Cassou 
Commit: Protesilaos Stavrou 

tmr-tabulated: Add documentation to the Commentary section
---
 tmr-tabulated.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index c81f3c63cb..8422644024 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -22,7 +22,10 @@
 
 ;;; Commentary:
 ;;
-;; TODO
+;; Call `M-x tmr-tabulated-view' to display all tmr timers in a grid,
+;; one by line with sortable columns.  Columns show the creation date,
+;; the end date, a check mark if the timer is finished and the timer's
+;; optional description.
 
 ;;; Code:
 



[elpa] externals/tmr updated (4bf30baacb -> d8071f7476)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/tmr.

  from  4bf30baacb Add FIXME for tmr-cancel
   new  4d8c70530c tmr-cancel: Fix
   new  15089d145e tmr-tabulated: Add documentation to the Commentary 
section
   new  41c44c2154 tmr-tabulated: Bind "k" to the new tmr-tabulated-cancel 
command
   new  b240741a14 Add Damien Cassou as author
   new  90526a0310 Fix placement of comma for Authors
   new  81aa6ce65c Use forward-line instead of {next,previous}-line
   new  d8071f7476 Use let bound variable in tmr--read-timer


Summary of changes:
 tmr-tabulated.el | 43 ++-
 tmr.el   | 53 ++---
 2 files changed, 72 insertions(+), 24 deletions(-)



[elpa] externals/tmr d8071f7476 7/7: Use let bound variable in tmr--read-timer

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit d8071f74761c6b9b30f55f5598b89a4b2f4ec47d
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Use let bound variable in tmr--read-timer
---
 tmr.el | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tmr.el b/tmr.el
index 1296d08290..39b8705af2 100644
--- a/tmr.el
+++ b/tmr.el
@@ -277,17 +277,18 @@ completion."
 (setq tmr--timers (cl-delete timer tmr--timers
 
 (defun tmr--read-timer ()
-  "Let the user choose a timer among all timers. Return the selected timer.
-If there is a single timer, use that.  If there are multiple
-timers, prompt for one with completion. If there are no timers,
-return nil."
-  (cond
-   ((= (length tmr--timers) 1)
-(car timers))
-   ((> (length tmr--timers) 1)
-(let* ((timer-descriptions (mapcar #'tmr--long-description tmr--timers))
-   (selection (completing-read "Timer: " timer-descriptions nil t)))
-  (cl-find selection tmr--timers :test #'string= :key 
#'tmr--long-description)
+  "Let the user choose a timer among all timers.
+Return the selected timer.  If there is a single timer, use that.
+If there are multiple timers, prompt for one with completion.  If
+there are no timers, return nil."
+  (let ((timers tmr--timers))
+(cond
+ ((= (length timers) 1)
+  (car timers))
+ ((> (length timers) 1)
+  (let* ((timer-descriptions (mapcar #'tmr--long-description timers))
+ (selection (completing-read "Timer: " timer-descriptions nil t)))
+(cl-find selection timers :test #'string= :key 
#'tmr--long-description))
 
 (defun tmr--echo-area (time &optional description)
   "Produce `message' for current `tmr' TIME.



[elpa] externals/tmr 81aa6ce65c 6/7: Use forward-line instead of {next, previous}-line

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 81aa6ce65cbc3f47a5a69c280f45088c9dd79730
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Use forward-line instead of {next,previous}-line

This is done to placate the compiler.  The other functions are meant for
interactive use.
---
 tmr-tabulated.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index ca1f8e4066..51f6da2c89 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -82,16 +82,16 @@ Interactively, use the timer at point."
   "Move the point to the next entry if there is one or to the previous one.
 Point isn't moved if point is on the only entry."
   (if (tmr-tabulated--next-entry)
-  (next-line)
+  (forward-line 1)
 (when (tmr-tabulated--previous-entry)
-  (previous-line
+  (forward-line -1
 
 (defun tmr-tabulated--previous-entry ()
   "Return the entry on the line before point, nil if none."
   (save-excursion
 (setf (point) (line-beginning-position))
 (unless (bobp)
-  (previous-line)
+  (forward-line -1)
   (tabulated-list-get-id
 
 (defun tmr-tabulated--next-entry ()
@@ -99,7 +99,7 @@ Point isn't moved if point is on the only entry."
   (save-excursion
 (setf (point) (line-end-position))
 (unless (eobp)
-  (next-line)
+  (forward-line 1)
   (tabulated-list-get-id
 
 (defun tmr-tabulated--get-timer-at-point ()



[elpa] externals/tmr 90526a0310 5/7: Fix placement of comma for Authors

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 90526a0310a759dd86d965ca70ba706e350f205c
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Fix placement of comma for Authors
---
 tmr.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tmr.el b/tmr.el
index a4fc60512a..1296d08290 100644
--- a/tmr.el
+++ b/tmr.el
@@ -2,8 +2,8 @@
 
 ;; Copyright (C) 2020-2022  Free Software Foundation, Inc.
 
-;; Author: Protesilaos Stavrou 
-;; Damien Cassou ,
+;; Author: Protesilaos Stavrou ,
+;; Damien Cassou 
 ;; URL: https://git.sr.ht/~protesilaos/tmr
 ;; Mailing list: https://lists.sr.ht/~protesilaos/tmr
 ;; Version: 0.2.3



[elpa] externals/tmr 41c44c2154 3/7: tmr-tabulated: Bind "k" to the new tmr-tabulated-cancel command

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 41c44c2154c8f493d1de272b36611c890ef399ad
Author: Damien Cassou 
Commit: Protesilaos Stavrou 

tmr-tabulated: Bind "k" to the new tmr-tabulated-cancel command
---
 tmr-tabulated.el | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index 8422644024..ca1f8e4066 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -55,6 +55,7 @@
 
 (defvar tmr-tabulated-mode-map
   (let ((map (make-sparse-keymap)))
+(define-key map "k" #'tmr-tabulated-cancel)
 map)
   "Keybindings for `tmr-tabulated-mode-map'.")
 
@@ -68,5 +69,42 @@
   (add-hook 'tabulated-list-revert-hook #'tmr-tabulated--set-entries)
   (tabulated-list-init-header))
 
+(defun tmr-tabulated-cancel (timer)
+  "Stop TIMER and remove it from the list.
+Interactively, use the timer at point."
+  (interactive (list (tmr-tabulated--get-timer-at-point)))
+  (tmr-cancel timer)
+  ;; avoid point moving back to the beginning of the buffer:
+  (tmr-tabulated--move-point-to-closest-entry)
+  (revert-buffer))
+
+(defun tmr-tabulated--move-point-to-closest-entry ()
+  "Move the point to the next entry if there is one or to the previous one.
+Point isn't moved if point is on the only entry."
+  (if (tmr-tabulated--next-entry)
+  (next-line)
+(when (tmr-tabulated--previous-entry)
+  (previous-line
+
+(defun tmr-tabulated--previous-entry ()
+  "Return the entry on the line before point, nil if none."
+  (save-excursion
+(setf (point) (line-beginning-position))
+(unless (bobp)
+  (previous-line)
+  (tabulated-list-get-id
+
+(defun tmr-tabulated--next-entry ()
+  "Return the entry on the line after point, nil if none."
+  (save-excursion
+(setf (point) (line-end-position))
+(unless (eobp)
+  (next-line)
+  (tabulated-list-get-id
+
+(defun tmr-tabulated--get-timer-at-point ()
+  "Return the timer on the current line or nil."
+  (tmr--get-timer-by-creation-date (tabulated-list-get-id)))
+
 (provide 'tmr-tabulated)
 ;;; tmr-tabulated.el ends here



[elpa] externals/tmr 15c3e4035b 3/3: Add Damien Cassou to authors in the manual

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 15c3e4035b37bb2de2d346c9fe953f78c14cc615
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Add Damien Cassou to authors in the manual
---
 README.org | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index ee517c3777..51e028a482 100644
--- a/README.org
+++ b/README.org
@@ -233,11 +233,13 @@ Everything is in place to set up the package.
 
 TMR is meant to be a collective effort.  Every bit of help matters.
 
-+ Author/maintainer :: Protesilaos Stavrou.
++ Authors :: Damien Cassou, Protesilaos Stavrou.
 
 + Contributions to the code or manual :: Christian Tietze, Damien
   Cassou.
 
++ Maintainer :: Protesilaos Stavrou.
+
 * GNU Free Documentation License
 :PROPERTIES:
 :CUSTOM_ID: h:b8b7def2-5ab0-4623-b3ef-2a1bd17bb42a



[elpa] externals/tmr 7be6aa97c3 1/3: Make tabulated hook local

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 7be6aa97c32003fbbc29a7234524ab5b1e817aad
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Make tabulated hook local

Otherwise it affects other packages.
---
 tmr-tabulated.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index 51f6da2c89..e75fe9cb9e 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -66,7 +66,7 @@
("End" 10 t)
("Finished?" 10 t)
("Description" 0 t)])
-  (add-hook 'tabulated-list-revert-hook #'tmr-tabulated--set-entries)
+  (add-hook 'tabulated-list-revert-hook #'tmr-tabulated--set-entries nil t)
   (tabulated-list-init-header))
 
 (defun tmr-tabulated-cancel (timer)



[elpa] externals/tmr updated (d8071f7476 -> 15c3e4035b)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/tmr.

  from  d8071f7476 Use let bound variable in tmr--read-timer
   new  7be6aa97c3 Make tabulated hook local
   new  2938857a93 Update docs, especially for tmr-tabulated-view
   new  15c3e4035b Add Damien Cassou to authors in the manual


Summary of changes:
 README.org   | 68 +++-
 tmr-tabulated.el |  2 +-
 tmr.el   | 44 +++-
 3 files changed, 86 insertions(+), 28 deletions(-)



[elpa] externals/tmr 2938857a93 2/3: Update docs, especially for tmr-tabulated-view

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 2938857a93b2f032a91674c159848aa90c959b0c
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Update docs, especially for tmr-tabulated-view

Thanks again to Damien Cassou for all the contributions thus far.
---
 README.org | 64 +++---
 tmr.el | 44 +++---
 2 files changed, 82 insertions(+), 26 deletions(-)

diff --git a/README.org b/README.org
index 13918f4fff..ee517c3777 100644
--- a/README.org
+++ b/README.org
@@ -24,8 +24,8 @@
 #+texinfo_header: @set MAINTAINERCONTACT 
@uref{mailto:i...@protesilaos.com,contact the maintainer}
 
 This manual, written by Protesilaos Stavrou, describes the customization
-options for =tmr= (or =tmr.el=, tmr, TMR, ...), and provides every other
-piece of information pertinent to it.
+options for =tmr= (or =tmr.el=, tmr, TMR, TMR May Ring, ...), and
+provides every other piece of information pertinent to it.
 
 The documentation furnished herein corresponds to stable version
 {{{stable-version}}}, released on {{{release-date}}}.  Any reference to
@@ -38,6 +38,9 @@ Current development target is {{{development-version}}}.
 + Git repository: https://git.sr.ht/~protesilaos/tmr.
 + Mailing list: https://lists.sr.ht/~protesilaos/tmr.
 
+TMR has benefited from major contributions by Damien Cassou, to whom I
+am most thankful.
+
 #+toc: headlines 8 insert TOC here, with eight headline levels
 
 * COPYING
@@ -67,10 +70,10 @@ modify this GNU manual.”
 
 #+findex: tmr
 TMR is an Emacs package that provides facilities for setting timers
-using a convenient notation.  The point of entry is the ~tmr~ command.
-It prompts for a unit of time, which is represented as a string that
-consists of a number and, optionally, a single character suffix which
-specifies the unit of time.  Valid input formats:
+using a convenient notation.  The first point of entry is the ~tmr~
+command.  It prompts for a unit of time, which is represented as a
+string that consists of a number and, optionally, a single character
+suffix which specifies the unit of time.  Valid input formats:
 
 | Input | Meaning   |
 |---+---|
@@ -113,11 +116,40 @@ be played.
 
 #+findex: tmr-cancel
 The ~tmr-cancel~ command is used to cancel running timers (as set by the
-~tmr~ command).  If there is only one timer, it cancels it outright.  If
-there are multiple timers, it produces a minibuffer completion prompt
-which asks for one among them.  Timers at the completion prompt are
-described by the exact time they were set and the input that was used to
-create them, including the optional description that ~tmr~ accepts.
+~tmr~ or ~tmr-with-description~ commands).  If there is only one timer,
+it cancels it outright.  If there are multiple timers, it produces a
+minibuffer completion prompt which asks for one among them.  Timers at
+the completion prompt are described by the exact time they were set and
+the input that was used to create them, including the optional
+description that ~tmr~ and ~tmr-with-description~ accept.
+
+[ The following information about the grid view is part of
+  {{{development-version}}} ]
+
+#+findex: tmr-tabulated-view
+Active timers can be viewed in a grid with ~tmr-tabulated-view~ (part of
+the =tmr-tabulated.el= file, whose main author is Damien Cassou).  The
+grid is placed in the =*tmr-tabulated-view*= buffer and looks like this:
+
+#+begin_example
+Start  EndFinished?  Description
+12:26:50   12:51:50   ✔ Update tmr manual
+12:26:35   12:56:35  Bake bread
+12:26:26   12:36:26  Prepare tea
+#+end_example
+
+If a timer has elapsed, it has a check mark, otherwise the =Finished?=
+column is empty.  A =Description= is shown only if it is provided while
+setting the timer, otherwise the field is left blank.
+
+The ~tmr-tabulated-view~ command relies on Emacs' ~tabulated-list-mode~.
+From the =*tmr-tabulated-view*= buffer, invoke the command
+~describe-mode~ to learn about the applicable key bindings, such as how
+to expand/contract columns and toggle their sort.
+
+#+findex: tmr-tabulated-cancel
+While in this grid view, the =k= key runs the ~tmr-tabulated-cancel~
+command.  It immediately cancels the timer at point.
 
 * Installation
 :PROPERTIES:
@@ -181,14 +213,16 @@ Everything is in place to set up the package.
 (setq tmr-sound-file
   "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga")
 
+(setq tmr-notification-urgency 'normal)
+(setq tmr-descriptions-list (list "Boil water" "Prepare tea" "Bake bread"))
+
 ;; OPTIONALLY set global key bindings:
 (let ((map global-map))
-  (define-key map (kbd "C-c t t") #'tmr) ; or use the command 
`tmr-with-description'
+  (define-key map (kbd "C-c t t") #'tmr)
+  (define-key map (kbd "C-c t T") #'tmr-with-description)
   (define-key map (kbd "C-c t e") #'tmr-view-echo-area-messages) ; "e" to 
remind of C-h e
+  (define-key map (kbd "C-c t l") #'tmr-tabula

[elpa] externals/osm 7d79bb9ba5: Inline functions. For some reason this seemingly reduces allocations.

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit 7d79bb9ba5aaeba094829e967d5d6b316509de83
Author: Daniel Mendler 
Commit: Daniel Mendler 

Inline functions. For some reason this seemingly reduces allocations.

Who knows why? These functions should be non-allocating...
---
 osm.el | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/osm.el b/osm.el
index d655fbf328..08559316d8 100644
--- a/osm.el
+++ b/osm.el
@@ -403,6 +403,15 @@ Should be at least 7 days according to the server usage 
policies."
  menu)))
 (nreverse menu)))
 
+(defsubst osm--lon-to-normalized-x (lon)
+  "Convert LON to normalized x coordinate."
+  (/ (+ lon 180.0) 360.0))
+
+(defsubst osm--lat-to-normalized-y (lat)
+  "Convert LAT to normalized y coordinate."
+  (setq lat (* lat (/ float-pi 180.0)))
+  (- 0.5 (/ (log (+ (tan lat) (/ 1.0 (cos lat float-pi 2)))
+
 (defun osm--boundingbox-to-zoom (lat1 lat2 lon1 lon2)
   "Compute zoom level from boundingbox LAT1 to LAT2 and LON1 to LON2."
   (let ((w (/ (frame-pixel-width) 256))
@@ -413,15 +422,6 @@ Should be at least 7 days according to the server usage 
policies."
   (min (logb (/ w (abs (- (osm--lon-to-normalized-x lon1) 
(osm--lon-to-normalized-x lon2)
(logb (/ h (abs (- (osm--lat-to-normalized-y lat1) 
(osm--lat-to-normalized-y lat2))
 
-(defun osm--lon-to-normalized-x (lon)
-  "Convert LON to normalized x coordinate."
-  (/ (+ lon 180.0) 360.0))
-
-(defun osm--lat-to-normalized-y (lat)
-  "Convert LAT to normalized y coordinate."
-  (setq lat (* lat (/ float-pi 180.0)))
-  (- 0.5 (/ (log (+ (tan lat) (/ 1 (cos lat float-pi 2)))
-
 (defun osm--x-to-lon (x zoom)
   "Return longitude in degrees for X/ZOOM."
   (- (/ (* x 360.0) 256.0 (expt 2.0 zoom)) 180.0))



[elpa] externals/osm 8d461109ed 2/2: Revert "Save a few bits here and there"

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit 8d461109ed1ad77111dd267584da8379d244197a
Author: Daniel Mendler 
Commit: Daniel Mendler 

Revert "Save a few bits here and there"

The byte code compiler should optimize that for me, I think?
---
 osm.el | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/osm.el b/osm.el
index 1ee09d3162..08559316d8 100644
--- a/osm.el
+++ b/osm.el
@@ -1067,22 +1067,24 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
  (concat
   (format #(" %7.2f°" 0 6 (face bold)) osm--lat)
   (format #(" %7.2f°" 0 6 (face bold)) osm--lon)
-  #(" " 0 1 (display (space :align-to (- center 10
+  (propertize " " 'display '(space :align-to (- center 10)))
   (format "%3s " (if (>= meter 1000) (/ meter 1000) meter))
   (if (>= meter 1000) "km " "m ")
-  #(" " 0 1 (display (space :width (3)) face (:inverse-video t)))
+  (propertize " " 'face '(:inverse-video t)
+  'display '(space :width (3)))
   (propertize " " 'face '(:strike-through t)
   'display `(space :width (,(floor (/ meter 
meter-per-pixel)
-  #(" " 0 1 (display (space :width (3)) face (:inverse-video t)))
+  (propertize " " 'face '(:inverse-video t)
+  'display '(space :width (3)))
   (propertize " " 'display `(space :align-to
(- right ,(+ 5 3 3 2 (length server) 3) 
(,(+ 4 1 4 1 4 1 4)
   (format " Z%-2d " osm--zoom)
   (osm--header-button " + " #'osm-zoom-in)
-  #(" " 0 1 (display (space :width (1
+  (propertize " " 'display '(space :width (1)))
   (osm--header-button " - " #'osm-zoom-out)
-  #(" " 0 1 (display (space :width (1
+  (propertize " " 'display '(space :width (1)))
   (osm--header-button (format " %s " server) #'osm--server-menu)
-  #(" " 0 1 (display (space :width (1
+  (propertize " " 'display '(space :width (1)))
   (osm--header-button " ☰ " osm--menu)
 
 (defun osm--update ()
@@ -1139,7 +1141,9 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
 (if (listp copyright)
 (string-join copyright " | ")
   copyright)
-#(" " 0 1 (display (space :align-to right))
+(propertize " "
+'display
+'(space :align-to right)
   (add-face-text-property
0 (length copyright)
'(:inherit (header-line variable-pitch) :height 0.75)



[elpa] externals/osm updated (7d79bb9ba5 -> 8d461109ed)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/osm.

  from  7d79bb9ba5 Inline functions. For some reason this seemingly reduces 
allocations.
   new  e049d3db6a Save a few bits here and there
   new  8d461109ed Revert "Save a few bits here and there"


Summary of changes:



[elpa] externals/osm e049d3db6a 1/2: Save a few bits here and there

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit e049d3db6a0a334df5181c572f57bf8ad38d104d
Author: Daniel Mendler 
Commit: Daniel Mendler 

Save a few bits here and there
---
 osm.el | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/osm.el b/osm.el
index 08559316d8..1ee09d3162 100644
--- a/osm.el
+++ b/osm.el
@@ -1067,24 +1067,22 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
  (concat
   (format #(" %7.2f°" 0 6 (face bold)) osm--lat)
   (format #(" %7.2f°" 0 6 (face bold)) osm--lon)
-  (propertize " " 'display '(space :align-to (- center 10)))
+  #(" " 0 1 (display (space :align-to (- center 10
   (format "%3s " (if (>= meter 1000) (/ meter 1000) meter))
   (if (>= meter 1000) "km " "m ")
-  (propertize " " 'face '(:inverse-video t)
-  'display '(space :width (3)))
+  #(" " 0 1 (display (space :width (3)) face (:inverse-video t)))
   (propertize " " 'face '(:strike-through t)
   'display `(space :width (,(floor (/ meter 
meter-per-pixel)
-  (propertize " " 'face '(:inverse-video t)
-  'display '(space :width (3)))
+  #(" " 0 1 (display (space :width (3)) face (:inverse-video t)))
   (propertize " " 'display `(space :align-to
(- right ,(+ 5 3 3 2 (length server) 3) 
(,(+ 4 1 4 1 4 1 4)
   (format " Z%-2d " osm--zoom)
   (osm--header-button " + " #'osm-zoom-in)
-  (propertize " " 'display '(space :width (1)))
+  #(" " 0 1 (display (space :width (1
   (osm--header-button " - " #'osm-zoom-out)
-  (propertize " " 'display '(space :width (1)))
+  #(" " 0 1 (display (space :width (1
   (osm--header-button (format " %s " server) #'osm--server-menu)
-  (propertize " " 'display '(space :width (1)))
+  #(" " 0 1 (display (space :width (1
   (osm--header-button " ☰ " osm--menu)
 
 (defun osm--update ()
@@ -1141,9 +1139,7 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
 (if (listp copyright)
 (string-join copyright " | ")
   copyright)
-(propertize " "
-'display
-'(space :align-to right)
+#(" " 0 1 (display (space :align-to right))
   (add-face-text-property
0 (length copyright)
'(:inherit (header-line variable-pitch) :height 0.75)



[elpa] externals/pyim ce1ee215f7: * pyim-cloudim.el (pyim-cloudim:baidu, pyim-cloudim:google): Handle buffer is nil.

2022-05-11 Thread ELPA Syncer
branch: externals/pyim
commit ce1ee215f7e9e41d2cdd3f353700e97940e07031
Author: Feng Shu 
Commit: Feng Shu 

* pyim-cloudim.el (pyim-cloudim:baidu, pyim-cloudim:google): Handle buffer 
is nil.
---
 pyim-cloudim.el | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/pyim-cloudim.el b/pyim-cloudim.el
index 32af111b98..3e8a7b1358 100644
--- a/pyim-cloudim.el
+++ b/pyim-cloudim.el
@@ -55,10 +55,12 @@
 (defun pyim-cloudim:baidu (string scheme-name)
   "使用 baidu 云输入法引擎搜索 STRING, 获取词条列表。"
   (when (equal scheme-name 'quanpin)
-(with-current-buffer (pyim-cloudim-url-retrieve-sync
-  (format "https://olime.baidu.com/py?py=%s"; string)
-  t nil 0.1)
-  (pyim-cloudim-parse-baidu-buffer
+(let ((buffer (pyim-cloudim-url-retrieve-sync
+   (format "https://olime.baidu.com/py?py=%s"; string)
+   t nil 0.2)))
+  (when (bufferp buffer)
+(with-current-buffer buffer
+  (pyim-cloudim-parse-baidu-buffer))
 
 (defun pyim-cloudim-url-retrieve-sync (url &optional silent inhibit-cookies 
timeout)
   "Pyim 版本的 `url-retrieve-synchronously'.
@@ -134,10 +136,12 @@
 (defun pyim-cloudim:google (string scheme-name)
   "使用 google 云输入法引擎搜索 STRING, 获取词条列表。"
   (when (eq scheme-name 'quanpin)
-(with-current-buffer (pyim-cloudim-url-retrieve-sync
-  (format 
"https://www.google.cn/inputtools/request?ime=pinyin&text=%s"; string)
-  t nil 0.1)
-  (pyim-cloudim-parse-google-buffer
+(let ((buffer (pyim-cloudim-url-retrieve-sync
+   (format 
"https://www.google.cn/inputtools/request?ime=pinyin&text=%s"; string)
+   t nil 0.2)))
+  (when (bufferp buffer)
+(with-current-buffer buffer
+  (pyim-cloudim-parse-google-buffer))
 
 (defun pyim-cloudim-parse-google-buffer ()
   "解析 `pyim-cloudim-url-retrieve-sync' 返回的 google buffer."



[elpa] externals/engrave-faces d6bc222841: LaTeX: allow for tex/latex only maths comments

2022-05-11 Thread ELPA Syncer
branch: externals/engrave-faces
commit d6bc2228418941b9bee525cf588714569f6edb5d
Author: TEC 
Commit: TEC 

LaTeX: allow for tex/latex only maths comments
---
 engrave-faces-latex.el | 28 ++--
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/engrave-faces-latex.el b/engrave-faces-latex.el
index d2465e8e45..4d209356b1 100644
--- a/engrave-faces-latex.el
+++ b/engrave-faces-latex.el
@@ -22,10 +22,22 @@ When preset, short commands are generated for 
`engrave-faces-preset-styles'."
   :group 'engrave-faces)
 
 (defcustom engrave-faces-latex-mathescape nil
-  "Whether $ characters in comments should be allowed.
-This is intended to be used with fvextra's mathescape option, and
-only applies to text set with `font-lock-comment-face' including
-at least two $s."
+  "Whether maths characters in comments should be allowed.
+
+When nil, all potential maths (both \"$tex$\" and
+\"\\(latex\\)\") is protected by
+`engrave-faces-latex--protect-content'. Three non-nil symbols are
+supported:
+- latex, in which case the content of LaTeX maths is left unprotected
+- tex, in which case the content of TeX dollar-delimited maths is left
+  unprotected
+- t, in which case LaTeX and TeX maths are supported
+
+This only affects text set with `font-lock-comment-face'.
+
+For TeX maths to be supported, fvextra's mathescape option must
+also be applied. This is done automatically when generating a
+standalone document."
   :type 'boolean
   :group 'engrave-faces)
 
@@ -105,8 +117,12 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-latex-output-style'."
nil t))
 
 (defun engrave-faces-latex--protect-content-mathescape (content)
-  (let ((dollar-maths (string-match-p "\\$.+\\$" content))
-(paren-maths (string-match-p "(.+)" content)))
+  (let ((dollar-maths
+ (and (memq engrave-faces-latex-mathescape '(t tex TeX))
+  (string-match-p "\\$.+\\$" content)))
+(paren-maths
+ (and (memq engrave-faces-latex-mathescape '(t latex LaTeX))
+  (string-match-p "(.+)" content
 (replace-regexp-in-string
  (cond
   (dollar-maths "^\\([^$]*\\)\\(\\$.+\\$\\)\\([^$]*\\)$")



[elpa] externals/javaimp 0d5979510f: Set imenu-space-replacement to nil locally

2022-05-11 Thread Filipp Gunbin
branch: externals/javaimp
commit 0d5979510f7e36ad52d41d60c08219aad53eefd1
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

Set imenu-space-replacement to nil locally
---
 javaimp.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/javaimp.el b/javaimp.el
index b4056da158..c68729864f 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -1195,7 +1195,8 @@ using Javaimp facilities.
   #'javaimp-end-of-defun)
 (add-function :override (local 'add-log-current-defun-function)
   #'javaimp-add-log-current-defun)
-(add-hook 'xref-backend-functions #'javaimp-xref--backend nil t))
+(add-hook 'xref-backend-functions #'javaimp-xref--backend nil t)
+(setq-local imenu-space-replacement nil))
 (remove-function (local 'imenu-create-index-function)
  #'javaimp-imenu-create-index)
 (remove-function (local 'beginning-of-defun-function)
@@ -1204,7 +1205,8 @@ using Javaimp facilities.
  #'javaimp-end-of-defun)
 (remove-function (local 'add-log-current-defun-function)
  #'javaimp-add-log-current-defun)
-(remove-hook 'xref-backend-functions #'javaimp-xref--backend t)))
+(remove-hook 'xref-backend-functions #'javaimp-xref--backend t)
+(kill-local-variable 'imenu-space-replacement)))
 
 
 ;;;###autoload



[elpa] externals/tmr updated (15c3e4035b -> bd9b1cd8f3)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/tmr.

  from  15c3e4035b Add Damien Cassou to authors in the manual
   new  4bf7f9d4e7 Don't overdo it with references to co-authors
   new  bcbb9b3eaf tmr.el: add "Maintainer:" library header
   new  bd9b1cd8f3 tmr-tabulated: add library headers


Summary of changes:
 README.org   | 11 +++
 tmr-tabulated.el |  3 +++
 tmr.el   |  5 +++--
 3 files changed, 9 insertions(+), 10 deletions(-)



[elpa] externals/tmr bcbb9b3eaf 2/3: tmr.el: add "Maintainer:" library header

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit bcbb9b3eaf13946c70a6b06190f923710850b65b
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

tmr.el: add "Maintainer:" library header

Because we have two authors, it is better to not confuse users.

For more information about library headers, evaluate:

(info "(elisp) Library Headers")
---
 tmr.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tmr.el b/tmr.el
index 47c4b90494..a29c577e02 100644
--- a/tmr.el
+++ b/tmr.el
@@ -4,6 +4,7 @@
 
 ;; Author: Protesilaos Stavrou ,
 ;; Damien Cassou 
+;; Maintainer: Protesilaos Stavrou 
 ;; URL: https://git.sr.ht/~protesilaos/tmr
 ;; Mailing list: https://lists.sr.ht/~protesilaos/tmr
 ;; Version: 0.2.3



[elpa] externals/tmr 4bf7f9d4e7 1/3: Don't overdo it with references to co-authors

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit 4bf7f9d4e75aed1cd1f31df4c2a43e45db7b5b02
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Don't overdo it with references to co-authors

I got carried away, but Damien was quick to correct me:

.
---
 README.org | 11 +++
 tmr.el |  4 ++--
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index 51e028a482..d1db07b0e7 100644
--- a/README.org
+++ b/README.org
@@ -38,9 +38,6 @@ Current development target is {{{development-version}}}.
 + Git repository: https://git.sr.ht/~protesilaos/tmr.
 + Mailing list: https://lists.sr.ht/~protesilaos/tmr.
 
-TMR has benefited from major contributions by Damien Cassou, to whom I
-am most thankful.
-
 #+toc: headlines 8 insert TOC here, with eight headline levels
 
 * COPYING
@@ -128,8 +125,8 @@ description that ~tmr~ and ~tmr-with-description~ accept.
 
 #+findex: tmr-tabulated-view
 Active timers can be viewed in a grid with ~tmr-tabulated-view~ (part of
-the =tmr-tabulated.el= file, whose main author is Damien Cassou).  The
-grid is placed in the =*tmr-tabulated-view*= buffer and looks like this:
+the =tmr-tabulated.el= file).  The grid is placed in the
+=*tmr-tabulated-view*= buffer and looks like this:
 
 #+begin_example
 Start  EndFinished?  Description
@@ -233,13 +230,11 @@ Everything is in place to set up the package.
 
 TMR is meant to be a collective effort.  Every bit of help matters.
 
-+ Authors :: Damien Cassou, Protesilaos Stavrou.
++ Authors :: Protesilaos Stavrou (maintainer), Damien Cassou.
 
 + Contributions to the code or manual :: Christian Tietze, Damien
   Cassou.
 
-+ Maintainer :: Protesilaos Stavrou.
-
 * GNU Free Documentation License
 :PROPERTIES:
 :CUSTOM_ID: h:b8b7def2-5ab0-4623-b3ef-2a1bd17bb42a
diff --git a/tmr.el b/tmr.el
index f43b791ea0..47c4b90494 100644
--- a/tmr.el
+++ b/tmr.el
@@ -76,8 +76,8 @@
 ;; description that `tmr' and `tmr-with-description' accept.
 ;;
 ;; Active timers can be viewed in a grid with `tmr-tabulated-view' (part of
-;; the `tmr-tabulated.el' file, whose main author is Damien Cassou).  The
-;; grid is placed in the `*tmr-tabulated-view*' buffer and looks like this:
+;; the `tmr-tabulated.el' file).  The grid is placed in the
+;; `*tmr-tabulated-view*' buffer and looks like this:
 ;;
 ;; Start  EndFinished?  Description
 ;; 12:26:50   12:51:50   ✔ Update tmr manual



[elpa] externals/tmr bd9b1cd8f3 3/3: tmr-tabulated: add library headers

2022-05-11 Thread ELPA Syncer
branch: externals/tmr
commit bd9b1cd8f36dbc4465cdf75100ef96f244d59687
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

tmr-tabulated: add library headers

Same principle as commit bcbb9b3.
---
 tmr-tabulated.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tmr-tabulated.el b/tmr-tabulated.el
index e75fe9cb9e..1b24ae3fff 100644
--- a/tmr-tabulated.el
+++ b/tmr-tabulated.el
@@ -4,6 +4,9 @@
 
 ;; Author: Damien Cassou ,
 ;; Protesilaos Stavrou 
+;; Maintainer: Protesilaos Stavrou 
+;; URL: https://git.sr.ht/~protesilaos/tmr
+;; Mailing list: https://lists.sr.ht/~protesilaos/tmr
 
 ;; This file is NOT part of GNU Emacs.
 



[elpa] externals/osm 0753e734e9: Minor cleanup

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit 0753e734e9cc3c77cf70ccc126c3ee3831fb3a30
Author: Daniel Mendler 
Commit: Daniel Mendler 

Minor cleanup
---
 osm.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/osm.el b/osm.el
index 08559316d8..bb515f6d4b 100644
--- a/osm.el
+++ b/osm.el
@@ -1065,8 +1065,7 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
 (setq-local
  header-line-format
  (concat
-  (format #(" %7.2f°" 0 6 (face bold)) osm--lat)
-  (format #(" %7.2f°" 0 6 (face bold)) osm--lon)
+  (format (propertize " %7.2f° %7.2f°" 'face 'bold) osm--lat osm--lon)
   (propertize " " 'display '(space :align-to (- center 10)))
   (format "%3s " (if (>= meter 1000) (/ meter 1000) meter))
   (if (>= meter 1000) "km " "m ")



[elpa] externals/osm 0bcc5b4484: Minor optimization

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit 0bcc5b4484b375d08bb99a57f36aff6f7c845a4c
Author: Daniel Mendler 
Commit: Daniel Mendler 

Minor optimization
---
 osm.el | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/osm.el b/osm.el
index bb515f6d4b..97cf698306 100644
--- a/osm.el
+++ b/osm.el
@@ -431,11 +431,11 @@ Should be at least 7 days according to the server usage 
policies."
   (setq y (* float-pi (- 1 (* 2 (/ y 256.0 (expt 2.0 zoom))
   (/ (* 180 (atan (/ (- (exp y) (exp (- y))) 2))) float-pi))
 
-(defun osm--lon-to-x (lon zoom)
+(defsubst osm--lon-to-x (lon zoom)
   "Convert LON/ZOOM to x coordinate in pixel."
   (floor (* 256 (expt 2.0 zoom) (osm--lon-to-normalized-x lon
 
-(defun osm--lat-to-y (lat zoom)
+(defsubst osm--lat-to-y (lat zoom)
   "Convert LAT/ZOOM to y coordinate in pixel."
   (floor (* 256 (expt 2.0 zoom) (osm--lat-to-normalized-y lat
 
@@ -810,11 +810,10 @@ Should be at least 7 days according to the server usage 
policies."
 
 (defun osm--pin-inside-p (x y lat lon)
   "Return non-nil if pin at LAT/LON is inside tile X/Y."
-  (let ((p (osm--lon-to-x lon osm--zoom))
-(q (osm--lat-to-y lat osm--zoom)))
-(setq x (* x 256) y (* y 256))
-(and (>= p (- x 32)) (< p (+ x 256 32))
- (>= q y) (< q (+ y 256 64)
+  (let ((p (/ (osm--lon-to-x lon osm--zoom) 256.0))
+(q (/ (osm--lat-to-y lat osm--zoom) 256.0)))
+(and (>= p (- x 0.125)) (< p (+ x 1.125))
+ (>= q y) (< q (+ y 1.25)
 
 (defun osm--put-pin (pins id lat lon name)
   "Put pin at X/Y with NAME and ID in PINS hash table."



[elpa] externals/corfu updated (b4004a14a2 -> 77932f45ce)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/corfu.

  from  b4004a14a2 Another attempt at working around the frame focus bug 
(#159)
   new  3b3f7b6e6d Revert "Another attempt at working around the frame 
focus bug (#159)"
   new  f078f09354 Revert "Redirect focus in after-focus-change-function 
(Fix #159)"
   new  77932f45ce Try different frame redirection


Summary of changes:
 corfu.el | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)



[elpa] externals/corfu 3b3f7b6e6d 1/3: Revert "Another attempt at working around the frame focus bug (#159)"

2022-05-11 Thread ELPA Syncer
branch: externals/corfu
commit 3b3f7b6e6d1f8a1fd344fbbf63bed86b7ced334f
Author: Daniel Mendler 
Commit: Daniel Mendler 

Revert "Another attempt at working around the frame focus bug (#159)"

This reverts commit b4004a14a2ada1f3cbd7c21df99e6607572a0bb3.
---
 corfu.el | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/corfu.el b/corfu.el
index cec6492e6a..097ea9bb52 100644
--- a/corfu.el
+++ b/corfu.el
@@ -369,10 +369,7 @@ The completion backend can override this with
 (defun corfu--popup-redirect-focus ()
   "Redirect focus from popup."
   (when (and (frame-live-p corfu--frame) (eq (selected-frame) corfu--frame))
-;; I don't understand what I am doing...
-;; Why is this even necessary? The frame is marked with no-accept-focus!!!
-(redirect-frame-focus corfu--frame (frame-parent corfu--frame))
-(x-focus-frame (frame-parent corfu--frame
+(redirect-frame-focus corfu--frame (frame-parent corfu--frame
 
 (defun corfu--make-buffer (content)
   "Create corfu buffer with CONTENT."



[elpa] externals/corfu f078f09354 2/3: Revert "Redirect focus in after-focus-change-function (Fix #159)"

2022-05-11 Thread ELPA Syncer
branch: externals/corfu
commit f078f093549009e0104b1d0578ce4c4844b9a944
Author: Daniel Mendler 
Commit: Daniel Mendler 

Revert "Redirect focus in after-focus-change-function (Fix #159)"

This reverts commit ad712043b43791cacf13db66be901f271fb70bcf.
---
 corfu.el | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/corfu.el b/corfu.el
index 097ea9bb52..c3cc2d9eca 100644
--- a/corfu.el
+++ b/corfu.el
@@ -368,8 +368,7 @@ The completion backend can override this with
 
 (defun corfu--popup-redirect-focus ()
   "Redirect focus from popup."
-  (when (and (frame-live-p corfu--frame) (eq (selected-frame) corfu--frame))
-(redirect-frame-focus corfu--frame (frame-parent corfu--frame
+  (redirect-frame-focus corfu--frame (frame-parent corfu--frame)))
 
 (defun corfu--make-buffer (content)
   "Create corfu buffer with CONTENT."
@@ -377,6 +376,8 @@ The completion backend can override this with
 (ls line-spacing)
 (buffer (get-buffer-create " *corfu*")))
 (with-current-buffer buffer
+  ;;; XXX HACK install redirect focus hook
+  (add-hook 'pre-command-hook #'corfu--popup-redirect-focus nil 'local)
   ;;; XXX HACK install mouse ignore map
   (use-local-map corfu--mouse-ignore-map)
   (dolist (var corfu--buffer-parameters)
@@ -1212,9 +1213,7 @@ Auto completion is only performed if the tick did not 
change."
 ;; advice is active *globally*.
 (advice-add #'completion--capf-wrapper :around 
#'corfu--capf-wrapper-advice)
 (advice-add #'eldoc-display-message-no-interference-p :before-while 
#'corfu--allow-eldoc)
-;;; XXX HACK install redirect focus hook
-(add-function :after after-focus-change-function 
#'corfu--popup-redirect-focus)
-(when corfu-auto (add-hook 'post-command-hook #'corfu--auto-post-command 
nil 'local))
+(and corfu-auto (add-hook 'post-command-hook #'corfu--auto-post-command 
nil 'local))
 (setq-local completion-in-region-function #'corfu--in-region))
(t
 (remove-hook 'post-command-hook #'corfu--auto-post-command 'local)



[elpa] externals/osm 471f21f0f8: Optimize osm--update-header

2022-05-11 Thread ELPA Syncer
branch: externals/osm
commit 471f21f0f8bffc078d5ccfd86610a83e5269c2a0
Author: Daniel Mendler 
Commit: Daniel Mendler 

Optimize osm--update-header
---
 osm.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osm.el b/osm.el
index 97cf698306..a7a1f87e85 100644
--- a/osm.el
+++ b/osm.el
@@ -1063,7 +1063,7 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
   (cl-incf idx))
 (setq-local
  header-line-format
- (concat
+ (list
   (format (propertize " %7.2f° %7.2f°" 'face 'bold) osm--lat osm--lon)
   (propertize " " 'display '(space :align-to (- center 10)))
   (format "%3s " (if (>= meter 1000) (/ meter 1000) meter))



[elpa] externals/corfu 77932f45ce 3/3: Try different frame redirection

2022-05-11 Thread ELPA Syncer
branch: externals/corfu
commit 77932f45ce98dfc3e9f00f451af29433c3b241c9
Author: Daniel Mendler 
Commit: Daniel Mendler 

Try different frame redirection
---
 corfu.el | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/corfu.el b/corfu.el
index c3cc2d9eca..87aef110f9 100644
--- a/corfu.el
+++ b/corfu.el
@@ -366,18 +366,12 @@ The completion backend can override this with
 map)
   "Ignore all mouse clicks.")
 
-(defun corfu--popup-redirect-focus ()
-  "Redirect focus from popup."
-  (redirect-frame-focus corfu--frame (frame-parent corfu--frame)))
-
 (defun corfu--make-buffer (content)
   "Create corfu buffer with CONTENT."
   (let ((fr face-remapping-alist)
 (ls line-spacing)
 (buffer (get-buffer-create " *corfu*")))
 (with-current-buffer buffer
-  ;;; XXX HACK install redirect focus hook
-  (add-hook 'pre-command-hook #'corfu--popup-redirect-focus nil 'local)
   ;;; XXX HACK install mouse ignore map
   (use-local-map corfu--mouse-ignore-map)
   (dolist (var corfu--buffer-parameters)
@@ -421,13 +415,14 @@ The completion backend can override this with
  (y (if (> (+ yb (* corfu-count ch) ch ch) (frame-pixel-height))
 (- yb height ch 1)
   yb))
- (buffer (corfu--make-buffer content)))
+ (buffer (corfu--make-buffer content))
+ (parent (window-frame)))
 (unless (and (frame-live-p corfu--frame)
- (eq (frame-parent corfu--frame) (window-frame)))
+ (eq (frame-parent corfu--frame) parent))
   (when corfu--frame (delete-frame corfu--frame))
   (setq corfu--frame (make-frame
-  `((parent-frame . ,(window-frame))
-(minibuffer . ,(minibuffer-window (window-frame)))
+  `((parent-frame . ,parent)
+(minibuffer . ,(minibuffer-window parent))
 ;; Set `internal-border-width' for Emacs 27
 (internal-border-width . ,border)
 ,@corfu--frame-parameters
@@ -459,7 +454,8 @@ The completion backend can override this with
   ;; display content.
   (set-frame-position corfu--frame x y)
   (redisplay 'force)
-  (make-frame-visible corfu--frame
+  (make-frame-visible corfu--frame))
+(redirect-frame-focus corfu--frame parent)))
 
 (defun corfu--popup-show (pos off width lines &optional curr lo bar)
   "Show LINES as popup at POS - OFF.



[elpa] externals/tomelr 62e249f208 1/5: chore: Remove a workaround unnecessary for Emacs 26.3+

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit 62e249f2083dbe4acb0c1b4783f8fe0b132aef73
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Remove a workaround unnecessary for Emacs 26.3+
---
 test/all-tests.el | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/test/all-tests.el b/test/all-tests.el
index 537db89ead..31beb47e0f 100644
--- a/test/all-tests.el
+++ b/test/all-tests.el
@@ -50,13 +50,6 @@
 ;; Load newer version of .el and .elc if both are available
 (setq load-prefer-newer t)
 
-;; Install map and seq from GNU ELPA only for Emacsen older than 27.x.
-(when (version< emacs-version "27.0")
-  ;; Workaround for this error on GHA when using Emacs 26.3:
-  ;;   signal(file-error ("https://elpa.gnu.org/packages/tomelr-0.2.2.tar"; 
"Bad Request"))
-  ;; https://lists.gnu.org/archive/html/help-gnu-emacs/2020-01/msg00162.html
-  (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
-
 (tomelr-install)
 
 (require 'tjson-utils)



[elpa] externals/tomelr 0f7a6cf7f4 2/5: fix: Case of table arrays in nested sub tables

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit 0f7a6cf7f40717b3fd7735f3ee78978e2d031bdb
Author: Kaushal Modi 
Commit: Kaushal Modi 

fix: Case of table arrays in nested sub tables
---
 test/ttable-array.el | 41 +
 tomelr.el| 28 +---
 2 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/test/ttable-array.el b/test/ttable-array.el
index a76192ede9..caefae6b8c 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -127,5 +127,46 @@ See 
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
   (push (tomelr-encode el) out))
 (should (equal ref (nreverse out)
 
+ TOML Table Array in a deeply nested sub-table
+(ert-deftest test-tta-in-subtable ()
+  (let ((inp '(
+   ((logbook . ((toplevel . ((notes . (((note . "abc")
+(val . 123))
+   ((note . "def")
+(val . 456))
+   ((note . "ghi")
+(val . 789))
+   
+(sub1 . ((notes . (((note . "subabc")
+(val . 99123))
+   ((note . "subdef")
+(val . 99456))
+   )))
+   ))
+(ref '(
+   "[logbook]
+  [logbook.toplevel]
+[[logbook.toplevel.notes]]
+  note = \"abc\"
+  val = 123
+[[logbook.toplevel.notes]]
+  note = \"def\"
+  val = 456
+[[logbook.toplevel.notes]]
+  note = \"ghi\"
+  val = 789
+  [logbook.sub1]
+[[logbook.sub1.notes]]
+  note = \"subabc\"
+  val = 99123
+[[logbook.sub1.notes]]
+  note = \"subdef\"
+  val = 99456"
+   ))
+out)
+(dolist (el inp)
+  (push (tomelr-encode el) out))
+(should (equal ref (nreverse out)
+
 
 (provide 'ttable-array)
diff --git a/tomelr.el b/tomelr.el
index 0588c290f1..7217fa23e4 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -281,28 +281,26 @@ Return nil if OBJECT cannot be encoded as a TOML string."
 ;; (message "[tomelr--print-stringlike DBG] str = %S" str)
 (when (member key-type '(table-key table-array-key))
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
-  ;;  object type tomelr--print-indentation-depth)
+  ;;  object key-type tomelr--print-indentation-depth)
   (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
   (progn
-(push str tomelr--print-table-hierarchy)
-(setq tomelr--print-table-hierarchy (nreverse 
tomelr--print-table-hierarchy)))
+(push str tomelr--print-table-hierarchy))
+
 ;; Throw away table keys collected at higher depths, if
 ;; any, from earlier runs of this function.
 (setq tomelr--print-table-hierarchy
-  (seq-take tomelr--print-table-hierarchy
-(1+ tomelr--print-indentation-depth)))
-(setf (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy)
-  str))
-  ;; (message "[tomelr--print-stringlike DBG] table hier: %S"
-  ;;  tomelr--print-table-hierarchy)
+  (reverse (seq-take (reverse tomelr--print-table-hierarchy)
+ (1+ tomelr--print-indentation-depth
+(setf (nth 0 tomelr--print-table-hierarchy) str))
+  ;; (message "[tomelr--print-stringlike DBG] table hier: %S" 
tomelr--print-table-hierarchy)
   )
 (cond
  ;; TT keys
  ((equal key-type 'table-key)
-  (princ (format "[%s]" (string-join tomelr--print-table-hierarchy "."
+  (princ (format "[%s]" (string-join (reverse 
tomelr--print-table-hierarchy) "."
  ;; TTA keys
  ((equal key-type 'table-array-key)
-  (princ (format "[[%s]]" (string-join tomelr--print-table-hierarchy 
"."
+  (princ (format "[[%s]]" (string-join (reverse 
tomelr--print-table-hierarchy) "."
  ;; Normal keys (Alist and Plist keys)
  ((equal key-type 'normal-key)
   (princ str))
@@ -428,12 +426,11 @@ Definition of a TOML Table Array (TTA):
   ;; Throw away table keys collected at higher depths, if
   ;; any, from earlier runs of this function.
   (setq tomelr--print-table-hierarchy
-(seq-take tomelr--print-table-hierarchy
-  (1+ tomelr--print-indentation-depth)))
-
+(reverse (seq-take (reverse tomelr--print-table-hierarchy)
+   (1+ tomelr--print-indentation-depth
   (tomelr--print-indentation)
   (insert
-   (format "[[%s]]" (string-join tomelr--print-table-hierarchy "."
+   (format "[[%

[elpa] externals/tomelr updated (ede2781024 -> 19d128f0d2)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/tomelr.

  from  ede2781024 chore: Update changelog, bump version header
   new  62e249f208 chore: Remove a workaround unnecessary for Emacs 26.3+
   new  0f7a6cf7f4 fix: Case of table arrays in nested sub tables
   new  a5b2a0e625 chore: Update .gitignore
   new  7bc3c7c78a chore(changelog): Update
   new  19d128f0d2 chore: Bump version in header


Summary of changes:
 .gitignore   |  2 ++
 CHANGELOG.org| 11 +++
 test/all-tests.el|  7 ---
 test/ttable-array.el | 41 +
 tomelr.el| 30 ++
 5 files changed, 68 insertions(+), 23 deletions(-)



[elpa] externals/tomelr a5b2a0e625 3/5: chore: Update .gitignore

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit a5b2a0e6251ce62cd2ce515b961dba513966fcb9
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Update .gitignore
---
 .gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index c531d9867f..dfb0c49467 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 *.elc
+/test/.emacs.d/
+/test/.gnupg/



[elpa] externals/tomelr 7bc3c7c78a 4/5: chore(changelog): Update

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit 7bc3c7c78aa9155252fd2f44b242cb180b404afe
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore(changelog): Update
---
 CHANGELOG.org | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index d32088347b..db8bf0ff24 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -4,6 +4,17 @@
 
 All notable changes to this project will be documented in this file.
 
+** *0.4.0* - <2022-05-11>
+
+[[https://github.com/kaushalmodi/tomelr/compare/2820bf1af3e5482df8aa1c9c35bd0d7333ce6a68...a5b2a0e6251ce62cd2ce515b961dba513966fcb9][2820bf1...a5b2a0e]]
+
+*** :bug: Bug Fixes
+:PROPERTIES:
+:CUSTOM_ID: bug-fixes-v0.4.0
+:END:
+
+- Case of table arrays in nested sub tables 
([[https://github.com/kaushalmodi/tomelr/commit/0f7a6cf7f40717b3fd7735f3ee78978e2d031bdb][0f7a6cf]])
+
 ** *0.3.0* - <2022-05-05>
 
 
[[https://github.com/kaushalmodi/tomelr/compare/8fc2257ec072a3fc3316c7f311722db50b37558e...2820bf1af3e5482df8aa1c9c35bd0d7333ce6a68][8fc2257...2820bf1]]



[elpa] externals/tomelr 19d128f0d2 5/5: chore: Bump version in header

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit 19d128f0d2fd4ea8d4bf92cb1f5a235468b45d00
Author: Kaushal Modi 
Commit: Kaushal Modi 

chore: Bump version in header
---
 tomelr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tomelr.el b/tomelr.el
index 7217fa23e4..7007b25254 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Kaushal Modi 
-;; Version: 0.3.0
+;; Version: 0.4.1
 ;; Package-Requires: ((emacs "26.3") (map "3.2.1") (seq "2.23"))
 ;; Keywords: data, tools, toml, serialization, config
 ;; URL: https://github.com/kaushalmodi/tomelr/



[nongnu] elpa/pdf-tools 37bbe86175: Use mkstemp instead of tempnam

2022-05-11 Thread ELPA Syncer
branch: elpa/pdf-tools
commit 37bbe861755bc60c7cc59fee3e2a5d919c77
Author: Vedang Manerikar 
Commit: Vedang Manerikar 

Use mkstemp instead of tempnam

This reverts commit 8ee31220a6ae3e41549bfffca7a89c481d270004 and
brings in @JunyuanChen's change once again.

We modify the commit to fix the problem on Windows by changing the
code as follows:

--- a/server/epdfinfo.c
+++ b/server/epdfinfo.c
@@ -347,6 +347,6 @@
 static char*
 mktempfile()
 {
-  char template[] = "/tmp/epdfinfoXX";
+  char template[] = P_tmpdir "/epdfinfoXX";
   char *filename = malloc(sizeof(template));
   memcpy(filename, template, sizeof(template));

This works correctly for Windows (as confirmed by @ShuguangSun),
Mac (tested by @vedang) and Linux (tested by @Junyuanchen)

Relates to: #101, #94
Closes: #110
---
 server/epdfinfo.c | 29 +++--
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/server/epdfinfo.c b/server/epdfinfo.c
index 3e0e7c1166..906bdb486b 100644
--- a/server/epdfinfo.c
+++ b/server/epdfinfo.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -346,26 +347,18 @@ strchomp (char *str)
 static char*
 mktempfile()
 {
-  char *filename = NULL;
-  int tries = 3;
-  while (! filename && tries-- > 0)
+  char template[] = P_tmpdir "/epdfinfoXX";
+  char *filename = malloc(sizeof(template));
+  memcpy(filename, template, sizeof(template));
+  int fd = mkstemp(filename);
+  if (fd == -1)
 {
-
-  filename =  tempnam(NULL, "epdfinfo");
-  if (filename)
-{
-  int fd = open(filename, O_CREAT | O_EXCL | O_RDONLY, S_IRWXU);
-  if (fd > 0)
-close (fd);
-  else
-{
-  free (filename);
-  filename = NULL;
-}
-}
+  fprintf (stderr, "Unable to create tempfile");
+  free(filename);
+  filename = NULL;
 }
-  if (! filename)
-fprintf (stderr, "Unable to create tempfile");
+  else
+close(fd);
 
   return filename;
 }



[elpa] externals/javaimp 9f8e85fd58: Make navigation functions move over entire defun declaration

2022-05-11 Thread Filipp Gunbin
branch: externals/javaimp
commit 9f8e85fd58e357441658137c35d4b81d12ad495e
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

Make navigation functions move over entire defun declaration
---
 javaimp-parse.el | 46 ++-
 javaimp.el   | 84 +---
 2 files changed, 100 insertions(+), 30 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index 5433bebe6a..a5aa0af599 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -91,6 +91,9 @@ anything in the buffer.  A marker pointing nowhere means
 everything's up-to-date.")
 
 
+
+;; Low-level subroutines
+
 (defsubst javaimp-parse--substr-before-< (str)
   (let ((end (string-search "<" str)))
 (if end
@@ -246,6 +249,38 @@ is unchanged."
   (goto-char pos)
   nil)))
 
+(defun javaimp-parse--decl-prefix (&optional bound)
+  "Attempt to parse defun declaration prefix backwards from
+point (but not farther than BOUND).  Matches inside comments /
+strings are skipped.  Return the beginning of the match (then the
+point is also at that position) or nil (then the point is left
+unchanged)."
+  ;; If we skip a previous scope (including unnamed initializers), or
+  ;; reach enclosing scope start, we'll fail the check in the below
+  ;; loop.  But a semicolon, which delimits statements, will just be
+  ;; skipped by scan-sexps, so find it and use as bound.  If it is in
+  ;; another scope, that's not a problem, for the same reasons as
+  ;; described above.
+  (let* ((prev-semi (save-excursion
+  (javaimp-parse--rsb-keyword ";" bound t)))
+ (bound (when (or bound prev-semi)
+  (apply #'max
+ (delq nil
+   (list bound
+ (and prev-semi (1+ prev-semi)))
+ pos res)
+(with-syntax-table javaimp--arglist-syntax-table
+  (while (and (ignore-errors
+(setq pos (scan-sexps (point) -1)))
+  (or (not bound) (>= pos bound))
+  (or (member (char-after pos)
+  '(?@ ?\(  ;annotation type / args
+   ?<)) ;generic type
+  ;; keyword / identifier first char
+  (= (char-syntax pos) ?w)))
+(goto-char (setq res pos
+res))
+
 
 ;;; Scopes
 
@@ -668,6 +703,15 @@ it with PRED, and its parents with PARENT-PRED."
   (javaimp-scope-filter-parents scope parent-pred))
 scope))
 
+(defun javaimp-parse-get-defun-decl-start (&optional bound)
+  "Return the position of the start of defun declaration at point,
+but not before BOUND.  Point should be at defun name, but
+actually can be anywhere within the declaration, as long as it's
+outside paren constructs like arg-list."
+  (save-excursion
+(javaimp-parse--all-scopes))
+  (javaimp-parse--decl-prefix bound))
+
 (defun javaimp-parse-get-class-abstract-methods ()
   "Return all scopes which are abstract methods in classes."
   (javaimp-parse--all-scopes)
@@ -683,12 +727,12 @@ it with PRED, and its parents with PARENT-PRED."
 (seq-mapcat #'javaimp-parse--interface-abstract-methods
 interfaces)))
 
+
 (defun javaimp-parse-fully-parsed-p ()
   "Return non-nil if current buffer is fully parsed."
   (and javaimp-parse--dirty-pos
(not (marker-position javaimp-parse--dirty-pos
 
-
 (defmacro javaimp-parse-without-hook (&rest body)
   "Execute BODY, temporarily removing
 `javaimp-parse--update-dirty-pos' from `after-change-functions'
diff --git a/javaimp.el b/javaimp.el
index c68729864f..40c6b4dd01 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -1063,35 +1063,59 @@ buffer."
   "Function to be used as `beginning-of-defun-function'."
   (if (zerop arg)
   t
-(when (> arg 0) (setq arg (1- arg)))
 (let* ((ctx (javaimp--get-sibling-context))
-   (prev-idx (or (nth 2 ctx) -1))
-   (siblings (nthcdr 3 ctx))
-   (target-idx (- prev-idx arg)))
+   (parent-beg (nth 0 ctx))
+   (parent-end (nth 1 ctx))
+   (offset-from-prev (if (> arg 0)
+ (1- arg)
+   arg))
+   (target-idx (- (nth 2 ctx) offset-from-prev))
+   (siblings (nthcdr 3 ctx)))
   (cond ((or (not siblings) (< target-idx 0))
- (goto-char (nth 0 ctx))
- nil)
+ (when (= (abs arg) 1)
+   ;; Special case: ok to move to floor.  If there's
+   ;; parent - try to skip its decl prefix too.
+   (goto-char (if parent-beg
+  (or (javaimp--beg-of-defun-decl parent-beg)
+  parent-beg)
+(point-min)
 ((>= target-idx (length siblings))
- (goto-char (nth 1 ctx))
- nil)
+ (when (= (abs arg) 1)
+   ;; Special case: ok to m

[elpa] externals/dtache updated (9becf3a921 -> b121de820c)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/dtache.

  from  9becf3a921 Merge commit 'b762fe472f'
   new  ca489920f3 Add support for dired
   new  b121de820c Handle carriage motion when opening a session


Summary of changes:
 CHANGELOG.org |  1 +
 README.md | 17 +
 dtache.el |  5 +
 3 files changed, 23 insertions(+)



[elpa] externals/dtache ca489920f3 1/2: Add support for dired

2022-05-11 Thread ELPA Syncer
branch: externals/dtache
commit ca489920f31683e9c339ac57a99f260c2625266e
Author: Rose Osterheld 
Commit: Niklas Eklund 

Add support for dired

Add a function to the README that lets dtache be used for asynchronous
shell commands with dired while still supporting all of dired's
filename substitution features.
---
 CHANGELOG.org |  1 +
 README.md | 17 +
 2 files changed, 18 insertions(+)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index ab475ca3f2..41425e0e93 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -3,6 +3,7 @@
 #+language: en
 
 *   Development
+- Add integration with =dired= through =dired-do-shell-command=
 
 * Version 0.6 (2022-05-01)
 
diff --git a/README.md b/README.md
index 4fed7d7b03..b99ff41ce8 100644
--- a/README.md
+++ b/README.md
@@ -430,6 +430,23 @@ The package can be integrated with the 
[vterm](https://github.com/akermu/emacs-l
 (process-send-string vterm--process dtache--dtach-detach-character)))
 ```
 
+### Dired
+
+Dtache can be used to run async commands in `dired`, with all of dired's 
special features for inserting filenames an working with marked files.
+
+``` emacs-lisp
+(defun my/dtache-dired-do-shell-command (dired-do-shell-command &rest args)
+  "Make sure `dtache' is used before running DIRED-DO-SHELL-COMMAND with ARGS."
+  (cl-letf* ((dtache-session-origin 'dired)
+ ((symbol-function #'dired-run-shell-command)
+  (lambda (command)
+(dtache-start-session command)
+nil)))
+(apply dired-do-shell-command args)))
+
+(advice-add 'dired-do-shell-command :around #'my/dtache-dired-do-shell-command)
+```
+
 ### Dired-rsync
 
 The [dired-rsync](https://github.com/stsquad/dired-rsync) is a package to run 
[rsync](https://linux.die.net/man/1/rsync) commands from within `dired`. Its a 
perfect package to integrate with `dtache` since it typically requires some 
time to run and you don't want to have your Emacs limited by that process.



[elpa] externals/dtache b121de820c 2/2: Handle carriage motion when opening a session

2022-05-11 Thread ELPA Syncer
branch: externals/dtache
commit b121de820cf28ed507194b9c4cde90ac9ca672d8
Author: Rose Osterheld 
Commit: Niklas Eklund 

Handle carriage motion when opening a session

Properly handle characters like carriage returns and backspaces in session
output. The package can now properly handle these characters upon
viewing a session. For now it will handle the previous output when
tailing a session but any new output will not be handled.
---
 dtache.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/dtache.el b/dtache.el
index 03cf504a4d..2c1294fe2d 100644
--- a/dtache.el
+++ b/dtache.el
@@ -45,6 +45,7 @@
 
 (require 'ansi-color)
 (require 'autorevert)
+(require 'comint)
 (require 'notifications)
 (require 'filenotify)
 (require 'simple)
@@ -1302,6 +1303,8 @@ If event is cased by an update to the `dtache' database, 
re-initialize
 (define-derived-mode dtache-log-mode nil "Dtache Log"
   "Major mode for `dtache' logs."
   (when dtache-filter-ansi-sequences
+(comint-carriage-motion (point-min) (point-max))
+(set-buffer-modified-p nil)
 (ansi-color-apply-on-region (point-min) (point-max)))
   (read-only-mode t))
 
@@ -1323,6 +1326,8 @@ If event is cased by an update to the `dtache' database, 
re-initialize
   (setq-local auto-revert-verbose nil)
   (auto-revert-tail-mode)
   (when dtache-filter-ansi-sequences
+(comint-carriage-motion (point-min) (point-max))
+(set-buffer-modified-p nil)
 (add-hook 'after-revert-hook #'dtache--ansi-color-tail nil t)
 (ansi-color-apply-on-region (point-min) (point-max)))
   (read-only-mode t))



[elpa] externals/tomelr 7f331a8c0d: refactor: Use append instead of push+reverse

2022-05-11 Thread ELPA Syncer
branch: externals/tomelr
commit 7f331a8c0d4ab1f25b6f8b8749f8cb7a6ad274a6
Author: Kaushal Modi 
Commit: Kaushal Modi 

refactor: Use append instead of push+reverse
---
 tomelr.el | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tomelr.el b/tomelr.el
index 7007b25254..916191aa33 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -283,24 +283,23 @@ Return nil if OBJECT cannot be encoded as a TOML string."
   ;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S, 
depth = %d"
   ;;  object key-type tomelr--print-indentation-depth)
   (if (null (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy))
-  (progn
-(push str tomelr--print-table-hierarchy))
+  (setq tomelr--print-table-hierarchy
+(append tomelr--print-table-hierarchy (list str)))
 
 ;; Throw away table keys collected at higher depths, if
 ;; any, from earlier runs of this function.
 (setq tomelr--print-table-hierarchy
-  (reverse (seq-take (reverse tomelr--print-table-hierarchy)
- (1+ tomelr--print-indentation-depth
-(setf (nth 0 tomelr--print-table-hierarchy) str))
+  (seq-take tomelr--print-table-hierarchy (1+ 
tomelr--print-indentation-depth)))
+(setf (nth tomelr--print-indentation-depth 
tomelr--print-table-hierarchy) str))
   ;; (message "[tomelr--print-stringlike DBG] table hier: %S" 
tomelr--print-table-hierarchy)
   )
 (cond
  ;; TT keys
  ((equal key-type 'table-key)
-  (princ (format "[%s]" (string-join (reverse 
tomelr--print-table-hierarchy) "."
+  (princ (format "[%s]" (string-join tomelr--print-table-hierarchy "."
  ;; TTA keys
  ((equal key-type 'table-array-key)
-  (princ (format "[[%s]]" (string-join (reverse 
tomelr--print-table-hierarchy) "."
+  (princ (format "[[%s]]" (string-join tomelr--print-table-hierarchy 
"."
  ;; Normal keys (Alist and Plist keys)
  ((equal key-type 'normal-key)
   (princ str))
@@ -426,11 +425,11 @@ Definition of a TOML Table Array (TTA):
   ;; Throw away table keys collected at higher depths, if
   ;; any, from earlier runs of this function.
   (setq tomelr--print-table-hierarchy
-(reverse (seq-take (reverse tomelr--print-table-hierarchy)
-   (1+ tomelr--print-indentation-depth
+(seq-take tomelr--print-table-hierarchy (1+ 
tomelr--print-indentation-depth)))
+
   (tomelr--print-indentation)
   (insert
-   (format "[[%s]]" (string-join (reverse tomelr--print-table-hierarchy) 
"."
+   (format "[[%s]]" (string-join tomelr--print-table-hierarchy "."
 
 (defun tomelr--print-array (array)
   "Insert a TOML representation of ARRAY at point."



[elpa] main c3b6837331: * elpa-packages (plz): New package

2022-05-11 Thread Stefan Monnier via
branch: main
commit c3b6837331dab592337b18692def69f1d5224e1c
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages (plz): New package
---
 elpa-packages | 4 
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index 51c17bcf09..0a72606e4c 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -487,6 +487,10 @@
   :auto-sync nil
   )
  ("pinentry"   :url "https://github.com/ueno/pinentry-el.git";)
+ ("plz" :url "https://github.com/alphapapa/plz.el.git";
+  :ignored-files ("LICENSE")
+  :doc "README.org"
+  :auto-sync t)
  ("poke"   :url "git://git.sv.gnu.org/poke/poke-el.git"
   :doc "poke-el.texi"
   :ignored-files ("COPYING")



[elpa] branch externals/plz created (now 9156de9c59)

2022-05-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/plz.

at  9156de9c59 Release: 0.1

This branch includes the following new commits:

   new  f0a0d114a6 Initial commit
   new  2d20ca5030 Changes
   new  e7d9513bb9 Rename
   new  c7c16e2123 Changes
   new  2b7944e0f9 Changes
   new  5f54b5ebec Changes
   new  1016279174 Changes
   new  debfc864c8 Changes
   new  fbdcd69950 Changes
   new  454c11 Changes
   new  2c19b7f11d Changes
   new  6a21c7e809 Significant changes
   new  897c5bbfb2 Improvements, error handling
   new  e14ea7327d Tidying
   new  5b00a61ce3 Rename functions
   new  950a5498cb Tidy
   new  44e6f02064 Binary content
   new  3249835c8b Tidy tests
   new  5bd683ead8 Tidy tests
   new  bca0b3112b Tidy
   new  370d0bbc1a Tidy
   new  30e48b1e6a Tidy
   new  971077e1d3 Tests
   new  3dd2598fe9 Tidy
   new  05f93b0b6b Meta: Update Makefile, makem.sh
   new  21a7318f1c Tests: Tidy/rename
   new  2b51ecd6be Meta: Add test.yml for GitHub Actions
   new  3cc6747035 Meta: Add comm keyword
   new  51404566fa Notes: Add fetch.el
   new  4f74be6565 Notes: Add idea
   new  b77283748b Meta: Update makem.sh
   new  56c66c4421 Add/Change: :as 'binary
   new  19a0110109 Notes: Add ToC
   new  6f8dfb83de Tests: (plz-test-get-response) Change to macro
   new  33438b7105 CI: Enable testing of all branches
   new  1bb701f1c1 Change/Fix: Downcase and intern header keys
   new  439fb383d9 Notes: Add idea about finalizers
   new  9a1b119eff Meta: Ignore sandbox/
   new  baf93bb80a Fix: (plz--curl) Header args
   new  0301272d8d Add: plz-put
   new  65dbc0f219 Change/Fix: (plz--sentinel) Use exhaustive pcase
   new  a5f22b23e1 Add: (plz)
   new  430ceffd1d Change: Handle killed processes
   new  7eff40f276 Add: plz-finally
   new  27010c20e1 Meta: Update makem.sh, etc.
   new  1884d038ae Notes: Add note about Lars Ingebrigtsen's with-url macro
   new  f40d3ecbdd Add/Change: :noquery argument for make-process
   new  f34efa052c Fix: set-buffer-multibyte nil for binary
   new  8d2654bba7 Add/Change: Handle LF-only HTTP responses
   new  e977a046a3 Change: (plz-http-response-status-line-regexp) Match at 
BOL
   new  7478d43668 Revert "Add/Change: Handle LF-only HTTP responses"
   new  f12f907719 Change/Fix: (plz--curl) Disable Expect header
   new  220f882ee4 Tests: (plz-post-jpeg-string) Add
   new  4a246e24f6 Add: Upload binary files
   new  701e79c3e8 Tidy: Remove obsolete functions
   new  b412258c9d Add: :timeout argument (curl's --max-time)
   new  87007fc612 Add: FIXMEs
   new  709a14740f Tidy: Docstrings
   new  93a2ccaaa8 Fix: Run curl in temporary-file-directory
   new  f2176dc56c Change/Fix: Avoid command-line arguments
   new  7c27e4bdcd Change: Sync with accept-process-output
   new  ac5bc006f3 Docs: Add readme
   new  ce7afc17f9 Meta: Ignore .sandbox/
   new  65030d5cc1 Tidy: Docstring
   new  dd92f48895 Change: Default to :then 'sync and :as 'string
   new  4736d5242a Tests: (plz-test-wait) Change to function, test process 
argument
   new  cddf81 Docs: Fix link
   new  f1a89a8816 Add: Download :as file
   new  278391562a Docs: Tidy
   new  a5ccf48d80 Tests: Add check/error to a test
   new  0a860d94dc Tests: "There be dragons."
   new  2f48423834 Docs: Add mascot
   new  8cd1ef481d Notes: Add links to skeeto's feedback
   new  0b32c64f77 Notes: Rename file
   new  7e456638a6 Meta: Move notes to orphan branch
   new  da503527d2 Change: (plz--response) Error if unable to parse HTTP 
response
   new  69d5bf74f6 Fix: (plz--coding-system) Alist key
   new  1d3efc036c Add: (plz) DELETE method
   new  dd491941ab Meta: Update makem.sh
   new  9e308f1833 Meta: Tidy headers, etc. for ELPA
   new  9156de9c59 Release: 0.1




[elpa] externals/plz f0a0d114a6 01/81: Initial commit

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit f0a0d114a64e92e39bb7923186b6986bb0d15114
Author: Adam Porter 
Commit: Adam Porter 

Initial commit
---
 http-lib.el   | 256 ++
 test/test-http-lib.el |  53 +++
 2 files changed, 309 insertions(+)

diff --git a/http-lib.el b/http-lib.el
new file mode 100644
index 00..7903dcbb33
--- /dev/null
+++ b/http-lib.el
@@ -0,0 +1,256 @@
+;;; http-lib.el --- HTTP library -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2019  Adam Porter
+
+;; Author: Adam Porter 
+;; Keywords:
+
+;; 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 of the License, 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 this program.  If not, see .
+
+;;; Commentary:
+
+;; An HTTP library that uses curl as a backend.  Inspired by, and some
+;; code copied from, Christopher Wellons's library, elfeed-curl.el.
+
+;;; Code:
+
+ Requirements
+
+(require 'cl-lib)
+(require 'subr-x)
+
+ Structs
+
+(cl-defstruct http-lib-response
+  version status headers body)
+
+ Constants
+
+(defconst http-lib-curl-errors
+  ;; Copied from elfeed-curl.el.
+  '((1 . "Unsupported protocol.")
+(2 . "Failed to initialize.")
+(3 . "URL malformed. The syntax was not correct.")
+(4 . "A feature or option that was needed to perform the desired request 
was not enabled or was explicitly disabled at build-time.")
+(5 . "Couldn't resolve proxy. The given proxy host could not be resolved.")
+(6 . "Couldn't resolve host. The given remote host was not resolved.")
+(7 . "Failed to connect to host.")
+(8 . "FTP weird server reply. The server sent data curl couldn't parse.")
+(9 . "FTP access denied.")
+(11 . "FTP weird PASS reply.")
+(13 . "FTP weird PASV reply.")
+(14 . "FTP weird 227 format.")
+(15 . "FTP can't get host.")
+(17 . "FTP couldn't set binary.")
+(18 . "Partial file. Only a part of the file was transferred.")
+(19 . "FTP couldn't download/access the given file, the RETR (or similar) 
command failed.")
+(21 . "FTP quote error. A quote command returned error from the server.")
+(22 . "HTTP page not retrieved.")
+(23 . "Write error.")
+(25 . "FTP couldn't STOR file.")
+(26 . "Read error. Various reading problems.")
+(27 . "Out of memory. A memory allocation request failed.")
+(28 . "Operation timeout.")
+(30 . "FTP PORT failed.")
+(31 . "FTP couldn't use REST.")
+(33 . "HTTP range error. The range \"command\" didn't work.")
+(34 . "HTTP post error. Internal post-request generation error.")
+(35 . "SSL connect error. The SSL handshaking failed.")
+(36 . "FTP bad download resume.")
+(37 . "FILE couldn't read file.")
+(38 . "LDAP bind operation failed.")
+(39 . "LDAP search failed.")
+(41 . "Function not found. A required LDAP function was not found.")
+(42 . "Aborted by callback.")
+(43 . "Internal error. A function was called with a bad parameter.")
+(45 . "Interface error. A specified outgoing interface could not be used.")
+(47 . "Too many redirects.")
+(48 . "Unknown option specified to libcurl.")
+(49 . "Malformed telnet option.")
+(51 . "The peer's SSL certificate or SSH MD5 fingerprint was not OK.")
+(52 . "The server didn't reply anything, which here is considered an 
error.")
+(53 . "SSL crypto engine not found.")
+(54 . "Cannot set SSL crypto engine as default.")
+(55 . "Failed sending network data.")
+(56 . "Failure in receiving network data.")
+(58 . "Problem with the local certificate.")
+(59 . "Couldn't use specified SSL cipher.")
+(60 . "Peer certificate cannot be authenticated with known CA 
certificates.")
+(61 . "Unrecognized transfer encoding.")
+(62 . "Invalid LDAP URL.")
+(63 . "Maximum file size exceeded.")
+(64 . "Requested FTP SSL level failed.")
+(65 . "Sending the data requires a rewind that failed.")
+(66 . "Failed to initialise SSL Engine.")
+(67 . "The user name, password, or similar was not accepted and curl 
failed to log in.")
+(68 . "File not found on TFTP server.")
+(69 . "Permission problem on TFTP server.")
+(70 . "Out of disk space on TFTP server.")
+(71 . "Illegal TFTP operation.")
+(72 . "Unknown TFTP transfer ID.")
+(73 . "File already exists (TFTP).")
+(74 . "No such user (TFTP).")
+(75 . "Character conversion failed.")
+(76 . "Character conversion

[elpa] externals/plz 5f54b5ebec 06/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 5f54b5ebeced21f57a1fc8d2681118d18503bd53
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 test/test-plz.el | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/test/test-plz.el b/test/test-plz.el
index e63932b66b..cadcbab3bb 100644
--- a/test/test-plz.el
+++ b/test/test-plz.el
@@ -27,6 +27,7 @@
  Requirements
 
 (require 'ert)
+(require 'json)
 
  Variables
 
@@ -39,10 +40,31 @@
 
  Functions
 
+(defun plz-test-get-response (response)
+  "Return non-nil if RESPONSE seems to be a correct GET response."
+  (and (plz-response-p response)
+   (numberp (plz-response-version response))
+   (eq 200 (plz-response-status response))
+   (equal "application/json" (alist-get "Content-Type" 
(plz-response-headers response) nil nil #'equal))
+   (let* ((json (json-read-from-string (plz-response-body response)))
+  (headers (alist-get 'headers json))
+  (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
+ (string-match "curl" user-agent
+
  Tests
 
+(ert-deftest plz-get-async nil
+  (let* ((test-response)
+ (process (plz-get "https://httpbin.org/get";
+   :success (lambda (response)
+  (setf test-response response)
+(cl-loop for i upto 100 ;; 10 seconds
+ while (equal 'run (process-status process))
+ do (sleep-for 0.1))
+(plz-test-get-response test-response)))
+
 (ert-deftest plz-get-sync nil
-  (plz-response-p (plz-get "https://httpbin.org/get"; :sync t)))
+  (plz-test-get-response (plz-get "https://httpbin.org/get"; :sync t)))
 
  Footer
 



[elpa] externals/plz 2d20ca5030 02/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 2d20ca5030c5a4df30e7bd8a3a76584276c532bf
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 http-lib.el   | 72 +++
 test/test-http-lib.el |  6 ++---
 2 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/http-lib.el b/http-lib.el
index 7903dcbb33..b81e399eff 100644
--- a/http-lib.el
+++ b/http-lib.el
@@ -155,41 +155,69 @@
 
  Functions
 
-(cl-defun http-lib-get (url &key headers _connect-timeout
+(cl-defun http-lib-get (url &key headers _connect-timeout sync
 success error)
   "FIXME: Docstring."
-  (http-lib-request 'get url
-:headers headers
-;;  :connect-timeout timeout
-:success success
-:error error))
-
-(cl-defun http-lib-request (_method url &key headers _connect-timeout
-success error)
+  (http-lib--request 'get url
+ :sync sync
+ :headers headers
+ ;;  :connect-timeout timeout
+ :success success
+ :error error))
+
+(cl-defun http-lib-request-async (&rest args)
+  "FIXME: Docstring."
+  (apply #'http-lib--request args))
+
+(cl-defun http-lib-request-sync (&rest args)
+  "FIXME: Docstring."
+  (apply #'http-lib--request :sync t args))
+
+(cl-defun http-lib--request (_method url &key headers _connect-timeout sync
+ success error)
   "FIXME: Docstring."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
+  (let* ((coding-system-for-read 'binary)
+ (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
+(list url
+(if sync
+(http-lib-request--sync curl-args :success success :error error)
+  (http-lib-request--async curl-args :success success :error error
+
+(cl-defun http-lib-request--async (curl-args &key success error)
+  "FIXME: Docstring."
   (with-current-buffer (generate-new-buffer "*http-lib-request-curl*")
-(let* ((coding-system-for-read 'binary)
-   (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
-  (list url)))
-   (process (apply #'start-process "http-lib-request-curl" 
(current-buffer)
-   http-lib-curl-program curl-args)))
+(let ((process (make-process :name "http-lib-request-curl"
+ :buffer (current-buffer)
+ :command (append (list http-lib-curl-program) 
curl-args)
+ :connection-type 'pipe
+ :sentinel #'http-lib--sentinel
+ :stderr (current-buffer
   (setf http-lib-success success
-http-lib-error error
-(process-sentinel process) #'http-lib--sentinel)
+http-lib-error error)
   process)))
 
-(defun http-lib--sentinel (process status)
+(cl-defun http-lib-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
+ curl-args))
+  (http-lib-success #'identity))
+  (http-lib--sentinel (current-buffer) status
+
+(defun http-lib--sentinel (process-or-buffer status)
   "FIXME: Docstring."
   ;; Inspired by and some code copied from `elfeed-curl--sentinel'.
-  (let ((buffer (process-buffer process)))
+  (let ((buffer (cl-etypecase process-or-buffer
+  (process (process-buffer process-or-buffer))
+  (buffer process-or-buffer
 (unwind-protect
 (with-current-buffer buffer
   (pcase status
-("finished\n"
+((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)))
diff --git a/test/test-http-lib.el b/test/test-http-lib.el
index 9ad0582bd1..d8d780df02 100644
--- a/test/test-http-lib.el
+++ b/test/test-http-lib.el
@@ -41,10 +41,8 @@
 
  Tests
 
-(ert-deftest http-lib-get nil
-  (http-lib-response-body (http-lib-get "https://httpbin.org/get";))
-  )
-
+(ert-deftest http-lib-get-sync nil
+  (http-lib-response-p (http-lib-get "https://httpbin.org/get"; :sync t)))
 
  Footer
 



[elpa] externals/plz 5bd683ead8 19/81: Tidy tests

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 5bd683ead8311a406cf2dea16ca45cdd1bf7451b
Author: Adam Porter 
Commit: Adam Porter 

Tidy tests
---
 tests/test-plz.el | 73 +++
 1 file changed, 36 insertions(+), 37 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 6f82e78c2f..c93ec8e904 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -28,6 +28,7 @@
 
 (require 'ert)
 (require 'json)
+(require 'let-alist)
 
 (require 'plz)
 
@@ -66,44 +67,43 @@
 ; Async
 
 (ert-deftest plz-get-string nil
-  (should (let* ((test-string)
- (process (plz-get "https://httpbin.org/get";
-:as 'string
-:then (lambda (string)
-(setf test-string string)
-(plz-test-wait process)
-(string-match "curl" test-string
+  (let* ((test-string)
+ (process (plz-get "https://httpbin.org/get";
+:as 'string
+:then (lambda (string)
+(setf test-string string)
+(plz-test-wait process)
+(should (string-match "curl" test-string
 
 (ert-deftest plz-get-buffer nil
   ;; The sentinel kills the buffer, so we get the buffer as a string.
-  (should (let* ((test-buffer-string)
- (process (plz-get "https://httpbin.org/get";
-:as 'buffer
-:then (lambda (buffer)
-(with-current-buffer buffer
-  (setf test-buffer-string 
(buffer-string)))
-(plz-test-wait process)
-(string-match "curl" test-buffer-string
+  (let* ((test-buffer-string)
+ (process (plz-get "https://httpbin.org/get";
+:as 'buffer
+:then (lambda (buffer)
+(with-current-buffer buffer
+  (setf test-buffer-string (buffer-string)))
+(plz-test-wait process)
+(should (string-match "curl" test-buffer-string
 
 (ert-deftest plz-get-response nil
-  (should (let* ((test-response)
- (process (plz-get "https://httpbin.org/get";
-:as 'response
-:then (lambda (response)
-(setf test-response response)
-(plz-test-wait process)
-(plz-test-get-response test-response
+  (let* ((test-response)
+ (process (plz-get "https://httpbin.org/get";
+:as 'response
+:then (lambda (response)
+(setf test-response response)
+(plz-test-wait process)
+(should (plz-test-get-response test-response
 
 (ert-deftest plz-get-json nil
-  (should (let* ((test-json)
- (process (plz-get "https://httpbin.org/get";
-:as #'json-read
-:then (lambda (json)
-(setf test-json json)
-(plz-test-wait process)
-(let* ((headers (alist-get 'headers test-json))
-   (user-agent (alist-get 'User-Agent headers nil nil 
#'equal)))
-  (string-match "curl" user-agent)
+  (let* ((test-json)
+ (process (plz-get "https://httpbin.org/get";
+:as #'json-read
+:then (lambda (json)
+(setf test-json json)
+(plz-test-wait process)
+(let-alist test-json
+  (should (string-match "curl" .headers.User-Agent)
 
 ; Sync
 
@@ -117,11 +117,9 @@
:as 'response
 
 (ert-deftest plz-get-sync-json nil
-  (should (let* ((test-json (plz-get-sync "https://httpbin.org/get";
-  :as #'json-read))
- (headers (alist-get 'headers test-json))
- (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
-(string-match "curl" user-agent
+  (let-alist (plz-get-sync "https://httpbin.org/get";
+   :as #'json-read)
+(should (string-match "curl" .headers.User-Agent
 
 (ert-deftest plz-get-sync-buffer nil
   ;; `buffer' is not a valid type for `plz-get-sync'.
@@ -136,7 +134,8 @@
:type 'plz-curl-error)))
 (should (and (eq 'plz-curl-error (car err))
  (plz-error-p (cdr err))
- (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.") (plz-error-curl-error (cdr err)))
+ (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.")
+(plz-error-curl-error (cdr err)))
 
 (ert-deftest plz-get-404-error nil
   (let ((err (should-error (plz-get-sync "https://httpbin.org/get/status/404";



[elpa] externals/plz 1016279174 07/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 1016279174611eb126db9d6378967b10610e42ca
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 .gitignore  | 1 +
 plz.el  | 1 +
 {test => tests}/test-plz.el | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00..c531d9867f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.elc
diff --git a/plz.el b/plz.el
index 2d6471c47e..3b256f56a0 100644
--- a/plz.el
+++ b/plz.el
@@ -48,6 +48,7 @@
  Requirements
 
 (require 'cl-lib)
+(require 'rx)
 (require 'subr-x)
 
  Structs
diff --git a/test/test-plz.el b/tests/test-plz.el
similarity index 99%
rename from test/test-plz.el
rename to tests/test-plz.el
index cadcbab3bb..7551a91e41 100644
--- a/test/test-plz.el
+++ b/tests/test-plz.el
@@ -29,6 +29,8 @@
 (require 'ert)
 (require 'json)
 
+(require 'plz)
+
  Variables
 
 



[elpa] externals/plz e14ea7327d 14/81: Tidying

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit e14ea7327dd364d6a479ebd6a2455608455ecb0b
Author: Adam Porter 
Commit: Adam Porter 

Tidying
---
 plz.el | 134 -
 1 file changed, 100 insertions(+), 34 deletions(-)

diff --git a/plz.el b/plz.el
index 0b189d07b9..1e1a7bd5d7 100644
--- a/plz.el
+++ b/plz.el
@@ -186,12 +186,32 @@
 
  Functions
 
+; Public
+
 (cl-defun plz-get (url &key headers as then else
(connect-timeout plz-connect-timeout)
(decode t))
   "Get HTTP URL with curl.
 
-FIXME: Docstring.
+AS selects the kind of result to pass to the callback function
+THEN.  It may be:
+
+- `buffer' to pass the response buffer.
+- `string' to pass the response body as a string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
+
+If DECODE is non-nil, the response body is decoded automatically.
+
+THEN is a callback function, whose sole argument is selected
+above with AS.
+
+ELSE is an optional callback function called when the request
+fails with one argument, a `plz-error' struct.  If ELSE is nil,
+an error is signaled when the request fails, either
+`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-error' struct as the error data..
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
@@ -208,7 +228,18 @@ the initial connection attempt."
 (decode t))
   "Get HTTP URL with curl synchronously.
 
-FIXME: Docstring.
+AS selects the kind of result to return.  It may be:
+
+- `string' to pass the response body as a string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
+
+If DECODE is non-nil, the response body is decoded automatically.
+
+If the request fails, an error is signaled, either
+`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-error' struct as the error data.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
@@ -220,11 +251,35 @@ the initial connection attempt."
  :decode decode
  :as as))
 
+; Private
+
+;; Curl
+
+;; Functions for calling and handling curl processes.
+
 (cl-defun plz--request (_method url &key headers connect-timeout
 decode as then else)
-  "Return curl process for HTTP request to URL.
+  "Get HTTP URL with curl.
+
+AS selects the kind of result to pass to the callback function
+THEN.  It may be:
+
+- `buffer' to pass the response buffer.
+- `string' to pass the response body as a string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
 
-FIXME: Docstring.
+If DECODE is non-nil, the response body is decoded automatically.
+
+THEN is a callback function, whose sole argument is selected
+above with AS.
+
+ELSE is an optional callback function called when the request
+fails with one argument, a `plz-error' struct.  If ELSE is nil,
+an error is signaled when the request fails, either
+`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-error' struct as the error data..
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
@@ -268,8 +323,25 @@ the initial connection attempt."
 
 (cl-defun plz--request-sync (_method url &key headers connect-timeout
  decode as)
-  "Return HTTP response for curl called with CURL-ARGS.
-FIXME: Docstring.
+  "Return result for HTTP request to URL made synchronously with curl.
+
+AS selects the kind of result to return.  It may be:
+
+- `string' to pass the response body as a string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
+
+If DECODE is non-nil, the response body is decoded automatically.
+
+HEADERS may be an alist of extra headers to send with the
+request.  CONNECT-TIMEOUT may be a number of seconds to timeout
+the initial connection attempt.
+
+If the request fails, an error is signaled, either
+`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-error' struct as the error data.
+
 Uses `call-process' to call curl synchronously."
   (with-current-buffer (generate-new-buffer " *plz-request-curl*")
 (let* ((coding-system-for-read 'binary)
@@ -285,12 +357,12 @@ Uses `call-process' to call curl synchronously."
;; THEn form copied from `plz--request'.
;; TODO: DRY this.  Maybe we could use a thread a

[elpa] externals/plz 3249835c8b 18/81: Tidy tests

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 3249835c8b0712e8d498731a609a2fb60781c903
Author: Adam Porter 
Commit: Adam Porter 

Tidy tests
---
 tests/test-plz.el | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 071730e8cf..6f82e78c2f 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -71,9 +71,7 @@
 :as 'string
 :then (lambda (string)
 (setf test-string string)
-(cl-loop for i upto 100 ;; 10 seconds
- while (equal 'run (process-status process))
- do (sleep-for 0.1))
+(plz-test-wait process)
 (string-match "curl" test-string
 
 (ert-deftest plz-get-buffer nil
@@ -84,9 +82,7 @@
 :then (lambda (buffer)
 (with-current-buffer buffer
   (setf test-buffer-string 
(buffer-string)))
-(cl-loop for i upto 100 ;; 10 seconds
- while (equal 'run (process-status process))
- do (sleep-for 0.1))
+(plz-test-wait process)
 (string-match "curl" test-buffer-string
 
 (ert-deftest plz-get-response nil
@@ -95,9 +91,7 @@
 :as 'response
 :then (lambda (response)
 (setf test-response response)
-(cl-loop for i upto 100 ;; 10 seconds
- while (equal 'run (process-status process))
- do (sleep-for 0.1))
+(plz-test-wait process)
 (plz-test-get-response test-response
 
 (ert-deftest plz-get-json nil
@@ -106,9 +100,7 @@
 :as #'json-read
 :then (lambda (json)
 (setf test-json json)
-(cl-loop for i upto 100 ;; 10 seconds
- while (equal 'run (process-status process))
- do (sleep-for 0.1))
+(plz-test-wait process)
 (let* ((headers (alist-get 'headers test-json))
(user-agent (alist-get 'User-Agent headers nil nil 
#'equal)))
   (string-match "curl" user-agent)
@@ -158,10 +150,6 @@
 ; Binary
 
 (ert-deftest plz-test-get-jpeg ()
-  (let ((jpeg (plz-get-sync "https://httpbin.org/image/jpeg";
-:decode nil)))
-(should (image-jpeg-p jpeg)))
-
   (let* ((test-jpeg)
  (process (plz-get "https://httpbin.org/image/jpeg";
 :decode nil
@@ -169,7 +157,12 @@
 :then (lambda (string)
 (setf test-jpeg string)
 (plz-test-wait process)
-(should (image-jpeg-p test-jpeg
+(should (equal 'jpeg (image-type-from-data test-jpeg)
+
+(ert-deftest plz-test-get-jpeg-sync ()
+  (let ((jpeg (plz-get-sync "https://httpbin.org/image/jpeg";
+:decode nil)))
+(should (equal 'jpeg (image-type-from-data jpeg)
 
  Footer
 



[elpa] externals/plz e7d9513bb9 03/81: Rename

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit e7d9513bb92c0854bf911c9993d8e18bd3eada84
Author: Adam Porter 
Commit: Adam Porter 

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) 
cu

[elpa] externals/plz 439fb383d9 37/81: Notes: Add idea about finalizers

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 439fb383d9b7f6a8c6e6d647ea699276114974d7
Author: Adam Porter 
Commit: Adam Porter 

Notes: Add idea about finalizers
---
 notes.org | 9 +
 1 file changed, 9 insertions(+)

diff --git a/notes.org b/notes.org
index 73afb586dd..d29b4d781d 100644
--- a/notes.org
+++ b/notes.org
@@ -20,6 +20,15 @@ e.g. =request.el= can leak secrets and other data via the 
command line and [[htt
 
 * 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=



[elpa] externals/plz 2b51ecd6be 27/81: Meta: Add test.yml for GitHub Actions

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 2b51ecd6bea35884ef180f3cd85f1631d848fa4c
Author: Adam Porter 
Commit: Adam Porter 

Meta: Add test.yml for GitHub Actions
---
 .github/workflows/test.yml | 73 ++
 1 file changed, 73 insertions(+)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00..11428d808e
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,73 @@
+# * test.yml --- Test Emacs packages using makem.sh on GitHub Actions
+
+# https://github.com/alphapapa/makem.sh
+
+# Based on Steve Purcell's examples at
+# 
,
+# 
.
+
+# * 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 of the License, 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 this program.  If not, see .
+
+# * Code:
+
+name: "CI"
+on:
+  pull_request:
+  push:
+# Comment out this section to enable testing of all branches.
+branches:
+  - master
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+strategy:
+  fail-fast: false
+  matrix:
+emacs_version:
+  - 26.3
+  - snapshot
+steps:
+- uses: purcell/setup-emacs@master
+  with:
+version: ${{ matrix.emacs_version }}
+
+- uses: actions/checkout@v2
+
+- name: Install sandbox script
+  run: |
+curl -o $GITHUB_WORKSPACE/emacs-sandbox.sh \
+  
https://raw.githubusercontent.com/alphapapa/emacs-sandbox.sh/master/emacs-sandbox.sh
+chmod +x $GITHUB_WORKSPACE/emacs-sandbox.sh
+echo ::add-path::$GITHUB_WORKSPACE
+echo ::set-env name=SANDBOX_DIR::$(mktemp -d)
+
+- name: Initialize sandbox
+  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR --auto-install --install 
package-lint
+
+# The "all" rule is not used, because it treats compilation warnings
+# as failures, so linting and testing are run as separate steps.
+
+- name: Lint
+  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR lint
+
+- name: Test
+  if: always()  # Run test even if linting fails.
+  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR test
+
+# Local Variables:
+# eval: (outline-minor-mode)
+# End:



[elpa] externals/plz 27010c20e1 45/81: Meta: Update makem.sh, etc.

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 27010c20e17aaed6f1e74ab7519578d57cdf9e19
Author: Adam Porter 
Commit: Adam Porter 

Meta: Update makem.sh, etc.
---
 .github/workflows/test.yml |  18 +--
 Makefile   |  23 ++--
 makem.sh   | 303 +
 3 files changed, 279 insertions(+), 65 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 29560acca1..e84deac3c2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,6 +1,9 @@
 # * test.yml --- Test Emacs packages using makem.sh on GitHub Actions
 
-# https://github.com/alphapapa/makem.sh
+# URL: https://github.com/alphapapa/makem.sh
+# Version: 0.5
+
+# * Commentary:
 
 # Based on Steve Purcell's examples at
 # 
,
@@ -28,8 +31,8 @@ on:
   pull_request:
   push:
 # Comment out this section to enable testing of all branches.
-# branches:
-#   - master
+branches:
+  - master
 
 jobs:
   build:
@@ -39,6 +42,7 @@ jobs:
   matrix:
 emacs_version:
   - 26.3
+  - 27.1
   - snapshot
 steps:
 - uses: purcell/setup-emacs@master
@@ -50,8 +54,8 @@ jobs:
 - name: Initialize sandbox
   run: |
 SANDBOX_DIR=$(mktemp -d) || exit 1
-echo ::set-env name=SANDBOX_DIR::$SANDBOX_DIR
-./makem.sh -vv --sandbox-dir=$SANDBOX_DIR --install-deps 
--install-linters
+echo "SANDBOX_DIR=$SANDBOX_DIR" >> $GITHUB_ENV
+./makem.sh -vv --sandbox=$SANDBOX_DIR --install-deps --install-linters
 
 # The "all" rule is not used, because it treats compilation warnings
 # as failures, so linting and testing are run as separate steps.
@@ -60,11 +64,11 @@ jobs:
   # NOTE: Uncomment this line to treat lint failures as passing
   #   so the job doesn't show failure.
   # continue-on-error: true
-  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR lint
+  run: ./makem.sh -vv --sandbox=$SANDBOX_DIR lint
 
 - name: Test
   if: always()  # Run test even if linting fails.
-  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR test
+  run: ./makem.sh -vv --sandbox=$SANDBOX_DIR test
 
 # Local Variables:
 # eval: (outline-minor-mode)
diff --git a/Makefile b/Makefile
index 1ca3da4b8e..64c4516119 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
 # * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp 
packages
 
-# This Makefile is from the makem.sh repo: 
.
+# URL: https://github.com/alphapapa/makem.sh
+# Version: 0.5
 
 # * Arguments
 
@@ -19,11 +20,11 @@ ifdef install-linters
 endif
 
 ifdef sandbox
-   SANDBOX = "--sandbox"
-endif
-
-ifdef sandbox-dir
-   SANDBOX_DIR = "--sandbox-dir" "$(sandbox-dir)"
+   ifeq ($(sandbox), t)
+   SANDBOX = --sandbox
+   else
+   SANDBOX = --sandbox=$(sandbox)
+   endif
 endif
 
 ifdef debug
@@ -37,7 +38,9 @@ endif
 
 verbose = $(v)
 
-ifneq (,$(findstring vv,$(verbose)))
+ifneq (,$(findstring vvv,$(verbose)))
+   VERBOSE = "-vvv"
+else ifneq (,$(findstring vv,$(verbose)))
VERBOSE = "-vv"
 else ifneq (,$(findstring v,$(verbose)))
VERBOSE = "-v"
@@ -49,4 +52,8 @@ endif
 # directory by that name exists, which can confuse Make.
 
 %:
-   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(SANDBOX_DIR) 
$(INSTALL_DEPS) $(INSTALL_LINTERS) $(@)
+   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) 
$(INSTALL_LINTERS) $(@)
+
+.DEFAULT: init
+init:
+   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) 
$(INSTALL_LINTERS)
diff --git a/makem.sh b/makem.sh
index 060bf19f15..d1a5edba8f 100755
--- a/makem.sh
+++ b/makem.sh
@@ -2,7 +2,8 @@
 
 # * makem.sh --- Script to aid building and testing Emacs Lisp packages
 
-# https://github.com/alphapapa/makem.sh
+# URL: https://github.com/alphapapa/makem.sh
+# Version: 0.5
 
 # * Commentary:
 
@@ -60,6 +61,7 @@ Rules:
   lint-checkdoc  Run checkdoc.
   lint-compile   Byte-compile source files with warnings as errors.
   lint-declare   Run check-declare.
+  lint-elsa  Run Elsa (not included in "lint" rule).
   lint-indentLint indentation.
   lint-package   Run package-lint.
   lint-regexps   Run relint.
@@ -77,7 +79,8 @@ Rules:
 Options:
   -d, --debugPrint debug info.
   -h, --help I need somebody!
-  -v, --verbose  Increase verbosity, up to -vv.
+  -v, --verbose  Increase verbosity, up to -vvv.
+  --no-color Disable color output.
 
   --debug-load-path  Print load-path from inside Emacs.
 
@@ -86,22 +89,29 @@ Options:
   -e, --exclude FILE  Exclude FILE from linting and testing.
   -f, --file FILE Check FILE in addition to discovered files.
 
-  --no-colorDisable color output.
-  -C, --no-compile  Don't compile files automatically.
+  -c, --compile-batch  Batch-compile files (instead of separately; quicker, but
+

[elpa] externals/plz c7c16e2123 04/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit c7c16e2123d8bc71898f11717fe7e643b4d39924
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 LICENSE  | 674 +++
 Makefile |  17 ++
 makem.sh | 554 +++
 plz.el   |  60 --
 4 files changed, 1290 insertions(+), 15 deletions(-)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00..94a9ed024d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Pro

[elpa] externals/plz 6f8dfb83de 34/81: Tests: (plz-test-get-response) Change to macro

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 6f8dfb83deeaec7b25f184522a6e301f5add64ba
Author: Adam Porter 
Commit: Adam Porter 

Tests: (plz-test-get-response) Change to macro

Not sure why these two tests are failing on CI but passing locally.
Testing each part individually should help.
---
 tests/test-plz.el | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 66d5928750..17070866e7 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -51,16 +51,16 @@
 
  Functions
 
-(defun plz-test-get-response (response)
-  "Return non-nil if RESPONSE seems to be a correct GET response."
-  (and (plz-response-p response)
-   (numberp (plz-response-version response))
-   (eq 200 (plz-response-status response))
-   (equal "application/json" (alist-get "Content-Type" 
(plz-response-headers response) nil nil #'equal))
-   (let* ((json (json-read-from-string (plz-response-body response)))
-  (headers (alist-get 'headers json))
-  (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
- (string-match "curl" user-agent
+(defmacro plz-test-get-response (response)
+  "Test parts of RESPONSE with `should'."
+  `(and (should (plz-response-p ,response))
+(should (numberp (plz-response-version ,response)))
+(should (eq 200 (plz-response-status ,response)))
+(should (equal "application/json" (alist-get "Content-Type" 
(plz-response-headers ,response) nil nil #'equal)))
+(let* ((json (json-read-from-string (plz-response-body ,response)))
+   (headers (alist-get 'headers json))
+   (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
+  (should (string-match "curl" user-agent)
 
  Tests
 
@@ -93,7 +93,7 @@
 :then (lambda (response)
 (setf test-response response)
 (plz-test-wait process)
-(should (plz-test-get-response test-response
+(plz-test-get-response test-response)))
 
 (ert-deftest plz-get-json nil
   (let* ((test-json)
@@ -113,8 +113,8 @@
   (should (string-match "curl" (plz-get-sync "https://httpbin.org/get";
 
 (ert-deftest plz-get-response-sync nil
-  (should (plz-test-get-response (plz-get-sync "https://httpbin.org/get";
-   :as 'response
+  (plz-test-get-response (plz-get-sync "https://httpbin.org/get";
+   :as 'response)))
 
 (ert-deftest plz-get-json-sync nil
   (let-alist (plz-get-sync "https://httpbin.org/get";



[elpa] externals/plz 44e6f02064 17/81: Binary content

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 44e6f02064afb36559f968081a3ba1e612a72ea8
Author: Adam Porter 
Commit: Adam Porter 

Binary content
---
 plz.el| 12 
 tests/test-plz.el | 24 
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/plz.el b/plz.el
index 51cf529446..5cb53f7cbb 100644
--- a/plz.el
+++ b/plz.el
@@ -190,7 +190,7 @@
 
 (cl-defun plz-get (url &key headers as then else
(connect-timeout plz-connect-timeout)
-   (decode t))
+   (decode t decode-s))
   "Get HTTP URL with curl.
 
 AS selects the kind of result to pass to the callback function
@@ -203,6 +203,7 @@ THEN.  It may be:
   narrowed to the response body (suitable for, e.g. `json-read').
 
 If DECODE is non-nil, the response body is decoded automatically.
+For binary content, it should be nil.
 
 THEN is a callback function, whose sole argument is selected
 above with AS.
@@ -220,12 +221,13 @@ the initial connection attempt."
   (plz--curl 'get url
  :headers headers
  :connect-timeout connect-timeout
- :decode decode
+ :decode (cond ((and decode-s (not decode)) nil)
+   (t decode))
  :as as :then then :else else))
 
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
-(decode t))
+(decode t decode-s))
   "Get HTTP URL with curl synchronously.
 
 AS selects the kind of result to return.  It may be:
@@ -236,6 +238,7 @@ AS selects the kind of result to return.  It may be:
   narrowed to the response body (suitable for, e.g. `json-read').
 
 If DECODE is non-nil, the response body is decoded automatically.
+For binary content, it should be nil.
 
 If the request fails, an error is signaled, either
 `plz-curl-error' or `plz-http-error', as appropriate, with a
@@ -248,7 +251,8 @@ the initial connection attempt."
   (plz--curl-sync 'get url
   :headers headers
   :connect-timeout connect-timeout
-  :decode decode
+  :decode (cond ((and decode-s (not decode)) nil)
+(t decode))
   :as as))
 
 ; Private
diff --git a/tests/test-plz.el b/tests/test-plz.el
index a5d468a399..071730e8cf 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -40,6 +40,14 @@
  Commands
 
 
+ Macros
+
+(cl-defmacro plz-test-wait (process &optional (seconds 0.1) (times 100))
+  "Wait for SECONDS seconds TIMES times for PROCESS to finish."
+  `(cl-loop for i upto ,times ;; 10 seconds
+while (equal 'run (process-status ,process))
+do (sleep-for ,seconds)))
+
  Functions
 
 (defun plz-test-get-response (response)
@@ -147,6 +155,22 @@
  (plz-response-p (plz-error-response (cdr err)))
  (eq 404 (plz-response-status (plz-error-response (cdr 
err
 
+; Binary
+
+(ert-deftest plz-test-get-jpeg ()
+  (let ((jpeg (plz-get-sync "https://httpbin.org/image/jpeg";
+:decode nil)))
+(should (image-jpeg-p jpeg)))
+
+  (let* ((test-jpeg)
+ (process (plz-get "https://httpbin.org/image/jpeg";
+:decode nil
+:as 'string
+:then (lambda (string)
+(setf test-jpeg string)
+(plz-test-wait process)
+(should (image-jpeg-p test-jpeg
+
  Footer
 
 (provide 'test-plz)



[elpa] externals/plz debfc864c8 08/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit debfc864c87b4406c4bf0ff9660bd58aa31679a3
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 .gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index c531d9867f..0753206d74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 *.elc
+/scratch.el
+.#*



[elpa] externals/plz fbdcd69950 09/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit fbdcd699508837a3b5309516d803df05cc2f618c
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 plz.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plz.el b/plz.el
index 3b256f56a0..e8acf3dde0 100644
--- a/plz.el
+++ b/plz.el
@@ -28,7 +28,7 @@
 ;; An HTTP library that uses curl as a backend.  Inspired by, and some
 ;; code copied from, Christopher Wellons's library, elfeed-curl.el.
 ;;
-;; * Why this package?
+;; Why this package?
 ;;
 ;; 1.  `url' works well for many things, but it has some issues (and have
 ;; you seen its code?).
@@ -37,7 +37,7 @@
 ;; 3.  Chris Wellons doesn't have time to factor his excellent
 ;; elfeed-curl.el library out of Elfeed.  This will have to do.
 ;;
-;; * Why is it called `plz'?
+;; Why is it called `plz'?
 ;;
 ;; 1.  There's already a package called `http'.
 ;; 2.  There's already a package called `request'.



[elpa] externals/plz f12f907719 52/81: Change/Fix: (plz--curl) Disable Expect header

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit f12f907719e01ccb0793552a573c361c9e6a39bd
Author: Adam Porter 
Commit: Adam Porter 

Change/Fix: (plz--curl) Disable Expect header

Prevents curl from implicitly sending that header for PUT requests and
POST requests >1KB (which causes the server to send a "HTTP 100
Continue" response, which we don't want to deal with now).
---
 plz.el | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/plz.el b/plz.el
index 30f4737369..c7b50b667d 100644
--- a/plz.el
+++ b/plz.el
@@ -390,6 +390,13 @@ the initial connection attempt.
 
 NOQUERY is passed to `make-process', which see."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
+
+  ;; NOTE: By default, for PUT requests and POST requests >1KB, curl sends an
+  ;; "Expect:" header, which causes servers to send a "100 Continue" response, 
which
+  ;; we don't want to have to deal with, so we disable it by setting the 
header to
+  ;; the empty string.  See .
+  ;; TODO: Handle "100 Continue" responses and remove this workaround.
+  (push (cons "Expect" "") headers)
   (let* ((header-args (cl-loop for (key . value) in headers
append (list "--header" (format "%s: %s" key 
value
  (curl-args (append plz-curl-default-args header-args



[elpa] externals/plz 3cc6747035 28/81: Meta: Add comm keyword

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 3cc67470359ddbdbff5604ff146788bd9d569084
Author: Adam Porter 
Commit: Adam Porter 

Meta: Add comm keyword
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 92e3f2f443..3667270685 100644
--- a/plz.el
+++ b/plz.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/alphapapa/plz.el
 ;; Version: 0.1-pre
 ;; Package-Requires: ((emacs "26.3"))
-;; Keywords: network, http
+;; Keywords: comm, network, http
 
 ;;; License:
 



[elpa] externals/plz 971077e1d3 23/81: Tests

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 971077e1d35af168791b9cab69916b8158835104
Author: Adam Porter 
Commit: Adam Porter 

Tests
---
 tests/test-plz.el | 24 
 1 file changed, 24 insertions(+)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index c93ec8e904..da925df0cb 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -129,6 +129,18 @@
 ; Errors
 
 (ert-deftest plz-get-curl-error nil
+  ;; Async.
+  (let* ((err)
+ (process (plz-get "https://httpbinn.org/get/status/404";
+:as 'string
+:else (lambda (e)
+(setf err e)
+(plz-test-wait process)
+(should (and (plz-error-p err)
+ (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.")
+(plz-error-curl-error err)
+
+  ;; Sync.
   (let ((err (should-error (plz-get-sync 
"https://httpbinn.org/get/status/404";
  :as 'string)
:type 'plz-curl-error)))
@@ -138,6 +150,18 @@
 (plz-error-curl-error (cdr err)))
 
 (ert-deftest plz-get-404-error nil
+  ;; Async.
+  (let* ((err)
+ (process (plz-get "https://httpbin.org/get/status/404";
+:as 'string
+:else (lambda (e)
+(setf err e)
+(plz-test-wait process)
+(should (and (plz-error-p err)
+ (plz-response-p (plz-error-response err))
+ (eq 404 (plz-response-status (plz-error-response err))
+
+  ;; Sync.
   (let ((err (should-error (plz-get-sync "https://httpbin.org/get/status/404";
  :as 'string)
:type 'plz-http-error)))



[elpa] externals/plz b77283748b 31/81: Meta: Update makem.sh

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit b77283748b212f32dec9aa17feec2093aace6c33
Author: Adam Porter 
Commit: Adam Porter 

Meta: Update makem.sh
---
 .github/workflows/test.yml |  16 +-
 Makefile   |  13 +-
 makem.sh   | 626 ++---
 3 files changed, 495 insertions(+), 160 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 11428d808e..b3c22ed9dc 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -47,21 +47,19 @@ jobs:
 
 - uses: actions/checkout@v2
 
-- name: Install sandbox script
-  run: |
-curl -o $GITHUB_WORKSPACE/emacs-sandbox.sh \
-  
https://raw.githubusercontent.com/alphapapa/emacs-sandbox.sh/master/emacs-sandbox.sh
-chmod +x $GITHUB_WORKSPACE/emacs-sandbox.sh
-echo ::add-path::$GITHUB_WORKSPACE
-echo ::set-env name=SANDBOX_DIR::$(mktemp -d)
-
 - name: Initialize sandbox
-  run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR --auto-install --install 
package-lint
+  run: |
+SANDBOX_DIR=$(mktemp -d) || exit 1
+echo ::set-env name=SANDBOX_DIR::$SANDBOX_DIR
+./makem.sh -vv --sandbox-dir=$SANDBOX_DIR --install-deps 
--install-linters
 
 # The "all" rule is not used, because it treats compilation warnings
 # as failures, so linting and testing are run as separate steps.
 
 - name: Lint
+  # NOTE: Uncomment this line to treat lint failures as passing
+  #   so the job doesn't show failure.
+  # continue-on-error: true
   run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR lint
 
 - name: Test
diff --git a/Makefile b/Makefile
index 5000738761..1ca3da4b8e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+# * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp 
packages
+
+# This Makefile is from the makem.sh repo: 
.
+
 # * Arguments
 
 # For consistency, we use only var=val options, not hyphen-prefixed options.
@@ -7,8 +11,11 @@
 # conflict with Make's own arguments through Make to the script.
 # Using -- doesn't seem to do it.
 
-ifdef auto-install
-   AUTO_INSTALL = "--auto-install"
+ifdef install-deps
+   INSTALL_DEPS = "--install-deps"
+endif
+ifdef install-linters
+   INSTALL_LINTERS = "--install-linters"
 endif
 
 ifdef sandbox
@@ -42,4 +49,4 @@ endif
 # directory by that name exists, which can confuse Make.
 
 %:
-   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(SANDBOX_DIR) 
$(AUTO_INSTALL) $(@)
+   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(SANDBOX_DIR) 
$(INSTALL_DEPS) $(INSTALL_LINTERS) $(@)
diff --git a/makem.sh b/makem.sh
index 40c49c5a2b..060bf19f15 100755
--- a/makem.sh
+++ b/makem.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # * makem.sh --- Script to aid building and testing Emacs Lisp packages
 
@@ -21,13 +21,11 @@
 # occur.  With increasing verbosity levels, more detail gives positive
 # feedback.  Output is colored by default to make reading easy.
 
-# When desired, emacs-sandbox.sh can be used as a backend, which
-# allows package dependencies to be installed automatically into a
-# clean Emacs "sandbox" configuration without affecting the
-# developer's personal configuration.  This is especially helpful when
+# The script can run Emacs with the developer's local Emacs
+# configuration, or with a clean, "sandbox" configuration that can be
+# optionally removed afterward.  This is especially helpful when
 # upstream dependencies may have released new versions that differ
-# from those installed in the developer's personal configuration.  See
-# .
+# from those installed in the developer's personal configuration.
 
 # * License:
 
@@ -50,46 +48,60 @@ function usage {
 cat .
-
-  -s, --sandbox  Run Emacs with emacs-sandbox.sh in a temporary
- directory (removing directory on exit).
-  -S, --sandbox-dir DIR  Use DIR for the sandbox directory (leaving it
- on exit).  Implies -s.
-  --auto-install Automatically install package dependencies.
+  -s, --sandbox  Run Emacs with an empty config in a temporary
+ sandbox directory (removing directory on exit).
+  -S, --sandbox-dir DIR  Run Emacs with DIR as persistent sandbox directory.
+ Makes an Emacs version-specific subdirectory, which
+ facilitates testing under multiple Emacs versions.
+  --install-deps Automatically install package dependencies.
+  --install-linters  Automatically install linters.
   -i, --install PACKAGE  Install PACKAGE before running rules.
 
 Source files are automatically discovered from git, or may be
-specified with options.
-
-Package dependencies are discovered from "Package-Requires" headers in
-source files and from a Cask file.
+specifie

[elpa] externals/plz 897c5bbfb2 13/81: Improvements, error handling

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 897c5bbfb2dc97c910dffb35d73e1e63b104b37d
Author: Adam Porter 
Commit: Adam Porter 

Improvements, error handling
---
 plz.el| 69 +++
 tests/test-plz.el | 22 +-
 2 files changed, 70 insertions(+), 21 deletions(-)

diff --git a/plz.el b/plz.el
index d744e1b76b..0b189d07b9 100644
--- a/plz.el
+++ b/plz.el
@@ -51,13 +51,27 @@
 (require 'rx)
 (require 'subr-x)
 
+ Errors
+
+;; FIXME: `condition-case' can't catch these...?
+(define-error 'plz-curl-error "Curl error")
+(define-error 'plz-http-error "HTTP error")
+
  Structs
 
 (cl-defstruct plz-response
   version status headers body)
 
+(cl-defstruct plz-error
+  curl-error response)
+
  Constants
 
+(defconst plz-http-response-status-line-regexp
+  (rx "HTTP/" (group (1+ (or digit "."))) (1+ blank)
+  (group (1+ digit)))
+  "Regular expression matching HTTP response status line.")
+
 (defconst plz-curl-errors
   ;; Copied from elfeed-curl.el.
   '((1 . "Unsupported protocol.")
@@ -172,7 +186,7 @@
 
  Functions
 
-(cl-defun plz-get (url &key headers as then
+(cl-defun plz-get (url &key headers as then else
(connect-timeout plz-connect-timeout)
(decode t))
   "Get HTTP URL with curl.
@@ -187,7 +201,7 @@ the initial connection attempt."
 :headers headers
 :connect-timeout connect-timeout
 :decode decode
-:as as :then then))
+:as as :then then :else else))
 
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
@@ -207,7 +221,7 @@ the initial connection attempt."
  :as as))
 
 (cl-defun plz--request (_method url &key headers connect-timeout
-decode as then)
+decode as then else)
   "Return curl process for HTTP request to URL.
 
 FIXME: Docstring.
@@ -216,9 +230,7 @@ HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
 the initial connection attempt."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
-  (let* ((coding-system-for-read 'binary)
- (process-connection-type nil)
- (header-args (cl-loop for (key . value) in headers
+  (let* ((header-args (cl-loop for (key . value) in headers
collect (format "--header %s: %s" key value)))
  (curl-args (append plz-curl-default-args header-args
 (when connect-timeout
@@ -227,6 +239,7 @@ the initial connection attempt."
 (with-current-buffer (generate-new-buffer " *plz-request-curl*")
   (let ((process (make-process :name "plz-request-curl"
:buffer (current-buffer)
+   :coding 'binary
:command (append (list plz-curl-program) 
curl-args)
:connection-type 'pipe
:sentinel #'plz--sentinel
@@ -249,7 +262,8 @@ the initial connection attempt."
   (when decode
 (decode-coding-region (point) 
(point-max) coding-system))
   (funcall then (funcall as
-(setf plz-then then)
+(setf plz-then then
+  plz-else else)
 process
 
 (cl-defun plz--request-sync (_method url &key headers connect-timeout
@@ -305,26 +319,41 @@ node `(elisp) Sentinels').  Kills the buffer before 
returning."
 (with-current-buffer buffer
   (pcase status
 ((or 0 "finished\n")
- ;; Request completed successfully: call THEN.
- (funcall plz-then))
-
-;; FIXME: Implement error callback handling.
-((rx "exited abnormally with code " (group (1+ digit)))
- ;; Error: call error callback.
- (warn "plz--sentinel: ERROR: %s" (buffer-string))
- ;; (let* ((code (string-to-number (match-string 1 status)))
- ;;(message (alist-get code plz-curl-errors)))
- ;;   (funcall plz-error (plz--response buffer)))
- )))
+ ;; Curl exited normally: check HTTP status code.
+ (pcase (plz--http-status)
+   (200 (funcall plz-then))
+   (_ (let ((err (make-plz-error :response (plz--response
+(pcase-exhaustive plz-else
+  (`nil (signal 'plz-http-error err))
+  ((pred functionp) (funcall plz-else err)))
+
+((or (and (pred numberp) code)
+ (rx "exited abnormally with code " (let code (group (1+ 
digit)
+ ;; Curl error.
+ (let* ((curl-exit-code (cl-typecase code
+

[elpa] externals/plz 701e79c3e8 55/81: Tidy: Remove obsolete functions

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 701e79c3e8bcfe7d403ea772b274cf53c5ac32af
Author: Adam Porter 
Commit: Adam Porter 

Tidy: Remove obsolete functions
---
 plz.el | 81 --
 1 file changed, 81 deletions(-)

diff --git a/plz.el b/plz.el
index e547a7f85f..680aadd73d 100644
--- a/plz.el
+++ b/plz.el
@@ -192,87 +192,6 @@ It is called without arguments outside the curl process 
buffer.")
 
 ; Public
 
-(cl-defun plz-get (url &key headers as then else noquery
-   (connect-timeout plz-connect-timeout)
-   (decode t decode-s))
-  "Get HTTP URL with curl.
-
-AS selects the kind of result to pass to the callback function
-THEN.  It may be:
-
-- `buffer' to pass the response buffer.
-- `binary' to pass the response body as an undecoded string.
-- `string' to pass the response body as a decoded string.
-- `response' to pass a `plz-response' struct.
-- A function, which is called in the response buffer with it
-  narrowed to the response body (suitable for, e.g. `json-read').
-
-If DECODE is non-nil, the response body is decoded automatically.
-For binary content, it should be nil.  When AS is `binary',
-DECODE is automatically set to nil.
-
-THEN is a callback function, whose sole argument is selected
-above with AS.
-
-ELSE is an optional callback function called when the request
-fails with one argument, a `plz-error' struct.  If ELSE is nil,
-an error is signaled when the request fails, either
-`plz-curl-error' or `plz-http-error' as appropriate, with a
-`plz-error' struct as the error data.
-
-HEADERS may be an alist of extra headers to send with the
-request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt.
-
-NOQUERY is passed to `make-process', which see."
-  (declare (indent defun))
-  (plz--curl 'get url
- :headers headers
- :connect-timeout connect-timeout
- :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else :noquery noquery))
-
-(cl-defun plz-put (url body &key headers as then else noquery
-   (connect-timeout plz-connect-timeout)
-   (decode t decode-s))
-  "PUT BODY to URL with curl.
-
-AS selects the kind of result to pass to the callback function
-THEN.  It may be:
-
-- `buffer' to pass the response buffer.
-- `binary' to pass the response body as an undecoded string.
-- `string' to pass the response body as a decoded string.
-- `response' to pass a `plz-response' struct.
-- A function, which is called in the response buffer with it
-  narrowed to the response body (suitable for, e.g. `json-read').
-
-If DECODE is non-nil, the response body is decoded automatically.
-For binary content, it should be nil.  When AS is `binary',
-DECODE is automatically set to nil.
-
-THEN is a callback function, whose sole argument is selected
-above with AS.
-
-ELSE is an optional callback function called when the request
-fails with one argument, a `plz-error' struct.  If ELSE is nil,
-an error is signaled when the request fails, either
-`plz-curl-error' or `plz-http-error' as appropriate, with a
-`plz-error' struct as the error data.
-
-HEADERS may be an alist of extra headers to send with the
-request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt.
-
-NOQUERY is passed to `make-process', which see."
-  (declare (indent defun))
-  (plz--curl 'put url
- :body body
- :headers headers
- :connect-timeout connect-timeout
- :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else :noquery noquery))
-
 (cl-defun plz (method url &key headers body as then else finally noquery
   (body-type 'text)
   (connect-timeout plz-connect-timeout)



[elpa] externals/plz f40d3ecbdd 47/81: Add/Change: :noquery argument for make-process

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit f40d3ecbddcc49325033ce73ad7d080daba254e6
Author: Adam Porter 
Commit: Adam Porter 

Add/Change: :noquery argument for make-process
---
 plz.el | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/plz.el b/plz.el
index cc23f0e29e..100015bb7a 100644
--- a/plz.el
+++ b/plz.el
@@ -192,7 +192,7 @@ It is called without arguments outside the curl process 
buffer.")
 
 ; Public
 
-(cl-defun plz-get (url &key headers as then else
+(cl-defun plz-get (url &key headers as then else noquery
(connect-timeout plz-connect-timeout)
(decode t decode-s))
   "Get HTTP URL with curl.
@@ -222,15 +222,17 @@ an error is signaled when the request fails, either
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt."
+the initial connection attempt.
+
+NOQUERY is passed to `make-process', which see."
   (declare (indent defun))
   (plz--curl 'get url
  :headers headers
  :connect-timeout connect-timeout
  :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else))
+ :as as :then then :else else :noquery noquery))
 
-(cl-defun plz-put (url body &key headers as then else
+(cl-defun plz-put (url body &key headers as then else noquery
(connect-timeout plz-connect-timeout)
(decode t decode-s))
   "PUT BODY to URL with curl.
@@ -260,16 +262,18 @@ an error is signaled when the request fails, either
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt."
+the initial connection attempt.
+
+NOQUERY is passed to `make-process', which see."
   (declare (indent defun))
   (plz--curl 'put url
  :body body
  :headers headers
  :connect-timeout connect-timeout
  :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else))
+ :as as :then then :else else :noquery noquery))
 
-(cl-defun plz (method url &key headers body as then else finally
+(cl-defun plz (method url &key headers body as then else finally noquery
   (connect-timeout plz-connect-timeout)
   (decode t decode-s))
   "Request BODY with METHOD to URL with curl.
@@ -302,14 +306,16 @@ THEN or ELSE, as appropriate.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt."
+the initial connection attempt.
+
+NOQUERY is passed to `make-process', which see."
   (declare (indent defun))
   (plz--curl method url
  :body body
  :headers headers
  :connect-timeout connect-timeout
  :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else :finally finally))
+ :as as :then then :else else :finally finally :noquery noquery))
 
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
@@ -349,7 +355,7 @@ the initial connection attempt."
 ;; Functions for calling and handling curl processes.
 
 (cl-defun plz--curl (method url &key body headers connect-timeout
-decode as then else finally)
+decode as then else finally noquery)
   "Make HTTP METHOD request to URL with curl.
 
 AS selects the kind of result to pass to the callback function
@@ -380,7 +386,9 @@ BODY may be a string or buffer to send as the request body.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt."
+the initial connection attempt.
+
+NOQUERY is passed to `make-process', which see."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
   (let* ((header-args (cl-loop for (key . value) in headers
append (list "--header" (format "%s: %s" key 
value
@@ -402,7 +410,8 @@ the initial connection attempt."
:command (append (list plz-curl-program) 
curl-args)
:connection-type 'pipe
:sentinel #'plz--sentinel
-   :stderr (current-buffer)))
+   :stderr (current-buffer)
+   :noquery noquery))
 ;; The THEN function is called in the response buffer.
 (then (pcase-exhaustive as
 ((or 'binary 'string)



[elpa] externals/plz 33438b7105 35/81: CI: Enable testing of all branches

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 33438b71051869c9d2960a44bc0c658b932ec307
Author: Adam Porter 
Commit: Adam Porter 

CI: Enable testing of all branches
---
 .github/workflows/test.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b3c22ed9dc..29560acca1 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -28,8 +28,8 @@ on:
   pull_request:
   push:
 # Comment out this section to enable testing of all branches.
-branches:
-  - master
+# branches:
+#   - master
 
 jobs:
   build:



[elpa] externals/plz 2b7944e0f9 05/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 2b7944e0f926b20672ccc90c8c55edac3dd7e953
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 plz.el | 58 ++
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/plz.el b/plz.el
index 15bf49a055..2d6471c47e 100644
--- a/plz.el
+++ b/plz.el
@@ -3,7 +3,12 @@
 ;; Copyright (C) 2019  Adam Porter
 
 ;; Author: Adam Porter 
-;; Keywords:
+;; URL: https://github.com/alphapapa/plz.el
+;; Version: 0.1-pre
+;; Package-Requires: ((emacs "26.3"))
+;; Keywords: network, http
+
+;;; 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
@@ -145,7 +150,8 @@
 
 (defgroup plz nil
   "Options for `plz'."
-  :group 'network)
+  :group 'network
+  :link '(url-link "https://github.com/alphapapa/plz.el";))
 
 (defcustom plz-curl-program "curl"
   "Name of curl program to call."
@@ -155,23 +161,17 @@
   '("--silent"
 "--compressed"
 "--location"
-;;  "--write-out" "(plz-curl-request . %%{size_header})"
+;; TODO: Move timeout to a defcustom and use a function to build args list.
 "--connect-timeout" "5"
 "--dump-header" "-")
   "Default arguments to curl."
   :type '(repeat string))
 
-;; (defcustom plz-curl-connection-timeout 5
-;;   "Default connection timeout for HTTP requests made with curl.
-;; The --connect-timeout option for curl.")
-
- Commands
-
-
  Functions
 
 (cl-defun plz-get (url &key headers _connect-timeout sync
success error)
+  ;; TODO: Handle connect-timeout argument.
   "Get HTTP URL with curl.
 If SYNC is non-nil, return the response object; otherwise, return
 the curl process object.
@@ -181,9 +181,7 @@ request.
 
 For asynchronous requests, SUCCESS and ERROR should be callback
 functions, called when the curl process finishes with a single
-argument: the `plz-response' object.
-
-"
+argument: the `plz-response' object."
   (plz--request 'get url
 :sync sync
 :headers headers
@@ -191,17 +189,18 @@ argument: the `plz-response' object.
 :success success
 :error error))
 
-(cl-defun plz-request-async (&rest args)
-  "FIXME: Docstring."
-  (apply #'plz--request args))
+(cl-defun plz--request (_method url &key headers _connect-timeout sync
+success error)
+  "Return process or response for HTTP request to URL.
+If SYNC is non-nil, return the response object; otherwise, return
+the curl process object.
 
-(cl-defun plz-request-sync (&rest args)
-  "FIXME: Docstring."
-  (apply #'plz--request :sync t args))
+HEADERS may be an alist of extra headers to send with the
+request.
 
-(cl-defun plz--request (_method url &key headers _connect-timeout sync
- success error)
-  "FIXME: Docstring."
+For asynchronous requests, SUCCESS and ERROR should be callback
+functions, called when the curl process finishes with a single
+argument: the `plz-response' object."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
   (let* ((coding-system-for-read 'binary)
  (process-connection-type nil)
@@ -209,12 +208,15 @@ argument: the `plz-response' object.
collect (format "--header %s: %s" key value)))
  (curl-args (append plz-curl-default-args header-args
 (list url
-(if sync
-(plz-request--sync curl-args :success success :error error)
-  (plz-request--async curl-args :success success :error error
+(pcase sync
+  (`nil (plz-request--async curl-args :success success :error error))
+  (_ (plz-request--sync curl-args :success success :error error)
 
 (cl-defun plz-request--async (curl-args &key success error)
-  "FIXME: Docstring."
+  "Return process object for curl called with CURL-ARGS.
+SUCCESS and ERROR should be callback functions, called when the
+curl process finishes with a single argument: the `plz-response'
+object.  Uses `make-process' to call curl asynchronously."
   (with-current-buffer (generate-new-buffer "*plz-request-curl*")
 (let ((process (make-process :name "plz-request-curl"
  :buffer (current-buffer)
@@ -227,7 +229,8 @@ argument: the `plz-response' object.
   process)))
 
 (cl-defun plz-request--sync (curl-args &key success error)
-  "FIXME: Docstring."
+  "Return HTTP response object for curl called with CURL-ARGS.
+Uses `call-process' to call curl synchronously."
   (with-current-buffer (generate-new-buffer "*plz-request-curl*")
 (let ((status (apply #'call-process plz-curl-program nil t nil
  curl-args))
@@ -306,7 +309,6 @@ Decodes with `decode-coding-region' according to 
CODING-SYSTEM."
   (re-search-forward "^\r\n" nil)
   (decode-coding-region (point) (point-max) coding-system t
 
-
  Footer
 
 (provide 'plz)



[elpa] externals/plz 4f74be6565 30/81: Notes: Add idea

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 4f74be656502aa6ea779ea82fa4a810629151abd
Author: Adam Porter 
Commit: Adam Porter 

Notes: Add idea
---
 notes.org | 9 +
 1 file changed, 9 insertions(+)

diff --git a/notes.org b/notes.org
index 625db5a0a7..f967b97a3d 100644
--- a/notes.org
+++ b/notes.org
@@ -71,6 +71,15 @@ Assuming that =plz= has already called 
=decode-coding-region=, this is straightf
 
 *** HTTP response with headers
 
+* Ideas
+
+** 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.
+
 * References
 
 ** Similar projects



[elpa] externals/plz 1884d038ae 46/81: Notes: Add note about Lars Ingebrigtsen's with-url macro

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 1884d038ae67e8025df2211bca8072edb7f57b1c
Author: Adam Porter 
Commit: Adam Porter 

Notes: Add note about Lars Ingebrigtsen's with-url macro
---
 notes.org | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/notes.org b/notes.org
index d29b4d781d..52f1f93164 100644
--- a/notes.org
+++ b/notes.org
@@ -112,6 +112,12 @@ Assuming that =plz= has already called 
=decode-coding-region=, this is straightf
 :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 [...]
+
 ** Similar projects
 
 *** [[https://github.com/ebpa/fetch.el][GitHub - ebpa/fetch.el: A simple HTTP 
request library modeled after the web browser API]]



[elpa] externals/plz 05f93b0b6b 25/81: Meta: Update Makefile, makem.sh

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 05f93b0b6bcbb865aa6f8d2254c360c47e82b353
Author: Adam Porter 
Commit: Adam Porter 

Meta: Update Makefile, makem.sh
---
 Makefile |  32 +-
 makem.sh | 340 +++
 2 files changed, 264 insertions(+), 108 deletions(-)

diff --git a/Makefile b/Makefile
index 9be2568ad1..5000738761 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,29 @@
-# * Verbosity
+# * Arguments
+
+# For consistency, we use only var=val options, not hyphen-prefixed options.
+
+# NOTE: I don't like duplicating the arguments here and in makem.sh,
+# but I haven't been able to find a way to pass arguments which
+# conflict with Make's own arguments through Make to the script.
+# Using -- doesn't seem to do it.
+
+ifdef auto-install
+   AUTO_INSTALL = "--auto-install"
+endif
+
+ifdef sandbox
+   SANDBOX = "--sandbox"
+endif
+
+ifdef sandbox-dir
+   SANDBOX_DIR = "--sandbox-dir" "$(sandbox-dir)"
+endif
+
+ifdef debug
+   DEBUG = "--debug"
+endif
+
+# ** Verbosity
 
 # Since the "-v" in "make -v" gets intercepted by Make itself, we have
 # to use a variable.
@@ -13,5 +38,8 @@ endif
 
 # * Rules
 
+# TODO: Handle cases in which "test" or "tests" are called and a
+# directory by that name exists, which can confuse Make.
+
 %:
-   @./makem.sh $(VERBOSE) $(@)
+   @./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(SANDBOX_DIR) 
$(AUTO_INSTALL) $(@)
diff --git a/makem.sh b/makem.sh
index 67a92dbd5b..40c49c5a2b 100755
--- a/makem.sh
+++ b/makem.sh
@@ -2,8 +2,32 @@
 
 # * makem.sh --- Script to aid building and testing Emacs Lisp packages
 
+# https://github.com/alphapapa/makem.sh
+
 # * Commentary:
 
+# makem.sh is a script helps to build, lint, and test Emacs Lisp
+# packages.  It aims to make linting and testing as simple as possible
+# without requiring per-package configuration.
+
+# It works similarly to a Makefile in that "rules" are called to
+# perform actions such as byte-compiling, linting, testing, etc.
+
+# Source and test files are discovered automatically from the
+# project's Git repo, and package dependencies within them are parsed
+# automatically.
+
+# Output is simple: by default, there is no output unless errors
+# occur.  With increasing verbosity levels, more detail gives positive
+# feedback.  Output is colored by default to make reading easy.
+
+# When desired, emacs-sandbox.sh can be used as a backend, which
+# allows package dependencies to be installed automatically into a
+# clean Emacs "sandbox" configuration without affecting the
+# developer's personal configuration.  This is especially helpful when
+# upstream dependencies may have released new versions that differ
+# from those installed in the developer's personal configuration.  See
+# .
 
 # * License:
 
@@ -20,63 +44,56 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .
 
-# * Safety
-
-# NOTE: These are disabled by default in this template but should be
-# enabled when feasible.  Documentation is from the Bash man page.
+# * Functions
 
-# ** errexit
+function usage {
+cat .
 
-# ** pipefail
+  -s, --sandbox  Run Emacs with emacs-sandbox.sh in a temporary
+ directory (removing directory on exit).
+  -S, --sandbox-dir DIR  Use DIR for the sandbox directory (leaving it
+ on exit).  Implies -s.
+  --auto-install Automatically install package dependencies.
+  -i, --install PACKAGE  Install PACKAGE before running rules.
 
-# If set, the return value of a pipeline is the value of the last
-# (rightmost) command to exit with a non-zero status, or zero if all
-# commands in the pipeline exit successfully.  This option is disabled
-# by default.
+Source files are automatically discovered from git, or may be
+specified with options.
 
-# set -o pipefail
+Package dependencies are discovered from "Package-Requires" headers in
+source files and from a Cask file.
+EOF
+}
 
-# * Elisp
+# ** Elisp
 
 # These functions return a path to an elisp file which can be loaded
 # by Emacs on the command line with -l or --load.
@@ -140,26 +157,24 @@ EOF
 echo $file
 }
 
-# * Functions
-
 # ** Emacs
 
 function run_emacs {
-debug "run_emacs: emacs -Q --batch --load=$package_initialize_file -L 
\"$load_path\" $@"
+debug "run_emacs: $emacs_command -Q --batch 
--load=$package_initialize_file -L \"$load_path\" $@"
 if [[ $debug_load_path ]]
 then
-debug $(emacs -Q --batch \
-  --load=$package_initialize_file \
-  -L "$load_path" \
-  --eval "(message \"LOAD-PATH: %s\" load-path)" \
-  2>&1)
+debug $($emacs_command -Q --batch \
+   --load=$package_initialize_file \
+ 

[elpa] externals/plz 19a0110109 33/81: Notes: Add ToC

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 19a0110109fb0cfe80371dc8595b7e44ada39c96
Author: Adam Porter 
Commit: Adam Porter 

Notes: Add ToC
---
 notes.org | 39 ++-
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/notes.org b/notes.org
index f967b97a3d..73afb586dd 100644
--- a/notes.org
+++ b/notes.org
@@ -1,5 +1,32 @@
 #+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
+
+** TODO Ensure that secrets are not leaked via command line or temp files
+
+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.
+
+* Ideas
+
+** 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
@@ -71,16 +98,10 @@ Assuming that =plz= has already called 
=decode-coding-region=, this is straightf
 
 *** HTTP response with headers
 
-* Ideas
-
-** 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.
-
 * References
+:PROPERTIES:
+:TOC:  :depth 1
+:END:
 
 ** Similar projects
 



[elpa] externals/plz 7478d43668 51/81: Revert "Add/Change: Handle LF-only HTTP responses"

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 7478d43668c916c71f2fa87560136031d55025c9
Author: Adam Porter 
Commit: Adam Porter 

Revert "Add/Change: Handle LF-only HTTP responses"

This reverts commit 8d2654bba7bfa11525aef50f969c489c20ac0a43.

The problem was not the line endings in the server's response, but
that I wasn't aware that curl was implicitly sending an "Expect"
header, causing the server to return an additional "HTTP 100 Continue"
response.  See .  In
the next commit, we tell curl to omit that header, so the server
doesn't do that, and we only parse one response.
---
 plz.el | 36 +---
 1 file changed, 5 insertions(+), 31 deletions(-)

diff --git a/plz.el b/plz.el
index 9734c4c454..30f4737369 100644
--- a/plz.el
+++ b/plz.el
@@ -559,9 +559,7 @@ according to the apparent coding system."
   (save-excursion
 (goto-char (point-min))
 ;; Parse HTTP version and status code.
-(unless (looking-at plz-http-response-status-line-regexp)
-  (error "Unable to parse HTTP response status line: %S"
- (substring-no-properties (buffer-string
+(looking-at plz-http-response-status-line-regexp)
 (let* ((http-version (string-to-number (match-string 1)))
(status-code (string-to-number (match-string 2)))
(headers (plz--headers))
@@ -586,14 +584,10 @@ refer to rather than the current buffer's unparsed 
headers."
 
 (defun plz--http-status ()
   "Return HTTP status code for HTTP response in current buffer."
-  ;; This function is used in the sentinel to get the HTTP response
-  ;; code without parsing the whole response.
   (save-excursion
 (goto-char (point-min))
-(unless (looking-at plz-http-response-status-line-regexp)
-  (error "Unable to parse HTTP response status line: %S"
- (substring-no-properties (buffer-string
-(string-to-number (match-string 2
+(when (looking-at plz-http-response-status-line-regexp)
+  (string-to-number (match-string 2)
 
 (defun plz--headers ()
   "Return headers alist for HTTP response in current buffer."
@@ -601,7 +595,7 @@ refer to rather than the current buffer's unparsed headers."
 (goto-char (point-min))
 (forward-line 1)
 (let ((limit (save-excursion
-   (plz--skip-headers)
+   (re-search-forward "^\r\n" nil)
(point
   (cl-loop while (re-search-forward (rx bol (group (1+ (not (in ":" 
":" (1+ blank)
 (group (1+ (not (in "\r\n")
@@ -613,30 +607,10 @@ refer to rather than the current buffer's unparsed 
headers."
;; use `alist-get' without having to add "nil nil #'equal" 
every time.
collect (cons (intern (downcase (match-string 1))) 
(match-string 2))
 
-(defun plz--skip-headers ()
-  "Move point past headers in current HTTP response buffer.
-It seems that some misbehaving HTTP servers use only LF line
-endings rather than the RFC 2616-mandated CRLF endings, so we
-must try to handle either."
-  ;; It seems that this is happening with some Cloudflare responses.   :(
-  ;; NOTE: For debugging purposes, I'm inserting these warnings for now.  If 
this is a solvable
-  ;; bug, or if I come to understand the issue better, they could be removed 
or disabled.
-  (condition-case _err
-  (re-search-forward "^\r\n" nil)
-(search-failed ;; Try LF-only.
- (condition-case _err
- (progn
-   (re-search-forward "^\n" nil)
-   (display-warning 'plz (format "Only LF used after headers in HTTP 
response: %S"
- (substring-no-properties 
(buffer-string)
-   (search-failed
-(signal 'search-failed (format "Can't find end-of-headers in HTTP 
response: %S"
-   (substring-no-properties 
(buffer-string)
-
 (defun plz--narrow-to-body ()
   "Narrow to body of HTTP response in current buffer."
   (goto-char (point-min))
-  (plz--skip-headers)
+  (re-search-forward "^\r\n" nil)
   (narrow-to-region (point) (point-max)))
 
  Footer



[elpa] externals/plz a5f22b23e1 42/81: Add: (plz)

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit a5f22b23e182cd9365a6ccefdcb96b0ca51df374
Author: Adam Porter 
Commit: Adam Porter 

Add: (plz)

Not sure which I like better, but this works.
---
 plz.el| 46 +++---
 tests/test-plz.el | 33 +
 2 files changed, 68 insertions(+), 11 deletions(-)

diff --git a/plz.el b/plz.el
index e92742ba9d..551330343d 100644
--- a/plz.el
+++ b/plz.el
@@ -265,6 +265,45 @@ the initial connection attempt."
  :decode (if (and decode-s (not decode)) nil decode)
  :as as :then then :else else))
 
+(cl-defun plz (method url &key headers body as then else
+  (connect-timeout plz-connect-timeout)
+  (decode t decode-s))
+  "Request BODY with METHOD to URL with curl.
+
+AS selects the kind of result to pass to the callback function
+THEN.  It may be:
+
+- `buffer' to pass the response buffer.
+- `binary' to pass the response body as an undecoded string.
+- `string' to pass the response body as a decoded string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
+
+If DECODE is non-nil, the response body is decoded automatically.
+For binary content, it should be nil.  When AS is `binary',
+DECODE is automatically set to nil.
+
+THEN is a callback function, whose sole argument is selected
+above with AS.
+
+ELSE is an optional callback function called when the request
+fails with one argument, a `plz-error' struct.  If ELSE is nil,
+an error is signaled when the request fails, either
+`plz-curl-error' or `plz-http-error' as appropriate, with a
+`plz-error' struct as the error data.
+
+HEADERS may be an alist of extra headers to send with the
+request.  CONNECT-TIMEOUT may be a number of seconds to timeout
+the initial connection attempt."
+  (declare (indent defun))
+  (plz--curl method url
+ :body body
+ :headers headers
+ :connect-timeout connect-timeout
+ :decode (if (and decode-s (not decode)) nil decode)
+ :as as :then then :else else))
+
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
 (decode t decode-s))
@@ -338,9 +377,10 @@ the initial connection attempt."
  (curl-args (append plz-curl-default-args header-args
 (when connect-timeout
   (list "--connect-timeout" (number-to-string 
connect-timeout)))
-(when (eq 'put method)
-  (cl-assert body)
-  (list "--data" "@-" "--request" "PUT"))
+(pcase method
+  ((or 'put 'post)
+   (cl-assert body)
+   (list "--data" "@-" "--request" (upcase 
(symbol-name method)
 (list url)))
  (decode (pcase as
('binary nil)
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 23ecefd7ff..cd055b4cc7 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -68,7 +68,7 @@
 
 (ert-deftest plz-get-string nil
   (let* ((test-string)
- (process (plz-get "https://httpbin.org/get";
+ (process (plz 'get "https://httpbin.org/get";
 :as 'string
 :then (lambda (string)
 (setf test-string string)
@@ -78,7 +78,7 @@
 (ert-deftest plz-get-buffer nil
   ;; The sentinel kills the buffer, so we get the buffer as a string.
   (let* ((test-buffer-string)
- (process (plz-get "https://httpbin.org/get";
+ (process (plz 'get "https://httpbin.org/get";
 :as 'buffer
 :then (lambda (buffer)
 (with-current-buffer buffer
@@ -88,7 +88,7 @@
 
 (ert-deftest plz-get-response nil
   (let* ((test-response)
- (process (plz-get "https://httpbin.org/get";
+ (process (plz 'get "https://httpbin.org/get";
 :as 'response
 :then (lambda (response)
 (setf test-response response)
@@ -97,7 +97,7 @@
 
 (ert-deftest plz-get-json nil
   (let* ((test-json)
- (process (plz-get "https://httpbin.org/get";
+ (process (plz 'get "https://httpbin.org/get";
 :as #'json-read
 :then (lambda (json)
 (setf test-json json)
@@ -105,11 +105,28 @@
 (let-alist test-json
   (should (string-match "curl" .headers.User-Agent)
 
+(ert-deftest plz-post-json-string nil
+  (let* ((json-string (json-encode (list (cons "key" "value"
+ (response-json)
+ (process (plz 'post "https://httpbin.org/post";
+:headers

[elpa] externals/plz 2c19b7f11d 11/81: Changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 2c19b7f11d91c43e056f66050101b9218da7c9bf
Author: Adam Porter 
Commit: Adam Porter 

Changes
---
 plz.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plz.el b/plz.el
index 855df410ac..1af1de35de 100644
--- a/plz.el
+++ b/plz.el
@@ -223,7 +223,7 @@ argument: the `plz-response' object."
 SUCCESS and ERROR should be callback functions, called when the
 curl process finishes with a single argument: the `plz-response'
 object.  Uses `make-process' to call curl asynchronously."
-  (with-current-buffer (generate-new-buffer "*plz-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 plz-curl-program) 
curl-args)
@@ -237,7 +237,7 @@ object.  Uses `make-process' to call curl asynchronously."
 (cl-defun plz-request--sync (curl-args &key success error)
   "Return HTTP response object for curl called with CURL-ARGS.
 Uses `call-process' to call curl synchronously."
-  (with-current-buffer (generate-new-buffer "*plz-request-curl*")
+  (with-current-buffer (generate-new-buffer " *plz-request-curl*")
 (let ((status (apply #'call-process plz-curl-program nil t nil
  curl-args))
   (plz-success #'identity))
@@ -246,8 +246,8 @@ Uses `call-process' to call curl synchronously."
 (defun plz--sentinel (process-or-buffer status)
   "Process buffer of curl output in PROCESS-OR-BUFFER.
 If PROCESS-OR-BUFFER if a process, uses its buffer; if a buffer,
-uses it.  STATUS should be the process's event
-string (see info node `(elisp) Sentinels')."
+uses it.  STATUS should be the process's event string (see info
+node `(elisp) Sentinels').  Kills the buffer before returning."
   ;; Inspired by and some code copied from `elfeed-curl--sentinel'.
   (let ((buffer (cl-etypecase process-or-buffer
   (process (process-buffer process-or-buffer))



[elpa] externals/plz bca0b3112b 20/81: Tidy

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit bca0b3112b67ed3a62797994681d893e506f3830
Author: Adam Porter 
Commit: Adam Porter 

Tidy
---
 plz.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/plz.el b/plz.el
index 5cb53f7cbb..632d53d49d 100644
--- a/plz.el
+++ b/plz.el
@@ -211,8 +211,8 @@ above with AS.
 ELSE is an optional callback function called when the request
 fails with one argument, a `plz-error' struct.  If ELSE is nil,
 an error is signaled when the request fails, either
-`plz-curl-error' or `plz-http-error', as appropriate, with a
-`plz-error' struct as the error data..
+`plz-curl-error' or `plz-http-error' as appropriate, with a
+`plz-error' struct as the error data.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
@@ -241,7 +241,7 @@ If DECODE is non-nil, the response body is decoded 
automatically.
 For binary content, it should be nil.
 
 If the request fails, an error is signaled, either
-`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-curl-error' or `plz-http-error' as appropriate, with a
 `plz-error' struct as the error data.
 
 HEADERS may be an alist of extra headers to send with the
@@ -282,8 +282,8 @@ above with AS.
 ELSE is an optional callback function called when the request
 fails with one argument, a `plz-error' struct.  If ELSE is nil,
 an error is signaled when the request fails, either
-`plz-curl-error' or `plz-http-error', as appropriate, with a
-`plz-error' struct as the error data..
+`plz-curl-error' or `plz-http-error' as appropriate, with a
+`plz-error' struct as the error data.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
@@ -343,7 +343,7 @@ request.  CONNECT-TIMEOUT may be a number of seconds to 
timeout
 the initial connection attempt.
 
 If the request fails, an error is signaled, either
-`plz-curl-error' or `plz-http-error', as appropriate, with a
+`plz-curl-error' or `plz-http-error' as appropriate, with a
 `plz-error' struct as the error data.
 
 Uses `call-process' to call curl synchronously."



[elpa] externals/plz a5ccf48d80 70/81: Tests: Add check/error to a test

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit a5ccf48d80cd536a577062215a4563afd19d56af
Author: Adam Porter 
Commit: Adam Porter 

Tests: Add check/error to a test
---
 tests/test-plz.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 49fd0271df..87294d1af8 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -129,6 +129,8 @@
 (ert-deftest plz-post-jpeg-string nil
   (let* ((jpeg-to-upload (plz 'get "https://httpbin.org/image/jpeg";
:as 'binary :then 'sync))
+ (_ (unless jpeg-to-upload
+  (error "jpeg-to-upload is nil")))
  (response-json)
  (response-jpeg)
  (process (plz 'post "https://httpbin.org/post";



[elpa] externals/plz 5b00a61ce3 15/81: Rename functions

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 5b00a61ce3f370153a5ebb4288481ab46ad162b2
Author: Adam Porter 
Commit: Adam Porter 

Rename functions
---
 plz.el | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/plz.el b/plz.el
index 1e1a7bd5d7..675112c91b 100644
--- a/plz.el
+++ b/plz.el
@@ -217,11 +217,11 @@ HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
 the initial connection attempt."
   (declare (indent defun))
-  (plz--request 'get url
-:headers headers
-:connect-timeout connect-timeout
-:decode decode
-:as as :then then :else else))
+  (plz--curl 'get url
+ :headers headers
+ :connect-timeout connect-timeout
+ :decode decode
+ :as as :then then :else else))
 
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
@@ -245,11 +245,11 @@ HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
 the initial connection attempt."
   (declare (indent defun))
-  (plz--request-sync 'get url
- :headers headers
- :connect-timeout connect-timeout
- :decode decode
- :as as))
+  (plz--curl-sync 'get url
+  :headers headers
+  :connect-timeout connect-timeout
+  :decode decode
+  :as as))
 
 ; Private
 
@@ -257,8 +257,8 @@ the initial connection attempt."
 
 ;; Functions for calling and handling curl processes.
 
-(cl-defun plz--request (_method url &key headers connect-timeout
-decode as then else)
+(cl-defun plz--curl (_method url &key headers connect-timeout
+ decode as then else)
   "Get HTTP URL with curl.
 
 AS selects the kind of result to pass to the callback function
@@ -321,8 +321,8 @@ the initial connection attempt."
   plz-else else)
 process
 
-(cl-defun plz--request-sync (_method url &key headers connect-timeout
- decode as)
+(cl-defun plz--curl-sync (_method url &key headers connect-timeout
+  decode as)
   "Return result for HTTP request to URL made synchronously with curl.
 
 AS selects the kind of result to return.  It may be:
@@ -354,7 +354,7 @@ Uses `call-process' to call curl synchronously."
   (list url)))
(status (apply #'call-process plz-curl-program nil t nil
   curl-args))
-   ;; THEn form copied from `plz--request'.
+   ;; THEn form copied from `plz--curl'.
;; TODO: DRY this.  Maybe we could use a thread and a condition 
variable, but...
(plz-then (pcase-exhaustive as
((or `nil 'string) (lambda ()



[elpa] externals/plz 56c66c4421 32/81: Add/Change: :as 'binary

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 56c66c44213275582f968c2238840cbcb3b6f6dc
Author: Adam Porter 
Commit: Adam Porter 

Add/Change: :as 'binary

Seems clearer and more natural to say:

  (plz-get :as 'binary)

than:

  (plz-get :as 'string :decode nil)
---
 plz.el| 76 ++-
 tests/test-plz.el |  5 ++--
 2 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/plz.el b/plz.el
index 3667270685..23560bc4c8 100644
--- a/plz.el
+++ b/plz.el
@@ -197,13 +197,15 @@ AS selects the kind of result to pass to the callback 
function
 THEN.  It may be:
 
 - `buffer' to pass the response buffer.
-- `string' to pass the response body as a string.
+- `binary' to pass the response body as an undecoded string.
+- `string' to pass the response body as a decoded string.
 - `response' to pass a `plz-response' struct.
 - A function, which is called in the response buffer with it
   narrowed to the response body (suitable for, e.g. `json-read').
 
 If DECODE is non-nil, the response body is decoded automatically.
-For binary content, it should be nil.
+For binary content, it should be nil.  When AS is `binary',
+DECODE is automatically set to nil.
 
 THEN is a callback function, whose sole argument is selected
 above with AS.
@@ -231,13 +233,15 @@ the initial connection attempt."
 
 AS selects the kind of result to return.  It may be:
 
-- `string' to pass the response body as a string.
+- `binary' to pass the response body as an undecoded string.
+- `string' to pass the response body as a decoded string.
 - `response' to pass a `plz-response' struct.
 - A function, which is called in the response buffer with it
   narrowed to the response body (suitable for, e.g. `json-read').
 
 If DECODE is non-nil, the response body is decoded automatically.
-For binary content, it should be nil.
+For binary content, it should be nil.  When AS is `binary',
+DECODE is automatically set to nil.
 
 If the request fails, an error is signaled, either
 `plz-curl-error' or `plz-http-error' as appropriate, with a
@@ -267,7 +271,8 @@ AS selects the kind of result to pass to the callback 
function
 THEN.  It may be:
 
 - `buffer' to pass the response buffer.
-- `string' to pass the response body as a string.
+- `binary' to pass the response body as an undecoded string.
+- `string' to pass the response body as a decoded string.
 - `response' to pass a `plz-response' struct.
 - A function, which is called in the response buffer with it
   narrowed to the response body (suitable for, e.g. `json-read').
@@ -292,7 +297,10 @@ the initial connection attempt."
  (curl-args (append plz-curl-default-args header-args
 (when connect-timeout
   (list "--connect-timeout" (number-to-string 
connect-timeout)))
-(list url
+(list url)))
+ (decode (pcase as
+   ('binary nil)
+   (_ decode
 (with-current-buffer (generate-new-buffer " *plz-request-curl*")
   (let ((process (make-process :name "plz-request-curl"
:buffer (current-buffer)
@@ -303,16 +311,17 @@ the initial connection attempt."
:stderr (current-buffer)))
 ;; The THEN function is called in the response buffer.
 (then (pcase-exhaustive as
-('string (lambda ()
-   (let ((coding-system (or (plz--coding-system) 
'utf-8)))
- (plz--narrow-to-body)
- (when decode
-   (decode-coding-region (point) (point-max) 
coding-system))
- (funcall then (buffer-string)
+((or 'binary 'string)
+ (lambda ()
+   (let ((coding-system (or (plz--coding-system) 'utf-8)))
+ (plz--narrow-to-body)
+ (when decode
+   (decode-coding-region (point) (point-max) 
coding-system))
+ (funcall then (buffer-string)
 ('buffer (lambda ()
(funcall then (current-buffer
 ('response (lambda ()
- (funcall then (plz--response
+ (funcall then (plz--response :decode-p 
decode
 ((pred functionp) (lambda ()
 (let ((coding-system (or 
(plz--coding-system) 'utf-8)))
   (plz--narrow-to-body)
@@ -354,24 +363,30 @@ Uses `call-process' to call curl synchronously."
   (when connect-timeout
 (list "--connect-timeout" (number-to-string 
connect-timeout)))
  

[elpa] externals/plz 6a21c7e809 12/81: Significant changes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 6a21c7e809e3f23a983e1f50346f55008f79415f
Author: Adam Porter 
Commit: Adam Porter 

Significant changes

Thanks to Chris Wellons for his invaluable feedback.
---
 notes.org |  72 
 plz.el| 246 +-
 tests/test-plz.el |  83 +++---
 3 files changed, 293 insertions(+), 108 deletions(-)

diff --git a/notes.org b/notes.org
new file mode 100644
index 00..8944270d80
--- /dev/null
+++ b/notes.org
@@ -0,0 +1,72 @@
+#+TITLE: plz Notes
+
+* 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
diff --git a/plz.el b/plz.el
index 1af1de35de..d744e1b76b 100644
--- a/plz.el
+++ b/plz.el
@@ -141,10 +141,10 @@
 
  Variables
 
-(defvar-local plz-error nil
+(defvar-local plz-else nil
   "Callback function for errored completion of request in current curl process 
buffer.")
 
-(defvar-local plz-success nil
+(defvar-local plz-then nil
   "Callback function for successful completion of request in current curl 
process buffer.")
 
  Customization
@@ -172,39 +172,49 @@
 
  Functions
 
-(cl-defun plz-get (url &key headers sync success error
-   (connect-timeout plz-connect-timeout))
+(cl-defun plz-get (url &key headers as then
+   (connect-timeout plz-connect-timeout)
+   (decode t))
   "Get HTTP URL with curl.
-If SYNC is non-nil, return the response object; otherwise, return
-the curl process object.
+
+FIXME: Docstring.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt.
-
-For asynchronous requests, SUCCESS and ERROR should be callback
-functions, called when the curl process finishes with a single
-argument: the `plz-response' object."
+the initial connection attempt."
+  (declare (indent defun))
   (plz--request 'get url
-:sync sync
 :headers headers
 :connect-timeout connect-timeout
-:success success
-:error error))
+:decode decode
+:as as :then then))
+
+(cl-defun plz-get-sync (url &key headers as
+(connect-timeout plz-connect-timeout)
+(decode t))
+  "Get HTTP URL with curl synchronously.
 
-(cl-defun plz--request (_method url &key headers connect-timeout sync
-success error)
-  "Return process or response for HTTP request to URL.
-If SYNC is non-nil, return the response object; otherwise, return
-the curl process object.
+FIXME: Docstring.
 
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
-the initial connection attempt.
+the initial connection attempt."
+  (declare (indent defun))
+  (plz--request-sync 'get url
+ :headers headers
+ :connect-timeout connect-timeout
+ :decode decode
+ :as as))
+
+(cl-defun plz--request (_meth

[elpa] externals/plz 2f48423834 72/81: Docs: Add mascot

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 2f48423834f070a96438892f96fbf9a100c2b900
Author: Adam Porter 
Commit: Adam Porter 

Docs: Add mascot
---
 README.org|   2 ++
 images/mascot.png | Bin 0 -> 49535 bytes
 2 files changed, 2 insertions(+)

diff --git a/README.org b/README.org
index 45cf09c95c..2ef7ba2702 100644
--- a/README.org
+++ b/README.org
@@ -4,6 +4,8 @@
 
 # Note: This readme works with the org-make-toc 
 package, which automatically 
updates the table of contents.
 
+#+HTML: 
+
 # 
[[https://melpa.org/#/package-name][file:https://melpa.org/packages/plz-badge.svg]]
 
[[https://stable.melpa.org/#/package-name][file:https://stable.melpa.org/packages/plz-badge.svg]]
 
 ~plz~ is an HTTP library for Emacs.  It uses ~curl~ as a backend, which avoids 
some of the issues with using Emacs's built-in ~url~ library.  It supports both 
synchronous and asynchronous requests.  Its API is intended to be simple, 
natural, and expressive.  Its code is intended to be simple and well-organized. 
 Every feature is tested against [[https://httpbin.org/][httpbin]].
diff --git a/images/mascot.png b/images/mascot.png
new file mode 100644
index 00..e1cf52965b
Binary files /dev/null and b/images/mascot.png differ



[elpa] externals/plz 950a5498cb 16/81: Tidy

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 950a5498cb8ac1a7f8a183da73c13915eea80d3e
Author: Adam Porter 
Commit: Adam Porter 

Tidy
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 675112c91b..51cf529446 100644
--- a/plz.el
+++ b/plz.el
@@ -354,7 +354,7 @@ Uses `call-process' to call curl synchronously."
   (list url)))
(status (apply #'call-process plz-curl-program nil t nil
   curl-args))
-   ;; THEn form copied from `plz--curl'.
+   ;; THEN form copied from `plz--curl'.
;; TODO: DRY this.  Maybe we could use a thread and a condition 
variable, but...
(plz-then (pcase-exhaustive as
((or `nil 'string) (lambda ()



[elpa] externals/plz 3dd2598fe9 24/81: Tidy

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 3dd2598fe955b371d24d744585202a8baad725b8
Author: Adam Porter 
Commit: Adam Porter 

Tidy
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index c59fdb9470..92e3f2f443 100644
--- a/plz.el
+++ b/plz.el
@@ -447,7 +447,7 @@ refer to rather than the current buffer's unparsed headers."
   (string-to-number (match-string 2)
 
 (defun plz--headers ()
-  "Return headers alist for HTTP response in current buffer"
+  "Return headers alist for HTTP response in current buffer."
   (save-excursion
 (goto-char (point-min))
 (forward-line 1)



[elpa] externals/plz 0301272d8d 40/81: Add: plz-put

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 0301272d8d72691b807e44402f6ea801fdca6d5d
Author: Adam Porter 
Commit: Adam Porter 

Add: plz-put
---
 plz.el| 57 ---
 tests/test-plz.el | 15 +++
 2 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/plz.el b/plz.el
index 3844b2c3ef..22f0d232df 100644
--- a/plz.el
+++ b/plz.el
@@ -226,6 +226,45 @@ the initial connection attempt."
  :decode (if (and decode-s (not decode)) nil decode)
  :as as :then then :else else))
 
+(cl-defun plz-put (url body &key headers as then else
+   (connect-timeout plz-connect-timeout)
+   (decode t decode-s))
+  "PUT BODY to URL with curl.
+
+AS selects the kind of result to pass to the callback function
+THEN.  It may be:
+
+- `buffer' to pass the response buffer.
+- `binary' to pass the response body as an undecoded string.
+- `string' to pass the response body as a decoded string.
+- `response' to pass a `plz-response' struct.
+- A function, which is called in the response buffer with it
+  narrowed to the response body (suitable for, e.g. `json-read').
+
+If DECODE is non-nil, the response body is decoded automatically.
+For binary content, it should be nil.  When AS is `binary',
+DECODE is automatically set to nil.
+
+THEN is a callback function, whose sole argument is selected
+above with AS.
+
+ELSE is an optional callback function called when the request
+fails with one argument, a `plz-error' struct.  If ELSE is nil,
+an error is signaled when the request fails, either
+`plz-curl-error' or `plz-http-error' as appropriate, with a
+`plz-error' struct as the error data.
+
+HEADERS may be an alist of extra headers to send with the
+request.  CONNECT-TIMEOUT may be a number of seconds to timeout
+the initial connection attempt."
+  (declare (indent defun))
+  (plz--curl 'put url
+ :body body
+ :headers headers
+ :connect-timeout connect-timeout
+ :decode (if (and decode-s (not decode)) nil decode)
+ :as as :then then :else else))
+
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
 (decode t decode-s))
@@ -263,9 +302,9 @@ the initial connection attempt."
 
 ;; Functions for calling and handling curl processes.
 
-(cl-defun plz--curl (_method url &key headers connect-timeout
- decode as then else)
-  "Get HTTP URL with curl.
+(cl-defun plz--curl (method url &key body headers connect-timeout
+decode as then else)
+  "Make HTTP METHOD request to URL with curl.
 
 AS selects the kind of result to pass to the callback function
 THEN.  It may be:
@@ -288,6 +327,8 @@ an error is signaled when the request fails, either
 `plz-curl-error' or `plz-http-error' as appropriate, with a
 `plz-error' struct as the error data.
 
+BODY may be a string or buffer to send as the request body.
+
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
 the initial connection attempt."
@@ -297,6 +338,9 @@ the initial connection attempt."
  (curl-args (append plz-curl-default-args header-args
 (when connect-timeout
   (list "--connect-timeout" (number-to-string 
connect-timeout)))
+(when (eq 'put method)
+  (cl-assert body)
+  (list "--data" "@-" "--request" "PUT"))
 (list url)))
  (decode (pcase as
('binary nil)
@@ -330,6 +374,13 @@ the initial connection attempt."
   (funcall then (funcall as
 (setf plz-then then
   plz-else else)
+(when body
+  (cl-typecase body
+(string (process-send-string process body)
+(process-send-eof process))
+(buffer (with-current-buffer body
+  (process-send-region process (point-min) (point-max))
+  (process-send-eof process)
 process
 
 (cl-defun plz--curl-sync (_method url &key headers connect-timeout
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 96adc12808..23ecefd7ff 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -105,6 +105,21 @@
 (let-alist test-json
   (should (string-match "curl" .headers.User-Agent)
 
+(ert-deftest plz-put-json-string nil
+  (let* ((json-string (json-encode (list (cons "key" "value"
+ (response-json)
+ (process (plz-put "https://httpbin.org/put"; json-string
+:headers '(("Content-Type" . "application/json"))
+:as #'json-read
+:then (lambda (json)
+(setf response-json json)

[elpa] externals/plz baf93bb80a 39/81: Fix: (plz--curl) Header args

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit baf93bb80ad9e22be5c0273602c2d94cbb02a2fd
Author: Adam Porter 
Commit: Adam Porter 

Fix: (plz--curl) Header args
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index fb9a4c742a..3844b2c3ef 100644
--- a/plz.el
+++ b/plz.el
@@ -293,7 +293,7 @@ request.  CONNECT-TIMEOUT may be a number of seconds to 
timeout
 the initial connection attempt."
   ;; Inspired by and copied from `elfeed-curl-retrieve'.
   (let* ((header-args (cl-loop for (key . value) in headers
-   collect (format "--header %s: %s" key value)))
+   append (list "--header" (format "%s: %s" key 
value
  (curl-args (append plz-curl-default-args header-args
 (when connect-timeout
   (list "--connect-timeout" (number-to-string 
connect-timeout)))



[elpa] externals/plz 65dbc0f219 41/81: Change/Fix: (plz--sentinel) Use exhaustive pcase

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 65dbc0f219a45c0663e6b0aecbe7cc1d2edfe520
Author: Adam Porter 
Commit: Adam Porter 

Change/Fix: (plz--sentinel) Use exhaustive pcase
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 22f0d232df..e92742ba9d 100644
--- a/plz.el
+++ b/plz.el
@@ -451,7 +451,7 @@ node `(elisp) Sentinels').  Kills the buffer before 
returning."
   (buffer process-or-buffer
 (unwind-protect
 (with-current-buffer buffer
-  (pcase status
+  (pcase-exhaustive status
 ((or 0 "finished\n")
  ;; Curl exited normally: check HTTP status code.
  (pcase (plz--http-status)



[elpa] externals/plz e977a046a3 50/81: Change: (plz-http-response-status-line-regexp) Match at BOL

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit e977a046a31eca785fbf127396577e4f55aff9d3
Author: Adam Porter 
Commit: Adam Porter 

Change: (plz-http-response-status-line-regexp) Match at BOL

Seems like a good idea.
---
 plz.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 8e22d037ff..9734c4c454 100644
--- a/plz.el
+++ b/plz.el
@@ -68,7 +68,7 @@
  Constants
 
 (defconst plz-http-response-status-line-regexp
-  (rx "HTTP/" (group (1+ (or digit "."))) (1+ blank)
+  (rx bol "HTTP/" (group (1+ (or digit "."))) (1+ blank)
   (group (1+ digit)))
   "Regular expression matching HTTP response status line.")
 



[elpa] externals/plz 4736d5242a 66/81: Tests: (plz-test-wait) Change to function, test process argument

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 4736d5242ab5b2e40ca5d50d9c8380e2ee0d49b1
Author: Adam Porter 
Commit: Adam Porter 

Tests: (plz-test-wait) Change to function, test process argument

I'm not sure if the recent changes I made caused a race condition of
some kind (whether in the library or just the tests), but this seems
to fix the tests that were failing, and it didn't need to be a macro,
anyway.
---
 tests/test-plz.el | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 10812b06d9..6cc3f3397f 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -43,11 +43,18 @@
 
  Macros
 
-(cl-defmacro plz-test-wait (process &optional (seconds 0.1) (times 100))
+(cl-defun plz-test-wait (process &optional (seconds 0.1) (times 100))
   "Wait for SECONDS seconds TIMES times for PROCESS to finish."
-  `(cl-loop for i upto ,times ;; 10 seconds
-while (equal 'run (process-status ,process))
-do (sleep-for ,seconds)))
+  (when process
+;; Sometimes it seems that the process is killed, the THEN
+;; function called by its sentinel, and its buffer killed, all
+;; before this function gets called with the process argument;
+;; when that happens, tests that use this can fail.  Testing
+;; whether PROCESS is non-nil seems to fix it, but it's possible
+;; that something funny is going on...
+(cl-loop for i upto times ;; 10 seconds
+ while (equal 'run (process-status process))
+ do (sleep-for seconds
 
  Functions
 



[elpa] externals/plz 9a1b119eff 38/81: Meta: Ignore sandbox/

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 9a1b119effc337e285754d1f37ccda4c954f55c0
Author: Adam Porter 
Commit: Adam Porter 

Meta: Ignore sandbox/
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 0753206d74..5008183664 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.elc
 /scratch.el
 .#*
+/sandbox/



[elpa] externals/plz 709a14740f 58/81: Tidy: Docstrings

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 709a14740fa0e4584e52e97669d440eeffd83a0e
Author: Adam Porter 
Commit: Adam Porter 

Tidy: Docstrings
---
 plz.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/plz.el b/plz.el
index 06ba565564..3775863c14 100644
--- a/plz.el
+++ b/plz.el
@@ -156,14 +156,17 @@
  Variables
 
 (defvar-local plz-else nil
-  "Callback function for errored completion of request in current curl process 
buffer.")
+  "Callback function for errored completion of request.
+Called in current curl process buffer.")
 
 (defvar-local plz-then nil
-  "Callback function for successful completion of request in current curl 
process buffer.")
+  "Callback function for successful completion of request.
+Called in current curl process buffer.")
 
 (defvar-local plz-finally nil
-  "Function called unconditionally after completion of request, after the 
then/else function.
-It is called without arguments outside the curl process buffer.")
+  "Function called unconditionally after completion of request.
+Called after the then/else function, without arguments, outside
+the curl process buffer.")
 
  Customization
 



[elpa] externals/plz 7eff40f276 44/81: Add: plz-finally

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 7eff40f27686fb2e61bebc43f66c39e00e51a711
Author: Adam Porter 
Commit: Adam Porter 

Add: plz-finally
---
 plz.el| 28 +---
 tests/test-plz.el | 12 
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/plz.el b/plz.el
index e9b8d90d20..cc23f0e29e 100644
--- a/plz.el
+++ b/plz.el
@@ -161,6 +161,10 @@
 (defvar-local plz-then nil
   "Callback function for successful completion of request in current curl 
process buffer.")
 
+(defvar-local plz-finally nil
+  "Function called unconditionally after completion of request, after the 
then/else function.
+It is called without arguments outside the curl process buffer.")
+
  Customization
 
 (defgroup plz nil
@@ -265,7 +269,7 @@ the initial connection attempt."
  :decode (if (and decode-s (not decode)) nil decode)
  :as as :then then :else else))
 
-(cl-defun plz (method url &key headers body as then else
+(cl-defun plz (method url &key headers body as then else finally
   (connect-timeout plz-connect-timeout)
   (decode t decode-s))
   "Request BODY with METHOD to URL with curl.
@@ -293,6 +297,9 @@ an error is signaled when the request fails, either
 `plz-curl-error' or `plz-http-error' as appropriate, with a
 `plz-error' struct as the error data.
 
+FINALLY is an optional function called without argument after
+THEN or ELSE, as appropriate.
+
 HEADERS may be an alist of extra headers to send with the
 request.  CONNECT-TIMEOUT may be a number of seconds to timeout
 the initial connection attempt."
@@ -302,7 +309,7 @@ the initial connection attempt."
  :headers headers
  :connect-timeout connect-timeout
  :decode (if (and decode-s (not decode)) nil decode)
- :as as :then then :else else))
+ :as as :then then :else else :finally finally))
 
 (cl-defun plz-get-sync (url &key headers as
 (connect-timeout plz-connect-timeout)
@@ -342,7 +349,7 @@ the initial connection attempt."
 ;; Functions for calling and handling curl processes.
 
 (cl-defun plz--curl (method url &key body headers connect-timeout
-decode as then else)
+decode as then else finally)
   "Make HTTP METHOD request to URL with curl.
 
 AS selects the kind of result to pass to the callback function
@@ -366,6 +373,9 @@ an error is signaled when the request fails, either
 `plz-curl-error' or `plz-http-error' as appropriate, with a
 `plz-error' struct as the error data.
 
+FINALLY is an optional function called without argument after
+THEN or ELSE, as appropriate.
+
 BODY may be a string or buffer to send as the request body.
 
 HEADERS may be an alist of extra headers to send with the
@@ -413,7 +423,8 @@ the initial connection attempt."
 (decode-coding-region (point) 
(point-max) coding-system))
   (funcall then (funcall as
 (setf plz-then then
-  plz-else else)
+  plz-else else
+  plz-finally finally)
 (when body
   (cl-typecase body
 (string (process-send-string process body)
@@ -486,9 +497,10 @@ If PROCESS-OR-BUFFER if a process, uses its buffer; if a 
buffer,
 uses it.  STATUS should be the process's event string (see info
 node `(elisp) Sentinels').  Kills the buffer before returning."
   ;; Inspired by and some code copied from `elfeed-curl--sentinel'.
-  (let ((buffer (cl-etypecase process-or-buffer
-  (process (process-buffer process-or-buffer))
-  (buffer process-or-buffer
+  (let* ((buffer (cl-etypecase process-or-buffer
+   (process (process-buffer process-or-buffer))
+   (buffer process-or-buffer)))
+ (finally (buffer-local-value 'plz-finally buffer)))
 (unwind-protect
 (with-current-buffer buffer
   (pcase-exhaustive status
@@ -519,6 +531,8 @@ node `(elisp) Sentinels').  Kills the buffer before 
returning."
(pcase-exhaustive plz-else
  (`nil (signal 'plz-curl-error err))
  ((pred functionp) (funcall plz-else err)))
+  (when finally
+(funcall finally))
   (kill-buffer buffer
 
 ;; HTTP Responses
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 925175ec8c..8ef261c3b8 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -221,6 +221,18 @@
  (plz-response-p (plz-error-response (cdr err)))
  (eq 404 (plz-response-status (plz-error-response (cdr 
err
 
+; Finally
+
+(ert-deftest plz-get-finally nil
+  (let* ((finally-null t)
+ (process (plz 'get "https://httpbin.org/get";
+:as 'string
+:then #'ignore
+:finally (lambda ()
+   

[elpa] externals/plz 30e48b1e6a 22/81: Tidy

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 30e48b1e6a9c7f7d05655ba2ed2dc6ad170e3a9a
Author: Adam Porter 
Commit: Adam Porter 

Tidy
---
 plz.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/plz.el b/plz.el
index 75255ae4ac..c59fdb9470 100644
--- a/plz.el
+++ b/plz.el
@@ -440,8 +440,7 @@ refer to rather than the current buffer's unparsed headers."
   (coding-system-from-name content-type
 
 (defun plz--http-status ()
-  "Return HTTP status code for HTTP response in current buffer.
-Assumes point is at beginning of buffer."
+  "Return HTTP status code for HTTP response in current buffer."
   (save-excursion
 (goto-char (point-min))
 (when (looking-at plz-http-response-status-line-regexp)



[elpa] externals/plz 51404566fa 29/81: Notes: Add fetch.el

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 51404566faf6c7b358491a68183fb59328a9603d
Author: Adam Porter 
Commit: Adam Porter 

Notes: Add fetch.el

@ebpa's project looks very interesting!
---
 notes.org | 9 +
 1 file changed, 9 insertions(+)

diff --git a/notes.org b/notes.org
index 8944270d80..625db5a0a7 100644
--- a/notes.org
+++ b/notes.org
@@ -70,3 +70,12 @@ Assuming that =plz= has already called 
=decode-coding-region=, this is straightf
 #+END_SRC
 
 *** HTTP response with headers
+
+* References
+
+** 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=.
+



[elpa] externals/plz f34efa052c 48/81: Fix: set-buffer-multibyte nil for binary

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit f34efa052c52857a59db69348860bb95e2abbf88
Author: Adam Porter 
Commit: Adam Porter 

Fix: set-buffer-multibyte nil for binary
---
 plz.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/plz.el b/plz.el
index 100015bb7a..097e43d420 100644
--- a/plz.el
+++ b/plz.el
@@ -417,6 +417,8 @@ NOQUERY is passed to `make-process', which see."
 ((or 'binary 'string)
  (lambda ()
(let ((coding-system (or (plz--coding-system) 'utf-8)))
+ (pcase as
+   ('binary (set-buffer-multibyte nil)))
  (plz--narrow-to-body)
  (when decode
(decode-coding-region (point) (point-max) 
coding-system))
@@ -485,6 +487,8 @@ Uses `call-process' to call curl synchronously."
((or `nil 'string 'binary)
 (lambda ()
   (let ((coding-system (or (plz--coding-system) 
'utf-8)))
+(pcase as
+  ('binary (set-buffer-multibyte nil)))
 (plz--narrow-to-body)
 (when decode
   (decode-coding-region (point) (point-max) 
coding-system))



[elpa] externals/plz 93a2ccaaa8 59/81: Fix: Run curl in temporary-file-directory

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 93a2ccaaa8604433d0c75ea4d9adc1de834cbdc6
Author: Adam Porter 
Commit: Adam Porter 

Fix: Run curl in temporary-file-directory

Fixes https://github.com/alphapapa/ement.el/issues/19.  Thanks to
@akater for reporting.
---
 plz.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plz.el b/plz.el
index 3775863c14..348f2f8b36 100644
--- a/plz.el
+++ b/plz.el
@@ -362,7 +362,11 @@ NOQUERY is passed to `make-process', which see."
('binary nil)
(_ decode
 (with-current-buffer (generate-new-buffer " *plz-request-curl*")
-  (let ((process (make-process :name "plz-request-curl"
+  ;; Avoid making process in a nonexistent directory (in case the current
+  ;; default-directory has since been removed).  It's unclear what the best
+  ;; directory is, but this seems to make sense, and it should still exist.
+  (let ((default-directory temporary-file-directory)
+(process (make-process :name "plz-request-curl"
:buffer (current-buffer)
:coding 'binary
:command (append (list plz-curl-program) 
curl-args)



[elpa] externals/plz 21a7318f1c 26/81: Tests: Tidy/rename

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 21a7318f1c8ae2bfe07fb84100f06cebb5481f4a
Author: Adam Porter 
Commit: Adam Porter 

Tests: Tidy/rename
---
 tests/test-plz.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index da925df0cb..a3b18fded8 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -107,21 +107,21 @@
 
 ; Sync
 
-(ert-deftest plz-get-sync-string nil
+(ert-deftest plz-get-string-sync nil
   (should (string-match "curl" (plz-get-sync "https://httpbin.org/get";
  :as 'string)))
   (should (string-match "curl" (plz-get-sync "https://httpbin.org/get";
 
-(ert-deftest plz-get-sync-response nil
+(ert-deftest plz-get-response-sync nil
   (should (plz-test-get-response (plz-get-sync "https://httpbin.org/get";
:as 'response
 
-(ert-deftest plz-get-sync-json nil
+(ert-deftest plz-get-json-sync nil
   (let-alist (plz-get-sync "https://httpbin.org/get";
:as #'json-read)
 (should (string-match "curl" .headers.User-Agent
 
-(ert-deftest plz-get-sync-buffer nil
+(ert-deftest plz-get-buffer-sync nil
   ;; `buffer' is not a valid type for `plz-get-sync'.
   (should-error (plz-get-sync "https://httpbin.org/get";
   :as 'buffer)))
@@ -172,7 +172,7 @@
 
 ; Binary
 
-(ert-deftest plz-test-get-jpeg ()
+(ert-deftest plz-get-jpeg ()
   (let* ((test-jpeg)
  (process (plz-get "https://httpbin.org/image/jpeg";
 :decode nil
@@ -182,7 +182,7 @@
 (plz-test-wait process)
 (should (equal 'jpeg (image-type-from-data test-jpeg)
 
-(ert-deftest plz-test-get-jpeg-sync ()
+(ert-deftest plz-get-jpeg-sync ()
   (let ((jpeg (plz-get-sync "https://httpbin.org/image/jpeg";
 :decode nil)))
 (should (equal 'jpeg (image-type-from-data jpeg)



[elpa] externals/plz 430ceffd1d 43/81: Change: Handle killed processes

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 430ceffd1d39ee5240d3a6576ef161c4829ec4b0
Author: Adam Porter 
Commit: Adam Porter 

Change: Handle killed processes
---
 plz.el|  9 -
 tests/test-plz.el | 31 +--
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/plz.el b/plz.el
index 551330343d..e9b8d90d20 100644
--- a/plz.el
+++ b/plz.el
@@ -63,7 +63,7 @@
   version status headers body)
 
 (cl-defstruct plz-error
-  curl-error response)
+  curl-error response message)
 
  Constants
 
@@ -509,6 +509,13 @@ node `(elisp) Sentinels').  Kills the buffer before 
returning."
   (number code)))
 (curl-error-message (alist-get curl-exit-code 
plz-curl-errors))
 (err (make-plz-error :curl-error (cons curl-exit-code 
curl-error-message
+   (pcase-exhaustive plz-else
+ (`nil (signal 'plz-curl-error err))
+ ((pred functionp) (funcall plz-else err)
+
+("killed\n"
+ ;; Curl process killed.
+ (let ((err (make-plz-error :message "curl process killed")))
(pcase-exhaustive plz-else
  (`nil (signal 'plz-curl-error err))
  ((pred functionp) (funcall plz-else err)))
diff --git a/tests/test-plz.el b/tests/test-plz.el
index cd055b4cc7..925175ec8c 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -170,16 +170,35 @@
 (plz-test-wait process)
 (should (and (plz-error-p err)
  (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.")
-(plz-error-curl-error err)
-
+(plz-error-curl-error err))
+
+;; FIXME: This test works interactively but not in batch mode: it
+;; stalls the Emacs process indefinitely, using either sleep-for or
+;; sit-for.
+
+;; (ert-deftest plz-get-killed-error nil
+;;   ;; Async.
+;;   (let* ((err)
+;;  (process (plz 'get "https://httpbinn.org/get/status/404";
+;; :as 'string
+;; :else (lambda (e)
+;; (setf err e)
+;; (sit-for 0.01)
+;; (delete-process process)
+;; (should (not (process-live-p process)))
+;; (should (plz-error-p err))
+;; (should (equal "curl process killed"
+;;(plz-error-message err)
+
+(ert-deftest plz-get-curl-error-sync nil
   ;; Sync.
   (let ((err (should-error (plz-get-sync 
"https://httpbinn.org/get/status/404";
  :as 'string)
:type 'plz-curl-error)))
-(should (and (eq 'plz-curl-error (car err))
- (plz-error-p (cdr err))
- (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.")
-(plz-error-curl-error (cdr err)))
+(should (eq 'plz-curl-error (car err)))
+(should (plz-error-p (cdr err)))
+(should (equal '(6 . "Couldn't resolve host. The given remote host was not 
resolved.")
+   (plz-error-curl-error (cdr err))
 
 (ert-deftest plz-get-404-error nil
   ;; Async.



[elpa] externals/plz 65030d5cc1 64/81: Tidy: Docstring

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 65030d5cc1d51fcff7ab95b6363e4ac3453a2577
Author: Adam Porter 
Commit: Adam Porter 

Tidy: Docstring
---
 README.org | 2 +-
 plz.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index beb08a1d90..06e9f7c48c 100644
--- a/README.org
+++ b/README.org
@@ -105,7 +105,7 @@ Synchronously download a JPEG file, then create an Emacs 
image object from the d
 - ~binary~ to pass the response body as an undecoded string.
 - ~string~ to pass the response body as a decoded string.
 - ~response~ to pass a ~plz-response~ struct.
-- A function, which is called in the response buffer with it narrowed to 
the response body (suitable for, e.g. ~json-read~).
+- A function, to pass its return value; it is called in the response 
buffer, which is narrowed to the response body (suitable for, e.g. ~json-read~).
 
   If ~DECODE~ is non-nil, the response body is decoded automatically.  For 
binary content, it should be nil.  When ~AS~ is ~binary~, ~DECODE~ is 
automatically set to nil.
 
diff --git a/plz.el b/plz.el
index 50ac5ccc74..ab4f4f89a5 100644
--- a/plz.el
+++ b/plz.el
@@ -241,7 +241,7 @@ For binary content, it should be nil.  When AS is `binary',
 DECODE is automatically set to nil.
 
 THEN is a callback function, whose sole argument is selected
-above with AS.  Or it may be `sync' to make a synchronous
+above with AS.  Or THEN may be `sync' to make a synchronous
 request, in which case the result is returned directly.
 
 ELSE is an optional callback function called when the request



[elpa] externals/plz 220f882ee4 53/81: Tests: (plz-post-jpeg-string) Add

2022-05-11 Thread ELPA Syncer
branch: externals/plz
commit 220f882ee4806904505aaeaaa014de0c2d874707
Author: Adam Porter 
Commit: Adam Porter 

Tests: (plz-post-jpeg-string) Add
---
 tests/test-plz.el | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 8ef261c3b8..d622fabc08 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -119,6 +119,22 @@
   (should (string-match "curl" .headers.User-Agent))
   (should (string= "value" (alist-get 'key (json-read-from-string 
.data)))
 
+(ert-deftest plz-post-jpeg-string nil
+  (let* ((jpeg-string (plz-get-sync "https://httpbin.org/image/jpeg";
+:as 'binary))
+ (response-jpeg)
+ (process (plz 'post "https://httpbin.org/post";
+:headers '(("Content-Type" . "image/jpeg"))
+:body jpeg-string
+:as #'json-read
+:then (lambda (json)
+(setf response-jpeg
+  (base64-decode-string
+   (string-remove-prefix 
"data:application/octet-stream;base64,"
+ (alist-get 'data 
json
+(plz-test-wait process)
+(should (equal 'jpeg (image-type-from-data response-jpeg)
+
 ;; TODO: POST JSON buffer.
 
 (ert-deftest plz-put-json-string nil



  1   2   >