unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33359: On emacs-clang-format
@ 2018-11-12 21:40 Tim Gesthuizen
  2018-11-14 10:25 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Gesthuizen @ 2018-11-12 21:40 UTC (permalink / raw)
  To: 33359


[-- Attachment #1.1.1: Type: text/plain, Size: 857 bytes --]

Hi,
I noticed that someone packaged emacs-clang-format.
There are some problems with the current package definition:

- clang already distributes the same functionality (Maybe I am missing a
  feature that clangs version does not have though).
- The package also includes integration for clang-rename.
- The package should probably have a more generic name and function as a
  package for all emacs integration clang offers.
- The clang package is installing the same files under share/clang.
  Maybe those should be removed.
- The license is incorrect. The version that is cloned from github
  also seems to have some licensing issues (Missing full license...)

You'll find an example package definition attached.
This can probably be optimized a little bit more so that the full clang
tarball does not need to be extracted twice.

Tim.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-gnu-Add-emacs-clang-tooling.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-emacs-clang-tooling.patch", Size: 3805 bytes --]

From bc5d4139c28c10fc5a52466fd2b4182560fed8c6 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen@yahoo.de>
Date: Mon, 12 Nov 2018 22:27:41 +0100
Subject: [PATCH] * gnu: Add emacs-clang-tooling.

---
 gnu/packages/emacs.scm | 73 +++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3e32998a9..e1e751d4b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -12490,42 +12490,43 @@ correctly.")
 @end itemize\n")
       (license license:gpl3+))))
 
-(define-public emacs-clang-format
-  (let ((commit "5556c31528af2661bed3011bd63ffc0ed44e18a0"))
-    (package
-      (name "emacs-clang-format")
-      (version (git-version "0.0.0" "1" commit))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/emacsorphanage/clang-format")
-                      (commit commit)))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "0ynvnp3vrcpngmwakb23xv4xn7jbkg43s196q7pg9nkl13x4n2nq"))))
-      (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")))
-                 ;; Repo is read-only.
-                 (chmod "clang-format.el" #o644)
-                 (emacs-substitute-variables "clang-format.el"
-                   ("clang-format-executable"
-                    (string-append clang "/bin/clang-format"))))
-               #t)))))
-      (home-page "https://github.com/emacsorphanage/clang-format")
-      (synopsis "Format code using clang-format")
-      (description "This package allows to filter code through clang-format to
-fix its formatting.  @command{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}.")
-      (license license:gpl3+))))
+(define-public emacs-clang-tooling
+  (package
+    (inherit clang)
+    (name "emacs-clang-tooling")
+    (version (package-version clang))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://llvm.org/releases/"
+                           version "/cfe-" version ".src.tar.xz"))
+       (sha256 (base32 "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w"))
+       (snippet
+	'(begin
+	   (copy-file "tools/clang-rename/clang-rename.el" "clang-rename.el")
+	   (copy-file "tools/clang-format/clang-format.el" "clang-format.el")))))
+    (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")))
+	       ;; Repo is read-only.
+	       (chmod "clang-format.el" #o644)
+	       (emacs-substitute-variables "clang-format.el"
+		 ("clang-format-executable"
+		  (string-append clang "/bin/clang-format")))
+	       (chmod "clang-rename.el" #o644)
+	       (emacs-substitute-variables "clang-rename.el"
+		 ("clang-rename-binary"
+		  (string-append clang "/bin/clang-rename"))))
+	     #t)))))
+    (synopsis "Integration of clang-tooling into emacs")
+    (description "This package provides integration of clang tooling into emacs.
+It can be used with C/C++/Obj-C code.")))
 
 (define-public emacs-gtk-look
   (package
-- 
2.19.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#33359: On emacs-clang-format
  2018-11-12 21:40 bug#33359: On emacs-clang-format Tim Gesthuizen
@ 2018-11-14 10:25 ` Ludovic Courtès
  2018-11-14 10:48   ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2018-11-14 10:25 UTC (permalink / raw)
  To: Tim Gesthuizen, Pierre Neidhardt; +Cc: 33359

Hi Tim,

Thanks for your feedback.

Tim Gesthuizen <tim.gesthuizen@yahoo.de> skribis:

> I noticed that someone packaged emacs-clang-format.
> There are some problems with the current package definition:
>
> - clang already distributes the same functionality (Maybe I am missing a
>   feature that clangs version does not have though).
> - The package also includes integration for clang-rename.
> - The package should probably have a more generic name and function as a
>   package for all emacs integration clang offers.
> - The clang package is installing the same files under share/clang.
>   Maybe those should be removed.
> - The license is incorrect. The version that is cloned from github
>   also seems to have some licensing issues (Missing full license...)
>
> You'll find an example package definition attached.
> This can probably be optimized a little bit more so that the full clang
> tarball does not need to be extracted twice.

Pierre, WDYT?

Thanks in advance!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#33359: On emacs-clang-format
  2018-11-14 10:25 ` Ludovic Courtès
@ 2018-11-14 10:48   ` Pierre Neidhardt
  2018-11-14 15:56     ` Tim Gesthuizen
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Neidhardt @ 2018-11-14 10:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 33359, Tim Gesthuizen

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

That's absolutely right, I didn't know clang packaged it already.

Here is the listing.

--8<---------------cut here---------------start------------->8---
> ls -1 /gnu/store/...-clang-6.0.1/share/clang
bash-autocomplete.sh
clang-format-bbedit.applescript
clang-format-diff.py
clang-format-sublime.py
clang-format.el
clang-format.py
clang-rename.el
clang-rename.py
--8<---------------cut here---------------end--------------->8---

Not should we fix the Emacs package, but also the Vim .py files, the
Sublime+bbedit extensions (which we can discard I guess) and the Bash
completion.

I see a few ways we can proceed:

- Deprecate emacs-clang-format.

  - Use emacs-clang-tooling as suggested by Tim.

  - Use clang as it is and fix the installation of the share folder.
    
  - Use clang:emacs output and clang:vim output.

- Keep emacs-clang-format but use the Clang source (as per Tim suggestion), and
  add emacs-clang-rename from the same source.

In all cases we need to fix the installation of the Bash completion file and
maybe to discard the Sublime+bbedit extensions.

> : - The license is incorrect. The version that is cloned from github
> :   also seems to have some licensing issues (Missing full license...)

Which license?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#33359: On emacs-clang-format
  2018-11-14 10:48   ` Pierre Neidhardt
@ 2018-11-14 15:56     ` Tim Gesthuizen
  2018-11-26 13:54       ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Gesthuizen @ 2018-11-14 15:56 UTC (permalink / raw)
  To: Pierre Neidhardt, Ludovic Courtès; +Cc: 33359


[-- Attachment #1.1: Type: text/plain, Size: 731 bytes --]

On 14.11.2018 11:48, Pierre Neidhardt wrote:
>> : - The license is incorrect. The version that is cloned from github
>> :   also seems to have some licensing issues (Missing full license...)
> 
> Which license?
> 

The emacs-clang-format package definition claims that the package is
licensed under the GPLv3+. The files in the repository are licensed
under the same license that clang is licensed under ( The headers of the
files actually say that they are from the LLVM project). This means the
package is licensed under University of Illinois/NCSA Open Source License.
So while it would probably be legal to distribute binaries and source
code under the terms of the GPL this should probably be fixed :)

Tim.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#33359: On emacs-clang-format
  2018-11-14 15:56     ` Tim Gesthuizen
@ 2018-11-26 13:54       ` Pierre Neidhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Neidhardt @ 2018-11-26 13:54 UTC (permalink / raw)
  To: Tim Gesthuizen; +Cc: 33359

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

I went ahead and implemented the aforementioned approach:

> - Keep emacs-clang-format but use the Clang source (as per Tim suggestion), and
>   add emacs-clang-rename from the same source.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-26 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 21:40 bug#33359: On emacs-clang-format Tim Gesthuizen
2018-11-14 10:25 ` Ludovic Courtès
2018-11-14 10:48   ` Pierre Neidhardt
2018-11-14 15:56     ` Tim Gesthuizen
2018-11-26 13:54       ` Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).