← 返回日报
精读 预计 3 分钟

Magit 4.6 released

摘要

Magit 4.6 版本发布,包含 313 个提交,重点改进 Blob 访问缓冲区:使用 magit-find-file-noselect 访问 blob,即使已有缓冲区也适用,行为更接近 find-file-noselect;支持仅用 blob OID 访问;新增 g 键撤销缓冲区;改善在不同 blob 间跳转位置。实验性开启 diff 语法高亮(默认关闭,会同步处理导致大 diff 延迟),可自定义 magit-diff-fontify-hunk、magit-diff-specify-hunk-foreground、magit-diff-use-indicator-faces。Git 钩子新增 hook.NAME.event 和 hook.NAME.command 变量,支持 Git v2.54.0 + 调用 Elisp 钩子。提交消息编写支持修改定义列表自动补全,新增 git-commit-insert-changelog-gnu 和 git-commit-insert-changelog-plain 命令插入列表,统一在 C-c C-i 菜单使用。

荐读理由

Magit 4.6 直接提供了可迁移到 AI 工程项目的 blob-visiting 缓冲区改进,支持使用 blob 对象 ID 直接访问,还能用 g 快速 revert 缓冲区。

原文

E macsAir

Collecting frequent-committer miles

Magit 4.6 released

I am excited to announce the release of Magit version 4.6, consisting of 313 commits since the last release half a year ago. The release notes can be found here.

It’s Magit! A Git interface inside Emacs

Magit is a text-based Git user interface that puts an unmatched focus on streamlining workflows. Commands are invoked using short mnemonic key sequences that take the cursor’s position in the highly actionable interface into account to provide context-sensitive behavior.

With Magit you can do nearly everything that you can do when using Git on the command-line, but at greater speed and while taking advantage of advanced features that previously seemed too daunting to use on a daily basis. Many users will find that by using Magit they can become more effective Git user.

For more information about Magit, see https://magit.vc and these blog posts.

Please consider sponsoring my work. Thank you! — Jonas Bernoulli

Sponsor my work using Github Sponsors Sponsor my work using Liberapay Sponsor my work using Opencollective Sponsor my work using PayPal

Blob improvements

The primary focus of this release are blob-visiting buffers. For now the hope is that most users will find working with such buffers slightly more pleasant, without necessarily becoming aware that anything changed. The goal was to pay off technical debt and to prepare for future changes.

  • Visiting blobs now always involves magit-find-file-noselect, even when an existing buffer may be involved. The behavior of this function is getting closer to that of find-file-noselect.

  • Implemented support for visiting blobs for the benefit of features such as syntax-highlighting, as opposed to the user visiting it explicitly. Such “volatile” blob buffers are hidden and are cached for a while, in case they are needed again. If the user visits a hidden cached blob, the buffer is renamed to reveal it, and it is no longer subject to garbage collection.

  • Blobs can now alternatively be visited with nothing but a blob object id (instead of a revision and a path).

  • Blob-visiting buffers can now be reverted with g, which is useful when the buffer is visited via, e.g., a branch, as opposed to a revision or blob object id. The buffer is not needlessly refreshed, if the blob oid does not change.

  • Improved support for jumping to the same location in another blob, from a buffer visiting a blob or file.

Experimental syntax highlighting in diffs

  • Syntax highlighting can now be enabled for diffs. This is disabled by default, because the work is still being performed synchronously, which leads to noticeable delays for large diffs and can be sluggish even for smaller diffs.

  • A future release is going to add support for asynchronous diff syntax highlighting. (The blob buffer cache added in this release does help, but is not enough.)

  • Configure magit-diff-fontify-hunk to try out this feature now, but please just disable it again, if it turns out to still be too slow for your taste. If you enable this, you should also customize the new option magit-diff-specify-hunk-foreground and possibly the new option magit-diff-use-indicator-faces as well.

Improved Git hook to Elisp hook bridge

  • The new Git variables hook.NAME.event and hook.NAME.command are now used to call Elisp hooks from Git hooks.

  • After waiting for such functionality for two decades, I came to the conclusion that this will never be implemented, and finally added a noisy kludge to get the same functionality anyway, in the previous release. Of course, just one release later, Git added the missing functionality 😝. We now use Git’s variables, which means that Elisp hooks can now only be called from Git hooks when using Git v2.54.0 or greater.

Improved commit message authoring

  • Added support for compiling a list of definitions that are modified in a diff, and for inserting such lists when authoring commit messages. The new commands git-commit-insert-changelog-gnu and git-commit-insert-changelog-plain insert such list and can be invoked from the same menu (on C-c C-i), which is used to insert commit trailers.

  • When authoring commit messages, complete-symbol now completes against modified definitions and symbols appearing in modified lines.

Please consider making a donation to support my work on Magit, Transient, Forge, Package-Build, Melpa, Emacsmirror and my other packages. This is how I make a living.

Thank you! — Jonas Bernoulli

Sponsor my work using Github Sponsors Sponsor my work using Liberapay Sponsor my work using Opencollective Sponsor my work using PayPal Some alternative donation options are available.

Comments on Reddit and Github.

Posted on 1st July 2026

Lobsters · 4 赞 · 0 评 讨论 → 阅读原文 →

这条对你有帮助吗?