JCMXOO3QYYWM33TFQRSD4SAJJTZS75FQDX4CW2FXEGE2TEJL5P4QC
KXQCM5H4TGZD4LCAFFNBSNEYARYCLWVGPCPFMCFMNPVH2FE5ZA7AC
RXCY7LD6ZRIOIKZEYKLMCYPMQPXF4DOEEFBDLVR2B22BXLZJFFBQC
A3TVGLVHSVLMEHLHB3TPBSD3QGNVGX3DIK6BEBDTTHWBNW4ALMRAC
ZYEHQDDB635RZOU4YDJYS5SPJ6BBZEWGSYLNABXRTW5OA4AXU7LQC
IOVPOFAVXEQIZ7BCFVVAWFW3RYFXPK2GOILDWA6N6QHQHLAJ4XTAC
O44NSJ7NBP6VO6BMDKN4XID4SLPHLQQVN6AC3PU3XX5BGD3XGZZQC
UIXIJMKKE7STQ65EALHSRFO7J64YCRPRQOQRAX7FJ27455W4X3WAC
VR6IOKCA2J3I7OZDAD6LE43KBTPFBKII7SIYMWTFPAP2R4MPHTNAC
XPCB6UQAVJWX26LZ5YNKV3WXE7EVCDF6RNJSVHUYPYTIDK2SW3VQC
;;; fwoar-pastebin.el --- Save htmlized version of buffer to a server -*- lexical-binding: t; tab-width: 8; -*-
;; Copyright (C) 2017 Edward Langley
;; Author: Edward Langley <fwoar@elangley.org>
;; Keywords: lisp
;; Version: 0.0.1
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 2 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Put a description of the package here
;;; Code:
;; code goes here
(defgroup fwoar-pastebin nil
"Configuration for simple pastebin"
:prefix "fwoar-pastebin-"
:group 'application)
(defcustom fwoar-pastebin-tramp-url nil
"A tramp-writable url to the pastebin"
:group 'fwoar-pastebin
:type 'string)
(defcustom fwoar-pastebin-web-url-pattern nil
"An appropriate URL for viewing the uploaded files"
:group 'fwoar-pastebin
:type 'string)
;;;###autoload
(defun pastebin-buffer ()
(interactive)
(let* ((extension (file-name-extension (elt (split-string (buffer-name)
"<")
0)))
(htmlized-buffer (htmlize-buffer)))
(with-current-buffer htmlized-buffer
(let ((result-name-hash (sha1 (current-buffer))))
(write-file (format fwoar-pastebin-tramp-url
result-name-hash
extension))
(message "Wrote file to: %s.%s.html" result-name-hash extension)
(browse-url (format fwoar-pastebin-web-url-pattern
result-name-hash
extension))))))
(provide 'fwoar-pastebin)
;;; fwoar-pastebin.el ends here
(use-package fwoar-pastebin :ensure nil
:custom
(fwoar-pastebin-tramp-url (when (file-exists-p "~/.pastebin-name")
(car (read-sexps-in-file "~/.pastebin-name"))))
(fwoar-pastebin-web-url-pattern (when (file-exists-p "~/.pastebin-name")
(cadr (read-sexps-in-file "~/.pastebin-name")))))
(defun pastebin-buffer ()
(interactive)
(let* ((extension (file-name-extension (elt (split-string (buffer-name) "<") 0)))
(htmlized-buffer (htmlize-buffer)))
(with-current-buffer htmlized-buffer
(let ((result-name-hash (sha1 (current-buffer))))
(write-file (format url-pattern result-name-hash extension))
(message "Wrote file to: %s.%s.html" result-name-hash extension)
(browse-url (format "https://fwoar.co/pastebin/%s.%s.html" result-name-hash extension))))))
;;; fwoar-pastebin.el --- Save htmlized version of buffer to a server -*- lexical-binding: t; tab-width: 8; -*-
;; Copyright (C) 2017 Edward Langley
;; Author: Edward Langley <fwoar@elangley.org>
;; Keywords: lisp
;; Version: 0.0.1
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 2 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Put a description of the package here
;;; Code:
;; code goes here
(defgroup fwoar-pastebin nil
"Configuration for simple pastebin"
:prefix "fwoar-pastebin-"
:group 'application)
(defcustom fwoar-pastebin-tramp-url nil
"A tramp-writable url to the pastebin"
:group 'fwoar-pastebin
:type 'string)
(defcustom fwoar-pastebin-web-url-pattern nil
"An appropriate URL for viewing the uploaded files"
:group 'fwoar-pastebin
:type 'string)
;;;###autoload
(defun pastebin-buffer ()
(interactive)
(let* ((extension (file-name-extension (elt (split-string (buffer-name)
"<")
0)))
(htmlized-buffer (htmlize-buffer)))
(with-current-buffer htmlized-buffer
(let ((result-name-hash (sha1 (current-buffer))))
(write-file (format fwoar-pastebin-tramp-url
result-name-hash
extension))
(message "Wrote file to: %s.%s.html" result-name-hash extension)
(browse-url (format fwoar-pastebin-web-url-pattern
result-name-hash
extension))))))
(provide 'fwoar-pastebin)
;;; fwoar-pastebin.el ends here