Added support to open created pastes in browser

This fixes #4.
master
Elis Axelsson 9 years ago
parent 01440169d1
commit 7bd2cec67b
No known key found for this signature in database
GPG Key ID: D57EFA625C9A925F
  1. 14
      README.org
  2. 11
      webpaste.el

@ -68,6 +68,20 @@ Example:
Can also be put in the =:config= section of =use-package= the same way as the Can also be put in the =:config= section of =use-package= the same way as the
provider definitions above. 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] ** TODO Providers to implement [6/10]
- [X] ptpb.pw - [X] ptpb.pw
- [X] ix.io - [X] ix.io

@ -59,6 +59,13 @@ default to all providers in order defined in ‘webpaste-providers’ list."
:group 'webpaste) :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 () (defvar webpaste/tested-providers ()
"Variable for storing which providers to try in which order while running. "Variable for storing which providers to try in which order while running.
@ -369,6 +376,10 @@ return it to the user."
;; Reset tested providers after successful paste ;; Reset tested providers after successful paste
(setq webpaste/tested-providers nil) (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 ;; Add RETURNED-URL to killring for easy pasting
(kill-new returned-url) (kill-new returned-url)

Loading…
Cancel
Save