gnu: emacs-treemacs: Update package style.

* gnu/packages/emacs-xyz.scm (emacs-treemacs)[arguments]: Use
G-expressions.  Simplify PATCH-PATHS phase.  Move data within the ELPA directory.
This commit is contained in:
Nicolas Goaziou 2022-09-13 22:37:06 +02:00
parent 66b54aef0d
commit a24da5c8bc
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -25721,56 +25721,57 @@ processes for Emacs.")
(inputs (inputs
(list python)) (list python))
(arguments (arguments
`(#:tests? #t (list
#:test-command '("make" "-C" "../.." "test") #:tests? #t
#:phases #:test-command #~(list "make" "-C" "../.." "test")
(modify-phases %standard-phases #:phases
(add-after 'unpack 'fix-makefile #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'fix-makefile
(substitute* "Makefile" (lambda _
(("@\\$\\(CASK\\) exec ") "") (substitute* "Makefile"
;; Guix does not need to prepare dependencies before testing. (("@\\$\\(CASK\\) exec ") "")
(("test: prepare") "test:")))) ;; Guix does not need to prepare dependencies before testing.
(add-after 'fix-makefile 'chdir-elisp (("test: prepare") "test:"))))
;; Elisp directory is not in root of the source. (add-after 'fix-makefile 'chdir-elisp
(lambda _ ;; Elisp directory is not in root of the source.
(chdir "src/elisp"))) (lambda _
(add-before 'check 'delete-failing-tests (chdir "src/elisp")))
;; FIXME: 4 tests out of 254 are failing. (add-before 'check 'delete-failing-tests
(lambda _ ;; FIXME: 4 tests out of 254 are failing.
(emacs-batch-edit-file "../../test/treemacs-test.el" (lambda _
`(progn (emacs-batch-edit-file "../../test/treemacs-test.el"
(goto-char (point-min)) '(progn
(re-search-forward "describe \"treemacs--parent\"") (goto-char (point-min))
(beginning-of-line) (re-search-forward "describe \"treemacs--parent\"")
(kill-sexp) (beginning-of-line)
(basic-save-buffer))))) (kill-sexp)
(add-before 'install 'patch-paths (basic-save-buffer)))))
(lambda* (#:key inputs outputs #:allow-other-keys) (add-before 'install 'patch-paths
(with-directory-excursion "../.." ;treemacs root (lambda* (#:key inputs #:allow-other-keys)
(chmod "src/elisp/treemacs-core-utils.el" #o644) (make-file-writable "treemacs-core-utils.el")
(emacs-substitute-variables "src/elisp/treemacs-core-utils.el" (emacs-substitute-variables "treemacs-core-utils.el"
("treemacs-dir" ("treemacs-dir" (string-append #$output "/")))
(string-append (assoc-ref outputs "out") "/"))) (make-file-writable "treemacs-icons.el")
(chmod "src/elisp/treemacs-icons.el" #o644) (substitute* "treemacs-icons.el"
(substitute* "src/elisp/treemacs-icons.el" (("icons/default")
(("icons/default") "share/emacs-treemacs/images")) (string-append (elpa-directory #$output) "/icons/default")))
(chmod "src/elisp/treemacs-customization.el" #o644) (make-file-writable "treemacs-customization.el")
(emacs-substitute-variables "src/elisp/treemacs-customization.el" (emacs-substitute-variables "treemacs-customization.el"
("treemacs-python-executable" ("treemacs-python-executable"
(search-input-file inputs "/bin/python3"))) (search-input-file inputs "/bin/python3")))
(chmod "src/elisp/treemacs-async.el" #o644) (make-file-writable "treemacs-async.el")
(substitute* "src/elisp/treemacs-async.el" (substitute* "treemacs-async.el"
(("src/scripts") (string-append "share/" ,name "/scripts")))))) (("src/scripts")
(add-after 'install 'install-data (string-append (elpa-directory #$output) "/scripts")))))
(lambda* (#:key outputs #:allow-other-keys) (add-after 'install 'install-data
(let ((out (assoc-ref outputs "out"))) (lambda _
(with-directory-excursion "../.." ;treemacs root (with-directory-excursion "../.." ;treemacs root
(copy-recursively "icons/default" (copy-recursively
(string-append out "/share/" ,name "/images")) "icons/default"
(copy-recursively (string-append (elpa-directory #$output) "/icons/default"))
"src/scripts" (copy-recursively
(string-append out "/share/" ,name "/scripts"))))))))) "src/scripts"
(string-append (elpa-directory #$output) "/scripts"))))))))
(home-page "https://github.com/Alexander-Miller/treemacs") (home-page "https://github.com/Alexander-Miller/treemacs")
(synopsis "Emacs tree style file explorer") (synopsis "Emacs tree style file explorer")
(description (description