Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.56 KB

2016-10-15-javascript-inside-emacs.org

File metadata and controls

63 lines (51 loc) · 1.56 KB
— layout: post title: Run JavaScript inside Emacs tagline: ” do what you want in the literal manner” permalink: /emacs/javascript-intro.html categories: [emacs, javascript, nodejs] tags: [emacs, literate programming, JavaScript] —

Prerequisites

First of all lets check up does NodeJS already installed on our host:

nodejs --version
v0.10.25

Activation

In order to use JS inside Babel you’ll need to activate its support. Find in your .emacs or .init strings with Babel’s supported languages:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)
   (emacs-lisp . t)
   (shell . t)
   (js . t)
   (ditaa . t)
   (plantuml . t)
   (sqlite . t)
   ))

and ensure that JS is already included. Otherwise you should add the necessary string and evaluate the region by marking it C-SPC and execution M-x eval-region

Testing

Try to copy and paste code snippet below into your org file and evaluate it by yourself. Put the pointer between #+BEGIN_SRC and #+END_SRC and type C-c C-c to get results.

  console.log("Hello World!");
#+END_SRC

#+RESULTS:
: Hello World!

Conclusion

Have a fun