centaur-tabs-build-helm-source "fix"
M-x centaur-tabs-build-helm-source shows the following error message:
centaur-tabs-build-helm-source: Invalid function: helm-build-sync-source
System info
Centaur-tabs:
- ;; Version: 5
- centaur-tabs-20200821.335/
GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21 Windows 10 2004
Setup
It was tested with the centaur-tabs and helm packages installed,
and these lines added to the init.el
(require 'centaur-tabs)
(centaur-tabs-mode t)
(global-set-key (kbd "C-<prior>") 'centaur-tabs-backward)
(global-set-key (kbd "C-<next>") 'centaur-tabs-forward)
(require 'helm)
A possible solution
I searched for the invalid function name in Spacemacs and found that it's used in the julia layer:
https://github.com/syl20bnr/spacemacs/blob/3d5d4b2f280259daa737e8e3558eb6b61ae4ad54/layers/%2Blang/julia/funcs.el#L54
like this:
(helm :sources (helm-build-sync-source "test"
:candidates (spacemacs//julia-hash-to-alist julia-latexsubs)
:fuzzy-match t
:action (lambda (candidate) (insert candidate)))
:buffer "*helm julia latex insert*")
When (helm :sources is added to the centaur-tabs-build-helm-source function.
Before:
https://github.com/ema2159/centaur-tabs/blob/5453317b6b9f68bfbd934eee3b883207bfa331e0/centaur-tabs-interactive.el#L302-L310
After:
(defun centaur-tabs-build-helm-source ()
"Display a list of current buffer groups in Helm."
(interactive)
(setq helm-source-centaur-tabs-group
(when (featurep 'helm)
(require 'helm)
(helm :sources (helm-build-sync-source "Centaur-Tabs Group"
:candidates #'centaur-tabs-get-groups
:action '(("Switch to group" . centaur-tabs-switch-group)))))))
Then it seems to work as expected.

Issue:
The group choice(s) are not shown when there are two windows:

It's a refresh issue, when the helm buffer doesn't open correctly.
The list of candidates appear when:
- The cursor is moved:
C-norC-p - A character is typed.
@duianto Did you solve this issue for yourself? Is this something in centaur tabs that needs to be solved?
This issue occurs in centaur-tabs.
After installing centaur-tabs and helm from melpa.
Before
Calling: M-x centaur-tabs-build-helm-source shows:
centaur-tabs-build-helm-source: Invalid function: helm-build-sync-source
A possible solution
The fix seems to be to wrap (helm :sources ... )
around the expression: (helm-build-sync-source "Centaur-Tabs Group" ...
in the function:
https://github.com/ema2159/centaur-tabs/blob/cde3469d77f83b0877f2a7c727ca101cfeb86401/centaur-tabs-interactive.el#L303-L311
The emacs-helm wiki has some usage examples here: https://github.com/emacs-helm/helm/wiki/Developing#creating-a-source
With (helm :sources ... ) added.
After
M-x centaur-tabs-build-helm-source opens the expected *helm* buffer:

System info
centaur-tabs-20220112.1239 helm-20220211.1707 GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26 Windows 21H2