惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

暗无天日

读:AI Agent 安全日志——从可见性与隐私的两难说起 - 暗无天日 AI写作的语言指纹——如何让文字不那么像机器 - 暗无天日 读:50 条 Claude Code 技巧——一个工程经理的六个月使用心得 读:AI 辅助开发为什么让 E2E 测试更有价值 - 暗无天日 读:在Emacs中使用Claude Code(Spacemacs适配版) - 暗无天日 Claude Code 背后的工程哲学——读 Agent Harness Engineering 读:Agent Harness Engineering——AI 智能体不只是模型,还有套件 - 暗无天日 browser-harness:让 AI 直接接管你的浏览器 - 暗无天日 读:Security-First CI/CD —— DevSecOps 自动化实践指南 TIL: 数字小键盘的小数点陷阱与行内算术求值 - 暗无天日 读:Immutability 不是万能药,它是一种权衡 - 暗无天日 Conducty:给 Claude Code 加上项目记忆和并行执行能力 - 暗无天日 读 — GitHub Trending 里的 Claude Code 技能包 读 — Prompt Caching 省钱指南 TIL: Emacs 中那些跟鼠标配合的冷门快捷键 - 暗无天日 读:Anvil——把 Emacs 变成 AI 的工具服务器 读:Emacs 代码折叠终极指南 - 暗无天日 读:Clojure 搭车客指南 - 暗无天日 git推送失败后恢复仓库损坏的完整记录 - 暗无天日 多智能体系统的两个有效模式——以及对 Claude Code 用户的启示 - 暗无天日 用 Org Babel 写 Literate 博文:扩展执行 + 定制导出 proced:Emacs 内置的进程查看器 - 暗无天日 从 proced 定制中学到的 Elisp 模式 读:让 Emacs proced 在 macOS 上显示 CPU 和内存 异步编程的函数着色税 - 暗无天日 链式调用的代价:JavaScript 和 Clojure 的共同教训 - 暗无天日 hyperfine:命令行基准测试工具 - 暗无天日 管道中的变量去哪了?——子 shell 作用域陷阱 - 暗无天日 开源包装器的信任陷阱:四个危险信号 - 暗无天日 程序员愿意为 AI 写文档,却不愿为同事写 - 暗无天日 mktemp: Shell 脚本中临时文件的安全陷阱与最佳实践 - 暗无天日 WSL9x —— 在 Windows 9x 里跑 Linux 内核 6.19 用 ox.el 做你想做的事 —— org-export 高级编程指南 读:Hot-wiring the Lisp Machine —— 用纯 Elisp 构建零依赖的 Org 静态站点生成器 Elisp 性能优化的六个实战教训 - 暗无天日 fcitx5 下 Emacs 无法切换输入法的排查 - 暗无天日 ERT 测试交互命令的三种方式 - 暗无天日 SEM Assistant: 当 Elisp 守护进程遇上 LLM 用 dmsg 给 Elisp 加上结构化调试日志 用 org-habit 追踪非每日习惯 - 暗无天日 Clojure X-Men:当编程语言特性变成超能力 - 暗无天日 TIL: 用 diff-hl 在 fringe 中显示 git 变更 读:llm-test —— 用 LLM agent 驱动 Emacs 测试 TIL: AI 时代的橡皮鸭调试 - 暗无天日 fcitx 启动后键盘输入卡顿的排查 - 暗无天日 TIL: 早期网页的图片热区导航 - 暗无天日 读 Seeing the Whole System 用 Emacs 自动生成每周链接推荐 - 暗无天日 读:ASCII control characters in my terminal 读 What to learn - 暗无天日 Lisp 的括号之痛——一个愚人节玩笑揭开的老伤疤 - 暗无天日 一本书该"线性读"还是"并行读" - 暗无天日 读 How to Monetize a Blog:一篇伪装成变现指南的讽刺文 Python Mock 第三方依赖的四种策略 - 暗无天日 Emacs Lisp 热重载实用指南 - 暗无天日 Prot 的 Emacs 配置哲学 - 暗无天日 TIL: 从直播对谈中学到的三个 Emacs 技巧 - 暗无天日 TIL: 自动使用项目虚拟环境的 Python - 暗无天日 TIL: 让 Help buffer 自动获得焦点 一条命令让本地开发用上 HTTPS —— slim 工具介绍 用 fsck 检查和修复 Linux 文件系统 排查Linux进程"卡死"实战:从strace到gdb全流程 - 暗无天日 PostgreSQL 索引:从基础到你可能不知道的高级用法 - 暗无天日 用 .pdbrc 自定义 Python 调试器 ANSI 转义码的标准化现状 - 暗无天日 终端程序的潜规则 - 暗无天日 PARA Org-mode 测试配置 - 暗无天日 AI越强越辣鸡?控制论说这是必然的 - 暗无天日 AI 越强越需要你盯着——反馈循环实操指南 - 暗无天日 你的AI代理正在偷你的密钥——四种你没想到的泄露通道 - 暗无天日 LLM 在 DevOps 中的三种角色 - 暗无天日 写作风格的反建议 - 暗无天日 反驳本质复杂性——Dan Luu 论为什么《没有银弹》错了 - 暗无天日 文件充满了危险——Dan Luu 谈文件系统的可靠性陷阱 - 暗无天日 AI 时代的 PARA 方法:用 Org-mode 和 AI 打造个人知识管理系统 Linux 数据去重学习笔记 - 暗无天日 创建跨平台 ZIP 文件的隐藏陷阱:Extra Field - 暗无天日 X11 Forwarding 排障指南 - 暗无天日 IP欺骗端口扫描:当别人冒充你去扫描别人 - 暗无天日 Linux 输入栈全景解析:从硬件按键到屏幕响应 - 暗无天日 Unix 系统中那些被埋没的配置开关——以 FontConfig 为例 - 暗无天日 在Linux上限制儿童使用电脑 - 暗无天日 GIF不仅仅是一种图片格式——用GIF流做些奇怪的事 - 暗无天日 Leiningen 学习笔记:Clojure 项目构建与管理从入门到实战配置 - 暗无天日 Google SRE Book 读书笔记 - 暗无天日 yes 管道 head 发生了什么 - 暗无天日 为什么 nohup 在 crontab 中不起作用 Bash中的Indirection与Nameref - 暗无天日 Linux PAM 简介 - 暗无天日 从Linux ISO文件启动计算机 - 暗无天日 用 Bash 打造一个Screen Locker 用GitHub Actions自动构建EGO博客 - 暗无天日 blocking I/O 的作用 - 暗无天日 mobileog 手机端同步提示Error:2 No such file 的解决方法 回收 WSL2 VHDX 文件占用空间 使用 org-mode columnview 生成任务列表 - 暗无天日 Emacs 作为 MPD 客户端 - 暗无天日 移动文件路径却不破坏org file link的方法 - 暗无天日 如何合理的导出help link 成HTML - 暗无天日 笑话理解之Biology - 暗无天日
读:Protesilaos 的 Emacs 合理默认配置 —— 兼与 newcomers-presets 对比
2026-05-02 · via 暗无天日

上次整理了 newcomers-presets theme 的配置清单。几天后,Protesilaos(Prot)在和 Sacha Chua 的 livestream 上聊了这个话题,随后分享了一份自己的"sensible defaults"配置。

Prot 在 Emacs 社区以 themes(Modus/ef 系列)、icon 等包闻名。他这份配置不是个人完整配置,而是"跟不同水平的人交流后,觉得有用的基础配置"。

这篇笔记把他的配置逐段过一遍,顺带对比两种思路的差异。

两种思路的根本差异

方面 newcomers-presets Prot 的方案
形式 Emacs theme, load-theme 加载 配置片段,合并到 init.el
开关 随时 disable-theme 关闭 修改 init.el 移除
作用域 只设 setopt / add-hook 可设任何 Elisp
包依赖 纯内置,不装包 推荐 6 个第三方包
改动范围 30+ 项细微调整 更激进(如 custom-safe-themes t)

newcomers-presets 的定位是"开箱即友好的默认值":不改用户的配置习惯,不满意可以关掉。Prot 的思路则是"给一份我觉得对的配置",他认为对新手来说,一开始就用对的设置比"错了再改"更省事。

custom-file 分离

(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file :no-error-if-file-is-missing)

Prot 第一件事就是把 custom.elinit.el 里拆出来,单独用一个文件存 M-x customize 产生的配置。没有 custom-file 时,Emacs 把这些自动生成的配置直接写进 init.el ,跟手写配置混在一起。想删掉某个 customize 项得在 init.el 里翻半天,分不清哪些是自动写的、哪些是自己手写的。

这一条和 newcomers-presets 不冲突,无论哪种方案,都应该设 custom-file

包仓库优先级

(setq package-archives
      '(("gnu-elpa" . "https://elpa.gnu.org/packages/")
        ("nongnu" . "https://elpa.nongnu.org/nongnu/")
        ("melpa" . "https://melpa.org/packages/")))
(setq package-archive-priorities
      '(("gnu-elpa" . 3)
        ("nongnu" . 2)
        ("melpa" . 1)))

Prot 把 GNU ELPA 的优先级设为最高(3),NonGNU 其次(2),MELPA 最低(1)。 gnu-elpa 这个名字比默认的 gnu 更直观(新手容易混淆 gnuelpa )。

newcomers-presets 没动包仓库配置,只设了 package-autosuggest-mode 提醒用户装包。

通用设置(General options)

(defun prot/keyboard-quit-dwim ()
  "Do-What-I-Mean behaviour for a general `keyboard-quit'."
  (interactive)
  (cond
   ((region-active-p)
    (keyboard-quit))
   ((derived-mode-p 'completion-list-mode)
    (delete-completion-window))
   ((> (minibuffer-depth) 0)
    (abort-recursive-edit))
   (t
    (keyboard-quit))))

C-g 被绑定到一个 DWIM 函数:激活了区域就取消选择,打开了 minibuffer 就关闭,Completions buffer 被选中就关闭,否则退出的常规行为。这个函数把 C-g 改成了一个通用的"取消当前操作"按钮,非常实用。

(set-face-attribute 'default nil :family "Aporetic Sans Mono" :height 160)
(set-face-attribute 'fixed-pitch nil :family "Aporetic Serif Mono" :height 1.0)
(set-face-attribute 'variable-pitch nil :family "Aporetic Sans" :height 1.0)

字体设的是 Prot 自己做的 Aporetic 系列字体。读者换成自己的字体即可。

(setq custom-safe-themes t)
(setq use-short-answers t)
(setq read-answer-short t)
(setq help-window-select t)
(setq help-window-keep-selected t)
(setq window-combination-resize t)
(setq save-interprogram-paste-before-kill t)
(setq completion-category-defaults nil)

几个值得注意的:

  • custom-safe-themes t :最激进的一行。不再询问每个 theme 是否安全。Prot 的理由是"理论上任何 Elisp 文件都能跑任意代码,theme 安全提示在安全层面没实际作用"。这个看个人风险偏好。
  • use-short-answers t :把 yes/no 改成 y/n 。Emacs 28 引入,省事。
  • help-window-select t + help-window-keep-selected t :打开帮助窗口时自动聚焦,且在帮助 buffer 中继续按快捷键不会跳回原来的窗口。newcomers-presets 没设这些。
  • save-interprogram-paste-before-kill t :从系统剪贴板粘贴后,下次 kill 不会覆盖粘贴的内容。防止粘贴后不小心删掉东西找不回来。

会话与编辑

(savehist-mode 1)
(delete-selection-mode 1)

savehist-mode 和 newcomers-presets 里的 savehist-mode t 一回事。 delete-selection-mode (选中文本后输入直接替换)newcomers-presets 没设。

书签

(setq bookmark-fringe-mark nil)
(setq bookmark-save-flag 1)

关闭 fringe 上的书签图标(很多人不知道那是什么),且每增删一次书签就立即保存文件,而不是等 Emacs 退出时再写。

Dired

(setq dired-kill-when-opening-new-dired-buffer t)
(setq dired-auto-revert-buffer #'dired-directory-changed-p)
(setq dired-recursive-copies 'always)
(setq dired-recursive-deletes 'always)
(setq delete-by-moving-to-trash t)
(setq dired-create-destination-dirs 'ask)

Prot 的 Dired 配置比 newcomers-presets 丰富得多:

  • 打开新目录时复用当前 Dired buffer,不产生一堆 buffer
  • 递归复制和删除不需要确认(但删除走回收站,所以安全)
  • delete-by-moving-to-trash t :删除文件不进回收站的人应该不多

Isearch

(setq isearch-lazy-count t)
(setq lazy-count-prefix-format "(%s/%s) ")
(setq lazy-count-suffix-format nil)

搜索时实时显示"当前匹配 /总匹配数"。Emacs 30 开始默认就有,但 Prot 把格式改成了更紧凑的 (%s/%s) 前缀。

Ediff

(setq ediff-split-window-function 'split-window-horizontally)
(setq ediff-window-setup-function 'ediff-setup-windows-plain)

Ediff 的默认窗口布局在平铺窗口管理器上几乎没法用:控制面板会单独开一个 frame。Prot 把它改成水平分割的窗口内布局,这也是社区常见的优化。

辅助窗口布局(display-buffer-alist)

让帮助窗口、occur/grep 结果等出现在合适的位置,而不是随机占一个窗口。

(add-to-list 'display-buffer-alist
             '((or . ((derived-mode . occur-mode)
                      (derived-mode . grep-mode)
                      (derived-mode . Buffer-menu-mode)
                      (derived-mode . log-view-mode)
                      (derived-mode . help-mode)))
               (display-buffer-reuse-mode-window display-buffer-below-selected)
               (body-function . select-window)))

上例让 occur-mode、grep-mode 等辅助 buffer 优先复用一个同类型的窗口,否则在当前窗口下方打开,并自动聚焦。 display-buffer-alist 是 Emacs 窗口管理的高级话题,初学者可以直接照抄。

推荐的包

Prot 把推荐的包分了两级:

ESSENTIAL:vertico + marginalia

(vertico-mode 1)
(marginalia-mode 1)

vertico 提供垂直的补全候选列表(类似 Emacs 30 的 minibuffer-visible-completions 但更成熟), marginalia 在 minibuffer 中给每个候选显示额外信息(如文件大小、函数签名)。

有意思的是,newcomers-presets 选择了 Emacs 30 原生的补全增强,而 Prot 推荐了第三方包。两种方案都能用,但 vertico 的生态更成熟、社区用户更多。

VERY USEFUL:orderless + consult + embark + trashed

  • orderless — 灵活的补全匹配方式(输入空格分隔的关键词,匹配包含所有关键词的候选),替代 Prot 配置中的 completion-styles
  • consult — 增强版搜索/跳转命令( consult-bufferconsult-line 等)
  • embark — 对任意候选执行操作(比如在 minibuffer 中对文件候选执行复制、重命名等)
  • trashed — 回收站的文件管理器,跟 delete-by-moving-to-trash 配合使用

总结

Prot 这份配置和 newcomers-presets 不是替代关系。newcomers-presets 的目标是"给 Emacs 新手一个更好的默认值,不满意随时关",改动谨慎、可逆。Prot 的配置更接近"一个 Emacs 老手认为初学者应该用的设置",有些选择比较个人化( custom-safe-themes t 、DWIM 的 C-g )。

对读者来说,两个可以同时用:先加载 newcomers-presets 获得基础改进,再从 Prot 的配置里挑自己需要的片段加上。newcomers-presets 的完整代码在 Emacs 源码的 etc/themes/newcomers-presets-theme.el ,Prot 的这份配置在 他的博客