summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-09-20 19:11:00 +0300
committerMarc Coquand <marc@mccd.space>2024-09-20 19:11:00 +0300
commitb2f56a06a9b6d3c2fdc09b33fbbd568b651d5eab (patch)
treeace0ee0d7acf2af94839e893d8a3a7e514e185c9 /emacs
parente233e7f028366ce8f5d58fe1cc8a88210664ddb3 (diff)
downloadbsd-b2f56a06a9b6d3c2fdc09b33fbbd568b651d5eab.tar.gz
bsd-b2f56a06a9b6d3c2fdc09b33fbbd568b651d5eab.tar.bz2
bsd-b2f56a06a9b6d3c2fdc09b33fbbd568b651d5eab.zip
.
Diffstat (limited to '')
-rw-r--r--emacs234
1 files changed, 234 insertions, 0 deletions
diff --git a/emacs b/emacs
new file mode 100644
index 0000000..1a7e823
--- /dev/null
+++ b/emacs
@@ -0,0 +1,234 @@
+(set-face-attribute 'default nil :height 150)
+(set-frame-font "Iosevka Slab Extended" nil t)
+
+(menu-bar-mode -1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+(display-battery-mode t)
+(pixel-scroll-precision-mode)
+(delete-selection-mode 1)
+(fset 'yes-or-no-p 'y-or-n-p)
+(setq initial-scratch-message ";; scratch")
+(setq-default frame-title-format '("%b"))
+(setq ring-bell-function 'ignore)
+(setq inhibit-startup-screen t)
+(setq line-spacing 0.15)
+
+
+;; Put Emacs auto-save and backup files to /tmp
+(defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory))
+(setq
+ backup-by-copying t ; Avoid symlinks
+ delete-old-versions t
+ kept-new-versions 6
+ kept-old-versions 2
+ version-control t
+ auto-save-list-file-prefix emacs-tmp-dir
+ auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t)) ; Change autosave dir to tmp
+ backup-directory-alist `((".*" . ,emacs-tmp-dir)))
+
+;; Packages
+(setq package-list '(
+ magit
+ go-mode
+ devdocs
+ rec-mode
+ almost-mono-themes
+ markdown-mode
+ tldr
+ mastodon
+ expand-region))
+
+(require 'package)
+
+;; list the repositories containing them
+(setq package-archives '(("elpa" . "https://elpa.gnu.org")
+ ("gnu" . "http://elpa.gnu.org/packages/")
+ ("melpa" . "https://melpa.org/packages/")
+ ("melpa-stable" . "https://stable.melpa.org/packages/")))
+
+;; activate all thpe packages (in particular autoloads)
+(package-initialize)
+
+;; fetch the list of packages available
+(unless package-archive-contents
+ (package-refresh-contents))
+
+;; install the missing packages
+(dolist (package package-list)
+ (unless (package-installed-p package)
+ (package-install package)))
+
+;; Expand Region
+(require 'expand-region)
+(global-set-key (kbd "C-.") 'er/expand-region)
+(global-set-key (kbd "C-,") 'er/contract-region)
+(global-set-key (kbd "C-h D") 'devdocs-lookup)
+
+
+;; Markdown
+(add-hook 'markdown-mode-hook 'variable-pitch-mode)
+(add-hook 'markdown-mode-hook 'visual-line-mode)
+
+;; Pairs
+(electric-pair-mode 1)
+
+;; IDO
+(ido-mode t)
+
+;; Eglot
+(require 'eglot)
+(define-key eglot-mode-map (kbd "C-c r") 'eglot-rename)
+(define-key eglot-mode-map (kbd "C-c o") 'eglot-code-actions-at-mouse)
+(define-key eglot-mode-map (kbd "C-c h") 'eldoc)
+
+(add-hook 'go-mode-hook 'eglot-ensure)
+
+(set 'eldoc-print-after-edit t)
+(global-eldoc-mode t)
+(setq eldoc-echo-area-prefer-doc-buffer t)
+
+(setq make-backup-files nil)
+
+;; X integration
+(setq x-select-enable-clipboard t)
+(setq x-select-enable-primary t)
+
+(add-to-list 'load-path "~/.emacs.d/elisp")
+(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
+
+(setq-default grep-template (string-join '("ugrep"
+ "--color=never"
+ "--ignore-binary"
+ "--ignore-case"
+ "--include=<F>"
+ "--line-number"
+ "--null"
+ "--recursive"
+ "--regexp=<R>")
+ " "))
+
+(require 'secrets)
+(require 'auth-source-pass (auth-source-pass-enable))
+
+
+(global-set-key
+ "\C-cef"
+ (lambda ()
+ (interactive)
+ (erc :server
+ "irc.libera.chat" :port "6667" :nick "mccd"
+ :password (shell-command-to-string "pass show libera.chat"))))
+
+(setq rmail-movemail-program "/nix/store/idfxv25n52wkwnw7y5ks6bk6x17xapkp-user-environment/bin/movemail")
+(setq rmail-primary-inbox-list '("maildir:///home/mccd/mail-home/"))
+
+(setq shr-max-image-proportion 0.3
+ mastodon-active-user "marcc"
+ mastodon-instance-url "https://fosstodon.org")
+
+;; Mu4e
+(use-package mu4e
+ :ensure nil
+ :load-path "/usr/share/emacs/site-lisp/mu4e/"
+ :config
+
+ ;; This is set to 't' to avoid mail syncing issues when using mbsync
+ (setq mu4e-change-filenames-when-moving t)
+
+ ;; Refresh mail using isync every 10 minutes
+ (setq mu4e-update-interval (* 10 60)
+ mu4e-get-mail-command "mbsync -a"
+ mu4e-view-show-images t
+ mu4e-view-show-addresses t
+ mu4e-attachment-dir "~/Downloads"
+ mu4e-view-prefer-html t
+ message-send-mail-function 'smtpmail-send-it
+ mu4e-maildir "~/mail")
+
+ (setq mu4e-contexts
+ (list
+ ;; Home
+ (make-mu4e-context
+ :name "home"
+ :enter-func (lambda () (mu4e-message "Entering personal context"))
+ :leave-func (lambda () (mu4e-message "Leaving personal context"))
+ :match-func
+ (lambda (msg)
+ (when msg
+ (string-prefix-p "/home" (mu4e-message-field msg :maildir))))
+ :vars '((user-mail-address . "marc@mccd.space")
+ (user-full-name . "Marc Coquand")
+ (mu4e-drafts-folder . "/home/Drafts")
+ (mu4e-sent-folder . "/home/Sent")
+ (mu4e-refile-folder . "/home/Archive")
+ (mu4e-trash-folder . "/home/Trash")
+ (mu4e-maildir-shortcuts .
+ (("/home/INBOX" . ?i)
+ ("/home/Archive/Done" . ?d)
+ ("/home/Archive" . ?a)
+ ("/home/Archive/Todo" . ?t)))))
+ ;; Work account
+ (make-mu4e-context
+ :name "work"
+ :enter-func (lambda () (mu4e-message "Entering work context"))
+ :leave-func (lambda () (mu4e-message "Leaving work context"))
+ :match-func
+ (lambda (msg)
+ (when msg
+ (string-prefix-p "/work" (mu4e-message-field msg :maildir))))
+ :vars '((user-mail-address . "marc.coquand@sustainably.app")
+ (user-full-name . "Marc Coquand")
+ (mu4e-drafts-folder . "/work/[Gmail]/Drafts")
+ (mu4e-sent-folder . "/work/[Gmail]/Sent Mail")
+ (mu4e-refile-folder . "/work/[Gmail]/All Mail")
+ (mu4e-sent-messages-behavior . delete)
+ (mu4e-trash-folder . "/work/[Gmail]/Trash")
+ (mu4e-maildir-shortcuts .
+ (("/work/[Gmail]/All Mail" . ?a)
+ ("/work/INBOX" . ?i))))))))
+
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(eglot-highlight-symbol-face ((t (:weight bold))))
+ '(eglot-mode-line ((t (:weight regular))))
+ '(erc-timestamp-face ((t (:foreground "blue" :weight bold))))
+ '(font-lock-builtin-face ((t (:weight regular))))
+ '(font-lock-comment-face ((t (:foreground "#0000FF" :slant normal))))
+ '(font-lock-constant-face ((t (:slant italic :weight regular))))
+ '(font-lock-function-name-face ((t (:weight regular))))
+ '(font-lock-keyword-face ((t (:weight regular))))
+ '(font-lock-string-face ((t (:foreground "black"))))
+ '(font-lock-type-face ((t (:foreground "black"))))
+ '(font-lock-variable-name-face ((t (:foreground "black"))))
+ '(header-line ((t (:inherit mode-line :background "white" :foreground "grey20" :box nil :underline "black"))))
+ '(highlight ((t (:background "light yellow"))))
+ '(mastodon-display-name-face ((t (:inherit nil :weight bold))))
+ '(mode-line ((t (:background "white" :foreground "black" :box (:line-width (1 . -1) :style flat-button) :overline "black"))))
+ '(mu4e-header-highlight-face ((t (:inherit hl-line :extend t :weight bold))))
+ '(mu4e-highlight-face ((t (:inherit highlight))))
+ '(tldr-code-block ((t (:background "cornsilk" :foreground "black"))))
+ '(tldr-command-argument ((t (:background "cornsilk" :foreground "black"))))
+ '(tldr-command-itself ((t (:background "khaki" :foreground "black" :weight bold))))
+ '(tldr-introduction ((t (:foreground "black" :slant italic))))
+ '(tldr-title ((t (:inherit variable-pitch :foreground "black" :weight bold :height 1.2))))
+ '(variable-pitch ((t (:family "Iosevka Aile")))))
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(custom-safe-themes
+ '("cbd85ab34afb47003fa7f814a462c24affb1de81ebf172b78cb4e65186ba59d2" default))
+ '(mastodon-tl--enable-proportional-fonts t)
+ '(mastodon-use-emojify t)
+ '(mu4e-bookmarks
+ '((:name "Last 7 days" :query "date:7d..now" :hide-unread t :key 119)
+ (:name "Messages with images" :query "mime:image/*" :key 112)))
+ '(package-selected-packages
+ '(smartparens markdown-mode mastodon tldr almost-mono-themes rec-mode magit go-mode expand-region devdocs)))
+(put 'secrets-mode 'disabled nil)