Add these keywords to macro spacemacs|add-company-backends
:append-hooks controls wether we add the hooks to major mode hook variable
:call-hooks conrols wether we execute the created hooks function right away
Basically for multiple backends setup we want to pass :append-hooks to nil and
:call-hooks to t.
Reverting a buffer could put multiple entries of the same backend in the buffer
local `company-backends` variable.
This is due to the fact that we mutate `company-backends-xxxx-mode` variable
with:
(setq ,backends-var-name
(mapcar 'spacemacs//show-snippets-in-company
,backends-var-name)))
Solution is to add a new variable that won't be mutated when we add the support
for snippets.
When multiple modes where provided to macro spacemacs|add-company-backends along
with variables, only the first mode was taken into account as the `variables`
variable was nil after the first interation on `modes`.
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.
The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
Fix#10177
counsel-projectile has updated custom actions mechanism[1] and
counsel-projectile-switch-project-actions is no more defined
Also,
- moved counsel-projectile into spacemacs-layouts from ivy layer as
perspective/layout based project switching depends on it instead of swiper
- removed swiper from spacemacs-layouts
[1] a4e9a34d7f
Also remove unneeded addtion of yasnippet-snippets directory as it is done
automatically in the package.
push is to avoid in :init blocks because it will add duplicated entries when
the user reload the configuration with SPC f e R.
Had to create dummy init functions at some places since the owner of a package
is the last layer that defines the init function of a package. And a package
can be installed only if it has an owner.
abo-abo/swiper@4f57b5a9 removed the counsel--git-dir variable. Code
that used that variable is now expected to use (ivy-state-directory
ivy-last) instead. Update the code to reflect this change.
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
When a layer doesn't have a package, its name was added to the candidate list as
a symbol instead of a string, breaking actions such as
layer-action-open-packages which expect a string.
In perspective transient state. b and l keys in the docstring have no
corresponding functions declared whenever both helm and ivy layers are not
used.
Add two private variables to fix the issue:
- spacemacs--persp-display-buffers-func
- spacemacs--persp-display-perspectives-func
These variables are set to the correct functions by the helm and ivy layers via
a use-package hook.
Default is `ignore` function so b and l does nothing if both helm and ivy layers
are not used, TODO: we should find a better default function.
Shadowing is now control by layer property ':can-shadow' only.
can-shadow is a commutative relation, if layer1 can shadow layer2 then layer2
can shadow layer1.
the shadow operator is a binary operator accepting two layer names, it is not
commutative and the order of the operands is determined by the order of the
layers in the dotfile (like the ownership stealing mechanism).
If ':can-shadow' is set explicity to nil in the dotfile then the layer won't
shadow any layer.
For instance to install both ivy and helm layer:
(setq dotspacemacs-configuration-layers
'(
ivy
(helm :can-shadow nil)
)
note that due to the commutative relation the above example can also be
written (in this case, ':can-shadow' should be read ':can-be-shawdowed'):
(setq dotspacemacs-configuration-layers
'(
(ivy :can-shadow nil)
helm
)
Layers can now declare in their layers.el file that they shadow one or more
layers using the following functions:
- configuration-layer/shadow-layers
- configuration-layer/shadow-layer
Those function are commutative so:
(configuration-layer/shadow-layer 'layer1 'layer2)
is the same as
(configuration-layer/shadow-layer 'layer2 'layer1)
and means that
layer1 shadows layer2
and
layer2 shadows layer1
The typical use-case is helm and ivy layers. Helm shadows the ivy layer and
Ivy shadows the helm layer.
Shadowing is sensitive to the order of declaration of layers in the dotfile,
for instance:
(setq dotspacemacs-configuration-layers '(
helm
ivy
))
means that ivy shadows helm so helm layer is effectively ignored,
whereas
(setq dotspacemacs-configuration-layers '(
ivy
helm
))
means that helm shadows ivy so ivy layer is effectively ignored.
This mechanism can be turned off using the :can-shadow keyword:
(setq dotspacemacs-configuration-layers '(
ivy
(helm :can-shadow nil)
))
means that both ivy and helm layers will be installed (not recommended in this
case)
Note that the `:can-shadow` mechanism will be fully implemented in a next
commit.
dotspacemacs-directory-snippets-dir contains a path to a directory with yas
snippets in ~/.spacemacs.d (or arbitrary picked dotspacemacs direcotry).
However, while it's not always present (user has to create it manually)
it is always checked while yas is loaded which generates errors.
This diffs forces checking whether the assumed path exists before adding
it to the yas-snippet-dirs.