dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
550 stars 51 forks source link

Mode line shows like inactive just like when emacs in opened #78

Closed IcaroBritto closed 6 years ago

IcaroBritto commented 6 years ago

When I open emacs the mode line looks like inactive. I insert some text and move the cursor around and it still the same, but when I click with the mouse on the emacs area the mode line gets back to normal.

Here is a gif of what is happening: Here is a gif of what is happening

I'm using emacs 26.1 on Mac OS.

Thanks.

dbordak commented 6 years ago

Never seen this before.

Are you...

Also, can you confirm nothing similar happens with telephone-line disabled? (one possibility: does the mode-line appear inactive until you begin typing? etc.)

And further, to help narrow it down, try running a minimal emacs config that only initializes telephone-line to make sure it's not some other package interaction.

IcaroBritto commented 6 years ago

Answering the questions:

Are you...

Q: Running emacs as a daemon? A: No

Q: Using any kind of non-standard WM? A: No

Q: Using an alternate build of emacs? A: No. I installed it using brew cask install emacs

Q: Also, can you confirm nothing similar happens with telephone-line disabled? A: Yes, nothing similar happens.

And further, to help narrow it down, try running a minimal emacs config that only initializes telephone-line to make sure it's not some other package interaction.

I just did what you suggested and I found out that the problem occurs when I use (setq inhibit-startup-screen t). The problem also happens when I create a new emacs window (Cmd+N). The new window looks ok but in the old one the problem happens. To reproduce this last one I just started emacs, hit Cmd+N and then Cmd-W (to close the new window, getting back to the old one).

Thank you for the quick reply, by the way.

IcaroBritto commented 6 years ago

Sorry, I forgot to post here my init.el:

(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

(package-initialize)

(custom-set-variables
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(package-selected-packages (quote (use-package telephone-line evil))))

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)

;; Uncomment the line below to see the problem happening
;; (setq inhibit-startup-screen t)
(setq initial-scratch-message nil)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(setq-default display-line-numbers 'relative)
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
(blink-cursor-mode 0)
(global-hl-line-mode 1)
(set-default-font "Monaco-12")
(show-paren-mode 1)

;; {{ --------------- EVIL
(use-package evil)
(evil-mode 1)

(defun up-7()
  "Move point up 7 lines"
  (interactive) (evil-previous-line 7))
(defun down-7()
  "Move point down 7 lines"
  (interactive) (evil-next-line 7))

(with-eval-after-load 'evil-maps
  (define-key evil-motion-state-map (kbd ":") 'evil-repeat-find-char)
  (define-key evil-motion-state-map (kbd ";") 'evil-ex)
  (define-key evil-motion-state-map (kbd "C-j") 'down-7)
  (define-key evil-motion-state-map (kbd "C-k") 'up-7))
;; ------------------ }}

;; {{ --------------- TELEPHONE-LINE
(setq ns-use-srgb-colorspace nil)
(use-package telephone-line)

(setq telephone-line-primary-left-separator 'telephone-line-cubed-left
      telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
      telephone-line-primary-right-separator 'telephone-line-cubed-right
      telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right)

(face-spec-set
      'telephone-line-evil-normal
      '((t :foreground "black" :background "#AFD787"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-evil-insert
      '((t :foreground "black" :background "#87AFD8"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-evil-visual
      '((t :foreground "black" :background "#D7AFD7"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-evil-replace
      '((t :foreground "black" :background "#D78787"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-evil-operator
      '((t :foreground "black" :background "#FBB957"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-evil-motion
      '((t :foreground "black" :background "#A88EFF"))
      'face-defface-spec)
(face-spec-set
      'telephone-line-projectile
      '((t :foreground "light green"))
      'face-defface-spec)

(setq telephone-line-lhs
    '((evil   . (telephone-line-evil-tag-segment))
      (accent . (telephone-line-erc-modified-channels-segment
                 telephone-line-process-segment))
      (nil    . (telephone-line-buffer-segment))))
(setq telephone-line-height 16
      telephone-line-evil-use-short-tag t)
(telephone-line-mode t)
;; ------------------ }}

Hope this can help.

dbordak commented 6 years ago

I'll look into this next week, I'm a bit busy right now.

IcaroBritto commented 6 years ago

No problem. Thank you :)

dbordak commented 6 years ago

Alright, I've just tested it, but unfortunately I can't reproduce on linux :( Don't really know how to proceed with fixing it, in that case...

dbordak commented 6 years ago

These lines:

(add-hook 'window-configuration-change-hook #'telephone-line--set-selected-window)
(add-hook 'focus-in-hook #'telephone-line--set-selected-window)
(defadvice select-window (after telephone-line-select-window activate)
  "Set telephone-line's selected window value for use in determining the active mode-line."
  (telephone-line--set-selected-window))
(defadvice select-frame (after telephone-line-select-frame activate)
  "Set telephone-line's selected window value for use in determining the active mode-line."
  (telephone-line--set-selected-window))

are what causes this to not happen, normally. I'm not sure why it's not working for you.

You might be able to fix it by adding the same function to a different hook, but I don't know which hook you'd need.

IcaroBritto commented 6 years ago

Hey @dbordak. I was able to fix this by adding this hook: (add-hook 'buffer-list-update-hook #'telephone-line--set-selected-window)

Thank you very much for the clarification :)