diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-16 22:04:33 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-16 22:04:33 +0200 |
commit | 0ee7fa9c382ae30295f0b8d88457f7856c7ff800 (patch) | |
tree | 6b5a0cf01fa0bfa4d01b0134b268f5d993055c0b /.config/emacs/modules/mm-projects.el | |
parent | d452ae1347b3711bc0a7ac80cfa2c37d9d63836e (diff) |
emacs: Overhaul configuration completely
Diffstat (limited to '.config/emacs/modules/mm-projects.el')
-rw-r--r-- | .config/emacs/modules/mm-projects.el | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-projects.el b/.config/emacs/modules/mm-projects.el new file mode 100644 index 0000000..fad56ae --- /dev/null +++ b/.config/emacs/modules/mm-projects.el @@ -0,0 +1,70 @@ +;;; mm-projects.el --- Configuration for project management -*- lexical-binding: t; -*- + +;;; Project Configuration + +(defun mm-projects-project-magit-status () + "Open a Git status buffer for the current project. +This is intended to be called interactively via + `project-switch-commands'." + (interactive) + (thread-last + (project-current t) + (project-root) + (magit-status-setup-buffer))) + +(use-package project + :defer 1 ; Marginal startup performance improvement + :custom + (project-switch-commands '((project-dired "Dired" ?d) + (project-find-file "Find File") + (project-find-regexp "Find Regexp") + (mm-projects-project-magit-status "Git Status" ?s))) + :config + (unless mm-darwin-p + (if-let ((repo-directory (getenv "REPODIR"))) + (mm-with-suppressed-output + (thread-last + (directory-files repo-directory :full "\\`[^.]") + (mapcar (lambda (path) (concat path "/"))) ; Avoid duplicate entries + (mapc #'project-remember-projects-under))) + (warn "The REPODIR environment variable is not set.")))) + + +;;; Git Client + +(use-package magit + :ensure t + :custom + (transient-default-level 7) + (magit-display-buffer-function + #'magit-display-buffer-same-window-except-diff-v1) + :config + (transient-define-suffix mm-projects-magit-push-current-to-all-remotes (args) + "Push the current branch to all remotes." + :if #'magit-get-current-branch + (interactive (list (magit-push-arguments))) + (run-hooks 'magit-credential-hook) + (let ((branch (magit-get-current-branch))) + (dolist (remote (magit-list-remotes)) + (magit-run-git-async + "push" "-v" args remote + (format "refs/heads/%s:refs/heads/%s" branch branch))))) + (transient-append-suffix #'magit-push '(1 -1) + '("a" "all remotes" mm-projects-magit-push-current-to-all-remotes))) + +(use-package magit-todos + :ensure t + :after magit + :hook magit-mode + :custom + (magit-todos-exclude-globs '("vendor/"))) + + +;; Project Compilation + +(use-package compile + :config + (require 'ansi-color) + (add-hook 'compilation-filter-hook #'ansi-color-compilation-filter)) + +(provide 'mm-projects) |