Open5

Emacs 設定記録

HikaruHikaru

パッケージ、ツール選定

  1. パッケージ管理: leaf
  2. LSPクライアント: eglot Emacs29 以降に標準搭載らしい
  3. シンタックスハイライト: tree-sitter (Emacs29以降に標準搭載)
HikaruHikaru

leaf.el 設定

  1. インストールコード(公式READMEよりコピー)
;; <leaf-install-code>
(eval-and-compile
  (customize-set-variable
   'package-archives '(("org" . "https://orgmode.org/elpa/")
                       ("melpa" . "https://melpa.org/packages/")
                       ("gnu" . "https://elpa.gnu.org/packages/")))
  (package-initialize)
  (unless (package-installed-p 'leaf)
    (package-refresh-contents)
    (package-install 'leaf))

  (leaf leaf-keywords
    :ensure t
    :config
    ;; initialize leaf-keywords.el
    (leaf-keywords-init)))
;; </leaf-install-code>

  1. 追加パッケージインストール(leaf関連)
    参考
(leaf leaf-tree
  :ensure t
  :custom ((imenu-list-size . 30)
             (imenu-list-position . 'left)))
(leaf leaf-convert :ensure t)
(leaf macrostep
  :ensure t
  :bind (("C-c e" . macrostep-expand)))
HikaruHikaru

ここまでのinit.elは以下

;; <leaf-install-code>
(eval-and-compile
  (customize-set-variable
   'package-archives '(("org" . "https://orgmode.org/elpa/")
                       ("melpa" . "https://melpa.org/packages/")
                       ("gnu" . "https://elpa.gnu.org/packages/")))
  (package-initialize)
  (unless (package-installed-p 'leaf)
    (package-refresh-contents)
    (package-install 'leaf))

  (leaf leaf-keywords
    :ensure t
    :config
    ;; initialize leaf-keywords.el
    (leaf-keywords-init)))
;; </leaf-install-code>

(leaf leaf-tree
  :ensure t
  :custom ((imenu-list-size . 30)
             (imenu-list-position . 'left)))
(leaf leaf-convert :ensure t)
(leaf macrostep
  :ensure t
  :bind (("C-c e" . macrostep-expand)))

これでemacsを再起動すると、init.elの末尾に以下が自動追記される。

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(macrostep leaf-convert leaf-tree leaf-keywords leaf)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

HikaruHikaru

とりあえず、方針として、leaf hogeなどでパッケージ(外部、ビルトイン含め)を指定できるものはleafの構文で書くが、そのほかglobal-set-keyなどは従来のまま書く。
のちに、leafの書き方にする