emacs-orgmode
[Top][All Lists]
Advanced

[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: Visuwesh
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: Mon, 23 Oct 2023 15:42:32 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[திங்கள் அக்டோபர் 23, 2023] Ihor Radchenko wrote:

>>> Also, we might want to add a subsection describing the new customization to
>>> 17 Miscellaneous section of the manual. Otherwise, users might have
>>> difficulties discovering relevant settings to customize dnd and yank
>>> behavior.
>>
>> I have now added these to the manual with a few relevant concept
>> indices.  Please check if they are understandable as I am terrible at
>> writing documentation.  Thanks.
>
> Thanks!
> Upon reading the manual sections I have further comments on the code:
>
> 1. org-yank-image-save-type feels a bit inconsistent. What about
>    org-yank-image-save-method? "Type" sounds more like extension (png,
>    jpeg, etc)

You're right, I have now changed the name to say method instead.

> 2. org-dnd-method allows either attaching files/images or putting them
>    into a dedicated directory. Same for yanked images. But it is not the
>    case for yanked files - they are always attached, which is not
>    consistent. May we also allow dedicated directory for yanked files?
>    Or maybe simply merge the org-dnd-method customization for yank and
>    dnd together.

Hmm... yes, I now made yank-media also respect the value of
org-dnd-method.  I changed the name of org-dnd-method to
org-yank-dnd-method and similarly for the rest of the common user
options.

Here's the new patch:

Attachment: 0001-Add-support-for-yank-media-and-DND.patch
Description: Text Data

> I am attaching my further amendments on top of your patch.
> For simpler review, I am also adding the manual section verbatim.
>
> To other readers of this thread: Please help reviewing the manual
> section - it should be as clear as possible for everyone.

Thanks for your review.  The manual now says:

** Drag and Drop & ~yank-media~
:PROPERTIES:
:DESCRIPTION: Dropping and pasting files and images
:END:

#+cindex: dropping files
#+cindex: dragging files
#+cindex: drag and drop
#+cindex: dnd
#+vindex: org-yank-dnd-method
Org mode supports drag and drop (DnD) of files.  By default, Org asks
the user what must be done with the dropped file: attach it, insert
=file:= link, or open the file.  Customize ~org-yank-dnd-method~ to
set the default DnD action.

When DnD method is "attach", Org mode first consults DnD metadata to
decide the attach method.  For example, when file/files are dragged
from a file manager, Org may attach by copying or by moving.

#+vindex: org-yank-dnd-default-attach-method
If Org cannot figure out which attachment method to use from the
metadata, it defaults to ~org-yank-dnd-default-attach-method~ [fn::By
default, ~org-yank-dnd-default-attach-method~ is set to nil -- use the same
value as ~org-attach-method~ (~cp~ by default).]

#+cindex: pasting files, images from clipboard
Starting from Emacs 29, Org mode supports ~yank-media~ command to yank
images from the clipboard and files from a file manager.

#+vindex: org-yank-image-save-method
When yanking images from clipboard, Org saves the image on disk and
inserts the image link to Org buffer.  Images are either saved as
attachments to heading (default) or to a globally defined directory.
The save location is controlled by ~org-yank-image-save-method~.

#+vindex: org-yank-image-file-name-function
The yanked images are saved under automatically generated name.  You
can customize ~org-yank-image-file-name-function~ to make Org query
the image names or change the naming scheme.

When yanking files copied from a file manager, Org respects the value
of ~org-yank-dnd-method~.  Image files pasted this way also respect
the value of ~org-yank-image-save-method~ when the action to perform
is =attach=.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]