diff options
Diffstat (limited to '')
45 files changed, 516 insertions, 1330 deletions
diff --git a/.gitignore b/.gitignore index 366c1cc..0c26f81 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ /elpa/ /url/ /eshell/ +/history +/places +/projects +/recentf +/transient/ diff --git a/config/init-base.el b/config/init-base.el new file mode 100644 index 0000000..799dce6 --- /dev/null +++ b/config/init-base.el @@ -0,0 +1,143 @@ +;;; init-base.el --- base configuration -*- lexical-binding: t -*- +;; Author: Franck Cuny <franck@fcuny.net> + +;;; Commentary: + +;; commentary + +;;; Code: + +(setq sentence-end-double-space nil + create-lockfiles nil ;; don't use a lock file + tab-always-indent 'complete ;; when using TAB, always indent + initial-major-mode 'fundamental-mode ;; default mode for the scratch buffer + initial-scratch-message "" ;; makes the scratch buffer empty + confirm-kill-emacs #'yes-or-no-p ;; ask before killing emacs + use-short-answers t ;; use y-or-n + minibuffer-message-timeout 0.5 ;; How long to display an echo-area message + ring-bell-function 'ignore ;; really no bell + visible-bell nil ;; no bell + indent-tabs-mode nil ;; turn off tab indentation + delete-by-moving-to-trash t ;; delete files by moving them to the trash + user-full-name "Franck Cuny" + user-mail-address "franck@fcuny.net" + history-length 200 + history-delete-duplicates t + require-final-newline t + auto-save-default nil ;; no autosave + backup-inhibited t ;; no backups + completion-ignored-extensions '(".class" ".cp" ".elc" ".fmt" ".git/" ".pyc" ".so" "~")) + +;; Use UTF-8 everywhere +(prefer-coding-system 'utf-8) +(set-default-coding-systems 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) + +(use-package recentf + :custom + (recentf-max-saved-items 2000) + (recentf-max-menu-items 200) + (recentf-exclude + '("~\\'" "\\`out\\'" "\\.log\\'" "^/[^/]*:" "\\.el\\.gz\\'" "\\.gz\\'")) + :config + (recentf-mode t)) + +(use-package savehist + :config + (savehist-mode t)) + +(use-package saveplace + :config + (save-place-mode t)) + +(use-package autorevert + :custom + (auto-revert-use-notify nil) + :config + (global-auto-revert-mode t)) + +(global-set-key (kbd "M-j") 'join-line) + +(use-package which-key + :diminish + :ensure t + :hook (after-init . which-key-mode)) + +(use-package imenu + :config + (setq imenu-auto-rescan t)) + +(when (memq window-system '(mac ns)) + (add-to-list 'default-frame-alist '(fullscreen . maximized)) + (add-to-list 'default-frame-alist '(ns-appearance . nil)) + (add-to-list 'default-frame-alist '(ns-transparent-titlebar . nil))) + +(use-package exec-path-from-shell + :ensure t + :demand t + :if (memq window-system '(mac ns)) + :config + (exec-path-from-shell-initialize) + :custom + (exec-path-from-shell-variables '("ASPELL_CONF"))) + +(use-package ibuffer + :defer t + :bind ("C-x C-b" . ibuffer) + :custom + (ibuffer-expert t) + (ibuffer-show-empty-filter-groups nil) + (ibuffer-jump-offer-only-visible-buffers t) + (ibuffer-maybe-show-predicates '("^\\*.*\\*$")) + (ibuffer-never-show-predicates '("^ ")) + (ibuffer-use-other-window t)) + +(use-package midnight + :defer t + :custom + ;; every 6 hours + (midnight-period (* 3600 6))) + +(use-package dired + :ensure nil + :defer t + :config + (setq dired-omit-files "^__pycache__$") + :custom + (dired-use-ls-dired t) + (insert-directory-program "/etc/profiles/per-user/fcuny/bin/ls") + (dired-clean-up-buffers-too nil) + (dired-dwim-target t) + (dired-hide-details-hide-information-lines nil) + (dired-hide-details-hide-symlink-targets nil) + (dired-recursive-copies 'always) + (dired-recursive-deletes 'always) + (dired-no-confirm + '(byte-compile chgrp chmod chown copy hardlink symlink touch))) + +(use-package dired-x + :after dired + :hook ((dired-mode . dired-omit-mode))) + +(defun my/rename-this-buffer-and-file () + "Renames current buffer and file it is visiting." + (interactive) + (let ((name (buffer-name)) + (filename (buffer-file-name)) + (read-file-name-function 'read-file-name-default)) + (if (not (and filename (file-exists-p filename))) + (error "Buffer '%s' is not visiting a file!" name) + (let ((new-name (read-file-name "New name: " filename))) + (cond ((get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name)) + (t + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) + +(provide 'init-base) + +;;; init-base.el ends here diff --git a/config/init-buffer.el b/config/init-buffer.el deleted file mode 100644 index 57c158e..0000000 --- a/config/init-buffer.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; init-buffer.el --- Configure buffer -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; buffer related configurations - -;;; Code: - -(use-package ibuffer - :defer t - :bind ("C-x C-b" . ibuffer) - :custom - (ibuffer-expert t) - (ibuffer-show-empty-filter-groups nil) - (ibuffer-jump-offer-only-visible-buffers t) - (ibuffer-maybe-show-predicates '("^\\*.*\\*$")) - (ibuffer-never-show-predicates '("^ ")) - (ibuffer-use-other-window t)) - -(use-package midnight - :defer t - :custom - ;; every 6 hours - (midnight-period (* 3600 6))) - -(setq clean-buffer-list-delay-general 2 ; every 2 day - clean-buffer-list-delay-special (* 3600 3)) ; every 3 hours - -(defun my/rename-this-buffer-and-file () - "Renames current buffer and file it is visiting." - (interactive) - (let ((name (buffer-name)) - (filename (buffer-file-name)) - (read-file-name-function 'read-file-name-default)) - (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) - (let ((new-name (read-file-name "New name: " filename))) - (cond ((get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name)) - (t - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) - - -(provide 'init-buffer) - -;;; init-buffer.el ends here diff --git a/config/init-completion.el b/config/init-completion.el index fc65e3d..5ba2038 100644 --- a/config/init-completion.el +++ b/config/init-completion.el @@ -33,6 +33,7 @@ :ensure t) (use-package marginalia + :ensure t :hook (after-init . marginalia-mode)) (use-package orderless diff --git a/config/init-dired.el b/config/init-dired.el deleted file mode 100644 index 8278c49..0000000 --- a/config/init-dired.el +++ /dev/null @@ -1,33 +0,0 @@ -;;; init-dired.el --- Configure dired -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configuration for dired-mode - -;;; Code: - -(use-package dired - :ensure nil - :defer t - :config - (setq dired-omit-files "^__pycache__$") - :custom - (dired-use-ls-dired t) - (insert-directory-program "/etc/profiles/per-user/fcuny/bin/ls") - (dired-clean-up-buffers-too nil) - (dired-dwim-target t) - (dired-hide-details-hide-information-lines nil) - (dired-hide-details-hide-symlink-targets nil) - (dired-recursive-copies 'always) - (dired-recursive-deletes 'always) - (dired-no-confirm - '(byte-compile chgrp chmod chown copy hardlink symlink touch))) - -(use-package dired-x - :after dired - :hook ((dired-mode . dired-omit-mode))) - -(provide 'init-dired) - -;;; init-dired.el ends here diff --git a/config/init-docker.el b/config/init-docker.el deleted file mode 100644 index 508c3e2..0000000 --- a/config/init-docker.el +++ /dev/null @@ -1,36 +0,0 @@ -;;; init-docker.el --- Docker configuration -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure all things related to docker - -;;; Code: - -(use-package docker - :bind ("C-c d" . docker) - :ensure t - :diminish - :init - (use-package docker-image :commands docker-images) - (use-package docker-volume :commands docker-volumes) - (use-package docker-network :commands docker-containers) - (use-package docker-compose :commands docker-compose) - - (use-package docker-container - :commands docker-containers - :custom - (docker-containers-shell-file-name "/bin/bash") - (docker-containers-show-all nil))) - -(use-package docker-compose-mode - :ensure t - :mode "docker-compose.*\.yml\\'") - -(use-package dockerfile-mode - :ensure t - :mode "Dockerfile[a-zA-Z.-]*\\'") - -(provide 'init-docker) - -;;; init-docker.el ends here diff --git a/config/init-elisp.el b/config/init-elisp.el deleted file mode 100644 index 49f3ab4..0000000 --- a/config/init-elisp.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; init-elisp.el --- Configure elisp -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure elisp - -;;; Code: - -(use-package emacs-lisp-mode - :bind (:map emacs-lisp-mode-map - ("C-c C-r" . eval-region) - ("C-c C-d" . eval-defun) - ("C-c C-b" . eval-buffer)) - :hook ((emacs-lisp-mode . flymake-mode))) - -(provide 'init-elisp) - -;;; init-elisp.el ends here diff --git a/config/init-eshell.el b/config/init-eshell.el index 286e180..856b8ea 100644 --- a/config/init-eshell.el +++ b/config/init-eshell.el @@ -9,28 +9,13 @@ (use-package eshell :commands (eshell eshell-command) + :bind (("C-r" . consult-history)) :custom - (eshell-directory-name (emacs-path "eshell")) (eshell-hist-ignoredups t) (eshell-history-size 50000) (eshell-ls-dired-initial-args '("-h")) - (eshell-ls-exclude-regexp "~\\'") (eshell-ls-initial-args "-h") - (eshell-modules-list - '(eshell-alias - eshell-basic - eshell-cmpl - eshell-dirs - eshell-glob - eshell-hist - eshell-ls - eshell-pred - eshell-prompt - eshell-rebind - eshell-script - eshell-term - eshell-unix - eshell-xtra)) + (eshell-ls-exclude-regexp "~\\'") (eshell-save-history-on-exit t) (eshell-stringify-t nil) (eshell-term-name "ansi")) diff --git a/config/init-file.el b/config/init-file.el deleted file mode 100644 index d0e6da3..0000000 --- a/config/init-file.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; init-file.el --- Configure things related to files -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure things related to files - -;;; Code: - -(require 'bookmark) - -(require 'init-util) - -(use-package files - :custom - (require-final-newline t) - (auto-save-default nil) - (auto-save-list-file-prefix nil) - (backup-inhibited t)) - -(setq bookmark-default-file (user-data "bookmarks")) - -(use-package recentf - :custom - (recentf-max-saved-items 2000) - (recentf-max-menu-items 200) - (recentf-exclude - '("~\\'" "\\`out\\'" "\\.log\\'" "^/[^/]*:" "\\.el\\.gz\\'" "\\.gz\\'")) - (recentf-save-file (user-data "recentf")) - (recentf-auto-cleanup 60) - :config - (recentf-mode t) - (run-at-time nil 60 'recentf-save-list) - :diminish nil) - -(use-package autorevert - :custom - (auto-revert-use-notify nil) - :config - (global-auto-revert-mode t)) - -(provide 'init-file) - -;;; init-file.el ends here diff --git a/config/init-flymake.el b/config/init-flymake.el deleted file mode 100644 index d829c3c..0000000 --- a/config/init-flymake.el +++ /dev/null @@ -1,31 +0,0 @@ -;;; init-flymake.el --- Configure flymake -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure flymake - -;;; Code: - -(use-package flymake - :ensure nil - :defer t - :bind (:prefix "C-c !" - :prefix-map flymake-prefix-map - ("l" . consult-flymake) - ("b" . flymake-show-project-diagnostics) - ("n" . flymake-goto-next-error) - ("p" . flymake-goto-prev-error)) - :hook - (prog-mode . flymake-mode) - :custom - (flymake-start-on-save-buffer t) - (flymake-fringe-indicator-position 'left-fringe) - (flymake-suppress-zero-counters t) - (flymake-proc-compilation-prevents-syntax-check t) - (flymake-no-changes-timeout 9999) - (elisp-flymake-byte-compile-load-path load-path)) - -(provide 'init-flymake) - -;;; init-flymake.el ends here diff --git a/config/init-git.el b/config/init-git.el deleted file mode 100644 index a0a9e25..0000000 --- a/config/init-git.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; init-git.el --- configure git -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configuration for git - -;;; Code: - -(require 'init-util) - -(use-package magit - :ensure t - :bind ("C-x g" . magit-status) - :custom - (magit-diff-refine-hunk t) - (magit-clone-default-directory "~/workspace/") - (git-commit-major-mode 'markdown-mode) - :config - ;; show ANSI colors in the process buffer, so it's easier to read what's going on - ;; for some reasons if it's in the `:custom' section it does not get set - (setq magit-process-finish-apply-ansi-colors t)) - -(use-package vc - :defer t - :custom - (vc-command-messages t) - (vc-follow-symlinks t)) - -(use-package git-link - :defines git-link-remote-alist - :ensure t - :bind ("C-c Y" . git-link) - :commands (git-link git-link-commit git-link-homepage) - :custom - (git-link-open-in-browser t) - :config - ;; sets up roblox git enterprise as a git-link handler - (add-to-list 'git-link-remote-alist '("github\\.rblx\\.com" git-link-github)) - (add-to-list 'git-link-commit-remote-alist '("github\\.rblx\\.com" git-link-commit-github))) - -(use-package transient - :defer t - :custom - (transient-history-file (user-data "transient/history.el")) - (transient-values-file (user-data "transient/values.el"))) - -(provide 'init-git) - -;;; init-git.el ends here diff --git a/config/init-go.el b/config/init-go.el deleted file mode 100644 index daabb2b..0000000 --- a/config/init-go.el +++ /dev/null @@ -1,28 +0,0 @@ -;;; init-go.el --- Configure go related things -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; go-mode and friends - -;;; Code: - -(use-package go-mode - :ensure t - :defer t - :hook ((go-mode . tree-sitter-hl-mode) - (go-mode . eglot-ensure) - (go-mode . (lambda () (setq tab-width 4))) - (go-mode . (lambda () (add-hook 'before-save-hook 'eglot-format-buffer nil t)))) - :bind (:map go-mode-map - ("C-c C-c" . compile))) - -(use-package gotest - :ensure t - :after go-mode - :custom - (go-test-verbose t)) - -(provide 'init-go) - -;;; init-go.el ends here diff --git a/config/init-imenu.el b/config/init-imenu.el deleted file mode 100644 index 7f45434..0000000 --- a/config/init-imenu.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; init-imenu.el --- Configure imenu -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure imenu - -;;; Code: - -(use-package imenu - :config - (setq imenu-auto-rescan t)) - -(provide 'init-imenu) - -;;; init-imenu.el ends here diff --git a/config/init-json.el b/config/init-json.el deleted file mode 100644 index 7f0cfcb..0000000 --- a/config/init-json.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; init-json.el --- Configure JSON -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure json-mode and jq-mode - -;;; Code: - -(use-package json-mode - :mode "\\.json\\'") - -(use-package json-reformat - :ensure t - :after json-mode) - -(use-package jq-mode - :ensure t - :mode "\\.jq\\'") - -(provide 'init-json) - -;;; init-json.el ends here diff --git a/config/init-keys.el b/config/init-keys.el deleted file mode 100644 index a197043..0000000 --- a/config/init-keys.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; init-keys.el --- Configure key bindings -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure key bindings - -;;; Code: - -(global-set-key (kbd "M-j") 'join-line) - -(use-package which-key - :diminish - :ensure t - :hook (after-init . which-key-mode)) - -(provide 'init-keys) - -;;; init-keys.el ends here diff --git a/config/init-lsp.el b/config/init-lsp.el deleted file mode 100644 index e530fba..0000000 --- a/config/init-lsp.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; init-lsp.el --- Configure LSP integration -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure LSP integration - -;;; Code: - -(use-package eglot - :after yasnippet - :bind (:map eglot-mode-map - ("C-c l a" . eglot-code-actions) - ("C-c l r" . eglot-rename) - ("C-c l f" . eglot-format-buffer)) - :hook (eglot-managed-mode . (lambda () (eglot-inlay-hints-mode -1))) - :config - (setq eglot-autoshutdown t) - (setq-default read-process-output-max (* 1024 1024)) - (setq-default eglot-workspace-configuration - '(:pylsp (:plugins (:ruff (:enabled t))) - :gopls (:usePlaceholders t - :staticcheck t - :completeUnimported t - :matcher "CaseSensitive"))) - - ;; uses https://github.com/nix-community/nixd for the LSP server instead of rnix - (add-to-list 'eglot-server-programs '(nix-mode . ("nixd")))) - -(use-package eldoc-box - :ensure t - :hook - (eglot-managed-mode . eldoc-box-hover-mode) - :custom - (eldoc-documentation-strategy 'eldoc-documentation-enthusiast) - :custom-face - (eldoc-box-body ((t (:background "#eeefff" :family "Monaspace Argon" :height 0.9))))) - -(provide 'init-lsp) - -;;; init-lsp.el ends here diff --git a/config/init-markdown.el b/config/init-markdown.el deleted file mode 100644 index 07e927d..0000000 --- a/config/init-markdown.el +++ /dev/null @@ -1,32 +0,0 @@ -;;; init-markdown.el --- Configure markdown -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configuration related to markdown - -;;; Code: - -(use-package markdown-mode - :mode (("\\`README\\.md\\'" . gfm-mode) - ("\\.md\\'" . markdown-mode) - ("\\.markdown\\'" . markdown-mode)) - :custom - (markdown-command "pandoc -f markdown_github+smart") - (markdown-command-needs-filename t) - (markdown-enable-math t) - (markdown-open-command "marked") - :init - (setq markdown-command "multimarkdown")) - -(use-package markdown-preview-mode - :ensure t - :after markdown-mode - :config - (setq markdown-preview-stylesheets - (list (concat "https://github.com/dmarcotte/github-markdown-preview/" - "blob/master/data/css/github.css")))) - -(provide 'init-markdown) - -;;; init-markdown.el ends here diff --git a/config/init-modeline.el b/config/init-modeline.el deleted file mode 100644 index 9d3c59a..0000000 --- a/config/init-modeline.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; init-modeline.el --- configure the modeline -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure the modeline - -;;; Code: - -(require 'diminish) -(require 'time) - -;; show column number in the mode line -(setq column-number-mode t) - -(setq display-time-24hr-format t - display-time-interval 60 - display-time-format "%H:%M %d.%m" - display-time-default-load-average nil) - -(provide 'init-modeline) - -;;; init-modeline.el ends here diff --git a/config/init-nix.el b/config/init-nix.el deleted file mode 100644 index d0e50c7..0000000 --- a/config/init-nix.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; init-nix.el --- Configure nix -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; All nix related things - -;;; Code: - -(use-package nix-mode - :ensure t - :hook ((nix-mode . eglot-ensure) - (nix-mode . (lambda () (add-hook 'before-save-hook 'eglot-format-buffer nil t)))) - :custom - (nix-indent-function 'nix-indent-line)) - -(provide 'init-nix) - -;;; init-nix.el ends here diff --git a/config/init-org.el b/config/init-org.el deleted file mode 100644 index 9f5c4a0..0000000 --- a/config/init-org.el +++ /dev/null @@ -1,89 +0,0 @@ -;;; init-org.el --- configure things related to org-mode -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure things related to org-mode - -;;; Code: - -(use-package org - :hook - (org-mode . turn-on-flyspell) - (org-mode . visual-line-mode) - (org-mode . org-indent-mode) - :custom - ;;; general settings - (org-startup-folded t) - (org-startup-indented t) - (org-hide-emphasis-markers t) - (org-hide-leading-stars t) - (org-pretty-entities t) - (org-return-follows-link t) - (org-startup-with-inline-images t) - (org-export-backends '(html md)) - (org-imenu-depth 4) - (org-insert-heading-respect-content t) - (org-outline-path-complete-in-steps nil) - (org-src-fontify-natively t) - (org-src-preserve-indentation t) - (org-src-tab-acts-natively t) - (org-src-window-setup 'current-window) - (org-yank-adjusted-subtrees t) - (org-structure-template-alist - '(("s" . "src") - ("E" . "src emacs-lisp") - ("p" . "src python") - ("e" . "example") - ("q" . "quote") - ("V" . "verbatim"))) - :config - (font-lock-add-keywords 'org-mode - '(("^ *\\(-\\) " - (0 (ignore (compose-region (match-beginning 1) (match-end 1) "•"))))))) - -(use-package org-bullets - :ensure t - :hook (org-mode . org-bullets-mode)) - -(use-package org-auto-tangle - :ensure t - :hook (org-mode . org-auto-tangle-mode)) - -(use-package org-babel - :no-require t - :after (org) - :config - (org-babel-do-load-languages - 'org-babel-load-languages - '((python . t) - (emacs-lisp . t) - (calc . t) - (shell . t) - (sql . t) - (dot . t))) - - (remove-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory) - - (advice-add 'org-babel-edit-prep:emacs-lisp :after - #'(lambda (_info) (run-hooks 'emacs-lisp-mode-hook)))) - -(use-package ox-gfm - :ensure t - :after org) - -(use-package ox-md - :after org) - -(use-package ox-pandoc - :ensure t - :after org - :preface - (defun markdown-to-org-region (start end) - "Convert region from markdown to org, replacing selection" - (interactive "r") - (shell-command-on-region start end "pandoc -f markdown -t org" t t))) - -(provide 'init-org) - -;;; init-org.el ends here diff --git a/config/init-osx.el b/config/init-osx.el deleted file mode 100644 index 175ffbd..0000000 --- a/config/init-osx.el +++ /dev/null @@ -1,30 +0,0 @@ -;;; init-osx.el --- configure osx -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure osx - -;;; Code: - -(when (memq window-system '(mac ns)) - (add-to-list 'default-frame-alist '(fullscreen . maximized)) - (add-to-list 'default-frame-alist '(ns-appearance . nil)) - (add-to-list 'default-frame-alist '(ns-transparent-titlebar . nil)) - (when (boundp 'ns-use-native-fullscreen) - (setq ns-use-native-fullscreen nil)) - (when (boundp 'mac-allow-anti-aliasing) - (setq mac-allow-anti-aliasing t))) - -(use-package exec-path-from-shell - :ensure t - :demand t - :if (memq window-system '(mac ns)) - :config - (exec-path-from-shell-initialize) - :custom - (exec-path-from-shell-variables '("ASPELL_CONF"))) - -(provide 'init-osx) - -;;; init-osx.el ends here diff --git a/config/init-programming.el b/config/init-programming.el index ca1ec41..f90aaf1 100644 --- a/config/init-programming.el +++ b/config/init-programming.el @@ -7,6 +7,14 @@ ;;; Code: +;; `elec-pair' is a built-in minor-mode that enables auto-pairing of parens (or +;; similar delimiters). +(use-package elec-pair + :hook (prog-mode . electric-pair-mode)) + +;; `delete-trailing-whitespace' removes the tailing whitespace. +(add-hook 'before-save-hook 'delete-trailing-whitespace) + (use-package compile :ensure nil :hook (compilation-filter . ansi-color-compilation-filter) @@ -22,18 +30,13 @@ (use-package eldoc :diminish - :hook ((c-mode-common emacs-lisp-mode) . eldoc-mode) + :hook ((emacs-lisp-mode) . eldoc-mode) :custom (eldoc-idle-delay 1) (eldoc-documentation-strategy #'eldoc-documentation-default) - (eldoc-echo-area-use-multiline-p 3) - (eldoc-echo-area-prefer-doc-buffer 'maybe) - (eldoc-echo-area-display-truncation-message nil)) - -(use-package indent - :commands indent-according-to-mode - :custom - (tab-always-indent 'complete)) + ;; Don't resize the echo area if the documentation is longer. This is very + ;; distracting when combined with Eglot's highlight functionality. + (eldoc-echo-area-use-multiline-p nil)) (use-package tree-sitter :ensure t @@ -51,48 +54,167 @@ :config (direnv-mode)) -(setq prettify-symbols-unprettify-at-point 'right-edge) - -(defun my/github-code-search () - "Search code on github for a given language." - (interactive) - (let ((language (completing-read - "Language: " - '("Emacs Lisp" "Python" "Go" "Nix"))) - (code (read-string "Code: "))) - (browse-url - (concat "https://github.com/search?lang=" language - "&type=code&q=" code)))) - -(defun my/work-code-search () - "Search code on sourcegraph for a given language." - (interactive) - (let ((language (completing-read - "Language: " - '("Ruby" "Python" "Go"))) - (code (read-string "Code: "))) - (browse-url - (concat "https://sourcegraph.rbx.com/search?q=context:global+lang:" language - "+" code)))) - - -(require 'init-elisp) -(require 'init-go) -(require 'init-lsp) -(require 'init-nix) -(require 'init-python) -(require 'init-ruby) -(require 'init-rust) - -(require 'init-flymake) - -(require 'init-shell) -(require 'init-json) -(require 'init-terraform) -(require 'init-toml) -(require 'init-yaml) - -(require 'init-docker) +(use-package emacs-lisp-mode + :bind (:map emacs-lisp-mode-map + ("C-c C-r" . eval-region) + ("C-c C-d" . eval-defun) + ("C-c C-b" . eval-buffer)) + :hook ((emacs-lisp-mode . flymake-mode))) + +(use-package eglot + :after yasnippet + :bind (:map eglot-mode-map + ("C-c l a" . eglot-code-actions) + ("C-c l r" . eglot-rename) + ("C-c l f" . eglot-format-buffer)) + :hook ((go-mode . eglot-ensure) + (python-mode . eglot-ensure) + (nix-mode . eglot-ensure)) + :custom + (eglot-send-changes-idle-time 0.1) + :config + (setq eglot-autoshutdown t + ;; Disable logging of events. + eglot-events-buffer-size 0) + (setq-default eglot-workspace-configuration + '(:pylsp (:plugins (:ruff (:enabled t))) + :gopls (:usePlaceholders t + :staticcheck t + :completeUnimported t + :matcher "CaseSensitive"))) + + ;; uses https://github.com/nix-community/nixd for the LSP server instead of rnix + (add-to-list 'eglot-server-programs '(nix-mode . ("nixd")))) + +;;; go related configuration +(use-package go-mode + :ensure t + :defer t + :hook ((go-mode . tree-sitter-hl-mode) + (go-mode . (lambda () (setq tab-width 4))) + (go-mode . (lambda () (add-hook 'before-save-hook 'eglot-format-buffer nil t)))) + :bind (:map go-mode-map + ("C-c C-c" . compile))) + +(use-package gotest + :ensure t + :after go-mode + :custom + (go-test-verbose t)) + +;;; nix related configuration +(use-package nix-mode + :ensure t + :hook ((nix-mode . (lambda () (add-hook 'before-save-hook 'eglot-format-buffer nil t)))) + :custom + (nix-indent-function 'nix-indent-line)) + +;;; python related configuration +(use-package python-mode + :hook ((python-mode . tree-sitter-hl-mode)) + :custom + ;; if set to an absolute path, pyvenv won't work + (python-shell-interpreter "python3")) + +(use-package blacken + :ensure t + :hook (python-mode . blacken-mode)) + +(use-package pyvenv + :ensure t + :config + (pyvenv-mode 1)) + +(use-package ruby-mode) + +;;; flymake related configuration +(use-package flymake + :ensure nil + :defer t + :bind (:prefix "C-c !" + :prefix-map flymake-prefix-map + ("l" . consult-flymake) + ("b" . flymake-show-project-diagnostics) + ("n" . flymake-goto-next-error) + ("p" . flymake-goto-prev-error)) + :hook + (prog-mode . flymake-mode) + :custom + (flymake-start-on-save-buffer t) + (flymake-fringe-indicator-position 'left-fringe) + (flymake-suppress-zero-counters t) + (flymake-proc-compilation-prevents-syntax-check t) + (flymake-no-changes-timeout 9999) + (elisp-flymake-byte-compile-load-path load-path)) + +;;; JSON related modules +(use-package json-mode + :defer t + :mode "\\.json\\'") + +(use-package json-reformat + :defer t + :ensure t + :after json-mode) + +(use-package jq-mode + :defer t + :ensure t + :mode "\\.jq\\'") + +;;; hashicorp related modules +(use-package terraform-mode + :defer t + :ensure t + :mode "\.tf\\'") + +(use-package hcl-mode + :defer t + :ensure t + :mode "\.nomad\\'") + +;;; TOML related modules +(use-package toml-mode + :defer t + :ensure t) + +;;; YAML related modules +(use-package yaml-mode + :defer t + :ensure t) + +;;; docker related modules +(use-package docker + :defer t + :bind ("C-c d" . docker) + :ensure t + :diminish + :init + (use-package docker-image :commands docker-images) + (use-package docker-volume :commands docker-volumes) + (use-package docker-network :commands docker-containers) + (use-package docker-compose :commands docker-compose) + + (use-package docker-container + :commands docker-containers + :custom + (docker-containers-shell-file-name "/bin/bash") + (docker-containers-show-all nil))) + +(use-package docker-compose-mode + :defer t + :ensure t + :mode "docker-compose.*\.yml\\'") + +(use-package dockerfile-mode + :defer t + :ensure t + :mode "Dockerfile[a-zA-Z.-]*\\'") + +(use-package protobuf-mode + :defer t + :ensure t + :mode "\\.proto\\'") (provide 'init-programming) diff --git a/config/init-project.el b/config/init-project.el index c8d638f..3a87e0c 100644 --- a/config/init-project.el +++ b/config/init-project.el @@ -7,7 +7,48 @@ ;;; Code: -(require 'init-util) +(use-package magit + :ensure t + :bind ("C-x g" . magit-status) + :custom + (magit-diff-refine-hunk t) + (magit-clone-default-directory "~/workspace/") + (git-commit-major-mode 'markdown-mode) + :config + ;; show ANSI colors in the process buffer, so it's easier to read what's going on + ;; for some reasons if it's in the `:custom' section it does not get set + (setq magit-process-finish-apply-ansi-colors t)) + +(use-package vc + :defer t + :custom + (vc-command-messages t) + (vc-follow-symlinks t)) + +(use-package git-link + :defines git-link-remote-alist + :ensure t + :bind ("C-c Y" . git-link) + :commands (git-link git-link-commit git-link-homepage) + :custom + (git-link-open-in-browser t) + :config + ;; sets up roblox git enterprise as a git-link handler + (add-to-list 'git-link-remote-alist '("github\\.rblx\\.com" git-link-github)) + (add-to-list 'git-link-commit-remote-alist '("github\\.rblx\\.com" git-link-commit-github))) + +(use-package rg + :ensure t + :custom + (rg-group-result t) + (rg-show-columns t) + (rg-align-line-number-field-length 3) + (rg-align-column-number-field-length 3) + (rg-align-line-column-separator "#") + (rg-align-position-content-separator "|") + (rg-hide-command nil) + (rg-align-position-numbers t) + (rg-command-line-flags '("--follow"))) (use-package project :custom @@ -19,8 +60,6 @@ (project-eshell "Eshell" e) (magit-project-status "Magit" ?m)))) -(setq-default project-list-file (user-data "projects.eld")) - (provide 'init-project) ;;; init-project.el ends here diff --git a/config/init-protobuf.el b/config/init-protobuf.el deleted file mode 100644 index 1af464b..0000000 --- a/config/init-protobuf.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; init-protobuf.el --- configure protocol buffer -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure protobuf - -;;; Code: - -(use-package protobuf-mode - :ensure t - :mode "\\.proto\\'") - -(provide 'init-protobuf.el) - -;;; init-protobuf.el ends here diff --git a/config/init-python.el b/config/init-python.el deleted file mode 100644 index 847304f..0000000 --- a/config/init-python.el +++ /dev/null @@ -1,28 +0,0 @@ -;;; init-python.el --- Configure python -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; All python related things - -;;; Code: - -(use-package python-mode - :hook ((python-mode . tree-sitter-hl-mode) - (python-mode . eglot-ensure)) - :custom - ;; if set to an absolute path, pyvenv won't work - (python-shell-interpreter "python3")) - -(use-package blacken - :ensure t - :hook (python-mode . blacken-mode)) - -(use-package pyvenv - :ensure t - :config - (pyvenv-mode 1)) - -(provide 'init-python) - -;;; init-python.el ends here diff --git a/config/init-rg.el b/config/init-rg.el deleted file mode 100644 index 8700fb2..0000000 --- a/config/init-rg.el +++ /dev/null @@ -1,25 +0,0 @@ -;;; init-rg.el --- configure ripgrep -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure ripgrep - -;;; Code: - -(use-package rg - :ensure t - :custom - (rg-group-result t) - (rg-show-columns t) - (rg-align-line-number-field-length 3) - (rg-align-column-number-field-length 3) - (rg-align-line-column-separator "#") - (rg-align-position-content-separator "|") - (rg-hide-command nil) - (rg-align-position-numbers t) - (rg-command-line-flags '("--follow"))) - -(provide 'init-rg) - -;;; init-rg.el ends here diff --git a/config/init-ruby.el b/config/init-ruby.el deleted file mode 100644 index fc33a48..0000000 --- a/config/init-ruby.el +++ /dev/null @@ -1,24 +0,0 @@ -;;; init-ruby.el --- configure ruby -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure ruby - -;;; Code: - -(use-package ruby-mode - :mode "\\.rb\\'" - :interpreter "ruby" - :bind (:map ruby-mode-map - ("<return>" . my-ruby-smart-return)) - :preface - (defun my-ruby-smart-return () - (interactive) - (when (memq (char-after) '(?\| ?\" ?\')) - (forward-char)) - (call-interactively 'newline-and-indent))) - -(provide 'init-ruby) - -;;; init-ruby.el ends here diff --git a/config/init-rust.el b/config/init-rust.el deleted file mode 100644 index 8aa8034..0000000 --- a/config/init-rust.el +++ /dev/null @@ -1,27 +0,0 @@ -;;; init-rust.el --- Configuration for rust -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configuration for rust - -;;; Code: - -(use-package rust-mode - :ensure t - :defer t - :hook ((rust-mode . eglot-ensure)) - :mode ("\\.rs\\'" . rust-mode) - :custom - (rust-format-on-save t)) - -(use-package cargo-mode - :ensure t - :defer t - :hook (rust-mode . cargo-minor-mode) - :custom - (compilation-scroll-output t)) - -(provide 'init-rust) - -;;; init-rust.el ends here diff --git a/config/init-session.el b/config/init-session.el deleted file mode 100644 index 45b6c52..0000000 --- a/config/init-session.el +++ /dev/null @@ -1,98 +0,0 @@ -;;; init-session.el --- configure session -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure sesson - -;;; Code: - -(require 'init-util) - -(setq create-lockfiles nil) ;; don't use a lock file -(setq confirm-kill-emacs #'yes-or-no-p) ;; ask before killing emacs -(setq minibuffer-message-timeout 0.5) ;; How long to display an echo-area message - -(setq ring-bell-function 'ignore) ;; really no bell -(setq tab-always-indent 'complete) ;; when using TAB, always indent -(setq visible-bell nil) ;; no bell - -(setq indent-tabs-mode nil) ;; turn off tab indentation - -(setq delete-by-moving-to-trash t) ;; delete files by moving them to the trash - -(use-package electric - :defer t - :init - (electric-pair-mode 1)) - -;; bytecomp.el -(setq byte-compile-verbose nil) - -;; startup.el -(setq initial-buffer-choice t) -(setq initial-major-mode 'fundamental-mode) -(setq initial-scratch-message "") - -(setq user-full-name "Franck Cuny") -(setq user-mail-address "franck@fcuny.net") -(setq add-log-mailing-address "franck@fcuny.net") - -(setq history-length 200) -(setq history-delete-duplicates t) -(setq completion-ignored-extensions - '(".class" - ".cp" - ".elc" - ".fmt" - ".git/" - ".pyc" - ".so" - "~")) - -;; paragraphs.el -(setq sentence-end-double-space nil) - -;; switch to view-mode whenever you are in a read-only buffer (e.g. -;; switched to it using C-x C-q). -(setq view-read-only t) - -;; window.el -(setq switch-to-buffer-preserve-window-point t) - -;; warnings.el -(setq warning-minimum-log-level :error) - -(use-package savehist - :unless noninteractive - :custom - (savehist-additional-variables - '(file-name-history - kmacro-ring - compile-history - compile-command)) - (savehist-autosave-interval 60) - (savehist-file (user-data "history")) - (savehist-ignored-variables - '(load-history - flyspell-auto-correct-ring - org-roam-node-history - magit-revision-history - org-read-date-history - query-replace-history - yes-or-no-p-history - kill-ring)) - (savehist-mode t) - :config - (savehist-mode 1)) - -(use-package saveplace - :unless noninteractive - :custom - (save-place-file (user-data "places")) - :config - (save-place-mode 1)) - -(provide 'init-session) - -;;; init-session.el ends here diff --git a/config/init-shell.el b/config/init-shell.el deleted file mode 100644 index 643877b..0000000 --- a/config/init-shell.el +++ /dev/null @@ -1,29 +0,0 @@ -;;; init-shell.el --- configure shell -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure shell - -;;; Code: - -(use-package sh-script - :defer t - :preface - (defvar sh-script-initialized nil) - - (defun initialize-sh-script () - (unless sh-script-initialized - (setq sh-script-initialized t) - (info-lookup-add-help :mode 'shell-script-mode - :regexp ".*" - :doc-spec '(("(bash)Index"))))) - :init - (add-hook 'shell-mode-hook #'initialize-sh-script)) - -(add-hook 'after-save-hook - #'executable-make-buffer-file-executable-if-script-p) - -(provide 'init-shell) - -;;; init-shell.el ends here diff --git a/config/init-terraform.el b/config/init-terraform.el deleted file mode 100644 index 4012f0c..0000000 --- a/config/init-terraform.el +++ /dev/null @@ -1,20 +0,0 @@ -;;; init-terraform.el --- Configure terraform -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; terraform and related formats - -;;; Code: - -(use-package terraform-mode - :ensure t - :mode "\.tf\\'") - -(use-package hcl-mode - :ensure t - :mode "\.nomad\\'") - -(provide 'init-terraform) - -;;; init-terraform.el ends here diff --git a/config/init-theme.el b/config/init-theme.el deleted file mode 100644 index c1bcd4e..0000000 --- a/config/init-theme.el +++ /dev/null @@ -1,34 +0,0 @@ -;;; init-theme.el --- configure the theme -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure the theme - -;;; Code: - -;; use various monaspace fonts -;; https://monaspace.githubnext.com -(set-face-attribute 'default nil - :font "Monaspace Argon" - :height 150) - -(set-face-attribute 'fixed-pitch nil - :font "Monaspace Argon" - :height 150) - -(set-face-attribute 'variable-pitch nil - :font "Monaspace Radon" - :height 150) - -(add-to-list 'default-frame-alist '(background-color . "#FFFCF6")) -(add-to-list 'default-frame-alist '(foreground-color . "#101010")) - -(custom-set-faces - ;; make sure comments are distinct from the rest - `(font-lock-comment-face ((t (:font "Monaspace Radon" :italic t :bold t :height 1.0 :background "#eeefff" :foreground "#7f0000")))) - `(font-lock-doc-face ((t (:font "Monaspace Radon" :italic t :bold t :height 1.0 :background "#eeefff" :foreground "#7f0000"))))) - -(provide 'init-theme) - -;;; init-theme.el ends here diff --git a/config/init-time.el b/config/init-time.el deleted file mode 100644 index a6932aa..0000000 --- a/config/init-time.el +++ /dev/null @@ -1,38 +0,0 @@ -;;; init-time.el --- configure time -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; Configure time - -;;; Code: - -(require 'time) - -(setq display-time-mode t) -(setq display-time-24hr-format t) -(setq display-time-day-and-date t) -(setq display-time-default-load-average nil) -(setq world-clock-list t) -(setq world-clock-timer-enable t) -(setq world-clock-timer-second 60) -;; UTC => 02:42 +0000 Wednesday 20 April -;; Berkeley => 19:42 -0700 Tuesday 19 April -(setq world-clock-time-format "%R %z %A %d %B") -(setq zoneinfo-style-world-list '(("UTC" "UTC") - ("America/Los_Angeles" "Berkeley") - ("America/Denver" "Mountain Time") - ("America/Chicago" "Central Time") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Europe/Paris" "Paris"))) - -(add-to-list 'display-buffer-alist '("\\*wclock\\*" - (display-buffer-in-side-window) - (side . left) - (slot . 0) - (window-width . 0.35))) - -(provide 'init-time) - -;;; init-time.el ends here diff --git a/config/init-toml.el b/config/init-toml.el deleted file mode 100644 index 28b56db..0000000 --- a/config/init-toml.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; init-toml.el --- Configure TOML related things -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; For TOML - -;;; Code: - -(use-package toml-mode - :defer t - :ensure t) - -(provide 'init-toml) - -;;; init-toml.el ends here diff --git a/config/init-ui.el b/config/init-ui.el index 526b446..312e622 100644 --- a/config/init-ui.el +++ b/config/init-ui.el @@ -6,6 +6,8 @@ ;;; Code: +(require 'time) + ;; Don't say anything on mode-line mouseover. (setq mode-line-default-help-echo nil) @@ -15,26 +17,6 @@ ;; Don't highlight inactive windows. (setq highlight-nonselected-windows nil) -;; Use y-or-n -(setq use-short-answers t) - -;; Use UTF-8 everywhere -(prefer-coding-system 'utf-8) -(set-default-coding-systems 'utf-8) -(set-terminal-coding-system 'utf-8) -(set-keyboard-coding-system 'utf-8) - -(use-package paren - :init - (show-paren-mode 2) - :custom-face - :custom - (show-paren-delay 0.2) - (show-paren-highlight-openparen t) - (show-paren-when-point-inside-paren t) - (show-paren-when-point-in-periphery t) - (show-paren-style 'parenthesis)) - (use-package fringe :demand t :config @@ -44,18 +26,6 @@ ;; Disable bidirectional text support for slight performance bonus. (setq bidi-display-reordering nil) -(setq window-divider-default-bottom-width 1) -(setq window-divider-default-places 'bottom-only) - -;; empty scratch buffer -(setq initial-scratch-message "") - -;; scroll 5 lines at a time -(setq next-screen-context-lines 5) - -;; cursor is a horizontal bar -(setq cursor-type 'box) - ;; breadcrumb ;; https://github.com/joaotavora/breadcrumb (use-package breadcrumb @@ -63,5 +33,58 @@ :init (breadcrumb-mode 1)) +;; show column number in the mode line +(setq column-number-mode t) + +(setq display-time-24hr-format t + display-time-interval 60 + display-time-mode t + display-time-format "%H:%M %d.%m" + display-time-day-and-date t + display-time-default-load-average nil) + +(setq world-clock-list t + world-clock-timer-enable t + world-clock-timer-second 60 + world-clock-time-format "%R %z %A %d %B") + +;; UTC => 02:42 +0000 Wednesday 20 April +;; Berkeley => 19:42 -0700 Tuesday 19 April +(setq zoneinfo-style-world-list '(("UTC" "UTC") + ("America/Los_Angeles" "Berkeley") + ("America/Denver" "Mountain Time") + ("America/Chicago" "Central Time") + ("America/New_York" "New York") + ("Europe/London" "London") + ("Europe/Paris" "Paris"))) + +(add-to-list 'display-buffer-alist '("\\*wclock\\*" + (display-buffer-in-side-window) + (side . left) + (slot . 0) + (window-width . 0.35))) + +;; use various monaspace fonts +;; https://monaspace.githubnext.com +(set-face-attribute 'default nil + :font "Monaspace Argon" + :height 150) + +(set-face-attribute 'fixed-pitch nil + :font "Monaspace Argon" + :height 150) + +(set-face-attribute 'variable-pitch nil + :font "Monaspace Radon" + :height 150) + +(add-to-list 'default-frame-alist '(background-color . "#FFFCF6")) +(add-to-list 'default-frame-alist '(foreground-color . "#101010")) + +(custom-set-faces + ;; make sure comments are distinct from the rest + `(font-lock-comment-face ((t (:font "Monaspace Radon" :italic t :bold t :height 1.0 :background "#eeefff" :foreground "#7f0000")))) + `(font-lock-doc-face ((t (:font "Monaspace Radon" :italic t :bold t :height 1.0 :background "#eeefff" :foreground "#7f0000"))))) + (provide 'init-ui) ;;; init-ui.el ends here diff --git a/config/init-util.el b/config/init-util.el deleted file mode 100644 index 71b862e..0000000 --- a/config/init-util.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; init-util.el --- Util functions and variables -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; util functions and variables - -;;; Code: - -(defsubst emacs-path (path) - "The PATH where Emacs configuration is loaded from." - (expand-file-name path user-emacs-directory)) - -(defconst user-data-directory - (emacs-path "data")) - -(defun user-data (dir) - "Concat DIR under the user's directory." - (expand-file-name dir user-data-directory)) - -(provide 'init-util) - -;;; init-util.el ends here diff --git a/config/init-whitespace.el b/config/init-whitespace.el deleted file mode 100644 index 14533ad..0000000 --- a/config/init-whitespace.el +++ /dev/null @@ -1,33 +0,0 @@ -;;; init-whitespace.el --- configure whitespace -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; configure whitespace - -;;; Code: - -(use-package whitespace - :diminish (global-whitespace-mode - whitespace-mode - whitespace-newline-mode) - :commands (whitespace-buffer - whitespace-cleanup - whitespace-mode - whitespace-turn-off) - :init - (dolist (hook '(prog-mode-hook text-mode-hook)) - (add-hook hook #'whitespace-mode)) - :custom - (whitespace-auto-cleanup t t) - (whitespace-rescan-timer-time nil t) - (whitespace-silent t t) - (whitespace-style '(face trailing space-before-tab)) - :defines - (whitespace-auto-cleanup - whitespace-rescan-timer-time - whitespace-silent)) - -(provide 'init-whitespace) - -;;; init-whitespace.el ends here diff --git a/config/init-writing.el b/config/init-writing.el index 9cd3370..e54d605 100644 --- a/config/init-writing.el +++ b/config/init-writing.el @@ -7,14 +7,12 @@ ;;; Code: -(require 'init-markdown) - (use-package flyspell :defer - :hook ((text-mode . flyspell-mode) - (org-mode . flyspell-mode) + :hook ((text-mode . flyspell-mode) + (org-mode . flyspell-mode) (git-commit-mode . flyspell-mode) - (prog-mode . flyspell-prog-mode)) + (prog-mode . flyspell-prog-mode)) :diminish flyspell-mode :custom (ispell-program-name "aspell") @@ -22,6 +20,96 @@ (ispell-local-dictionary "en_US") (ispell-extra-args '("--camel-case"))) +(use-package markdown-mode + :ensure t + :mode (("\\`README\\.md\\'" . gfm-mode) + ("\\.md\\'" . markdown-mode) + ("\\.markdown\\'" . markdown-mode)) + :custom + (markdown-command "pandoc -f markdown_github+smart") + (markdown-command-needs-filename t) + (markdown-enable-math t) + (markdown-open-command "marked") + :init + (setq markdown-command "multimarkdown")) + +(use-package org + :hook + (org-mode . turn-on-flyspell) + (org-mode . visual-line-mode) + (org-mode . org-indent-mode) + :custom + ;;; general settings + (org-startup-folded t) + (org-startup-indented t) + (org-hide-emphasis-markers t) + (org-hide-leading-stars t) + (org-pretty-entities t) + (org-return-follows-link t) + (org-startup-with-inline-images t) + (org-export-backends '(html md)) + (org-imenu-depth 4) + (org-insert-heading-respect-content t) + (org-outline-path-complete-in-steps nil) + (org-src-fontify-natively t) + (org-src-preserve-indentation t) + (org-src-tab-acts-natively t) + (org-src-window-setup 'current-window) + (org-yank-adjusted-subtrees t) + (org-structure-template-alist + '(("s" . "src") + ("E" . "src emacs-lisp") + ("p" . "src python") + ("e" . "example") + ("q" . "quote") + ("V" . "verbatim"))) + :config + (font-lock-add-keywords 'org-mode + '(("^ *\\(-\\) " + (0 (ignore (compose-region (match-beginning 1) (match-end 1) "•"))))))) + +(use-package org-bullets + :ensure t + :hook (org-mode . org-bullets-mode)) + +(use-package org-auto-tangle + :ensure t + :hook (org-mode . org-auto-tangle-mode)) + +(use-package org-babel + :no-require t + :after (org) + :config + (org-babel-do-load-languages + 'org-babel-load-languages + '((python . t) + (emacs-lisp . t) + (calc . t) + (shell . t) + (sql . t) + (dot . t))) + + (remove-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory) + + (advice-add 'org-babel-edit-prep:emacs-lisp :after + #'(lambda (_info) (run-hooks 'emacs-lisp-mode-hook)))) + +(use-package ox-gfm + :ensure t + :after org) + +(use-package ox-md + :after org) + +(use-package ox-pandoc + :ensure t + :after org + :preface + (defun markdown-to-org-region (start end) + "Convert region from markdown to org, replacing selection" + (interactive "r") + (shell-command-on-region start end "pandoc -f markdown -t org" t t))) + (provide 'init-writing) ;;; init-writing.el ends here diff --git a/config/init-yaml.el b/config/init-yaml.el deleted file mode 100644 index 0a460e6..0000000 --- a/config/init-yaml.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; init-yaml.el --- Configure YAML -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; YAML related configurations - -;;; Code: - -(use-package yaml-mode - :ensure t - :mode "\\.ya?ml\\'") - -(provide 'init-yaml) - -;;; init-yaml.el ends here diff --git a/etc/interview.org b/etc/interview.org deleted file mode 100644 index dfb24b1..0000000 --- a/etc/interview.org +++ /dev/null @@ -1,11 +0,0 @@ -* %U %^{Candidate name} :interview: -:PROPERTIES: -:Created: %U -:PairingWith: %^{pairing with} -:Team: %^{which team} -:Position: %^{name of the position} -:END: -** Notes for the interview -** Feedback -** Concerns -** Outcome diff --git a/etc/new-project.org b/etc/new-project.org deleted file mode 100644 index 3d17d55..0000000 --- a/etc/new-project.org +++ /dev/null @@ -1,15 +0,0 @@ -* TODO %^{Project name} -DEADLINE: %^t -:PROPERTIES: -:STARTDATE: %u -:END: -%^{OUTCOME}p -%? -- [ ] Add project tags for context (e.g. work, personal) -- [ ] List specific tasks -- [ ] Schedule next actions from generated tasks -- [ ] Add links to wiki pages / tickets - -** Links -** Tasks -** Notes diff --git a/etc/weekly_review.org b/etc/weekly_review.org deleted file mode 100644 index a7d2581..0000000 --- a/etc/weekly_review.org +++ /dev/null @@ -1,40 +0,0 @@ -* %U Review :review: -** Get Clear [0/3] -- [ ] Collect Loose Papers and Materials. -- [ ] Get "IN" to Zero: - - [ ] Papers - - [ ] Physical Notebook - - [ ] Physical Objects - - [ ] Text Messages - - [ ] Email Inbox - - [ ] [[https://read.amazon.com/kp/notebook][Kindle highlights]] - - [ ] Browser Tabs - - [ ] [[file:~/Downloads][Downloads]] Folder - - [ ] [[file:~/Desktop][Desktop]] Folder -- [ ] Empty Your Head: New projects, tasks, waiting-fors, someday/maybes? -** Get Current [0/7] -- [ ] Review Action Lists -#+BEGIN_SRC emacs-lisp - (progn - (org-agenda nil "a") - (org-agenda-day-view)) -#+END_SRC -- [ ] Archive completed or inactive projects -- [ ] Review calendar data -- [ ] Review Upcoming Calendar -- [ ] Review Waiting For List -- [ ] Review Project (and Larger Outcome) Lists -- [ ] Review Stuck Projects -- [ ] Review Any Relevant Checklists -** Get Creative [0/2] -- [ ] Review Someday Maybe List -- [ ] Be Creative and Courageous -** Journal -*** How are you doing right now? -*** What went well this week? -*** What didn't go so well this week? -*** Did I learn anything important this week? -*** Is there anything I can tweak, simplify, or eliminate? -*** What is currently holding me back? -*** What urgent questions do I have? -*** What do I feel grateful for in my life and work/school? diff --git a/init.el b/init.el index de81c2b..0646a4e 100644 --- a/init.el +++ b/init.el @@ -32,50 +32,17 @@ (require 'use-package)) ;;; Custom configurations -;; Load custom code under the "lisp" and "config" directories. (add-to-list 'load-path (expand-file-name "config" user-emacs-directory)) -(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) +(require 'init-base) (require 'init-ui) -(require 'init-modeline) -(require 'init-theme) -(require 'init-session) -(require 'init-osx) - -(require 'init-buffer) -(require 'init-dired) -(require 'init-file) -(require 'init-time) (require 'init-project) (require 'init-snippets) (require 'init-completion) -(require 'init-whitespace) -(require 'init-rg) - -(require 'init-keys) -(require 'init-imenu) -(require 'init-git) - (require 'init-programming) -(require 'init-writing) -(require 'init-org) (require 'init-eshell) - -;;; Custom modules -(use-package my-cheeseboard) - -(use-package my-uptime - :init - (add-to-list 'display-buffer-alist '("\\*slo-calculator\\*" - (display-buffer-in-side-window) - (side . left) - (slot . 0) - (window-width . 0.35)))) - -;;; Custom Variables -(setq custom-file (user-data "customizations.el")) -(load custom-file 'noerror) +(require 'init-writing) (report-time-since-load) diff --git a/lisp/my-cheeseboard.el b/lisp/my-cheeseboard.el deleted file mode 100644 index 9713e14..0000000 --- a/lisp/my-cheeseboard.el +++ /dev/null @@ -1,55 +0,0 @@ -;;; my-cheeseboard.el --- summary -*- lexical-binding: t -*- -;; Author: Franck Cuny <franck@fcuny.net> - -;;; Commentary: - -;; commentary: -;; As everybody knows, the best pizza in the world is at -;; cheeseboard[0]. I like to check during the week the pizzas for the -;; week and see if there are any we would like to have. This module -;; gets the list of pizzas for the week and display them in a buffer. -;; -;; [0] https://cheeseboardcollective.coop/ - -;;; Code: - -(require 'dom) - -(defconst my/cheeseboard-buffer "*cheeseboard-menu*" - "Name of the buffer for displaying the week's menu.") - -(defconst my/cheeseboard-url "https://cheeseboardcollective.coop/pizza/" - "URL to fetch to get the list of pizzas for the week.") - -(defun my/cheeseboard-menu () - "Display the list of pizzas for the week." - (interactive) - (let* ((dom (with-current-buffer (url-retrieve-synchronously my/cheeseboard-url) - (libxml-parse-html-region (point-min) (point-max)))) - ;; a class named `pizza-list' contains all the items for the - ;; week. they are wrapped in a `article' tag. - (menus (dom-by-tag (dom-by-class dom "pizza-list") 'article)) - (inhibit-read-only t) - (buffer-undo-list t)) - (pop-to-buffer my/cheeseboard-buffer) - (erase-buffer) - (insert (format "if you want to look at the menu on the website => %s\n\n" my/cheeseboard-url)) - (dolist (menu menus) - (my/pizza-of-the-day menu)) - (special-mode))) - -(defun my/pizza-of-the-day (menu) - "Print the pizzas for the day from the MENU." - (let* ((date (car (dom-strings (dom-by-tag (dom-by-class menu "date") 'p)))) - (pizza (dom-by-tag (dom-by-class menu "menu") 'p))) - (if (string= "The pizzeria is closed today." (nth 0 (dom-strings pizza))) - (insert (format "%s: cheeseboard is closed :(\n\n" (propertize date 'face 'italic))) - (insert (format "%s: 🍕 %s\n(note: %s, %s)\n\n" - (propertize date 'face 'italic) - (propertize (replace-regexp-in-string "\n" "" (nth 2 (dom-strings pizza))) 'face 'highlight) - (nth 0 (dom-strings pizza)) - (nth 1 (dom-strings pizza))))))) - -(provide 'my-cheeseboard) - -;;; my-cheeseboard.el ends here diff --git a/lisp/my-uptime.el b/lisp/my-uptime.el deleted file mode 100644 index 77c9957..0000000 --- a/lisp/my-uptime.el +++ /dev/null @@ -1,55 +0,0 @@ -;;; my-uptime.el --- calculates uptime for SLOs - -;;; Commentary: - -;; Calculate how much downtime is allowed for different period of time -;; based on a given SLO. - -;;; Code: - -(defconst my-uptime/buffer-name "*slo-calculator*") - -(defconst my-uptime/seconds-per-hour 3600 - "Number of seconds in an hour.") -(defconst my-uptime/seconds-per-day (* my-uptime/seconds-per-hour 24) - "Number of seconds in a day.") -(defconst my-uptime/seconds-per-week (* my-uptime/seconds-per-day 7) - "Number of seconds in a week.") -(defconst my-uptime/seconds-per-month (* my-uptime/seconds-per-day 30) - "Number of seconds in a month.") -(defconst my-uptime/seconds-per-quarter (* my-uptime/seconds-per-month 3) - "Number of seconds in a quarter.") -(defconst my-uptime/seconds-per-year (* my-uptime/seconds-per-month 12) - "Number of seconds in a year.") - -(defun my/uptime-is (slo) - "Return the amount of allowed downtime for a given SLO." - (interactive "nSLO:") - (let* ((slo (cond ((< slo 0) 0) - ((> slo 100) 100) - (t slo))) - (allowed (/ (- (* 100 100) (* slo 100.0)) (* 100 100)))) - (my/uptime--message allowed slo))) - -(defun my/uptime--message (seconds slo) - "Insert buffer text with allowed downtime based on SECONDS (derived from SLO)." - (let ((inhibit-read-only t) - (buffer-undo-list t)) - (pop-to-buffer my-uptime/buffer-name) - (erase-buffer) - (insert (format "calculated allowed downtime for %s%% availability.\n" slo)) - (insert - (format "daily: %s\n" (format-seconds "%H %M %S" (seconds-to-time (* my-uptime/seconds-per-day seconds))))) - (insert - (format "weekly: %s\n" (format-seconds "%H %M %S" (seconds-to-time (* my-uptime/seconds-per-week seconds))))) - (insert - (format "monthly: %s\n" (format-seconds "%D %H %M %S" (seconds-to-time (* my-uptime/seconds-per-month seconds))))) - (insert - (format "quarterly: %s\n" (format-seconds "%D %H %M %S" (seconds-to-time (* my-uptime/seconds-per-quarter seconds))))) - (insert - (format "yearly: %s\n" (format-seconds "%D %H %M %S" (seconds-to-time (* my-uptime/seconds-per-year seconds)))))) - (special-mode)) - -(provide 'my-uptime) - -;;; my-uptime.el ends here |