summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el172
1 files changed, 44 insertions, 128 deletions
diff --git a/init.el b/init.el index aec757e..985fa2c 100644 --- a/init.el +++ b/init.el
@@ -243,10 +243,12 @@
243(use-package auto-compile 243(use-package auto-compile
244 :custom 244 :custom
245 (load-prefer-newer t) 245 (load-prefer-newer t)
246 :init
247 (defun acdw/setup-auto-compile ()
248 (auto-compile-on-load-mode)
249 (auto-compile-on-save-mode))
246 :hook 250 :hook
247 (emacs-lisp-mode-hook . (lambda () 251 (emacs-lisp-mode-hook . acdw/setup-auto-compile))
248 (auto-compile-on-load-mode)
249 (auto-compile-on-save-mode))))
250 252
251;;;; Recent files 253;;;; Recent files
252(use-package recentf 254(use-package recentf
@@ -327,16 +329,18 @@
327 :hook 329 :hook
328 (after-init-hook . selectrum-mode)) 330 (after-init-hook . selectrum-mode))
329 331
330(use-package prescient) 332(use-package prescient
333 :hook
334 (after-init-hook . prescient-persist-mode))
331 335
332(use-package selectrum-prescient 336(use-package selectrum-prescient
333 :hook 337 :hook
334 (after-init-hook . (lambda () 338 (after-init-hook . (selectrum-prescient-mode)))
335 (selectrum-prescient-mode)
336 (prescient-persist-mode))))
337 339
338;;;;; Searching 340;;;;; Searching
339(use-package ctrlf 341(use-package ctrlf
342 :custom
343 (ctrlf-show-match-count-at-eol nil)
340 :hook 344 :hook
341 (after-init-hook . ctrlf-mode)) 345 (after-init-hook . ctrlf-mode))
342 346
@@ -485,7 +489,6 @@
485 ("C-=" . er/expand-region)) 489 ("C-=" . er/expand-region))
486 490
487;;;; Programming 491;;;; Programming
488
489;;;;; Code completion 492;;;;; Code completion
490(use-package company 493(use-package company
491 :custom 494 :custom
@@ -543,10 +546,12 @@
543 546
544;;;;;; Smartly deal with pairs 547;;;;;; Smartly deal with pairs
545(use-package smartparens 548(use-package smartparens
549 :init
550 (defun acdw/setup-smartparens ()
551 (require 'smartparens-config)
552 (smartparens-mode))
546 :hook 553 :hook
547 (prog-mode-hook . (lambda () 554 (prog-mode-hook . acdw/setup-smartparens))
548 (require 'smartparens-config)
549 (smartparens-global-mode))))
550 555
551;;;;;; Show delimiters as different colors 556;;;;;; Show delimiters as different colors
552(use-package rainbow-delimiters 557(use-package rainbow-delimiters
@@ -559,7 +564,6 @@
559 (prog-mode-hook . rainbow-mode)) 564 (prog-mode-hook . rainbow-mode))
560 565
561;;;; Writing 566;;;; Writing
562
563;;;;; `fill-column', but in `visual-line-mode' 567;;;;; `fill-column', but in `visual-line-mode'
564(use-package visual-fill-column 568(use-package visual-fill-column
565 :custom 569 :custom
@@ -570,10 +574,8 @@
570 :after #'visual-fill-column-adjust)) 574 :after #'visual-fill-column-adjust))
571 575
572;;;; Machine-specific 576;;;; Machine-specific
573
574;;;;; Linux at home 577;;;;; Linux at home
575(when *acdw/at-home* 578(when *acdw/at-home*
576
577;;;;;; Edit files with `sudo' (I think?) 579;;;;;; Edit files with `sudo' (I think?)
578 (use-package su 580 (use-package su
579 :hook 581 :hook
@@ -592,7 +594,6 @@
592 ) 594 )
593 595
594;;; Specialized packages 596;;; Specialized packages
595
596;;;; Gemini & Gopher 597;;;; Gemini & Gopher
597(use-package elpher 598(use-package elpher
598 :straight (elpher 599 :straight (elpher
@@ -602,115 +603,26 @@
602 ("p" . elpher-prev-link) 603 ("p" . elpher-prev-link)
603 ("o" . elpher-follow-current-link) 604 ("o" . elpher-follow-current-link)
604 ("G" . elpher-go-current)) 605 ("G" . elpher-go-current))
605 :hook (elpher-mode-hook . (lambda () 606 :init
606 (variable-pitch-mode) 607 (defun acdw/setup-elpher ()
607 (set-fill-column 100) 608 (variable-pitch-mode)
608 (visual-fill-column-mode)))) 609 (set-fill-column 100)
610 (visual-fill-column-mode))
611 :hook (elpher-mode-hook . acdw/setup-elpher))
609 612
610(use-package gemini-mode 613(use-package gemini-mode
611 :straight (gemini-mode 614 :straight (gemini-mode
612 :repo "https://git.carcosa.net/jmcbray/gemini.el.git") 615 :repo "https://git.carcosa.net/jmcbray/gemini.el.git")
613 :hook (gemini-mode-hook . (lambda () 616 :init
614 ;; (variable-pitch-mode) 617 (defun acdw/setup-gemini-mode ()
615 (set-fill-column 100) 618 (set-fill-column 100)
616 (visual-fill-column-mode)))) 619 (visual-fill-column-mode))
620 :hook (gemini-mode-hook . acdw/setup-gemini-mode))
617 621
618(use-package gemini-write 622(use-package gemini-write
619 :straight (gemini-write 623 :straight (gemini-write
620 :repo "https://alexschroeder.ch/cgit/gemini-write")) 624 :repo "https://alexschroeder.ch/cgit/gemini-write"))
621 625
622;;;; IRC
623(use-package circe
624 :init
625 (defun my/fetch-password (&rest params)
626 "Fetch a password from auth-sources"
627 (require 'auth-source)
628 (let ((match (car (apply 'auth-source-search params))))
629 (if match
630 (let ((secret (plist-get match :secret)))
631 (if (functionp secret)
632 (funcall secret)
633 secret))
634 (error "Password not found for %S" params))))
635
636 (defun my/sasl-password (nick server)
637 "Fetch a password for $server and $nick"
638 (my/fetch-password :user nick :host server))
639 (require 'lui-autopaste)
640 (defun my/circe-prompt ()
641 (lui-set-prompt
642 (concat (propertize (concat (buffer-name) ">")
643 'face 'circe-prompt-face)
644 " ")))
645 (defun my/lui-setup ()
646 (setq right-margin-width 5
647 fringes-outside-margins t
648 word-wrap t
649 wrap-prefix " ")
650 (setf (cdr (assoc 'continuation fringe-indicator-alist)) nil))
651 :hook
652 (circe-channel-mode-hook . enable-lui-autopaste)
653 (circe-chat-mode-hook . my/circe-prompt)
654 (lui-mode-hook . my/lui-setup)
655 :config
656 (setq circe-default-part-message "Peace out, cub scouts")
657 (setq circe-default-quit-message "See You Space Cowpokes ......")
658 (setq circe-default-realname "Case D")
659 (setq circe-highlight-nick-type 'all)
660 (setq circe-reduce-lurker-spam t)
661 (setq circe-format-say "{nick:-12s} {body}")
662 (setq circe-format-self-say "{nick:-11s}> {body}")
663 (setq lui-time-stamp-position 'right-margin)
664 (setq lui-fill-type nil)
665 (setq lui-time-stamp-format "%H:%M")
666 (setq lui-track-bar-behavior 'before-switch-to-buffer)
667 (setq circe-network-options
668 `(("Freenode"
669 :tls t
670 :port 6697
671 :nick "acdw"
672 :sasl-username "acdw"
673 :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net")
674 :channels ("#emacs" "#daydreams"))
675 ("Tilde.chat"
676 :tls t
677 :port 6697
678 :nick "acdw"
679 :sasl-username "acdw"
680 :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat")
681 :channels ("#gemini" "#meta"))))
682 (enable-lui-track-bar)
683 :custom-face
684 (circe-my-message-face ((t (:inherit 'circe-highlight-nick-face :weight normal))))
685 (circe-originator-face ((t (:weight bold))))
686 (circe-prompt-face ((t (:inherit 'circe-my-message-face)))))
687
688;;;; eshell
689(use-package eshell
690 :init
691 (defun eshell/emacs (&rest args)
692 "Open a file in emacs."
693 (if (null args)
694 (bury-buffer)
695 (mapc #'find-file
696 (mapcar #'expand-file-name
697 (eshell-flatten-list (reverse args))))))
698 (defun eshell/info (&optional subject)
699 "Invoke `info', optionally opening Info to SUBJECT."
700 (require 'cl)
701 (let ((buf (current-buffer)))
702 (Info-directory)
703 (if (not (null subject))
704 (let ((node-exists (ignore-errors (Info-menu subject))))
705 (if (not node-exists)
706 (format "No menu item `%s' in node `(dir)Top'."
707 subject)))))))
708
709(use-package eshell-syntax-highlighting
710 :after esh-mode
711 :config
712 (eshell-syntax-highlighting-global-mode))
713
714;;;; org-mode 626;;;; org-mode
715(use-package org 627(use-package org
716 :custom 628 :custom
@@ -758,22 +670,26 @@
758 ("\\.html?\\'" . web-mode) 670 ("\\.html?\\'" . web-mode)
759 ("\\.css?\\'" . web-mode) 671 ("\\.css?\\'" . web-mode)
760 ("\\.js\\'" . web-mode)) 672 ("\\.js\\'" . web-mode))
673 :init
674 (defun acdw/setup-web-mode ()
675 (set (make-local-variable 'company-backends
676 '(company-css
677 company-web-html
678 company-files))))
761 :hook 679 :hook
762 (web-mode-hook 680 (web-mode-hook . acdw/setup-web-mode))
763 . (lambda ()
764 (set (make-local-variable 'company-backends
765 '(company-css company-web-html company-files))))))
766 681
767(use-package emmet-mode 682(use-package emmet-mode
683 :init
684 (defun acdw/setup-emmet-in-web-mode ()
685 (let ((web-mode-cur-language
686 (web-mode-language-at-pos)))
687 (if (string= web-mode-cur-language "css")
688 (setq emmet-use-css-transform t)
689 (setq emmet-use-css-transform nil))))
768 :hook 690 :hook
769 (web-mode-hook . emmet-mode) 691 (web-mode-hook . emmet-mode)
770 (web-mode-before-auto-complete-hooks 692 (web-mode-before-auto-complete-hooks . acdw/setup-emmet-in-web-mode))
771 . (lambda () 693
772 (let ((web-mode-cur-language 694 (provide 'init)
773 (web-mode-language-at-pos)))
774 (if (string= web-mode-cur-language "css")
775 (setq emmet-use-css-transform t)
776 (setq emmet-use-css-transform nil))))))
777
778(provide 'init)
779;;; init.el ends here 695;;; init.el ends here