[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 6ea53d0 123/298: Added support for custom handler
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 6ea53d0 123/298: Added support for custom handler of how to build the post data for providers |
Date: |
Thu, 9 Dec 2021 18:59:57 -0500 (EST) |
branch: elpa/webpaste
commit 6ea53d0e67c1a11007e269752b3fdbeefc8eab6c
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Added support for custom handler of how to build the post data for providers
---
webpaste.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/webpaste.el b/webpaste.el
index 373b292..09cd686 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -91,6 +91,14 @@ each run.")
(replace-regexp-in-string "\n$" "" data)))))
"Predefined success callback for providers returning a string with URL.")
+(defvar webpaste/providers-default-post-field-lambda
+ (lambda (text post-field post-data)
+ (cl-pushnew (cons post-field text) post-data)
+
+ post-data)
+ "Predefined lambda for building post fields.")
+
+
(cl-defun webpaste-provider (&key uri
@@ -99,6 +107,7 @@ each run.")
(post-data '())
(sync nil)
post-field
+ (post-field-lambda
webpaste/providers-default-post-field-lambda)
error-lambda
success-lambda)
"Function to create the lambda function for a provider.
@@ -115,6 +124,9 @@ Usage:
:post-field Name of the field to insert the code into.
:sync Set to t to wait until request is done. Defaults to nil. This
should only be used for debugging purposes.
+:post-field-lambda Function that builds and returns the post data that should
be
+ sent to the provider. It should accept the parameter TEXT
+ only which contains the content that should be sent.
:success-lambda Callback sent to `request', look up how to write these in the
documentation for `request'.
:error-lambda Callback sent to `request', look up how to write these in the
@@ -126,13 +138,10 @@ Usage:
"Paste TEXT to provider"
(prog1 nil
- ;; Local variable post-data
- (cl-pushnew (cons post-field text) post-data)
-
;; Do request
(request uri
:type type
- :data post-data
+ :data (funcall post-field-lambda text post-field post-data)
:parser parser
:success success-lambda
:sync sync
- [nongnu] elpa/webpaste f83fd7b 145/298: Added note about new provider to implement. This refs #7, (continued)
- [nongnu] elpa/webpaste f83fd7b 145/298: Added note about new provider to implement. This refs #7, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 62e0f33 165/298: Refactor default post field lambda, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6e116ea 166/298: Merge branch 'refactor-away-defvars', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1677cd2 171/298: Added stuff to Makefile to run integration tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 51a6a07 174/298: Fixed broken message format, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6086556 180/298: Added integration tests for dpaste.com, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 44364f4 109/298: Rename parameter domain to uri for webpaste-provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1a1144f 110/298: Exposed sync parameter of request for debugging/test purposes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d9529de 112/298: Replaced (if (eq VAR nil)) with (unless VAR), ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1bfa9ec 120/298: Bump version for stable release and copyright year, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6ea53d0 123/298: Added support for custom handler of how to build the post data for providers,
ELPA Syncer <=
- [nongnu] elpa/webpaste aff4e42 124/298: The error-lambda now has a default value and is now optional, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2dc2206 126/298: Added github anonymous gists as provider. This fixes #8., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b3bcde1 128/298: Updated some docs that was missed before release..., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0fa48e2 129/298: Switch github pastes to not be public. This fixes #9., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4e58b0a 131/298: Fix bug in link returned from dpaste.de, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b35b30d 134/298: Added documentation for how to configure provider priority, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 70e8fd0 135/298: Bump version for new release, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b03b90f 138/298: Add confirmation dialog of paste, before pasting, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste f0a36e2 140/298: Added some docs of how to enable the confirmation dialog before pasting, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 272757b 056/298: Change documentation string, ELPA Syncer, 2021/12/09