From 9d7b1f585046d9675c93388b971326424aff4a19 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Mon, 25 Nov 2024 03:14:05 +0100 Subject: [PATCH] Emacs: Improve buffer group separation for projects --- .config/emacs/site-lisp/dot-development.el | 10 +++++++-- .config/emacs/site-lisp/dot-elpaca.el | 26 +++++++++++----------- .config/emacs/site-lisp/dot-keybinds.el | 1 + .config/emacs/site-lisp/dot-org-mode.el | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.config/emacs/site-lisp/dot-development.el b/.config/emacs/site-lisp/dot-development.el index 6c86b7e..49ea15e 100644 --- a/.config/emacs/site-lisp/dot-development.el +++ b/.config/emacs/site-lisp/dot-development.el @@ -144,7 +144,11 @@ "Return project name." (let ((project (project-current))) (if project - (file-name-nondirectory (directory-file-name (project-root project))) + (let* ((project (file-truename (directory-file-name (project-root (project-current))))) + (parent-dir-full (file-name-directory (directory-file-name project))) + (parent-dir (file-name-nondirectory (substring parent-dir-full 0 -1))) + (filename (file-name-nondirectory project))) + (concat filename "/" parent-dir)) "-"))) (defun dot/project-save-project-buffers () @@ -350,7 +354,9 @@ ;;; HTML -(elpaca-setup web-mode) +(elpaca-setup web-mode + (:file-match "\\.ts") + (:file-match "\\.vue")) ;;; Kotlin diff --git a/.config/emacs/site-lisp/dot-elpaca.el b/.config/emacs/site-lisp/dot-elpaca.el index a055f78..4801a58 100644 --- a/.config/emacs/site-lisp/dot-elpaca.el +++ b/.config/emacs/site-lisp/dot-elpaca.el @@ -9,7 +9,7 @@ ;; ----------------------------------------- ;; Elpaca bootstrap -(defvar elpaca-installer-version 0.7) +(defvar elpaca-installer-version 0.8) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) @@ -26,18 +26,18 @@ (make-directory repo t) (when (< emacs-major-version 28) (require 'subr-x)) (condition-case-unless-debug err - (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) - ((zerop (apply #'call-process `("git" nil ,buffer t "clone" - ,@(when-let ((depth (plist-get order :depth))) - (list (format "--depth=%d" depth) "--no-single-branch")) - ,(plist-get order :repo) ,repo)))) - ((zerop (call-process "git" nil buffer t "checkout" - (or (plist-get order :ref) "--")))) - (emacs (concat invocation-directory invocation-name)) - ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" - "--eval" "(byte-recompile-directory \".\" 0 'force)"))) - ((require 'elpaca)) - ((elpaca-generate-autoloads "elpaca" repo))) + (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) + ((zerop (apply #'call-process `("git" nil ,buffer t "clone" + ,@(when-let* ((depth (plist-get order :depth))) + (list (format "--depth=%d" depth) "--no-single-branch")) + ,(plist-get order :repo) ,repo)))) + ((zerop (call-process "git" nil buffer t "checkout" + (or (plist-get order :ref) "--")))) + (emacs (concat invocation-directory invocation-name)) + ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" + "--eval" "(byte-recompile-directory \".\" 0 'force)"))) + ((require 'elpaca)) + ((elpaca-generate-autoloads "elpaca" repo))) (progn (message "%s" (buffer-string)) (kill-buffer buffer)) (error "%s" (with-current-buffer buffer (buffer-string)))) ((error) (warn "%s" err) (delete-directory repo 'recursive)))) diff --git a/.config/emacs/site-lisp/dot-keybinds.el b/.config/emacs/site-lisp/dot-keybinds.el index 56c761d..b8d54ed 100644 --- a/.config/emacs/site-lisp/dot-keybinds.el +++ b/.config/emacs/site-lisp/dot-keybinds.el @@ -41,6 +41,7 @@ "M-j" nil "M-k" nil "M-l" nil + "" nil ; Do not scale text when pinching touchpad ))) (elpaca-nil (setup org diff --git a/.config/emacs/site-lisp/dot-org-mode.el b/.config/emacs/site-lisp/dot-org-mode.el index 77ac915..5a73c72 100644 --- a/.config/emacs/site-lisp/dot-org-mode.el +++ b/.config/emacs/site-lisp/dot-org-mode.el @@ -190,6 +190,7 @@ When ANYWHERE is non-nil, search beyond the preamble." (elpaca-nil (setup ox-latex ; built-in (:when-loaded ;; Define how minted (highlighted src code) is added to src code blocks + ;; Requires packages: texlive-bin, texlive-latexextra and python-pygments (setq org-latex-listings 'minted) (setq org-latex-minted-options '(("frame" "lines") ("linenos=true"))) ;; Set 'Table of Contents' layout