Skip to content

Commit 336c160

Browse files
committed
add src
1 parent 0d138dc commit 336c160

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

sideline-emoji.el

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
;;; sideline-emoji.el --- Show emoji information with sideline -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2025 Shen, Jen-Chieh
4+
5+
;; Author: Shen, Jen-Chieh <[email protected]>
6+
;; Maintainer: Shen, Jen-Chieh <[email protected]>
7+
;; URL: https://github.com/emacs-sideline/sideline-emoji
8+
;; Version: 0.1.0
9+
;; Package-Requires: ((emacs "27.1") (sideline "0.1.0") (emojify "1.2.1"))
10+
;; Keywords: convenience sideline emoji
11+
12+
;; This file is not part of GNU Emacs.
13+
14+
;; This program is free software: you can redistribute it and/or modify
15+
;; it under the terms of the GNU General Public License as published by
16+
;; the Free Software Foundation, either version 3 of the License, or
17+
;; (at your option) any later version.
18+
19+
;; This program is distributed in the hope that it will be useful,
20+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
;; GNU General Public License for more details.
23+
24+
;; You should have received a copy of the GNU General Public License
25+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
26+
27+
;;; Commentary:
28+
;;
29+
;; Show emoji information with sideline.
30+
;;
31+
;; 1) Add sideline-emoji to sideline backends list,
32+
;;
33+
;; (setq sideline-backends-right '(sideline-emoji))
34+
;;
35+
;; 2) Then enable sideline-mode in the target buffer,
36+
;;
37+
;; M-x sideline-mode
38+
;;
39+
40+
;;; Code:
41+
42+
(require 'emojify)
43+
(require 'sideline)
44+
45+
(defgroup sideline-emoji nil
46+
"Show emoji information with sideline."
47+
:prefix "sideline-emoji-"
48+
:group 'tool
49+
:link '(url-link :tag "Repository" "https://github.com/emacs-sideline/sideline-emoji"))
50+
51+
;;;###autoload
52+
(defun sideline-emoji (command)
53+
"Backend for sideline.
54+
55+
Argument COMMAND is required in sideline backend."
56+
(cl-case command
57+
(`candidates (cons :async #'sideline-emoji--show))))
58+
59+
(defun sideline-emoji--show (callback &rest _)
60+
"Execute CALLBACK to display with sideline."
61+
(when-let* ((text (sideline-color--thing-at-point 'symbol t))
62+
(color (color-values text))
63+
(display (concat (propertize sideline-color-text 'font-lock-face `(:foreground ,text)) " " text)))
64+
(funcall callback (list display))))
65+
66+
(provide 'sideline-emoji)
67+
;;; sideline-emoji.el ends here

0 commit comments

Comments
 (0)