emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste 4b32baa 203/298: Rename all the lambdas to privat


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste 4b32baa 203/298: Rename all the lambdas to private scopes
Date: Thu, 9 Dec 2021 19:00:14 -0500 (EST)

branch: elpa/webpaste
commit 4b32baa166059d41092d6a13a4babc3918fb0436
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    Rename all the lambdas to private scopes
    
    It's not meant for regular users to engage them directly.
---
 .../test-webpaste-default-post-field-lambda.el     |  2 +-
 tests/unit/test-webpaste-error-lambdas.el          |  4 +--
 tests/unit/test-webpaste-success-lambdas.el        |  6 ++--
 webpaste.el                                        | 36 +++++++++++-----------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/tests/unit/test-webpaste-default-post-field-lambda.el 
b/tests/unit/test-webpaste-default-post-field-lambda.el
index 134fbb6..3666037 100644
--- a/tests/unit/test-webpaste-default-post-field-lambda.el
+++ b/tests/unit/test-webpaste-default-post-field-lambda.el
@@ -10,7 +10,7 @@
  (it
   "can add language and text as post data"
 
-  (let ((post-lambda (webpaste-providers-default-post-field-lambda))
+  (let ((post-lambda (webpaste--providers-default-post-field-lambda))
         (major-mode 'fundamental-mode)
         (webpaste--provider-lang-alists '(("https://example.com/"; . 
((fundamental-mode . "text"))))))
     (let ((post-data (funcall post-lambda
diff --git a/tests/unit/test-webpaste-error-lambdas.el 
b/tests/unit/test-webpaste-error-lambdas.el
index 3364f19..a8959ba 100644
--- a/tests/unit/test-webpaste-error-lambdas.el
+++ b/tests/unit/test-webpaste-error-lambdas.el
@@ -16,7 +16,7 @@
  (it
   "with fallback"
 
-  (let ((error-lambda (webpaste-providers-error-lambda :text "my text")))
+  (let ((error-lambda (webpaste--providers-error-lambda :text "my text")))
     (funcall error-lambda :error-thrown "my error")
 
     (expect 'message
@@ -30,7 +30,7 @@
 
  (it
   "without fallback"
-  (let ((error-lambda (webpaste-providers-error-lambda-no-failover :text "my 
text")))
+  (let ((error-lambda (webpaste--providers-error-lambda-no-failover :text "my 
text")))
     (funcall error-lambda :error-thrown "my error")
 
     (expect 'message
diff --git a/tests/unit/test-webpaste-success-lambdas.el 
b/tests/unit/test-webpaste-success-lambdas.el
index 5a6a7e5..d8dfc6f 100644
--- a/tests/unit/test-webpaste-success-lambdas.el
+++ b/tests/unit/test-webpaste-success-lambdas.el
@@ -17,7 +17,7 @@
  (it
   "using a response header"
 
-  (let ((success-lambda (webpaste-providers-success-location-header)))
+  (let ((success-lambda (webpaste--providers-success-location-header)))
     (funcall success-lambda :response "my fake response")
 
     (expect 'webpaste--return-url
@@ -27,7 +27,7 @@
 
  (xit
   "when using some request.el response thingy"
-  (let ((success-lambda (webpaste-providers-success-response-url)))
+  (let ((success-lambda (webpaste--providers-success-response-url)))
     (funcall success-lambda :response "my fake response")
 
     (expect 'webpaste--return-url
@@ -38,7 +38,7 @@
  (it
   "when returning a string with an url"
 
-  (let ((success-lambda (webpaste-providers-success-returned-string)))
+  (let ((success-lambda (webpaste--providers-success-returned-string)))
     (funcall success-lambda :data "\"https://example.com/\";
 ")
 
diff --git a/webpaste.el b/webpaste.el
index 2a9a91f..dd72920 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -93,21 +93,21 @@ This uses `simpleclip-set-contents' to copy to clipboard."
      :post-field "c"
      :lang-uri-separator "/"
      :lang-overrides ((emacs-lisp-mode . "elisp"))
-     :success-lambda webpaste-providers-success-location-header)
+     :success-lambda webpaste--providers-success-location-header)
 
     ("ix.io"
      :uri "http://ix.io/";
      :post-field "f:1"
      :lang-uri-separator "/"
      :lang-overrides ((emacs-lisp-mode . "elisp"))
-     :success-lambda webpaste-providers-success-returned-string)
+     :success-lambda webpaste--providers-success-returned-string)
 
     ("sprunge.us"
      :uri "http://sprunge.us/";
      :post-field "sprunge"
      :lang-uri-separator "?"
      :lang-overrides ((emacs-lisp-mode . "clojure"))
-     :success-lambda webpaste-providers-success-returned-string)
+     :success-lambda webpaste--providers-success-returned-string)
 
     ("dpaste.com"
      :uri "http://dpaste.com/api/v2/";
@@ -117,7 +117,7 @@ This uses `simpleclip-set-contents' to copy to clipboard."
      :post-field "content"
      :post-lang-field-name "syntax"
      :lang-overrides ((emacs-lisp-mode . "clojure"))
-     :success-lambda webpaste-providers-success-location-header)
+     :success-lambda webpaste--providers-success-location-header)
 
     ("dpaste.de"
      :uri "https://dpaste.de/api/";
@@ -125,7 +125,7 @@ This uses `simpleclip-set-contents' to copy to clipboard."
      :post-field "content"
      :post-lang-field-name "lexer"
      :lang-overrides ((emacs-lisp-mode . "clojure"))
-     :success-lambda webpaste-providers-success-returned-string)
+     :success-lambda webpaste--providers-success-returned-string)
 
     ("gist.github.com"
      :uri "https://api.github.com/gists";
@@ -148,7 +148,7 @@ This uses `simpleclip-set-contents' to copy to clipboard."
      :post-field "code"
      :post-lang-field-name "language"
      :lang-overrides ((emacs-lisp-mode . "clojure"))
-     :success-lambda webpaste-providers-success-response-url))
+     :success-lambda webpaste--providers-success-response-url))
 
   "Define all webpaste.el providers.
 Consists of provider name and arguments to be sent to `webpaste--provider' when
@@ -193,21 +193,21 @@ precalculated, and also available both for pre and post 
request access.")
 
 
 ;;; Predefined error lambda for providers
-(cl-defun webpaste-providers-error-lambda (&key text)
+(cl-defun webpaste--providers-error-lambda (&key text)
   "Predefined error callback for providers that always does failover."
   (cl-function (lambda (&key error-thrown &allow-other-keys)
                  (message "Got error: %S" error-thrown)
                  (webpaste--paste-text text))))
 
 
-(cl-defun webpaste-providers-error-lambda-no-failover (&key text)
+(cl-defun webpaste--providers-error-lambda-no-failover (&key text)
   "Predefined error callback for providers that shouldn't do failover."
   (cl-function (lambda (&key error-thrown &allow-other-keys)
                  (message "Got error: %S" error-thrown))))
 
 
 ;;; Predefined success lambdas for providers
-(cl-defun webpaste-providers-success-location-header ()
+(cl-defun webpaste--providers-success-location-header ()
   "Predefined success callback for providers returning a Location header."
   (cl-function (lambda (&key response &allow-other-keys)
                  (when response
@@ -215,7 +215,7 @@ precalculated, and also available both for pre and post 
request access.")
                     (request-response-header response "Location"))))))
 
 
-(cl-defun webpaste-providers-success-response-url ()
+(cl-defun webpaste--providers-success-response-url ()
   "Predefined success callback for providers that and up with an URL somehow."
   (cl-function (lambda (&key response &allow-other-keys)
                  (when response
@@ -223,7 +223,7 @@ precalculated, and also available both for pre and post 
request access.")
                     (request-response-url response))))))
 
 
-(cl-defun webpaste-providers-success-returned-string ()
+(cl-defun webpaste--providers-success-returned-string ()
   "Predefined success callback for providers returning a string with URL."
   (cl-function (lambda (&key data &allow-other-keys)
                  (when data
@@ -233,7 +233,7 @@ precalculated, and also available both for pre and post 
request access.")
                    (webpaste--return-url data)))))
 
 
-(cl-defun webpaste-providers-default-post-field-lambda ()
+(cl-defun webpaste--providers-default-post-field-lambda ()
   "Predefined lambda for building post fields."
   (cl-function (lambda (&key text
                         post-field
@@ -275,8 +275,8 @@ precalculated, and also available both for pre and post 
request access.")
                                   (parser 'buffer-string)
                                   (lang-overrides '())
                                   (lang-uri-separator nil)
-                                  (error-lambda 
'webpaste-providers-error-lambda)
-                                  (post-field-lambda 
'webpaste-providers-default-post-field-lambda))
+                                  (error-lambda 
'webpaste--providers-error-lambda)
+                                  (post-field-lambda 
'webpaste--providers-default-post-field-lambda))
   "Function to create the lambda function for a provider.
 
 Usage:
@@ -290,8 +290,8 @@ Required params:
 
 :success-lambda    Callback sent to `request', look up how to write these in 
the
                    documentation for `request'.  Two good examples are
-                   `webpaste-providers-success-location-header' and
-                   `webpaste-providers-success-returned-string' as well as the
+                   `webpaste--providers-success-location-header' and
+                   `webpaste--providers-success-returned-string' as well as the
                    custom one used for the gist.github.com provider.
 
 Optional params:
@@ -315,8 +315,8 @@ Optional params:
 
 :error-lambda      Callback sent to `request', look up how to write these in 
the
                    documentation for `request'.  The default value for this is
-                   `webpaste-providers-error-lambda', but there's also
-                   `webpaste-providers-error-lambda-no-failover' available if
+                   `webpaste--providers-error-lambda', but there's also
+                   `webpaste--providers-error-lambda-no-failover' available if
                    you need a provider that isn't allowed to failover.
 
 :post-field-lambda Function that builds and returns the post data that should 
be



reply via email to

[Prev in Thread] Current Thread [Next in Thread]