Closed Luis-Henriquez-Perez closed 6 years ago
I just tested this on a fresh config:
(require 'telephone-line-config)
(require 'evil)
(telephone-line-evil-config)
(evil-mode 1)
This works fine, so I'm not sure where your issue is happening?
If it's because you're not calling (evil-mode 1)
in your config, you shouldn't be using telephone-line-evil-config
without evil.
You're right. I think It's probably something having to do with me using use-package
:
(use-package evil :demand t)
(use-package telephone-line :demand t)
(telephone-line-evil-config)
(evil-mode 1)
The above code for me produces the problem. And interesting the order of (telephone-line-evil-config)
and (evil-mode 1)
doesn't matter.
I'll post what I got to work in this situation in case it may help someone else.
For me, I have to define the telephone-line-evil-tag-segment
and it will work:
(advice-add #'evil-mode :after
(lambda (&rest args)
(progn
(telephone-line-defsegment* telephone-line-evil-tag-segment ()
(let ((tag (cond
((not (evil-visual-state-p)) (upcase (symbol-name evil-state)))
((eq evil-visual-selection 'block)
(if telephone-line-evil-use-short-tag "VB" "V-BLOCK"))
((eq evil-visual-selection 'line)
(if telephone-line-evil-use-short-tag "VL" "V-LINE"))
(t "VISUAL"))))
(if telephone-line-evil-use-short-tag
(seq-take tag 2)
tag)))
(telephone-line-evil-config))))
I use use-package like this (abbreviated):
(use-package evil
:config (evil-mode t))
(use-package telephone-line
:config
(require 'telephone-line-config)
(telephone-line-evil-config))
...And that works for me, at least.
If it's because you're not calling (evil-mode 1) in your config, you shouldn't be using telephone-line-evil-config without evil
You're probably right that it's due to a mistiming. I don't know. I do some funky things in my config which is probably why I got that error. I think telephone-line-evil-config
was called when evil was loaded but before evil-mode
was called.
In any case I got it to work making sure telephone-line-evil-config
is called after evil-mode
. I can close this issue, unless you have a further inquiry.
Nah, nothing else. I mean, I could take a look at your config if you want help, but otherwise I don't think there's a package issue here.
The use
with-eval-after-load 'evil
to use the evil segments if evil is enabled does not work reliably. In my configuration I load evil but I call(evil-mode 1)
at a later time. I follow the instructions on your readme:When I do this, it meets the condition of having evil loaded (otherwise the code would not be run) but gives me this error.
After debugging it I realized it was because
(evil-mode 1)
had not been called yet. I fixed it by doing something along the lines ofI propose that either the
eval-after-load 'evil
should be changed (because it won't always work) and that it should be specifically mentioned in the README that the evil telephone-line integration works afterevil-mode
is enabled, not just after evil is loaded.