Spacemacs - General Discussion, Blog Posts, Wiki

Thanks… but I couldn’t get it to work :frowning: is this right?

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
  (add-hook 'alchemist-mode-hook 'company-mode)
  (global-linum-mode) ; Show line numbers by default
  (global-set-key (kbd "M-3") '(lambda () (interactive) (insert "#"))) ; Allow hash to be entered
  (setq-default dotspacemacs-themes '(codeschool spacemacs-dark))
  )

did you want this to occur in insert mode or normal mode? Ill have a crack at getting it setup not that I immediately see any issues with this.

1 Like

Yep, insert mode please :slight_smile:

Btw if anyone’s interested, I’ve just ported my Codeschool theme over https://github.com/AstonJ/editor-themes/tree/master/CodeSchool/Spacemacs (it probably needs some work yet tho).

5 Likes

(define-key evil-insert-state-map (kbd "M-3") '(lambda () (interactive) (insert "#")))

Is what you want.

1 Like

Awesome, thanks - it works!! :023:

(I am beginning to think we need a whole section for code editors because they are such a huge part of programming…)

1 Like

Question, I am working with Clojure and Cursive plugin for Intelij and want to do the same with Spacemacs:

  • Reload one module or all modules into iex
  • Select line of code and run it into iex
2 Likes

I noticed that @kblake tweeted how to do this earlier…

How to execute a region of elixir code in Spacemacs:
Select/highlight a region of code and then SPC m e r

2 Likes

Ok but this not exactly what I wanted. Yes this command evaluates current line but in new context.
But what I want is to load module(s)/mix project into iex (and also possible to reload these modules), and then run current selected text using code from these modules.

1 Like

Anyone using Spacemacs with Macintosh Computers an European (German) Keyboard?

1 Like

Hi,

With vim, I’ve gotten used to using Shift+up arrow (Shift+down arrow) to scroll page up (and down).
Do you know how I can map these keys to obtain the same behavior in spacemacs ?

1 Like

Ok so I think I finally found a way to do what I was looking for.
I added these lines in the dotspacemacs/user-config block in my ~/.spacemacs config:

  (define-key evil-motion-state-map (kbd "S-<up>") 'evil-scroll-page-up)
  (define-key evil-motion-state-map (kbd "S-<down>") 'evil-scroll-page-down)

Not sure if that’s the recommended way but it seems to work

2 Likes

How to transform Atom to Spacemacs :slight_smile:

Alchemist v1.8.0 is out

Enhancements

  • [Hex] Add Hex package interface for fetching specific package informations.
  • [Refcard] Update dynamic generated refcard with phoenix-mode

See Alchemist-Hex in action here: https://github.com/tonini/alchemist.el/releases/tag/v1.8.0

1 Like

If you are -like me- having trouble installing the latest Emacs 24.5 on Ubuntu 14.04 the following script comes in quite handy:

1 Like

Couple of questions.

Is there something like StyleCop available to enforce Elixer style like for example this one?

Is it possible to autocorrect or apply the style to your code like proper indentation, use of parenthesis for functions etc. (as prescribed in the style) like for example:

# not preferred
def some_function arg1, arg2 do
   # body omitted
end

to:

# preferred
def some_function(arg1, arg2) do
   # body omitted
end

Is it possible to “desugar” code like for example:

[ name : "J. Doe" ]

to:

[ { :name, "J. Doe" } ]

Or remove shorthand like:

add_one = &(&1 + 1)

to:

add_one = fn (n) -> n + 1 end
1 Like

There are som hex modules available which do some suggestions on styling. Spontaniously I can think off dogma and credo.

Both do provide you with a mix task to check your code style, but as far as I know, there is no integration into any editor for them so far.

1 Like

I like Credo and I use it in some of my projects. That said, I don’t think alchemist should include support for credo, except for being able to enter a mix command and display the output in a buffer—which alchemist is already capable of doing. The reason behind my thinking: While I think Credo is good I could imagine other style checker libraries coming out that I might prefer in the future for any reason.

But—this is Emacs. We can customise it to our hearts content! This doesn’t need to be part of Alchemist. We can use some of the stuff in alchemist to shoehorn credo integration into our Alchemist installation. I got the following in my Emacs configuration where I configure my Elixir environment:

(defun mg/alchemist-run-credo-on-project ()
  "Run credo on project"
  (interactive)
  (alchemist-mix-execute "credo"))

(define-key alchemist-mode-keymap (kbd "p c") 'mg/alchemist-run-credo-on-project) 

I define a «run credo» function and bind it to the alchemist keybinding; which means that credo is run when i hit C-c a p c (I use vanilla Emacs)

2 Likes

The most important parts of Spacemacs run okay when I use PuTTY except some of the coloring and special characters.

Any idea on how to get this working?

1 Like

Having that ugly colors is typical for emacs in a terminal. It can get even worse than what you showed us, if you activate whitespace-mode.

But I haven’t seen that black on black until now…

And the special characters is a typical problem when having unicode in a windows terminal. It just doesn’t work, because windows has a different encoding there. Perhaps you can check if putty allows some conversion?

2 Likes