Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Emacs: disable warning about non graphical display

I recently added Fira ligatures to emacs and I added the following to my .emacs file (I am on Debian stable)

;; (require 'fira-code-mode)
;; (custom-set-variable 'fira-code-mode-disabled-ligatures '("[]" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off

;; ;; Enable fira-code-mode automatically for programming major modes
;; (add-hook 'prog-mode-hook 'fira-code-mode)
;; ;; Or, you can use the global mode instead of adding a hook:
;; (global-fira-code-mode)


;; (require 'fira-code-mode)

;; install use-package from melpa and also fira

;; See https://github.com/jming422/fira-code-mode

(use-package fira-code-mode
  :custom (fira-code-mode-disabled-ligatures '("[]" "www" "<-" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off
  :hook prog-mode) ;; Enables fira-code-mode automatically for programming major modes

;; (set-frame-font "FiraCode-Regular-Symbol")

It works and I cannot complain and I get some nice ligatures. However, I also use mutt to write emails and it invokes emacs inside bash when I compose or reply to an email.

In this case, I always get an annoying warning which splits my buffer which I copy below

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Warning (fira-code-ligatures): fira-code-mode probably won't work for non-graphical displays!

Now, this is due to the fact that in the code at

https://github.com/jming422/fira-code-mode/blob/master/fira-code-mode.el

I have (line 169)

(unless (display-graphic-p)
    (display-warning '(fira-code-ligatures) "fira-code-mode probably won't work for non-graphical displays!"))

Is there any way to disable this warning (and possibly only this!) without actually modifying the source code?

Thanks!

>Solution :

You can load this package conditionally with use-package:

(use-package fira-code-mode
  :if (display-graphic-p)
  :custom (fira-code-mode-disabled-ligatures '("[]" "www" "<-" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off
  :hook prog-mode) ;; Enables fira-code-mode automatically for programming major modes)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading