emoji layer company-emoji font support

Font support for company-emoji on Linux or on Mac OS X and using the
Cocoa version of Emacs.
See https://github.com/dunn/company-emoji/blob/master/README.md
This commit is contained in:
codefalling 2015-11-18 14:08:54 +08:00 committed by syl20bnr
parent 90d9980878
commit 37f4a5250e
3 changed files with 42 additions and 1 deletions

View File

@ -23,6 +23,11 @@ To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =emoji= to the existing =dotspacemacs-configuration-layers= list in this
file.
Linux user could install [[https://zhm.github.io/symbola/][Symbola]] font to get company-emoji support with =apt-get=
#+BEGIN_SRC shell
apt-get install ttf-ancient-fonts
#+END_SRC
* Key bindings
| Key Binding | Description |

View File

@ -0,0 +1,29 @@
;;; funcs.el --- Emoji Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; From https://github.com/dunn/company-emoji/README.md for Linux, or on
;; Mac OS X and using the Cocoa version of Emacs
(defun spacemacs//set-emoji-font (frame)
"Adjust the font settings of FRAME so Emacs can display emoji properly."
(cond
((spacemacs/system-is-mac)
(set-fontset-font t 'symbol
(font-spec :family "Apple Color Emoji")
frame 'prepend))
((spacemacs/system-is-linux)
(set-fontset-font t 'symbol
(font-spec :family "Symbola")
frame 'prepend))))
(defun spacemacs//set-emoji-font-for-current-frame ()
"Adjust the font settings of current frame so Emacs can display emoji
properly."
(spacemacs//set-emoji-font (selected-frame)))

View File

@ -39,4 +39,11 @@
(defun emoji/init-company-emoji ()
(use-package company-emoji
:defer t
:init (setq company-emoji-insert-unicode nil)))
:init
(progn
(setq company-emoji-insert-unicode nil)
;; For when Emacs is started in GUI mode:
(spacemacs//set-emoji-font nil)
;; Hook for when a frame is created with emacsclient
(spacemacs|do-after-display-system-init
(spacemacs//set-emoji-font-for-current-frame)))))