Closed Wheest closed 3 years ago
Hi! The linked commit above is the change I've done to the helm
integration. helm-build-sync-source
seems to be used before too, so I don't know why this appears as an error for you just now. I myself use a later version of helm
than you: 20200905. It could be the case that the code in org-brain
is run before helm
is loaded, but that shouldn't be the case (I think) since it is in within with-eval-after-load
.
You could try (require 'helm-source)
in your init before loading org-brain
. I'm not sure, but it may work (I don't know the internals of helm
very well).
Thanks for the quick reply!
Unfortunately this hasn't worked for me, even with use-package :requires 'helm-source
. I'm on a distribution that should be loading helm earlier anyway.
Not sure about the path forward here is, but if I figure it out I'll be sure to share it here.
Org-brain is a backbone package for me, so thanks for all the work!
Maybe this has something to do with it all? https://github.com/alphapapa/org-ql/issues/60 It says something about Nix and Guix (which I am not familiar with).
I'm on a Debian-like setup, not using Nix, at least not yet.
My distribution is Spacemacs. I did try your linked commit above, but unfortunately no such luck. Same with reinstalled from elpa.
From the linked issue, the OP seemed to fix their issues be having
;; (require 'helm)
;; (require 'helm-org)
Uncommented at the start of their init, as I have done.
One thing to note is that on start, my Compile-Log buffer is populated with lot's of org-brain messages, and I highlight the final one which shows the source of the error in another light:
In org-brain-display-face:
org-brain.el:525:30:Warning: reference to free variable ‘org-brain-selected’
In org-brain-open-resource:
org-brain.el:1296:4:Warning: ‘org-open-link-from-string’ is an obsolete
function (as of Org 9.3); use ‘org-link-open-from-string’ instead.
In org-brain-rename-file:
org-brain.el:1878:74:Warning: value returned from (cdr e) is unused
org-brain.el:1897:35:Warning: ‘replace-regexp’ is for interactive use only;
use ‘re-search-forward’ and ‘replace-match’ instead.
In org-brain-insert-relationships:
org-brain.el:1956:37:Warning: ‘org-make-link-string’ is an obsolete function
(as of Org 9.3); use ‘org-link-make-string’ instead.
In org-brain-visualize:
org-brain.el:2404:68:Warning: assignment to free variable
‘org-brain-mind-map-parent-level’
org-brain.el:2404:100:Warning: assignment to free variable
‘org-brain-mind-map-child-level’
org-brain.el:2403:11:Warning: reference to free variable
‘org-brain-visualizing-mind-map’
org-brain.el:2404:28:Warning: reference to free variable
‘org-brain-mind-map-parent-level’
org-brain.el:2404:28:Warning: reference to free variable
‘org-brain-mind-map-child-level’
In org-brain-vis-title:
org-brain.el:2517:50:Warning: reference to free variable
‘org-brain-visualizing-mind-map’
In org-brain-insert-resource-button:
org-brain.el:2565:15:Warning: ‘org-open-link-from-string’ is an obsolete
function (as of Org 9.3); use ‘org-link-open-from-string’ instead.
In org-brain-add-resource:
org-brain.el:2592:38:Warning: ‘org-bracket-link-regexp’ is an obsolete
variable (as of Org 9.3); use ‘org-link-bracket-re’ instead.
org-brain.el:2598:30:Warning: ‘org-make-link-string’ is an obsolete function
(as of Org 9.3); use ‘org-link-make-string’ instead.
org-brain.el:2831:13:Warning: reference to free variable
‘org-brain-select-map’
org-brain.el:2847:13:Warning: reference to free variable ‘org-brain-move-map’
org-brain.el:3209:20:Warning: reference to free variable
‘org-brain-poly-hostmode’
org-brain.el:3212:21:Warning: reference to free variable
‘org-brain-poly-innermode’
org-brain.el:3219:20:Warning: reference to free variable ‘org-brain-polymode’
org-brain.el:3223:41:Warning: reference to free variable
‘polymode-move-these-vars-from-old-buffer’
org-brain.el:3223:41:Warning: assignment to free variable
‘polymode-move-these-vars-from-old-buffer’
org-brain.el:3244:15:Warning: reference to free variable
‘org-brain-polymode-map’
In org-brain-link-complete:
org-brain.el:3292:22:Warning: reference to free variable
‘org-insert-link-history’
org-brain.el:3292:22:Warning: assignment to free variable
‘org-insert-link-history’
In org-brain-link-store:
org-brain.el:3300:6:Warning: ‘org-store-link-props’ is an obsolete function
(as of Org 9.3); use ‘org-link-store-props’ instead.
In end of data:
org-brain.el:3485:1:Warning: the following functions are not known to be
defined: ivy-completing-read, helm-completing-read-default-1,
define-hostmode, define-innermode, define-polymode,
helm-marked-candidates, helm-make-actions, helm-build-sync-source,
helm-build-dummy-source, helm, ivy-read, ivy-set-actions
I should probably fix these compilation warnings, but I don't think they're the problem. Here's a Spacemacs user with a similar problem: https://www.gitmemory.com/issue/syl20bnr/spacemacs/12096/475978660
Seems to be something about compiled files here. You can try the suggested solution, but replace dumb-jump with org-brain
Drat, I never should have listened my friend getting me to move from base to spacemacs, but the modeline is so pretty.
I followed the steps in the issue, recompiling org-brain, and also completely removing the elpa directory for it and it being reinstalled.
I'm not sure if spacemacs uses a tweaked version of Helm or what? I'll link to this issue in an issue I'll open with spacemacs.
Well you could have the pretty modeline in "base" too, I think its available as a package :) Anyway Spacemacs is just an Emacs configuration, so I don't think they're to blame. I've had problems myself with compiled packages causing issues when installing/upgrading packages. I've never really understood what is causing it all, but at least I've learned to recognize the problem and to fix it. I'm happy you got it working!
Yeah, my main reason for switching is it that Spacemacs seemed to have some nice default configuration, especially for C/C++, which I could never get right on my GNU Emacs setup.
My issue isn't quite working yet I'm afraid, and I've noticed that it also impacts other packages, e.g. running functions in markdown-mode gives the error helm--completing-read-default: Symbol’s function definition is void: helm-subr-native-elisp-p
. It seems something deeper is at play, it's just infuriating since there have been no init-file changes on my end.
I may need to declare Emacs bankruptcy at the weekend, and purge everything, build up my init again. Autumn cleaning I suppose ':)
@Kungsgeten just fyi from: https://github.com/syl20bnr/spacemacs/issues/14167#issuecomment-735430490
Putting
(eval-and-compile (require 'helm-source))
into org-brain.el
fixed my Invalid function: helm-build-sync-source
problem
I had to declare .emacs
bankruptcy, and even a fresh install of Spacemacs and a new init file had the same issues. Have gone back to GNU Emacs, though out of the box I got the Invalid function: helm-build-sync-source
error.
Thus I had to put (eval-and-compile (require 'helm-source))
at the top of org-brain.el
Same problem here. Is there any way to fix this in the setup, instead of modifying the source code?
It's a somewhat nuclear option, but if org-brain is as key to you as it is to me, it might be worth it. Switch to another framework rather than Helm.
My bankruptcy took me through GNU Emacs, and then into the loving arms of doom-emacs, which uses Ivy. Though you can try Ivy or similar in your own setup.
@Wheest The problem only exists when i install the org-brain with the "package" system. If i clone the repo and eval the org-brain.el directly, everything works fine. So the problem is introduced in the process of byte-compiling, maybe @Kungsgeten can fix that in the packaging process.
I byte-compile the "org-brain.el" with "emacs -q" and evalulate the "elc" file later in normal environment with helm loaded. Same problem happens. It seems like org-brain has no dependence on helm, so the package system ignored the loaded helm and leaved the "helm-build-sync-source" undefined when compiling. I added "dont-compile" around the body as follows:
(with-eval-after-load "helm" (dont-compile orig-body))
The above process was repeated and the problem was fixed. Maybe that can be an ugly fix.
Also the problem only happens on macro, function works fine. There should be some better ways to avoid this problem.
Okay, maybe something else can be used instead of the macro. Since it all works for me it is a bit hard to debug.
Maybe using helm-make-source instead of helm-build-sync-source and helm-build-dummy-source could fix this.
I used "macroexpand-all" to expand "helm-brain--source" and "helm-brain--fallback-source", and got the results as follows:
(defvar helm-brain--source
(helm-make-source "Brain" 'helm-source-sync
:candidates #'org-brain--all-targets
:action 'helm-brain--actions))
(defvar helm-brain--fallback-source
(helm-make-source "New entry" 'helm-source-dummy
:action (helm-make-actions
"Visualize" #'(lambda (x)
(org-brain-visualize (org-brain-get-entry-from-title x)))
"Add children" 'helm-brain--add-children
"Add parents" 'helm-brain--add-parents
"Add friends" 'helm-brain--add-friends)))
The problem was fixed by avoiding the use of macro.
@Kungsgeten I have opened a pull request to fix this problem, by replacing helm-build-sync-source with helm-make-source, #343.
Should be fixed due to @hitswint PR #343 Thanks!
After running routine updates, I found that all org-brain methods now fail with the message:
Invalid function: helm-build-sync-source
.I haven't noticed any other packages fail, including helm itself. The function is called on line 3400 of the master branch, though I am running the latest on my package repo:
org-brain-20201120.2132
.I'm running
helm-20200818.742
, so maybe this function has been deprecated?Any idea what the issue is?