making emacs work better under nixos

This commit is contained in:
Chris Cochrun 2022-05-08 06:24:57 -05:00
parent bf57945a82
commit c25d060033
4 changed files with 62 additions and 191 deletions

191
init.el
View file

@ -38,16 +38,17 @@
(defun chris/set-transparency ()
"Set the frame to be transparent on Wayland compositors"
(if (string-search "wayland" x-display-name)
'((set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100))))))
(set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100))))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(chris/set-font-faces)))
(chris/set-font-faces)
(chris/set-transparency)
(tool-bar-mode -1)))
(chris/set-font-faces)))
(setq display-line-numbers-type 'relative)
@ -126,11 +127,7 @@
(use-package aggressive-indent
:defer 1
:config
<<<<<<< HEAD
(aggressive-indent-mode -1))
=======
)
>>>>>>> 2338cd74 (adding temel stuff)
(use-package adaptive-wrap
:defer t)
@ -141,6 +138,15 @@
(which-key-mode)
:defer 1)
(add-to-list 'exec-path "/home/chris/.nix-profile/bin")
(add-to-list 'exec-path "/run/current-system/sw/bin")
(setenv "NIX_CONF_DIR" "/etc/nix")
(setenv "NIX_OTHER_STORES" "/run/nix/remote-stores/*/nix")
(setenv "NIX_PATH" "nixpkgs=%h/nixpkgs:nixos=%h/nixpkgs/nixos:nixos-config=/etc/nixos/configuration.nix")
(setenv "NIX_PROFILES" "${pkgs.lib.concatStringsSep " " config.environment.profiles}")
(setenv "NIX_REMOTE" "daemon")
(setenv "NIX_USER_PROFILE_DIR" "/nix/var/nix/profiles/per-user/%u")
(use-package no-littering)
;; no-littering doesn't set this by default so we must place
@ -341,8 +347,7 @@
'((emacs-lisp . t)
(python . t)
(ditaa . t)
(shell . t)
(restclient . t)))
(shell . t)))
(setq org-ditaa-jar-path "/usr/bin/ditaa")
@ -611,6 +616,7 @@
(custom-set-faces
'(org-modern-tag ((t :background "#9aedfe" :foreground "#282a36")))
)
(global-org-modern-mode +1)
)
(defun chris/org-dwim-at-point (&optional arg)
@ -1047,7 +1053,7 @@ targets."
;; Recommended: Enable Corfu globally.
;; This is recommended since dabbrev can be used globally (M-/).
:init
(corfu-global-mode)
(global-corfu-mode)
:general
('corfu-map
"C-j" 'corfu-next
@ -1289,6 +1295,9 @@ targets."
(use-package lua-mode
:mode ("\\.lua\\'" . lua-mode))
(use-package nix-mode
:mode "\\.nix\\'")
(use-package lsp-mode
:commands (lsp lsp-deferred)
:custom
@ -1475,164 +1484,6 @@ targets."
(use-package ledger-mode)
(use-package mu4e
:ensure nil
:config
(setq mail-user-agent 'mu4e-user-agent)
(setq mu4e-maildir "~/Maildir"
user-full-name "Chris Cochrun"
mu4e-change-filenames-when-moving t
mu4e-get-mail-command "mbsync -a"
mu4e-update-interval (* 15 60)
mu4e-attachment-dir "/home/chris/nextcloud/home/Documents/attachments"
mu4e-completing-read-function #'completing-read)
(setq mu4e-contexts
(list
(make-mu4e-context
:name "work"
:match-func
(lambda (msg)
(when msg
(string-prefix-p "/office" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "chris@tfcconnection.org")
(mu4e-sent-folder . "/office/Sent Items/")
(mu4e-drafts-folder . "/office/Drafts")
(mu4e-trash-folder . "/office/Deleted Items")
(mu4e-refile-folder . "/office/Archive")
(smtpmail-smtp-user . "chris@tfcconnection.org")
(smtpmail-starttls-credentials . '(("smtp.office365.com" 587 nil nil)))
(smtpmail-auth-credentials . '(("smtp.office365.com" 587 "chris@tfcconnection.org" nil)))
(smtpmail-smtp-server . "smtp.office365.com")
(mu4e-compose-signature . "Praising God in all things,\nChris Cochrun")))
(make-mu4e-context
:name "outlook"
:match-func
(lambda (msg)
(when msg
(string-prefix-p "/outlook" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "chris.cochrun@outlook.com")
(mu4e-sent-folder . "/outlook/Sent/")
(mu4e-drafts-folder . "/outlook/Drafts")
(mu4e-trash-folder . "/outlook/Deleted")
(mu4e-refile-folder . "/outlook/Archive")
(smtpmail-smtp-user . "chris.cochrun@outlook.com")
(mu4e-compose-signature . "Praising God in all things,\nChris Cochrun")))
(make-mu4e-context
:name "personal"
:match-func
(lambda (msg)
(when msg
(string-prefix-p "/cochrun" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "chris@cochrun.xyz")
(mu4e-sent-folder . "/cochrun/Sent/")
(mu4e-drafts-folder . "/cochrun/Drafts")
(mu4e-trash-folder . "/cochrun/Trash")
(mu4e-refile-folder . "/cochrun/Archive")
(smtpmail-smtp-user . "chris@cochrun.xyz")
(smtpmail-starttls-credentials . '(("mail.cochrun.xyz" 587 nil nil)))
(smtpmail-auth-credentials . '(("mail.cochrun.xyz" 587 "chris@cochrun.xyz" nil)))
(smtpmail-smtp-server . "mail.cochrun.xyz")
(mu4e-compose-signature . "Praising God in all things,\nChris Cochrun")))
(make-mu4e-context
:name "gmail"
:match-func
(lambda (msg)
(when msg
(string-prefix-p "/gmail" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "ccochrun21@gmail.com")
(mu4e-sent-folder . "/gmail/[Gmail].Sent Mail/")
(smtpmail-smtp-user . "ccochrun21@gmail.com")
(mu4e-compose-signature . "Praising God in all things,\nChris Cochrun")))))
;; Add the ability to send email
(setq message-send-mail-function 'smtpmail-send-it
starttls-use-gnutls t
smtpmail-default-smtp-server "mail.cochrun.xyz"
smtpmail-smtp-service 587)
;; shortcuts in the jumplist by pressing "J" in the mu4e buffer
(setq mu4e-maildir-shortcuts
'((:maildir "/office/Archive" :key ?a)
(:maildir "/office/INBOX" :key ?i)
(:maildir "/cochrun/INBOX" :key ?p)
(:maildir "/outlook/INBOX" :key ?l)
(:maildir "/office/Junk Email" :key ?j)
(:maildir "/office/INBOX/Website Forms" :key ?f)
(:maildir "/gmail/INBOX" :key ?g)
(:maildir "/office/Sent Items" :key ?s)))
;; (add-to-list mu4e-headers-actions ("org capture message" . mu4e-org-store-and-capture))
(setq mu4e-bookmarks
'((:name "Unread messages"
:query "flag:unread AND NOT flag:trashed AND NOT maildir:\"/outlook/Junk\" AND NOT maildir:\"/office/Junk Email\" AND NOT maildir:\"/outlook/Deleted\" AND NOT maildir:\"/office/Deleted Items\""
:key 117)
(:name "Today's messages"
:query "date:today..now"
:key 116)
(:name "Last 7 days"
:query "date:7d..now"
:hide-unread t
:key 119)
(:name "Messages with images"
:query "mime:image/*"
:key 112)))
(setq mu4e-mu-binary "/usr/bin/mu"
mu4e-view-prefer-html nil
shr-color-visible-luminance-min 80)
(setq mu4e-use-fancy-chars t
mu4e-headers-draft-mark '("D" . "")
mu4e-headers-flagged-mark '("F" . "")
mu4e-headers-new-mark '("N" . "")
mu4e-headers-passed-mark '("P" . "")
mu4e-headers-replied-mark '("R" . "")
mu4e-headers-seen-mark '("S" . "")
mu4e-headers-trashed-mark '("T" . "")
mu4e-headers-attach-mark '("a" . "")
mu4e-headers-encrypted-mark '("x" . "")
mu4e-headers-signed-mark '("s" . "")
mu4e-headers-unread-mark '("u" . ""))
(setq mu4e-headers-fields
'((:human-date . 12)
(:flags . 6)
(:from . 22)
(:subject)))
(setq mu4e-view-actions
'(("capture message" . mu4e-action-capture-message)
("view in browser" . mu4e-action-view-in-browser)
("show this thread" . mu4e-action-show-thread)))
(defun chris/setup-mu4e-headers ()
(toggle-truncate-lines +1)
(display-line-numbers-mode -1))
(defun chris/setup-mu4e-view ()
(display-line-numbers-mode -1)
(toggle-truncate-lines +1)
(setq visual-fill-column-center-text t)
(setq visual-fill-column-width 100)
(visual-fill-column-mode +1))
(remove-hook 'mu4e-main-mode-hook '(display-line-numbers-mode -1))
(add-hook 'mu4e-headers-mode-hook #'chris/setup-mu4e-headers)
(add-hook 'mu4e-view-mode-hook #'chris/setup-mu4e-view)
(mu4e t)
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"om" 'mu4e)
(general-def 'normal mu4e-view-mode-map
"ga" 'mu4e-view-save-attachments))
(use-package org-msg
:hook (mu4e-compose-mode . org-msg-edit-mode)
:config