Whenever I see some installation instruction for an emacs package it always suggests to use add-to-list 'load-path
it never works for me. For some reason and I have to use load-file
. For example, this will not work:
(add-to-list 'load-path "~/.emacs.d/jade-mode")
(require 'sws-mode)
(require 'jade-mode)
(add-to-list 'auto-mode-alist '("\\.styl$" . sws-mode))
(add-to-list 'auto-mode-alist '("\\.jade$" . sws-mode))
but this will work:
(l开发者_Python百科oad-file "~/.emacs.d/jade-mode/sws-mode.el")
(load-file "~/.emacs.d/jade-mode/jade-mode.el")
(require 'sws-mode)
(require 'jade-mode)
anybody can tell me why? EDIT: I use Carbon Emacs on MAC OS X 10.5
Perhaps the problem is that the leading tilde ('~') is not expanded when require
searches the entries in the load-path
list. Consider using the expand-file-name
function to prepare your entry for subsequent use by require
:
(add-to-list 'load-path (expand-file-name "jademode" "~/.emacs.d"))
or
(add-to-list 'load-path (expand-file-name "~/.emacs.d/jademode"))
It would help to know which Emacs you're using on which operating system.
i'm not 100% sure but i would guess that the list is not instantiated and thus you can't add anything to the load-path list, i just instantiate the list with
(setq load-path (cons (expand-file-name "~/.emacs.d/lisp")
load-path))
The first answer didn't work for me. Adding the directory path, not individual .el files, worked for me, i.e.:
(add-to-list 'load-path (expand-file-name "~/.emacs.d"))
精彩评论