Can't get Emacs24 to load themes - emacs

To start off, my Emacs version is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-06 on barber, modified by Debian, and I am running Debian Jessie as the sole OS on a 2009 Macbook Pro.
So I've downloaded lots of themes off the net that I think would make working in Emacs much more soothing, and placed them in my ~/.emacs.d/themes/ folder. I've downloaded the emacs-goodies-el packages. I've set the custom load path for these themes to be in that specific folder. When I start, I either get one of two things depending on if I actually try to load the themes with (load-theme tron t), or not. Both errors are of the type Symbol's value as variable is void: <!DOCTYPE.
When I run Emacs in --debut-init, this is what I get:
Debugger entered--Lisp error: (void-variable <!DOCTYPE)
eval-buffer() ; Reading at buffer position 14
load-theme(jazz t)
eval-buffer(#<buffer *load*> nil "/home/finnds/.emacs" nil t) ;
Reading at buffer position 1203
load-with-code-conversion("/home/finnds/.emacs" "/home/finnds/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
When I try to load themes through M-x customize-themes, I get the error: load-theme: Symbol's value as variable is void: <!DOCTYPE, and all the colors go back to being white/light/default.
And here is my .emacs file, after the custom-set-variables and custom-set-faces (meaning this is put all the way at the bottom of the file):
(add-to-list 'custom-theme-load-path "~/.emacs.d/")
(load-theme 'jazz t)
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)))
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
I've tried doing exactly what the wiki tells me to do, and several other themesites, but I still keep getting this message. I tried searching for an answer, but there wasn't a particular one like my exact case, I found. Can anyone help me out here? Thanks in advance!

You are trying to load an HTML file, not an Emacs-Lisp file. It sounds like you saved the file wrong. <!DOCTYPE is what tells you this.
The article written by Bozhidar B. and cited by him is misleading. I recommend the EmacsWiki page about this instead. It fairly compares and contrasts color themes, which are provided by library color-theme.el, and custom themes, which were added to vanilla Emacs 24.
These two kinds of theme are not the same thing, and neither replaces the other, in spite of what you might hear. Each has its advantages (and disadvantages) and use cases.
And yes, you can use both -- it is not true that "you shouldn't be doing" this. Read the wiki page, get to know both of them, and then make up your own mind about what works for you.
I say this with no horse in the race. My code (Icicles and Do Re Mi) that lets you cycle themes etc. supports both kinds of themes equally: color themes and custom themes.

You're mixing the old color theme handling (based on the color-theme package) and the Emacs 24.x built-in support for themes, which you shouldn't be doing. I'd suggest having a look at this article to learn more about color themes in Emacs. Here's a minimal setup example (using the zenburn theme):
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(unless (package-installed-p 'zenburn-theme) (package-install 'zenburn-theme))
(load-theme 'zenburn t)
To load a theme that's locally available:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'theme-name t)
This assumes that you've placed an Emacs 24 compatible theme named theme-name in your ~/.emacs.d/themes folder.

Related

setting up semantic with cscope

I'm starting to experiment a bit with using emacs as my development envrionment and I am running into a bit of trouble. I wish to use cscope with semantic for a fairly robust way of searching through my code base. However, after installing cscope (with apt-get install cscope) and moving xscope.el into my ~/.emacs.d/, I am still having trouble calling some settings with my .emacs file. When I try to call (semanticdb-enable-cscope-databases), I get an error that the symbol's function definition is void. I am using emacs 24.3
(semantic-mode 1)
(global-ede-mode 1)
(require 'semantic/ia)
;; Semantic
(global-semantic-idle-completions-mode t)
(global-semantic-decoration-mode t)
(global-semantic-highlight-func-mode t)
(global-semantic-show-unmatched-syntax-mode t)
;; auto-complete stuff
(add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(ac-config-default)
(add-hook 'c-mode-common-hook '(lambda ()
;; ac-omni-completion-sources is made buffer local so
;; you need to add it to a mode hook to activate on
;; whatever buffer you want to use it with. This
;; example uses C mode (as you probably surmised).
;; auto-complete.el expects ac-omni-completion-sources to be
;; a list of cons cells where each cell's car is a regex
;; that describes the syntactical bits you want AutoComplete
;; to be aware of. The cdr of each cell is the source that will
;; supply the completion data. The following tells autocomplete
;; to begin completion when you type in a . or a ->
(add-to-list 'ac-omni-completion-sources
(cons "\\." '(ac-source-semantic)))
(add-to-list 'ac-omni-completion-sources
(cons "->" '(ac-source-semantic)))
;; ac-sources was also made buffer local in new versions of
;; autocomplete. In my case, I want AutoComplete to use
;; semantic and yasnippet (order matters, if reversed snippets
;; will appear before semantic tag completions).
(setq ac-sources '(ac-source-semantic ac-source-yasnippet))
))
(require 'xcscope)
(semanticdb-enable-cscope-databases) ;;This is causing problems
;;C mode
(require 'cc-mode)
;;Color theme
(require 'color-theme)
(setq color-theme-is-global t)
(add-to-list 'load-path "/home/bob/.emacs.d/theme/ample-theme/ample-theme.el")
;;(require 'ample-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-jsc-dark)))
;;set font
(set-face-attribute 'default nil :family "Anonymous Pro" :height 140)
;;line numbers
(global-linum-mode 1)
(custom-set-variables '(linum-format (quote "%4d \u2502 ")))
;;treat .h files at C++
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
;; use F5 as compile
(global-set-key [(f5)] 'compile)
;; make compilation window smaller
(setq compilation-window-height 8)
Now, I really start writing an answer to be able to refine it with time. That is how far I got until now:
There are several versions of cedet.
Emacs 24.3 includes cedet-2.0. But, with respect to the bazaar version cited below it seems to be slightly outdated.
I believe that in this version cscope is supported as one of the tools in semantic-symref-tool-alist.
The variable semantic-symref-tool-alist is described in the info manual. One gets there with the key strokes C-h i g (semantic-user) Configuring SymRef.
One can see the default value of semantic-symref-tool-alist after loading semantic/symref. One of its members is:
((lambda
(rootdir)
(file-exists-p
(expand-file-name "cscope.out" rootdir)))
. cscope)
I think that this is the cscope support in in the built-in version of cedet-2.0 and no additional enabling of cscope is required (?).
The official release is cedet-1.1 from https://sourceforge.net/projects/cedet/files/cedet/cedet-1.1.tar.gz/download.
In this version the function semanticdb-enable-cscope-databases is defined in the file semantic/semanticdb-cscope.el
The bazar-version of cedet is cedet-2.0. It is available via bazaar under:
bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/trunk cedet
In this version the function semanticdb-enable-cscope-databases is defined in cedet/semantic/db-cscope.el.
This file is missing in the version of cedet shipped with emacs 24.3.
Σ: That makes me believe that if you want to use your setup you should use the bazaar version of cedet-2.0.

How to fix "Symbol's function definition is void" while loading up a color theme in emacs24?

When I load my .emacs, although the color theme, twilight, loads up fine, but it shows me this error message:
Symbol's function definition is void: color-theme-twilight
In my .emacs I have put the following lines to add the color theme:
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-twilight)
The color-theme-twilight.el file lives in ~/.emacs.d/themes/
I looked at this question. But the solution there is a correction to a typo. But I am not making that typo. I am on emacs24. What is the problem?
Solved the problem. Removed all the lines :
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-twilight)
And just added:
(load-file "~/.emacs.d/themes/color-theme-twilight.el")
The problem was the last line:
(color-theme-twilight)
Other three lines are not required at all. Not sure if this is the most elegant solution.
If you are using emacs 24, I think you could change the 4 lines you include by this single line:
(load-theme 'twilight t)
No extra requires; this use the emacs 24 theme approach.
If you are using a recent version of twilight, that should give you no error.
You say "The color-theme-twilight.el file lives in ~/.emacs.d/themes/." But I don't see where you load that file. Add (require 'color-theme-twilight) to your init file, and make sure color-theme-twilight.el is in your load-path.

How to highlight current argument in SLIME

I am using sbcl with GNU Emacs 24.3.1 and the 2012-04-14 release of SLIME, on Arch Linux to write some Common Lisp code. When writing an expression, if I type, for example
(if
the minibuffer will display
(if TEST THEN &OPTIONAL ELSE)
Is there a mode or SLIME setting that can make the argument that I'm currently editing be highlighted in the minibuffer? For example, if I type
(if (> x y)
it would be great if
(if TEST *THEN* &OPTIONAL ELSE)
or something similar was displayed in the minibuffer.
The strange thing is that you have documentation in minibuffer with this configuration. Maybe your distribution also loads it from a different location.
Please try this config:
(setq inferior-lisp-program "/usr/bin/sbcl")
(add-to-list 'load-path "~/.emacs.d/slime-2012-04-14/")
(require 'slime)
(require 'slime-autoloads)
(slime-setup '(slime-autodoc))
It tells Emacs to load and use slime-autodoc module that displays documentation and in minibuffer and highlights it as you'd like it to be.
Maybe you'd also like to update to a more recent SLIME version (the current one in ELPA is 20130402).

Emacs for Windows error loading color theme

I'm using emacs 24.3 on Windows 8. I have installed the solarized color theme from the marmalade repository, and am able to set it using M + x load-theme. It also sets for the current session when I use Customize, but doesn't load when I open emacs again.
I can open the customize menu and select the theme, but saving the changes does nothing, and nothing changes between that and my next session. I looked at several questions here about color themes, but most do not apply to Emacs 24, since I don't need to use color-theme to do it.
Below is a snippet from my .emacs file.
(custom-set-variables
'(custom-enabled-themes (quote (solarized-dark)))
'(custom-safe-themes (quote ("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default)))
...
When I try to put (load-theme 'solarized-dark t) into my .emacs, I get the error:
error: Unable to find theme file for `solarized-dark'
I've checked the value of custom-theme-load-path after opening emacs and it includes the directory elpa uses to store the solarized theme. As mentioned above, I can load the theme manually, but something about loading it during init is breaking.
Just add
(package-initialize)
To the top of your .emacs file and you are good to go.
Side note: if the theme author has taken care of it, the theme will add itself to the custom-theme-load-path, however this is not a part of the deftheme and is down to individual theme authors implementing this behaviour.
To solve the problem, I made a quick snippet of emacslisp that will find packages with theme in their name, then add them to the custom-theme-load-path at startup.
Just add it near the top of your ~/.emacs or ~/.emacs.d/init.el (ie. before you load-theme
It has dependencies on s.el and dash.el (both available on elpa)
(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)))

Setting Emacs 24 color theme from .emacs

I have the following code in my .emacs:
(if (null window-system)
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1)))
When I open Emacs on the console, I can verify that the progn block runs (by a (message "Got here.")), and I see a flash that suggests that the color theme was loaded, but if it was loaded, it is overridden by something else. If, after loading, I open my .emacs file and submit the block above using C-x C-e, it works. I've tried doing:
(add-hook 'after-init-hook
(lambda ()
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1))))
but that acts the same.
It may be relevant that I'm using Emacs 24, and that this code is not in my .emacs, but in ~/Dropbox/.emacs, which is loaded from my .emacs.
An additional note: I've tried M-x customize-themes, but none of those work acceptably on the console. They either produce a nearly unreadable light theme, or most of the text is invisible.
Emacs 24 has built-in theming, which doesn't use statements like (require 'color-theme). As Drew points out in the comments, there are differences between color themes and custom themes, and the new direction is towards the latter. Try M-x customize-themes to take a look. From .emacs, you can do things like (load-theme 'wombat t).
But...
It may still be going wrong for you. One thing that can mess it up like this is changing the face -- maybe in the custom-set-faces part of your .emacs file. Emacs's interactive customization automatically includes the color information (both background and foreground) of whatever theme you happen to be using at the time you set it, so this can definitely make trouble with color themes. If that is what's causing it, you can just set the particular attribute you care about with something like
(set-face-attribute 'default nil :height 120)
That will change the font size without changing the colors.
Emacs 24 have own theming system.
M-x customize-themes
or
(custom-set-variables
....
'(custom-enabled-themes (quote (selected-theme)))
)