0

Hello guys i am experiencing some font issues using the theme monokai on windows 10 and emacs 27.2. Emacs seems to compile everything quite nice even there are not error and warnings. However, when i load an org file the font and sizes are gone in other words just the colors are loaded. i looked through the monkai website and there is a piece of code pointing out those font issues (see code below in the case you don't want to take a look at the website)

(add-hook 'after-init-hook '(lambda () (load-theme 'monokai t)))

(when (and sys/win32p (> emacs-major-version 24))
  (add-hook 'window-setup-hook '(lambda () (load-theme 'monokai t))))

In the website also there is a thread on this issue (thread number #56) and the same code is presented. However, they mentioned that monokai must be loaded twice in order to solve the font issue.

Well, in my case i placed the code in my init.el file This is my code:

;; Using monokai theme
(use-package monokai-theme
  :config
  (load-theme 'monokai t))

(add-hook 'after-init-hook '(lambda () (load-theme 'monokai t)))

(when (and sys/win32p (> emacs-major-version 24))
  (add-hook 'window-setup-hook '(lambda () (load-theme 'monokai t))))

The next error appears:

Symbol's value as variable is void: sys/win32p

Guys i have no clue how to solve it because of sys/win32p i assuming that of course this is realted to the system windows. How can i solve it?

Then i decided to remove the sys/win32 along with the and and the (), now the code compiles. But the font issue persist.

Look, the info was posted on 2016, this info is already old, therefore i changed the part that mentioned the emacs version from 24 to 26 like this > emacs-major-version 26

As final thing i tried the same theme and the same code (of course without the windows part) in Ubuntu 20.04 and there is not font issue at all.

I don't know if this question was asked and solved before but i searched on internet for hours and i found not answer

3
  • 1
    Advice: Don't quote lambdas. And use named functions, not lambdas, on hooks.
    – Drew
    Feb 8, 2022 at 5:15
  • @Drew Thanks for your answer. I removed those mistakes but anyways the font issue still presented. I don't know if actually i have to install some fonts, because if in some code of my init.el file i use the keyword :font "Fira Code Retina" or any other font and error appears saying that such font does not exits.
    – baezacaljo
    Feb 8, 2022 at 6:19
  • 1
    Yes, that advice is irrelevant to your question. It's just a general suggestion.
    – Drew
    Feb 8, 2022 at 16:21

2 Answers 2

0

I can't find any variable sys/win32p in emacs or in monokai and am thinking it might only be in that one person's configuration. If you are only using Windows 10 and not other systems you could avoid that variable by using either

;; Using monokai theme
(use-package monokai-theme
  :config
  (load-theme 'monokai t))

(add-hook 'after-init-hook '(lambda () (load-theme 'monokai t)))
(add-hook 'window-setup-hook '(lambda () (load-theme 'monokai t)))

or if want to use the same code on Windows and Linux, and want this to only run twice on Windows, you could test for Windows a different way, with

;; Using monokai theme
(use-package monokai-theme
  :config
  (load-theme 'monokai t))

(add-hook 'after-init-hook '(lambda () (load-theme 'monokai t)))

(when (and (eq 'w32 (window-system)) (> emacs-major-version 24))
  (add-hook 'window-setup-hook '(lambda () (load-theme 'monokai t))))
2
  • Thank you for your answer, look i already tried both options and the font issue persist. Let me tell you that no errors are presented when compiling.
    – baezacaljo
    Feb 8, 2022 at 1:53
  • Just another thing, look i tried another two themes the tango-dark and the zenburn an the same thing occurs. Therefore, another doubt arises, is the issue comming from the theme itself or it could be another package or settings in my init.el file?
    – baezacaljo
    Feb 8, 2022 at 3:09
0

Guys as you probably already know emacs by default in windows does not work in the same as in linux. Well, i kept searching for the problem, and the closest solution is the following.

Manually install the desire font (.TTF) in my case the closest to Operator Mono was the Victor Mono (this is a nice font as well take a look at the website)and also Dank Mono. The steps for installing fonts in windows are in the website from Microsoft after that, you will have available your desired font.

Look, if you want to have the font available through the entire frames and buffers in emacs you just have to add the following line (This next line commonly used and posted in other question from emacs)

(set-face-attribute 'default nil :font "Dank Mono")

Then automatically the font will be applied in all buffer even in org, and the nice thing about this is that org-tables org-agenda and everything about org-mode does not present any issues like misalignment or indentation of even the sizes (using this type of fonts and spacemacs-dark theme). Usually when you set an specific theme, the agenda tables and indentation present problems because of the font, therefore there is more tuning needed.

Finally, for the customization in different themes also those fonts work quite nice, i tested using spacemacs-dark using the custom-theme-set-faces and the consistency in org mode stills the same.

Finally using the monokai theme presents an small issue that '(org-level-1 ((t (:font "Victor Mono" :weight bold :height 1.8 :slant italic)))) is not allowed.

If someone has a better idea please share it. i really love linux but this time i have to stick to windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.