[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 14fd97b 225/298: Add deprecation message of simpl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 14fd97b 225/298: Add deprecation message of simpleclip option to clean up the code |
Date: |
Thu, 9 Dec 2021 19:00:18 -0500 (EST) |
branch: elpa/webpaste
commit 14fd97bc3c8554d9394b698610dca1186ff68b03
Author: Elis Hirwing <elis@hirwing.se>
Commit: Elis Hirwing <elis@hirwing.se>
Add deprecation message of simpleclip option to clean up the code
---
README.org | 6 ++++++
tests/unit/test-webpaste-return-url.el | 23 +----------------------
webpaste.el | 7 +++++--
3 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/README.org b/README.org
index c816c98..a5e36cc 100644
--- a/README.org
+++ b/README.org
@@ -102,6 +102,9 @@ clipboard. You can enable this with
(setq webpaste-copy-to-clipboard t)
#+END_SRC
+Warning: This option is deprecated and will be dropped in the future. Please
+use a custom hook instead.
+
*** Open the recently created paste in the browser
To enable opening of recently created pastes in an external browser, you can
enable the option =webpaste-open-in-browser= by setting this value to a
@@ -132,6 +135,9 @@ can have several hooks as well if you want it to do several
custom things.
(lambda (url)
(message "Opened URL in browser: %S" url)
(browse-url-generic url)))
+
+ ;; Simple hook to replicate the `webpaste-copy-to-clipboard' option
+ (add-hook 'webpaste-return-url-hook 'simpleclip-set-contents)
#+end_src
** Custom providers
diff --git a/tests/unit/test-webpaste-return-url.el
b/tests/unit/test-webpaste-return-url.el
index f032e54..14bba42 100644
--- a/tests/unit/test-webpaste-return-url.el
+++ b/tests/unit/test-webpaste-return-url.el
@@ -13,8 +13,7 @@
(setq webpaste-return-url-hook nil)
(spy-on 'message)
(spy-on 'kill-new)
- (spy-on 'browse-url-generic)
- (spy-on 'simpleclip-set-contents))
+ (spy-on 'browse-url-generic))
(it
"can put in kill-ring and message the user"
@@ -58,34 +57,14 @@
"https://example.com/?lang=lisp")))
(it
- "can put contents in clipboard using simpleclip"
- (let ((webpaste-copy-to-clipboard t)
- (webpaste-add-to-killring nil))
-
- (webpaste--return-url "https://example.com/")
-
- (expect 'simpleclip-set-contents
- :to-have-been-called-with
- "https://example.com/")
-
- (expect 'message
- :to-have-been-called-with
- "URL copied to clipboard.")))
-
- (it
"can run user defined hooks"
(add-hook 'webpaste-return-url-hook 'message)
(add-hook 'webpaste-return-url-hook 'browse-url-generic)
- (add-hook 'webpaste-return-url-hook 'simpleclip-set-contents)
(let ((webpaste-copy-to-clipboard nil)
(webpaste-add-to-killring nil)
(webpaste-open-in-browser nil))
(webpaste--return-url "https://example.com/")
- (expect 'simpleclip-set-contents
- :to-have-been-called-with
- "https://example.com/")
-
(expect 'message
:to-have-been-called-with
"https://example.com/")
diff --git a/webpaste.el b/webpaste.el
index 6b58f9d..dea11af 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -70,7 +70,10 @@ This uses `browse-url-generic' to open URLs."
(defcustom webpaste-copy-to-clipboard nil
"Uses simpleclip to send the provider's returned URL to the clipboard.
-This uses `simpleclip-set-contents' to copy to clipboard."
+This uses `simpleclip-set-contents' to copy to clipboard.
+
+Warning: This option is deprecated and will be dropped in the future. Please
+use a hook with `webpaste-return-url-hook' in the future."
:group 'webpaste
:type 'boolean)
@@ -431,7 +434,7 @@ Optional params:
;; Send RETURNED-URL to the clipboard using simpleclip
(when webpaste-copy-to-clipboard
(simpleclip-set-contents returned-url)
- (message "URL copied to clipboard."))
+ (message "URL copied to clipboard. -- Warning: This option is deprecated,
please use a hook instead."))
;; Add RETURNED-URL to killring for easy pasting
(when webpaste-add-to-killring
- [nongnu] elpa/webpaste 90a96d2 199/298: Change emacs-lisp-mode from elisp to clojure for sprunge.us, (continued)
- [nongnu] elpa/webpaste 90a96d2 199/298: Change emacs-lisp-mode from elisp to clojure for sprunge.us, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4b32baa 203/298: Rename all the lambdas to private scopes, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste cc9ba3d 202/298: Begin autoloading of the webpaste group, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste aed3e00 210/298: Bump version for new release, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b8f300f 209/298: Add pattern for buttercup to not run gists.github.com on travis, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4bd15f8 227/298: Add a nix-shell file for some development utils, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste f047313 219/298: Update the custom hook example to actually need to be a lambda, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ac24701 214/298: Merge branch 'DamienCassou-simplify-travis', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6a02ff9 185/298: Added tests for error lambdas and failovers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste bf08207 211/298: Update my name due to legal namechange, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 14fd97b 225/298: Add deprecation message of simpleclip option to clean up the code,
ELPA Syncer <=
- [nongnu] elpa/webpaste b6f8005 216/298: Do not fallback to true if test fails, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste cd66756 241/298: Detect lang from shebang, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 1787ea7 249/298: bugfix in "gist.github.com" entry of webpaste-providers-alist, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9da4eca 258/298: travis: Switch to nix-emacs-ci, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7d08f87 254/298: integration-tests: Change filtering of local/ci provider tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste afbcf6f 273/298: Merge branch 'comfort-paste', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4e410b0 272/298: Add example config to README with 'pasting buffer OR region' function, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0760361 278/298: docs: Fix all warnings regarding docstrings, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 5e963e8 275/298: Fix bug in webpaste-paste-buffer-or-region when you don't have a region, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9662b1c 280/298: Bump version number and copyright year, ELPA Syncer, 2021/12/09