emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rémi Vanicat" <vanicat@debian.org>
To: emacs-orgmode@gnu.org
Cc: Gerhard <gsqual@gmail.com>
Subject: [PATCH] Re: orgtbl-to-generic with lfmt (wrong usage or bug)
Date: Fri, 22 Mar 2013 09:26:58 +0100	[thread overview]
Message-ID: <87obebhmb1.dlv@debian.org> (raw)
In-Reply-To: 514B2BDE.6030307@googlemail.com

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Gerhard <gsqual@gmail.com> writes:

> Hi,
>
> I was happy to find out about the possibility to convert a table into 
> something else, but I struggle with obtaining a particular result. I 
> have addresses in a table and want them to be formatted for printing. 
> This is where I am so far.
>
> #+ORGTBL: SEND sofar orgtbl-to-generic :lfmt "%s"

Reading the documentation, this should be 

#+ORGTBL: SEND sofar orgtbl-to-generic :lfmt "%s %s\n%s\n%s %s\n"

to have your expected formatting.

But it seem there is a bug in orgtbl that make this to fail. This very
simple patch seem to do the trick solve this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correctly-format-orgtbl-line-when-there-is-a-lfmt-ar.patch --]
[-- Type: text/x-diff, Size: 924 bytes --]

From 248ee115ffaa86e7284a111bffc750174997faf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= <vanicat@debian.org>
Date: Fri, 22 Mar 2013 09:22:51 +0100
Subject: [PATCH] Correctly format orgtbl line when there is a :lfmt argument.

orgtbl-apply-fmt need its arguments not in a line but as direct
argument, we need to call apply
---
 lisp/org-table.el |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 8da57b2..dec16c0 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4595,7 +4595,7 @@ First element has index 0, or I0 if given."
 				   f)))
 	     line)))
       (push (if *orgtbl-lfmt*
-		(orgtbl-apply-fmt *orgtbl-lfmt* line)
+		(apply #'orgtbl-apply-fmt *orgtbl-lfmt* line)
 	      (concat (orgtbl-eval-str *orgtbl-lstart*)
 		      (mapconcat 'identity line *orgtbl-sep*)
 		      (orgtbl-eval-str *orgtbl-lend*)))
-- 
1.7.10.4


[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Rémi Vanicat

  reply	other threads:[~2013-03-22  8:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 15:48 orgtbl-to-generic with lfmt (wrong usage or bug) Gerhard
2013-03-22  8:26 ` Rémi Vanicat [this message]
2013-04-07  7:42   ` [PATCH] " 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=87obebhmb1.dlv@debian.org \
    --to=vanicat@debian.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=gsqual@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).