From e48584700d06957b31392eb8c51c9c122d7c2db7 Mon Sep 17 00:00:00 2001 From: Elis Axelsson Date: Sat, 22 Apr 2017 10:58:28 +0200 Subject: [PATCH] Break out pasting to provider to own function This makes it easier to make custom pasting functions that will try a spacific provider to begin with, it won't *only* try that provider since the failover is the same as always which might be suboptimal, I would like to make that an option so one can decide to only ever use one provider and just fail if one wants to. This is good if you have internal systems at offices for example, that you have an internal paste provider for example github enterprise. Then you don't want it to go try some other provider afterwards. --- webpaste.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webpaste.el b/webpaste.el index 1ba4624..c96d77d 100644 --- a/webpaste.el +++ b/webpaste.el @@ -203,6 +203,14 @@ return it to the user." +;;;###autoload +(defun webpaste-paste-text-to-provider (text provider-name) + "Paste TEXT to specific PROVIDER-NAME. +This function sends a paste to a spacific provider. This function is created to +make `webpaste-paste-text' do less magic things all at once." + (funcall (cadr (assoc provider-name webpaste-providers-alist)) text)) + + ;;;###autoload (defun webpaste-paste-text (text) "Paste TEXT to some paste service. @@ -230,7 +238,7 @@ When we run out of providers to try, it will restart since (setq webpaste-tested-providers (cdr webpaste-tested-providers)) ;; Run pasting function - (funcall (cadr (assoc provider-name webpaste-providers-alist)) text))) + (webpaste-paste-text-to-provider text provider-name))) ;;;###autoload