我之前也遇到了这个问题,即使安装了ImageMagick也得确保它的路径在PATH环境变量的最前面,否则找到的就是系统自带的convert.exe,不过由于是系统自带的convert.exe,可能会有程序去用这个东西,我怕如果把ImageMagick的路径提到PATH之前,导致其他原本要用系统自带的convert.exe现在变成去用ImageMagick的convert.exe会导致出错,同时我还不确定除了convert.exe还有没有其他同名程序会被ImageMagick的覆盖。
编辑下答案。。。这里我不该用advice,定义个新command,绑定按键到新command就好。
一个可选的解决方案是,覆盖org-download-clipboard
,让它使用magick convert,不要用convert:
(when (memq system-type '(windows-nt cygwin))
(define-advice org-download-clipboard (:override (&rest args))
"Copy image from clipboard to a file using 'magick convert' instead of 'convert'."
(unless (executable-find "magick")
(user-error
"Please install ImageMagick and put its path inside the PATH environment variable"))
(let ((org-download-screenshot-method "magick convert clipboard: %s"))
(apply #'org-download-screenshot args))))
不过由于覆盖了整个函数的实现,感觉有点不干净。。。不过org-download也没提供相应的定制选项,我也没找到比较好的修改点。