This commit is contained in:
Case Duckworth 2021-09-14 17:47:46 -05:00
commit f3c9b7c3d9
5 changed files with 106 additions and 63 deletions

View File

@ -20,6 +20,7 @@ I just have to make sure it's loading correctly in my own config… bleh
- [ ] =(╥﹏╥)=
- [ ] =Σ ◕ ◡ ◕=
- [ ] =╭∩╮︶_︶╭∩╮=
- [ ] =(งツ)ว=
- [ ] =ʕ ᴖᴥᴖʔ=
** TODO keep-acs (name?)

99
init.el
View File

@ -113,7 +113,8 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(:option auth-sources '("~/.authinfo" "~/.authinfo.gpg")))
(setup autorevert
(:option global-auto-revert-non-file-buffers t)
(:option global-auto-revert-non-file-buffers t
auto-revert-verbose nil)
(global-auto-revert-mode +1))
(setup (:straight avy)
@ -257,15 +258,28 @@ AKA, DO NOT USE THIS FUNCTION!!!"
circe-command-QUIT :after
(defun circe-quit@kill-buffer (&rest _)
(let ((circe-server-killed-confirmation 'kill-all))
;; `circe-server-killed-confirmation' set to nil, and manually
;; deleting all chat buffers, pending Github issue #402
;; (https://github.com/emacs-circe/circe/issues/402)
(let ((circe-server-killed-confirmation nil))
(with-circe-server-buffer
(dolist (buf (circe-server-chat-buffers))
(let ((circe-channel-killed-confirmation nil))
(kill-buffer buf)))
(kill-buffer))))
circe-command-GQUIT :after
(defun circe-gquit@kill-buffer (&rest _)
(let ((circe-server-killed-confirmation 'kill-all))
;; `circe-server-killed-confirmation' set to nil, and manually
;; deleting all chat buffers, pending Github issue #402
;; (https://github.com/emacs-circe/circe/issues/402)
(let ((circe-server-killed-confirmation nil))
(dolist (buf (circe-server-buffers))
(with-current-buffer buf
(dolist (buf (circe-server-chat-buffers))
(let ((circe-channel-killed-confirmation nil))
(kill-buffer buf)))
(message "%s: %s" buf circe-server-killed-confirmation)
(kill-buffer))))))
(defun circe-command-SHORTEN (url)
@ -469,8 +483,8 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(:hook visual-line-mode))
(setup (:straight-if (define-repeat-map
:host nil
:repo "https://tildegit.org/acdw/define-repeat-map.el")
:host nil
:repo "https://tildegit.org/acdw/define-repeat-map.el")
(acdw/system :home))
(defun acdw/other-window-or-switch-buffer-backward ()
@ -607,8 +621,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
;; requires extension:
;; https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/
(setup (:straight-if edit-server
(daemonp))
(setup (:straight edit-server)
(:require edit-server)
(edit-server-start)
@ -769,8 +782,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
"C-x o" #'acdw/other-window-or-switch-buffer
"C-x O" #'acdw/other-window-or-switch-buffer-backward
"C-c _" #'add-file-local-variable
"C-x C-c" #'delete-frame ; I keep fat-fingering and exiting
)
"C-x C-c" #'acdw/fat-finger-exit)
(:with-map toggle-map
(:bind "c" #'column-number-mode
@ -923,8 +935,19 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(load (expand-file-name "eshell" user-emacs-directory))))))
(setup eww
(defvar-local eww-readable-p nil
"Whether current buffer is in readable-mode.")
(:option eww-search-prefix "https://duckduckgo.com/html?q="
url-privacy-level '(email agent cookies lastloc))
(defun eww@is-readable (&rest _)
(setq-local eww-readable-p t))
(defun eww@is-not-readable (&rest _)
(setq-local eww-readable-p nil))
(advice-add 'eww-readable :after #'eww@is-readable)
(advice-add 'eww-render :after #'eww@is-not-readable)
(advice-add 'eww-back-url :after #'eww@is-not-readable)
(:hook #'reading-mode))
@ -934,29 +957,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(exec-path-from-shell-initialize)))
(setup (:straight expand-region)
(:global "C-=" #'er/expand-region
"C-SPC"
(defun acdw/set-mark-or-expand-region (arg)
"Set mark at point and activate, jump to mark, or expand region.
See `set-mark-command' and `expand-region'.
With no prefix argument, either run `set-mark-command' on first
invocation and `er/expand-region' on each successive invocation.
With any prefix argument
(e.g., \\[universal-argument] \\[set-mark-command]), act as with
`set-mark-command' (i.e., pop the mark). Don't care about
successive invocations."
(interactive "P")
(cond
((or arg
(and set-mark-command-repeat-pop
(eq last-command 'pop-to-mark-command)))
(setq this-command 'set-mark-command)
(set-mark-command arg))
((eq last-command 'acdw/set-mark-or-expand-region)
(er/expand-region 1))
(t (set-mark-command arg))))))
(:global "C-=" #'er/expand-region))
(setup (:straight-if fennel-mode
(executable-find "fennel"))
@ -1046,11 +1047,18 @@ specific to most general, they are these:
(setup (:straight flyspell-correct)
(:option flyspell-correct-interface #'flyspell-correct-completing-read
flyspell-correct--cr-key "`")
flyspell-correct--cr-key ";")
(defun acdw/flyspell-correct-f7 ()
"Run a full spell correction on the current buffer."
(interactive)
(save-mark-and-excursion
(flyspell-correct-move 0 :forward :rapid)))
(:with-feature flyspell
(:hook (defun flyspell@correct ()
(:bind "C-;" #'flyspell-correct-wrapper)
(:unbind "C-," "C-." "C-M-i")))))
(:bind "C-." #'flyspell-correct-wrapper
"<f7>" #'acdw/flyspell-correct-f7)
(:unbind "C-," "C-." "C-M-i")))
(setup (:straight-if forge
(acdw/system :home))
@ -1338,9 +1346,11 @@ browser defined in `browse-url-secondary-browser-function'."
(setup (:straight markdown-mode)
(:file-match (rx ".md" eos)
(rx ".markdown" eos))
(:hook #'variable-pitch-mode)
(:with-mode gfm-mode
(:file-match (rx "README.md" eos)))
(:file-match (rx "README.md" eos))
(:hook #'variable-pitch-mode))
(when (executable-find "markdownfmt")
(with-eval-after-load 'apheleia
@ -1480,10 +1490,11 @@ browser defined in `browse-url-secondary-browser-function'."
(:option
org-adapt-indentation nil
org-agenda-files nil ; only until I set this up
org-catch-invisible-edits 'smart
org-catch-invisible-edits 'show-and-error
org-clock-clocked-in-display 'mode-line
org-clock-string-limit 7 ; gives time and not title
org-confirm-babel-evaluate nil
org-cycle-separator-lines 0
org-directory "~/org"
org-ellipsis ""
org-export-coding-system 'utf-8-unix
@ -1499,6 +1510,9 @@ browser defined in `browse-url-secondary-browser-function'."
org-html-coding-system 'utf-8-unix
org-image-actual-width '(300)
org-imenu-depth 3
org-list-demote-modify-bullet '(("-" . "+")
("+" . "*")
("*" . "-"))
org-outline-path-complete-in-steps nil
org-pretty-entities t
org-refile-use-outline-path 'file
@ -1603,7 +1617,7 @@ browser defined in `browse-url-secondary-browser-function'."
(paredit-mode +1))
(dolist (mode lispy-modes)
(add-hook (intern (concat (symbol-name mode) "-hook"))
(add-hook (intern (format "%s-hook" mode))
#'paredit@setup))
(:also-load eldoc)
@ -1611,7 +1625,7 @@ browser defined in `browse-url-secondary-browser-function'."
(setup (:straight paren-face)
(dolist (mode lispy-modes)
(add-hook (intern (concat (symbol-name mode) "-hook")) #'paren-face-mode)))
(add-hook (intern (format "%s-hook" mode)) #'paren-face-mode)))
(setup (:straight-if (pdf-tools
:host github
@ -1641,8 +1655,8 @@ browser defined in `browse-url-secondary-browser-function'."
(:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
(setup (:straight prism)
(:hook-into lisp-mode
c-mode))
(dolist (mode lispy-modes)
(add-hook (intern (format "%s-hook" mode)) #'prism-mode)))
(setup prog
(:option show-paren-delay 0
@ -1813,6 +1827,7 @@ browser defined in `browse-url-secondary-browser-function'."
simple-modeline-segment-process
acdw-modeline/god-mode-indicator
acdw-modeline/minions
acdw-modeline/reading-mode
acdw-modeline/narrowed
acdw-modeline/major-mode)))

View File

@ -45,18 +45,6 @@ Stolen from s.el."
(setq num (1- num)))
(apply 'concat ss))))
(if (fboundp 's-truncate)
(defalias 'truncate-string 's-truncate)
(defun truncate-string (len s &optional ellipsis)
"If STR is longer than LEN, cut it down and add ELLIPSIS to the end.
When not specified, ELLIPSIS defaults to '...'."
(declare (pure t) (side-effect-free t))
(unless ellipsis
(setq ellipsis "..."))
(if (> (length s) len)
(format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis)
s)))
;;; IRC stuff

View File

@ -33,12 +33,16 @@ Otherwise, cdr should be a function that takes two points (see `count-words')."
(defun acdw-modeline/buffer-name () ; gonsie
"Display the buffer name in a face reflecting its modified status."
(propertize " %b "
(propertize (concat " "
(truncate-string (/ (window-total-width) 2)
(buffer-name) "~")
" ")
'face
(if (buffer-modified-p)
'font-lock-warning-face
'font-lock-type-face)
'help-echo (buffer-file-name)))
'help-echo (or (buffer-file-name)
(buffer-name))))
(defun acdw-modeline/erc ()
"ERC indicator for the modeline."
@ -151,6 +155,10 @@ is, if point < mark."
(region-bounds))))
'font-lock-face 'font-lock-variable-name-face))))
(defun acdw-modeline/reading-mode ()
"Display an indicator if currently in reading mode, mine or EWW's."
(concat (if reading-mode "R" "") (if eww-readable-p "w" "")))
(defun acdw-modeline/text-scale ()
"Display the text scaling from the modeline, if scaled."
;; adapted from https://github.com/seagle0128/doom-modeline

View File

@ -54,6 +54,16 @@ ARG). When called with multiple arguments or a list, it returns
;; I don't prefix these because ... reasons. Honestly I probably should prefix
;; them.
(defun truncate-string (len str &optional ellipsis)
"If STR is longer than LEN, cut it down and add ELLIPSIS to the end.
When not specified, ELLIPSIS defaults to '...'."
(declare (pure t) (side-effect-free t))
(unless ellipsis
(setq ellipsis "..."))
(if (> (length str) len)
(format "%s%s" (substring str 0 (- len (length ellipsis))) ellipsis)
str))
;; Why isn't this a thing???
(defmacro fbound-and-true-p (func)
"Return the value of function FUNC if it is bound, else nil."
@ -366,10 +376,15 @@ first."
(goto-char (point-min))
(kill-line)
(insert extracted-heading))
(replace-regexp org-property-drawer-re "") ;Delete properties
(replace-regexp org-logbook-drawer-re "") ;Delete logbook
;; Delete property drawers
(replace-regexp org-property-drawer-re "")
;; Delete logbook drawers
(replace-regexp org-logbook-drawer-re "")
;; Replace list items with their contents, paragraphed
(replace-regexp org-list-full-item-re "
\4")
;; Delete comment lines
(replace-regexp (concat org-comment-regexp ".*$") "")
;; Re-fill text for clipboard
(unfill-region (point-min) (point-max))
(flush-lines "^$" (point-min) (point-max)))
@ -626,12 +641,28 @@ This function is internal. Use `acdw/make-password-fetcher' instead."
(setq-local blink-matching-paren nil
show-paren-mode nil)))
;;; uh
(defun 💩 (n)
"💩 x N"
;;; 💩
(defun 💩 (&optional n)
"💩 x N."
(interactive "p")
(dotimes (or n 1)
(insert "💩")))
(let ((n (or n 1)))
(while (> n 0)
(insert "💩")
(setq n (1- n)))))
;;; Fat finger solutions
(defun acdw/fat-finger-exit (&optional prefix)
"Delete a frame, or kill Emacs with confirmation.
When called with PREFIX, just kill Emacs without confirmation."
(interactive "P")
(if (or prefix
(and (= 1 (length (frame-list)))
(yes-or-no-p "This is the last frame! Wanna quit?")))
(kill-emacs)
(ignore-errors
(delete-frame))))
(provide 'acdw)
;;; acdw.el ends here