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

推荐订阅源

腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
A
About on SuperTechFans
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
The Cloudflare Blog
F
Fortinet All Blogs
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
罗磊的独立博客
量子位
有赞技术团队
有赞技术团队
V
V2EX
Engineering at Meta
Engineering at Meta

暗无天日

读: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 写文档,却不愿为同事写 - 暗无天日
TIL: 用 Org-mode 列表管理选择题题库 - 暗无天日
2026-05-06 · via 暗无天日

Randy Ridenour 在 博客 上介绍了一种用 Org-mode 有序列表管理选择题的方法:数字编号是题目,字母编号是选项,正确答案后面加 *

1. 下面哪个是 Emacs 的默认编辑器?
   a) Vim
   b) nano
   c) Emacs*
   d) ed
2. Elisp 中哪个函数用于向前搜索正则表达式?
   a) string-match
   b) re-search-forward*
   c) looking-at
   d) search-forward
3. 下面哪个是 Vim 的默认编辑器?
   a) Vim*
   b) nano
   c) Emacs
   d) ed

这种格式的好处是 Org-mode 自带列表操作: M-up / M-down 移动题目(连子项一起拖), org-list-repair 重编号。

下面函数可以从题库选题到*scratch*,首先找到题目边界:

(defun my/copy-mcq-to-scratch ()
  "Copy the multiple choice question at point to the *scratch* buffer."
  (interactive)
  (save-excursion
    (let* ((question-start
            (progn
              (end-of-line)
              (if (re-search-backward "^[0-9]+\\." nil t)
                  (point)
                (error "No question found at point"))))
           (question-end
            (progn
              (goto-char question-start)
              (forward-line 1)
              (if (re-search-forward "^[0-9]+\\." nil t)
                  (match-beginning 0)
                (point-max))))
           (text (buffer-substring-no-properties question-start question-end)))
      (with-current-buffer (get-buffer-create "*scratch*")
        (goto-char (point-max))
        (insert text)))))

向上搜 ^[0-9]+\\. 定位题目开头,向下搜下一个同模式匹配作为题目结尾,中间就是一道完整题目。

删除题目也用同样的边界定位,删完后调 org-list-repair 重编号:

(defun my/delete-mcq-at-point ()
  "Delete the multiple choice question at point."
  (interactive)
  (save-excursion
    (beginning-of-line)
    (unless (looking-at "[[:space:]]*[0-9]+\\.")
      (re-search-backward "^[[:space:]]*[0-9]+\\." nil t))
    (let ((start (line-beginning-position))
          (end (progn
                 (forward-line 1)
                 (if (re-search-forward "^[0-9]+\\." nil t)
                     (match-beginning 0)
                   (point-max)))))
      (kill-region start end)))
  (org-list-repair))

这里用 kill-region 而不是 delete-region ,是因为这样删掉的题进 kill ring,还能捞回来。