lompik / ob-nim Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Lesser General Public License v2.1
License: GNU Lesser General Public License v2.1
Hello,
Thanks for working on this package.
I was experimenting with strutils
modules, when I realized that the leading/trailing whitespace is stripped off..
So
#+PROPERTY: header-args:nim :exports both :results output
#+BEGIN_SRC nim :noweb-ref nim__str :results silent
var str = "abcdef"
#+END_SRC
#+BEGIN_SRC nim :noweb yes
<<nim__str>>
import strutils
echo str.center(10, ' ') # Hmm.. this does not work
echo str.center(10, '*')
#+END_SRC
outputs
#+RESULTS:
: abcdef
: **abcdef**
instead of
#+RESULTS:
: abcdef
: **abcdef**
Ref: https://travis-ci.org/github/Lompik/ob-nim/jobs/773160718
Contacting host: elpa.gnu.org:443
Saving file /home/travis/.emacs.d/.cask/24.3/bootstrap/archives/gnu/archive-contents...
Wrote /home/travis/.emacs.d/.cask/24.3/bootstrap/archives/gnu/archive-contents
Contacting host: stable.melpa.org:443
gnutls.c: [0] (Emacs) fatal error: A TLS fatal alert has been received.
gnutls.c: [0] (Emacs) Received alert: Handshake failed
gnutls.el: (err=[-12] A TLS fatal alert has been received.) boot: (:priority NORMAL :hostname stable.melpa.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :verify-hostname-error nil :callbacks nil)
Failed to download `melpa' archive.
Package `s' is not available for installation
�[31m
!!!
!!! DEPRECATION NOTICE
!!!
!!!
!!! The cask `go` script will be removed on 2021/06/01.
!!!
!!! This is due to security concerns about the way python is
!!! invoked from curl, and to remove the python dependency from cask.
!!!
!!! The way to install cask without depending on the `go` script
!!! is very simple. Just clone Cask and pass the PATH.
!!!
!!! git clone https://github.com/cask/cask ~/.cask
!!! PATH=$HOME/.cask/bin:$PATH
!!!
!!! # If you want to make it permanent
!!! echo 'PATH=$HOME/.cask/bin:$PATH' >> .bashrc
!!!
�[0m
�[31mCask could not be bootstrapped. Try again later, or report an issue at https://github.com/cask/cask/issues�[0m
travis_time:end:202d9568:start=1622562293360369858,finish=1622562298597581293,duration=5237211435,event=install
�[0K�[31;1mThe command "curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh" failed and exited with 1 during .�[0m
Your build has been stopped.
I have seen tests, but they are .el files. Could you add some .org files as examples that show the features that you support. Some explanations of how things work for example passing tables from org to nim and how the result from nim is evaluated?
Hello,
Here is an Org file to reproduce the issue.
#+title: No ob-nim output when unittest fails
#+date: <2018-05-25 Fri>
#+property: header-args :eval never-export
#+property: header-args:nim :exports both :results output replace verbatim
* Passing test
#+begin_src nim :tangle test_passing.nim
when isMainModule:
import unittest
suite "check number equality":
test "1 == 1":
check:
1 == 1
#+end_src
#+RESULTS:
:
: [Suite] check number equality
: [OK] 1 == 1
* Failing test
#+begin_src nim :tangle test_failing.nim
when isMainModule:
import unittest
suite "check number equality (failing)":
test "1 == 0":
check:
1 == 0
#+end_src
#+RESULTS:
unittest
generated outputs get inserted fine in the #+RESULTS
block.Now, with the point in the code block in the "Failing test" subtree, if you tangle it using C-c C-v t
, it will generate test_failing.nim
file.
When you run that using:
nim c -r test_failing.nim
you will get:
[Suite] check number equality (failing)
test_failing.nim(7, 10): Check failed: 1 == 0
[FAILED] 1 == 0
It would be great if you can help debug and fix this.
Thanks!
The current Nim version used in CI is 0.17.0. It needs to be updated to the latest stable.
Below was tested on Org 9.4.6-544-gc5573b and latest Nim devel 1.5.1 as of today (2021/06/01).
Below started occurring after a recent fix to Org mode.
#+begin_src nim
echo "-0"
#+end_src
#+RESULTS:
: 0
There was a bug in org-babel--string-to-number
which got fixed recently in https://code.orgmode.org/bzg/org-mode/commit/4c934424d6e45daa30d2e5a2b3217181216d4e37 .
#5 attempted to fix this, but that broke few existing tests ( https://github.com/Lompik/ob-nim/runs/2720365777 ).
edit: sorry, it is standard output during compilation of program. I closed issue.
Hi,
I am starting learning Nim and testing some code in Emacs Org babel, I am running Nim on openSUSE Tumbleweed GNU/Linux from its packages but even during evaluation simplest Nim code the results shows below as well as Org-Babel Error Output buffer with following lines:
,#+begin_src nim :results output
echo("Hello, world!")
#+end_src
#+RESULTS:
: Hello, world!
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
..........................................................................
CC: ../../usr/lib64/nim/lib/std/private/digitsutils.nim
CC: ../../usr/lib64/nim/lib/system/assertions.nim
CC: ../../usr/lib64/nim/lib/system/dollars.nim
CC: ../../usr/lib64/nim/lib/system/io.nim
CC: ../../usr/lib64/nim/lib/system.nim
CC: ../../usr/lib64/nim/lib/pure/parseutils.nim
CC: ../../usr/lib64/nim/lib/pure/unicode.nim
CC: ../../usr/lib64/nim/lib/pure/strutils.nim
CC: ../../usr/lib64/nim/lib/pure/strformat.nim
CC: nim_src_hTtgDJ.nim
Hint: [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
40926 lines; 0.909s; 60.738MiB peakmem; proj: /tmp/babel-N1vLYy/nim_src_hTtgDJ.nim; out: /tmp/babel-N1vLYy/nim_src_hTtgDJ [SuccessX]
[ Babel evaluation exited with code 0 ]
My environment:
#+begin_src shell :results output
nim -v
#+end_src
#+RESULTS:
: Nim Compiler Version 1.6.10 [Linux: amd64]
: Compiled at 2022-11-23
: Copyright (c) 2006-2021 by Andreas Rumpf
:
: active boot switches: -d:release
#+begin_src emacs-lisp
(emacs-version)
#+end_src
#+RESULTS:
: GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.35, cairo version 1.17.6)
: of 2022-12-11
Is it related with my is it related with my Nim configuration in /etc/nim
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.