How do I activate "lisp mode" for cljs files in emacs? - emacs

Currently emacs isn't turning on paredit and isn't using any syntax highlighting when I edit .cljs files. It does when I edit .clj files and I want it to treat .cljs similar.
What do I have to do?

If you already have everything working for clojure you can just turn clojure-mode on for the current buffer using
M-x clojure-mode
If you want it turned on automatically you need to add an entry to the Auto Mode AList. In my case, adding the following to init.el did the trick:
(add-to-list 'auto-mode-alist '("\.cljs$" . clojure-mode))
After that you need to reload your init.el (M-x load-file) and re-open the file.

Related

Getting browser-style tabs in emacs

Really new programming student here, and I'm trying to get tabs in emacs (browser style, like Aquamacs has).
So, how do you get tabs in emacs? A strip of labels showing me which buffers I have open, and clicking on one of them selects that buffer.
I have googled this extensively, but not being fluent in elisp makes it really hard to understand. I have installed the tabbar package, but I do not know where to go from here.
What do I want? Just tabs, and a command to open new tabs, for example C-t (or whatever is best).
I have installed the tabbar package, but I do not know where to go from here.
The tabbar library provides a global minor mode named tabbar-mode, so you will want to enable that in your init file. If it's installed somewhere in your load-path then the following will work:
(when (require 'tabbar nil t)
(tabbar-mode 1))
There is lots of documentation in the library's Commentary, which you can visit like so:
M-x find-library RET tabbar RET
Try this, it's called tabbar and should allow you to do what you're looking for.
As the other answers, tabbar is what you're looking for.
You need to copy it to wherever you keep your emacs files (if you don't have such a place - make one, tabbar will not be the last add-on you'll use :) ), load the file and start the tabbar-mode.
In the below code, the emacs files dir is .emacs.files and it is in my home dir.
(setq tabbar-file
(expand-file-name "tabbar.el"
(expand-file-name ".emacs.files" "~")))
(load-file tabbar-file)
(tabbar-mode 1)
(define-key global-map "\M-[" 'tabbar-backward)
(define-key global-map "\M-]" 'tabbar-forward)
In the above code, I also added binding of scrolling through the tabs to Alt-[ and Alt-].
As to opening new tabs - every time you'll open a new file, it will be opened in a new tab, so don't worry...

How to make minimap run in specified modes?

I installed GNU minimap (version 1.2).
When I open certain type of files , e.g. .py, .c, the minimap comes out as expected.
However, when I open .html file, the minimap is not started.
Is there a way to add additional modes where the minimap automatically shown?
I tried to add hooks to .emacs file but it just starts minimap-mode, but no displaying any minimap.
(add-hook 'html-mode-hook 'minimap-mode)
By default, minimap-mode only works for modes that derive from prog-mode (most modern modes for programming, including python-mode and c-mode). Modify minimap-major-modes if you want to activate it for others, e.g.
(setq minimap-major-modes '(prog-mode html-mode))
or
(add-to-list 'minimap-major-modes 'html-mode)

LaTeX-mode hooks not loading in emacs (24.3.50) with AUCTeX (11.87.3)

Since I updated to emacs 24 I cannot get AUCTeX to load the LaTeX-mode hooks, e.g.
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
despite:
C-h m tells me that my major mode is Major mode in AUCTeX for editing LaTeX files.
the AUCTeX mode help states:
Entering LaTeX mode calls the value of `text-mode-hook',
then the value of `TeX-mode-hook', and then the value
of `LaTeX-mode-hook'.
(Indeed, the text-mode hooks are not loaded either.)
Hooks for other modes (e.g. for Markdown or Python) do work.
And, of course, I have tested that manual activation, e.g. M-x visual-line-mode, does work.
Thanks!
This is strange C-hm gives me
Entering Latex mode runs the hook text-mode-hook', then
tex-mode-hook', and finally `latex-mode-hook'.
Notice that it is latex-mode-hook and not LaTeX-mode-hook.
EDIT - I do not have auctex installed maybe that explains why the help messages are different for us, ignore the part above. You can try the below as an alternative
(add-hook 'latex-mode-hook 'visual-line-mode)
As is noted in the comments in the other answer, this issue is caused by AucTeX being unable to create XPM images. This occurs when when Emacs is not compiled with the libxpm library, which might be the case when you run Emacs primarily inside your favorite terminal emulator.
Anyways, you can still correct this issue without recompiling Emacs. In fact, the images are only used for the AucTeX toolbar. Thus, disabling it will effectively remove the problem altogether. You can do this by adding:
(unless (image-type-available-p 'xpm)
(setq LaTeX-enable-toolbar nil))
To your .emacs (or .emacs.d/init.el) file.
This snippet simply checks if XPM images are available in the Emacs installation and if not, it disables the toolbar.

Ido mode is too smart, can I get it to NOT complete a filename?

My problem: I have Ido-mode enabled and I want to edit (for example) a file .emacs in my home directory. I have no .emacs file there, but I do have a .emacs.d, and so ido assumes that I want to enter the directory when I do C-x C-f .emacs RET.
I've been trying to solve this for at least weeks, and I've got a couple work-arounds but I would really rather not have to do anything crazy.
You can either press C-j to accept what you have typed so far, or C-f which will drop you into regular find-file

How do I stop Emacs from automatically editing my startup file?

Emacs edits my .emacs file whenever I use the customization facility, or when I type a command that is disabled by default. Any automatic editing of my configuration makes me nervous. How can I stop Emacs from ever editing my .emacs. file?
The first thing to do is to stop that silly "disabled command" feature from ever doing anything. If you care this much about your .emacs file, you certainly don't need novice.el bossing you around.
(setq disabled-command-function nil)
The customization facility can be made to stuff all your customizations in a separate file with the following commands.
(setq custom-file "~/.emacs-custom.el")
(load custom-file 'noerror)