org-brain
org-brain copied to clipboard
eval-after-load: Symbol’s value as variable is void: org-brain-poly-hostmode
I've added the following to my (non-Evil) Gnu Emacs 27.1 .emacs, but get the above error when I hit "C-c b" -- what's wrong?
(use-package org-brain :after org polymode :bind ("C-c b" . org-brain-visualize-mode) :init (setq org-brain-path org-directory) ;; For Evil users (with-eval-after-load 'evil (evil-set-initial-state 'org-brain-visualize-mode 'emacs)) :config (add-hook 'before-save-hook #'org-brain-ensure-ids-in-buffer) (push '("b" "Brain" plain (function org-brain-goto-end) "* %i%?" :empty-lines 1) org-capture-templates) (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) )
(use-package polymode :config (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode) )
Hi!
It looks like there's something problematic with the way polymode
is loaded. Have you installed the package (assuming you're using use-package-always-ensure
)? You could try this:
(use-package polymode :defer t)
and then in the :config
part of org-brain
:
(add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode)
That works for me. Perhaps I need to update the README.
I too am now getting this issue, was there a recent update? Specifically:
org-brain-replace-links-with-visible-parts: Wrong type argument: stringp, nil
File mode specification error: (void-variable org-brain-poly-hostmode)
The first of those errors is in relation to me trying to visualize an entry from helm-brain
.
Edit: Hmmm, it seems that there may be a deeper issue, as now .org
files open as Fundamental
instead of in org-mode
...
P.S. I am a Doom user
I'm going to have to look at this more. There's a lot to the README that I have to figure out. In the meantime:
- I'm not sure org-brain-path is working right. I set it to a directory and org-brain adds "/brain" to it,
- You have a README.org already. Why not, as part of your packaging/release process, org-publish that into a .texi file that could then be run through 'makeinfo' to produce an org-brain.info file. Then create a simple 'dir' file in the package and the package install process should take care of adding your info file to Emacs Info.
@nanjigen No, I don't think there's a recent update causing this. Seems to be something with your config if org files aren't opened in org-mode
.
@DSMasterson The only function that changes org-brain-path
is org-brain-switch-brain
. The function org-brain-maybe-switch-brain
could trigger that function. If you've changed org-brain-path
after org-brain
is loaded then the variable org-brain-data-file
might have the wrong value, triggering org-brain-switch-brain
when you enter the directory of the data file. Regarding the texi thing I have never tried that (and don't know how), but it seems like a good idea.
Curiousity question: I see the LICENSE.org, README.org, and org-brain.el files in Github -- how do you package this for upload to MELPA? I thought there would be some sort of Makefile for that process.
Curiousity question: I see the LICENSE.org, README.org, and org-brain.el files in Github -- how do you package this for upload to MELPA? I thought there would be some sort of Makefile for that process.
I don't know how MELPA works, but when you upload to MELPA you only include a very small file containing information about the repo. Most information in the package manager is taken from the package description header in the main .el
file. I don't think it cares about LICENSE and README, but I might be wrong. I've never written av Makefile, so I'm sure that is not required :) My "packaging/release process" is simply to push a new version to the Github repo. I think tagged releases are pushed onto MELPA Stable, but I'm not 100% here (I seldom tag releases).
Interesting, Thanks.
@nanjigen No, I don't think there's a recent update causing this. Seems to be something with your config if org files aren't opened in
org-mode
.
I keep circling around this issue, first I will get this
File mode specification error: (void-variable org-brain-poly-hostmode)
org-brain-headline-at: Wrong type argument: stringp, nil
Then, if I go to the polymode section in org-brain.el
and manual evaluate it, I get the following:
File mode specification error: (invalid-function define-hostmode)
org-brain-headline-at: Wrong type argument: stringp, nil
Then, moving around a visualise buffer causes a stream of display errors:
Error during redisplay: (poly-lock-function 77) signaled (void-variable matcher)
Error during redisplay: (poly-lock-function 83) signaled (void-variable matcher)
Error during redisplay: (poly-lock-function 85) signaled (void-variable matcher)
I'm also facing this under NixOS and Nixpkgs/Darwin (without :ensure t
).
It's weird, but I tried installing org-brain.el
from a local checkout (as opposed to the version available in Melpa) and the error disappeared.
I deduced the version in melpa was lagging behind, but after diffing the checked out file and the Melpa version, the only difference is a ;; Package-Version: 20210108.1512
line. Well, that and the fact that the local checkout is being installed straight as $out/share/emacs/site-lisp/org-brain.el
instead of the location chosen by the Nix packaging.
I must be lacking some sleep or something, because I can't think of any possible explanation.
Hello, unfortunately here is the same error. I'm on Org-mode 9.4, actual MELPA version of org-brain, Emacs 28, Fedora 34. I load it with (require 'org-brain), (require 'polymode) No other configuration for polymode. Is it necessary?
Any ideas how to solve it? Without polymode org-brain works for me.
Regards Poul
I'm having a similar issue (on Windows); .org files open in org-mode (as they should) but org-brain gives this error in the use-package declaration and when trying to use any of its commands.
Based on the discussions in #320 I tried putting a no-compile setting: ;; --no-byte-compile: t; -- at the top of org-brain.el.
This fixed the initial problem and allows me to open org-brain-visualize, but causes a different issue when trying to move between nodes in org-brain (by using RET or by mouse-1). Removing the compiled .elc files in the org-brain folder and restarting Emacs lets org-brain work for some time. The first time I tried it the org-brain.elc file (and the problem) reappeared for some reason, but I removed it again and it hasn't caused any problems today.
P.S.: Here's the error I'm getting after putting the above "no-byte-compile" warning on org-brain.el and then trying to move between entries in org-brain-visualize. Adding the warning to both org-brain.el and org-brain-autoloads.el didn't get rid of this either, so I'm not sure why it's popping up: Lisp error: (void-variable entry) (org-brain-visualize entry) (lambda (_x) (org-brain-visualize entry))(#<marker (moves after insertion) at 83 in org-brain>) button-activate(#<marker (moves after insertion) at 83 in org-brain> nil) push-button(83) funcall-interactively(push-button 83) call-interactively(push-button nil nil) command-execute(push-button)
I must be lacking some sleep or something, because I can't think of any possible explanation.
It seems the issue has to do with the byte-compiler's treatment of the code, though I don't know enough about it to find an exact solution.
Adding a (require 'polymode)
to the top of org-brain.el
fixes this for me.
I've had this problem too, when I did use straight.el without use-package. But it works for me in combination with use-package. I presume the minimal working example is:
;;; BEGIN bootstrap straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;;; END bootstrap straight.el
(straight-use-package 'use-package)
;; Configure use-package to use straight.el by default
(use-package straight
:custom (straight-use-package-by-default t))
;; Allows you to edit entries directly from org-brain-visualize
(use-package polymode
:defer t)
(use-package org-brain
:config (add-hook 'org-brain-visualize-mode-hook #'org-brain-polymode))
I'm not sure if this would help (since I'm not having these issues) but perhaps someone could try:
In org-brain.el there's a line (with-eval-after-load "polymode"
. Try using "polymode-core"
instead of "polymode"
.