Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modeline only appears in non-file buffers #1

Closed
trbjo opened this issue Jun 12, 2018 · 21 comments
Closed

Modeline only appears in non-file buffers #1

trbjo opened this issue Jun 12, 2018 · 21 comments

Comments

@trbjo
Copy link

trbjo commented Jun 12, 2018

I have a problem, where the mode-line only is visible in buffers not associated with files (e.g. scratch, dired). As soon as i open an existing file, the modeline completely disappears.

I tried removing modules from my .emacs, but to no avail. It doesn't work with the following .emacs:

`
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("ORG" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("MELPA STABLE" . "http://stable.melpa.org/packages/"))
(add-to-list 'package-archives '("MELPA" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("MARMALADE" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("GNU ELPA" . "http://elpa.gnu.org/packages/"))
(setq package-archive-priorities
'(("ORG" . 10)
;;("MELPA STABLE" . 7)
("GNU ELPA" . 5)
;;("MARMALADE" . 2)
("MELPA" . 9)))

(package-initialize)

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

(eval-when-compile
(require 'use-package))
(setq use-package-always-ensure t)
(require 'bind-key)

;;; Use-package
(use-package projectile)
(use-package shrink-path)
(use-package eldoc-eval)
(load "~/.emacs.d/doom-modeline.el")
(require 'doom-modeline)
(+doom-modeline|init)
`

(also, the package is not available on Melpa yet)

@trbjo trbjo changed the title Modeline only appears in *scratch*-buffer Modeline only appears in non-file buffers Jun 12, 2018
@seagle0128
Copy link
Owner

seagle0128 commented Jun 12, 2018

Thanks for the reporting. Actually the package has not been approved by Melpa so far.

Regarding this issue, I tested with your configurations. It seems the all-the-icons package is missing. Please add (use-package all-the-icons) and retry. It works well for me as below.

image

@trbjo
Copy link
Author

trbjo commented Jun 12, 2018

It still doesn't work for me. I am on Windows if that makes any difference.

udklip

@trbjo
Copy link
Author

trbjo commented Jun 12, 2018

I found this in the Messages buffer

../../../Users/Troels/.emacs.d/doom-modeline.el: ‘when-let’ is an obsolete macro (as of 26.1); use ‘when-let*’ instead. [3 times] Loading c:/Users/Troels/.emacs.d/doom-modeline.el (source)...done

@seagle0128
Copy link
Owner

Does it work now?
Yes. I also noticed this warning. But for Emacs 24 and 25, there is no when-let*. Let me look into and address it.

@trbjo
Copy link
Author

trbjo commented Jun 12, 2018

It still doesn't work, but after changing when-let to when-let* I now get this error:
Error during redisplay: (eval (doom-modeline-format--main)) signaled (invalid-regexp "Trailing backslash") [4 times]

@seagle0128
Copy link
Owner

OK. Did you install all-the-icons fonts? Run M-x all-the-icons-install-fonts. It should be the fonts issue here.

@trbjo
Copy link
Author

trbjo commented Jun 12, 2018

Yes, I have run the command, and I'm afraid it doesn't change anything.

@trbjo
Copy link
Author

trbjo commented Jun 12, 2018

I think this might be an issue with the encoding in Windows. I'll be back.

@seagle0128
Copy link
Owner

Please try other fonts or encodings. Hmm, I am not using Windows now :(

@seagle0128
Copy link
Owner

seagle0128 commented Jun 12, 2018

If the fonts are still not displayed correctly, please try to put these codes in init.el (after (require 'doom-modeline)) , and let me know the results.

(defun +doom-maybe-icon-octicon (&rest args)
  (when (and (display-graphic-p) (not (eq system-type 'windows-nt)))
    (apply 'all-the-icons-octicon args)))

(defun +doom-maybe-icon-faicon (&rest args)
  (when (and (display-graphic-p) (not (eq system-type 'windows-nt)))
    (apply 'all-the-icons-faicon args)))

(defun +doom-maybe-icon-material (&rest args)
  (when (and (display-graphic-p) (not (eq system-type 'windows-nt)))
    (apply 'all-the-icons-material args)))

@trbjo
Copy link
Author

trbjo commented Jun 13, 2018

I have now tested it on my work computer, and it's the same thing. The lisp code above doesn't change anything :-(

@seagle0128
Copy link
Owner

Also on Windows? Any output in the Messages buffer?

@trbjo
Copy link
Author

trbjo commented Jun 13, 2018

Yes, my work computer runs Windows. And the output in *Messages* is exactly the same.

@seagle0128
Copy link
Owner

I tested on Windows just now. It works fine. Please update and retry. I am using consolas fonts with GNU Emacs 26.1 on Windows 10.

image

@trbjo
Copy link
Author

trbjo commented Jun 13, 2018

It's working! Turns out I was running 26.093 or something like that. I've now upgraded to 26.1. Thank you so much.

@seagle0128
Copy link
Owner

Welcome! I disabled all-the-icons in Windows due to the bad performance and formats. Please refer to my latest commit. In my testing, the icons are not showed correctly.

I'm closing this issue. Please let me know if you still have questions. Thanks.

@trbjo
Copy link
Author

trbjo commented Jun 13, 2018

Have you seen this?

Putting (setq inhibit-compacting-font-caches t) in my .emacs solves the issue for me.

@seagle0128
Copy link
Owner

seagle0128 commented Jun 13, 2018

Thanks!

I tried this workaround, but seems it doesn't work. The icons in modeline are messy, and the Emacs is extremely slow after I updated all-the-icons. Actually the Emacs consumes 3GB memory if turning on all-the-icons on Windows 10. So I decided to disable it.

All icons are showed correctly on your side? Can I see the screenshot?

On my Windows laptop, the icons are like this

image

@seagle0128
Copy link
Owner

seagle0128 commented Jun 22, 2018

@VirgiliusHaufniensis I enabled all-the-icons on Windows now. The root cause is the font issue and it has been fixed in my config (seagle0128/.emacs.d@7e0e69e).

Please update and try on your env. For develop branch, it has been merged new codes, also stable now.

@yiufung
Copy link

yiufung commented Jul 29, 2018

Hmm I'm still having the same issue using Emacs 26.1 in Windows 10. All fonts from all-the-icons have been installed.

;; UTF-8 everywhere please
(setq locale-coding-system 'utf-8) ; pretty
(set-terminal-coding-system 'utf-8) ; pretty
(set-keyboard-coding-system 'utf-8) ; pretty
(set-selection-coding-system 'utf-8) ; please
(prefer-coding-system 'utf-8) ; with sugar on top
(set-language-environment 'utf-8)

;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; Define melpas
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives
             '("melpa2" . "http://www.mirrorservice.org/sites/melpa.org/packages/"))
(add-to-list 'package-archives
             '("melpa3" . "http://www.mirrorservice.org/sites/stable.melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(package-initialize)

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

;; Load use-package
(eval-when-compile
  (require 'use-package))

;; Essentials starts.
(setq system-time-locale "C")
(winner-mode 1)

(use-package all-the-icons)
(use-package doom-modeline
  :ensure t
  :defer t
  :hook (after-init . doom-modeline-init))

Modeline is only shown on special buffers, *scratch* etc. The error message in *Message* is:

Error during redisplay: (eval (doom-modeline-format--main)) signaled (invalid-regexp "Trailing backslash") [9 times]

Have also tried putting (setq inhibit-compacting-font-caches t) before doom-modeline, doesn't work either.

@seagle0128
Copy link
Owner

seagle0128 commented Jul 30, 2018

Hi @yiufung ,

  1. Please use the latest Emacs 26.1.
  2. Please update doom-modeline to the latest version.
  3. Run M-x all-the-icons-install-fonts and install the dwonloaded fonts manually.
  4. Try with these configs if using cnfonts.
(defun cnfonts--set-all-the-icons-fonts (&optional _)
    "Show icons in all-the-icons."
    (when (featurep 'all-the-icons)
      (dolist (charset '(kana han cjk-misc bopomofo gb18030))
        (set-fontset-font "fontset-default" charset "all-the-icons" nil 'append)
        (set-fontset-font "fontset-default" charset "github-octicons" nil 'append)
        (set-fontset-font "fontset-default" charset "FontAwesome" nil 'append)
        (set-fontset-font "fontset-default" charset "Material Icons" nil 'append))))

(add-hook 'cnfonts-set-font-finish  #'cnfonts--set-all-the-icons-fonts)
  1. Remove the suspicious sections in mode-line below, then re-evaluate (C-x C-e).
(doom-modeline-def-modeline main
                            (workspace-number window-number bar matches " " buffer-info buffer-position  " " selection-info)
                            (global buffer-encoding major-mode vcs flycheck))

if you still encounter this issue, try M-x toggle-debug-on-error, and provide more errors for troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants