lorniu / go-translate

Translator on Emacs. Supports multiple engines such as Google, Bing, deepL, ChatGPT, StarDict, Youdao and so on.
GNU General Public License v3.0
283 stars 38 forks source link

gts-translate-list can not manage dotted pairs #26

Closed gynamics closed 2 years ago

gynamics commented 2 years ago

我试图用custom-group对变量gts-translate-list进行配置,该变量在defcustom中设置为alist类型,默认存储为加点对,但是gts-all-paths似乎并不能正确处理加点对。问题在于gts-core.el第385-386行的cadrcdr作用于列表和加点对产生的结果是不同的。

383             for path in candidates
384             do (progn
385                  (cl-pushnew (cons (car path) (cadr path)) paths :test 'equal)
386                  (cl-pushnew (cons (cadr path) (car path)) paths :test 'equal)))

为了兼容加点对,我的修改建议如下:

385                  (cl-pushnew (cons (car path) (if (consp (cdr path)) (cadr path) (cdr path))) paths :test 'equal)
386                  (cl-pushnew (cons (if (consp (cdr path)) (cadr path) (cdr path)) (car path)) paths :test 'equal)))
lorniu commented 2 years ago

谢谢,已更新。