更新到 emacs 30 后可以更新的配置 / 体验

更新到 emacs 30 以后,简单的配置了 20 分钟,我的配置有了如下的变化。

  • editorconfig, which-key 和 use-package 都自带了,不用再从 elpa 去装这些包。在我的配置里就是直接写 (straight-use-package '(xxx :type built-in))
  • 更新了 treesit-language-source-alist 将 go 和 cpp 的 treesit grammar 更新到了最新版 v0.23.4。之前的 emacs 29.4 自带的 go-ts-mode 和 cpp-ts-mode 都不支持最新的 grammar,只能 pin 到一个较老的版本。
  • 通过使用 tab-bar-tab-name-format-functions 简化了我设置 tab-bar format 格式的配置。在之前我只能通过 customize tab-bar-tab-name-format-function。这个变量虽然更 flexible,但是我需要把整个 tab-bar 的 format 的 logic 完整的写一遍,现在可以通过 tab-bar-tab-name-format-functions 来 incrementally 添加我想要增添的 format,而不必重写不需要更改的 logic。

把玩了一下 completion-preview-mode 这个其实有点意思,是基于 overlay 的 ghost text 的 in-buffer 自动补全,和目前比较常见的 AI 补全的显示效果一致。但是也正是因为 和 AI 补全的显示冲突了,因此只能玩一玩,还是得用传统的弹出小窗的补全,和 AI 补全互不冲突更符合我的工作流。但是不管怎样 completion-preview-mode 配合 icomplete-vertical-mode,内置包总算是自带了两个更符合 “现代” 意义上的补全交互体验。

大家更新到最新的版本以后,有什么觉得比较有意思的配置和新的发现吗?欢迎分享。

6 个赞

我的org配置:config里有一句

(add-to-list 'org-preview-latex-process-alist '(...))

在emacs30里居然会导致整个org无法正常加载。

2 个赞
(setopt show-paren-context-when-offscreen t
        blink-matching-paren-highlight-offscreen t)

左括号在屏幕外面时, 光标放到右括号上, 会在 echo area 高亮对应的左括号. 之前遇到 (((( 这种情况就完全分不清匹配的是哪个

4 个赞

真是这样

mac osx版本的emacs 30.1 (https://emacsformacosx.com/) 安装后没有nativecomp,请问有办法打开吗?

这个问题我也遇到了,找不到办法

后来只能吧#+STARTUP: latexpreview去掉了

可以在你的(use-package org …)前面手动(require 'org),我尝试做了点分析

我试了一下没改进,无论使用convert还是dvipng 都报同样的错

File mode specification error: (error File “/tmp/orgtexm6emFs.dvi” wasn’t produced Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’.) 不过我也不常用latex, 可以先搁置 等有了完整解决办法再说吧

感谢

刚更新了,遇到一个问题:按 C-g,经常卡死。

添加了

(setopt project-mode-line t)
(which-key-mode +1)
(global-completion-preview-mode +1)

启动速度增加了2秒左右。

我的配置更新到 emacs-plus-30 以后启动速度更快了。在 macOS 上的 tty 原来 0.29s 左右,现在 0.25s 左右。GUI 从 0.44s 降到了 0.40s。只做了我在顶楼做的配置的改动,未做其他改动。

有意思的新选项, 确实体验感不错!

可以不用 global ,只给 prog-mode 加 hook

之前因为 emacs-app 还没出 30.1 版本,所以试了一下这个 https://emacsformacosx.com 发布版,结果就有我上面遇到的问题,启动速度变慢,很卡,按 C-g 更是经常卡死。原因不明。不晓得是不是因为我的mac很老再加上不是本地编译的原因。

我现在换回 emacs-app 30.1 后,上面的问题就都没了。速度确实变快了。

use-package 自带了??我很久前升到30都没注意到,还在用28时装的use-packag版本

感谢分享!

我的配置:

(setq blink-matching-paren-highlight-offscreen t
      show-paren-context-when-offscreen
      (if (childframe-workable-p) 'child-frame 'overlay))
3 个赞

:+1: 用 child-frame 不挡 echo area 里的 message 了. 虽然我好像没有 childframe-workable-p 这个函数

可以用这个:

(defun childframe-workable-p ()
  "Whether childframe is workable."
 (and (>= emacs-major-version 26)
       (not noninteractive)
       (not emacs-basic-display)
       (or (display-graphic-p)
           (featurep 'tty-child-frames))
       (eq (frame-parameter (selected-frame) 'minibuffer) 't)))

有人遇到过这个错误吗

下面的配置可以临时解决,但是不知道根源问题在哪里?company-capf 默认配置了 ispell?但是不是所有人都用 ispell 的呀。

;; for emacs 30.1
(add-hook 'org-mode-hook
          (lambda ()
            (delq 'ispell-completion-at-point completion-at-point-functions)))

(add-hook 'markdown-mode-hook
          (lambda ()
            (delq 'ispell-completion-at-point completion-at-point-functions)))

我也发现了,在 orgmode-mode 和 markdown-mode 的 completion-at-point-functions 里多了一项 ispell-completion-at-point。但是应该和 company 没有关系,不启用 company 也会多这一项。

是因为 text-mode 给它加了进去

File: /opt/homebrew/Cellar/emacs-plus@30/30.1/share/emacs/30.1/lisp/textmodes/text-mode.el
(add-hook 'completion-at-point-functions #'ispell-completion-at-point 10 t)))

从corfu的文档看,是这样

;; disable ispell backends in text-mode
(setq text-mode-ispell-word-completion nil)