emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: orgtbl export to latex :fmt() fails
Date: Fri, 18 Jul 2014 00:11:37 -0400	[thread overview]
Message-ID: <87pph3qpae.fsf@gmail.com> (raw)
In-Reply-To: 87oawn4rmm.fsf@alphaville.bos.redhat.com

Nick Dokos <ndokos@gmail.com> writes:

> Nothing - there is a bug in org-table.el:org-table-clean-before-export
> where the regexp that matches special chars in the first column (see
>
>   (info "(org)Advanced features")
>
> for the details) inadvertently matches "| | | | 3900|" and deletes the
> first column. The regexp is set like this:
>
>   (let ((special (if maybe-quoted
> 		     "^[ \t]*| *\\\\?[\#!$*_^/ ] *|"
> 		   "^[ \t]*| *[\#!$*_^/ ] *|"))
>
>

Checking the list of special chars in the Advanced Features section
above, I see #!$*_^/ only - I'm not sure what the \ is doing in the
[...] character class. I propose getting rid of it as well as the space.

Also, org-table-clean-before-export is called from two places in
org-table.el, neither of which uses the maybe-quoted argument[fn:1], so
I propose getting rid of it and the if clauses as well. Like this:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 6d649ab..bfe396e 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -436,15 +436,11 @@ available parameters."
 					   "[ \t]*|[ \t]*")))))))
 
 (defvar org-table-clean-did-remove-column nil) ; dynamically scoped
-(defun org-table-clean-before-export (lines &optional maybe-quoted)
+(defun org-table-clean-before-export (lines)
   "Check if the table has a marking column.
 If yes remove the column and the special lines."
-  (let ((special (if maybe-quoted
-		     "^[ \t]*| *\\\\?[\#!$*_^/ ] *|"
-		   "^[ \t]*| *[\#!$*_^/ ] *|"))
-	(ignore  (if maybe-quoted
-		     "^[ \t]*| *\\\\?[!$_^/] *|"
-		   "^[ \t]*| *[!$_^/] *|")))
+  (let ((special "^[ \t]*| *[#!$*_^/] *|")
+	(ignore "^[ \t]*| *[!$_^/] *|"))
     (setq org-table-clean-did-remove-column
 	  (not (memq nil
 		     (mapcar
--8<---------------cut here---------------end--------------->8---

Any objections?

Footnotes:

[fn:1] I checked contrib as well and nobody uses it there either. Although
       it's possible that somebody uses it out in the wild, I think it's
       very unlikely. But if you do use it, let me know.

Thanks,
-- 
Nick

  parent reply	other threads:[~2014-07-18  4:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 19:46 orgtbl export to latex :fmt() fails Thorsten Grothe
2014-07-17 21:12 ` Nick Dokos
2014-07-17 21:54   ` Thorsten Grothe
2014-07-17 22:35     ` Nick Dokos
2014-07-18  9:46       ` Thorsten Grothe
2014-07-18 13:22         ` Nick Dokos
2014-07-18 18:59           ` Thorsten Grothe
2014-07-18  4:11   ` Nick Dokos [this message]
2014-07-19  4:09     ` Nick Dokos
2014-07-27 13:18       ` Bastien

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=87pph3qpae.fsf@gmail.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@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/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).