* Emacs C source
@ 2023-12-15 14:56 Kristoffer Ström
2023-12-17 11:27 ` Tomas Volf
2023-12-17 22:03 ` Ian Eure
0 siblings, 2 replies; 6+ messages in thread
From: Kristoffer Ström @ 2023-12-15 14:56 UTC (permalink / raw)
To: help-guix
Hello! I'm running emacs in a guix shell, and wonder how/where to get
the C source code directory for xref-find-definitions.
I've grepped the /gnu/store/*emacs but cannot find the C source, is
there some special package/output or procedure needed to get it included
in the shell environment?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs C source
2023-12-15 14:56 Emacs C source Kristoffer Ström
@ 2023-12-17 11:27 ` Tomas Volf
2023-12-17 13:18 ` Kristoffer Ström
2023-12-17 22:03 ` Ian Eure
1 sibling, 1 reply; 6+ messages in thread
From: Tomas Volf @ 2023-12-17 11:27 UTC (permalink / raw)
To: Kristoffer Ström; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
On 2023-12-15 15:56:34 +0100, Kristoffer Ström wrote:
>
> Hello! I'm running emacs in a guix shell, and wonder how/where to get
> the C source code directory for xref-find-definitions.
>
> I've grepped the /gnu/store/*emacs but cannot find the C source, is
> there some special package/output or procedure needed to get it included
> in the shell environment?
You can download source archives for any package using build --sources, like
this:
$ guix build --sources emacs
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
43.3 MB will be downloaded:
/gnu/store/c4xfnis0g5g2v1ssl3wqgk8h6s3xjfk6-emacs-29.1.tar.xz
substituting /gnu/store/c4xfnis0g5g2v1ssl3wqgk8h6s3xjfk6-emacs-29.1.tar.xz...
downloading from https://bordeaux.guix.gnu.org/nar/lzip/c4xfnis0g5g2v1ssl3wqgk8h6s3xjfk6-emacs-29.1.tar.xz ...
emacs-29.1.tar.xz 41.3MiB 16.6MiB/s 00:02 ▕██████████████████▏ 100.0%
/gnu/store/c4xfnis0g5g2v1ssl3wqgk8h6s3xjfk6-emacs-29.1.tar.xz
You can then extract the archive somewhere.
Hope this helps,
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs C source
2023-12-17 11:27 ` Tomas Volf
@ 2023-12-17 13:18 ` Kristoffer Ström
2023-12-19 15:35 ` Simon Tournier
0 siblings, 1 reply; 6+ messages in thread
From: Kristoffer Ström @ 2023-12-17 13:18 UTC (permalink / raw)
To: help-guix
> You can download source archives for any package using build --sources, like
> this:
That's nice to know! However i would greatly prefer if there was some
way to make it be available as part of a manifest, i'm building multiple
environments using guix shell containers, and doing this as an extra
step in each one is not very pleasant.
something along the lines of `guix shell -D emacs` but for sources
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs C source
2023-12-15 14:56 Emacs C source Kristoffer Ström
2023-12-17 11:27 ` Tomas Volf
@ 2023-12-17 22:03 ` Ian Eure
1 sibling, 0 replies; 6+ messages in thread
From: Ian Eure @ 2023-12-17 22:03 UTC (permalink / raw)
To: help-guix
Kristoffer Ström <kristoffer@rymdkoloni.se> writes:
> Hello! I'm running emacs in a guix shell, and wonder how/where
> to get
> the C source code directory for xref-find-definitions.
>
> I've grepped the /gnu/store/*emacs but cannot find the C source,
> is
> there some special package/output or procedure needed to get it
> included
> in the shell environment?
>
There is no C source for xref-find-definitions, it’s written in
Emacs Lisp:
xref-find-definitions is an interactive native-compiled Lisp
function
in ‘xref.el’.
The source is available in any environment the Emacs package is
installed.
— Ian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs C source
2023-12-17 13:18 ` Kristoffer Ström
@ 2023-12-19 15:35 ` Simon Tournier
2023-12-19 16:07 ` Kristoffer Ström
0 siblings, 1 reply; 6+ messages in thread
From: Simon Tournier @ 2023-12-19 15:35 UTC (permalink / raw)
To: Kristoffer Ström, help-guix
Hi,
On Sun, 17 Dec 2023 at 14:18, Kristoffer Ström <kristoffer@rymdkoloni.se> wrote:
> That's nice to know! However i would greatly prefer if there was some
> way to make it be available as part of a manifest,
Well, I am not aware of such out-of-box feature.
> i'm building multiple
> environments using guix shell containers, and doing this as an extra
> step in each one is not very pleasant.
Hum, I am missing context but I do not see what would be the workflow.
> something along the lines of `guix shell -D emacs` but for sources
Somehow Guix will manipulate read-only items in the store; thus the
source is not directly useful. Something like that ugly,
--8<---------------cut here---------------start------------->8---
(use-modules (guix scripts build))
(specifications->manifest
(map
(lambda (spec)
(begin
(guix-build "--source" spec)
spec))
(list
"emacs"
"coreutils"
)))
--8<---------------cut here---------------end--------------->8---
allows to fetch the corresponding source of each package. However, the
source (tarball) are not part of the ’manifest’ and thus not visible
inside the container.
It is possible to do it using some plumbing Guix procedures, I
guess. :-)
Aside, I initially wrote a Guix script (see below) for mainly demoing
and now, I am using more or more. :-) I think something in this area is
missing. I would like such workflow
guix <something> emacs custom/path/to/emacs
cd custom/path/to/emacs
guix shell -C -D emacs
… hack …
And the script just shows how to download the source of a package.
(Please note that “guix build --source” returns the source after the
applying snippets, and the tiny script manipulated the URL of source,
i.e., before the applications of snippets.)
Cheers,
simon
--8<---------------cut here---------------start------------->8---
$ cat examples/scripts/show-me-fetch.scm
#!/usr/bin/env -S guix repl -q --
;; -*- mode: scheme -*-
!#
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;;
;;; This script show URL of packages.
;;;
(use-modules
(ice-9 match)
((gnu packages) #:select (specification->package))
(guix packages)
((web uri) #:select (string->uri
uri->string))
((guix build download) #:select (maybe-expand-mirrors))
((guix download) #:select (%mirrors))
(guix git-download))
(let ((pkgs (match (command-line)
((prog-name pkgs ...)
(map specification->package pkgs))
(_
(begin
(format #t "Error. Try: ./show-me-url.scm hello")
(exit 1))))))
(for-each
(lambda (pkg)
(match (package-source pkg)
;; See 'origin->json' from file build-package-metadata.scm in repository
;; maintenance.git for an exhaustive case handling.
((? origin? o)
(match (origin-uri o)
((? string? s)
;; Pick only the first (car) of the potenial long list
(let ((url (car (map uri->string
(maybe-expand-mirrors (string->uri s) %mirrors)))))
(format #t "wget ~a~%" url)))
((? git-reference? g)
(let* ((url (git-reference-url g))
(revision (git-reference-commit g))
(tmpdir (string-append "/tmp/" (package-name pkg)))
(git (string-append "git -C " tmpdir)))
(format #t "mkdir -p ~a ~%" tmpdir)
(format #t "&& ~a init --initial-branch=main ~%" git)
(format #t "&& ~a remote add origin ~a ~%" git url)
(format #t "&& ~a fetch --depth 1 origin ~a ~%" git revision)
(format #t "&& ~a checkout FETCH_HEAD ~%" git)))
;; All the other cases
(_ #f)))))
pkgs)
(exit 0))
--8<---------------cut here---------------end--------------->8---
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs C source
2023-12-19 15:35 ` Simon Tournier
@ 2023-12-19 16:07 ` Kristoffer Ström
0 siblings, 0 replies; 6+ messages in thread
From: Kristoffer Ström @ 2023-12-19 16:07 UTC (permalink / raw)
To: Simon Tournier, help-guix
> --8<---------------cut here---------------start------------->8---
> (use-modules (guix scripts build))
>
> (specifications->manifest
> (map
> (lambda (spec)
> (begin
> (guix-build "--source" spec)
> spec))
> (list
> "emacs"
> "coreutils"
> )))
> --8<---------------cut here---------------end--------------->8---
>
> allows to fetch the corresponding source of each package. However, the
> source (tarball) are not part of the ’manifest’ and thus not visible
> inside the container.
This looks like a good start to get somehting automatic. Thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-20 12:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15 14:56 Emacs C source Kristoffer Ström
2023-12-17 11:27 ` Tomas Volf
2023-12-17 13:18 ` Kristoffer Ström
2023-12-19 15:35 ` Simon Tournier
2023-12-19 16:07 ` Kristoffer Ström
2023-12-17 22:03 ` Ian Eure
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.