From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 0B3KOLsEDmcWKAEAe85BDQ:P1 (envelope-from ) for ; Tue, 15 Oct 2024 05:59:24 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0B3KOLsEDmcWKAEAe85BDQ (envelope-from ) for ; Tue, 15 Oct 2024 07:59:24 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LXq2mrdO; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1728971963; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=ju4Lg2wq82vj5d6o9kZDSYq2tWu3i4Z4bB9LD6wYGqw=; b=ne/eNfM0RzQOtvseqy5r0XQ8luh7jLOGx6q1o6pjeY5hJHpSEBEJa7GmstH+0qOqNRSE5m zj340eeUyPtKlfUc+95wjXfnO6jDMtU+gq7uroMBL5w4JyJBJRe8jxvxRcn7vmbhd5QlrH ENcvLNB8prea1lYad8NY7YqGHupNY3AYtFNSjDyPGHP0OoKIYlSfEKD01Rc+keqjJIvQKP 4WX/2pYC+3p87z4WS0z2qieUeFAZeffgh+TrNFcwfE5eveENVGovG8/Q3WM/TugAxVt1f6 hyD+jE3w4wih3wOiTPfR2Y78gfKHVqx2lE0oXr63WGtGuTlf2hyaQCUKTh79Tw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LXq2mrdO; 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=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728971963; a=rsa-sha256; cv=none; b=abynz3IOiLGyGFkALD60KwneFOKJzPCjJJidyPH/9v/OozdowVap69BZbOzgwCIV2fUZBN 8qZtRZdTC/wPTgl2Rs+XQIthgLVSGejZxZQ8tHad7KNWiz2bHyVsOwvc/wceU8YiBS8KPa oBKFOyAlJMCzuXoO2VeX2LAFzLuveFHOLb8QRAWHejmN89+0E4ZvW+czO8PXPjEIwe45L9 VAwtVC6FlCsztrJvAlLXdMXeQSOfOUex3FWrT+D9/eOSdh4/ELdkggOzqK9suGao1lJKbC 0s50M/dX3RWBzV4N81WgLSU6GLDwgQThu62WXrGXRDt85skAIGiYlzvmOq4JGw== 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 8924286262 for ; Tue, 15 Oct 2024 07:59:23 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0aZj-0005Cf-ST; Tue, 15 Oct 2024 01:58:31 -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 1t0aZh-0005CU-R3 for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 01:58:29 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0aZg-0008Ai-9S for emacs-orgmode@gnu.org; Tue, 15 Oct 2024 01:58:29 -0400 Received: by mail-pg1-x542.google.com with SMTP id 41be03b00d2f7-7ea7d509e61so760217a12.1 for ; Mon, 14 Oct 2024 22:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728971906; x=1729576706; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:references :message-id:date:in-reply-to:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ju4Lg2wq82vj5d6o9kZDSYq2tWu3i4Z4bB9LD6wYGqw=; b=LXq2mrdOEOzAGfRlrfsTNvNrQUhkIPZV5gr4hnnILLsYI9BX/qrPz+lDbb5wjxYsMd MvF2E8wLjD2+SGjpzaLoLWhsTspk6YHh8TKeAdy+dWWMD43pHJGeMhbqMmDBAlMayhpX avJM36OmCIVyD3N6ULHsj9q/Sm3dXMA5BigiTh5BRIPKBhD1dB4UbkQl7jN2GJTc9p6M YTpgX0OD+PRcuySvtLQ14YE8nwJPyle2fck245tBIe+LdBttbSNtaRVpDlDXtCZKqbGZ CXBCddEpMpdqWdh77oNOzKZCKtIDXAkAgtt5bW4FxRFk8Ovkb9W4uncCQRMKIEM4zETW fkUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728971906; x=1729576706; h=content-transfer-encoding:mime-version:user-agent:references :message-id:date:in-reply-to:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ju4Lg2wq82vj5d6o9kZDSYq2tWu3i4Z4bB9LD6wYGqw=; b=bxajXw2OsoJsPVAELr+DCjx6bAbBOhO51R7Rj9Dca6zhrs+PxDhF8OO3I/RoXoosxl ypaRsKe5n/pQ49Ctsm7ACkaVQA89i6+Ch6P1agVFtth8HXjDCaF3arqhk0/axfRtaTQy /msX+ti+W8BNza00zSKa4zt2En+VRIw1rOzo1An3z3FL63VGUdp3vDzqoPjyDfIfryAf HJnT+INyzdLnlVz4iieJQmF00vREWTgE9dGIGoc5Jy3AFydT/+VovahcnPVoUo0mbmjW 5/QfPsE02U36SttM1ASWKssNXhElP59HDo1UJ2r54JJftRE478m88kyUWuXgx+zVDF32 BMYg== X-Gm-Message-State: AOJu0YzJgQegdrOuwRXSaaKxQ/T+Bj6fJ/06hiEYc2oCZVrMugJky/Ju I3Cbs9A6XVzycdZmQ+vBBbRIuLulH1TifaEDduqIbyuQ7VUb+cB3 X-Google-Smtp-Source: AGHT+IGodykYFCKi/PSNxZlE1H9g02l8fmh+LMwbBGFWelunMa+xPtN3EK+QqElaPLrDiwDK99yrDg== X-Received: by 2002:a05:6a21:2d84:b0:1cf:573a:bb58 with SMTP id adf61e73a8af0-1d8bcfaa18amr20498259637.40.1728971906369; Mon, 14 Oct 2024 22:58:26 -0700 (PDT) Received: from localhost ([1.7.159.70]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e392ecdd37sm663216a91.13.2024.10.14.22.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 22:58:25 -0700 (PDT) From: Visuwesh To: Ihor Radchenko Cc: org-mode-email Subject: Re: [PATCH] Add yank-media handler for LibreOffice Calc tables In-Reply-To: <871q0ise9x.fsf@localhost> (Ihor Radchenko's message of "Mon, 14 Oct 2024 18:58:02 +0000") Date: Tue, 15 Oct 2024 11:27:51 +0530 Message-ID: <87msj53o2o.fsf@gmail.com> References: <87r08i3alo.fsf@gmail.com> <871q0ise9x.fsf@localhost> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x542.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -0.59 X-Spam-Score: -0.59 X-Migadu-Queue-Id: 8924286262 X-TUID: PqVtsu8oWh5S [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0=AE=85= =E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 14, 2024] I= hor Radchenko wrote: > Visuwesh writes: > >> Attached patch adds support for yanking LibreOffice Calc tables as Org >> tables. Tables from docx files (or LO's equivalent) cannot be yanked >> though since the mimetype for them are richtext or HTML. > > Thanks! > > I just tried your patch (make repro) with a simple table > > foo bar=09 > 1 2 3 > > I got > > * This is test > | f\0o\0o\0 | \0b\0a\0r\0 | \0 | > | \01\0 | \02\0 | \03\0 | > | \0 | | | > > Something is off with encoding. I cannot reproduce it on my end. I tried with different documents and document types (Excel and LO format). Would it be possible to send the faulty file? >> +(defun org--libreoffice-table-handler (_mimetype data) >> + "Insert LibreOffice Calc table DATA as an Org table. >> +DATA is in the TSV format." >> + (let ((beg (point))) >> + (insert data) >> + ;; LibreOffice source code defines >> + ;; 'application/x-libreoffice-tsvc' as Text TSV-Calc so it should >> + ;; be safe to handle this as TSV always. >> + (org-table-convert-region beg (point) '(16)))) > > What if the point is in the middle of something else? > For example, in the middle of another table. > Then, conversion may yield wild outcomes. > Maybe it is safer to convert region in a temporary buffer and > insert the final result into the Org document being edited. Even if we do the processing in a temporary buffer, we would still end up inserting the table after point. I say we leave it to the user to be prudent and not call yank-media when in the middle of a table or somesuch. We do not do any special handling in other handlers, so why do it here?