victorteokw / ac-html

Emacs auto complete source for html.
22 stars 9 forks source link

Symbol's function definition is void: ac-html-define-ac-source #31

Closed cdwfs closed 9 years ago

cdwfs commented 9 years ago

I use the ac-html package out of MELPA. Sometime last week I started getting an error message at startup that ac-html-define-ac-source is undefined. Curiously, it's only happening on my Linux system (Emacs 24.3.1); the same suite of packages works fine on Windows (Emacs 24.5.1). Do you have any idea what might be causing this error? I'm afraid I don't have much more to offer than that; my elisp-fu is pretty weak. I'm happy to provide further information about my setup if necessary.

victorteokw commented 9 years ago

Here is a example of setup ac-html for completion with web mode:

(eval-after-load "web-mode"
  '(progn
     (setq web-mode-ac-sources-alist
           '(("css" . (ac-source-words-in-buffer ac-source-css-property))
             ("html" . (ac-source-html-tag
                        ac-source-html-attr
                        ac-source-html-attrv))
             ("php" . (ac-source-words-in-buffer
                       ac-source-words-in-same-mode-buffers
                       ac-source-dictionary))))

(add-hook 'web-mode-hook
          (lambda ()
            (require 'ac-html)
            (require 'ac-html-default-data-provider)
            (ac-html-enable-data-provider 'ac-html-default-data-provider)
            (ac-html-setup)
            (auto-complete-mode)))

For slim, haml or jade, just remove the eval-after-load and require corresponding ac-slim, ac-haml or ac-jade. And add some code like this:

  (require 'ac-haml)
  (require 'ac-html-default-data-provider)
  (ac-html-enable-data-provider 'ac-html-default-data-provider)
  (ac-haml-setup)
  (setq ac-sources '(ac-source-haml-tag
                     ac-source-haml-attr
                     ac-source-haml-attrv))
  (auto-complete-mode)

If this doesn't fix for you, can you paste your emacs setup for ac-html?

cdwfs commented 9 years ago

Thanks; there's definitely a few things in the setup code you posted that I'm not doing, so I'll be adding those for sure. However, this error seems to occur at package load time, before I hit any of my setup/custimization code for web-mode or ac. If I force it to break at init time by loading packages at the beginning of my init.el:

(setq package-enable-at-startup nil)
(package-initialize)

and running emacs --debug-init, here's the backtrace I get:

Debugger entered--Lisp error: (void-function ac-html-define-ac-source)
  (ac-html-define-ac-source "haml" :tag-prefix "%\\(.*\\)" :attr-prefix ":\\(.*\\)" :attrv-prefix ac-haml-attrv-prefix :current-tag-func ac-haml-current-tag :current-attr-func ac-haml-current-attr)
  eval-buffer(#<buffer  *load*-825801> nil "/home/cort/.emacs.d/elpa/ac-html-20150904.2032/ac-html-autoloads.el" nil t)  ; Reading at buffer position 388
  load-with-code-conversion("/home/cort/.emacs.d/elpa/ac-html-20150904.2032/ac-html-autoloads.el" "/home/cort/.emacs.d/elpa/ac-html-20150904.2032/ac-html-autoloads.el" nil t)
  load("/home/cort/.emacs.d/elpa/ac-html-20150904.2032/ac-html-autoloads" nil t)
  package-activate-1(ac-html [(20150904 2032) ((auto-complete (1 4)) (s (1 9)) (f (0 17)) (dash (2 10))) "auto complete source for html tags and attributes"])
  package-activate(ac-html (20150904 2032))
  package-initialize()
  eval-buffer(#<buffer  *load*> nil "/home/cort/.emacs.d/init.el" nil t)  ; Reading at buffer position 480
  load-with-code-conversion("/home/cort/.emacs.d/init.el" "/home/cort/.emacs.d/init.el" t t)
  load("/home/cort/.emacs.d/init" t t)
  #[0 "\205\262   \306=\203\307\310Q\202; \311=\204\307\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\307\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()
ghost commented 9 years ago

The melpa package is broken. The autoloads are not set up correct. Delete the whole file and load it manually (like the snippet from cheunghy does). Also the completion-data folder is not inside the melpa package. You'll have to get it from the git archive.

victorteokw commented 9 years ago

Thanks!

I've opened pull request on melpa for including back the completion data. The other issues is fixed in the newest ac-html.

Currently, you may directly checkout this repo and put completion data into the package directory. After the pull request is approved by melpa, the completion data is automatically installed with ac-html.

If it still not working, notify me, I will investigate and fix.

cdwfs commented 9 years ago

Thanks; the error is gone in the new melpa build.