From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Riedy Subject: [PATCH 4/4] Add a :remove-nil-lines parameter to orgtbl-to-generic. Date: Wed, 16 Apr 2008 14:39:54 -0700 Message-ID: <1208381994-7893-5-git-send-email-jason@acm.org> References: <1208381994-7893-1-git-send-email-jason@acm.org> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JmFMP-0000Hq-A7 for emacs-orgmode@gnu.org; Wed, 16 Apr 2008 17:40:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JmFMM-0000GY-9j for emacs-orgmode@gnu.org; Wed, 16 Apr 2008 17:40:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JmFMK-0000GA-TH for emacs-orgmode@gnu.org; Wed, 16 Apr 2008 17:40:05 -0400 Received: from a.mail.sonic.net ([64.142.16.245]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JmFMJ-0007ey-DU for emacs-orgmode@gnu.org; Wed, 16 Apr 2008 17:40:04 -0400 Received: from localhost.localdomain (209-204-163-7.vpn.sonic.net [209.204.163.7]) (authenticated bits=0) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id m3GLduO7002451 for ; Wed, 16 Apr 2008 14:40:01 -0700 In-Reply-To: <1208381994-7893-1-git-send-email-jason@acm.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Useful if the header formatting is used purely for side-effects. Signed-off-by: Jason Riedy --- 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 + + * 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 * 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." (interactive) (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. -- 1.5.5.rc1.121.g1594