aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2022-08-20 12:55:00 -0500
committerGrant Shangreaux <grant@unabridgedsoftware.com>2022-08-20 12:55:11 -0500
commit1a0b623147bda3621241e74670545444c770f883 (patch)
treea34aa924e64f62d6e4ec8c80a76660a013060d4e
parentd5a49f0bbcfeeac32fd669f90e2cfa6bb2384b29 (diff)
Add: bepasty config
-rw-r--r--shoshimacs.el25
-rw-r--r--shoshimacs.org29
2 files changed, 54 insertions, 0 deletions
diff --git a/shoshimacs.el b/shoshimacs.el
index 54e0d84..43d3da9 100644
--- a/shoshimacs.el
+++ b/shoshimacs.el
@@ -173,6 +173,31 @@
(package-install 'srht)
(setq srht-username "shoshin")
+(defun read-file-into-string (f)
+ (with-temp-buffer
+ (insert-file-contents f)
+ (buffer-string)))
+
+(setq cicadas-paste-pw (read-file-into-string "~/.bepasty-key"))
+
+(defun cicadas-paste-current-buffer ()
+ (interactive)
+ (let ((tmpfile
+ (concat "/tmp/" (buffer-name))))
+ (write-region nil nil tmpfile)
+ (let ((url
+ (first (last (butlast
+ (split-string
+ (shell-command-to-string
+ (format "pastebinit -i '%s' -p %s -t '%s' -f text/plain"
+ tmpfile
+ cicadas-paste-pw
+ (buffer-name)))
+ "\n"))))))
+ (delete-file tmpfile)
+ (kill-new url)
+ (message "Pasted to %s (on kill ring)" url))))
+
;;; User Interface
(when (display-graphic-p)
(scroll-bar-mode -1)
diff --git a/shoshimacs.org b/shoshimacs.org
index eef48d6..05c6e37 100644
--- a/shoshimacs.org
+++ b/shoshimacs.org
@@ -694,6 +694,35 @@ HTTP requests.
an API token is stored in my ~.authinfo~ file.
+** paste.cicadas.surf
+
+#+begin_src emacs-lisp
+ (defun read-file-into-string (f)
+ (with-temp-buffer
+ (insert-file-contents f)
+ (buffer-string)))
+
+ (setq cicadas-paste-pw (read-file-into-string "~/.bepasty-key"))
+
+ (defun cicadas-paste-current-buffer ()
+ (interactive)
+ (let ((tmpfile
+ (concat "/tmp/" (buffer-name))))
+ (write-region nil nil tmpfile)
+ (let ((url
+ (first (last (butlast
+ (split-string
+ (shell-command-to-string
+ (format "pastebinit -i '%s' -p %s -t '%s' -f text/plain"
+ tmpfile
+ cicadas-paste-pw
+ (buffer-name)))
+ "\n"))))))
+ (delete-file tmpfile)
+ (kill-new url)
+ (message "Pasted to %s (on kill ring)" url))))
+#+end_src
+
* UI
:PROPERTIES:
:header-args:emacs-lisp: :noweb-ref user-interface :noweb-sep "\n\n" :results silent