* Erlang + Emacs profile @ 2020-06-23 22:49 Zelphir Kaltstahl 2020-06-24 20:29 ` Maxim Cournoyer 0 siblings, 1 reply; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-23 22:49 UTC (permalink / raw) To: help-guix Hello Guix users! What is your way of setting up a profile for Erlang development? There are some things I would like to have, some of which I already managed to get: * [X] Erlang installed through Guix package manager in a separate profile * [X] `erl` REPL available in that separate profile * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and searched for erlang there) * [_] org-mode babel erlang for literate programming in org-mode, using the Guix installed erlang executable – I found https://github.com/xfwduke/ob-erlang, which also seems to work, but I do not know how to point it to the Guix installed Erlang, so that it can actually run code. Currently it complains about not finding Erlang. Does anyone know how to point it to the Erlang executable? I created this issue: https://github.com/xfwduke/ob-erlang/issues/1 I did not see any separate OTP package on `guix search`. Is this already included in the `erlang` package or is this missing from Guix package repositories? Here is my current manifest.scm file for creating a profile (currently not much in there): ~~~~ (specifications->manifest '("erlang@21.3.8.13")) ~~~~ Note, that Emacs is not in here, because I have it in my global or base profile. I'd rather not have a separate Emacs for this project, but simply use the one installed already. I am also aware, that Guix has packages for Emacs packages, but so far I've always installed those inside Emacs using M-x list-pack. This probably means, that Guix is not aware of them being installed, but I had no problems with it so far. Regards, Zelphir ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-23 22:49 Erlang + Emacs profile Zelphir Kaltstahl @ 2020-06-24 20:29 ` Maxim Cournoyer 2020-06-25 19:25 ` Zelphir Kaltstahl ` (3 more replies) 0 siblings, 4 replies; 18+ messages in thread From: Maxim Cournoyer @ 2020-06-24 20:29 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix Hello Zelphir, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > Hello Guix users! > > What is your way of setting up a profile for Erlang development? > > There are some things I would like to have, some of which I already > managed to get: > > * [X] Erlang installed through Guix package manager in a separate profile > * [X] `erl` REPL available in that separate profile > * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and > searched for erlang there) > * [_] org-mode babel erlang for literate programming in org-mode, > using the Guix installed erlang executable – I found > https://github.com/xfwduke/ob-erlang, which also seems to work, but > I do not know how to point it to the Guix installed Erlang, so that > it can actually run code. Currently it complains about not finding > Erlang. Does anyone know how to point it to the Erlang executable? I > created this issue: https://github.com/xfwduke/ob-erlang/issues/1 It just looks up erl from your PATH, so the problem must be that you started Emacs from your user profile, which doesn't know about the separate Guix profile you created which contains Erlang. You'd have to start Emacs from an shell where your separate profile was sourced, or fiddle with M-x setenv to fix this. emacs-guix also has some guix-set-emacs-environment procedure that can be used to augment Emacs environment variables given a profile, but it seems broken at the moment. I just tried the following approach, where everything is managed by Guix in a separate profile: --8<---------------cut here---------------start------------->8--- ;; file: manifest.scm (specifications->manifest '("erlang" "emacs" "emacs-org" "emacs-erlang" "emacs-ob-erlang")) ;; freshly packaged for you ;-) --8<---------------cut here---------------end--------------->8--- Then spawn an environment with guix environment -m manifest.scm And then ran the following experiment: --8<---------------cut here---------------start------------->8--- # file: test.org Put this in your ~/.emacs or evaluate it ad-hoc before running the rest. #+begin_src elisp (require 'org-tempo) (require 'ob-erlang) (org-babel-do-load-languages 'org-babel-load-languages '((erlang . t))) #+end_src Example taken from: https://github.com/xfwduke/ob-erlang With your cursor on the code block, I ran M-x org-babel-execute-src-block #+BEGIN_SRC erlang :module tryerlang start() -> io:format("hello world"). #+END_SRC And it produced: #+RESULTS: : hello world --8<---------------cut here---------------end--------------->8--- Hope this helps! Maxim ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-24 20:29 ` Maxim Cournoyer @ 2020-06-25 19:25 ` Zelphir Kaltstahl 2020-06-28 4:41 ` Maxim Cournoyer 2020-06-29 8:50 ` zimoun 2020-06-29 20:26 ` Zelphir Kaltstahl ` (2 subsequent siblings) 3 siblings, 2 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-25 19:25 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hi Maxim! Thanks for your message! I'll try it out. It implies some things I'd rather not do though: * It requires keeping multiple Emacs on my system. How will they interact with the same ~/.emacs.d/.init.el? * This approach seems to install everything only temporary, reinstalling every single time. But I can use a profile, so that's fine. How did you package emacs-ob-erlang? (I did not yet package a single package for Guix, so I assume no prior knowledge.) Or is it a rather lengthy procedure to do so? I think this might be one of the next things I learn about Guix, which is very useful, because if a package is missing, one can add it oneself, without having to rely on others to add it. It's an OK-ish solution to simply modify my PATH to make ob-erlang find erl, however, I was hoping for a configuration value in ob-emacs itself, so that I can set everything inside that plugin. I usually install Emacs packages inside Emacs, instead of using Guix for it. I do this, because probably not all packages I want are available in Guix, but I have not checked this assumption at all. I think I'll be fine with adapting my PATH for now, just need to do it in a way, that will keep working when I update Guix packages. Thanks, Zelphir On 6/24/20 10:29 PM, Maxim Cournoyer wrote: > Hello Zelphir, > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > >> Hello Guix users! >> >> What is your way of setting up a profile for Erlang development? >> >> There are some things I would like to have, some of which I already >> managed to get: >> >> * [X] Erlang installed through Guix package manager in a separate profile >> * [X] `erl` REPL available in that separate profile >> * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and >> searched for erlang there) >> * [_] org-mode babel erlang for literate programming in org-mode, >> using the Guix installed erlang executable – I found >> https://github.com/xfwduke/ob-erlang, which also seems to work, but >> I do not know how to point it to the Guix installed Erlang, so that >> it can actually run code. Currently it complains about not finding >> Erlang. Does anyone know how to point it to the Erlang executable? I >> created this issue: https://github.com/xfwduke/ob-erlang/issues/1 > It just looks up erl from your PATH, so the problem must be that you > started Emacs from your user profile, which doesn't know about the > separate Guix profile you created which contains Erlang. > > You'd have to start Emacs from an shell where your separate profile was > sourced, or fiddle with M-x setenv to fix this. emacs-guix also has > some guix-set-emacs-environment procedure that can be used to augment > Emacs environment variables given a profile, but it seems broken at the > moment. > > I just tried the following approach, where everything is managed by Guix > in a separate profile: > > --8<---------------cut here---------------start------------->8--- > ;; file: manifest.scm > (specifications->manifest > '("erlang" > "emacs" > "emacs-org" > "emacs-erlang" > "emacs-ob-erlang")) ;; freshly packaged for you ;-) > --8<---------------cut here---------------end--------------->8--- > > Then spawn an environment with > > guix environment -m manifest.scm > > And then ran the following experiment: > > --8<---------------cut here---------------start------------->8--- > # file: test.org > > Put this in your ~/.emacs or evaluate it ad-hoc before running the > rest. > > #+begin_src elisp > (require 'org-tempo) > (require 'ob-erlang) > (org-babel-do-load-languages > 'org-babel-load-languages > '((erlang . t))) > #+end_src > > Example taken from: https://github.com/xfwduke/ob-erlang > With your cursor on the code block, I ran M-x org-babel-execute-src-block > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > And it produced: > #+RESULTS: > : hello world > --8<---------------cut here---------------end--------------->8--- > > Hope this helps! > > Maxim ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-25 19:25 ` Zelphir Kaltstahl @ 2020-06-28 4:41 ` Maxim Cournoyer 2020-06-29 8:50 ` zimoun 1 sibling, 0 replies; 18+ messages in thread From: Maxim Cournoyer @ 2020-06-28 4:41 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix Hello, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > Hi Maxim! > > Thanks for your message! I'll try it out. It implies some things I'd > rather not do though: > > * It requires keeping multiple Emacs on my system. How will they > interact with the same ~/.emacs.d/.init.el? Badly, unless you've carefully crafted .init.el to load modules only when they're present (it's doable, and some packages even aim to simplify this kind of thing). Otherwise you'd have to launch emacs with the -q switch to prevent reading your main ~/.emacs.el (or .init.el). > * This approach seems to install everything only temporary, reinstalling > every single time. But I can use a profile, so that's fine. Yes, you can change the 'guix environment -m' command for a 'guix package -m' one for a persistent result (or use the -r option of 'guix environment'). > How did you package emacs-ob-erlang? (I did not yet package a single > package for Guix, so I assume no prior knowledge.) 'guix edit emacs-ob-erlang' should bring you right to the definition of the package. > Or is it a rather > lengthy procedure to do so? No, it probably took me less than 15 minutes total; it was a small and straightforward package. The emacs-build-system is remarkably simple. > I learn about Guix, which is very useful, because if a package is > missing, one can add it oneself, without having to rely on others to add it. Yes, that's one of my favorite things about Guix. It's hackable. > It's an OK-ish solution to simply modify my PATH to make ob-erlang find > erl, however, I was hoping for a configuration value in ob-emacs itself, > so that I can set everything inside that plugin. Such as configuration would need to be possible in ob-erlang, but it's not [0]. You could define a bunch of defvars and contribute a patch upstream, if you are so inclined. > I usually install Emacs packages inside Emacs, instead of using Guix for > it. I do this, because probably not all packages I want are available in > Guix, but I have not checked this assumption at all. The collection is growing, and as mentioned earlier, it's rather easy to add new items to it :-). Managing everything the same way makes for a better experience in my opinion (isn't that what Guix is about? :-)). > I think I'll be fine with adapting my PATH for now, just need to do it > in a way, that will keep working when I update Guix packages. Note that you could also choose to install erlang in your main profile along Emacs and emacs-ob-erlang; that'd remove the need to mess with PATH. Maxim ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-25 19:25 ` Zelphir Kaltstahl 2020-06-28 4:41 ` Maxim Cournoyer @ 2020-06-29 8:50 ` zimoun 2020-06-29 19:37 ` Zelphir Kaltstahl 1 sibling, 1 reply; 18+ messages in thread From: zimoun @ 2020-06-29 8:50 UTC (permalink / raw) To: Zelphir Kaltstahl, Maxim Cournoyer; +Cc: help-guix Dear, On Thu, 25 Jun 2020 at 21:25, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: > * It requires keeping multiple Emacs on my system. How will they > interact with the same ~/.emacs.d/.init.el? Emacs reads init.el when it starts so yes all Emacs will interact with this file if you do not specify explicitly to not do it. Well, if you use 'with-eval-after-load' in your Emacs configuration files, it should not be a problem. Otherwise give a look at "emacs-guix" or try "emacs -q -l /path/to/your/specific/config.el", as Maxim pointed. > How did you package emacs-ob-erlang? (I did not yet package a single > package for Guix, so I assume no prior knowledge.) Or is it a rather > lengthy procedure to do so? I think this might be one of the next things > I learn about Guix, which is very useful, because if a package is > missing, one can add it oneself, without having to rely on others to add it. For this specific package, I do not know because I have not checked but the first step when a package is not in Guix is: try the importer! :-) guix import elpa -a melpa -r foo where foo is the name of package in MELPA. This works very well. > I usually install Emacs packages inside Emacs, instead of using Guix for > it. I do this, because probably not all packages I want are available in > Guix, but I have not checked this assumption at all. I did that (installing with 'use-package') too but then I switched all to manifest.scm file and 'with-eval-after-load' tracking channels.scm (guix describe -f channels). This way, I have a working setup everywhere and everytime. Anyway! :-) The point is that Guix has a really large collection of Emacs packages: --8<---------------cut here---------------start------------->8--- $ du -sh gnu/packages/*.scm | sort -nr | head -n5 908K gnu/packages/crates-io.scm 884K gnu/packages/emacs-xyz.scm 784K gnu/packages/cran.scm 732K gnu/packages/python-xyz.scm 636K gnu/packages/bioinformatics.scm --8<---------------cut here---------------end--------------->8--- and if your needs is not there then "guix import elpa" eases the task for adding it. :-) All the best, simon ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 8:50 ` zimoun @ 2020-06-29 19:37 ` Zelphir Kaltstahl 2020-06-29 20:24 ` Ricardo Wurmus 2020-06-29 20:49 ` zimoun 0 siblings, 2 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-29 19:37 UTC (permalink / raw) To: zimoun, Maxim Cournoyer; +Cc: help-guix Hi Simon and Maxim! I am not sure I understand all things you wrote. On 29.06.20 10:50, zimoun wrote: > Dear, > > On Thu, 25 Jun 2020 at 21:25, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: > >> * It requires keeping multiple Emacs on my system. How will they >> interact with the same ~/.emacs.d/.init.el? > Emacs reads init.el when it starts so yes all Emacs will interact with > this file if you do not specify explicitly to not do it. Well, if you > use 'with-eval-after-load' in your Emacs configuration files, it should > not be a problem. Otherwise give a look at "emacs-guix" or try "emacs -q > -l /path/to/your/specific/config.el", as Maxim pointed. OK, so basically the way would then be to have 2 Emacs, but always start one of them with with the `-l <path>` argument, so that it makes use of another config file. >> How did you package emacs-ob-erlang? (I did not yet package a single >> package for Guix, so I assume no prior knowledge.) Or is it a rather >> lengthy procedure to do so? I think this might be one of the next things >> I learn about Guix, which is very useful, because if a package is >> missing, one can add it oneself, without having to rely on others to add it. > For this specific package, I do not know because I have not checked but > the first step when a package is not in Guix is: try the importer! :-) > > guix import elpa -a melpa -r foo > > where foo is the name of package in MELPA. This works very well. OK nice! I'll try it for a package! I noticed, that there are only 3 Emacs Org-Babel packages available (or visible) at: https://guix.gnu.org/packages/E/page/9/. I'l try with some of those I need. And I see at https://guix.gnu.org/manual/en/html_node/Invoking-guix-import.html#Invoking-guix-import, that there are already some repositories understood, which I would probably use. Also the edit thing `guix edit emacs-ob-erlang` sounds interesting. I just did the edit thing and I am not sure how to then "upload" a package. But I will read the docs a little and will probably all clear up. >> I usually install Emacs packages inside Emacs, instead of using Guix for >> it. I do this, because probably not all packages I want are available in >> Guix, but I have not checked this assumption at all. > I did that (installing with 'use-package') too but then I switched all > to manifest.scm file and 'with-eval-after-load' tracking channels.scm > (guix describe -f channels). This way, I have a working setup > everywhere and everytime. Anyway! :-) > > The point is that Guix has a really large collection of Emacs packages: > > --8<---------------cut here---------------start------------->8--- > $ du -sh gnu/packages/*.scm | sort -nr | head -n5 > 908K gnu/packages/crates-io.scm > 884K gnu/packages/emacs-xyz.scm > 784K gnu/packages/cran.scm > 732K gnu/packages/python-xyz.scm > 636K gnu/packages/bioinformatics.scm > --8<---------------cut here---------------end--------------->8--- > > and if your needs is not there then "guix import elpa" eases the task > for adding it. :-) So if I understand this correctly, there are different channels for different types of packages, for example for Rust packages we have `gnu/packages/crates-io.scm` and for Emacs packages we have `gnu/packages/emacs-xyz.scm`. The command `guix describe -f channels` does not work for me: ~~~~ xiaolong@xlx200:~$ guix describe -f channels guix describe: error: failed to determine origin hint: Perhaps this `guix' command was not obtained with `guix pull'? Its version string is 36da62f1b9c78a2729658143a7df1845cd532afa. ~~~~ I did another `guix pull` and `guix package -u` and this is after a fresh Guix package manager install and and installing the following packages: ~~~~ xiaolong@xlx200:~$ sudo -i guix package -I glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 xiaolong@xlx200:~$ sudo -i guix package -I glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 xiaolong@xlx200:~$ guix package -I guile 3.0.4 out /gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4 erlang 21.3.8.13 out /gnu/store/6x8ycgi8hv5rh8gq3vrdbcq5sh3qfq7i-erlang-21.3.8.13 emacs-ob-erlang 20180827-1.f1a8c66 out /gnu/store/czg6wqga0hvc57axbz1cjp892k5r8ybp-emacs-ob-erlang-20180827-1.f1a8c66 icecat 68.9.0-guix0-preview1 out /gnu/store/7qakza7zdiz57l5hldd8162324fwbw8s-icecat-68.9.0-guix0-preview1 libreoffice 6.4.4.2 out /gnu/store/swk410ahw9v4k0hjmsd4f33bqw5fdyqa-libreoffice-6.4.4.2 lyx 2.3.5.1 out /gnu/store/p7z5436jhgjlgdbx44np44vzjhrwi2ns-lyx-2.3.5.1 python 3.8.2 out /gnu/store/6sr11m4i1d3vbqlmbpzmfj1lihbc5iz4-python-3.8.2 rust 1.39.0 out /gnu/store/24pbvvdwaj9kbsdfi6kgxkvxkjayfz74-rust-1.39.0 openvpn 2.4.9 out /gnu/store/3rh4i3wbkdwkrmrxy30d3f3nbg6kdl02-openvpn-2.4.9 emacs 26.3 out /gnu/store/528p0v6gg5gx53jd0x52dmghb01bfhc5-emacs-26.3 glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 guile-colorized 0.1 out /gnu/store/5h0jfssgyx49cq82wrmw57an7ngb7kkz-guile-colorized-0.1 ~~~~ The other command to show the count of packages also does not work for me: ~~~~ xiaolong@xlx200:/$ sudo du -sh gnu/packages/*.scm | sort -nr | head -n5 du: cannot access 'gnu/packages/*.scm': No such file or directory ~~~~ Do I need to create channels, like a custom way of structuring packages for myself, before running these commands? > All the best, > simon Thanks for all your help! Best regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 19:37 ` Zelphir Kaltstahl @ 2020-06-29 20:24 ` Ricardo Wurmus 2020-06-29 20:37 ` Zelphir Kaltstahl 2020-06-29 20:49 ` zimoun 1 sibling, 1 reply; 18+ messages in thread From: Ricardo Wurmus @ 2020-06-29 20:24 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > I just did the edit thing and I am not sure how to then "upload" a > package. But I will read the docs a little and will probably all clear up. “guix edit” only opens the source file containing a package definition in your editor. To contribute packages please see the Contributing section in the manual. >> The point is that Guix has a really large collection of Emacs packages: >> >> --8<---------------cut here---------------start------------->8--- >> $ du -sh gnu/packages/*.scm | sort -nr | head -n5 >> 908K gnu/packages/crates-io.scm >> 884K gnu/packages/emacs-xyz.scm >> 784K gnu/packages/cran.scm >> 732K gnu/packages/python-xyz.scm >> 636K gnu/packages/bioinformatics.scm >> --8<---------------cut here---------------end--------------->8--- >> >> and if your needs is not there then "guix import elpa" eases the task >> for adding it. :-) > > So if I understand this correctly, there are different channels for > different types of packages, for example for Rust packages we have > `gnu/packages/crates-io.scm` and for Emacs packages we have > `gnu/packages/emacs-xyz.scm`. No, these are not channels. These are all modules that are part of the default channel called “guix”. > The command `guix describe -f channels` does not work for me: > > ~~~~ > xiaolong@xlx200:~$ guix describe -f channels > guix describe: error: failed to determine origin > hint: Perhaps this `guix' command was not obtained with `guix pull'? Its version string is > 36da62f1b9c78a2729658143a7df1845cd532afa. > ~~~~ “guix describe” will work when you use a “guix” that was obtained with “guix pull”. It will usually be in ~/.config/guix/current/bin/guix. > I did another `guix pull` and `guix package -u` and this is after a > fresh Guix package manager install and and installing the following > packages: > > ~~~~ > xiaolong@xlx200:~$ sudo -i guix package -I > glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 > > xiaolong@xlx200:~$ sudo -i guix package -I > glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 > xiaolong@xlx200:~$ guix package -I > guile 3.0.4 out /gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4 > erlang 21.3.8.13 out /gnu/store/6x8ycgi8hv5rh8gq3vrdbcq5sh3qfq7i-erlang-21.3.8.13 > emacs-ob-erlang 20180827-1.f1a8c66 out /gnu/store/czg6wqga0hvc57axbz1cjp892k5r8ybp-emacs-ob-erlang-20180827-1.f1a8c66 > icecat 68.9.0-guix0-preview1 out /gnu/store/7qakza7zdiz57l5hldd8162324fwbw8s-icecat-68.9.0-guix0-preview1 > libreoffice 6.4.4.2 out /gnu/store/swk410ahw9v4k0hjmsd4f33bqw5fdyqa-libreoffice-6.4.4.2 > lyx 2.3.5.1 out /gnu/store/p7z5436jhgjlgdbx44np44vzjhrwi2ns-lyx-2.3.5.1 > python 3.8.2 out /gnu/store/6sr11m4i1d3vbqlmbpzmfj1lihbc5iz4-python-3.8.2 > rust 1.39.0 out /gnu/store/24pbvvdwaj9kbsdfi6kgxkvxkjayfz74-rust-1.39.0 > openvpn 2.4.9 out /gnu/store/3rh4i3wbkdwkrmrxy30d3f3nbg6kdl02-openvpn-2.4.9 > emacs 26.3 out /gnu/store/528p0v6gg5gx53jd0x52dmghb01bfhc5-emacs-26.3 > glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 > guile-colorized 0.1 out /gnu/store/5h0jfssgyx49cq82wrmw57an7ngb7kkz-guile-colorized-0.1 > ~~~~ I don’t know what this is supposed to demonstrate. “sudo -i guix” runs Guix as the root user, which has a different default profile. > The other command to show the count of packages also does not work for me: > > ~~~~ > xiaolong@xlx200:/$ sudo du -sh gnu/packages/*.scm | sort -nr | head -n5 > du: cannot access 'gnu/packages/*.scm': No such file or directory > ~~~~ That’s not a general command to count packages. This was just simon’s way of showing you that the file containing package definitions for Emacs packages in the Guix repository is among the largest modules. To show all available packages use “guix package --list-available”. > Do I need to create channels, like a custom way of structuring packages > for myself, before running these commands? No. The command line that simon showed you is a simple combination of coreutils commands that operate on the Guix source code. If you want to run the same command you need to do this in the directory containing a checkout of the Guix source code. -- Ricardo ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 20:24 ` Ricardo Wurmus @ 2020-06-29 20:37 ` Zelphir Kaltstahl 0 siblings, 0 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-29 20:37 UTC (permalink / raw) To: Ricardo Wurmus; +Cc: help-guix Hi Ricardo! On 29.06.20 22:24, Ricardo Wurmus wrote: > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > >> I just did the edit thing and I am not sure how to then "upload" a >> package. But I will read the docs a little and will probably all clear up. > “guix edit” only opens the source file containing a package definition > in your editor. > > To contribute packages please see the Contributing section in the manual. > >>> The point is that Guix has a really large collection of Emacs packages: >>> >>> --8<---------------cut here---------------start------------->8--- >>> $ du -sh gnu/packages/*.scm | sort -nr | head -n5 >>> 908K gnu/packages/crates-io.scm >>> 884K gnu/packages/emacs-xyz.scm >>> 784K gnu/packages/cran.scm >>> 732K gnu/packages/python-xyz.scm >>> 636K gnu/packages/bioinformatics.scm >>> --8<---------------cut here---------------end--------------->8--- >>> >>> and if your needs is not there then "guix import elpa" eases the task >>> for adding it. :-) >> So if I understand this correctly, there are different channels for >> different types of packages, for example for Rust packages we have >> `gnu/packages/crates-io.scm` and for Emacs packages we have >> `gnu/packages/emacs-xyz.scm`. > No, these are not channels. These are all modules that are part of the > default channel called “guix”. > >> The command `guix describe -f channels` does not work for me: >> >> ~~~~ >> xiaolong@xlx200:~$ guix describe -f channels >> guix describe: error: failed to determine origin >> hint: Perhaps this `guix' command was not obtained with `guix pull'? Its version string is >> 36da62f1b9c78a2729658143a7df1845cd532afa. >> ~~~~ > “guix describe” will work when you use a “guix” that was obtained with > “guix pull”. It will usually be in ~/.config/guix/current/bin/guix. > >> I did another `guix pull` and `guix package -u` and this is after a >> fresh Guix package manager install and and installing the following >> packages: >> >> ~~~~ >> xiaolong@xlx200:~$ sudo -i guix package -I >> glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 >> >> xiaolong@xlx200:~$ sudo -i guix package -I >> glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 >> xiaolong@xlx200:~$ guix package -I >> guile 3.0.4 out /gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4 >> erlang 21.3.8.13 out /gnu/store/6x8ycgi8hv5rh8gq3vrdbcq5sh3qfq7i-erlang-21.3.8.13 >> emacs-ob-erlang 20180827-1.f1a8c66 out /gnu/store/czg6wqga0hvc57axbz1cjp892k5r8ybp-emacs-ob-erlang-20180827-1.f1a8c66 >> icecat 68.9.0-guix0-preview1 out /gnu/store/7qakza7zdiz57l5hldd8162324fwbw8s-icecat-68.9.0-guix0-preview1 >> libreoffice 6.4.4.2 out /gnu/store/swk410ahw9v4k0hjmsd4f33bqw5fdyqa-libreoffice-6.4.4.2 >> lyx 2.3.5.1 out /gnu/store/p7z5436jhgjlgdbx44np44vzjhrwi2ns-lyx-2.3.5.1 >> python 3.8.2 out /gnu/store/6sr11m4i1d3vbqlmbpzmfj1lihbc5iz4-python-3.8.2 >> rust 1.39.0 out /gnu/store/24pbvvdwaj9kbsdfi6kgxkvxkjayfz74-rust-1.39.0 >> openvpn 2.4.9 out /gnu/store/3rh4i3wbkdwkrmrxy30d3f3nbg6kdl02-openvpn-2.4.9 >> emacs 26.3 out /gnu/store/528p0v6gg5gx53jd0x52dmghb01bfhc5-emacs-26.3 >> glibc-utf8-locales 2.31 out /gnu/store/z7a6sbvqzb5zapwpznmjkq2rsxil6i67-glibc-utf8-locales-2.31 >> guile-colorized 0.1 out /gnu/store/5h0jfssgyx49cq82wrmw57an7ngb7kkz-guile-colorized-0.1 >> ~~~~ > I don’t know what this is supposed to demonstrate. “sudo -i guix” runs > Guix as the root user, which has a different default profile. I made a typo when pasting the output from terminal. There are two package -I outputs I posted, if you check. The one with fewer packages is the root profile, of which you can see the command I used. The one with more packages is not the root profile, but the `guix package -I`. Perhaps I could have split it into two parts to make it more clear. This is supposed to show, that I already installed some software, instead of starting completely from a clean install, in case, that the error I got could be caused by anything I installed already. I don't know how it works internally, so perhaps it would be of use to someone knowing more than me about Guix package manager. Better to put all the info out there, than making others ask for it, because it's missing. That was the idea I had behind that. >> The other command to show the count of packages also does not work for me: >> >> ~~~~ >> xiaolong@xlx200:/$ sudo du -sh gnu/packages/*.scm | sort -nr | head -n5 >> du: cannot access 'gnu/packages/*.scm': No such file or directory >> ~~~~ > That’s not a general command to count packages. This was just simon’s > way of showing you that the file containing package definitions for > Emacs packages in the Guix repository is among the largest modules. > > To show all available packages use “guix package --list-available”. > >> Do I need to create channels, like a custom way of structuring packages >> for myself, before running these commands? > No. The command line that simon showed you is a simple combination of > coreutils commands that operate on the Guix source code. If you want to > run the same command you need to do this in the directory containing a > checkout of the Guix source code. OK I see, thanks! Regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 19:37 ` Zelphir Kaltstahl 2020-06-29 20:24 ` Ricardo Wurmus @ 2020-06-29 20:49 ` zimoun 2020-06-29 21:12 ` Zelphir Kaltstahl 1 sibling, 1 reply; 18+ messages in thread From: zimoun @ 2020-06-29 20:49 UTC (permalink / raw) To: Zelphir Kaltstahl, Maxim Cournoyer; +Cc: help-guix Dear, On Mon, 29 Jun 2020 at 21:37, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: >> On Thu, 25 Jun 2020 at 21:25, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: >> >>> * It requires keeping multiple Emacs on my system. How will they >>> interact with the same ~/.emacs.d/.init.el? >> Emacs reads init.el when it starts so yes all Emacs will interact with >> this file if you do not specify explicitly to not do it. Well, if you >> use 'with-eval-after-load' in your Emacs configuration files, it should >> not be a problem. Otherwise give a look at "emacs-guix" or try "emacs -q >> -l /path/to/your/specific/config.el", as Maxim pointed. > > OK, so basically the way would then be to have 2 Emacs, but always start > one of them with with the `-l <path>` argument, so that it makes use of > another config file. I am not sure to understand what you want. Could you describe what is your desired workflow to hack Erlang? > OK nice! I'll try it for a package! I noticed, that there are only 3 > Emacs Org-Babel packages available (or visible) > at: https://guix.gnu.org/packages/E/page/9/. I'l try with some of > those First, in case you do not know this web interface for searching packages: https://hpc.guix.info/browse Second, I am not following closely Org Babel extensions but what languages appear to you missing? > Also the edit thing `guix edit emacs-ob-erlang` sounds interesting. It depends if you use Guix System or Guix as package manager solely. For the latter, the 'edit' is read-only. > I just did the edit thing and I am not sure how to then "upload" a > package. But I will read the docs a little and will probably all clear > up. What do you mean by "upload"? If you mean contribute, you might be interested by this section of the manual: https://guix.gnu.org/manual/devel/en/guix.html#Contributing > So if I understand this correctly, there are different channels for > different types of packages, for example for Rust packages we have > `gnu/packages/crates-io.scm` and for Emacs packages we have > `gnu/packages/emacs-xyz.scm`. Channel is not the right term, in Guix parlance. To be clear, channel means a collection of packages living in files. The previous different types of packages are all in the same channel, i.e., the default channel. https://guix.gnu.org/manual/devel/en/guix.html#Channels For channels examples, you can give a look at: https://gitlab.inria.fr/guix-hpc/guix-hpc ahttps://gitlab.inria.fr/guix-hpc/guix-past > > The command `guix describe -f channels` does not work for me: > > ~~~~ > xiaolong@xlx200:~$ guix describe -f channels > guix describe: error: failed to determine origin > hint: Perhaps this `guix' command was not obtained with `guix pull'? Its version string is > 36da62f1b9c78a2729658143a7df1845cd532afa. > ~~~~ How did you install Guix? Have you run "guix pull" before trying "guix describe"? > I did another `guix pull` and `guix package -u` and this is after a > fresh Guix package manager install and and installing the following > packages: > > ~~~~ > xiaolong@xlx200:~$ sudo -i guix package -I Note that once you have configured your system (if you use Guix System), you can run "guix pull" as a regular user and install package as regular user, independently of what your system-wide is. > The other command to show the count of packages also does not work for me: > > ~~~~ > xiaolong@xlx200:/$ sudo du -sh gnu/packages/*.scm | sort -nr | head -n5 > du: cannot access 'gnu/packages/*.scm': No such file or directory > ~~~~ You need to be in the Guix repo, i.e., you need to git clone https://git.savannah.gnu.org/git/guix.git and the subfolder gnu/packages/ contains all the packages stored by thematic. > Do I need to create channels, like a custom way of structuring packages > for myself, before running these commands? To test and install your own packages, you have 3 choices: 1. ./pre-inst-env 2. local channel 3. --load-path The point #1 means you use the Contribution section, build Guix from source, then add your package to the file gnu/packages/emacs-xyz.scm (of the Git clone) and then run (from the Git cloned repo): ./pre-inst-env guix install emacs-foo The point #2 means you use a local Git repo containing your definitions of packages. You have the channels.scm file: --8<---------------cut here---------------start------------->8--- (cons* (channel (name 'my-stuff) (url "file:////path/to/my/stuff.git") (branch "master")) %default-channels) --8<---------------cut here---------------end--------------->8--- then "guix pull -C path/to/channels.scm" and you should be able to install your package emacs-foo with "guix install emacs-foo". Note that the Git repo can be also https:// or other protocols. The point #3 mean you use a local folder containing your definitions as for point #2. Then you simply run: guix install -L path/to/your/folder/containing/stuff emacs-foo Hope that helps, simon ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 20:49 ` zimoun @ 2020-06-29 21:12 ` Zelphir Kaltstahl 2020-06-29 22:08 ` zimoun 0 siblings, 1 reply; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-29 21:12 UTC (permalink / raw) To: zimoun; +Cc: help-guix Hi Simon! On 29.06.20 22:49, zimoun wrote: > Dear, > > On Mon, 29 Jun 2020 at 21:37, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: >>> On Thu, 25 Jun 2020 at 21:25, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: >>> >>>> * It requires keeping multiple Emacs on my system. How will they >>>> interact with the same ~/.emacs.d/.init.el? >>> Emacs reads init.el when it starts so yes all Emacs will interact with >>> this file if you do not specify explicitly to not do it. Well, if you >>> use 'with-eval-after-load' in your Emacs configuration files, it should >>> not be a problem. Otherwise give a look at "emacs-guix" or try "emacs -q >>> -l /path/to/your/specific/config.el", as Maxim pointed. >> OK, so basically the way would then be to have 2 Emacs, but always start >> one of them with with the `-l <path>` argument, so that it makes use of >> another config file. > I am not sure to understand what you want. Could you describe what is > your desired workflow to hack Erlang? I'm only trying to understand how it would work with 2 Emacs, one in the main profile and one in another profile, which can be created from manifest. What I would like to achieve is, that I can do some literate programming in org-mode, while following along an online course about Erlang. In the past I had some pretty good experience with that approach to understanding some code and making sure I also write down what I understand, so that later on, I can go back and read again. I am not asking, whether this is a good or typical approach to any Erlang development. >> OK nice! I'll try it for a package! I noticed, that there are only 3 >> Emacs Org-Babel packages available (or visible) >> at: https://guix.gnu.org/packages/E/page/9/. I'l try with some of >> those > First, in case you do not know this web interface for searching > packages: > > https://hpc.guix.info/browse Indeed I did not know that one yet and always clicked through the pages, estimating, how many pages ahead I would need to go, to approximately find a package. :D > Second, I am not following closely Org Babel extensions but what > languages appear to you missing? I was thinking, that `ob-python` was missing, because I only found `emacs-ob-ipython`, but apparently `ob-python` does not exist and is instead built in? Because it works without me installing any `ob-python` Emacs package. Same seems to be true for `ob-scheme`. Only needed to install `geiser` I think. For now it seems nothing is missing. >> Also the edit thing `guix edit emacs-ob-erlang` sounds interesting. > It depends if you use Guix System or Guix as package manager solely. > For the latter, the 'edit' is read-only. > >> I just did the edit thing and I am not sure how to then "upload" a >> package. But I will read the docs a little and will probably all clear >> up. > What do you mean by "upload"? > If you mean contribute, you might be interested by this section of the > manual: > > https://guix.gnu.org/manual/devel/en/guix.html#Contributing > > > >> So if I understand this correctly, there are different channels for >> different types of packages, for example for Rust packages we have >> `gnu/packages/crates-io.scm` and for Emacs packages we have >> `gnu/packages/emacs-xyz.scm`. > Channel is not the right term, in Guix parlance. To be clear, channel > means a collection of packages living in files. The previous different > types of packages are all in the same channel, i.e., the default > channel. > > https://guix.gnu.org/manual/devel/en/guix.html#Channels > > For channels examples, you can give a look at: > > https://gitlab.inria.fr/guix-hpc/guix-hpc > ahttps://gitlab.inria.fr/guix-hpc/guix-past > > >> The command `guix describe -f channels` does not work for me: >> >> ~~~~ >> xiaolong@xlx200:~$ guix describe -f channels >> guix describe: error: failed to determine origin >> hint: Perhaps this `guix' command was not obtained with `guix pull'? Its version string is >> 36da62f1b9c78a2729658143a7df1845cd532afa. >> ~~~~ > How did you install Guix? Have you run "guix pull" before trying "guix > describe"? I installed it on Trisquel 8 using the recommended install script. I did `guix pull` just like the error hinted, but still got the error. Now, a few terminals closed and opened later, it seems to work and give some output. ~~~~ (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "6ebf300959a58fd1eda875205c75d21137862285"))) ~~~~ I think that is the normal intended output. >> I did another `guix pull` and `guix package -u` and this is after a >> fresh Guix package manager install and and installing the following >> packages: >> >> ~~~~ >> xiaolong@xlx200:~$ sudo -i guix package -I > Note that once you have configured your system (if you use Guix System), > you can run "guix pull" as a regular user and install package as regular > user, independently of what your system-wide is. Yep, sorry for that copy&paste error in my e-mail! The longer output was actually the output of the non-root profile already. >> The other command to show the count of packages also does not work for me: >> >> ~~~~ >> xiaolong@xlx200:/$ sudo du -sh gnu/packages/*.scm | sort -nr | head -n5 >> du: cannot access 'gnu/packages/*.scm': No such file or directory >> ~~~~ > You need to be in the Guix repo, i.e., you need to git clone > https://git.savannah.gnu.org/git/guix.git and the subfolder > gnu/packages/ contains all the packages stored by thematic. > > >> Do I need to create channels, like a custom way of structuring packages >> for myself, before running these commands? > To test and install your own packages, you have 3 choices: > > 1. ./pre-inst-env > 2. local channel > 3. --load-path > > The point #1 means you use the Contribution section, build Guix from > source, then add your package to the file gnu/packages/emacs-xyz.scm (of > the Git clone) and then run (from the Git cloned repo): > > ./pre-inst-env guix install emacs-foo > > The point #2 means you use a local Git repo containing your definitions > of packages. You have the channels.scm file: > > --8<---------------cut here---------------start------------->8--- > (cons* > (channel > (name 'my-stuff) > (url "file:////path/to/my/stuff.git") > (branch "master")) > %default-channels) > --8<---------------cut here---------------end--------------->8--- > > then "guix pull -C path/to/channels.scm" and you should be able to > install your package emacs-foo with "guix install emacs-foo". Note that > the Git repo can be also https:// or other protocols. > > The point #3 mean you use a local folder containing your definitions as > for point #2. Then you simply run: > > guix install -L path/to/your/folder/containing/stuff emacs-foo > > > Hope that helps, > simon Thanks Simon, it helps! I will need to read more about various terms in the Guix universe in its docs. I've not read that much yet and that is, why some terms and concepts are unclear to me. Regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-29 21:12 ` Zelphir Kaltstahl @ 2020-06-29 22:08 ` zimoun 0 siblings, 0 replies; 18+ messages in thread From: zimoun @ 2020-06-29 22:08 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix On Mon, 29 Jun 2020 at 23:12, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote: > I'm only trying to understand how it would work with 2 Emacs, one in the > main profile and one in another profile, which can be created from > manifest. What I would like to achieve is, that I can do some literate > programming in org-mode, while following along an online course about > Erlang. In the past I had some pretty good experience with that approach > to understanding some code and making sure I also write down what I > understand, so that later on, I can go back and read again. I am not > asking, whether this is a good or typical approach to any Erlang > development. Having 2 Emacs instances, one in your default profile and one in your Erlang dev profile does not mean you need complicated init.el file. As I wrote you earlier, you can use 'with-eval-after-load' and everything will be fine, even using only one ~/.emacs.d. > Thanks Simon, it helps! Welcome! Feel free to ask. :-) All the best, simon ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-24 20:29 ` Maxim Cournoyer 2020-06-25 19:25 ` Zelphir Kaltstahl @ 2020-06-29 20:26 ` Zelphir Kaltstahl 2020-06-30 18:34 ` Zelphir Kaltstahl 2020-06-30 18:41 ` Zelphir Kaltstahl 3 siblings, 0 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-29 20:26 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hi Maxim! Although I installed emacs-ob-erlang in my main profile, where Emacs is installed, I get an error, when I try to evaluate Erlang code in Org-mode. A new buffer *Org-Babel Error Output* opens and displays: ~~~~ bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell ~~~~ When I open an `eshell` and do `which`: ~~~~ Welcome to the Emacs shell $ which erl /home/xiaolong/.guix-profile/bin/erl $ which erlc /home/xiaolong/.guix-profile/bin/erlc $ ~~~~ So it can definitely find Erlang. I am not sure what the problem is. I did not exactly follow the approach of using a manifest and instead installed everything in the main profile, but to my understanding, that should also work the same way, as long as it is all in the same profile. The whole file I have for trying it: ~~~~ #+BEGIN_SRC python :results output print(1+1) #+END_SRC #+RESULTS: : 2 #+BEGIN_SRC scheme (define abc (lambda (a) a)) (abc 123) #+END_SRC #+RESULTS: : 123 #+begin_src elisp ;; (require 'org-tempo) (require 'ob-erlang) (org-babel-do-load-languages 'org-babel-load-languages '((erlang . t))) #+end_src #+RESULTS: #+BEGIN_SRC erlang :module tryerlang start() -> io:format("hello world"). #+END_SRC #+RESULTS: ~~~~ So Python works, Scheme (Guile in this case) works, and Elisp simply had no output but worked and was run before the Erlang one. Only Erlang did not work. Do you know what causes this error? I've seen it with other org-babel source blocks, but usually accompanied by some more error telling me, what is wrong. For example, when there is no Python at the specified executable path of Python in Emacs settings / config, it would tell me that there is no such file or directory or something like that. Best regards, Zelphir On 24.06.20 22:29, Maxim Cournoyer wrote: > Hello Zelphir, > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > >> Hello Guix users! >> >> What is your way of setting up a profile for Erlang development? >> >> There are some things I would like to have, some of which I already >> managed to get: >> >> * [X] Erlang installed through Guix package manager in a separate profile >> * [X] `erl` REPL available in that separate profile >> * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and >> searched for erlang there) >> * [_] org-mode babel erlang for literate programming in org-mode, >> using the Guix installed erlang executable – I found >> https://github.com/xfwduke/ob-erlang, which also seems to work, but >> I do not know how to point it to the Guix installed Erlang, so that >> it can actually run code. Currently it complains about not finding >> Erlang. Does anyone know how to point it to the Erlang executable? I >> created this issue: https://github.com/xfwduke/ob-erlang/issues/1 > It just looks up erl from your PATH, so the problem must be that you > started Emacs from your user profile, which doesn't know about the > separate Guix profile you created which contains Erlang. > > You'd have to start Emacs from an shell where your separate profile was > sourced, or fiddle with M-x setenv to fix this. emacs-guix also has > some guix-set-emacs-environment procedure that can be used to augment > Emacs environment variables given a profile, but it seems broken at the > moment. > > I just tried the following approach, where everything is managed by Guix > in a separate profile: > > --8<---------------cut here---------------start------------->8--- > ;; file: manifest.scm > (specifications->manifest > '("erlang" > "emacs" > "emacs-org" > "emacs-erlang" > "emacs-ob-erlang")) ;; freshly packaged for you ;-) > --8<---------------cut here---------------end--------------->8--- > > Then spawn an environment with > > guix environment -m manifest.scm > > And then ran the following experiment: > > --8<---------------cut here---------------start------------->8--- > # file: test.org > > Put this in your ~/.emacs or evaluate it ad-hoc before running the > rest. > > #+begin_src elisp > (require 'org-tempo) > (require 'ob-erlang) > (org-babel-do-load-languages > 'org-babel-load-languages > '((erlang . t))) > #+end_src > > Example taken from: https://github.com/xfwduke/ob-erlang > With your cursor on the code block, I ran M-x org-babel-execute-src-block > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > And it produced: > #+RESULTS: > : hello world > --8<---------------cut here---------------end--------------->8--- > > Hope this helps! > > Maxim -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-24 20:29 ` Maxim Cournoyer 2020-06-25 19:25 ` Zelphir Kaltstahl 2020-06-29 20:26 ` Zelphir Kaltstahl @ 2020-06-30 18:34 ` Zelphir Kaltstahl 2020-06-30 18:41 ` Zelphir Kaltstahl 3 siblings, 0 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-30 18:34 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hi Maxim! I got around to trying it your way, I think. I have the manifest file `manifest.scm`: ~~~~ (specifications->manifest '("erlang" "emacs" "emacs-org" "emacs-erlang" "emacs-ob-erlang")) ~~~~ ~~~~ ~~~~ ~~~~ executing Erlang code block... append-export-all: Symbol’s function definition is void: string-join ~~~~ ~~~~ ~~~~ On 24.06.20 22:29, Maxim Cournoyer wrote: > Hello Zelphir, > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > >> Hello Guix users! >> >> What is your way of setting up a profile for Erlang development? >> >> There are some things I would like to have, some of which I already >> managed to get: >> >> * [X] Erlang installed through Guix package manager in a separate profile >> * [X] `erl` REPL available in that separate profile >> * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and >> searched for erlang there) >> * [_] org-mode babel erlang for literate programming in org-mode, >> using the Guix installed erlang executable – I found >> https://github.com/xfwduke/ob-erlang, which also seems to work, but >> I do not know how to point it to the Guix installed Erlang, so that >> it can actually run code. Currently it complains about not finding >> Erlang. Does anyone know how to point it to the Erlang executable? I >> created this issue: https://github.com/xfwduke/ob-erlang/issues/1 > It just looks up erl from your PATH, so the problem must be that you > started Emacs from your user profile, which doesn't know about the > separate Guix profile you created which contains Erlang. > > You'd have to start Emacs from an shell where your separate profile was > sourced, or fiddle with M-x setenv to fix this. emacs-guix also has > some guix-set-emacs-environment procedure that can be used to augment > Emacs environment variables given a profile, but it seems broken at the > moment. > > I just tried the following approach, where everything is managed by Guix > in a separate profile: > > --8<---------------cut here---------------start------------->8--- > ;; file: manifest.scm > (specifications->manifest > '("erlang" > "emacs" > "emacs-org" > "emacs-erlang" > "emacs-ob-erlang")) ;; freshly packaged for you ;-) > --8<---------------cut here---------------end--------------->8--- > > Then spawn an environment with > > guix environment -m manifest.scm > > And then ran the following experiment: > > --8<---------------cut here---------------start------------->8--- > # file: test.org > > Put this in your ~/.emacs or evaluate it ad-hoc before running the > rest. > > #+begin_src elisp > (require 'org-tempo) > (require 'ob-erlang) > (org-babel-do-load-languages > 'org-babel-load-languages > '((erlang . t))) > #+end_src > > Example taken from: https://github.com/xfwduke/ob-erlang > With your cursor on the code block, I ran M-x org-babel-execute-src-block > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > And it produced: > #+RESULTS: > : hello world > --8<---------------cut here---------------end--------------->8--- > > Hope this helps! > > Maxim -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-24 20:29 ` Maxim Cournoyer ` (2 preceding siblings ...) 2020-06-30 18:34 ` Zelphir Kaltstahl @ 2020-06-30 18:41 ` Zelphir Kaltstahl 2020-07-06 3:50 ` Maxim Cournoyer 3 siblings, 1 reply; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-06-30 18:41 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hi Maxim, Sorry for the incomplete previous e-mail, somehow I hit send, instead of changing formatting. So here I go again: I got around to trying it your way, I think. I have the manifest file `manifest.scm`: ~~~~ (specifications->manifest '("erlang" "emacs" "emacs-org" "emacs-erlang" "emacs-ob-erlang")) ~~~~ Then I run the command you wrote: `guix environment -m manifest.scm`, which created the environment just fine. Then I created a little Bash script, to make sure to start the separate Emacs without looking at the normal `~/.emacs.d/init.el` file: ~~~~ #!/usr/bin/env bash set -Eeuxo pipefail emacs --no-init-file --no-desktop --maximized ~~~~ And Emacs starts up just fine. Then I run the Elisp code in the *scratch* buffer: ~~~~ (require 'org-tempo) (require 'ob-erlang) (org-babel-do-load-languages 'org-babel-load-languages '((erlang . t))) ~~~~ Then I try to run the org-mode source block hello world Erlang: ~~~~ start() -> io:format("hello world"). ~~~~ Here however, I get an error logged in my *Messages* buffer: ~~~~ executing Erlang code block... append-export-all: Symbol’s function definition is void: string-join ~~~~ Is there anything I missed? Best regards, Zelphir On 24.06.20 22:29, Maxim Cournoyer wrote: > Hello Zelphir, > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > >> Hello Guix users! >> >> What is your way of setting up a profile for Erlang development? >> >> There are some things I would like to have, some of which I already >> managed to get: >> >> * [X] Erlang installed through Guix package manager in a separate profile >> * [X] `erl` REPL available in that separate profile >> * [X] an Emacs Erlang mode (installed it through M-x list-pack RET and >> searched for erlang there) >> * [_] org-mode babel erlang for literate programming in org-mode, >> using the Guix installed erlang executable – I found >> https://github.com/xfwduke/ob-erlang, which also seems to work, but >> I do not know how to point it to the Guix installed Erlang, so that >> it can actually run code. Currently it complains about not finding >> Erlang. Does anyone know how to point it to the Erlang executable? I >> created this issue: https://github.com/xfwduke/ob-erlang/issues/1 > It just looks up erl from your PATH, so the problem must be that you > started Emacs from your user profile, which doesn't know about the > separate Guix profile you created which contains Erlang. > > You'd have to start Emacs from an shell where your separate profile was > sourced, or fiddle with M-x setenv to fix this. emacs-guix also has > some guix-set-emacs-environment procedure that can be used to augment > Emacs environment variables given a profile, but it seems broken at the > moment. > > I just tried the following approach, where everything is managed by Guix > in a separate profile: > > --8<---------------cut here---------------start------------->8--- > ;; file: manifest.scm > (specifications->manifest > '("erlang" > "emacs" > "emacs-org" > "emacs-erlang" > "emacs-ob-erlang")) ;; freshly packaged for you ;-) > --8<---------------cut here---------------end--------------->8--- > > Then spawn an environment with > > guix environment -m manifest.scm > > And then ran the following experiment: > > --8<---------------cut here---------------start------------->8--- > # file: test.org > > Put this in your ~/.emacs or evaluate it ad-hoc before running the > rest. > > #+begin_src elisp > (require 'org-tempo) > (require 'ob-erlang) > (org-babel-do-load-languages > 'org-babel-load-languages > '((erlang . t))) > #+end_src > > Example taken from: https://github.com/xfwduke/ob-erlang > With your cursor on the code block, I ran M-x org-babel-execute-src-block > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > And it produced: > #+RESULTS: > : hello world > --8<---------------cut here---------------end--------------->8--- > > Hope this helps! > > Maxim -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-06-30 18:41 ` Zelphir Kaltstahl @ 2020-07-06 3:50 ` Maxim Cournoyer 2020-07-07 10:23 ` Zelphir Kaltstahl 2020-07-16 21:34 ` Zelphir Kaltstahl 0 siblings, 2 replies; 18+ messages in thread From: Maxim Cournoyer @ 2020-07-06 3:50 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix Hello Zelphir! Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: [...] > Then I try to run the org-mode source block hello world Erlang: > > ~~~~ > start() -> > io:format("hello world"). > ~~~~ > > Here however, I get an error logged in my *Messages* buffer: > > ~~~~ > executing Erlang code block... > append-export-all: Symbol’s function definition is void: string-join > ~~~~ Getting close! I've had this error before and could workaround it (I forgot how). let's see... The string-join call originates from this procedure, which is in ob-erlang.el: --8<---------------cut here---------------start------------->8--- (defun append-export-all (code-body) "Append -compile(export_all). after -module line if CODE-BODY do not has export line." (if (export-p code-body) code-body (string-join (mapcar (lambda (line) (if (string-match-p "^-module" line) (setq line (concat line "\n-compile(export_all).")) line)) (split-string code-body "\n")) "\n"))) --8<---------------cut here---------------end--------------->8--- In Emacs, C-h f string-join RET says it is defined in the subr-x.el module: --8<---------------cut here---------------start------------->8--- string-join is a compiled Lisp function in ‘/gnu/store/pm5kipzcpkfxspy0hhq0jnma7475hqhv-emacs-26.3/share/emacs/26.3/lisp/emacs-lisp/subr-x.el’. (string-join STRINGS &optional SEPARATOR) Join all STRINGS using SEPARATOR. --8<---------------cut here---------------end--------------->8--- Clicking on the link to the file fails to display it. After some head scratching, it turns out that Emacs calls out to 'sh' and 'gzip' to uncompress the 'subr.el.gz' file, and failing to do so 'string-join' is undefined. That's a bug in our Emacs package, it should just work even when ran in a container, at least for such core functionality. For now, using 'guix environment -m manifest.scm --pure --ad-hoc bash gzip' gets us passed this road block. Unfortunately doing the above steps still fail to produce the "hello world" result in a pure environment. Time to C-u C-M-x (edebug) org-babel-execute-src-block and see where the it stumbles, given the lack of error message. Everything looks fine until line 704 in ob-core.el: (let ((r (funcall cmd body params))) Where cmd, body and params are bound to org-babel-execute:erlang, "start() ->\n io:format(\"hello world\")." and ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")), respectively. C-h f org-babel-execute:erlang RET allows us to navigate to its definition, which we instrument for Edebug (C-u C-M-x) then run the entry-point M-x org-babel-execute-src-block again. The function saves the following script to a file named ".erc" under a temporary directory, with the following content: --8<---------------cut here---------------start------------->8--- -module(). -compile(export_all). start() -> io:format("hello world"). --8<---------------cut here---------------end--------------->8--- Which it compiles with: erlc -o /tmp/org-babel-erlangFBLqDi /tmp/org-babel-erlangFBLqDi/.erl The file name is made by concatenating the module name (specified with -module line or a :module code block parameter), which we didn't specify here so it is nil. It seems that a nil module name is not valid in erlang. the -module(). doesn't compile and the file name '.erl' seems to cause problems too. ob-erlang should probably choose a default module name when the user doesn't care to specify one instead of producing broken code. The workaround is to define a module name as explained on the ob-erlang home page: #+BEGIN_SRC erlang :module tryerlang start() -> io:format("hello world"). #+END_SRC Except there's a bug in ob-erlang and this also fails (it still produces a -module(). line). Instead, define it yourself: #+begin_src erlang -module(m). start() -> io:format("hello world"). #+end_src This works. I'll take two actions following this: 1) Create a Guix bug against our Emacs package: installing bash and gzip should not be necessary in a container just so that Emacs is able to load core modules --> done: http://issues.guix.gnu.org/issue/42224 2) Submit a PR to the ob-erlang project that fixes the above problems --> done: https://github.com/xfwduke/ob-erlang/pull/2. HTH! Maxim ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-07-06 3:50 ` Maxim Cournoyer @ 2020-07-07 10:23 ` Zelphir Kaltstahl 2020-07-07 15:55 ` Maxim Cournoyer 2020-07-16 21:34 ` Zelphir Kaltstahl 1 sibling, 1 reply; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-07-07 10:23 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hey Maxim! Wow, thanks for the notes on how to debug the problem as well as looking into it. I'll try to do the same debugging later myself, to learn how to do that and perhaps in the future know what to look for. Regards, Zelphir On 06.07.20 05:50, Maxim Cournoyer wrote: > Hello Zelphir! > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > > [...] > >> Then I try to run the org-mode source block hello world Erlang: >> >> ~~~~ >> start() -> >> io:format("hello world"). >> ~~~~ >> >> Here however, I get an error logged in my *Messages* buffer: >> >> ~~~~ >> executing Erlang code block... >> append-export-all: Symbol’s function definition is void: string-join >> ~~~~ > Getting close! I've had this error before and could workaround it (I > forgot how). let's see... > > The string-join call originates from this procedure, which is in > ob-erlang.el: > > --8<---------------cut here---------------start------------->8--- > (defun append-export-all (code-body) > "Append -compile(export_all). after -module line if CODE-BODY do not has export line." > (if (export-p code-body) > code-body > (string-join (mapcar > (lambda (line) > (if (string-match-p "^-module" line) > (setq line (concat line "\n-compile(export_all).")) > line)) > (split-string code-body "\n")) > "\n"))) > --8<---------------cut here---------------end--------------->8--- > > In Emacs, C-h f string-join RET says it is defined in the subr-x.el > module: > > --8<---------------cut here---------------start------------->8--- > string-join is a compiled Lisp function in > ‘/gnu/store/pm5kipzcpkfxspy0hhq0jnma7475hqhv-emacs-26.3/share/emacs/26.3/lisp/emacs-lisp/subr-x.el’. > > (string-join STRINGS &optional SEPARATOR) > > Join all STRINGS using SEPARATOR. > --8<---------------cut here---------------end--------------->8--- > > Clicking on the link to the file fails to display it. After some head > scratching, it turns out that Emacs calls out to 'sh' and 'gzip' to > uncompress the 'subr.el.gz' file, and failing to do so 'string-join' is > undefined. That's a bug in our Emacs package, it should just work even > when ran in a container, at least for such core functionality. > > For now, using 'guix environment -m manifest.scm --pure --ad-hoc bash > gzip' gets us passed this road block. Unfortunately doing the above > steps still fail to produce the "hello world" result in a pure > environment. > > Time to C-u C-M-x (edebug) org-babel-execute-src-block and see where the > it stumbles, given the lack of error message. > > Everything looks fine until line 704 in ob-core.el: > > (let ((r (funcall cmd body params))) > > Where cmd, body and params are bound to org-babel-execute:erlang, > "start() ->\n io:format(\"hello world\")." and ((:colname-names) > (:rowname-names) (:result-params "replace") (:result-type . value) > (:results . "replace") (:exports . "code") (:session . "none") (:cache > . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")), > respectively. > > C-h f org-babel-execute:erlang RET allows us to navigate to its > definition, which we instrument for Edebug (C-u C-M-x) then run the > entry-point M-x org-babel-execute-src-block again. > > The function saves the following script to a file named ".erc" under a > temporary directory, with the following content: > > --8<---------------cut here---------------start------------->8--- > -module(). > -compile(export_all). > start() -> > io:format("hello world"). > --8<---------------cut here---------------end--------------->8--- > > Which it compiles with: erlc -o /tmp/org-babel-erlangFBLqDi > /tmp/org-babel-erlangFBLqDi/.erl > > The file name is made by concatenating the module name (specified with > -module line or a :module code block parameter), which we didn't specify > here so it is nil. > > It seems that a nil module name is not valid in erlang. the > -module(). doesn't compile and the file name '.erl' seems to cause > problems too. ob-erlang should probably choose a default module name > when the user doesn't care to specify one instead of producing broken > code. > > The workaround is to define a module name as explained on the ob-erlang > home page: > > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > Except there's a bug in ob-erlang and this also fails (it still produces > a -module(). line). > > Instead, define it yourself: > > #+begin_src erlang > -module(m). > start() -> > io:format("hello world"). > #+end_src > > This works. > > I'll take two actions following this: > > 1) Create a Guix bug against our Emacs package: installing bash and gzip > should not be necessary in a container just so that Emacs is able to > load core modules --> done: http://issues.guix.gnu.org/issue/42224 > > 2) Submit a PR to the ob-erlang project that fixes the above problems > --> done: https://github.com/xfwduke/ob-erlang/pull/2. > > HTH! > > Maxim -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-07-07 10:23 ` Zelphir Kaltstahl @ 2020-07-07 15:55 ` Maxim Cournoyer 0 siblings, 0 replies; 18+ messages in thread From: Maxim Cournoyer @ 2020-07-07 15:55 UTC (permalink / raw) To: Zelphir Kaltstahl; +Cc: help-guix Hi, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > Hey Maxim! > > Wow, thanks for the notes on how to debug the problem as well as looking > into it. > > I'll try to do the same debugging later myself, to learn how to do that > and perhaps in the future know what to look for. Glad I could help! Maxim ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Erlang + Emacs profile 2020-07-06 3:50 ` Maxim Cournoyer 2020-07-07 10:23 ` Zelphir Kaltstahl @ 2020-07-16 21:34 ` Zelphir Kaltstahl 1 sibling, 0 replies; 18+ messages in thread From: Zelphir Kaltstahl @ 2020-07-16 21:34 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: help-guix Hi Maxim! It took me a few days longer to get back to this. Just to make sure I am doing this correctly: I put the: ~~~~ (require 'org-tempo) (require 'ob-erlang) (org-babel-do-load-languages 'org-babel-load-languages '((erlang . t) (shell . t))) ~~~~ Into the *scratch* buffer and then highlight all of it and "Evaluate and print" (or C-j), after which a "nil" is printed in the *scratch* buffer. Then I proceed. On 06.07.20 05:50, Maxim Cournoyer wrote: > Hello Zelphir! > > Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes: > > [...] > >> Then I try to run the org-mode source block hello world Erlang: >> >> ~~~~ >> start() -> >> io:format("hello world"). >> ~~~~ >> >> Here however, I get an error logged in my *Messages* buffer: >> >> ~~~~ >> executing Erlang code block... >> append-export-all: Symbol’s function definition is void: string-join >> ~~~~ > Getting close! I've had this error before and could workaround it (I > forgot how). let's see... > > The string-join call originates from this procedure, which is in > ob-erlang.el: > > --8<---------------cut here---------------start------------->8--- > (defun append-export-all (code-body) > "Append -compile(export_all). after -module line if CODE-BODY do not has export line." > (if (export-p code-body) > code-body > (string-join (mapcar > (lambda (line) > (if (string-match-p "^-module" line) > (setq line (concat line "\n-compile(export_all).")) > line)) > (split-string code-body "\n")) > "\n"))) > --8<---------------cut here---------------end--------------->8--- > > In Emacs, C-h f string-join RET says it is defined in the subr-x.el > module: > > --8<---------------cut here---------------start------------->8--- > string-join is a compiled Lisp function in > ‘/gnu/store/pm5kipzcpkfxspy0hhq0jnma7475hqhv-emacs-26.3/share/emacs/26.3/lisp/emacs-lisp/subr-x.el’. > > (string-join STRINGS &optional SEPARATOR) > > Join all STRINGS using SEPARATOR. > --8<---------------cut here---------------end--------------->8--- > > Clicking on the link to the file fails to display it. (Note: For me it opens the file, not sure, whether this is important. It shows the definition: ~~~~ (defsubst string-join (strings &optional separator) "Join all STRINGS using SEPARATOR." (mapconcat 'identity strings separator)) ~~~~ ) > After some head > scratching, it turns out that Emacs calls out to 'sh' and 'gzip' to > uncompress the 'subr.el.gz' file, and failing to do so 'string-join' is > undefined. That's a bug in our Emacs package, it should just work even > when ran in a container, at least for such core functionality. > > For now, using 'guix environment -m manifest.scm --pure --ad-hoc bash > gzip' gets us passed this road block. Unfortunately doing the above > steps still fail to produce the "hello world" result in a pure > environment. For me there is a different result (added newlines for readability): ~~~~ $ guix environment -m manifest.scm --pure --ad-hoc bash gzip The following derivation will be built: /gnu/store/3fsqf52sgr0mm271szmb24knvwr47frx-profile.drv The following profile hooks will be built: /gnu/store/4i8zy7adnskvbsfm8za29vb8nmqlds9f-gtk-im-modules.drv /gnu/store/7jdkqh3zhjlhc6wmb2qnnh6ysc1c3nbs-ca-certificate-bundle.drv /gnu/store/g31dq1fn90h2mdfvpb55i02r73sgrf0h-info-dir.drv /gnu/store/ikm4rinvywb7qapi6sqxb9yq3kj7mqjv-manual-database.drv /gnu/store/j3ks6l39bpj6svlrmap0s4smjz44iwbq-glib-schemas.drv /gnu/store/m6ki0x4p25sh4x9wzzgy8lxkwkysfk8a-xdg-desktop-database.drv /gnu/store/ygkd5q4d4m7a6lp86lm2b65md2by7r2r-xdg-mime-database.drv /gnu/store/zf9kfkm1ihqg3xcbw5xp2f59243da9z2-fonts-dir.drv /gnu/store/zq1rvhmxnrkr9cdpavdy05dpfdww044q-gtk-icon-themes.drv building CA certificate bundle... building fonts directory... generating GLib schema cache... creating GTK+ icon theme cache... building cache files for GTK+ input methods... building directory of Info manuals... building database for manual pages... building XDG desktop file cache... building XDG MIME database... building profile with 7 packages... Command 'lesspipe' is available in the following places * /bin/lesspipe * /usr/bin/lesspipe The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable. lesspipe: command not found Command 'dircolors' is available in '/usr/bin/dircolors' The command could not be located because '/usr/bin' is not included in the PATH environment variable. dircolors: command not found Command 'ls' is available in '/bin/ls' The command could not be located because '/bin' is not included in the PATH environment variable. ls: command not found $ which emacs Command 'which' is available in the following places * /bin/which * /usr/bin/which The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable. which: command not found $ emacs -Q ~~~~ And Emacs starts up just like before, but still I get the same error about string-join being void. > Time to C-u C-M-x (edebug) org-babel-execute-src-block and see where the > it stumbles, given the lack of error message. I guess the rest has only a chance of working once I get around the string-join issue, but I still tried as follows. For me when pressing C-u C-M-x, the part C-M-x is not a defined key combination and it shows in the *Messages* buffer: ~~~~ C-M-x is undefined ~~~~ So I ran edebug in the "Eval :" minibuffer pressing C-S-: (control, shift, colon) and writing there "edebug" and pressing the return key. Then the *Backtrace* buffer shows up, so that seems to have worked. However, next problem is to run `org-babel-execute-src-block`. When I try it in the M-x thing, it claims that `org-babel-execute-src-block` is void. I think it does not work inside the *Backtrace* buffer and I need to be in the buffer, where org-mode runs. However, when I move the cursor into that buffer, an try to run `org-babel-execute-src-block` there, I am back to the string-join error. > Everything looks fine until line 704 in ob-core.el: > > (let ((r (funcall cmd body params))) > > Where cmd, body and params are bound to org-babel-execute:erlang, > "start() ->\n io:format(\"hello world\")." and ((:colname-names) > (:rowname-names) (:result-params "replace") (:result-type . value) > (:results . "replace") (:exports . "code") (:session . "none") (:cache > . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")), > respectively. > > C-h f org-babel-execute:erlang RET allows us to navigate to its > definition, which we instrument for Edebug (C-u C-M-x) then run the > entry-point M-x org-babel-execute-src-block again. > > The function saves the following script to a file named ".erc" under a > temporary directory, with the following content: > > --8<---------------cut here---------------start------------->8--- > -module(). > -compile(export_all). > start() -> > io:format("hello world"). > --8<---------------cut here---------------end--------------->8--- > > Which it compiles with: erlc -o /tmp/org-babel-erlangFBLqDi > /tmp/org-babel-erlangFBLqDi/.erl > > The file name is made by concatenating the module name (specified with > -module line or a :module code block parameter), which we didn't specify > here so it is nil. > > It seems that a nil module name is not valid in erlang. the > -module(). doesn't compile and the file name '.erl' seems to cause > problems too. ob-erlang should probably choose a default module name > when the user doesn't care to specify one instead of producing broken > code. > > The workaround is to define a module name as explained on the ob-erlang > home page: > > #+BEGIN_SRC erlang :module tryerlang > start() -> > io:format("hello world"). > #+END_SRC > > Except there's a bug in ob-erlang and this also fails (it still produces > a -module(). line). > > Instead, define it yourself: > > #+begin_src erlang > -module(m). > start() -> > io:format("hello world"). > #+end_src OK I added that to my source block. > This works. > > I'll take two actions following this: > > 1) Create a Guix bug against our Emacs package: installing bash and gzip > should not be necessary in a container just so that Emacs is able to > load core modules --> done: http://issues.guix.gnu.org/issue/42224 > > 2) Submit a PR to the ob-erlang project that fixes the above problems > --> done: https://github.com/xfwduke/ob-erlang/pull/2. > > HTH! > > Maxim Thanks for doing those 2 things and taking the time to write that response. Best regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-07-16 21:34 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-23 22:49 Erlang + Emacs profile Zelphir Kaltstahl 2020-06-24 20:29 ` Maxim Cournoyer 2020-06-25 19:25 ` Zelphir Kaltstahl 2020-06-28 4:41 ` Maxim Cournoyer 2020-06-29 8:50 ` zimoun 2020-06-29 19:37 ` Zelphir Kaltstahl 2020-06-29 20:24 ` Ricardo Wurmus 2020-06-29 20:37 ` Zelphir Kaltstahl 2020-06-29 20:49 ` zimoun 2020-06-29 21:12 ` Zelphir Kaltstahl 2020-06-29 22:08 ` zimoun 2020-06-29 20:26 ` Zelphir Kaltstahl 2020-06-30 18:34 ` Zelphir Kaltstahl 2020-06-30 18:41 ` Zelphir Kaltstahl 2020-07-06 3:50 ` Maxim Cournoyer 2020-07-07 10:23 ` Zelphir Kaltstahl 2020-07-07 15:55 ` Maxim Cournoyer 2020-07-16 21:34 ` Zelphir Kaltstahl
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.