我抄了这个链接里的配置,
(org-download-screenshot-method "powershell.exe -Command \"(Get-Clipboard -Format image).Save('$(wslpath -w %s)')\"")
执行 org-download-screenshot
报错
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
org-download-screenshot()
funcall-interactively(org-download-screenshot)
command-execute(org-download-screenshot)
经过测试 org-download-screen-method
在 fish 中是可以正确执行的。
我还在 fish 中自定义了一个函数
function save_clipboard_image
set imagepathwindows (wslpath -w $argv)
powershell.exe -Command "(Get-Clipboard -Format image).save('$imagepathwindows')"
end
这个函数在 emacs 中使用 shell-command
执行可以成功,但指定它为 org-download-screen-method
有同样的报错。
上面那个链接里自定义的插入图片函数我试了也不行,图片没有被保存到wsl中。
目前的插入图片方法是我用 org-download-image
写了一个函数,
(defun org-download-windows-image (windows_path)
"Download an image from a Windows path and insert it into the current Org file."
(interactive "sWindows Path: ")
(let ((path (substring (shell-command-to-string (concat "wslpath " windows_path)) 0 -1)))
(org-download-image path)))
可以输入图片在 Windows 中的路径把它插入到 org 里。但这样插入截图要先保存下来,再复制路径粘贴到 emacs 中,非常麻烦。
不知道是哪里出了问题,尝试了几天都没有办法,希望有大佬能帮忙解决。