From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id YFabDXl2ImV95AAAG6o9tA:P1 (envelope-from ) for ; Sun, 08 Oct 2023 11:29:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YFabDXl2ImV95AAAG6o9tA (envelope-from ) for ; Sun, 08 Oct 2023 11:29:29 +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 D782545FCC for ; Sun, 8 Oct 2023 11:29:28 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="ZuEeyqm/"; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696757369; 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=OMmlH2xrv8+4LnlrRjo87WuevBL3iZEPaIgJFQV7Dmk=; b=n6dFrqkKsWLeh53S7O25QxQYs+R95Zi7K0HhydqQ+alMjVRAsWaaQc4cL/V8J0SrZ5D1wV f0Gei6I8U5c4hlwnVmKMZCmQ1hKaZM/3WxfEKNQtlpOmBBVsqac4k8P2AFssg5mtbCyK7s lDzDpLgHciPHiDSaRJ4rK2pcYW9epUCzCTjK+B/F8I7Ei8r0eEWezjvvYc+f+Xef45tfsu QtVsqoCsmtBiz/tT+nd9lX4o/yA768zhFA0vmOhZN0qEBCHemNBomzAKPS/VVSaAAIsA5M uEPqBiOUeF0h/IjgsSY2WvR02kFMP4lw17+wVBPdNTPvHi2h+K9iORDh/V7r4Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="ZuEeyqm/"; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696757369; a=rsa-sha256; cv=none; b=mz6IlS2b9R6ZcDEEsvnS8zMzYA9mpb4WCPxWQFPQ3TRPShW+EIS8IzSnR5ZlO4zaHVJ1Uf /oUGr/9qFVCiCHpVp1OQoVPqgBIcJnO1MJ5TnVBi8xUfOO3Kwd53YXf2/b5B/PM0vd6DaB +OX4q1ls6fiZOLs57UFgnpH/2nwMplNTSITkOX9GzD4Z3wy3wCQVLxMix/sBvIdxnAPUIN 8U27v9WNUkU9cEDp/P8HWuuMskARbNWHo0R7PodaXE4jmdAbH7zIsf6OIOTjiDf7SeZCzp Xu6EtVvcWwmfopmuNS+mT6UiU9LMgX8H6zP1xxxMjdd07vUVjPXJUYwuVSfVwg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpQ5W-0007ii-EG; Sun, 08 Oct 2023 05:28:38 -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 1qpQ5V-0007iB-Cj for emacs-orgmode@gnu.org; Sun, 08 Oct 2023 05:28:37 -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 1qpQ5R-0005zs-91 for emacs-orgmode@gnu.org; Sun, 08 Oct 2023 05:28:35 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CA244240103 for ; Sun, 8 Oct 2023 11:28:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1696757308; bh=2bdV6jlUDpyUC6NaZlHsc64D3vxNq1mCKIIe1aLg4sw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=ZuEeyqm/AdpsBgU5/rNDstqRU8ssgzzxNTYEj0ATWmPedSDx6HFdsbP8NPFgH58FR 7fGI1ThvuqTQEAygFgE1ijvWb9RSWSHl9xt1W6QwW7NkXjoDdecYCKSnIJ8q0lf/uN HE6tb3OE1y342Kpqa9Sm+b4mD3U6s3WsK2W9u3HtGrGJAgwLIxYaDh7oPFjABStWGK BvGnBAhHF3ouQarvQAWQVLDNVggXNw8yP0SHZWyqDBLsw5W3ceh1y69Ppm2OvYd5Qq raHic7Zl0gLc+Xs0GHaCrnXfGoZ6PGolBtwKF1gaKvFyuH6qorptEl8bOx4/XLU64d IK7/ELWE8i7pQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4S3H0D1B2Qz9rxT; Sun, 8 Oct 2023 11:28:28 +0200 (CEST) From: Ihor Radchenko To: Visuwesh Cc: emacs-orgmode@gnu.org 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: <875y3ir0lu.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> Date: Sun, 08 Oct 2023 09:30:06 +0000 Message-ID: <87ttr1pild.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: D782545FCC X-Spam-Score: -9.15 X-Migadu-Spam-Score: -9.15 X-Migadu-Scanner: mx1.migadu.com X-TUID: JQdAbW14MBph Visuwesh 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 . Support Org development at , or support my work at