How to set Emacs theme? - emacs

I am new to emacs and wondering how I would get it to load a theme of my choosing (http://lambda.nirv.net/m/files/color-theme-chocolate-rain.el)
I am on ubuntu, and have no idea what I am doing (yet :P) in regards to Emacs, for the most part.

This should work (you probably need to change color-theme-tty-dark to color-theme-chocolate-rain:
;; Enable a color theme
(require 'color-theme)
(color-theme-initialize)
(color-theme-tty-dark)

Download the theme folder or download the '.el' file.
Since you are on ubuntu you'll need to copy the '.el' file in to your theme-load path.
Or create your custom theme-load path as follows
Make a directory ~/.emacs.d/themes
Open the '.emacs' file in emacs
enter the following line at the end of the file
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
after copying the '.el' file, add the following line in the .emacs file
(load-theme 'theme name)
e.g. (load-theme 'gotham)
Save the file and restart emacs.

Here you go: http://www.nongnu.org/color-theme/.

Related

Emacs (24.4.1) will not open installed package

I am a newbie Emacs user, and have a problem when trying to install a new Emacs package. The package is https://github.com/tlh/workgroups.el.
I followed the file installation instructions in the accompanying README.md file: I copied the content of the "workgroup.el" into a new textfile with the same name, saved it to the same directory as my init.el file ("Put workgroups.el somewhere on your Emacs load path"), and added (require 'workgroups) to my init.el file ("Add this line to your .emacs file: (require 'workgroups)").
However, when saving and closing Emacs, and then opening my init file I get the
following error message
"File error: Cannot open load file, no such file or directory, workgroups "
Why doesn't Emacs recognize the new package?
Thanks in advance for any help : )
The directory where your init file lives (which is either your home directory or your ~/.emacs.d directory) is not in your Emacs load-path by default, and should not be added to it. (Recent versions of Emacs will complain if you do that.)
Instead place the new elisp library into a sub-directory named something like ~/.emacs.d/lisp, and add that to your load-path, by adding the following to your init file:
(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))

why cant emacs 24 find a custom theme I added?

My entire emacs setup is here
I loaded my init-theme.el file here
And supposedly that should make the darkclean theme available.
But when I type M-x load-theme TAB the darkclean theme is not listed.
How can I register it for Emacs 24?
If you install themes via elpa / package.el you'll notice that you need to add each theme folder into your custom-theme-load-path - this is a bit of a pain to do manually, especially when you take into account upgrades will create a new folder, e.g. 0.1.0 -> 0.1.2 will be a new folder inside your elpa folder.
Assuming you've installed your elpa packages into ~/.emacs.d/elpa/ add this script to your ~/.emacs.d/init.el
(require 'dash)
(require 's)
(-each
(-map
(lambda (item)
(format "~/.emacs.d/elpa/%s" item))
(-filter
(lambda (item) (s-contains? "theme" item))
(directory-files "~/.emacs.d/elpa/")))
(lambda (item)
(add-to-list 'custom-theme-load-path item)))
You'll need dash.el and s.el (available from elpa.)
init-themes has commented out the load path.
I have this (add-to-list 'custom-theme-load-path "~/.emacs.d/themes") and i think it found all my themes with M-x load-theme, enter then hit tab to see all the themes.
there was no search in the github for your repo, so i couldn't grep to see if you are doing it elsewhere. Also is your darkclean compatible with a 24 theme?
Edit: 1
actually i thought of another debug technique to rule out it being darkclean vs setup. put into your directory the
solarized theme and if you don't see it in your load-theme you know it's you and not a theme, as solarized worked for me this way on emacs 24.
I don't enjoy it, and prefer wombat actually.
I m new to emacs and wanted to add some custom themes and create my own as well.
first add this
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
then add any new theme to that folder.
This first did not work and when i used load-theme the themes in ~/.emacs.d/thems where not loaded.
the documentation says:
Each theme file is named THEME-theme.el, where THEME is the theme
name.
so renaming darklean.el to darkclean-theme.el did the trick
I think you need to set custom-theme-directory and then include the
sha256 hash in custom-safe-themes to remove the confirmation prompt
everytime you load it. To insert the sha256 hash, you can use the
customize interface, as then it is calculated for you. To enable the
theme, you will have to include it in custom-enabled-themes.
Below is an example from my setup:
(custom-set-variables
;; ...
'(custom-enabled-themes (quote (dark-emacs)))
'(custom-safe-themes (quote ("<SHA256 hash goes here>" default)))
'(custom-theme-directory "~/.emacs.d/themes/")
)
To see my actual setup, take a look at the following links:
my custom file
my dark theme

How to install a Emacs plugin (many times it's a .el file) on Windows platform?

I'm new to Emacs. I found many emacs plugins are released as an .el file. I'm not sure how to install them. Can I just put them in my emacs installation directory?
After placing it, say myplugin.el to your ~/.emacs.d/ directory, add the following in your .emacs file:
(add-to-list 'load-path "~/.emacs.d/")
(load "myplugin.el")
Also, in many cases you would need the following instead of the second line:
(require 'myplugin)
In any case, you should consult the documentation of the package you are trying to install on which one you should use.
If you are unsure where your ~ directory is, you may see it by typing C-x d ~/ and pressing Enter.
As already stated, you'll need the location of the file to be in Emacs' load path.
Read the comments at the top of the file to see if it has any particular installation or usage instructions. Authors often provide this information, and there isn't one single correct way to do it, so it's sensible to look.
Failing that, if the file contains a (provide 'some-name) line (typically at the end of the file), then you would be expected to use (require 'some-name) to load it.
You may also wish to byte-compile the library for speed (but that's a different question).
Many times, an emacs plugin will consist of a directory of elisp files that need to be accessible from the load path. A simple way to ensure that all individual elisp files as well as subdirectories of elisp files are included in the load path and accessible is to do something similar to the following:
Create a directory called ~/.emacs.d/site-lisp.
Install any single elisp files in the ~/.emacs.d/site-lisp directory.
Install any packages that consist of multiple elisp files in a subdirectory under your ~/.emacs.d/site-lisp directory.
Add the following code to your ~/.emacs file to ensure that Emacs "sees" all the elisp files that you have installed:
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(progn (cd "~/.emacs.d/site-lisp")
(normal-top-level-add-subdirs-to-load-path))
This will ensure that all elisp files that are located either in either the ~/.emacs.d/site-lisp directory or in a subdirectory under that directory are accessible.
Some supplementary information:
MATLAB.el comes from http://matlab-emacs.sourceforge.net/
On windows, use the load path that looks like this:
(add-to-list 'load-path' "C:\\Dropbox\\Portable\\emacs\\matlab-emacs")
If you want FULL MATLAB functionality you should use:
;;MATLAB Mode:
(add-to-list 'load-path' "C:\\Dropbox\\Portable\\emacs\\matlab-emacs")
(require 'matlab-load)
if you just want to edit text files:
;;MATLAB Mode:
(add-to-list 'load-path' "C:\\Dropbox\\Portable\\emacs\\matlab-emacs")
(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t)
(setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist))
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)

How to install emacs colortheme

I found this website and downloaded the color-theme files.
It says:
Put the file color-theme.el and the
folder “themes” (with the files
color-theme-example.el and
color-theme-library.el) in a directory
on your LoadPath.
and then I checked the load path website, which says:
To add a single directory to the load-path:
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
My question is, where do I type this line?
If I do M-x and then type, it complains add-to-list[No match].
By the way, I am using Emacs 23.2(9.0) on Mac, a GUI version.
For the text version on terminal, I use black background seems fine, except the blue is too dark on black
An answer for newbs like me!
In Emacs 24.5.1, on mac or linux the following will work.
The following command will create a folder called themes inside your .emacs.d folder (assuming one does not already exist)
mkdir ~/.emacs.d/themes/
Now tell emacs that you have installed a themes folder. In emacs open your .emacs file, by typing the following:
C-x C-f ;;;this opens a new .emacs file or creates one if it doesn't exist
Add the following line to your .emacs file:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
Now copy your theme's '.el' file to your .emacs.d/themes/ directory. A good place to find custom themes is here: emacsthemes.com
Now load your custom theme by typing the following:
M-x customize-themes ;;;now press return
Your newly installed themes should appear on the list like so:
Move your cursor to within the '[ ]' and press return to select that theme.
Enjoy emacs!
You can download Emacs 24 for Mac from here and Emacs 24 already has a built-in theming system. You can call it by M-x customize-themes and choose whatever themes you like. And you can find much more themes online. There is actually a quite nice theme called "solarized", you can use it both in GUI and command line.
I load color theme by this code:
(load-file "~/.emacs.d/color-theme/themes/zenburn.el")
(zenburn)
You should put that line in your init file. This is usually the file ~/.emacs. The .emacs.d directory is a conventional directory for storing your personal customization files. Many of the instructions for installing packages (like color theme) or explaining other parts of Emacs (like the load-path page) assume you understand the init file.
.emacs and .emacs.d are really at the core of Emacs customization. If you read up on those, Emacs will make a lot more sense. I hope that helps!
In emacs 23, I thought color theme is installed by default. If not, and you need to add that line, write it in either file ~/.emacs.d/init.el, ~/.emacs.el or ~/.emacs

Plugin in Emacs

I'm trying to install lua-mode into emacs for windows but nothing seems to be working. I've set my HOME environment variable. I've added init.el and lua-mode.el to the HOME\.emacs.d directory. Then I've added the following code to init.el:
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
(add-hook 'lua-mode-hook 'turn-on-font-lock)
Nothing is working when I start up emacs and load a .lua file. The major mode is always set to fundamental and there are no other options to change to. What can I do to get this working?
It's possible that your init.el is never read, because you also have a .emacs file (or .emacs.el) in your $HOME directory. You can choose between those three alternatives for Emacs' init file, but only one of them will be read. Traditionally, that's .emacs but some operating systems have problems with that filename syntax.
Also, make sure that you placed init.el in your actual home directory, not a directory called "HOME" or something.
See here for further details on Emacs init files and here for more info on home directories.
If you're not keen on using the init.el variant, here are instruction that should make lua-mode work for you using .emacs:
Start a new Emacs
Type C-x C-f ~/.emacs <ENTER> (C-x means press CTRL, hold it, press x, release - same for C-f)
Insert the following lines:
(add-to-list 'load-path "/path/to/lua-mode-dir")
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
(add-hook 'lua-mode-hook 'turn-on-font-lock)
Type C-x C-s to save the buffer to file
Type C-x C-c to close Emacs
Note that in step 3 you have to adjust "/path/to/lua-mode-dir" with the actual path to the directory where you saved the file lua-mode.el on your hard disk.
maybe you need something like (require 'lua-mode) or something like that? Also make sure that the lua-mode file is in a directory in your load-path variable. Something like this before anything else:
(add-to-list 'load-path "/home/dervin/.emacs.d/site-lisp/")
or wherever, and then the require-
The lines look OK. This can depend on a number of things:
The init.el file is not loaded at startup. In face, this is a non-standard name when it comes to Emacs. Emacs tries to load the files ~/.emacs, ~/emacs.el, and ~/.emacs.d/init.el in order, and will load the first one found. To verify that you file has loaded, you could add (message "Loading my init.el") inside it and check the *Messages* buffer.
The directory where you stored the file lua-mode.el is not in the load path. In fact, the ~/.emacs.d directory is not part of the standard load path.