masasam / emacs-easy-hugo

Emacs major mode for managing hugo
https://gohugo.io/tools/editors/#emacs
GNU General Public License v3.0
355 stars 26 forks source link

preview errors: Symbol's function definition is void: url-do-setup #48

Closed NAndreasson closed 5 years ago

NAndreasson commented 5 years ago

I'm having some trouble when trying to use the preview function. It errors with the message Symbol's function definition is void: url-do-setup. Am I missing a dependency?

I'm new to Emacs so sorry if this issue doesn't make sense.

masasam commented 5 years ago

Hi @NAndreasson . Thanks for your comment. Perhaps I think that the setting of emacs is incorrect. Please tell me your OS, your emacs version, your .emacs setting and how to install your emacs and easy-hugo and so on.

NAndreasson commented 5 years ago

@masasam

I'm on macOS 10.14, Emacs version 26.1. If I remember correctly I just installed Emacs via Homebrew brew cask install emacs.

My config for setting up emacs-easy-hugo:

(defun cesco/easy-hugo ()
  (interactive)
  (evil-define-key
    (list 'normal 'insert 'visual 'motion)
    easy-hugo-mode-map
    "n" 'easy-hugo-newpost
    "D" 'easy-hugo-article
    "p" 'easy-hugo-preview
    "P" 'easy-hugo-publish
    "o" 'easy-hugo-open
    "d" 'easy-hugo-delete
    "e" 'easy-hugo-open
    "c" 'easy-hugo-open-config
    "f" 'easy-hugo-open
    "N" 'easy-hugo-no-help
    "v" 'easy-hugo-view
    "r" 'easy-hugo-refresh
    "g" 'easy-hugo-refresh
    "s" 'easy-hugo-sort-time
    "S" 'easy-hugo-sort-char
    "G" 'easy-hugo-github-deploy
    "A" 'easy-hugo-amazon-s3-deploy
    "C" 'easy-hugo-google-cloud-storage-deploy
    "q" 'evil-delete-buffer
    (kbd "TAB") 'easy-hugo-open
    (kbd "RET") 'easy-hugo-preview)
  (define-key global-map (kbd "C-c C-e") 'easy/hugo))

(use-package easy-hugo
             :init
             (setq easy-hugo-basedir "~/Code/blog/")
             (setq easy-hugo-url "https://nandreasson.se")
             (setq easy-hugo-preview-url "http://127.0.0.1:1313")
             (setq easy-hugo-postdir "content/blog")
             (add-hook 'easy-hugo-mode-hook 'cesco/easy-hugo))

I'm using evil-mode so therefore the hook for setting up keys.

masasam commented 5 years ago

@NAndreasson Thanks for report. There seems to be no problem in .emacs setting.

Symbol's function definition is void: url-do-setup.

Since `url-do-setup' is emacs standard function, it is strange that this error occurs. There are two things I want you to try. One is reinstalling emacs. Next is melpa package cleanup. Please don't use .elc compiled with emacs 25 in emacs 26.1. To do this please delete ~/.emacs.d/elpa directory and reinstall the melpa package. When emacs major version up, .elc needs to erase all and start over.

NAndreasson commented 5 years ago

@masasam Thanks for the answer. I'll try it out and get back to you.

NAndreasson commented 5 years ago

Interesting... After deleting the ~/.emacs.d/elpa directory it worked after all the packages were reinstalled. But when I closed and reopened emacs I got the same error again. Not sure what that suggests.

masasam commented 5 years ago

@NAndreasson Please try the following.

cd ~/.emacs.d/
find . -name '*.elc' | xargs rm

Maybe this will work out.

NAndreasson commented 5 years ago

Unfortunately, that did not work

masasam commented 5 years ago

@NAndreasson After installing emacs please install only easy-hugo. If this work out, it can conclude that other emacs settings cause problems.

NAndreasson commented 5 years ago

Sorry for not getting back to you. I started to play around with ox-hugo which seem to suit my current needs. I might investigate this further at a later point in time but closing this issue meanwhile as it's most probably related to my config.

Thank you for being super helpful though!