From: Ihor Radchenko <yantar92@posteo.net>
To: Visuwesh <visuweshm@gmail.com>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Add yank-media handler for LibreOffice Calc tables
Date: Mon, 14 Oct 2024 18:58:02 +0000 [thread overview]
Message-ID: <871q0ise9x.fsf@localhost> (raw)
In-Reply-To: <87r08i3alo.fsf@gmail.com>
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.
> +(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.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2024-10-14 19:25 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 [this message]
2024-10-15 5:57 ` Visuwesh
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=871q0ise9x.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=visuweshm@gmail.com \
/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).