fixing emacs “cannot open load file” errors
January 3rd, 2007 by Lawrence David
it’s been a bit of a hassle getting emacs to read python files in python-mode. in spite of downloading a python-mode file and putting it in my boot path, emacs still refused to enter python mode. i kept getting the error message:
file-error “Cannot open load file” “python-mode”
turns out the problem was that i needed to specify emacs’ own load-path, by inserting the following line into my .emacs file:
(add-to-list ‘load-path “/Users/user_name/bin/”)
where “/Users/user_name/bin/” is the directory i’ve placed my python-mode.el file into.
Thanks for the tip .. I was using wrong syntax for my path (C:\Users\…)
Great! It worked for me for setting up the matlab mode.
Here’s a shell script I use:
#!/bin/bash
usage()
{
echo >&2 “$0 [-d directory [directory ...]] file.el [file.el ...]
where is added to the load-path during compilation.”
[ $# -eq 0 ] || echo >&2 ”
$@”
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
–help|-h|-’?') usage;;
-d)
[ $# -gt 1 ] || usage “Missing directory argument for -d”
DIRECTORIES=”$DIRECTORIES $2″; shift
;;
*) break;;
esac
shift
done
for directory in $DIRECTORIES; do
LOAD_PATH=”$LOAD_PATH –directory=$directory”
done
for file in “$@”; do
cd $(dirname $file)
emacs -batch -no-init-file $LOAD_PATH -f batch-byte-compile $file
done
Thanks for the tip, I thought (require ‘program) was all I needed.
Thanks for the valuable information.
It helped me to set matlab mode.
Great!
Thanks for the tip.
It helped me fix a “cannot open load file: gnuplot” error for emacs org-mode Org-babel-gnuplot on MacOS.
I had to add to my .emacs :
(add-to-list ‘load-path “/opt/local/share/emacs/site-lisp/”)
despite this path is the native installation path of
Emacs on MacOSX.
Emacs version 24.1.0, org-mode version 7.8.11
THANKS!
This worked for me. What not worked was symlinks from .emacs.d/ to the directory containing the *.el files.
I thought I have to say thank you for sharing I have been trying to do so and with no success it was just frustrating .
thanks again