This patch series is a resend of 54944 v3, marked as SUPERSEDED.
v2 cover-letter:
This is a complete rewrite of the previous patch series. The
rde-initialize-guix-python-environment has been completely rewritten
to parse the search paths instead of determining profile by hand. It
has been completed by a rde-project-get-manifest-search-paths in
feature-emacs-project that will probably be useful for other
languages. The patch series is rebased to account for updates in Guix
upstream. Lastly a fix is provided for the proper accounting of
max-line-length, with a dedicated-option.
v3 cover-letter:
Actually I'm not sure that the 5/6 patch fixes the issue, probably
requires more testing.
I'd also like to have Andrew's input before considering merging 3/6 ;)
Nicolas Graves (6):
rde: python: Ensure home-services definition
rde: python: Introduce lsp for python
rde: project: Add function to extract search-paths
rde: python: Add function rde-initialize-guix-python-environment
rde: python: Fix and add option max-line-length
rde: python: Add options dap? and python-debugpy
src/rde/features/emacs-xyz.scm | 49 +++++++++++-
src/rde/features/python.scm | 137 +++++++++++++++++++++++++--------
2 files changed, 153 insertions(+), 33 deletions(-)
--
2.47.1
They provide a really pleasant alist corresponding to the guix
search-paths of the current project. It does not behave that well
when there is no guix shell cache (launches hidden builds), hence the
5 seconds timeout to stop any hidden build and warn the user.
---
src/rde/features/emacs-xyz.scm | 49 ++++++++++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 45febfc8..5bad5e97 100644
--- a/src/rde/features/emacs-xyz.scm+++ b/src/rde/features/emacs-xyz.scm
@@ -2797,8 +2797,9 @@ working environemnt."
(define* (feature-emacs-project
#:key
- (project-extra-dominating-files- '(".project.el" ".dir-locals.el" ".gitignore")))+ (project-extra-dominating-files ;order matters+ '(".project.el" "manifest.scm" "guix.scm"+ ".dir-locals.el" ".gitignore"))) "Configure project.el, a library to perform operations
on the current project."
(ensure-pred list? project-extra-dominating-files)
@@ -2858,6 +2859,50 @@ on the current project."
(add-hook 'project-find-functions 'project-try-vc)
(advice-add 'project-compile :override 'rde-project-compile)
+ (defun rde-project-parse-search-paths (search-paths)+ "Parse the SEARCH-PATHS string into an alist of variables and their values.+Each value is a list of strings, split by ':' in case of multiple paths."+ (let ((lines (split-string search-paths "\n" t))+ (alist '()))+ (dolist (line lines)+ (when (string-prefix-p "export " line)+ (let ((parsed (split-string (substring line 7) "=" t "\"")))+ (push (cons (car parsed)+ (split-string (cadr parsed) ":"))+ alist))))+ (reverse alist)))++ (defun rde-project-get-manifest-search-paths ()+ "Get the content of guix shell --search-paths --pure as an alist."+ (interactive)+ (if (or (member "guix.scm" rde-project-dominating-files)+ (member "manifest.scm" rde-project-dominating-files))+ (when-let* ((default-directory (project-root+ (rde-project-custom-root+ default-directory)))+ (manifest-file+ (seq-find+ 'file-readable-p+ (list+ (file-truename "manifest.scm")+ (file-truename "guix.scm"))))+ (result+ (with-output-to-string+ (with-current-buffer+ standard-output+ (if (zerop (call-process+ "guix" nil t nil "shell"+ "-m" manifest-file+ "--search-paths" "--pure"+ "--timeout=5"))+ (buffer-string)+ (error "\+guix shell times out. Ensure the profile is built."))))))+ (rde-project-parse-search-paths result))+ (message "rde-projects-get-manifest-search-paths: \+rde-project-dominating-files requires \"guix.scm\" or \"manifest.scm\" to be \+able to load guix shell search-paths.")))+ (define-key global-map (kbd "s-p") project-prefix-map)
(with-eval-after-load 'project
--
2.47.1
[PATCH rde v4 4/6] rde: python: Add function rde-initialize-guix-python-environment