Emacs: disable warning about non graphical display

172 views Asked by At

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

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!

1

There are 1 answers

0
Nick McCurdy On BEST ANSWER

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)