1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Emacsでテーマのロードでハマった話も聞く?

Last updated at Posted at 2022-02-13

leafに慣れてないていうか、まっさらな状況でinit.elを編集してたから。
なんだこの使いにくいクソエディタと久しぶりに思った。
手が勝手に動いてエディタが勝手に小さくなって消えてって、そりゃねーだろおいと。

ffapが無いと何も出来ない体になっていた

まじで思考停止。
ソースファイル何処だっけって、ほけーっと呆けてしまった。
ffapを入れるとカーソル位置にあるソースファイルをディスクから探して来てくれて、これでしょ?って教えてくれるます。まるで良い犬のような心地よさ。グッボーイ!グッボーイ!

init.el 抜粋
;; ffapで上書き
(leaf files
  :doc "file input and output commands for Emacs"
  :tag "builtin"
  :custom `((auto-save-timeout . 15)
            (auto-save-interval . 60)
            (auto-save-file-name-transforms . '((".*" ,(locate-user-emacs-file "backup/") t)))
            (backup-directory-alist . '((".*" . ,(locate-user-emacs-file "backup"))
                                        (,tramp-file-name-regexp . nil)))
            (version-control . t)
            (delete-old-versions . t)))
  ;; :bind (([(control ?x) (control ?f)] . find-file)))

;; カーソル下のファイルを頑張って開く
(leaf ffap
  :doc "find file (or url) at point"
  :tag "builtin"
  :custom (ffap-bindings . 1)
  :bind ("C-x C-f" . find-file-at-point)
  )

それで。init.elでロードテーマを挿入する場所で、leafのテンプレート挿入コマンドを入力します。

M-x leaf-convert-insert-template
Package name: material-theme

パッケージ名入れている途中何度かタブキーを押して補間させながら入力すると、パッケージリストにあるかないか判断出来る。
あとは、途中アスタリスクを入力してタブキー連打すると、それに一致するパッケージリストが表示される。私のEmacs環境では!

Package name: m*-theme[タブキー連打]

これがこう!
;; (leaf material-theme
;;   :doc "A Theme based on the colors of the Google Material Design"
;;   :req "emacs-24.1"
;;   :tag "themes" "emacs>=24.1"
;;   :url "http://github.com/cpaulik/emacs-material-theme"
;;   :added "2022-02-13"
;;   :emacs>= 24.1
;;   :ensure t)

;; これを元に次のように編集する

(leaf material-theme :ensure t :config (load-theme 'material t))

パッケージテンプレートの入力が終わったらinit.elを実行し直すか、8行をリージョンで選択してevalしないと、パッケージを持ってきてくれないのを忘れていた。

  1. M-x eval-buffer
  2. M-x eval-region

全体を実行し直すコマンドと、選択したリージョンだけを実行するコマンドです。
実行されてleafがパッケージを持ってきてくれないと、ソースを読めないです。

(load-theme 'material t) このmaterialてのを見るのにffapを使ったのです。
leafの後に続く material-theme 上にカーソルを置いて C-x C-f する。
ffapさえロードされていれば、C-x C-f の代わりに M-x ffap でも行けはず。

おすすめされたソースファイルを開く
~/.emacs.d/elpa/material-theme-20210904.1226/material-theme.el

ほら、(deftheme material ってテーマ名あるでしょ。
たぶんこれを指定しないと行けないっぽい。
それ以前に、コメントに material をロードしてねって書いてあるし。

~/.emacs.d/elpa/material-theme-20210904.1226/material-theme.el 抜粋
;;; Commentary:

;; To use it, put the following in your Emacs configuration file:
;;
;;   (load-theme 'material t)
;;
;; Requirements: Emacs 24.

;;; Credits:

;; Thanks to Bruce Williams of the Spacegray Theme which was used as the boilerplate:
;; https://github.com/bruce/emacs-spacegray-theme

;;; Code:

(deftheme material

作者さん、必要なところだけ抜粋してごめんんささい。
テーマ名を入れてやれば、leafでのードテーマロ記載は完了せづ。
リージョンで1行まるまる選択して、M-x eval-region すれば、テーマの反映までテストできます。

;;(leaf tangotango-theme :ensure t :config (load-theme 'tangotango t))
;;(leaf solarized-theme :ensure t :config (load-theme 'solarized-dark t))
;;(leaf moe-theme :ensure t :config (load-theme 'moe-dark t))
;;(leaf tango-2-theme :ensure t :config (load-theme 'tango-2 t))

(leaf atom-dark-theme :ensure t :config (load-theme 'atom-dark t))
(leaf material-theme :ensure t :config (load-theme 'material t))
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?