On emacs-clang-format

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Pierre Neidhardt
  • Tim Gesthuizen
Owner
unassigned
Submitted by
Tim Gesthuizen
Severity
normal

Debbugs page

T
T
Tim Gesthuizen wrote on 12 Nov 2018 13:40
(address . bug-guix@gnu.org)
dbdd6fc0-e6c7-6f7a-f140-c742bcdf2734@yahoo.de
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.
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(-)

Toggle diff (86 lines)
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: signature.asc
L
L
Ludovic Courtès wrote on 14 Nov 2018 02:25
(address . 33359@debbugs.gnu.org)
87o9asj6ra.fsf@gnu.org
Hi Tim,

Thanks for your feedback.

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

Toggle quote (17 lines)
> 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’.
P
P
Pierre Neidhardt wrote on 14 Nov 2018 02:48
(name . Ludovic Courtès)(address . ludo@gnu.org)
87y39w0wa5.fsf@ambrevar.xyz
That's absolutely right, I didn't know clang packaged it already.

Here is the listing.

Toggle snippet (11 lines)
> 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

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.

Toggle quote (3 lines)
> : - 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
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlvr/ZIACgkQm9z0l6S7
zH+/FAf9GotW4x+pr/0JsfTozOv4VQiArwVNl9dSMz4S1+Snm4LHdRKWWsrhyMNh
KP2t1x3JJjDlLr1D/cCN9r7hMG6I6uqHSn+3CrkOkASMYTI8iTPfePqJlcJ5RwzP
n7AZmK0Ate3wyzs8w0c+/JF5K0P1bytC2ng9sLAUdmKfkN4kXmwcg1ckZh6u3EOH
sai/SklJp9cGJN2PPdHU/IdDhKwQI7dCM7oLDy+0wmTGftr4tjGiXGAuYsidnL0i
kSi2OGu80EizUAecpetu67T1gwUvmFYLeu17wB9gbCHCn8oBaSBxL/GIioSO/JLr
HmrOPr1pf3UNjMryn6ZWfO3pHW0DZQ==
=igQP
-----END PGP SIGNATURE-----

T
T
Tim Gesthuizen wrote on 14 Nov 2018 07:56
(address . 33359@debbugs.gnu.org)
b1cedc42-7d4e-3d6d-a25f-1bbbc480c30e@yahoo.de
On 14.11.2018 11:48, Pierre Neidhardt wrote:
Toggle quote (6 lines)
>> : - 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: signature.asc
P
P
Pierre Neidhardt wrote on 26 Nov 2018 05:54
(name . Tim Gesthuizen)(address . tim.gesthuizen@yahoo.de)
87zhtwhrko.fsf@ambrevar.xyz
I went ahead and implemented the aforementioned approach:

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

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlv7+ycACgkQm9z0l6S7
zH/Mewf+KKBw6YY0cAPEHCIkj5zmDHnQ5nJ1XRrJ36iFtifpTfJTFtQuqH/awkJ/
02CzTULIZRRgw1jippDJorK6j1WOdl1cWGd2W/SncOxpKR7J3E1SExJYa9krHNdM
P32f1JaFl/baeruk+0SGOX/oKh2MwNnQmjlp7Ftn36YY9qwGTsdnTItcGbDNK7GS
i1y8osXZbjsW92cINSKMCGBTSSyvFACqM3dugyPPIMjBCJ3N+80+1Xb5xf191H/g
3tyV/cm/XJQx3OYFNygyjme+UFnPWL+COHrd3CFnJDbibKgpOi0tLfn+cjDgm2Ui
U/BJMfAhPoJSdASEPF5d/skjce7Qtg==
=1dmg
-----END PGP SIGNATURE-----

P
P
Pierre Neidhardt wrote on 26 Nov 2018 05:55
control message for bug #33359
(address . control@debbugs.gnu.org)
87y39ghrk2.fsf@ambrevar.xyz
tags 33359 fixed
close 33359
?
Your comment

This issue is archived.

To comment on this conversation send an email to 33359@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 33359
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch