From 2beaac573d6b90388874b3770a5c4d17f7f8701d Mon Sep 17 00:00:00 2001 From: Peter Tillemans Date: Mon, 17 Feb 2025 01:06:23 +0100 Subject: [PATCH] emacsify denote bindings and add 0x0 support without package - map denote bindings to C-c iso prefix - replace 0x0 package with 2 functions from @daviwil --- init.org | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/init.org b/init.org index 97f02c8..5d44540 100644 --- a/init.org +++ b/init.org @@ -3226,12 +3226,39 @@ Configures the ~0x0~ package for easily sharing code snippets and files: #+BEGIN_SRC emacs-lisp ;; configure 0x0 (use-package 0x0 + :disabled :ensure t :config (setq 0x0-use-curl t)) + + (defun 0x0-upload-text () + (interactive) + (let* ((contents + (if (use-region-p) + (buffer-substring-no-properties (region-beginning) (region-end)) + (buffer-string))) + (temp-file (make-temp-file "0x0" nil ".txt" contents))) + (message "Sending %s to 0x0.st..." temp-file) + (let ((url (string-trim-right + (shell-command-to-string + (format "curl -s -F'file=@%s' -Fsecret= -Fexpires=24 https://0x0.st" + temp-file))))) + (message "Yanked ‘%s’ into kill ring." url) + (kill-new url) + (delete-file temp-file)))) + + (defun 0x0-upload-file (file-path) + (interactive "fSelect a file to upload: ") + (message "Sending %s to 0x0.st..." file-path) + (let ((url (string-trim-right + (shell-command-to-string + (format "curl -s -F'file=@%s' -Fsecret= -Fexpires=24 https://0x0.st" + (expand-file-name file-path)))))) + (message "Yanked ‘%s’ into kill ring." url) + (kill-new url))) #+END_SRC #+RESULTS: -: [nil 26279 35497 183387 nil elpaca-process-queues nil nil 963000 nil] +: +0x0-upload-file The commands this package offers: