From ccff884113100bf42cb330d8feccbbd4a82d45e6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 17 Dec 2021 18:31:24 -0600 Subject: Bunches o changes I was gonna try to like, make these atomic, but oops --- init.el | 250 +++++++++++++++++++++++++++++----------------------- lisp/+browse-url.el | 1 + lisp/+circe.el | 7 ++ lisp/+emacs.el | 13 +-- lisp/+modeline.el | 11 ++- lisp/+org.el | 6 ++ lisp/+scratch.el | 2 +- 7 files changed, 173 insertions(+), 117 deletions(-) diff --git a/init.el b/init.el index 3f85381..bda1fd8 100644 --- a/init.el +++ b/init.el @@ -26,7 +26,8 @@ ;; necessary for good functioning. In this block, I add extra ;; things or more "experimental" ones that might not belong in a ;; separate file. - (:global "C-x C-k" 'kill-this-buffer) + (:global "C-x C-k" 'kill-this-buffer + "C-x 4 n" 'clone-buffer) ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults (global-set-key (kbd "C-h") 'delete-backward-char) (keyboard-translate ?\C-h ?\C-?)) @@ -47,6 +48,11 @@ "~/.authinfo" "~/.authinfo.gpg"))) +(setup (:require goto-addr) + (if (fboundp #'global-goto-address-mode) + (global-goto-address-mode) + (add-hook 'after-change-major-mode-hook #'goto-address-mode))) + (setup (:require pulse) (:also-load +pulse) (:option pulse-flag nil @@ -55,6 +61,63 @@ (append +pulse-location-commands) 'lui-track-jump-to-indicator) (+pulse-location-mode +1)) +(setup abbrev + (:option abbrev-file-name (sync/ "abbrev.el") + save-abbrevs 'silent) + (:hook-into text-mode + circe-chat-mode)) + +(setup autorevert + (:option global-auto-revert-non-file-buffers t + auto-revert-verbose nil) + (global-auto-revert-mode +1)) + +(setup browse-url + (:require +browse-url) + (:option browse-url-secondary-browser-function (if (executable-find "firefox") + 'browse-url-firefox + 'browse-url-default-browser) + browse-url-new-window-flag nil + browse-url-firefox-arguments '("--new-tab") + browse-url-firefox-new-window-is-tab t) + ;; Set up URL handlers. + (+browse-url-set-handlers + (list + (cons (rx ; images + "." (or "jpeg" "jpg" "png") eos) + (lambda (&rest args) + (apply + (cond ((executable-find "mpv") '+browse-image-with-mpv) + (t 'eww-browse-url)) + args))) + (cons (rx ; videos + (or "youtube.com" "youtu.be" "yewtu.be" + (seq "." (or "mp4" "gif" "mov" "MOV") eos))) + (lambda (&rest args) + (apply (if (executable-find "mpv") + '+browse-url-with-mpv + browse-url-secondary-browser-function) + args))) + (cons (rx ; non-eww-friendly websites + (or + "github.com" + "gitlab.com" + "google.com" + "imgur.com" + "pixelfed" + "reddit.com" + "taskiq" + "twitter.com" "nitter.com" + )) + browse-url-secondary-browser-function) + (cons "." ; everything else + 'eww-browse-url))) + ;; Transform URLs before passing to `browse-url' + (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" + "youtu.be")) + . "//yewtu.be"))) + (+browse-url-transform-url-global-mode +1)) + (setup calendar (require '_location) (:option calendar-location-name _location-name @@ -159,6 +222,13 @@ 'display-fill-column-indicator-mode 'turn-on-auto-fill)) +(setup scratch + (:require +scratch) + (:option initial-major-mode 'lisp-interaction-mode + initial-scratch-message + ";; ABANDON ALL HOPE YE WHO ENTER HERE\n\n") + (add-hook 'kill-buffer-query-functions '+scratch-immortal)) + (setup text (:hook 'turn-on-auto-fill)) @@ -200,16 +270,17 @@ (setup (:straight (cape :host github :repo "minad/cape")) (dolist (fn '(;; All available cape capfs listed here. - cape-file-capf - cape-dabbrev-capf - cape-keyword-capf - ;;cape-abbrev-capf - ;;cape-ispell-capf - ;;cape-dict-capf + cape-file + cape-dabbrev + cape-keyword + ;;cape-abbrev + ;;cape-ispell + ;;cape-dict )) (add-to-list 'completion-at-point-functions fn))) (setup (:straight (capf-autosuggest + :host nil :repo "https://repo.or.cz/emacs-capf-autosuggest.git")) (:hook-into eshell-mode comint-mode)) @@ -217,12 +288,13 @@ (setup (:straight circadian) (:option circadian-themes '((:sunrise . modus-operandi) (:sunset . modus-vivendi))) - (circadian-setup)) + (add-hook 'after-init-hook 'circadian-setup)) (setup (:straight circe) (:require _circe +circe) - (autoload '+irc "+circe" "Connect to IRC." t) + (:also-load circe-chanop) + ;;(autoload '+irc "+circe" "Connect to IRC." t) ;; Formatting options (:option circe-format-action (format (format "%%%ds* {nick} {body}" @@ -294,12 +366,8 @@ visual-fill-column-extra-text-width (cons +circe-left-margin 0))) - (add-hook 'kill-emacs-hook - (defun circe-quit-all () - (ignore-errors - (advice-remove 'circe-command-GQUIT - 'circe-gquit@kill-buffer) - (circe-command-GQUIT "Quitting Emacs, bye!"))))) + (add-hook 'modus-themes-after-load-theme-hook 'circe-nick-color-reset) + (add-hook 'kill-emacs-hook '+circe-quit-all@kill-emacs)) (setup (:straight consult) (:also-load +consult) @@ -424,12 +492,31 @@ See also `crux-reopen-as-root-mode'." (autoload 'global-dictionary-tooltip-mode "dictionary" "Enable/disable dictionary-tooltip-mode for all buffers" t)) +(setup (:straight (discord + :host github + :repo "davep/discord.el" + :fork (:repo "duckwork/discord.el")))) + (setup (:straight electric-cursor) (electric-cursor-mode +1)) (setup (:straight electric-cursor) (electric-cursor-mode +1)) +(setup (:straight elfeed) + (:also-load +elfeed) + (:option elfeed-use-curl t + elfeed-curl-extra-arguments '("--insecure") + elfeed-show-unique-buffers t + elfeed-db-directory (sync/ "elfeed/db/" t)) + (:with-mode elfeed-show-mode + (:bind "SPC" '+elfeed-scroll-up-command + "S-SPC" '+elfeed-scroll-down-command))) + +(setup (:straight elfeed-org) + (:option rmh-elfeed-org-files (list (sync/ "elfeed/elfeed.org" t))) + (elfeed-org)) + (setup (:straight embark) (:option prefix-help-command 'embark-prefix-help-command) (:+key "C-." 'embark-act @@ -529,6 +616,20 @@ See also `crux-reopen-as-root-mode'." (setup (:straight lacarte) (:+key "" 'lacarte-execute-menu-command)) +(setup (:straight (lin :host gitlab :repo "protesilaos/lin")) + (require 'lin) + (:hook-into dired-mode + elfeed-search-mode + git-rebase-mode + ibuffer-mode + ledger-report-mode + log-view-mode + magit-log-mode + notmuch-search-mode + notmuch-tree-mode + org-agenda-mode + tabulated-list-mode)) + (setup (:straight marginalia) (marginalia-mode +1)) @@ -543,7 +644,11 @@ See also `crux-reopen-as-root-mode'." (setup (:straight (modus-themes :host gitlab - :repo "protesilaos/modus-themes"))) + :repo "protesilaos/modus-themes")) + (require 'modus-themes (.etc "straight/build/modus-themes/modus-themes")) + (:option modus-themes-bold-constructs t + modus-themes-italic-constructs t + modus-themes-headings '((t . (background))))) (setup (:straight mwim) (:+key "C-a" #'mwim-beginning @@ -553,7 +658,7 @@ See also `crux-reopen-as-root-mode'." (:option completion-styles '(orderless))) (setup (:straight (org - :type git + :type git :host nil :repo "https://git.savannah.gnu.org/git/emacs/org-mode.git" :local-repo "org" :depth full @@ -563,7 +668,7 @@ See also `crux-reopen-as-root-mode'." "lisp/*.el" ("etc/styles/" "etc/styles/*"))) (org-contrib - :type git + :type git :host nil :repo "https://git.sr.ht/~bzg/org-contrib")) ;; DO NOT load system-installed org !!! (setq load-path (cl-remove-if (lambda (path) @@ -572,6 +677,8 @@ See also `crux-reopen-as-root-mode'." (:also-load +org ox-md) (:option org-adapt-indentation nil + org-agenda-skip-deadline-if-done t + org-archive-mark-done t org-catch-invisible-edits 'show-and-error org-clock-clocked-in-display 'mode-line org-clock-frame-title-format (cons @@ -594,7 +701,7 @@ See also `crux-reopen-as-root-mode'." org-fontify-quote-and-verse-blocks t org-fontify-whole-heading-line t org-hide-emphasis-markers t - org-html-coding-system 'utf-8-unix + org-html-coding-system 'utf-8-unix org-image-actual-width (list (* (window-font-width) (- fill-column 8))) org-imenu-depth 3 @@ -620,11 +727,14 @@ See also `crux-reopen-as-root-mode'." "C-c C-l" '+org-insert-link-dwim "C-c C-n" '+org-next-heading-widen "C-c C-p" '+org-previous-heading-widen) + (:+leader "c" 'org-capture "C-c" 'org-capture + "a" 'org-agenda "C-a" 'org-agenda) (:local-set unfill-fill-function 'org-fill-paragraph) (:local-hook before-save-hook '+org-before-save@prettify-buffer) (advice-add 'org-delete-backward-char :override '+org-delete-backward-char) (with-eval-after-load 'org - (org-clock-persistence-insinuate))) + (org-clock-persistence-insinuate) + (org-link-set-parameters "tel" :follow '+org-tel-open))) (setup (:straight org-appear) (:option org-appear-autoemphasis t @@ -653,13 +763,9 @@ See also `crux-reopen-as-root-mode'." lisp-interaction-mode scheme-mode)) -(setup (:straight scratch) - (:require +scratch) - (:option initial-major-mode 'emacs-lisp-mode - initial-scratch-message - ";; ABANDON ALL HOPE YE WHO ENTER HERE\n") - (add-hook 'kill-buffer-query-functions '+scratch-immortal) - (add-hook 'scratch-create-buffer-hook '+scratch-buffer-setup)) +(setup (:straight-when pdf-tools + (eq system-type 'gnu/linux)) + (pdf-tools-install)) (setup (:straight (shell-command+ :host nil @@ -673,7 +779,9 @@ See also `crux-reopen-as-root-mode'." :fork (:repo "duckwork/simple-modeline"))) (:also-load +modeline) (:option simple-modeline-segments '((;; left + +modeline-ace-window-display +modeline-modified + +modeline-narrowed +modeline-buffer-name +modeline-position +modeline-anzu @@ -684,7 +792,6 @@ See also `crux-reopen-as-root-mode'." simple-modeline-segment-misc-info simple-modeline-segment-process +modeline-text-scale - +modeline-narrowed +modeline-minions +modeline-major-mode))) (simple-modeline-mode +1)) @@ -692,6 +799,9 @@ See also `crux-reopen-as-root-mode'." (setup (:straight smartscan) (smartscan-mode +1)) +(setup (:straight smartscan) + (smartscan-mode +1)) + (setup (:straight (sophomore :host github :repo "duckwork/sophomore.el")) @@ -732,6 +842,7 @@ See also `crux-reopen-as-root-mode'." 0)))) (funcall topsy-fn)))))) + (setup (:straight trashed) (:option trashed-action-confirmer #'y-or-n-p)) @@ -779,6 +890,9 @@ See also `crux-reopen-as-root-mode'." (with-eval-after-load 'visual-fill-column (advice-add 'text-scale-adjust :after 'visual-fill-column-adjust))) +(setup (:straight vlf) + (:require vlf-setup)) + (setup (:straight whitespace-cleanup-mode) (:option whitespace-cleanup-mode-preserve-point t) ;;(remove-hook 'before-save-hook 'whitespace-cleanup) @@ -790,83 +904,3 @@ See also `crux-reopen-as-root-mode'." (interactive "P") (call-interactively (if prefix #'zzz-up-to-char #'zzz-to-char))))) - -(setup (:straight elfeed) - (:also-load +elfeed) - (:option elfeed-use-curl t - elfeed-curl-extra-arguments '("--insecure") - elfeed-show-unique-buffers t - elfeed-db-directory (sync/ "elfeed/db/" t)) - (:with-mode elfeed-show-mode - (:bind "SPC" '+elfeed-scroll-up-command - "S-SPC" '+elfeed-scroll-down-command))) - -(setup (:straight elfeed-org) - (:option rmh-elfeed-org-files (list (sync/ "elfeed/elfeed.org" t))) - (elfeed-org)) - -(setup (:straight (lin :host gitlab :repo "protesilaos/lin")) - (require 'lin) - (:hook-into dired-mode - elfeed-search-mode - git-rebase-mode - ibuffer-mode - ledger-report-mode - log-view-mode - magit-log-mode - notmuch-search-mode - notmuch-tree-mode - org-agenda-mode - tabulated-list-mode)) - - -(setup browse-url - (:also-load +browse-url) - (:option browse-url-secondary-browser-function (if (executable-find "firefox") - 'browse-url-firefox - 'browse-url-default-browser) - browse-url-new-window-flag nil - browse-url-firefox-arguments '("--new-tab") - browse-url-firefox-new-window-is-tab t) - ;; Set up URL handlers. - (+browse-url-set-handlers - (list - (cons (rx ; images - "." (or "jpeg" "jpg" "png") eos) - (lambda (&rest args) - (apply - (cond ((executable-find "feh") '+browse-url-with-feh) - ((executable-find "mpv") '+browse-image-with-mpv) - (t 'eww-browse-url)) - args))) - (cons (rx ; videos - (or "youtube.com" "youtu.be" "yewtu.be" - (seq "." (or "mp4" "gif" "mov" "MOV") eos))) - (lambda (&rest args) - (apply (if (executable-find "mpv") - 'browse-url-mpv - browse-url-secondary-browser-function) - args))) - (cons (rx ; non-eww-friendly websites - (or - "github.com" - "gitlab.com" - "google.com" - "imgur.com" - "pixelfed" - "reddit.com" - "taskiq" - "twitter.com" - )) - browse-url-secondary-browser-function) - (cons "." ; everything else - 'eww-browse-url))) - ;; Transform URLs before passing to `browse-url' - (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" - "youtu.be")) - . "//yewtu.be"))) - (+browse-url-transform-url-global-mode +1)) - -(setup (:straight-when pdf-tools - (eq system-type 'gnu/linux)) - (pdf-tools-install)) diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index fad0826..d073d50 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el @@ -2,6 +2,7 @@ ;;; Code: +(require 'browse-url) (require 'cl-lib) (defgroup +browse-url nil diff --git a/lisp/+circe.el b/lisp/+circe.el index fc8d0be..7b11ce2 100644 --- a/lisp/+circe.el +++ b/lisp/+circe.el @@ -86,6 +86,13 @@ message the current topic.") (with-current-buffer buf (+circe-quit@kill-buffer)))) +(defun +circe-quit-all@kill-emacs () + "Quit all circe buffers when killing Emacs." + (ignore-errors + (advice-remove 'circe-command-GQUIT + 'circe-gquit@kill-buffer) + (circe-command-GQUIT "Quitting Emacs, bye!"))) + ;;; Patches (require 'el-patch) diff --git a/lisp/+emacs.el b/lisp/+emacs.el index a858cf6..15e23da 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el @@ -101,6 +101,7 @@ Do this only if the buffer is not visiting a file." show-paren-style 'mixed show-paren-when-point-in-periphery t show-paren-when-point-inside-paren t + tab-bar-show 1 tramp-backup-directory-alist backup-directory-alist use-dialog-box nil use-file-dialog nil @@ -231,12 +232,12 @@ Do this only if the buffer is not visiting a file." save-place-forget-unreadable-files (eq system-type 'gnu/linux)) (save-place-mode +1)) -(when (require 'tramp) - ;; thanks Irreal! https://irreal.org/blog/?p=895 - (add-to-list 'tramp-default-proxies-alist - '(nil "\\`root\\'" "/ssh:%h:")) - (add-to-list 'tramp-default-proxies-alist - '((regexp-quote (system-name)) nil nil))) +;; (when (require 'tramp) +;; ;; thanks Irreal! https://irreal.org/blog/?p=895 +;; (add-to-list 'tramp-default-proxies-alist +;; '(nil "\\`root\\'" "/ssh:%h:")) +;; (add-to-list 'tramp-default-proxies-alist +;; '((regexp-quote (system-name)) nil nil))) (provide '+emacs) ;;; +emacs.el ends here diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 7c74f76..7615ea7 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -20,7 +20,7 @@ (defun +modeline-buffer-name () ; gonsie "Display the buffer name." (propertize - (+string-align (buffer-name) 20 :before " " :ellipsis "… ") + (+string-align (buffer-name) 20 :before " " :ellipsis "~ ") 'face 'bold 'help-echo (or (buffer-file-name) (buffer-name)) @@ -49,7 +49,7 @@ "Display the current `major-mode'." (concat " " (propertize (+string-truncate (format-mode-line mode-name) - 12 "…") + 12 "~") 'face 'bold 'keymap mode-line-major-mode-keymap 'mouse-face 'mode-line-highlight))) @@ -108,6 +108,7 @@ The order of elements matters: whichever one matches first is applied." "mouse-2: widen buffer.") 'local-map (purecopy (simple-modeline-make-mouse-map 'mouse-2 'mode-line-widen)) + 'face 'font-lock-doc-face 'mouse-face 'mode-line-highlight)))) (define-minor-mode file-percentage-mode @@ -161,5 +162,11 @@ The order of elements matters: whichever one matches first is applied." (format (if (> text-scale-mode-amount 0) " (%+d)" " (%-d)") text-scale-mode-amount))) +(defun +modeline-ace-window-display () + "Display `ace-window-display-mode' information in the modeline." + '(+ace-window-display-mode + (ace-window-mode + (" " (:eval (window-parameter (selected-window) 'ace-window-path)))))) + (provide '+modeline) ;;; +modeline.el ends here diff --git a/lisp/+org.el b/lisp/+org.el index 9a91ef1..5631fed 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -392,5 +392,11 @@ the deletion might narrow the column." 'face '+org-script-markers))) t))) +;; Extra link types + +(defun +org-tel-open (number _) + "Notify the user of what phone NUMBER to call." + (message "Call: %s" number)) + (provide '+org) ;;; +org.el ends here diff --git a/lisp/+scratch.el b/lisp/+scratch.el index 976b08c..2a89a95 100644 --- a/lisp/+scratch.el +++ b/lisp/+scratch.el @@ -2,7 +2,7 @@ ;;; Code: -(require 'scratch) +;;(require 'scratch) (defun +scratch-immortal () "Bury, don't kill \"*scratc*\" buffer. -- cgit 1.4.1-21-gabe81