Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalide function: define-hostmode #381

Open
ChloeZhou1997 opened this issue Oct 28, 2022 · 2 comments
Open

Invalide function: define-hostmode #381

ChloeZhou1997 opened this issue Oct 28, 2022 · 2 comments

Comments

@ChloeZhou1997
Copy link

Hi, I am trying to configure the org-brain and my configuration looks the following:

(use-package org-brain
    :ensure t
    :init
    (setq org-brain-path "~/Notes/")
    :config
    (bind-key "C-c b" "~/Notes")
    (setq org-id-track-globally t)
    (setq org-id-locations-file "~/.emacs.d/.org-id-locations")
    (add-hook 'before-save-hook 'org-brain-ensure-ids-in-buffer)
    (setq org-brain-visualize-default-choices 'all)
    (setq org-brain-title-max-length 12)
    (setq org-brain-include-file-entries nil
	  org-brain-file-entries-use-title nil))

  ;; Allows you to edit entries directly from org-brain-visualize
  (use-package polymode
    :config
    (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode))

However, I receive the following error message from the warning section:

Error (use-package): polymode/:catch: Invalid function: define-hostmode

and if I run

  ;; Allows you to edit entries directly from org-brain-visualize
  (use-package polymode
    :config
    (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode))

The backtrace throws me with

Debugger entered--Lisp error: (invalid-function define-hostmode)
  define-hostmode(#<pm-host-chunkmode org-brain-hostmode> :mode org-brain-visualize-mode)
  #f(compiled-function () #<bytecode -0x11008be9a7eb8555>)()
  funcall(#f(compiled-function () #<bytecode -0x11008be9a7eb8555>))
  do-after-load-evaluation("/Users/zhouqiaohui/.emacs.d/elpa/polymode-20220820...")
  require(polymode nil t)
  (not (require 'polymode nil t))
  (if (not (require 'polymode nil t)) (display-warning 'use-package (format "Cannot load %s" 'polymode) :error) (condition-case err (progn (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode) t) ((debug error) (funcall use-package--warning274 :config err))))
  (condition-case err (if (not (require 'polymode nil t)) (display-warning 'use-package (format "Cannot load %s" 'polymode) :error) (condition-case err (progn (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode) t) ((debug error) (funcall use-package--warning274 :config err)))) ((debug error) (funcall use-package--warning274 :catch err)))
  (progn (use-package-ensure-elpa 'polymode '(t) 'nil) (defvar use-package--warning274 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case err (if (not (require 'polymode nil t)) (display-warning 'use-package (format "Cannot load %s" 'polymode) :error) (condition-case err (progn (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode) t) ((debug error) (funcall use-package--warning274 :config err)))) ((debug error) (funcall use-package--warning274 :catch err))))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

How should I deal with the problem?

@Kungsgeten
Copy link
Owner

Hmm, it seems like org-mode tries to use functionality from polymode even though polymode isn't loaded yet. That shouldn't be the case, but I might be doing something wrong when checking if polymode is available.

Try moving polymode before org-brain in your init-file, or try adding :after polymode in the org-brain use-package declaration.

@pymander
Copy link

I'm seeing this error, too. I believe it is because define-hostmode is a macro instead of a function. I'm not sure how to fix the problem, but it is keeping me from using my brain!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants