[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH 4/4] Add a :remove-nil-lines parameter to orgtbl-to-gen

From: Jason Riedy
Subject: [Orgmode] [PATCH 4/4] Add a :remove-nil-lines parameter to orgtbl-to-generic.
Date: Wed, 16 Apr 2008 14:39:54 -0700

Useful if the header formatting is used purely for side-effects.

Signed-off-by: Jason Riedy <address@hidden>
 ChangeLog         |    5 +++++
 lisp/org-table.el |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1347715..15937cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-16  Jason Riedy  <address@hidden>
+       * lisp/org-table.el (orgtbl-to-generic): Add a :remove-nil-lines
+       parameter that supresses lines that evaluate to NIL.
 2008-04-15  Jason Riedy  <address@hidden>
        * lisp/org-table.el (orgtbl-get-fmt): New inline function for
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 4ae90e3..9b4297b 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3692,6 +3692,8 @@ Valid parameters are
 :sep        Separator between two fields
+:remove-nil-lines Do not include lines that evaluate to nil.
   Each in the following group may be either a string or a function
   of no arguments returning a string:
 :tstart     String to start the table.  Ignored when :splice is t.
@@ -3731,6 +3733,7 @@ directly by `orgtbl-send-table'.  See manual."
   (let* ((splicep (plist-get params :splice))
         (hline (plist-get params :hline))
+        (remove-nil-linesp (plist-get params :remove-nil-lines))
         (*orgtbl-table* table)
         (*orgtbl-sep* (plist-get params :sep))
         (*orgtbl-efmt* (plist-get params :efmt))
@@ -3776,7 +3779,9 @@ directly by `orgtbl-send-table'.  See manual."
       (push (or (orgtbl-eval-str (plist-get params :tend))
                "ERROR: no :tend") *orgtbl-rtn*))
-    (mapconcat 'identity (nreverse *orgtbl-rtn*) "\n")))
+    (mapconcat 'identity (nreverse (if remove-nil-linesp
+                                      (remq nil *orgtbl-rtn*)
+                                    *orgtbl-rtn*)) "\n")))
 (defun orgtbl-to-latex (table params)
   "Convert the orgtbl-mode TABLE to LaTeX.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]