[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)] |
Date: |
Sun, 08 Oct 2023 09:30:06 +0000 |
Visuwesh <visuweshm@gmail.com> writes:
> This was far easier than I initially thought. Patch attached.
Thanks!
I tried to install the patch and I have two more comments.
> +(defun org-yank-image-autogen-filename ()
> + "Autogenerate filename for image in clipboard."
> + (format-time-string "clipboard-%Y-%m-%d-%H:%M"))
This is too coarse - no more than a single unique image name per minute.
What about the default value of `org-id-ts-format' - "%Y%m%dT%H%M%S.%6N"?
This is guaranteed to be unique.
> +(defun org--image-yank-media-handler (mimetype data)
> + "Save image DATA of mime-type MIMETYPE and insert link at point.
> +It is saved as per `org-yank-image-save-type'. The name for the
> +image is prompted and the extension is automatically added to the
> +end."
> ...
> + (if (null (eq org-yank-image-save-type 'attach))
> + (setq link (org-link-make-string
> + (concat "file:" (file-relative-name absname))
> + filename))
I do not like that the inserted image link is with description. Images
with description cannot be previewed by default. I think that no
description would be more handy as one could then M-x yank-media
followed by M-x org-display-inline-images to see the inserted image
immediately.
> + (org-link-make-string
> + (concat (if separatep
> + "file:"
> + "attachment:")
> + (if separatep
> + (expand-file-name (file-name-nondirectory filename)
> + org-yank-image-save-type)
> + (file-name-nondirectory filename)))
Same here.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Po Lu, 2023/10/06
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/07
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Visuwesh, 2023/10/07
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/07
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Visuwesh, 2023/10/07
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)],
Ihor Radchenko <=
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Visuwesh, 2023/10/08
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/09
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Visuwesh, 2023/10/09
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Visuwesh, 2023/10/19
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/19
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Po Lu, 2023/10/19
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/20
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Po Lu, 2023/10/20
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Ihor Radchenko, 2023/10/20
- Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)], Po Lu, 2023/10/20