Making project.el work better with built-in functionality

This commit is contained in:
Joseph Ferano 2023-04-15 16:03:49 +07:00
parent 7249fec7b8
commit 0fd3df7e34

View File

@ -236,7 +236,8 @@ Finish up
magit))
(setopt package-vc-selected-packages
'((doom-themes :url "https://github.com/JosephFerano/doom-themes")))
'((dotenv :url "https://github.com/pkulev/dotenv.el")
(doom-themes :url "https://github.com/JosephFerano/doom-themes")))
(package-initialize)
#+end_src
@ -290,25 +291,9 @@ I don't even know how you resume from GUI mode, we'll find a use for this keybin
(when (display-graphic-p)
(global-unset-key (kbd "C-z")))
#+end_src
This shows up when building Emacs;
#+begin_quote
3. New Org version is loaded using straight.el package manager and
other package depending on Org is loaded before straight triggers
loading of the newer Org version.
It is recommended to put
(elpaca 'org)
early in the config. Ideally, right after the straight.el
bootstrap. Moving use-package :straight declaration may not be
sufficient if the corresponding use-package statement is
deferring the loading.
#+end_quote
** Visuals
*** Initial Buffer
#+begin_src emacs-lisp
(defun load-projects ()
(with-temp-buffer
@ -765,6 +750,7 @@ weren't working, until I randomly saw this in someone's init.el
(kbd "SPC fb") 'bookmark-jump
(kbd "SPC fr") 'consult-recent-file
(kbd "SPC ff") 'project-find-file
(kbd "SPC fa") '(lambda () (interactive) (project-find-file t))
(kbd "SPC fi") 'joe/edit-init
(kbd "SPC bl") 'mode-line-other-buffer
(kbd "SPC ba") 'consult-buffer
@ -1008,6 +994,16 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
(global-set-key (kbd "C-S-v") #'joe/smooth-scroll-short-down)
(global-set-key (kbd "M-S-v") #'joe/smooth-scroll-short-up)
(defun joe/scroll-other-half-down ()
(interactive)
(scroll-other-window 8))
(defun joe/scroll-other-half-up ()
(interactive)
(scroll-other-window -8))
(global-set-key (kbd "C-M-v") #'joe/scroll-other-half-down)
(global-set-key (kbd "C-M-S-V") #'joe/scroll-other-half-up)
(require 'topspace)
#+end_src
@ -1101,24 +1097,23 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
#+end_src
** Projects
#+begin_src emacs-lisp
(setq frame-title-format "%b")
(with-eval-after-load 'project
(setq project-vc-ignores '("target/" "bin/" "obj/"))
(add-to-list 'project-switch-commands '(magit-project-status "Magit" ?m))
(add-to-list 'project-vc-extra-root-markers ".dir-locals.el")
(setq frame-title-format "%b")
(defun joe/get-project-name (dir)
(let ((override (locate-dominating-file dir ".project.el")))
(if override
(cons 'transient override)
(project-try-vc dir))))
(defun joe/project-root-override (dir)
(let ((proj-name (project-try-vc dir)))
(when (and proj-name
(not (frame-parameter (selected-frame) 'explicit-name)))
(progn
(set-frame-name (file-name-nondirectory (directory-file-name (nth 2 proj-name)))))
proj-name)))
(defun joe/project-root-override (dir)
(let ((proj-name (joe/get-project-name dir)))
(when (and proj-name
(not (frame-parameter (selected-frame) 'explicit-name)))
(set-frame-name proj-name))
proj-name))
(add-hook 'project-find-functions #'joe/project-root-override)
(add-hook 'project-find-functions #'joe/project-root-override)
(define-key 'ctl-x-5-prefix "n" #'set-frame-name)
(define-key 'ctl-x-5-prefix "n" #'set-frame-name))
#+end_src
** VEMCO
@ -1290,7 +1285,7 @@ Vertico Embark Marginalia Consult Orderless
`(shell . ("exa" "--icons" "--color=always" "--no-user" "-al" "--group-directories-first" ,file))))
(add-to-list 'dirvish-preview-dispatchers 'exa)
(setq dired-listing-switches "-l --sort=version --almost-all --human-readable --time-style=long-iso --group-directories-first --no-group")
(setq dired-listing-switches "-l --almost-all --human-readable --time-style=long-iso --group-directories-first --no-group")
(setq dirvish-preview-dispatchers (cl-substitute 'pdf-preface 'pdf dirvish-preview-dispatchers))
(setq dirvish-attributes '(all-the-icons file-size collapse subtree-state))