LoginSignup
2
4

More than 3 years have passed since last update.

Emacs magit-logで絵文字を表示したり、magitからのcommitメッセージで絵文字を書いたりしたい

Posted at

背景

GitHubやgitlabで開発を進める上で、絵文字を使ってcommit messageを書きたいを思うのが人情。さらにEmacs使いであればすべてEmacs上でできるようにしたいのも人情。
そこで、magitのlogやcommitで絵文字を使えるようにする方法を書く。
magit以外のmodeでも使えます。

本題

完成品はこちらです。
image.png

必要パッケージ

絵文字の表示とHelmによる入力したい絵文字検索を可能とする、emacs-emoji-cheat-sheet-plusを使用する。
私はパッケージ管理にstraight.eluse-packageを使っている。

emacs-lisp

設定用emacs-lispは以下の通りに書く。

(use-package emoji-cheat-sheet-plus
    :defer t
    :init
    (progn
      ;; enabled emoji in buffer
      (add-hook 'org-mode-hook 'emoji-cheat-sheet-plus-display-mode)
      (add-hook 'markdown-mode-hook 'emoji-cheat-sheet-plus-display-mode)
      (add-hook 'magit-log-mode-hook 'emoji-cheat-sheet-plus-display-mode)
      ;; insert emoji with helm
      (global-set-key (kbd "C-c C-e") 'emoji-cheat-sheet-plus-insert)))

これで、magit-logの他、orgmarkdownでも絵文字の表示が有効になる。
また、C-c C-eHelmから入力したい絵文字を検索できる。
image.png

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4