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

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

[nongnu] elpa/webpaste 7bd2cec 148/298: Added support to open created pa


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste 7bd2cec 148/298: Added support to open created pastes in browser
Date: Thu, 9 Dec 2021 19:00:03 -0500 (EST)

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

    Added support to open created pastes in browser
    
    This fixes #4.
---
 README.org  | 14 ++++++++++++++
 webpaste.el | 11 +++++++++++
 2 files changed, 25 insertions(+)

diff --git a/README.org b/README.org
index d118653..04ea75a 100644
--- a/README.org
+++ b/README.org
@@ -68,6 +68,20 @@ Example:
 Can also be put in the =:config= section of =use-package= the same way as the
 provider definitions above.
 
+*** Open recently created pastes in 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
+non-nil value.
+
+Example:
+#+begin_src emacs-lisp :tangle yes
+  ;; Open recently created pastes in an external browser
+  (setq webpaste/open-in-browser t)
+#+end_src
+
+Can also be put in the =:config= section of =use-package= the same way as the
+provider definitions above.
+
 ** TODO Providers to implement [6/10]
  - [X] ptpb.pw
  - [X] ix.io
diff --git a/webpaste.el b/webpaste.el
index 0aed885..d7bd5a7 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -58,6 +58,13 @@ default to all providers in order defined in 
‘webpaste-providers’ list."
   "Prompt for a yes/no confirmation before attempting to paste a region or 
buffer."
   :group 'webpaste)
 
+
+(defcustom webpaste/open-in-browser nil
+  "Open recently created pastes in a browser.
+
+This uses `browse-url-generic' to open URLs."
+  :group 'webpaste)
+
 
 
 (defvar webpaste/tested-providers ()
@@ -369,6 +376,10 @@ return it to the user."
   ;; Reset tested providers after successful paste
   (setq webpaste/tested-providers nil)
 
+  ;; If the user want to open the link in an external browser, do so.
+  (when webpaste/open-in-browser
+    (browse-url-generic returned-url))
+
   ;; Add RETURNED-URL to killring for easy pasting
   (kill-new returned-url)
 



reply via email to

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