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.
Related
I just installed the emacs package dired-details from inside emacs via
M-x package-list-packages
clicked on the package name and then install in the newly opened buffer.
Then I put those lines into my .emacs:
(require 'dired-details)
(setq-default dired-details-hidden-string ">---< ")
(dired-details-install)
When I restart emacs, I get the following error:
File error: Cannot open load file, dired-details
The interesting thing is, that when I mark the code region above and apply
M-x eval-region
everything works as expected.
emacs --version
>> GNU Emacs 24.3.1
package version:
dired-details-20130328.1119
Packages you installed with package.el need to be initialized if you want to access them during emacs initialization.
Add the line
(package-initialize)
to the very beginning of your .emacs .
Also follow phil's recommendation and see the variable
package-enable-at-startup
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)
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.
I can't make Yasnippets work (normal version).
When I start Emacs it says:
error: Error ~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/ not a directory
I added this to my .emacs file:
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/")
and my yasnippets files are placed in the following folders:
D:\Program Files\emacs-23.1\site-lisp\plugins\yasnippet-0.6.1c
and the snippets:
D:\Program Files\emacs-23.1\site-lisp\plugins\yasnippet-0.6.1c\snippets
All others plugins work so I'm sure its the right load-path
Help!
Perhaps you could write the whole path, instead of a relative one, like this:
add-to-list 'load-path
"D:/Program Files/emacs-23.1/site-lisp/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "D:/Program Files/emacs-23.1/site-lisp/plugins/yasnippet-0.6.1c/snippets")
Notice the forward slashes, and please make sure that emacs doesn't mind the spaces... Windows is less forgiving than Linux with these kinds of paths. Also, make sure your emacs install reads that dir. Usually, you should put an emacs dir where your .emacs is (in Windows), that makes it more clear. It
Another thing: 1) maybe you're trying your snippet in the wrong mode. Make sure there is a snippet for the mode you're in.
See here as well, lots of info here: GNU Emacs for Windows
I'm trying to use slime from CVS (2009-01-05) but keep getting this error:
LOAD: A file with name
/usr/share/common-lisp/source/slime/swank-loader.lisp does not exist
I've stripped my .emacs down to just:
(setq inferior-lisp-program "/usr/bin/clisp")
(add-to-list 'load-path "/home/ssm/lisp/slime/")
(require 'slime)
(slime-setup)
I've deleted my ~/.slime directory, started with 'emacs -q' and eval'd the above code but I keep getting the LOAD error when I run slime (via M-x slime). Any ideas on how to fix this error?
FWIW, I've tried to install slime via apt-get but I keep getting errors there too about cl-swank being broken. That's a whole different story.
Have you purged the slime pkg you installed via apt-get? It looks like emacs is still reading the old site-specific configuration setup by apt-get. Try starting emacs with the -Q option, which prevents loading of site-specific (as well as user specific) customization, and see if the problem still occur.
I agree with huaiyuan that older files may be being picked up.
Try (load-file "/path/to/slime.el") instead of require. (You did remove the .elc files from your old versions, right? emacs will load from .elc files in preference to .el files, even when the .el is newer.)
The next thing to try is M-x customize-variable slime-backend and setting that to the absolute path of swank-loader.lisp. I think that will fix it for sure, but I am not sure why it doesn't work to begin with.
Thanks guys, ~/.emacs:
(setq inferior-lisp-program "<path-to-lisp-compiler>/bin/lisp")
(setq slime-backend "<path-to-slime>/swank-loader.lisp")
(add-to-list 'load-path "<path-to-slime>/")
;;(require 'slime)
(load-file "<path-to-slime>/slime.el")
;;(slime-setup)
(slime-setup '(slime-fancy))
works :)