From patchwork Fri Jan 4 22:00:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gesthuizen X-Patchwork-Id: 663 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 02F9516A20; Fri, 4 Jan 2019 23:28:06 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id EE93B16A1E for ; Fri, 4 Jan 2019 23:28:03 +0000 (GMT) Received: from [127.0.0.1] (port=39294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfXXx-0008EP-Fj for patchwork@mira.cbaines.net; Fri, 04 Jan 2019 17:02:29 -0500 Received: from [208.118.235.92] (port=33705 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfXXg-0008Az-7j for guix-patches@gnu.org; Fri, 04 Jan 2019 17:02:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfXXW-00005z-Jf for guix-patches@gnu.org; Fri, 04 Jan 2019 17:02:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gfXXW-00005m-DX for guix-patches@gnu.org; Fri, 04 Jan 2019 17:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gfXXW-0004FJ-6U for guix-patches@gnu.org; Fri, 04 Jan 2019 17:02:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33598] Optimizations for emacs-clang-format and emacs-clang-rename Resent-From: Tim Gesthuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Jan 2019 22:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33598 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Pierre Neidhardt Received: via spool by 33598-submit@debbugs.gnu.org id=B33598.154663927216266 (code B ref 33598); Fri, 04 Jan 2019 22:02:02 +0000 Received: (at 33598) by debbugs.gnu.org; 4 Jan 2019 22:01:12 +0000 Received: from localhost ([127.0.0.1]:47082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfXWd-0004EF-Rl for submit@debbugs.gnu.org; Fri, 04 Jan 2019 17:01:11 -0500 Received: from sonic311-31.consmr.mail.ir2.yahoo.com ([77.238.176.163]:42515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfXWb-0004Dc-B6 for 33598@debbugs.gnu.org; Fri, 04 Jan 2019 17:01:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1546639259; bh=iY87dtX5bTb5BPUiz1uBeFa4GcSQTCJORItPpW1tWIs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=crmgCD101WTj81Uoh+yFdHARQliBk8k+/wo0E+m18dl+onL9kiYVLqOKJ5+z6Q6TkgPAYtmx4czhqrTWFqzwyAgipSifmwwnVGTCkvXVaKO6dxMVFF1fgte4bXvYUdLLyTONKNEFEjlZySuAdQjMhf9gb64EsA1MgaheKb9k6k3gf09JquMZYkb6eB+aHsOgtIGq1mE5TRBSTN8i8TEDndJq1cVh/A9bJ3vf73BLu3whEcwDechz4athwsjyWUoh9zYH10g76GyVSnUlBrzKtr2Pw7o4a7uZWcPdH2HmM5hVRYxkq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ijJyOXFQ8qbNTBPg0W qJzbzxDITRG__ZEsgb0ggQexLPregUiSYli9tfjdKjEcLwLdthBl2ZRdr9Ko2Rdjqc8P0XQkbAfe pJRCvddoc1t9J2b3V3faaHhFoqAG2Dc_6gSsdaWs- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Fri, 4 Jan 2019 22:00:59 +0000 Received: from p5B221793.dip0.t-ipconnect.de (EHLO [192.168.178.27]) ([91.34.23.147]) by smtp406.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 664e3d076c79e98f28661625337c8a38; Fri, 04 Jan 2019 22:00:55 +0000 (UTC) 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> From: Tim Gesthuizen Message-ID: <14de0933-fddc-94d0-d75a-cdf4b49fce1a@yahoo.de> Date: Fri, 4 Jan 2019 23:00:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87ftuth0d7.fsf@ambrevar.xyz> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 33598@debbugs.gnu.org Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches On 19.12.2018 18:50, Pierre Neidhardt wrote: > Hi Tim, > > Yeah, that makes sense. Please send a new patch updated with the aforementioned > recommendations and I'll merge. > Thanks for the good work! > Hi, I had some problems packaging the changes because I had some really weird issues with the guile modules (please validate that the patches compile as expected). They implement the discussed function for generating package definitions for packages that contain only a single elisp file from another packages source. If the attached patches compile, they can be merged and work as expected. If they cause weird errors to happen Pierre tries to find some time to investigate into this. Tim Gesthuizen. From fda77fbd33933065a3d18f4db60fbf53f5908970 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:56 +0100 Subject: [PATCH 5/5] 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 | 70 ++++++++++--------------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 05147b665..c846e2758 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) @@ -479,69 +480,28 @@ code analysis tools.") "This package provides a Python binding to LLVM for use in Numba.") (license license:bsd-3))) -;;; Returns a package definition that packages an emacs-lisp file from the -;;; clang source. The package has the name PKGNAME and packages the file -;;; SRC-FILE from the clang source in its root directory with the name -;;; TARGET-FILE where SUBST substitutions will be performed on the elisp file -;;; and SYN and DESC as the package synopsis an description. -(define (package-from-clang-elisp-file pkgname src-file target-file subst syn desc) - (package - (inherit clang) - (name pkgname) - (source (let ((orig (package-source clang))) - (origin - (method (origin-method orig)) - (uri (origin-uri orig)) - (sha256 (origin-sha256 orig)) - (file-name (string-append pkgname "-" (package-version clang))) - (modules '((guix build utils) - (srfi srfi-1) - (ice-9 ftw))) - (snippet - `(begin - ;; Copy target file to source root and delete all other files - (copy-file (string-append ,src-file) - ,target-file) - (map delete-file-recursively - (fold delete - (scandir ".") - '("." ".." ,target-file))) - #t))))) - (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"))) - (emacs-substitute-variables ,target-file - ,subst)) - #t))))) - (synopsis syn) - (description desc))) - (define-public emacs-clang-format - (package-from-clang-elisp-file + (package-elisp-from-package + clang "emacs-clang-format" "tools/clang-format/clang-format.el" - "clang-format.el" - '("clang-format-executable" - (string-append clang "/bin/clang-format")) - "Format code using clang-format" - "This package allows to filter code through @code{clang-format} + #:inputs `(("clang" ,clang)) + #:substitutions '("clang-format-executable" + (string-append (assoc-ref inputs "clang") "/bin/clang-format")) + #: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 C/C++/Obj-C code according to a set of style options, see @url{http://clang.llvm.org/docs/ClangFormatStyleOptions.html}.")) (define-public emacs-clang-rename - (package-from-clang-elisp-file + (package-elisp-from-package + clang "emacs-clang-rename" "tools/clang-rename/clang-rename.el" - "clang-rename.el" - '("clang-rename-binary" - (string-append clang "/bin/clang-rename")) - "Rename every occurrence of a symbol using clang-rename" - "This package renames every occurrence of a symbol at point + #:inputs `(("clang" ,clang)) + #:substitutions '("clang-rename-binary" + (string-append (assoc-ref inputs "clang") "/bin/clang-rename")) + #: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}.")) -- 2.20.1