Summary: Contribution on text-based API-key moved to Comments on Pastebin
< You can put your API-key in a text file rather than inserting it directly in your emacs init-file. I have the following in a file called my-pastbin.el.
< ;; my-pasbin.el
< (require 'pastebin)
< ;; Strip any newline from file containing API-key
< (defun pastebin--trim-trailing-newlines (string)
< (while (string-match "\\(.*\\)\\(\n\\|\r\\)$" string)
< (setq string (substring string 0 -1)))
< (defun pastebin-unique-developer-api-key-from-file (filename)
< "A way to set the API key from the contents of a text file."
< (setq pastebin-unique-developer-api-key
< (and (file-exists-p filename)
< (insert-file-contents filename)
< (buffer-substring-no-properties (point-min) (point-max)))))))
< (pastebin-unique-developer-api-key-from-file "/path/to/text/file/containing/pastebin/API/key")
< (setq pastebin-user-name "username")
< (setq pastebin-password "password")
< (provide 'my-pastebin)
< I then call my-pastbin via M-x load-libray RET my-pastbin RET. You could load it from your emacs init-file of course. The guts of my-pastebin.el have been shamelessly stolen from [http://www.emacswiki.org/emacs/thesaurus.el thesaurus.el].
> You access your API-key from a text file rather than inserting it directly in your emacs init-file. See the [http://www.emacswiki.org/emacs/Comments_on_pastebin|Comments] page.
pastebin is an Emacs interface to pastebin.com.
You can use it to send little snippets of code (or whole buffers) to the web for sharing with others.
pastebin allows sending of regions or whole buffers and let’s you specify the virtual host for pastebin. So you can send code to emacs.pastebin.com or myproject.pastebin.com.
The code is downloadable from the wiki here: pastebin.el
The code is also on a github repo here.
There are two versions of pastebin’s code. One is the main site available on the Internet, the other is an earlier downloadable version. The pastebin elisp library supports both of these via configuration which allows the version supported by a particular domain to be specified.
He keeps his version here: pastebin.el
That version varies widely from the one on here and it looks like the one on here is newer. Unfortunately, the one on here seems more than a little shortsighted. To use subdomains you used to be able to customize the following:
Now, you must do all of:
'(pastebin-default-domain "zenspider.pastebin.com") '(pastebin-domain-versions (quote (("pastebin.com" "/api_public.php") ("zenspider.pastebin.com" "/api_public.php") ("pastebin.example.com" "/pastebin.php"))))
The subdomain code was much more straightforward.
I just found another bug. Using it with subdomains now returns urls like:
New pastebin.el version here: newpastebin.el
I’ve change newpastebin.el, if no name is provided to pastebin function, buffer-name is used. Also fix the check for region. Here is buffer-name-pastebin.el
Editing: I create a new version of pastebin.el, supporting fetch and deletion, here is: gkos/emacs-pastebin
Get in touch with me via github? I’d be quite happy to assign you the repo for pastebin.el