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

你试试最新版

1 个赞

Command: Code Action: Code change OS: macOS Emacs version: master

还是没看到高亮,然后这个文件是第一次编辑,没触发ediff,直接修改了

../../../../../../../../.emacs.d/straight/build/aidermacs/aidermacs-backends.el: Warning: ‘when-let’ is an obsolete macro (as of 31.1); use ‘when-let*’ or ‘and-let*’ instead. [2 times]
Unbound suffix: ‘<escape>’ (Use ‘C-g’ to abort, ‘?’ for help) [ignore]
Running aider with (--model ollama_chat/qwen2.5-coder:7b --no-auto-commits)
comint-redirect-send-command-to-process: No prompt found or ‘comint-prompt-regexp’ not set properly
next-line: End of buffer [2 times]
error in process filter: Quit [2 times]
C-c c is undefined
Preparing code edit for (src/aoc/aoc24/day4.clj)
Added 1 files as editable
Preparing code edit for (src/aoc/aoc24/day4.clj)
Modified 1 file(s): src/aoc/aoc24/day4.clj
No pre-edit buffer found for src/aoc/aoc24/day4.clj, skipping
Reverting buffer ‘day4.clj’

不确定是不是我aider没有配置?我看演示视频里放回的markdown code block都有对应的language tag,而我这里是没有的

太怪了。你加个这个patch看看:

From 6e3228167735fbc11c92fa063461269f37f16163 Mon Sep 17 00:00:00 2001
From: "Mingde (Matthew) Zeng" <[email protected]>
Date: Sat, 15 Mar 2025 14:14:32 -0400
Subject: [PATCH] Test edit

Signed-off-by: Mingde (Matthew) Zeng <[email protected]>
---
 aidermacs-backend-comint.el | 1 +
 aidermacs.el                | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el
index 4b73907..9e8dcc4 100644
--- a/aidermacs-backend-comint.el
+++ b/aidermacs-backend-comint.el
@@ -112,6 +112,7 @@ that was matched at the start of the current syntax block.")
       (aidermacs--store-output aidermacs--comint-output-temp)
       ;; Check if any files were edited and show ediff if needed
       (let ((edited-files (aidermacs--detect-edited-files)))
+        (message "edited files %s" edited-files)
         (if edited-files
             (aidermacs--show-ediff-for-edited-files edited-files)
           (aidermacs--cleanup-temp-buffers)))
diff --git a/aidermacs.el b/aidermacs.el
index 238bd39..e3601d3 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -307,6 +307,7 @@ This is called when all ediff sessions are complete.
 Kills all pre-edit buffers that were created to store original file content."
   (interactive)
   (with-current-buffer (get-buffer (aidermacs-get-buffer-name))
+    (message "Cleanup %s" aidermacs--pre-edit-file-buffers)
     ;; Clean up buffers in the tracking list
     (dolist (file-pair aidermacs--pre-edit-file-buffers)
       (let ((temp-buffer (cdr file-pair)))
@@ -340,6 +341,7 @@ This is skipped if `aidermacs-show-diff-after-change' is nil."
                :test (lambda (a b) (equal (car a) (car b)))))
         ;; Remove nil entries from the list (where capture failed or was skipped)
         (setq aidermacs--pre-edit-file-buffers (delq nil aidermacs--pre-edit-file-buffers))
+        (message "Set pre-edit buffers %s" aidermacs--pre-edit-file-buffers)
         ;; Run again if it's nil
         (unless aidermacs--pre-edit-file-buffers
           (aidermacs--prepare-for-code-edit))))))
@@ -368,6 +370,7 @@ Returns a list of files that have been modified according to the output."
         (edited-files)
         (unique-files)
         (valid-files))
+    (message "Detecting edit files")
     (when output
       (with-temp-buffer
         (insert output)
-- 
2.48.1

之前重构用了29的新函数,27太老了,没办法更新吗?

安装上compat看行不行

compat?

Aidermacs 上线 non-gnu elpa 啦!

上线 nongnu-elpa 以后最好就要定期发布 tagged release 了。没记错的话 nongnu-elpa 应该只允许发布 tagged release,master branch 应该只能从 elpa-devel 下载。

同时最好每次发新 tag release 的时候也更新一下 changelog,更新 changelog 这个活让 LLM 做就行,很方便。当然 LLM 通常生成的会比较啰嗦,我会调整一番,删掉很多不重要的内容。

了解! Aidermacs 1.0 上线啦

一个月的时间,Aidermacs已经有了25个贡献者,并突破300星的大关,证明了Aidermacs最开始决定fork的价值,感谢大家的支持!!

3 个赞

请问 aidermacs 是需要依赖 vterm嘛,我在装包的时候提示需要编译 libvterm,还是我的操作姿势不对?windows上貌似用不了 vterm,大家是怎么解决的?

是vterm比较恶心,如果emacs库里有这个package,就算不用,仅仅是检测,也要求你编译。如果你确认不用的话,你直接把vterm删了就好了

1 个赞

不好意思,漏掉了你前面的回复。按理来说不应该,我也是Macbook Pro M3,编译vterm是没问题的。但不管怎么说,可以从init.el删掉vterm相关配置,就不会有这个问题了。

1 个赞

对, 这个package就是给老版本emacs兼容准备的, 实现了新版本里面的很多函数.

改动已完成,git pull 既可以体验,我没有旧版emacs,可以试一下,现在Emacs最低版本要求也降到26了。

希望隔壁下次在自我宣传的时候,尽量少强调一行代码就能解决的问题来突出自己的差异,多花时间打磨自己的功能,证明自己的依赖是否真的如自己所宣传那般”为了稳定性仔细测试“。
1 个赞

写一个 CI吧,可以自动探测一些问题,类似

好!

Aidermacs 要求 project-root 这个函数,而它是28才有的,我看compat没有实现它,有点苦恼,现在只能depend在28了。

这个简单,可以实现一个简易版的作为fallback,比如让用户自己输入root路径

或者用vc包里面的函数,或者依赖projectile,方式很多