
开发者更新2026版Emacs全局文件查找配置
来源标题:Find files anywhere, updated for 2026
开发者发布了其2026年更新的Emacs全局文件查找配置,用于在大量小项目间快速定位文件。该方案通过每小时定时任务生成约1.7万个常用文件名的全局列表,再结合locate或mdfind结果过滤,弥补locate范围过宽的问题。
以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。
This is a blog post draft from Amit Patel (of Red Blob Games fame). It's a well-written technical piece. Rather than just praise it, let me point out some issues you may want to address before publishing.
Technical issues
1. Linux fd discrepancy
The Mac minutely cron relies on mdfind and you note that fd --changed-within 2hours is "probably the best bet" on Linux. But the article never shows the Linux version. Given the audience pays attention to detail, either show the Linux crontab lines and the fact that they write to ~/.recent-file-list.txt, or drop the speculation.
2. The hourly example is Mac-only and doesn't include a Linux equivalent. If you're cross-platform, add something like:
fd --type f --changed-within 45d --exclude .git . "$HOME" | sort -r > ~/.global-file-list.txt
(or whatever you actually use—I'd want to see your real crontab).
3. Bug in amitp/remove-generated-files
You call map-delete with a key that may not exist. That's harmless in Emacs, but the function also silently treats .md and .org as the only source-code extensions—worth a comment for readers remixing.
4. amitp/all-files-list uses delete-dups on a list whose last element is nil (you already note this in the comment). Clever, but a reader copying the code without the trailing nil would get confusing behavior. Maybe pull the pattern out as a named function or at least add a one-line comment on why nil is there.
5. Undefined helpers referenced but not shown:
amitp/abbreviate-file-nameamitp/buffer-file-namesamitp/all-files-in-current-projectamitp/project-root-for-directory-amitp/replace-ext
Readers can't run the code as-is. If your goal is "the ingredients may be useful," list them in an appendix, or link to your full init.el.
6. -take 1 recentf-list — this suggests recentf-list is ordered by recency, and you want the most recent file first. Worth a one-sentence explanation; many readers use recentf differently.
Structural / editorial
- Title/lede mismatch: The title promises "updated for 2026" but the content doesn't say what's changed since 2017 beyond "now I use vertico+marginalia instead of ivy". Add a short "What changed since 2017" paragraph up top.
- Numbering inconsistency: sections start at "3. Dynamic file list" but 1 and 2 aren't labeled. Either number all of them or none.
- "around 17000" — a precise count with a date would be more useful ("17,400 files as of Jan 2026").
- Missing benchmarks — you give 0.1s for
mdfindbut sayfdis "over 10X as long". A concrete number forfdwould help readers decide whether the Linux story is viable. - Path abbreviation in
~/.global-file-list.txt— you callabbreviate-file-nameon load, but the file itself presumably stores absolute paths. Note that$HOMEappears literally in the crontab. Readers on a different home dir will need to adjust.
Small copy edits
- "emacs set up" → "Emacs setup"
- "I have to switch folders quite often" → "I have to switch folders quite often" (fine)
- "the freshest things" — good phrase, keep it
- "I essentially want to treat my home folder as one big project." — great summary sentence; consider moving it to the lede.
Suggested addition
A short "Why not Projectile/project.el?" section. Anyone reading "treat my home folder as one big project" will immediately ask. Your answer (project.el is per-project; you have many small projects) is worth stating explicitly.
Want me to draft any of these—e.g., a "What changed since 2017" intro, or a Linux crontab section?
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。
