Questions tagged [javascript]

for the use (typically editing) of JavaScript code in Emacs.

Filter by
Sorted by
Tagged with
5
votes
1answer
420 views

How do I make javascript-mode not turn all 8 spaces into tabs?

This is what javascript-mode generates with standard tabbing (I never hit the space key when making it). I'd like to have the files contain no tab characters. I can't seem to find any option in the ...
8
votes
1answer
2k views

How to get org-babel source block working with ES6-7?

I'm having difficulty getting org-babel to evaluate this block of code with emacs v24.5 node v5.0.0 babel-node v.6.6.5 #+BEGIN_SRC js :cmd "babel-node" let arr = [1, 2]; let [x, y] = ...
1
vote
1answer
336 views

Emacs indent AngularJS code to wrong level

It's really sad not to write well formatted angularJs code inside emacs, the image below shows what I am saying. What is happening inside the photo is that the code is already well formatted as it is,...
0
votes
0answers
51 views

Css mode break indent region for javascript-mode

I have css-mode and javascript-mode and if I open css file the indent-region-function is set to css-indent-region which break javascript-mode indent region, how can I fix that? the workaround is to ...
0
votes
0answers
42 views

Is there a way to colorize markdown coding partial

I want to colorize code snippet in markdown-mode. # foo.rb def foo do_something end And javascript code. // bar.js function bar(){ do_something(); } In markdown-mode the codes are colored by ...
0
votes
1answer
460 views

Enable JSX folding in web-mode

I'm using web-mode to edit jsx files and I'm wondering what minor-mode can I use to add folding support. Is there anything out there that works? Thanks
0
votes
0answers
220 views

Strange tabbing behaviour in .erb files

Note that I use spaces for tabs. When I am working in erb files for rails such as example.js.erb or example2.html.erb, I am getting some very odd (and annoying) auto-tabbing behaviour, which I can't ...
0
votes
1answer
175 views

Is there any way to get tabs to align relative to the previous line?

Currently I have this javascript code in a js2-mode buffer after I press tab: const entries = state.get('entries') .concat(getWinners(state.get('vote'))); and I would like for it to look ...
3
votes
1answer
3k views

Cannot jump to definition in js2-mode or Tern

I am performing Nodejs development in emacs, but my environment seems incorrect. For example, when I run ac-js2-jump-to-definition, I get "no jump location found" in the minibuffer. Also when I run '...
11
votes
1answer
5k views

Javascript mode compatible with es6

Does anyone know of a javascript editing mode that supports the es6 syntax additions (arrow functions, extends, imports, generators, etc.)? I've done some quick searching but it looks like so far ...
1
vote
3answers
3k views

Flycheck with eslint doesn't use ~/.eslintrc

I'm having trouble getting flycheck to use the .eslintrc file in the root of the current project, and I'm struggling to find any documentation that will tell me how to configure it to use the ...
7
votes
2answers
3k views

How prettify (newlines and indentation) an optimized HTML/JS file?

For example, I have the following bunch of characters (HTML): http://pastebin.com/pwTPp8wd I thought everyone stumbled it upon a processed file, especially when someone would speed up the processing ...
5
votes
1answer
668 views

How to set temporary file directory for flycheck eslint (outside of current directory)

flycheck-mode creates temporary files in the current directory. That is annoying. How can I disable/set the default place for these temporary files. I use javascript eslint syntax checker for react ...
3
votes
1answer
1k views

Receive error when trying to use tern mode

I have installed tern use npm and install tern.el from melpa. I put the path of tern.el in my init file as per instructions on the emacs section of the tern homepage. However when I enable tern mode ...
4
votes
0answers
362 views

Web mode -indentation is misaligned on skipping semicolons

When i indent javascript code (inside html - web mode) that has no semicolons in it, the next statements are indented right with two extra spaces, <script> function processTemplates(){ ...
0
votes
1answer
1k views

Angular and Tern.js - ReferenceError in angular.js

I'm trying to configure Emacs with Tern.js to use AngularJS in it. When add angular to .tern-project like: { "plugins": { "node": { }, "angular": { } } } and type app.| I get ...
2
votes
1answer
1k views

Javascript not autocompleting with Yasnippet and Auto-complete

I really want to use emacs as a Javascript IDE. I have followed all the directions I can, includings Yasnippets and Autocomplete, but I still have some issues. If you look at the differences, in ...
1
vote
2answers
181 views

js-comint mode (node) returning too many undefined responses?

I am using js2-mode and comint-mode to run the Node REPL in emacs. For some reason the prompt is returning a lot of undefined and ...undefined responses, which it wouldn't do normally. for instance, ...
0
votes
0answers
121 views

Set javascript mode indents to (1-based) columns 5, 9, 13, 17,

When setting the js-indent-level to 4, my code is aligned in (1-based) columns 4, 8, 12, 16, ... To me this makes perfect sense, but unfortunately I'm sharing code with others whose editors ...
1
vote
1answer
71 views

How can I modify a variable in a javascript file that meets specific conditions?

Lets say I'm editing a javascript file in emacs that has objects as such scattered through out the file: foo: [1], foo: [2], foo: [3], foo: [4], foo: [5], foo: [6], foo: [7] obo: [1], obo: [2], obo: [...
2
votes
2answers
389 views

Define key to toggle between javascript implementation and test file

I have been trying to set up a shortcut for jumping between a JavaScript implementation and test. I have particular requirements that are making examples I see harder to apply. I currently work with ...
1
vote
1answer
647 views

js2-mode customizations not applying

No matter what I do, the customizations I apply to js2-mode are not going into effect. The mode is on and working, but with default settings. I've tried changing the default-tab-width to 2 and ...
2
votes
2answers
388 views

Can't get a Node REPL with swank-js

I have followed the instructions on Github for setting up swank-js. I installed slime and slime-js from github and have the following in my .emacs file: (add-to-list 'load-path "~/slime/") (...
8
votes
1answer
3k views

How to navigate a JavaScript project?

I'm currently working on a JavaScript project using Backbone.js and I wonder how can I navigate between files, based on method and object definitions. For example, I keep references to some of my ...
2
votes
2answers
1k views

How to display the list of functions in iMenu and collapse/uncollapse functions in angular js file

I use js2-mode with emacs-prelude, imenu displays the list of functions and I can collapse and uncollapse the functions defined in a regular js file like this function testFunction1(){ console....
19
votes
3answers
5k views

How to use skewer-mode?

I am currently struggling to use skewer-mode in Emacs. I downloaded and installed skewer-mode via MELPA, so all the dependencies should be inplace. For testing purposes I even downloaded the boidsjs ...