This question already has an answer here:
Emacs: How to use a major mode for non-standard file extension
(1 answer)
Closed 8 years ago.
Does anyone know how I can get Emacs Live to recognize Hoplon (hl)? These hl files should be treated as a clojurescript file.
If you use both HTML and s-expression syntax you may want to use the .cljs.hl and .html.hl extensions to help emacs differentiate between them. So you may want something like:
(add-to-list 'auto-mode-alist '("\\.html\\.hl\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.cljs\\.hl\\'" . clojure-mode))
As stated in the comment(s),
(add-to-list 'auto-mode-alist '("\\.hl" . clojurescript-mode))
Should do the trick.
Related
This question already has an answer here:
Emacs: How to use a major mode for non-standard file extension
(1 answer)
Closed 8 years ago.
I was working with .stp files and .d files, which define kernel probes in c-like syntax. So I would like them to be treated as C source files so I could see the lovely font highlight.
Here are some examples -- just put in whatever mode you need -- e.g., c-mode:
;; associates files with a particular mode.
(add-to-list 'auto-mode-alist '("\\.tex\\'" . lawlist-tex-mode))
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.todo\\'" . lawlist-org-mode))
(add-to-list 'auto-mode-alist '("\\.done\\'" . lawlist-org-mode))
(add-to-list 'auto-mode-alist '("\\.scratch\\'" . text-mode))
(add-to-list 'auto-mode-alist '("user_prefs\\'" . text-mode))
(add-to-list 'auto-mode-alist '("\\.lisp\\'" . emacs-lisp-mode))
I downloaded two .el files
One is to highlight current column where cursor is and another one to highlight some specific words.
I followed next steps in the file:
(add-to-list 'load-path "~/.xemacs/packages/") //path where I saved .el files
(load "column-marker") //name of file without .el extension
To this step it works fine, I find those when I press M-x column-marker and I can use it.
My problem begins when I want to use it everytime i open emacs and I found that I could use something similar to this:
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
Which in my case I am typing:
(add-to-list 'auto-mode-alist '("\\.\\'" . column-marker)) //I want to enable it for all .something files
But... when doing that, there is an error when opening emacs and it starts with default setup.
What am I doing wrong? I have tried many ways and none work.
Thanks in advance
Always post the error message you see. That helps others help you.
C-h f auto-mode-alist tells you that the functions you use in it must implement major modes. column-marker is not a major-mode function. It is not even a function; it is a file.
What you need to do, for each mode where you want some function in file column-marker.el to be invoked, is to put that function on the major-mode hook for that function. For example:
(add-hook 'emacs-lisp-mode (lambda () (interactive) (column-marker-1 80))
And lo and behold, what does the Commentary in file column-marker.el tell you?
;; Installation: Place this file on your load path, and put this in
;; your init file (`.emacs'):
;;
;; (require 'column-marker)
;;
;; Other init file suggestions (examples):
;;
;; ;; Highlight column 80 in foo mode.
;; (add-hook 'foo-mode-hook (lambda () (interactive) (column-marker-1 80)))
Couldn't be clearer. Provided you actually read it.
Seriously, a minimum of investigation is in order, before you post a question to StackOverflow. You should do a Google search, open README files and read them, and so on --- first. And in the case of Emacs questions, IMHO, you should ask Emacs first (e.g. C-h v auto-mode-alist).
According to the rules of S.O. posting, not doing preliminary simple research is even grounds for closing a question. So do not be surprised if this question gets closed or downvoted.
This question already has answers here:
Viper mode in all modes
(2 answers)
Closed 8 years ago.
I've set up my emacs so that it automatically uses Octave mode when I open a .m file (really I'm working on Matlab files). I like to use viper-mode.
However, when I open a .m file, viper mode gets turned off, and I have to manually
restart it. Is there a way to modify my configuration so that viper mode stays on?
.emacs.d/init.el:
(setq viper-mode t)
(require 'viper)
(require 'vista-c-style)
(add-hook 'c-mode-common-hook 'vista-set-c-style)
(add-to-list 'auto-mode-alist '("\\.h" . c++-mode)) ;; open .h files in c++ mode
;; octave mode
(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist
(cons '("\\.m$" . octave-mode) auto-mode-alist) )
;; other config (relate to org-mode) and definition of 'vista-c-style are snipped
This
(add-to-list 'viper-vi-state-mode-list 'octave-mode)
adapted from this question worked.
This question already has answers here:
Emacs: check for no-window-system in .emacs
(2 answers)
Closed 8 years ago.
there are portions of my .emacs file that I would like to behave differently depending if emacs was opened in a terminal (ie, emacs -nw) or in a window. How does one go about detecting this?
In my FSF .emacs, I have code like this:
(if (null window-system)
(global-set-key "\C-h" 'delete-backward-char))
It looks like this works under XEmacs as well, though the preferred XEmacs way is to use the console-type function instead. Do M-x describe-function on console-type for details.
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.