From fc6c7ddc79e0edb92d8d53a2d7c6a0bfc6d08258 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 3 Apr 2021 09:45:59 -0500 Subject: Move stuff around --- init.el | 314 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 166 insertions(+), 148 deletions(-) diff --git a/init.el b/init.el index 4255e10..89e94ca 100644 --- a/init.el +++ b/init.el @@ -259,69 +259,6 @@ (remove-function after-focus-change-function 'hook--setup-fonts))) -;;;; Dired -(setup dired - (:setq-default dired-recursive-copies 'always - dired-recursive-deletes 'always - delete-by-moving-to-trash t - dired-listing-switches "-Al" - ls-lisp-dirs-first t - dired-ls-F-marks-symlinks t - dired-no-confirm '(byte-compile - chgrp chmod chown copy - hardlink load move - shell touch symlink) - dired-dwim-target t) - (:also-load dired-x) - (:hook dired-hide-details-mode - hl-line-mode) - (:global "C-x C-j" dired-jump) - (:bind "RET" dired-find-alternate-file)) - -;;;; Web browsing -(setup browse-url - (:setq-default browse-url-browser-function 'eww-browse-url - browse-url-secondary-browser-function - (if (executable-find "firefox") - 'browse-url-firefox - 'browse-url-default-browser) - browse-url-new-window-flag t - browse-url-firefox-new-window-is-tab t) - (when (eq acdw/system :work) - (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox"))) - -(setup shr - (:option shr-width fill-column - shr-max-width fill-column - shr-max-image-proportion 0.6 - shr-image-animate t - shr-discard-aria-hidden t)) - -(setup eww - (:hook acdw/reading-mode)) - -;;;; Eshell -(setup eshell - (defun eshell-quit-or-delete-char (arg) - "Delete the character to the right, or quit eshell on an empty line." - (interactive "p") - (if (and (eolp) (looking-back eshell-prompt-regexp)) - (eshell-life-is-too-much) - (delete-forward-char arg))) - (:option eshell-directory-name (acdw/in-dir "eshell/" t) - eshell-aliases-file (acdw/in-dir "eshell/aliases" t)) - (add-hook 'eshell-mode-hook - (defun hook--eshell-setup () - "Stuff to do after eshell is done setting up." - (define-key eshell-mode-map (kbd "C-d") - #'eshell-quit-or-delete-char) - (setq mode-line-format '(:eval simple-modeline--mode-line))))) - -;;;; Ediff -(setup ediff - (:option ediff-window-setup-function 'ediff-setup-windows-plain - ediff-split-window-function 'split-window-horizontally)) - ;;;; Debugger (setup debugger (:hook visual-line-mode) @@ -407,6 +344,170 @@ (global-set-key (kbd "M-=") #'count-words) (global-set-key (kbd "C-x C-b") #'ibuffer) + +;;; Applications +;; Some of these are built-in, some are packages; all are "extra" functionality +;; in Emacs (i.e., they're not /just/ editing text) +;;;; Org mode +(setup (:straight (org :host nil + :repo "https://code.orgmode.org/bzg/org-mode.git")) + (require 'acdw-org) + (:option org-directory "~/org" + org-hide-emphasis-markers t + org-fontify-whole-heading-line t + org-fontify-done-headline t + org-fontify-quote-and-verse-blocks t + org-src-fontify-natively t + org-pretty-entities t + org-tags-column (- 0 fill-column -3) + org-src-tab-acts-natively t + org-src-window-setup 'current-window + org-confirm-babel-evaluate nil + org-adapt-indentation nil + org-catch-invisible-edits 'smart + org-special-ctrl-a/e t + org-special-ctrl-k t + org-imenu-depth 3 + org-export-headline-levels 8 + org-export-with-smart-quotes t + org-export-with-sub-superscripts t) + (:bind "RET" unpackaged/org-return-dwim) + (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines)) + +;;;; Eshell +(setup eshell + (defun eshell-quit-or-delete-char (arg) + "Delete the character to the right, or quit eshell on an empty line." + (interactive "p") + (if (and (eolp) (looking-back eshell-prompt-regexp)) + (eshell-life-is-too-much) + (delete-forward-char arg))) + (:option eshell-directory-name (acdw/in-dir "eshell/" t) + eshell-aliases-file (acdw/in-dir "eshell/aliases" t)) + (add-hook 'eshell-mode-hook + (defun hook--eshell-setup () + "Stuff to do after eshell is done setting up." + (define-key eshell-mode-map (kbd "C-d") + #'eshell-quit-or-delete-char) + (setq mode-line-format '(:eval simple-modeline--mode-line))))) + + +;;;; Ediff +(setup ediff + (:option ediff-window-setup-function 'ediff-setup-windows-plain + ediff-split-window-function 'split-window-horizontally)) + +;;;; Reading mail +;; Let's try Gnus. +(setup gnus + (:option gnus-select-method '(nnnil nil) + gnus-secondary-select-methods + '((nnimap "imap.fastmail.com" + (nnimap-inbox "INBOX") + (nnimap-stream ssl) + (nnimap-expunge never))))) + +;;;; Web browsing +(setup browse-url + (:setq-default browse-url-browser-function 'eww-browse-url + browse-url-secondary-browser-function + (if (executable-find "firefox") + 'browse-url-firefox + 'browse-url-default-browser) + browse-url-new-window-flag t + browse-url-firefox-new-window-is-tab t) + (when (eq acdw/system :work) + (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox"))) + +(setup shr + (:option shr-width fill-column + shr-max-width fill-column + shr-max-image-proportion 0.6 + shr-image-animate t + shr-discard-aria-hidden t)) + +(setup eww + (:hook acdw/reading-mode)) + +;;;; Gemini/gopher browsing +(setup (:straight (elpher :host nil + :repo "git://thelambdalab.xyz/elpher.git")) + (:option elpher-ipv4-always t + elpher-certificate-directory (acdw/in-dir "elpher/") + elpher-gemini-max-fill-width fill-column) + (:bind "n" elpher-next-link + "p" elpher-prev-link + "o" elpher-follow-current-link + "G" elpher-go-current) + (:hook acdw/reading-mode) + + ;; Make `eww' gemini/gopher aware. From Emacswiki. + (advice-add 'eww-browse-url :around + (defun elpher:eww-browse-url (original url &optional new-window) + "Handle gemini and gopher links." + (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url) + (require 'elpher) + (elpher-go url)) + (t (funcall original url new-window)))))) + +(setup (:straight (gemini-mode + :host nil + :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) + (:option (append auto-mode-alist) + '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode))) + +;;;; File browsing +(setup dired + (:setq-default dired-recursive-copies 'always + dired-recursive-deletes 'always + delete-by-moving-to-trash t + dired-listing-switches "-Al" + ls-lisp-dirs-first t + dired-ls-F-marks-symlinks t + dired-no-confirm '(byte-compile + chgrp chmod chown copy + hardlink load move + shell touch symlink) + dired-dwim-target t) + (:also-load dired-x) + (:hook dired-hide-details-mode + hl-line-mode) + (:global "C-x C-j" dired-jump) + (:bind "RET" dired-find-alternate-file) + (with-eval-after-load 'dired + (setup (:straight dired-subtree) + (define-key dired-mode-map "i" #'dired-subtree-toggle)) + + (setup (:straight dired-collapse) + (:hook-into dired-mode)) + + (setup (:straight trashed) + (:option trashed-action-confirmer 'y-or-n-p)))) + +;;;; Magit +(setup (:straight magit) + (:acdw/leader "g" magit-status) + (:option magit-display-buffer-function + (defun magit-display-buffer-same-window (buffer) + "Display BUFFER in the selected window like God intended." + (display-buffer buffer '(display-buffer-same-window))) + magit-popup-display-buffer-action '((display-buffer-same-window)))) + +;;;; Read e-books (nov.el) +(setup (:straight nov) + (:option nov-text-width fill-column + (append auto-mode-alist) '("\\.epub\\'" . nov-mode))) + +;;;; PDF Tools +(when (eq acdw/system :home) + (setup (:straight pdf-tools) + (pdf-loader-install))) + +;;;; VTerm +(when (eq acdw/system :home) + (setup (:straight vterm))) + + ;;; Packages ;;;; Interactivity @@ -676,95 +777,12 @@ if ripgrep is installed, otherwise `consult-grep'." (when (eq acdw/system :home) (setup (:straight pkgbuild-mode))) -;;;; Applications - -;;;;; Magit -(setup (:straight magit) - (:acdw/leader "g" magit-status) - (:option magit-display-buffer-function - (defun magit-display-buffer-same-window (buffer) - "Display BUFFER in the selected window like God intended." - (display-buffer buffer '(display-buffer-same-window))) - magit-popup-display-buffer-action '((display-buffer-same-window)))) - -;;;;; File browsing -(setup (:straight dired-subtree) - (define-key dired-mode-map "i" #'dired-subtree-toggle)) - -(setup (:straight dired-collapse) - (:hook-into dired-mode)) - -(setup (:straight trashed) - (:option trashed-action-confirmer 'y-or-n-p)) - -;;;;; Gemini/gopher browsing -(setup (:straight (elpher :host nil - :repo "git://thelambdalab.xyz/elpher.git")) - (:option elpher-ipv4-always t - elpher-certificate-directory (acdw/in-dir "elpher/") - elpher-gemini-max-fill-width fill-column) - (:bind "n" elpher-next-link - "p" elpher-prev-link - "o" elpher-follow-current-link - "G" elpher-go-current) - (:hook acdw/reading-mode) - - ;; Make `eww' gemini/gopher aware. From Emacswiki. - (advice-add 'eww-browse-url :around - (defun elpher:eww-browse-url (original url &optional new-window) - "Handle gemini and gopher links." - (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url) - (require 'elpher) - (elpher-go url)) - (t (funcall original url new-window)))))) - -(setup (:straight (gemini-mode - :host nil - :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) - (:option (append auto-mode-alist) - '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode))) - -;;;;; Read e-books (nov.el) -(setup (:straight nov) - (:option nov-text-width fill-column - (append auto-mode-alist) '("\\.epub\\'" . nov-mode))) - -;;;;; Org mode -(setup (:straight (org :host nil - :repo "https://code.orgmode.org/bzg/org-mode.git")) - (require 'acdw-org) - (:option org-directory "~/org" - org-hide-emphasis-markers t - org-fontify-whole-heading-line t - org-fontify-done-headline t - org-fontify-quote-and-verse-blocks t - org-src-fontify-natively t - org-pretty-entities t - org-tags-column (- 0 fill-column -3) - org-src-tab-acts-natively t - org-src-window-setup 'current-window - org-confirm-babel-evaluate nil - org-adapt-indentation nil - org-catch-invisible-edits 'smart - org-special-ctrl-a/e t - org-special-ctrl-k t - org-imenu-depth 3 - org-export-headline-levels 8 - org-export-with-smart-quotes t - org-export-with-sub-superscripts t) - (:bind "RET" unpackaged/org-return-dwim) - (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines)) - -;;;;; PDF Tools -(when (eq acdw/system :home) - (setup (:straight pdf-tools) - (pdf-loader-install))) - + ;;; Programming languages ;; This section includes packages and other settings, because most languages' ;; packages aren't packaged with Emacs. -;;;;; Formatting +;;;; Formatting (setup (:straight (apheleia :host github :repo "raxod502/apheleia")) (apheleia-global-mode +1) -- cgit 1.4.1-21-gabe81