about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el314
1 files 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 @@
259 (remove-function after-focus-change-function 259 (remove-function after-focus-change-function
260 'hook--setup-fonts))) 260 'hook--setup-fonts)))
261 261
262;;;; Dired
263(setup dired
264 (:setq-default dired-recursive-copies 'always
265 dired-recursive-deletes 'always
266 delete-by-moving-to-trash t
267 dired-listing-switches "-Al"
268 ls-lisp-dirs-first t
269 dired-ls-F-marks-symlinks t
270 dired-no-confirm '(byte-compile
271 chgrp chmod chown copy
272 hardlink load move
273 shell touch symlink)
274 dired-dwim-target t)
275 (:also-load dired-x)
276 (:hook dired-hide-details-mode
277 hl-line-mode)
278 (:global "C-x C-j" dired-jump)
279 (:bind "RET" dired-find-alternate-file))
280
281;;;; Web browsing
282(setup browse-url
283 (:setq-default browse-url-browser-function 'eww-browse-url
284 browse-url-secondary-browser-function
285 (if (executable-find "firefox")
286 'browse-url-firefox
287 'browse-url-default-browser)
288 browse-url-new-window-flag t
289 browse-url-firefox-new-window-is-tab t)
290 (when (eq acdw/system :work)
291 (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")))
292
293(setup shr
294 (:option shr-width fill-column
295 shr-max-width fill-column
296 shr-max-image-proportion 0.6
297 shr-image-animate t
298 shr-discard-aria-hidden t))
299
300(setup eww
301 (:hook acdw/reading-mode))
302
303;;;; Eshell
304(setup eshell
305 (defun eshell-quit-or-delete-char (arg)
306 "Delete the character to the right, or quit eshell on an empty line."
307 (interactive "p")
308 (if (and (eolp) (looking-back eshell-prompt-regexp))
309 (eshell-life-is-too-much)
310 (delete-forward-char arg)))
311 (:option eshell-directory-name (acdw/in-dir "eshell/" t)
312 eshell-aliases-file (acdw/in-dir "eshell/aliases" t))
313 (add-hook 'eshell-mode-hook
314 (defun hook--eshell-setup ()
315 "Stuff to do after eshell is done setting up."
316 (define-key eshell-mode-map (kbd "C-d")
317 #'eshell-quit-or-delete-char)
318 (setq mode-line-format '(:eval simple-modeline--mode-line)))))
319
320;;;; Ediff
321(setup ediff
322 (:option ediff-window-setup-function 'ediff-setup-windows-plain
323 ediff-split-window-function 'split-window-horizontally))
324
325;;;; Debugger 262;;;; Debugger
326(setup debugger 263(setup debugger
327 (:hook visual-line-mode) 264 (:hook visual-line-mode)
@@ -407,6 +344,170 @@
407(global-set-key (kbd "M-=") #'count-words) 344(global-set-key (kbd "M-=") #'count-words)
408(global-set-key (kbd "C-x C-b") #'ibuffer) 345(global-set-key (kbd "C-x C-b") #'ibuffer)
409 346
347
348;;; Applications
349;; Some of these are built-in, some are packages; all are "extra" functionality
350;; in Emacs (i.e., they're not /just/ editing text)
351;;;; Org mode
352(setup (:straight (org :host nil
353 :repo "https://code.orgmode.org/bzg/org-mode.git"))
354 (require 'acdw-org)
355 (:option org-directory "~/org"
356 org-hide-emphasis-markers t
357 org-fontify-whole-heading-line t
358 org-fontify-done-headline t
359 org-fontify-quote-and-verse-blocks t
360 org-src-fontify-natively t
361 org-pretty-entities t
362 org-tags-column (- 0 fill-column -3)
363 org-src-tab-acts-natively t
364 org-src-window-setup 'current-window
365 org-confirm-babel-evaluate nil
366 org-adapt-indentation nil
367 org-catch-invisible-edits 'smart
368 org-special-ctrl-a/e t
369 org-special-ctrl-k t
370 org-imenu-depth 3
371 org-export-headline-levels 8
372 org-export-with-smart-quotes t
373 org-export-with-sub-superscripts t)
374 (:bind "RET" unpackaged/org-return-dwim)
375 (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines))
376
377;;;; Eshell
378(setup eshell
379 (defun eshell-quit-or-delete-char (arg)
380 "Delete the character to the right, or quit eshell on an empty line."
381 (interactive "p")
382 (if (and (eolp) (looking-back eshell-prompt-regexp))
383 (eshell-life-is-too-much)
384 (delete-forward-char arg)))
385 (:option eshell-directory-name (acdw/in-dir "eshell/" t)
386 eshell-aliases-file (acdw/in-dir "eshell/aliases" t))
387 (add-hook 'eshell-mode-hook
388 (defun hook--eshell-setup ()
389 "Stuff to do after eshell is done setting up."
390 (define-key eshell-mode-map (kbd "C-d")
391 #'eshell-quit-or-delete-char)
392 (setq mode-line-format '(:eval simple-modeline--mode-line)))))
393
394
395;;;; Ediff
396(setup ediff
397 (:option ediff-window-setup-function 'ediff-setup-windows-plain
398 ediff-split-window-function 'split-window-horizontally))
399
400;;;; Reading mail
401;; Let's try Gnus.
402(setup gnus
403 (:option gnus-select-method '(nnnil nil)
404 gnus-secondary-select-methods
405 '((nnimap "imap.fastmail.com"
406 (nnimap-inbox "INBOX")
407 (nnimap-stream ssl)
408 (nnimap-expunge never)))))
409
410;;;; Web browsing
411(setup browse-url
412 (:setq-default browse-url-browser-function 'eww-browse-url
413 browse-url-secondary-browser-function
414 (if (executable-find "firefox")
415 'browse-url-firefox
416 'browse-url-default-browser)
417 browse-url-new-window-flag t
418 browse-url-firefox-new-window-is-tab t)
419 (when (eq acdw/system :work)
420 (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")))
421
422(setup shr
423 (:option shr-width fill-column
424 shr-max-width fill-column
425 shr-max-image-proportion 0.6
426 shr-image-animate t
427 shr-discard-aria-hidden t))
428
429(setup eww
430 (:hook acdw/reading-mode))
431
432;;;; Gemini/gopher browsing
433(setup (:straight (elpher :host nil
434 :repo "git://thelambdalab.xyz/elpher.git"))
435 (:option elpher-ipv4-always t
436 elpher-certificate-directory (acdw/in-dir "elpher/")
437 elpher-gemini-max-fill-width fill-column)
438 (:bind "n" elpher-next-link
439 "p" elpher-prev-link
440 "o" elpher-follow-current-link
441 "G" elpher-go-current)
442 (:hook acdw/reading-mode)
443
444 ;; Make `eww' gemini/gopher aware. From Emacswiki.
445 (advice-add 'eww-browse-url :around
446 (defun elpher:eww-browse-url (original url &optional new-window)
447 "Handle gemini and gopher links."
448 (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)
449 (require 'elpher)
450 (elpher-go url))
451 (t (funcall original url new-window))))))
452
453(setup (:straight (gemini-mode
454 :host nil
455 :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))
456 (:option (append auto-mode-alist)
457 '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)))
458
459;;;; File browsing
460(setup dired
461 (:setq-default dired-recursive-copies 'always
462 dired-recursive-deletes 'always
463 delete-by-moving-to-trash t
464 dired-listing-switches "-Al"
465 ls-lisp-dirs-first t
466 dired-ls-F-marks-symlinks t
467 dired-no-confirm '(byte-compile
468 chgrp chmod chown copy
469 hardlink load move
470 shell touch symlink)
471 dired-dwim-target t)
472 (:also-load dired-x)
473 (:hook dired-hide-details-mode
474 hl-line-mode)
475 (:global "C-x C-j" dired-jump)
476 (:bind "RET" dired-find-alternate-file)
477 (with-eval-after-load 'dired
478 (setup (:straight dired-subtree)
479 (define-key dired-mode-map "i" #'dired-subtree-toggle))
480
481 (setup (:straight dired-collapse)
482 (:hook-into dired-mode))
483
484 (setup (:straight trashed)
485 (:option trashed-action-confirmer 'y-or-n-p))))
486
487;;;; Magit
488(setup (:straight magit)
489 (:acdw/leader "g" magit-status)
490 (:option magit-display-buffer-function
491 (defun magit-display-buffer-same-window (buffer)
492 "Display BUFFER in the selected window like God intended."
493 (display-buffer buffer '(display-buffer-same-window)))
494 magit-popup-display-buffer-action '((display-buffer-same-window))))
495
496;;;; Read e-books (nov.el)
497(setup (:straight nov)
498 (:option nov-text-width fill-column
499 (append auto-mode-alist) '("\\.epub\\'" . nov-mode)))
500
501;;;; PDF Tools
502(when (eq acdw/system :home)
503 (setup (:straight pdf-tools)
504 (pdf-loader-install)))
505
506;;;; VTerm
507(when (eq acdw/system :home)
508 (setup (:straight vterm)))
509
510
410;;; Packages 511;;; Packages
411 512
412;;;; Interactivity 513;;;; Interactivity
@@ -676,95 +777,12 @@ if ripgrep is installed, otherwise `consult-grep'."
676(when (eq acdw/system :home) 777(when (eq acdw/system :home)
677 (setup (:straight pkgbuild-mode))) 778 (setup (:straight pkgbuild-mode)))
678 779
679;;;; Applications 780
680
681;;;;; Magit
682(setup (:straight magit)
683 (:acdw/leader "g" magit-status)
684 (:option magit-display-buffer-function
685 (defun magit-display-buffer-same-window (buffer)
686 "Display BUFFER in the selected window like God intended."
687 (display-buffer buffer '(display-buffer-same-window)))
688 magit-popup-display-buffer-action '((display-buffer-same-window))))
689
690;;;;; File browsing
691(setup (:straight dired-subtree)
692 (define-key dired-mode-map "i" #'dired-subtree-toggle))
693
694(setup (:straight dired-collapse)
695 (:hook-into dired-mode))
696
697(setup (:straight trashed)
698 (:option trashed-action-confirmer 'y-or-n-p))
699
700;;;;; Gemini/gopher browsing
701(setup (:straight (elpher :host nil
702 :repo "git://thelambdalab.xyz/elpher.git"))
703 (:option elpher-ipv4-always t
704 elpher-certificate-directory (acdw/in-dir "elpher/")
705 elpher-gemini-max-fill-width fill-column)
706 (:bind "n" elpher-next-link
707 "p" elpher-prev-link
708 "o" elpher-follow-current-link
709 "G" elpher-go-current)
710 (:hook acdw/reading-mode)
711
712 ;; Make `eww' gemini/gopher aware. From Emacswiki.
713 (advice-add 'eww-browse-url :around
714 (defun elpher:eww-browse-url (original url &optional new-window)
715 "Handle gemini and gopher links."
716 (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)
717 (require 'elpher)
718 (elpher-go url))
719 (t (funcall original url new-window))))))
720
721(setup (:straight (gemini-mode
722 :host nil
723 :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))
724 (:option (append auto-mode-alist)
725 '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)))
726
727;;;;; Read e-books (nov.el)
728(setup (:straight nov)
729 (:option nov-text-width fill-column
730 (append auto-mode-alist) '("\\.epub\\'" . nov-mode)))
731
732;;;;; Org mode
733(setup (:straight (org :host nil
734 :repo "https://code.orgmode.org/bzg/org-mode.git"))
735 (require 'acdw-org)
736 (:option org-directory "~/org"
737 org-hide-emphasis-markers t
738 org-fontify-whole-heading-line t
739 org-fontify-done-headline t
740 org-fontify-quote-and-verse-blocks t
741 org-src-fontify-natively t
742 org-pretty-entities t
743 org-tags-column (- 0 fill-column -3)
744 org-src-tab-acts-natively t
745 org-src-window-setup 'current-window
746 org-confirm-babel-evaluate nil
747 org-adapt-indentation nil
748 org-catch-invisible-edits 'smart
749 org-special-ctrl-a/e t
750 org-special-ctrl-k t
751 org-imenu-depth 3
752 org-export-headline-levels 8
753 org-export-with-smart-quotes t
754 org-export-with-sub-superscripts t)
755 (:bind "RET" unpackaged/org-return-dwim)
756 (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines))
757
758;;;;; PDF Tools
759(when (eq acdw/system :home)
760 (setup (:straight pdf-tools)
761 (pdf-loader-install)))
762
763;;; Programming languages 781;;; Programming languages
764;; This section includes packages and other settings, because most languages' 782;; This section includes packages and other settings, because most languages'
765;; packages aren't packaged with Emacs. 783;; packages aren't packaged with Emacs.
766 784
767;;;;; Formatting 785;;;; Formatting
768(setup (:straight (apheleia :host github 786(setup (:straight (apheleia :host github
769 :repo "raxod502/apheleia")) 787 :repo "raxod502/apheleia"))
770 (apheleia-global-mode +1) 788 (apheleia-global-mode +1)