From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eAkaKHtHEWfZSQEAe85BDQ:P1 (envelope-from ) for ; Thu, 17 Oct 2024 17:20:59 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id eAkaKHtHEWfZSQEAe85BDQ (envelope-from ) for ; Thu, 17 Oct 2024 19:20:59 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OzHc2kQV; 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=1729185659; 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=blbAqU7GTAiRCCJnHPfTs7TYBK5ZCa9TjcBSNmnudS0=; b=TE8h3bT8l90TSH4jO0erAWvyS5a31BznYBXsyWgSO9r8phfLhiRUITWuxlkK/RRKvcRo4+ 9A3cV/RToDBYIsd+S7pNs9OJbx/QFPJgLT7nm9EV5DzBhLbJ27Xj39Gj5GS9k8+Njj0M4v IBUAvYSI828FAUYAi6Dfh3rPL+tBPZd13YAONuJjOkD57GnVBDl8zqvgA+thEa4w8Z838l /rXhsuIR3kw2frsQP4oUXO/C72zCrWT8OCNmunylqKZ7zir3ORoTF6yOhVeQ2FTHaGkVlM oe6/1V4kZjeNGqwyXEf8JAfsUi/tFCsI4zY2A7YwjYiWEGuPtY+SIp759CxQPw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729185659; a=rsa-sha256; cv=none; b=q6sELm1BCBQU7obZuTZsTv6i5I3kdiZJCWoMib4blPF/LMIOxk5TNCG8fvfS7NvY4Kq81h YQUUXGv5T3EdfBTNbfYGvxNqloBmMJNWX+48I8RfYHuNRNxz0rXV9rqdshN1Hb9pyj22LO QpoA80dl6hLqwG7+UtOGnA/vrLHR4rDlFKZkdGrpJ8g5iIfEBScbb2zl9784DPNCTxTI0k doJm6hJwvX2zx8fQmj2++yZsBBzRahn8+o1eynHTZ6RI72PnXf+sEhjtaMN/JOUl1JidZE txlHzE74hXUOkI4VhocslpkmHBh5gj/HCfmsy778MnR36vc3GzihffCxr49XdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OzHc2kQV; 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 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 424165B4EB for ; Thu, 17 Oct 2024 19:20:59 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1UAP-0005NZ-K7; Thu, 17 Oct 2024 13:20:05 -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 1t1UAN-0005Ln-O5 for emacs-orgmode@gnu.org; Thu, 17 Oct 2024 13:20:03 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t1UAL-0007Nm-So for emacs-orgmode@gnu.org; Thu, 17 Oct 2024 13:20:03 -0400 Received: by mail-pf1-x443.google.com with SMTP id d2e1a72fcca58-71e74900866so755694b3a.1 for ; Thu, 17 Oct 2024 10:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729185600; x=1729790400; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=blbAqU7GTAiRCCJnHPfTs7TYBK5ZCa9TjcBSNmnudS0=; b=OzHc2kQVQujTt/7RpvmLC9gU9kU8reDrjUV246mLf7rn/bA2CGj1oJWipa8R4SNw9Z ahK6JREalIPBaLQ8BGsg5M2bxiBGc3hkymOWWFHuCso8ZASUpyj69FQb+4UNrimFFXbS JFWRD0upPFxLFsz4S8zxmoWg97Xt1CHiDoyiQnw7+4hyKbch7lyZEyF8I/o+dolaOHvh 95bF+uGd6m53h1SLQs9K7q6Ika2wwj6R3uAihlJTyhOe6yZYQ/20i25Ue7N41uGAJHc3 Kkq8NNN5SAd9KIFNM7vT1gppygW7wa5EH0xQ5bt9WMvGbwnAEGi4QW8aXcfyW3PrvRAv ntQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729185600; x=1729790400; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=blbAqU7GTAiRCCJnHPfTs7TYBK5ZCa9TjcBSNmnudS0=; b=auQRM7MwX2flDnaDmea5QSvd8SlgjiIz0NQKR1D6jLJ23kQOBP8WvKuhajchFYKQX9 nPf1IofTbfDWLX6pHy9dVdFtMdr9xV99569nIAcPQiVaJKXFcqEH+piRut8U5TVaJpL2 aKb4tpuqPIeirGsWdolUvdrzUrxHR67yrDnM2NXCY7NUoJ96MXMq04EvBuFabK/yvJ2h KYUQ8KUw2XCawYpWiYzgHOmmIcztvUcF4nRbK9NGVYBnAYWctfCID7mdJZ0UzlR9R5Be LRr613KVYUtk/y7btOXdoq5yoHcVd2uQ9PS7NnwufXLsMtfQOG/aI2vYFdU7yxFcptcY jt4g== X-Gm-Message-State: AOJu0Yw2Gipr5Z8yZxiSJ5Xqzx5LzVYaDwYqPCwk65GxejcoDu8zEW9T ur/7qrffVKpNRPFbI/TW8IzntzUW+UDaYNOlSDo3SEyNVsTmzsB4 X-Google-Smtp-Source: AGHT+IE6GC+UAkfTFuzlH4Vqpnlj4RyKwp7AIXvc6m2tGA9MywdZtLZraB12VkZPwDZAtw45wX+bIQ== X-Received: by 2002:a05:6a00:a1b:b0:71e:659:f2e7 with SMTP id d2e1a72fcca58-71e7da51ec0mr11735921b3a.8.1729185599920; Thu, 17 Oct 2024 10:19:59 -0700 (PDT) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea9c6ba2d4sm5170356a12.11.2024.10.17.10.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 10:19:59 -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: <87msj5dx8l.fsf@localhost> (Ihor Radchenko's message of "Tue, 15 Oct 2024 18:42:02 +0000") References: <87r08i3alo.fsf@gmail.com> <871q0ise9x.fsf@localhost> <87msj53o2o.fsf@gmail.com> <87msj5dx8l.fsf@localhost> Date: Thu, 17 Oct 2024 22:49:56 +0530 Message-ID: <87ttdawssj.fsf@gmail.com> 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::443; envelope-from=visuweshm@gmail.com; helo=mail-pf1-x443.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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-Migadu-Spam-Score: -4.86 X-Spam-Score: -4.86 X-Migadu-Queue-Id: 424165B4EB X-Migadu-Scanner: mx13.migadu.com X-TUID: urHFigTk/Fy4 [=E0=AE=9A=E0=AF=86=E0=AE=B5=E0=AF=8D=E0=AE=B5=E0=AE=BE=E0=AE=AF=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 15= , 2024] Ihor Radchenko wrote: > Visuwesh writes: > >>> 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? > > Here is the recipe > 1. make repro (I tried with the latest Emacs master and with Emacs 29) > 2. Open test.odt (attached) > 3. M-x org-mode > 4. Copy the non-empty cell area > 5. M-x yank-media app > 6. Observe encoding problems Thanks for the reproducer. I think this might be locale-dependent. I fail to reproduce on my end with the following locale settings: LANG=3Den_GB.UTF-8 LC_COLLAGE=3Dta_IN.UTF-8 LC_MONETARY=3Dta_IN.UTF-8 LC_NUMERIC=3Dta_IN.UTF-8 locale-coding-system =3D 'utf-8-unix I have no idea how to deal with locale issues like this unfortunately. >>>> + (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? > > Consider the following example: > > * Heading > > M-x yank-media ... will slurp the heading > > | * Heading a | b | c | > > In contrast, the existing handlers will only insert some text at point, > never touching the text around. Would it be sufficient to unconditionally insert a newline after point? Maybe even after going to end of current element (if that can be done).