[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 51b20d9 235/298: Merge branch 'WP-25-raw-pastes'
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 51b20d9 235/298: Merge branch 'WP-25-raw-pastes' |
Date: |
Thu, 9 Dec 2021 19:00:21 -0500 (EST) |
branch: elpa/webpaste
commit 51b20d98145c8d94d416d9794c11969c0b22f71c
Merge: b8e9245 9c5e921
Author: Elis Hirwing <elis@hirwing.se>
Commit: Elis Hirwing <elis@hirwing.se>
Merge branch 'WP-25-raw-pastes'
---
README.org | 11 +++++++++++
tests/unit/test-webpaste-default-post-field-lambda.el | 17 ++++++++++++++++-
webpaste.el | 13 ++++++++++---
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index ece5046..37176e2 100644
--- a/README.org
+++ b/README.org
@@ -69,6 +69,17 @@ This can be added to the =:config= section of use-package:
(setq webpaste-provider-priority '("ptpb.pw" "dpaste.de"))))
#+END_SRC
+** Only paste plaintext pastes
+If you don't want language detection you can define the following parameter
+that will tell the language detection to not check what language it is and
+not return anything to make it fallback to plaintext.
+
+Example:
+#+begin_src emacs-lisp
+ ;; Only paste raw pastes
+ (setq webpaste-paste-raw-text t)
+#+end_src
+
** Confirm pasting with a yes/no confirmation before pasting
To enable a confirmation dialog to always pop up and require you to confirm
pasting before text is actually sent to a paste-provider you just need to set
diff --git a/tests/unit/test-webpaste-default-post-field-lambda.el
b/tests/unit/test-webpaste-default-post-field-lambda.el
index 3666037..022fcb6 100644
--- a/tests/unit/test-webpaste-default-post-field-lambda.el
+++ b/tests/unit/test-webpaste-default-post-field-lambda.el
@@ -21,7 +21,22 @@
:post-data '(("duration" . "1 day")))))
(expect post-data
:to-equal
- '(("lang" . "text") ("content" . "my text") ("duration" . "1
day")))))))
+ '(("lang" . "text") ("content" . "my text") ("duration" . "1
day"))))))
+ (it
+ "can paste raw pastes"
+ (let ((post-lambda (webpaste--providers-default-post-field-lambda))
+ (major-mode 'fundamental-mode)
+ (webpaste-paste-raw-text t)
+ (webpaste--provider-lang-alists '(("https://example.com/" .
((fundamental-mode . "text"))))))
+ (let ((post-data (funcall post-lambda
+ :text "my text"
+ :post-field "content"
+ :provider-uri "https://example.com/"
+ :post-lang-field-name "lang"
+ :post-data '(("duration" . "1 day")))))
+ (expect post-data
+ :to-equal
+ '(("content" . "my text") ("duration" . "1 day")))))))
;;; test-webpaste-default-post-field-lambda.el ends here
diff --git a/webpaste.el b/webpaste.el
index 344c933..4ab23a5 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -74,6 +74,12 @@ This uses `browse-url-generic' to open URLs."
:type 'boolean)
+(defcustom webpaste-paste-raw-text nil
+ "Enable this to disable language detection to only make raw pastes."
+ :group 'webpaste
+ :type 'boolean)
+
+
(defcustom webpaste-return-url-hook nil
"Hook executed with the returned url as parameter."
:group 'webpaste
@@ -403,9 +409,10 @@ Optional params:
This also depends on which provider it is since different providers might have
different opinions of how the input for their fields should look like."
- (let ((provider-lang-alist (cdr (assoc provider
webpaste--provider-lang-alists))))
- (let ((language-name (cdr (assoc major-mode provider-lang-alist))))
- language-name)))
+ (unless webpaste-paste-raw-text
+ (let ((provider-lang-alist (cdr (assoc provider
webpaste--provider-lang-alists))))
+ (let ((language-name (cdr (assoc major-mode provider-lang-alist))))
+ language-name))))
(cl-defun webpaste--return-url (returned-url)
- [nongnu] elpa/webpaste 0546284 176/298: Added types to some defcustom missing it, (continued)
- [nongnu] elpa/webpaste 0546284 176/298: Added types to some defcustom missing it, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 321e6a4 191/298: Added more details for contributing, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 26b4d21 192/298: Added test of appending mode name to post data, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8d5e884 200/298: Added skeleton of documentation for creation of custom providers., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 655a364 205/298: Remove local variables since it became easier to get the providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d6967bd 217/298: Check emacs version after emacs install, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2da60b8 223/298: Bump version for new release, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1925521 228/298: Add emacs 26.1 to tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9c5e921 234/298: WP-25: Add README for raw pastes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 3d639f1 256/298: Merge branch 'fix-undercover', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 51b20d9 235/298: Merge branch 'WP-25-raw-pastes',
ELPA Syncer <=
- [nongnu] elpa/webpaste 22f64b7 255/298: undercover: Fix up undercover reporting, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste a8b682a 239/298: Add toml lang to ptpb.pw default, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2c399a0 243/298: Tests: Add unit tests for shebangs to override major-mode, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste a3a9a77 251/298: Remove spaces at end of lines, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7345c5f 252/298: [providers] Deprecation of ptpb.pw as a provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 521de6d 247/298: Update copyright year, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 87ea8b1 294/298: workflows: Remove environment variable to force install cask on macos, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7d8e0d4 287/298: wepaste: Add provider paste.rs, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste a9c4aa4 288/298: Merge branch 'provider-paste-rs', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b47767f 229/298: Prefix integration test names to filter them out easily if they seem, ELPA Syncer, 2021/12/09