Perplexity AI 寫 emacs lisp 的能力真得很不錯...
https://www.perplexity.ai/search/i-wish-to-have-a-elisp-functio-.H0qDKViR.27dCZILcH_5w
忘了分享這則對話。
基本上我要它做一個 interactive function 給我,能夠吃 "ghq list -p" 然後然我以 fuzzy search 的方式選一個路徑,然後要用 magit 去打開我所選的路徑。
基本上第一個答案給的就已經是可動而且是 minimum implementation,沒有依賴如 ivy 或 helm 等外部的函式庫。
fuzzy search 的部分是中途增加的,也是沒有是使用外部函式庫。
我後來手動把這段
(split-string (shell-command-to-string "ghq list -p") "\n" t)
調爲
(process-lines "ghq" "list" "-p")
主要是 error handling 較好 (shell command 可能會出錯)。
但基本上沒什麼不乖的(?)地方了。