(defvar url-pattern (car (read-sexps-in-file "~/.pastebin-name"))) (defun pastebin-buffer () (interactive) (let* ((extension (file-name-extension (buffer-name))) (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))))))