From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:46239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghf4i-0000EG-Iw for guix-patches@gnu.org; Thu, 10 Jan 2019 13:29:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghf4g-0001SM-4a for guix-patches@gnu.org; Thu, 10 Jan 2019 13:29:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54892) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghf4f-0001S4-Sk for guix-patches@gnu.org; Thu, 10 Jan 2019 13:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ghf4f-0007of-MF for guix-patches@gnu.org; Thu, 10 Jan 2019 13:29:01 -0500 Subject: [bug#33598] Optimizations for emacs-clang-format and emacs-clang-rename Resent-Message-ID: References: <871s6l9h54.fsf@gnu.org> <87r2ekea1u.fsf@ambrevar.xyz> <04daca2a-705d-6255-85bd-48132879f5a8@yahoo.de> <87lg4se6wf.fsf@ambrevar.xyz> <8d15b1a4-5f0b-28aa-a3d9-78520431b8ef@yahoo.de> <87imzwe2d3.fsf@ambrevar.xyz> <2df7cbf3-81d5-7d50-35d7-f3b369d1ac0e@yahoo.de> <87ftuth0d7.fsf@ambrevar.xyz> <14de0933-fddc-94d0-d75a-cdf4b49fce1a@yahoo.de> <87wonhipbw.fsf@ambrevar.xyz> <792d34a0-b048-b84f-b7b8-d9d996da2a28@yahoo.de> <878szwinp0.fsf@ambrevar.xyz> <877efgin3x.fsf@ambrevar.xyz> <875zv0imr7.fsf@ambrevar.xyz> <87k1jgce5s.fsf@gnu.org> <878szw6rot.fsf@ambrevar.xyz> <874laj35n6.fsf@gnu.org> <87wonf5yd7.fsf@ambrevar.xyz> <87k1jfzd8x.fsf@gnu.org> <87va2z5us6.fsf@ambrevar.xyz> From: Tim Gesthuizen Message-ID: Date: Thu, 10 Jan 2019 19:28:16 +0100 MIME-Version: 1.0 In-Reply-To: <87va2z5us6.fsf@ambrevar.xyz> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pFySSy80a6M31JNiVOS7qImGmnD7voZJ8" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Pierre Neidhardt , Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 33598@debbugs.gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pFySSy80a6M31JNiVOS7qImGmnD7voZJ8 Content-Type: multipart/mixed; boundary="bB5ru9GL4Ri8p6dSGlLk6ut928FdyoDJe"; protected-headers="v1" From: Tim Gesthuizen To: Pierre Neidhardt , =?UTF-8?Q?Ludovic_Court=c3=a8s?= Cc: 33598@debbugs.gnu.org Message-ID: Subject: Re: [bug#33598] Optimizations for emacs-clang-format and emacs-clang-rename References: <871s6l9h54.fsf@gnu.org> <87r2ekea1u.fsf@ambrevar.xyz> <04daca2a-705d-6255-85bd-48132879f5a8@yahoo.de> <87lg4se6wf.fsf@ambrevar.xyz> <8d15b1a4-5f0b-28aa-a3d9-78520431b8ef@yahoo.de> <87imzwe2d3.fsf@ambrevar.xyz> <2df7cbf3-81d5-7d50-35d7-f3b369d1ac0e@yahoo.de> <87ftuth0d7.fsf@ambrevar.xyz> <14de0933-fddc-94d0-d75a-cdf4b49fce1a@yahoo.de> <87wonhipbw.fsf@ambrevar.xyz> <792d34a0-b048-b84f-b7b8-d9d996da2a28@yahoo.de> <878szwinp0.fsf@ambrevar.xyz> <877efgin3x.fsf@ambrevar.xyz> <875zv0imr7.fsf@ambrevar.xyz> <87k1jgce5s.fsf@gnu.org> <878szw6rot.fsf@ambrevar.xyz> <874laj35n6.fsf@gnu.org> <87wonf5yd7.fsf@ambrevar.xyz> <87k1jfzd8x.fsf@gnu.org> <87va2z5us6.fsf@ambrevar.xyz> In-Reply-To: <87va2z5us6.fsf@ambrevar.xyz> --bB5ru9GL4Ri8p6dSGlLk6ut928FdyoDJe Content-Type: multipart/mixed; boundary="------------81AF155A443509D879614087" Content-Language: en-US This is a multi-part message in MIME format. --------------81AF155A443509D879614087 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I implemented the changes we discussed so we can finally close this ticke= t. Patches are attached. Tim. --------------81AF155A443509D879614087 Content-Type: text/x-patch; name="0001-gnu-Add-package-elisp-from-package.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-gnu-Add-package-elisp-from-package.patch" =46rom 515a9392b8912fbfb067728acb25f84de83d8378 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:36 +0100 Subject: [PATCH 1/2] gnu: Add package-elisp-from-package Add a function to generate package definitions that packages single elisp= files from other packages. * gnu/packages/llvm.scm (package-elisp-from-package): New function --- gnu/packages/llvm.scm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index b1e41d72f..5518d4d5c 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -8,7 +8,7 @@ ;;; Copyright =C2=A9 2018 Marius Bakke ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2018 Efraim Flashner -;;; Copyright =C2=A9 2018 Tim Gesthuizen +;;; Copyright =C2=A9 2018, 2019 Tim Gesthuizen = ;;; Copyright =C2=A9 2018 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. @@ -508,6 +508,36 @@ SOURCE-FILES found in SOURCE-PACKAGE." (append '("." "..") basenames))) #t))))))) =20 +(define (package-elisp-from-package + source-package package-name source-files) + "Return a package definition that packages emacs-lisp files from the +SOURCE-PACKAGEs source. The package has the name PACKAGE-NAME and packa= ges +the files SOURCE-FILES from the source in its root directory." + (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-packag= e))) + (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) --=20 2.20.1 --------------81AF155A443509D879614087 Content-Type: text/x-patch; name="0002-gnu-Use-package-elisp-from-package-for-clangs-emacs-.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0002-gnu-Use-package-elisp-from-package-for-clangs-emacs-.pa"; filename*1="tch" =46rom 939547e6e2c0f5a83eb1290ff1c9ee39415ce3d5 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:56 +0100 Subject: [PATCH 2/2] gnu: Use package-elisp-from-package for clangs emacs= lisp files Use package-elisp-from-package for emacs-clang-format and emacs-clang-ren= ame. Also remove package-from-clang-elisp-file as it is not needed anymore. * gnu/packages/llvm.scm (emacs-clang-format): Use package-elisp-from-pack= age * gnu/packages/llvm.scm (emacs-clang-rename): Use package-elisp-from-pack= age * gnu/packages/llvm.scm (package-from-clang-elisp-file): Remove function --- gnu/packages/llvm.scm | 63 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 5518d4d5c..dedad7dc7 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -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) @@ -540,22 +541,21 @@ the files SOURCE-FILES from the source in its root = directory." =20 (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-fo= rmat.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-k= eys) + (chmod "clang-format.el" #o644) + (emacs-substitute-variables "clang-f= ormat.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 @@ -564,22 +564,21 @@ C/C++/Obj-C code according to a set of style option= s, see =20 (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-re= name.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 p= oint using @code{clang-rename}."))) --=20 2.20.1 --------------81AF155A443509D879614087-- --bB5ru9GL4Ri8p6dSGlLk6ut928FdyoDJe-- --pFySSy80a6M31JNiVOS7qImGmnD7voZJ8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEKUiC5+8BRKEri5fa0uWPaa77GdUFAlw3jsEACgkQ0uWPaa77 GdX+PggAqvuAfjw7XdPqGAUShxNX6yYooshtNDvO5kGiWLiWtPAshw+l3yv94VzU NZJfpBRs5nszcEq9MAMCL69mhaVHvN1/2l3qkfjERmeQ4UqIiMi+fpTJ84ZMU3K6 Zu9RZlgNrVcgWdpbwyzAtVqD26CW0o6xBiu28Zp0U9/dNpqYzbRFC6WXUnvboBVU 82DAsbhJP5vOXQ5NF0zFwTEDMQd9tBQh4azQ3MtKKvkfuRBee7cROwVPStxP4pIn 1EWnBW6d7Pm3BBCpv8WNVyQysjurt4az1zUcSMGM1XBFBzIkXPDYTA/UEB1R6pFR HHgElVtbz8F22wqF+edeNasGbAq6Gw== =N7Zw -----END PGP SIGNATURE----- --pFySSy80a6M31JNiVOS7qImGmnD7voZJ8--