我如何深度整合 Emacs
How I am deeply integrating Emacs

原始链接: https://joshblais.com/blog/how-i-am-deeply-integrating-emacs/

这篇帖子详细介绍了作者将 Emacs 打造成其核心计算环境的过程,旨在实现无缝的工作流程,让想法可以直接在编辑器中转化为行动。他们通过使用 Hyprland 作为窗口管理器(因其 Wayland 兼容性和与 Emacs 的性能)以及一个自定义的 Go 脚本从系统中的任何位置快速启动 Emacs 函数,实现了深度集成。 该设置远不止文本编辑,还包括一个用于启动应用程序的通用启动器、SSH、密码(使用 `pass`)、文件浏览 (`dirvish`)、电子邮件 (`mu4e`)、信息源阅读 (`elfeed`)、音乐 (`emms`),甚至可以直接编辑网页上的文本。Hyprland 中的键绑定会触发这些 Emacs 函数,以及 org-mode 集成,用于笔记、任务和日历事件。 作者曾考虑过 EXWM(将 Emacs *作为*窗口管理器运行),但由于 Emacs 的单线程特性以及 Wayland 的日益重要性而犹豫不决。最终,他们在其当前设置中复制了 EXWM 的许多功能,寻求一种整体的、以 Emacs 为中心的、最大化生产力的工作流程。他们邀请读者分享自己以 Emacs 为中心的设置。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 我如何深度集成 Emacs (joshblais.com) 8 分,来自 signa11 50 分钟前 | 隐藏 | 过去 | 收藏 | 讨论 考虑申请 YC 的 2026 年冬季批次!申请截止日期为 11 月 10 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

img

Emacs has holistically become my daily computing environment.

My efforts have been focused on building emacs into the workflow of essentially everything I do, as long as it doesn’t involve heavy video or media, I try my very best to accomplish it in emacs. The idea is to achieve deep integration with everything I do on a computer, to the degree my thoughts are immediately able to be acted upon in the buffer.

I use hyprland as my window manager, and while I have heard of other managers/DEs (I was using GNOME for the better part of 6 months), I keep coming back to hyprland just because it works and is easy to configure. Also, for some reason, I seem not to have laggin in emacs on wayland in hyprland, while I had to previously run emacs in X11 mode in GNOME, go figure.

My Motivation

I have seen what people are capable of doing when their tools get out of the way, and they are free to just create. This is how world class athletes, musicians, artists, writers, and of course programmers take what is in their mind and translate it into reality. The idea is that if I can learn this “editor of a lifetime” - then the things that I want to create, the programs I want to write, will be achieved in a near frictionless environment, allowing for velocity that is not possible elsewhere. It is the ultimate sharpening of the axe before chopping the tree.

Why not EXWM?

I have considered using EXWM as the window manager (quite literally offloading window management to emacs, and “living in emacs” - to more of a degree than I do already), the hesitation I have is that:

  1. Emacs is single threaded, therefore if anything in the system hangs, the whole system hangs, and
  2. It is only X11 where most of the development and forward movement in the linux space has been in wayland. While I understand this is not a tremendous issue, wayland does seem to be where the puck is going.

So, what I am aiming to do is replicate functionality as best as I can from EXWM to a wayland environment - not wholly possible, but also not wholly impossible, either.

The Emacs Launcher program

If you look at my dotfiles, you can see I have a script written in Go that allows me to call each and every one of my emacs controls anywhere is my system. I was previously calling each of these emacs commands in bash and with a sleep command so as to make sure I was targeting the emacs instance. No longer. This Go script has sped up my workflow by 10x.

My Current setup

How I Launch Emacs

bind = $mainMod SHIFT, E, exec, bash -c "emacs"

I almost never press this keybind, as emacs is opened from the get-go in my hyprland sessions. For that rare time I need to re-open it.

Opening vterm as my default terminal

bind = $mainMod, E, exec, emacsclient -n -e '(my/new-frame-with-vterm)'

This permits me to quickly open a vterm window and enter commands etc. If I need anything that is more graphically intense, I fallback to kitty terminal, but this is less and less these days.

Opening vterm in my emacs session quickly for in projects is done like so:

bind = $mainMod, RETURN, exec, ~/.config/hypr/scripts/emacs-launcher '(my-open-vterm-at-point)'

Universal Launcher

bind = $mainMod, SPACE, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (universal-launcher-popup))'

I wanted to replicate a launcher (similar to wofi/rofi) in which I could easily launch apps and switch to them in the environment.

So, my take on this is to replace wofi with this functionality. I was using ssh providers in GNOME, but then brought the functionality into my universal launcher. It has effectively grown to encapsulate:

  • Passwords
  • SSH
  • Bookmarking
  • Commands and program launching
  • Emojis
  • TODOS (though org-agenda/calendar also handles this)
  • File navigation
  • Web and documentation search

While this is a work in progress, I use it every day, hundreds of times a day, and love the flow & speed my launcher allows.

Capture to org mode

bind = CTRL SHIFT, c, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (org-capture))'

When I am not “in” emacs (I am always in emacs by extension) I can still capture direct to emacs with a quick keybind.

I capture to my org directory:

  • notes
  • bookmarks
  • contacts
  • inbox (todos)
  • events/deadlines

This is very useful when I am wanting to save a thought, idea, bookmark, quote, what have you, and then integrate it with my org-roam file structure.

Notes

bind = $mainMod CTRL, N, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (find-file "~/org/notes.org"))'

I can navigate to my notes file very quickly to write emails, keep notes on stuff, and then translate those into my org-roam directory, too.

Calendar/Org Agenda

bind = $mainMod, C, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (=calendar))'

bind = $mainMod, N, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (my/org-agenda-dashboard))'

Quick access to my agenda and calendar from anywhere.

Password manager

bind = $mainMod, P, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (pass))'

Password-store inside emacs to create, update, grab passwords and insert them on page in browsers.

File Browsing

bind = $mainMod, F, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (dirvish))'

I use dirvish/dired for nearly all my file browsing and manipulation. I have some binds that allow me to pull up thunar for graphical drag-drop operations, but other than that files are dealt with inside emacs.

The killer feature is that you can edit files as you would edit text, nothing else comes close.

Bookmarks

bind = $mainMod, B, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (find-file "~/org/bookmarks.org"))'

Bookmarking within emacs allows me to keep all sites top of mind.

Email

bind = $mainMod, M, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (=mu4e))'

The greatest email client.

Feed reader

bind = $mainMod CTRL, Z, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (elfeed))'

Reading any feed from around the web, I follow youtube, blogs, news, etc. here - never going out to the web to read anything.

Music playing

bind = $mainMod CONTROL, M, exec, ~/.config/hypr/scripts/emacs-launcher '(progn (select-frame-set-input-focus (selected-frame)) (emms-playlist-mode-go))'

You thought I wouldn’t play music in emacs?

Emacs everywhere for editing text anywhere

bind = $mainMod CONTROL, E, exec, emacsclient --eval '(thanos/type)'

When you are in a text box on any site, you can just edit the text in emacs, press C-c C-c and have it pasted right there for you.

Will I use EXWM?

I think that because I spend so much time inside emacs, I don’t really get the benefits of everything being a buffer. I only use a browser for projects, not as a window I have always open, and I don’t really need emacs to control buffers or give me the keybinds universally. I will never say never though, perhaps one day it will be my window manager of choice.

How are you integrating emacs in your workflow? I would be super interested to see other setups that allow you to use emacs as your one, true, holistic computing environment. Shoot me an email and tell me how it’s done!

As always, God bless, and until next time.

If you enjoyed this post, consider supporting my work by Buying me a Coffee, Checking out my book, or sending me an email to tell me what you think.

联系我们 contact @ memedata.com