Aidermacs:Emacs 里的 AI 代码助手,真正适配 Emacs 的 Aider 体验

我觉得aider最大的问题在于不经过你确认就把代码改了,代码有问题很可能还得回退。

而如果把aider每次修改后commit这个功能关闭,回退都不一定方便(没试过,不很确定aider有没有支持)。而每次aider修改后就commit,在有些公司不一定被允许。

就像reddit里有个人评论的一样,我个人更希望看到一个更好的aider。

1 个赞

加载和保存 session 可以用 /save /load

第一种情况就是不 auto commit (aider —no-auto-commits) 自己 manage commit 的状态。

第二种情况就是 auto commit,然后自己去 ammend drop,squash,revert,rebase。相当于把 git 的 commit history 当作编辑器的 undo-redo tree 来使用。

不管怎样就是要更频繁的使用 git。感觉最好的方式是每次用 aider 就开一个新分支。分支里 commit 随便怎么搞,改完了合并到主分支的时候使用 squash merge。

感觉 agent 自动改代码应该也是为了 agentic 的 workflow 连贯完整实现起来方便,要不然 ai 代码改到一半了被你拒绝了,那后续的 workflow 没走完流程该怎么走? cursor composer 也采用了自动改代码的思路。

我在考虑把这个做成一个defcustom来提升visibility

我刚刚推送了一个更新, aidermacs--current-output 让Emacs可以实时记录aider最后的输出。

目前的实现有点hack,如果大家知道如何调整,欢迎提PR。

彻底打通Emacs与aider输入输出的通道后,可以玩太多有趣的东西了,欢迎一起玩!

1 个赞

Aidermacs 两日更新:

  1. vterm和comint双选择
  1. aidermacs--current-output 彻底打通Emacs与aider输入输出通道
  2. M-x aidermacs-list-added-files 添加文件 和 M-x aidermacs-drop-file 移除文件
  1. 重新整理 transient 菜单(暂时没加入二级菜单)
  1. (setq aidermacs-auto-commits nil) 可以关闭 自动 commit

  2. M-x aidermacs-run-in-current-dir 可以将 Aidermacs 从你当前dir启动,自带--subtree-only

感谢 @milan-glacier@zsxh 两位大佬的PR!!

最新版已经重新refactor transient菜单,加入了二级菜单了。

1 个赞

aidermacs可以通过emacs的方式 (setq aidermacs-auto-commits nil) 关闭Autocommit,省得你自己加arg


由于Aider 的auto-commit实在过于烦人,Aidermacs已经默认关闭auto-commit,如果有人喜欢,可以手动打开 (setq aidermacs-auto-commits t)

Aidermacs预想: In the long run I want to eliminate the need for a terminal at all, interaction should be streamlined from Emacs to Aider directly, having any terminal, whether comint or vterm or EAT, is a compromise because aider is CLI.

有精力的同学可以一起来实现一下。

发现你把fork之后昨晚我merge的PR Refactor: remove aider--infix-add-file-read-only, add aider-drop-current-file, and fix dup short key in menu by tninja · Pull Request #88 · tninja/aider.el · GitHub 相关的change 加你的code里了。这是我第一次做开源工作,经验有限;不知道在不通知别人, 也不注明从哪里来的的情况下就这么做是否礼貌。我以前在学校的时候,写论文,引用别人的工作,也要加参考文献的。

是的,这是你第一次做开源工作,欢迎了解一下开源是什么:开源协议是什么?都有什么区别?_哔哩哔哩_bilibili

这是你的Aider.el开源协议的原文,如果看不懂,可以问问ChatGPT:GitHub - tninja/aider.el: aider emacs plugin for https://github.com/paul-gauthier/aider

最后回应一下你的accusation:

我已经在所有场合所有文件都有注明并再三强调Aidermacs来源自Aider.el,,每一页.el文件都有注明你的名字,我想我应该不需要把

Aidermacs fork 自 Aider.el

这几个大字写在脸上吧?应该吧?

虽然我理解你的注意力,理解能力和阅读能力都有问题,但你信口开河的能力也太让人叹为观止了。

fork之前的所有change 没问题,我也没说什么。之后的,是否要说明一下?

不需要。

只要他还再公开代码的情况下没改提交记录󠄃的人的名字,你也没更新协议,也就不需要通知你。

他的代码是我手动改的,不是完全的rebase,所以名字记录被我overwrite掉了。

如果有意见,我不是不可以去改一下加回来,但会导致重写历史,影响Aidermacs的所有用户。之后我可以注意一下。

可以参考AI的说法:

No, if you take inspiration from an upstream commit but rewrite the code yourself, it does **not** violate the Apache 2.0 License—as long as you are not directly copying significant portions of the original code without proper attribution.

Key Considerations:

  1. Independent Implementation :

• If you read an upstream commit, understand the logic, and then write your own implementation without copying the original code, this is generally fine and does not require attribution.

  1. Partial Code Reuse :

• If you copy small snippets (e.g., a few lines, a helper function), it’s good practice to mention the original source in a comment, but this is not strictly required by Apache 2.0 unless there’s a NOTICE file requiring specific attribution.

  1. Direct Code Copying :

• If you copy a commit’s code verbatim (or with minor modifications), you must retain the original copyright and attribution, either in the commit history (if merging) or in the source code comments (if copying manually).

  1. Derivative Works :

• If your new implementation is substantially similar to the original, it may still be considered a derivative work. The Apache 2.0 License allows this, but attribution is expected.

这种情况下建议用 git 的 coauthor

https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors

3 个赞

了解了,下次就用。

谢谢,还有能否请回答的时候不要人身攻击,比如说 注意力,理解能力和阅读能力都有问题 信口开河什么的,看了实在不太舒服。

1 个赞

“信口开河”上升到人身攻击的程度和你指控我“不礼貌”的程度差不多。

注意力,理解能力和阅读能力,我可不是空口无凭,我有非常多的证据证明你的理解能力阅读能力都有一定的问题,还需要我再列一遍吗?算了,反正列了你也没注意力看。

更何况啊,我说你信口开河真的说错了吗?

这可是你的原文啊。

F二级菜单我能打开,C二级菜单却打不开 我 是这样安装 的aidermacs (package-vc-install '(aidermacs :url “[email protected]:MatthewZMD/aidermacs.git”)) transient-20250213.1156 版本

我刚刚也注意到了,还没来得及研究是啥问题就在论坛上被骂了哈哈,我马上来修一下~