需求描述:
- 用各种截图软件进行截图(到剪贴板)
- 在 Emacs 的 org 文件中粘贴
- Minibuffer 提示输入文件名称(例如输入了filename.png)
- 文件自动保存为: ./images/filename.png
可以通过org-download 或者其它插件满足上述需求吗?
需求描述:
可以通过org-download 或者其它插件满足上述需求吗?
;;-------------------------------------------------- (defun org-insert-image () “insert a image from clipboard” (interactive) (let* ((path (concat default-directory “images/”)) (fname (read-string "Enter file name: ")) (image-file (concat path fname))) (if (not (file-exists-p path)) (mkdir path)) (do-applescript (concat “set the_path to "” image-file “" \n” “set png_data to the clipboard as «class PNGf» \n” “set the_file to open for access (POSIX file the_path as string) with write permission \n” “write png_data to the_file \n” “close access the_file”)) ;; (shell-command (concat "pngpaste " image-file)) (org-insert-link nil (concat “file:” image-file) “”) (message image-file)) (org-display-inline-images) )
(map! :leader :desc “Insert image” “i i” #'org-insert-image)
;;--------------------------------------------------
完美解决了! 增加了输入文件名的步骤。