简洁、美观的 Emacs 状态栏:modusregel
Simple, beautiful Emacs modeline: modusregel

原始链接: https://codeberg.org/jjba23/modusregel

目前 `modusregel` 尚未上架 MELPA 或 ELPA,可通过 Elpaca 进行安装: ```elisp (use-package modusregel :ensure (:host codeberg :repo "jjba23/modusregel" :branch "trunk") :demand t) ``` **关键实现说明:** * **作用域:** `mode-line-format` 是窗口局部的。使用 `setq` 可进行临时的窗口特定更改,使用 `setq-default` 则可应用全局更改。 * **配置:** 若要持久化设置,请定义一个函数来设定 `mode-line-format` 变量。你可以使用默认的 `modusregel-format`,或者使用自定义列表来选择特定组件(例如:缓冲区名称、版本控制状态、Eglot 信息)。 * **自动化:** 将你的配置函数添加到 `after-change-major-mode-hook` 中,以确保自定义的模式行在不同模式下始终保持生效。

抱歉。
相关文章

原文

This package is not (yet) available in popular Emacs repositories such as MELPA or ELPA. An example installation with Elpaca:

  (use-package modusregel
    :ensure (:host codeberg :repo "jjba23/modusregel" :branch "trunk")
    :demand t)

Note: remember that mode-line-format is window-local, this means that to persist changes and set it globally, one must use setq-default and for tweaking and experimenting, change it temporarily to setq.

  ;; window only
  (setq mode-line-format modusregel-format)
  ;; global
  (setq-default mode-line-format modusregel-format)

To ensure the modeline is set in your config, you should tweak the Emacs core. Also, in this way, you can choose what parts you like:

;; Simple example
(defun my-set-custom-modeline ()
  (setq mode-line-format modusregel-format))

;; Or more advanced control
(defun my-set-custom-modeline ()
  "Customize mode-line format using modusregel."
  (setq mode-line-format (list
                          modusregel-leading-str
                          modusregel-remote-expr
                          modusregel-buffer-name-expr
                          modusregel-buffer-modified-str
                          modusregel-buffer-read-only-str
                          modusregel-spacer-str

                          ;; Uncomment if nyan-mode is enabled above
                          ;; modusregel-nyan-expr

                          modusregel-spacer-str
                          modusregel-line-number-str
                          modusregel-column-number-str
                          modusregel-spacer-str
                          modusregel-buffer-position-str
                          modusregel-spacer-str
                          modusregel-vc-expr
                          modusregel-major-mode-expr
                          modusregel-eglot-expr
                          modusregel-spacer-str
                          modusregel-flymake-expr
                          (ignore-errors keycast-mode-line))))

;; Important hook
(add-hook 'after-change-major-mode-hook #'my-set-custom-modeline)

联系我们 contact @ memedata.com