From 08d18e3fbe3a76075af003a803a7f65c0084a20d Mon Sep 17 00:00:00 2001 From: Vedang Manerikar <ved.manerikar@gmail.com> Date: Thu, 12 Dec 2024 08:40:55 +0530 Subject: [PATCH] Load emacs-pet from github Finally, this commit puts elpaca to use and does the thing I've been wanting to do, which is being able to develop packages that I am using in a seamless way and being able to contribute PRs upstream. If this experiment goes well, I will merge this branch back into main and continue using elpaca for my package management needs. --- unravel-emacs.org | 27 +++++++++-------- unravel-modules/unravel-langs.el | 51 +++++++++++++++++--------------- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/unravel-emacs.org b/unravel-emacs.org index ff50518..64e08cf 100644 --- a/unravel-emacs.org +++ b/unravel-emacs.org @@ -5306,11 +5306,9 @@ Poetry takes care of setting up the venv properly, so if you replace the default (use-package python :ensure nil - :ensure-system-package (dasel sqlite3) - ;;; Uncomment this if you want Eglot to start automatically. I don't - ;;; recommend it because it does not give you time to activate the - ;;; appropriate VirtualEnv and get the best of the situation. - :hook ((python-base-mode . eglot-ensure)) + ;;; Uncomment this if you want Eglot to start automatically. I prefer + ;;; calling `M-x eglot' myself. + ;; :hook ((python-base-mode . eglot-ensure)) :config (setq python-shell-dedicated 'project) ;; Apheleia is an Emacs package for formatting code as you save @@ -5320,13 +5318,18 @@ Poetry takes care of setting up the venv properly, so if you replace the default (setf (alist-get 'python-mode apheleia-mode-alist) '(ruff-isort ruff)) (setf (alist-get 'python-ts-mode apheleia-mode-alist) - '(ruff-isort ruff))) - (with-eval-after-load 'eglot - (require 'vedang-pet) - ;; The -10 here is a way to define the priority of the function in - ;; the list of hook functions. We want `pet-mode' to run before - ;; any other configured hook function. - (add-hook 'python-base-mode-hook #'pet-mode -10))) + '(ruff-isort ruff)))) + + (use-package pet + :ensure (:host github :repo "vedang/emacs-pet" :branch "fix-eglot-integration" + ;; :remotes (("upstream" :repo "wyuenho/emacs-pet" :branch "main")) + ) + :ensure-system-package (dasel sqlite3) + :config + ;; The -10 here is a way to define the priority of the function in + ;; the list of hook functions. We want `pet-mode' to run before any + ;; other configured hook function. + (add-hook 'python-base-mode-hook #'pet-mode -10)) #+end_src *** Tooling I have tried and rejected or failed to setup correctly diff --git a/unravel-modules/unravel-langs.el b/unravel-modules/unravel-langs.el index 44d75f2..3dd3b85 100644 --- a/unravel-modules/unravel-langs.el +++ b/unravel-modules/unravel-langs.el @@ -29,7 +29,7 @@ (use-package eglot :ensure nil :demand t ; Not a mistake, we need to load Eglot elisp code before - ; we open any Python file. + ; we open any Python file. :functions (eglot-ensure) :commands (eglot) :bind @@ -373,11 +373,9 @@ modifications." (use-package python :ensure nil - :ensure-system-package (dasel sqlite3) -;;; Uncomment this if you want Eglot to start automatically. I don't -;;; recommend it because it does not give you time to activate the -;;; appropriate VirtualEnv and get the best of the situation. - :hook ((python-base-mode . eglot-ensure)) +;;; Uncomment this if you want Eglot to start automatically. I prefer +;;; calling `M-x eglot' myself. + ;; :hook ((python-base-mode . eglot-ensure)) :config (setq python-shell-dedicated 'project) ;; Apheleia is an Emacs package for formatting code as you save @@ -387,13 +385,18 @@ modifications." (setf (alist-get 'python-mode apheleia-mode-alist) '(ruff-isort ruff)) (setf (alist-get 'python-ts-mode apheleia-mode-alist) - '(ruff-isort ruff))) - (with-eval-after-load 'eglot - (require 'vedang-pet) - ;; The -10 here is a way to define the priority of the function in - ;; the list of hook functions. We want `pet-mode' to run before - ;; any other configured hook function. - (add-hook 'python-base-mode-hook #'pet-mode -10))) + '(ruff-isort ruff)))) + +(use-package pet + :ensure (:host github :repo "vedang/emacs-pet" :branch "fix-eglot-integration" + ;; :remotes (("upstream" :repo "wyuenho/emacs-pet" :branch "main")) + ) + :ensure-system-package (dasel sqlite3) + :config + ;; The -10 here is a way to define the priority of the function in + ;; the list of hook functions. We want `pet-mode' to run before any + ;; other configured hook function. + (add-hook 'python-base-mode-hook #'pet-mode -10)) ;;;; Configuration for Zig Programming @@ -438,17 +441,17 @@ NS is the namespace information passed into the function by cider." :ensure t :config (defun json->edn () - "Convert the selected region, or entire file, from JSON to EDN." - (interactive) - (let ((b (if mark-active (region-beginning) (point-min))) - (e (if mark-active (region-end) (point-max))) - (jet (when (executable-find "jet") - "jet --pretty --keywordize keyword --from json --to edn"))) - (if jet - (let ((p (point))) - (shell-command-on-region b e jet (current-buffer) t) - (goto-char p)) - (user-error "Could not find jet installed"))))) + "Convert the selected region, or entire file, from JSON to EDN." + (interactive) + (let ((b (if mark-active (region-beginning) (point-min))) + (e (if mark-active (region-end) (point-max))) + (jet (when (executable-find "jet") + "jet --pretty --keywordize keyword --from json --to edn"))) + (if jet + (let ((p (point))) + (shell-command-on-region b e jet (current-buffer) t) + (goto-char p)) + (user-error "Could not find jet installed"))))) ;;; Settings for Interaction mode for Emacs-Lisp (use-package ielm