why cant emacs 24 find a custom theme I added? - emacs

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

Related

Emacs: can't autostart projectile installed through MELPA

I'm fairly new to emacs. In fact I'm learning the editor and trying to setup something that will replicate "go to a file inside the project" feature known from Code::Blocks or certain plugins of notepad++.
'projectile' fulfills this need, and I installed it through MELPA. Package installed properly, as I can start it with M-x projectile-global-mode and C-c p commands are recognized.
However, if I put it into my .emacs file, Emacs starts with an error:
Symbol's function definition is void: projectile-global-mode
Contents of my .emacs file are as follows:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(global-whitespace-mode 1)
(global-linum-mode 1)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(projectile-global-mode 1)
When I try to (require 'projectile) first, I only end up with another error:
'File error: Cannot open load file, projectile'
I'm using Emacs 24.3.1.
How do I put this on autostart properly?
By default, Emacs initializes packages after evaluated init.el. Hence, in a standard setup, packages are not yet available while init is evaluated.
Use (add-hook 'after-init-hook #'projectile-global-mode) to enable Projectile only after packages are initialized, or explicitly initialize packages at the beginning of your init.el with the following code:
(require 'package)
(setq package-enable-at-startup nil) ; To avoid initializing twice
(package-initialize)
You have to load projectile first, e.g. by using this:
(require 'projectile)
(projectile-global-mode)
you can add
'(initial-major-mode (quote projectile-global-mode))
to your .emacs(or init.el or whatever your file is called) file in the custom-set-variable section.
Alternatively, in newer versions of emacs, the menu Options | Customize Emacs | Specific Option you can type 'initial-major-mode' and this will take you to an interface where emacs can customize itself with that setting. just remember to apply and save

emacs can't find its things in its own load path

the following is output from a terminal session demonstrating that I, hopefully actually set this up right.
~ $cat .emacs
(require 'package)
(custom-set-variables
;;lots of comments generated by computer
'(package-archives (quote(("gnu" . "http://elpa.gnu.org/packages")
("marmalade" . "http://marmalade-repo.org/packages")
("melpa" . "http://melpa.milkbox.net/packages/")
("org" . "http://orgmode.org/elpa")))))
(custom-set-faces
;;again lots of comments added by the computer
)
(add-to-list 'load-path "/usr/share/emacs/24.3/site-lisp/mu4e")
~ $ ls /usr/share/emacs/24.3/site-lisp/mu43
#there are a lot of files here, but I am only going to show 2 right now
mu4e.elc
mu4e.el
... and yet emacs M-x mu4e returns [no match]. I have checked to load-path variable, and it is there. What am I doing wrong?
You need to add one more thing so that mu4e is loaded. There are two different ways to do this.
First, you could add (require 'mu4e) after you've added the path to your load-path. This will immediately load mu4e.
Alternatively, you could add the following:
(autoload 'mu4e "mu4e" "Launch mu4e and show the main window" t)
This will tell Emacs to load it lazily (i.e. not until you actually use it). Autoloading is documented here. (This is essentially done for you for packages installed via package.el - it's the same mechanism, you just don't need to specify it yourself).
The benefit of autoloads is that Emacs's initial startup is faster, since rather than loading every package right away it waits until you use them.

Configuring auto-complete when it is installed as a package

I used to have the following line in auto-complete:
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
(ac-config-default)
but now that I installed auto-complete as an Emacs package, I don't have an auto-complete folder in my .emacs.d directory anymore, so the second line above does not work.
This leads me to two questions:
More generally, where are packages installed?
How should I adapt my add-to-list line now that I have auto-complete installed as a package?
By default (in newer versions of auto-complete) the directory used will the the one in the site-lisp folder where emacs installed the package so that line is not required. Simply placing
(setq-default ac-sources
'(ac-source-abbrev ac-source-dictionary
ac-source-words-in-same-mode-buffers))
In your .emacs will let auto-complete know the sources you want for completion and the dictionary file will be placed appropriately.
If you want a custom dictionary (at least what I did) was
(add-to-list 'ac-dictionary-directiories "~/.dict")
Just make sure the directory you put exists.
EDIT: Forgot to mention that this is only if you want to add custom dictionaries to auto-complete (Java object higlighting or custom keywords, etc...). The language ones are enabled by default.

Customize the list of packages that emacs-prelude provides

I see at this link how emacs prelude ensures that a set of packages is installed when emacs starts. I was wondering if I could somehow extend the variable prelude-packages to add some other packages, without changing the prelude-packages.el file?
Barring that I was wondering how I could define a list of packages that are installed at start-up if they aren't currently installed.
You can place a .el file in personal/ directory in Prelude. Prelude loads any .el file it finds there in an alphabetical order. Below is the content of my personal/00-packages.el file.:
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
;; My packages
(setq prelude-packages (append '(
drupal-mode
nginx-mode
) prelude-packages))
;; Install my packages
(prelude-install-packages)
"00" is added to the file name to ensure that the file is loaded before all personal customizations. Add any new package you need to the list being appended to prelude-packages.
Also, if you want to use any mode that is not available in MELPA or Marmalade, you can simply drop the mode's file in personal folder and Prelude will pick it up while loading. If there are any customizations to that mode, simply create another .el file and add the Emacs Lisp code there.
Prelude recommends to use
(prelude-require-packages '(some-package some-other-package))
if you have several package. Or in case you want to add just one package:
(prelude-require-package 'some-package)
If you want you can still maintain your package list in a variable:
(setq my-packages '(drupal-mode nginx-mode toto-mode)
(prelude-require-package my-packages)
In your .emacs file you could add code like this (very similar to the code in the link you sent) to check if each package is installed and install it if is not:
(dolist (package '(eredis anything erlang elnode))
(unless (package-installed-p package)
(package-install package)))
In answer to your question there's no reason you can't do this after the prelude code has run.

How to set Emacs theme?

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/.