From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id KPFgDXc1NmW5ZgEAG6o9tA:P1 (envelope-from ) for ; Mon, 23 Oct 2023 10:57:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id KPFgDXc1NmW5ZgEAG6o9tA (envelope-from ) for ; Mon, 23 Oct 2023 10:57:27 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A5E296A2FB for ; Mon, 23 Oct 2023 10:57:26 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=cfJdYvRW; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698051447; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2Mp1nzseWrbuCRf6iMUXPXTbNh4rvi9NmuQrLy+XrNk=; b=QOid/NghsJgwfYCaQPYKg1sh8cnkTet5pU2Q5qnJMCGUkBXr7DXAUZ5PFs/B7oaGjnpTIv 0+HEpdTKEjEg+J1ul4XxsVF6M+OS11VZGIkCBjcw6b8zxNUNQ8NWLm6u8yc/v/6pQ9sGLL ZQjQizgIpQksN5402aVp9iDMuUVo3dTwK2s2AftOEidfSFPgyrHgxbqrN7kEZmrY8ZoHtj FEXs2Lu14FoowQY0ycQ7MVE/oILGAG5qV/rvwEvw1DHFtAF3FTJ29Fmxp90pocokRzegob F0z42iV0RUr+JC4lvjPK/yKdzRYmM/pmvxF7ttBABVnekXDYK/lLXegDl3IY1Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698051447; a=rsa-sha256; cv=none; b=eGEkfKE9q17bg925kEJzbE404NptNdloYIO2YWwWHot3RSuFfNOBLVm5+TqCkJWK7xbocy 7qHHtdo/a9qafcu84ZyVxNj3dUjjXkB/ypTOgDpYG+FcyKOHQGvzG12Juchggy9bOa8MMP AuLNJLhOTwZcGf2Gv9y/aRTAe6nz2sG84RGVdVBYHH9gmyQZBRS2yqVTFPhH6oEDwy0B+c y8LbLWEljGOle1c4s4YimvGzFKhPnVv/2SSsorpDXQ+i5UkTCvWPV382yUZmzkCMQXLvhV 9J00tu9t8w/GiJ2vO4lBG2xpDHaTS8I6VAicONISxVY4lpZ/5EcRcYPDV8knNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=cfJdYvRW; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quqjs-0005f8-74; Mon, 23 Oct 2023 04:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quqjp-0005ez-47 for emacs-orgmode@gnu.org; Mon, 23 Oct 2023 04:56:41 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quqjm-00068x-TO for emacs-orgmode@gnu.org; Mon, 23 Oct 2023 04:56:40 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 59E87240103 for ; Mon, 23 Oct 2023 10:56:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1698051396; bh=Aql8M7M4z/FA0siLvRE0CD55dMtP1zq8QpKMMbGj25k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=cfJdYvRWqauQoxq1Is0sKoPhYhrLDRvl8n2YdeChh+wHylKZb5U8Hd1u8wLkGAfos dkC0PxKl/3bQLQhTZu46gO3tEoXOPZxxPQF3I58I+SE8XniwuB4G9KkIYc+lFHpZL2 1vpPTsmHQGuSrInb3Mny9tQAzRBElF6A4qYxYbfIDcQmqhvWwK80xm4c6rHkXyJ9oP wf8TtZQuc4/HQ9dP3C1a9k/UF7IKHa0hgQV00IXiqIG2KFpWh/uUihttjNtkHXKL/g td7LiSKV395wW6nKkKdbsUlG7XNJTUO2+ECYTTT9Pf/pGV3t4qDnzMn0/c7Du04SzE UFYfihXIpoJNA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SDTZW5x9kz6tw5; Mon, 23 Oct 2023 10:56:35 +0200 (CEST) From: Ihor Radchenko To: Visuwesh Cc: emacs-orgmode@gnu.org, Po Lu Subject: Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)] In-Reply-To: <87wmvf89ha.fsf@gmail.com> References: <87jzsintv0.fsf@gmail.com> <87lecx2nff.fsf@localhost> <87bkdsomm2.fsf@gmail.com> <87a5tamm3j.fsf@gmail.com> <877cnyzlda.fsf@localhost> <87a5sur51r.fsf@gmail.com> <875y3ir0lu.fsf@gmail.com> <87ttr1pild.fsf@localhost> <87v8bhpdg8.fsf@gmail.com> <87edi4m4my.fsf@localhost> <87wmvf89ha.fsf@gmail.com> Date: Mon, 23 Oct 2023 08:58:18 +0000 Message-ID: <875y2xaf6d.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -6.31 X-Migadu-Queue-Id: A5E296A2FB X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -6.31 X-TUID: Xqe4LHqbF4ft --=-=-= Content-Type: text/plain Visuwesh writes: >> Is there any particular reason why you insert a newline after the image >> link? > > I think this can stay here until Po Lu writes the platform-agnostic code > that you requested further down this thread? Sure. >> 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) 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. 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. ------------------ ** 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-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-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-dnd-default-attach-method If Org cannot figure out which attachment method to use from the metadata, it defaults to ~org-dnd-default-attach-method~ [fn::By default, ~org-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-type 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-type~. #+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 attaches them to the current heading using the =mv= or the =cp= method if the files were cut or copied in the file manager respectively. ----------- --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-doc-org-manual.org-Drag-and-Drop-yank-media-Rewrite.patch >From 23a01dd32ed21061b52557b427b2dc39a656aa8b Mon Sep 17 00:00:00 2001 Message-ID: <23a01dd32ed21061b52557b427b2dc39a656aa8b.1698051344.git.yantar92@posteo.net> From: Ihor Radchenko Date: Mon, 23 Oct 2023 11:50:56 +0300 Subject: [PATCH] * doc/org-manual.org (Drag and Drop & ~yank-media~): Rewrite --- doc/org-manual.org | 54 +++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 5a17d1c1f..00eb6680b 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -21101,39 +21101,43 @@ ** Drag and Drop & ~yank-media~ :END: #+cindex: dropping files +#+cindex: dragging files +#+cindex: drag and drop +#+cindex: dnd #+vindex: org-dnd-method -Org can attach, insert =file:= links, or open files dropped onto an -Emacs frame. By default, Org asks the user what must be done with the -dropped file but this can be changed by customizing the user option -~org-dnd-method~. Changing the variable can make Org do any of the -above mentioned actions without prompting. +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-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-dnd-default-attach-method -If Org cannot figure out which attachment method to use automatically, -it defaults to using the attachment method mentioned in -~org-dnd-default-attach-method~. Org uses the attachment method -mentioned in ~org-attach-method~ by default, so Org using the =cp= -method to attach the dropped files. +If Org cannot figure out which attachment method to use from the +metadata, it defaults to ~org-dnd-default-attach-method~ [fn::By +default, ~org-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 -From Emacs 29, Org can deal with images copied to the clipboard, and -files copied from a file manager when pasted using the command -~yank-media~. Org deals with them differently. +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-type +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-type~. + #+vindex: org-yank-image-file-name-function -For images, Org attaches the image when pasting but this can be -changed by customizing ~org-yank-image-save-type~ to save them under -another directory instead. The name given to these images are -autogenerated by default but you can customize what name should be -given to the pasted image by customizing -~org-yank-image-file-name-function~. This function takes no argument -and should return the filename without extension to use as the image's -filename. - -For files copied from a file manager, Org attaches them to the current -heading using the =mv= or the =cp= method if the files were cut or -copied in the file manager respectively. +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 attaches them to +the current heading using the =mv= or the =cp= method if the files +were cut or copied in the file manager respectively. * Hacking :PROPERTIES: -- 2.42.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--