Emacs (24.4.1) will not open installed package - emacs

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"))

Related

Emacs init file cannot open load file OS X

I am trying to add haskell-mode to emacs, but I run into the error: cannot open load file.
This is what I've done...
First I downloaded the tar file for haskell-mode version 2.4 from here : http://projects.haskell.org/haskellmode-emacs/
After doing so, I have a directory full of mode and modules called haskell-mode-2.4 in my /Users/username/Downloads/....
The next step, I added this to my ~/.emacs.d/init.el (Note: I also tried adding it to my ~/.emacs as well) as specified here...http://doc.gnu-darwin.org/haskell-mode/installation-guide.html :
(load "/Users/username/Downloads/haskell-mode-2.4")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
But after doing all this, I get an error: cannot open load file.
Why is this so? Could it be that my emacs version does not support the haskell-mode?
Try the following:
(load "/Users/username/Downloads/haskell-mode-2.8.0/haskell-site-file")
Also, I'd suggest moving from Downloads to a different folder, but that's off topic ;)

Emacs polymode gives error when opening file

I downloaded the polymode zip-file from GitHub, open the zip-file which gives a folder named polymode-master . I renamed the folder to polymode and put it on my .emacs.d folder. Then I inserted the following lines into my .emacs file:
;; Polymode
(setq load-path
(append '("~/.emacs.d/polymode/" "~/.emacs.d/polymode/modes")
load-path))
(require 'poly-R)
(require 'poly-markdown)
When I open a file with emacs it gives me the following error:
Warning (initialization): An error occurred while loading `c:/Users/ab/.emacs':
File error: Cannot open load file, markdown-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
Any idea what I did wrong?
Thanks for help.
PS:
Windows 7
GNU Emacs 24.3.1
ESS
polymode depends on markdown-mode for its Markdown support, and it doesn't look like you have it installed.
Since you're using Emacs 24, which has package.el built-in, I strongly recommend installing it via MELPA stable (also available in regular MELPA and Marmalade), but if you're still installing packages manually you can find it on its website.

How to launch dired plus

I've placed the dired plus file in ~/.emacs.d, added (require 'dired+) to my ~/.emacs file and restarted Emacs. How do I launch dired plus?
Dired+ adds functionality to dired, so you don't launch Dired+ as such - just run dired as you would normally (e.g. M-x dired) and the added functionality should be available.
If Dired+ isn't loading, make sure that ~/.emacs.d is in your load-path - add this line to your init file if necessary:
(add-to-list 'load-path "~/.emacs.d")
Edit: As event_jr says, you should avoid adding .emacs.d to your load-path - create a new directory in ~/.emacs.d, install your Emacs Lisp files there, and add that directory to load-path. My answer was intended to fix your immediate problem, given where you'd installed the Dired+ file, not a recommendation to install packages in ~/.emacs.d.

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