ESense looks dead; what are your recommendations for Erlang code completion in Emacs? It doesn't have to be fancy (ESense built an index from the Erlang source); even something that just uses Erlang's module_info/0 and module_info/1 functions for introspection of function names would help.
If one isn't available in Emacs, can you recommend one for TextMate?
I've used auto-complete successfully.
site: http://cx4a.org/software/auto-complete/
code: https://github.com/m2ym/auto-complete/
and added this to my .emacs file:
(add-to-list 'load-path "~/dev/emacs/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/dev/emacs/auto-complete/dict")
(ac-config-default)
; ... after loading erlang-mode
(add-to-list 'ac-modes 'erlang-mode)
Do you know about distel already?
See Bill Clementson summarize distel mode and its features.
distel should be able to compete functions names using information from running node
I've one working that I use for my own development. Its at,
http://github.com/rajivr/erlang.tmbundle
Feel free to try it and ping me if you have any issues.
Related
I am trying to get into emacs. I have installed it using apt-get install on ubuntu.
Now I want to change the background color, and found some doc on this. The best doc I found is this:
http://www.emacswiki.org/emacs/FrameParameters
But when reading about how to add things to the .emacs file, none of the docs/info I found mention anything about structure, and the .emacs file just looks like a big mess. Do any of you experienced emacs users follow a specific structure when adding to .emacs, or do you just add anywhere?
I want to add the following:
(add-to-list 'default-frame-alist '(foreground-color . "white"))
(add-to-list 'default-frame-alist '(background-color . "black"))
(add-to-list 'default-frame-alist '(cursor-color . "coral"))
When opening the .emacs file, I don't file like just throwing it in, as I like structure. Before I try to make my own, I'd like to hear if there is a convention that I have missed?
Your .emacs file is a piece of Lisp code. There are conventions for how to format Lisp code, but I guess that's not really what you are looking for.
Part of the problem is that your .emacs will tend to grow organically, as you find new things you want to try and new knobs you want to tweak. Over time, it will build up into a huge, monolithic piece of unrelated code snippets.
The usual structuring conventions for code apply -- group related code together, add comments, modularize.
What you can do with the code you posted as an example is mainly to add a comment.
;; Frame colors
(add-to-list 'default-frame-alist '(foreground-color . "white"))
(add-to-list 'default-frame-alist '(background-color . "black"))
(add-to-list 'default-frame-alist '(cursor-color . "coral"))
Some people like to add folding mode markers so they can collapse/expand code sections, but perhaps at that point you should start thinking about breaking it up into smaller files.
Overhauling the rest of your .emacs file is out of scope here, and impossible without access to the full thing. But see http://www.emacswiki.org/emacs/DotEmacsModular for some suggestions. (Disclosure: A snippet of mine is prominently linked.)
Using customize also helps somewhat, but it has its own pros and cons. The customize settings are added programmatically at the end of your .emacs, and has very little by way of structure.
I'm using emacs-snapshot (24.2.50) on Xubuntu 12.10. For completion I am currently using auto-complete (v1.4).
I have a pretty nice setup of auto-complete with various sources, including the semantic source for code completion of my c++ programming. However, I'd like to switch to predictive-mode for completion of LaTeX documents (I'm using AUCTeX for all LaTeX related stuff).
My current auto-complete config (for LaTeX; I omitted all non-LaTeX config) looks like this:
(require 'auto-complete-latex)
(require 'ac-math)
(add-to-list 'ac-modes 'latex-mode) ; make auto-complete aware of {{{latex-mode}}}
(defun ac-latex-mode-setup () ; add ac-sources to default ac-sources
(setq ac-sources
(append '(ac-source-math-latex ac-source-latex-commands)
ac-sources))
)
(add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)
After adding predictive to the load-path and doing the auto-load stuff as described here I tried to disable auto-complete for LaTeX-mode and enable predictive-mode in turn by exchanging the above code by this:
(defun ele/latex-mode-completion-setup ()
(auto-complete-mode -1)
(predictive-mode 1)
)
(add-hook 'LaTeX-mode-hook 'ele/latex-mode-completion-setup)
Unfortunately this doesn't work as expected: auto-complete is actually disabled but predictive-mode is not enabled and instead of using AUCTeX the build-in tex-mode is used.
I have uploaded all LaTeX related config here. Note that this is loaded after the above completion setup, but this is the case for the old auto-complete based setup as well. Also note that exchanging that order does not make a difference as far as I can tell. Furthermore I found that simply commenting the auto-complete config (first snippet I posted) results in the same behaviour: tex-mode is used instead of AUCTeX.
I don't want to switch to predictive-mode for all modes but I really like many features it provides when doing LaTeX editing.
Any suggestions?
(remove-hook
might clear the hook, not to run unwanted stuff - just a suggestion indeed
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.
Something like this should work:
(add-hook 'vala-mode-hook (lambda () (setq c-basic-offset 4)))
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")
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)
In Emacs, I'd like to highlight the parts of long lines that exceed 80 characters.
The package highlight-80+ is great for that. But how can I automatically enable it when a C++ source file is loaded?
I tried to add highlight-80+ to the C++ mode, but it didn't work:
(require 'highlight-80+)
(defun my-c++-mode-common-hook ()
(highlight-80+-mode 1))
(add-hook 'c++-mode-common-hook 'my-c++-mode-common-hook)
When I load a .cc file it goes in C++ mode but highlight-80+ is not enabled, so the long lines are not marked.
Note that the Highlight80Plus wiki says that it is built-in to emacs starting with 23. I believe it's referring to whitespace-mode; it does this and is built in to emacs.
There is a function in emacs-starter-kit that does something like this already but you could easily duplicate it,
(defun esk-turn-on-whitespace ()
(whitespace-mode t))
(add-hook 'prog-mode-hook 'esk-turn-on-whitespace)
See the whitespace-mode, it does this kind of highlighting and more:
http://www.emacswiki.org/emacs/WhiteSpace
Can you try this:
(autoload 'highlight-80+)
(add-to-list 'auto-mode-alist '("\\.cpp$" . highlight-80+-mode))
I'm trying to use smart-operator.el in emacs. I've put the following into my init.el file:
(add-to-list 'load-path "~/.emacs.d/dotemacs_git/smart-operator/")
(require 'smart-operator)
(smart-operator-mode 1)
That doesn't seem to turn on smart-operator-mode automatically ... I still have to do
M-x smart-operator-mode
to get it working. What am I doing wrong? This setup here uses smart-operator-mode within a python-mode-hook; I don't see why making the function call conditional on python-mode would matter, though...
Thanks,
Mike
The link you provide shows folks using
(smart-operator-mode-on)
Also, they're adding that call in a hook, like so:
(add-hook 'python-mode-hook
(lambda ()
(smart-operator-mode-on)))
Which will turn it on for all buffers using python-mode. You'll need that since it appears that smart-operator-mode is not a global minor mode.