From 5bc2e14add6433adbade3ccdf28c60e57334c20a Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:56 +0100 Subject: gnu: Use package-elisp-from-package for clangs emacs lisp files Use package-elisp-from-package for emacs-clang-format and emacs-clang-rename. Also remove package-from-clang-elisp-file as it is not needed anymore. * gnu/packages/llvm.scm (emacs-clang-format): Use package-elisp-from-package * gnu/packages/llvm.scm (emacs-clang-rename): Use package-elisp-from-package * gnu/packages/llvm.scm (package-from-clang-elisp-file): Remove function --- gnu/packages/llvm.scm | 65 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 6dab9c5195..32d7ef81b1 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Efraim Flashner -;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2018, 2019 Tim Gesthuizen ;;; Copyright © 2018 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. @@ -39,6 +39,7 @@ #:use-module (gnu packages gcc) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker #:use-module (gnu packages compression) + #:use-module (gnu packages emacs) #:use-module (gnu packages libffi) #:use-module (gnu packages perl) #:use-module (gnu packages python) @@ -481,22 +482,21 @@ code analysis tools.") (define-public emacs-clang-format (package - (inherit clang) - (name "emacs-clang-format") - (build-system emacs-build-system) - (inputs - `(("clang" ,clang))) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'configure - (lambda* (#:key inputs #:allow-other-keys) - (let ((clang (assoc-ref inputs "clang"))) - (copy-file "tools/clang-format/clang-format.el" "clang-format.el") - (emacs-substitute-variables "clang-format.el" - ("clang-format-executable" - (string-append clang "/bin/clang-format")))) - #t))))) + (inherit (package-elisp-from-package + clang + "emacs-clang-format" + '("tools/clang-format/clang-format.el"))) + (inputs `(("clang" ,clang))) + (arguments `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'configure + (lambda* (#:key inputs #:allow-other-keys) + (chmod "clang-format.el" #o644) + (emacs-substitute-variables "clang-format.el" + ("clang-format-executable" + (string-append (assoc-ref inputs "clang") + "/bin/clang-format"))) + #t))))) (synopsis "Format code using clang-format") (description "This package allows to filter code through @code{clang-format} to fix its formatting. @code{clang-format} is a tool that formats @@ -505,22 +505,21 @@ C/C++/Obj-C code according to a set of style options, see (define-public emacs-clang-rename (package - (inherit clang) - (name "emacs-clang-rename") - (build-system emacs-build-system) - (inputs - `(("clang" ,clang))) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'configure - (lambda* (#:key inputs #:allow-other-keys) - (let ((clang (assoc-ref inputs "clang"))) - (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el") - (emacs-substitute-variables "clang-rename.el" - ("clang-rename-binary" - (string-append clang "/bin/clang-rename")))) - #t))))) + (inherit (package-elisp-from-package + clang + "emacs-clang-rename" + '("tools/clang-rename/clang-rename.el"))) + (inputs `(("clang" ,clang))) + (arguments `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'configure + (lambda* (#:key inputs #:allow-other-keys) + (chmod "clang-rename.el" #o644) + (emacs-substitute-variables "clang-rename.el" + ("clang-rename-binary" + (string-append (assoc-ref inputs "clang") + "/bin/clang-rename"))) + #t))))) (synopsis "Rename every occurrence of a symbol using clang-rename") (description "This package renames every occurrence of a symbol at point using @code{clang-rename}."))) -- cgit v1.2.3 From 3a3d4d9d545028cda846ae827a60249f7162d34e Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 7 Jan 2019 14:58:40 +0100 Subject: Revert "gnu: Use package-elisp-from-package for clangs emacs lisp files" This reverts commit 5bc2e14add6433adbade3ccdf28c60e57334c20a. --- gnu/packages/llvm.scm | 65 ++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 32d7ef81b1..6dab9c5195 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Efraim Flashner -;;; Copyright © 2018, 2019 Tim Gesthuizen +;;; Copyright © 2018 Tim Gesthuizen ;;; Copyright © 2018 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. @@ -39,7 +39,6 @@ #:use-module (gnu packages gcc) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker #:use-module (gnu packages compression) - #:use-module (gnu packages emacs) #:use-module (gnu packages libffi) #:use-module (gnu packages perl) #:use-module (gnu packages python) @@ -482,21 +481,22 @@ code analysis tools.") (define-public emacs-clang-format (package - (inherit (package-elisp-from-package - clang - "emacs-clang-format" - '("tools/clang-format/clang-format.el"))) - (inputs `(("clang" ,clang))) - (arguments `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'configure - (lambda* (#:key inputs #:allow-other-keys) - (chmod "clang-format.el" #o644) - (emacs-substitute-variables "clang-format.el" - ("clang-format-executable" - (string-append (assoc-ref inputs "clang") - "/bin/clang-format"))) - #t))))) + (inherit clang) + (name "emacs-clang-format") + (build-system emacs-build-system) + (inputs + `(("clang" ,clang))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'configure + (lambda* (#:key inputs #:allow-other-keys) + (let ((clang (assoc-ref inputs "clang"))) + (copy-file "tools/clang-format/clang-format.el" "clang-format.el") + (emacs-substitute-variables "clang-format.el" + ("clang-format-executable" + (string-append clang "/bin/clang-format")))) + #t))))) (synopsis "Format code using clang-format") (description "This package allows to filter code through @code{clang-format} to fix its formatting. @code{clang-format} is a tool that formats @@ -505,21 +505,22 @@ C/C++/Obj-C code according to a set of style options, see (define-public emacs-clang-rename (package - (inherit (package-elisp-from-package - clang - "emacs-clang-rename" - '("tools/clang-rename/clang-rename.el"))) - (inputs `(("clang" ,clang))) - (arguments `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'configure - (lambda* (#:key inputs #:allow-other-keys) - (chmod "clang-rename.el" #o644) - (emacs-substitute-variables "clang-rename.el" - ("clang-rename-binary" - (string-append (assoc-ref inputs "clang") - "/bin/clang-rename"))) - #t))))) + (inherit clang) + (name "emacs-clang-rename") + (build-system emacs-build-system) + (inputs + `(("clang" ,clang))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'configure + (lambda* (#:key inputs #:allow-other-keys) + (let ((clang (assoc-ref inputs "clang"))) + (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el") + (emacs-substitute-variables "clang-rename.el" + ("clang-rename-binary" + (string-append clang "/bin/clang-rename")))) + #t))))) (synopsis "Rename every occurrence of a symbol using clang-rename") (description "This package renames every occurrence of a symbol at point using @code{clang-rename}."))) -- cgit v1.2.3 From 67eebb19b70acfe997b40d8c7978f9dc0673a4af Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 7 Jan 2019 14:59:01 +0100 Subject: gnu: Fix top-level circular references between emacs.scm and llvm.scm. Previously, loading either of these two modules could fail somewhat non-deterministically because each top-level was referencing a variable defined by the other module's top-level. * gnu/packages/emacs.scm (package-elisp-from-package): Move to... * gnu/packages/llvm.scm (package-elisp-from-package): Here. Keep private. --- gnu/packages/emacs.scm | 29 ----------------------------- gnu/packages/llvm.scm | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'gnu/packages/llvm.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 0c39a9c5ad..33b011c294 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -331,35 +331,6 @@ editor (without an X toolkit)" ) (lambda _ (invoke "mkdir" "-p" "src/deps"))))))))) -(define-public (package-elisp-from-package - source-package package-name source-files) - "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp -SOURCE-FILES found in SOURCE-PACKAGE." - (let ((orig (package-source source-package))) - (package - (inherit source-package) - (name package-name) - (build-system emacs-build-system) - (source (origin - (method (origin-method orig)) - (uri (origin-uri orig)) - (sha256 (origin-sha256 orig)) - (file-name (string-append package-name "-" - (package-version source-package))) - (modules '((guix build utils) - (srfi srfi-1) - (ice-9 ftw))) - (snippet - `(let* ((source-files (quote ,source-files)) - (basenames (map basename source-files))) - (map copy-file - source-files basenames) - (map delete-file-recursively - (fold delete - (scandir ".") - (append '("." "..") basenames))) - #t))))))) - ;;; ;;; Emacs hacking. diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 6dab9c5195..b1e41d72f9 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -479,6 +479,35 @@ code analysis tools.") "This package provides a Python binding to LLVM for use in Numba.") (license license:bsd-3))) +(define (package-elisp-from-package source-package package-name + source-files) + "Return a package definition named PACKAGE-NAME that packages the Emacs Lisp +SOURCE-FILES found in SOURCE-PACKAGE." + (let ((orig (package-source source-package))) + (package + (inherit source-package) + (name package-name) + (build-system emacs-build-system) + (source (origin + (method (origin-method orig)) + (uri (origin-uri orig)) + (sha256 (origin-sha256 orig)) + (file-name (string-append package-name "-" + (package-version source-package))) + (modules '((guix build utils) + (srfi srfi-1) + (ice-9 ftw))) + (snippet + `(let* ((source-files (quote ,source-files)) + (basenames (map basename source-files))) + (map copy-file + source-files basenames) + (map delete-file-recursively + (fold delete + (scandir ".") + (append '("." "..") basenames))) + #t))))))) + (define-public emacs-clang-format (package (inherit clang) -- cgit v1.2.3