emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Add yank-media handler for LibreOffice Calc tables
Date: Tue, 15 Oct 2024 11:27:51 +0530	[thread overview]
Message-ID: <87msj53o2o.fsf@gmail.com> (raw)
In-Reply-To: <871q0ise9x.fsf@localhost> (Ihor Radchenko's message of "Mon, 14 Oct 2024 18:58:02 +0000")

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

> Visuwesh <visuweshm@gmail.com> 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	
> 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?


  reply	other threads:[~2024-10-15  5:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 16:36 [PATCH] Add yank-media handler for LibreOffice Calc tables Visuwesh
2024-10-14 18:58 ` Ihor Radchenko
2024-10-15  5:57   ` Visuwesh [this message]
2024-10-15 18:42     ` Ihor Radchenko
2024-10-17 17:19       ` Visuwesh
2024-10-17 17:37         ` Ihor Radchenko
2024-10-18 16:45           ` Visuwesh
2024-10-19  7:10             ` Ihor Radchenko
2024-10-19  7:36               ` Visuwesh
2024-10-19  7:08         ` Ihor Radchenko
2024-10-19  7:35           ` Visuwesh
2024-10-19  7:42             ` Ihor Radchenko
2024-10-19  8:45               ` Visuwesh
2024-10-19  8:51                 ` Ihor Radchenko
2024-10-19  9:06                   ` Visuwesh
2024-10-19 10:09                     ` Rens Oliemans
2024-10-19 10:36                       ` Visuwesh
2024-10-21  8:51                         ` Rens Oliemans
2024-10-21 10:34                           ` Visuwesh
2024-11-29 14:05                             ` Visuwesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msj53o2o.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).