unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jakub Ječmínek" <jecminek.k@gmail.com>
To: 64205@debbugs.gnu.org
Subject: bug#64205: Fix missing cell border when using orgtbl-to-table.el function
Date: Wed, 21 Jun 2023 16:08:13 +0200	[thread overview]
Message-ID: <CAFBiodJZF3f7Tpi_T_W0q_M22T5a0WGNato=x71FR1yEPJphzg@mail.gmail.com> (raw)
In-Reply-To: <CAFBiodLywYt7h+rdpVZT00eN80sPftcVEzOfjopX+v_-YUUjYQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 417 bytes --]

Hello Robert, thank you for your response.

I'm sending a new patch in the attachment. I've also instrumented the
function using the `elp' package, here are the results:

Function Name           Call Count  Elapsed Time  Average Time
orgtbl-to-table.el-old  1001        2.6707780000  0.0026681098
orgtbl-to-table.el-new  1001        2.4684200000  0.0024659540

New version is indeed a little bit faster.

Best, Jakub

[-- Attachment #1.2: Type: text/html, Size: 576 bytes --]

[-- Attachment #2: 0001-Fix-orgtbl-to-table.el-function-to-include-last-cell.patch --]
[-- Type: application/octet-stream, Size: 1245 bytes --]

From dcb7dfb20157390dd4b234c929ce45d058da48d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= <jecminek.k@gmail.com>
Date: Wed, 21 Jun 2023 15:50:31 +0200
Subject: [PATCH] Fix orgtbl-to-table.el function to include last cell border

* lisp/org/org-table.el (orgtbl-to-table.el): Perform character
replacement in the temp buffer and fix missing cell border. (Bug #64205)
---
 lisp/org/org-table.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 42f234790c5..6810fd8dc5a 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -6132,9 +6132,13 @@ supported."
   (with-temp-buffer
     (insert (orgtbl-to-orgtbl table params))
     (org-table-align)
-    (replace-regexp-in-string
-     "-|" "-+"
-     (replace-regexp-in-string "|-" "+-" (buffer-substring 1 (buffer-size))))))
+    (goto-char (point-min))
+    (while (re-search-forward "-|" nil t)
+      (replace-match "-+"))
+    (goto-char (point-min))
+    (while (re-search-forward "|-" nil t)
+      (replace-match "+-"))
+    (buffer-string)))
 
 (defun orgtbl-to-unicode (table params)
   "Convert the `orgtbl-mode' TABLE into a table with unicode characters.
-- 
2.39.1


  parent reply	other threads:[~2023-06-21 14:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 21:57 bug#64205: Fix missing border cell when using orgtbl-to-table.el function Jakub Ječmínek
2023-06-21 12:45 ` Robert Pluim
2023-06-21 14:08 ` Jakub Ječmínek [this message]
2023-06-21 15:24   ` bug#64205: Fix missing cell border " Robert Pluim
2023-06-21 15:42     ` Jakub Ječmínek
     [not found]       ` <CAFBiodLYe+98=dYnvYCqxW0yY1feR8t_OKEH9VLUYXvLRXpEAA@mail.gmail.com>
2023-06-22 14:38         ` Robert Pluim
2023-06-22 15:15           ` Eli Zaretskii
2023-06-22 15:43             ` Robert Pluim

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAFBiodJZF3f7Tpi_T_W0q_M22T5a0WGNato=x71FR1yEPJphzg@mail.gmail.com' \
    --to=jecminek.k@gmail.com \
    --cc=64205@debbugs.gnu.org \
    /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.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).