0

I am using Emacs 24.5.1 and I seem to have a problem loading the web-mode package using use-package. I managed to narrow it down to the following .emacs file:

(require 'package)
(setq package-enable-at-startup nil)
(mapc (lambda(p) (add-to-list 'package-archives p t))
      '(("marmalade" . "http://marmalade-repo.org/packages/")
        ("melpa" . "http://melpa.org/packages/")
        ("org" . "http://orgmode.org/elpa/"))) 

(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

(use-package web-mode
   :init
   (progn
     (setq web-mode-enable-current-element-highlight t)
     (setq web-mode-enable-current-column-highlight t)
     (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
     (defun my-web-mode-hook ()
       "Hooks for Web mode."
       (setq web-mode-markup-indent-offset 2)
       (setq web-mode-css-indent-offset 2)
       (setq web-mode-code-indent-offset 2)
       (setq web-mode-style-padding 1)
       (setq web-mode-script-padding 1)
       (setq web-mode-block-padding 0)
       )
     (add-hook 'web-mode-hook  'my-web-mode-hook)
     (eval-after-load "web-mode"
       '(set-face-background 'web-mode-current-element-highlight-face "color-88"))
     )
   :ensure t)

When I start emacs with the above .emacs I get the message:

Warning (initialization): An error occurred while loading `/home/mperdikeas/.emacs':

Symbol's value as variable is void: <html>

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.

The backtrace with --debug-init is not much informative (to me at least):

Debugger entered--Lisp error: (void-variable <html>)
byte-code(\210  \210\n\210
\210\210\21\210        \210\n\210\210\f\210
\210\210\210\210\210\210\210\210\207" [<html> <head> <script type= >location\.href= </script> </head> <body> Authentication is required\. Click <a href= >here</a> to open the authentication page\. </body> </html>] 1)
require(web-mode nil noerror)
(not (require (quote web-mode) nil (quote noerror)))
(if (not (require (quote web-mode) nil (quote noerror))) (ignore (message (format "Could not load %s" (quote web-mode)))))
(progn (condition-case err (progn (setq web-mode-enable-current-element- highlight t) (setq web-mode-enable-current-column-highlight t) (add-to-list   (quote auto-mode-alist) (quote ("\\.html\\'" . web-mode))) (defalias (quote my- web-mode-hook) (function (lambda nil "Hooks for Web mode." (setq web-mode- markup-indent-offset 2) (setq web-mode-css-indent-offset 2) (setq web-mode-code- indent-offset 2) (setq web-mode-style-padding 1) (setq web-mode-script-padding  1) (setq web-mode-block-padding 0)))) (add-hook (quote web-mode-hook) (quote my- web-mode-hook)) (eval-after-load "web-mode" (function (lambda nil (set-face- background (quote web-mode-current-element-highlight-face) "color-88")))))  ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s"  "web-mode" ":init" (error-message-string err)) :error)))) (if (not (require  (quote web-mode) nil (quote noerror))) (ignore (message (format "Could not load   %s" (quote web-mode))))))
eval-buffer(#<buffer  *load*> nil "/home/mperdikeas/.emacs" nil t)  ; Reading at buffer position 1250
  load-with-code-conversion("/home/mperdikeas/.emacs"   "/home/mperdikeas/.emacs" t t)
  load("~/.emacs" t t)
  #[0 \205\262  \306=\203\30\310Q\202;  \311=\204\30\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317#\203:\320\ nB\321\202;\316\322\323\322\211#\210
                                                                         \322=\203a\324\325\326\30\327Q!\"\323\322\211#\210
                                       \322=\203`\210
                                                       \203\243\330
                                                                    !\331\232\203\243\332
     !\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335
 \"\203\237\336\337
                   #\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
 command-line()
 normal-top-level()
1

It appears that the installation of web-mode has failed. Instead of getting an elisp file, you got a user oriented HTML file telling you that you are not authorized to get the file. Try to download the file manually in order to understand what happened and why.

  • On closer inspection, I suspect a bug in use-package. It appears to not have detected the failure to download web-mode, instead happily storing the error message resulting from the failed download as if it were an actual elisp file. – Harald Hanche-Olsen Feb 24 '16 at 16:50
  • After manually installing web-mode (from list-packages) it now works. – Marcus Junius Brutus Feb 24 '16 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.