2015-11-18 06:08:54 +00:00
|
|
|
;;; funcs.el --- Emoji Layer functions File for Spacemacs
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2015-11-18 06:08:54 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-11-18 06:08:54 +00:00
|
|
|
|
|
|
|
;; From https://github.com/dunn/company-emoji/README.md for Linux, or on
|
2019-10-13 05:27:17 +00:00
|
|
|
;; macOS and using the Cocoa version of Emacs
|
2015-11-18 06:08:54 +00:00
|
|
|
(defun spacemacs//set-emoji-font (frame)
|
|
|
|
"Adjust the font settings of FRAME so Emacs can display emoji properly."
|
2017-09-12 01:14:40 +00:00
|
|
|
(when (fboundp 'set-fontset-font)
|
|
|
|
(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)))))
|
2015-11-18 06:08:54 +00:00
|
|
|
|
|
|
|
(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)))
|
2020-02-02 14:23:35 +00:00
|
|
|
|
|
|
|
(defun spacemacs/delay-emoji-cheat-sheet-hook ()
|
|
|
|
"Work-around for org buffers."
|
|
|
|
;; we need to wait for org buffer to be fully loaded before
|
|
|
|
;; calling the emoji mode.
|
|
|
|
;; If we directly call the emoji mode at hook runtime then some
|
|
|
|
;; text properties are not applied correctly.
|
|
|
|
(run-at-time 0.1 nil 'emoji-cheat-sheet-plus-display-mode))
|
2021-09-14 11:11:22 +00:00
|
|
|
|
|
|
|
(defun spacemacs/emoji-insert-and-possibly-complete (_)
|
|
|
|
"Use company-emoji to complete 'to' unicode."
|
|
|
|
(when company-emoji-insert-unicode
|
|
|
|
(delete-char -1)
|
|
|
|
(company-complete)))
|