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

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)

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 do I activate "lisp mode" for cljs files in 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.

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.

How to Save all edited-situations and resume all the situations from the last time when opening Emacs again

I learned that to add those codes in .emacs can make Emacs saves automatically all situations before quitting and start it next time, Emacs can show the last situation and go on editing it.
(load "desktop")
(desktop-load-default)
(desktop-read)
(add-hook 'kill-emacs-hook
'(lambda()(desktop-save "~/")))
but this codes makes a problem that you only can open one Emacs, when you want to start another Emacs at the same time, only the previous one can run.
I want the function saving all situations for the next use, but I also need to start one more Emacs, How can I get the two sides work simultaneously?
Thank you for your help. I am waiting......
Use different desktop files; or use emacsclient instead of emacs to start new editing buffers once you have your main Emacs up and running. There are multiple examples in Google of an emacs alias / function / whatever to start Emacs if it is not running, and otherwise run emacsclient.

Stop emacs from opening window automatically

This question probably applies to other emacs modes than haskell-mode, since I assume emacs has got a general way of opening windows for automatically created buffers:
haskell-mode for emacs enables me to hit C-c C-l to load the contents of the current buffer into a Haskell interactive session, which automatically causes emacs to open the buffer for the session in a split window in the current frame. Since I am running a setup with multiple emacs clients connected to a server, I really don't want to show the buffer in each open frame I've got. Is there a way to prevent emacs from doing this kind of thing?
Ah, I found a solution just after posting this :).
Adding
(setq special-display-buffer-names
'("*haskell*" "*Help*"))
to my .emacs tells emacs to open these buffers in a frame instead of a split.
Edit: But still, an even better solution would be for emacs never to create frames/splits automatically, but just silently create special buffers in the background. I can't figure out how to specify this though.
in init.el
(setq split-height-threshold 5)
(setq split-width-threshold 5)