commit ecf6463726d39ee230f8f4b0709542b0a4a0f342
Author: Simon Watson <spw01@protonmail.com>
Date: Sun Feb 13 20:13:55 2022 -0500
Took out Windows stuff as no longer using, added some pb functions
diff --git a/emacs/.emacs-all b/emacs/.emacs-all
index efe115d..807f626 100644
--- a/emacs/.emacs-all
+++ b/emacs/.emacs-all
@@ -1,4 +1,3 @@
-;;; PACKAGES
;; Bootstrap Straight Package Manager
(defvar bootstrap-version)
(let ((bootstrap-file
@@ -97,9 +96,7 @@
(global-set-key (kbd "C-c f") 'pophint:do-flexibly)
;;; Code folding
-(add-hook 'perl-mode-hook 'hs-minor-mode)
-(add-hook 'lisp-mode-hook 'hs-minor-mode)
-(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
+(add-hook 'prog-mode-hook 'hs-minor-mode)
(global-set-key (kbd "C-c a") 'hs-toggle-hiding)
@@ -110,12 +107,21 @@
(straight-use-package
'(symon :type git :host github
:repo "zk-phi/symon"))
+(symon-mode 1)
(straight-use-package
'(telephone-line :type git :host github
:repo "dbordak/telephone-line"))
(telephone-line-mode 1)
+;;; Indent highlighting
+(straight-use-package
+ '(highlight-indent-guides
+ :type git :host github
+ :repo "DarthFennec/highlight-indent-guides"))
+(setq highlight-indent-guides-method 'character)
+(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
+
(require 'yasnippet)
;; Configure focus
@@ -215,11 +221,10 @@
(global-set-key (kbd "C-c ;") 'comment-line)
(global-set-key (kbd "C-c b") 'fzf-switch-buffer)
(global-set-key (kbd "C-c z") 'fzf-find-file)
-(defun wrap-diff-hl-enable ()
- (interactive)
- (diff-hl-mode)
- (diff-hl-flydiff-mode))
-(global-set-key (kbd "C-c e") 'wrap-diff-hl-enable)
+(global-set-key (kbd "C-c e") '(lambda ()
+ (interactive)
+ (diff-hl-mode)
+ (diff-hl-flydiff-mode)))
(global-set-key (kbd "C-c d") 'slime-describe-symbol)
(global-set-key (kbd "C-c M-r") 'slime-restart-inferior-lisp)
(global-set-key (kbd "C-c D") 'dimmer-mode)
@@ -227,15 +232,15 @@
(global-set-key (kbd "C-c F") 'focus-mode)
(global-set-key (kbd "C-c r") 'reload-dot-emacs)
(global-set-key (kbd "C-c l") 'display-line-numbers-mode)
-(global-set-key (kbd "C-c w") 'windresize)
+(global-set-key (kbd "C-c w") 'window-swap-states)
+(global-set-key (kbd "C-c C-w") 'windresize)
(global-set-key (kbd "C-c W") 'whitespace-mode)
(global-set-key (kbd "C-c t") 'sol-dk)
(global-set-key (kbd "C-c y") 'sol-l) ; Quick toggle evil-mode for slime err
(global-set-key (kbd "C-c g") 'magit)
-(global-set-key (kbd "C-c h") 'tramp-cleanup-connection)
(global-set-key (kbd "C-c C-.") '(lambda ()
- (interactive)
- (switch-to-buffer "*Messages*")))
+ (interactive)
+ (switch-to-buffer "*Messages*")))
(global-set-key (kbd "C-c C-f") 'find-file-at-point)
;;; Can probably be replaced with
@@ -279,6 +284,9 @@
(load "~/Repos/dotfiles/emacs/elisp/rclone.el")
(global-set-key (kbd "C-c o") 'rclone-post-buffer)
(global-set-key (kbd "C-c C-o") 'rclone-get-org)
+(global-set-key (kbd "C-c C-P") 'post-region-to-pb)
+(global-set-key (kbd "C-c 2 p") 'display-pb)
+
;; Small helper functions
(load "~/Repos/dotfiles/emacs/elisp/helpers.el")
@@ -313,18 +321,6 @@
(progn
(load-theme 'solarized-dark t)))))
-;; Load for Windows10
-(if (eq system-type 'windows-nt)
- (progn
- ;; Configure yasnippet
- (setq yas-snippet-dirs
- '("C:/Users/watsonsi/Documents/Github/dotfiles/emacs/yasnippets/"))
- (yas-global-mode 1)
-
- (load "C:/Users/watsonsi/Documents/GitHub/dotfiles/emacs/windows-load/customs.el")
- (setq visible-bell 1)
- (load-theme 'solarized-light t)))
-
;; Load for GUI Linux
(if (eq system-type 'gnu/linux)
(if (display-graphic-p)
diff --git a/emacs/elisp/helpers.el b/emacs/elisp/helpers.el
index 7a67179..523a655 100644
--- a/emacs/elisp/helpers.el
+++ b/emacs/elisp/helpers.el
@@ -12,3 +12,38 @@
(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*))
+
+(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)))