From 71adb880043237c262813e8c9b500d1b2dd9755f Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:55:14 -0500 Subject: Un-verbose-ify auto-revert-mode --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index 3ac62dc..3ff6589 100644 --- a/init.el +++ b/init.el @@ -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) -- cgit 1.4.1-21-gabe81 From ca8221b36682b6c19df4ad33db4b7ec68bbb57fe Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:55:35 -0500 Subject: Correct circe-command-{G,}QUIT behavior See https://github.com/emacs-circe/circe/issues/402 --- init.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 3ff6589..855fb28 100644 --- a/init.el +++ b/init.el @@ -258,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) -- cgit 1.4.1-21-gabe81 From 01a8bdd9237d33c2c7a0072acabcdf6a239b738f Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:56:23 -0500 Subject: Enable edit-server even when not (daemonp) --- init.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 855fb28..47ca218 100644 --- a/init.el +++ b/init.el @@ -483,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 () @@ -621,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) -- cgit 1.4.1-21-gabe81 From c5b6a0774db7ecb2920db342abab5dbf5bcad9fb Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:56:46 -0500 Subject: Add fat-finger-exit --- init.el | 3 +-- lisp/acdw.el | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 47ca218..ec5a825 100644 --- a/init.el +++ b/init.el @@ -781,8 +781,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 diff --git a/lisp/acdw.el b/lisp/acdw.el index 91381da..b8a1906 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -632,6 +632,18 @@ This function is internal. Use `acdw/make-password-fetcher' instead." (interactive "p") (dotimes (or n 1) (insert "💩"))) + +;;; 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 -- cgit 1.4.1-21-gabe81 From 4c9d8ea075657b1c35d3b7352043725b59525a82 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:56:56 -0500 Subject: ~mehehheheh --- init.el | 69 +++++++++++++++++++++++++++------------------------ lisp/acdw-irc.el | 12 --------- lisp/acdw-modeline.el | 12 +++++++-- lisp/acdw.el | 33 ++++++++++++++++++------ 4 files changed, 72 insertions(+), 54 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index ec5a825..4e558b8 100644 --- a/init.el +++ b/init.el @@ -934,8 +934,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)) @@ -945,29 +956,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")) @@ -1057,11 +1046,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 + "" #'acdw/flyspell-correct-f7) + (:unbind "C-," "C-." "C-M-i"))) (setup (:straight-if forge (acdw/system :home)) @@ -1349,9 +1345,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 @@ -1491,10 +1489,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 @@ -1510,6 +1509,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 @@ -1614,7 +1616,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) @@ -1622,7 +1624,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 @@ -1652,8 +1654,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 @@ -1824,6 +1826,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))) diff --git a/lisp/acdw-irc.el b/lisp/acdw-irc.el index 3755441..b4b75ec 100644 --- a/lisp/acdw-irc.el +++ b/lisp/acdw-irc.el @@ -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 diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5aa0a18..6e5afb8 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el @@ -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 diff --git a/lisp/acdw.el b/lisp/acdw.el index b8a1906..0790f2e 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -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,16 @@ 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) -- cgit 1.4.1-21-gabe81