Search code examples
emacsload-path

emacs cannot load file highlight-current-line file-error


Emacs version : GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601) of 2013-03-18 on MARVIN

Copied the code for highlight-current-line from here. Created a text-file in .emacs.d, pasted the entire text on page in the text-file and saved it as highlight-current-line.el in the same folder.

Added the following lines to .emacs :

(add-to-list 'load-path "~/.emacs.d/")
(require 'highlight-current-line)   
(global-hl-line-mode t)
(set-face-background 'hl-line "white")
(setq highlight-current-line-globally t)

Restarted emacs and got this message :

Warning (initialization): An error occurred while loading `c:/Users/Owner/AppData/Roaming/.emacs':

File error: Cannot open load file, highlight-current-line

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.

Started emacs in debug mode and got this error in backtrace:

Debugger entered--Lisp error: (file-error "Cannot open load file" "highlight-current-line") require(highlight-current-line)
eval-buffer(# nil "c:/Users/Owner/AppData/Roaming/.emacs" nil t) ; Reading at buffer position 1209
load-with-code-conversion("c:/Users/Owner/AppData/Roaming/.emacs" "c:/Users/Owner/AppData/Roaming/.emacs" t t) load("~/.emacs" t t)

My system : Windows 7 32bit


Solution

  • Turns out copying text into notepad, saving it with .el in the file name and All files in the file type simply saves the file as highlight-current-line.el.txt .

    I used the Save link as option in the dropdown menu on the download link instead, which worked perfectly.