123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- (defun display-full-buffer-path ()
- (interactive)
- "Little helper for showing full file path in minibuffer"
- (message (buffer-file-name)))
- ;;; See great post here:
- ;;; https://www.manueluberti.eu/emacs/2018/02/17/magit-bury-buffer/
- (defun mu-magit-kill-buffers ()
- "Restore window configuration and kill all Magit buffers."
- (interactive)
- (let ((buffers (magit-mode-get-buffers)))
- (magit-restore-window-configuration)
- (mapc #'kill-buffer buffers)))
- (defcustom *last-pb-url* nil
- "Contains the URL of the last post to the pastebin."
- :set (lambda (sym val)
- (set-default sym val)
- (message "Set %s to %s" sym val)))
- ;; See: https://with-emacs.com/posts/tutorials/almost-all-you-need-to-know-about-variables/
- (defmacro csetq (sym val)
- `(funcall (or (get ',sym 'custom-set) 'set-default) ',sym ,val))
- (defun post-region-to-pb ()
- "Post buffer to http://chate.io pastebin"
- (interactive)
- (csetq *last-pb-url*
- (substring
- (with-output-to-string
- (shell-command-on-region
- (region-beginning)
- (region-end)
- "curl -s -F \"file=@-\" -H \"expire:60min\" http://chate.io:669"
- standard-output))
- 0 -1))
- (message *last-pb-url*)
- ;; There may be a more direct way to
- ;; do this?
- (with-temp-buffer
- (insert *last-pb-url*)
- (clipboard-kill-region (point-min) (point-max))))
- (defun display-pb (&optional url-arg)
- "Display either last pb url content, or passed URL.
- Can also be used to display HTML/text via curl in new buf."
- (interactive)
- (let* ((url (if url-arg url-arg *last-pb-url*))
- (r
- (shell-command-to-string (format "curl -s %s" url))))
- (switch-to-buffer
- (get-buffer-create url))
- (insert r)))
|