1
votes

I am using vala-mode to edit Vala code in Emacs. However, I want to change two things in vala-mode:

I want to indent with 4 spaces instead of 2 spaces (which is my Emacs default). I want to enable auto-completion inside vala-mode.

Auto-completion works in all modes except for vala-mode, and I want the 4 spaces indentation only for vala-mode, not all modes. However, I don't know how to make these changes only for vala-mode.

Thank you.

3
I second that question. I've tried to customize some settings in vala mode by adding lambdas to vala-mode-hook, but nothing works unless I add them to c-mode-common-hook (and I don't want to do that)... This is driving me nuts... I looked into vala-mode.el (there is vala-mode-hook handling section at the bottom if it) and it looks fine to me... Any help on this much appreciated.Pawel Stolowski

3 Answers

1
votes

Something like this should work:

(add-hook 'vala-mode-hook (lambda () (setq c-basic-offset 4)))
1
votes

I have never used vala-mode, but it looks like it is based on cc-mode so that setting c-basic-offset might work. For info on how to set c-basic-offset in a style, see the documentation at

(info "(ccmode)Customizing Indentation")
1
votes

I saw that the indentation issue was fixed but not the auto complete feature. If you are using the auto complete package, then in your init.el or .emacs you can simply put:

(require 'auto-complete-config)
(add-to-list 'ac-modes 'vala-mode)

You will then have auto complete locally. Thats one way of doing it. Also there is a Yasnippet package for vala that is available in MELPA (https://github.com/gopar/vala-snippets)