From: Jason Riedy <jason@acm.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH 4/4] Add a :remove-nil-lines parameter to orgtbl-to-generic.
Date: Wed, 16 Apr 2008 14:39:54 -0700 [thread overview]
Message-ID: <1208381994-7893-5-git-send-email-jason@acm.org> (raw)
In-Reply-To: <1208381994-7893-1-git-send-email-jason@acm.org>
Useful if the header formatting is used purely for side-effects.
Signed-off-by: Jason Riedy <jason@acm.org>
---
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 <jason@acm.org>
+
+ * 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 <jason@acm.org>
* 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
prev parent reply other threads:[~2008-04-16 21:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-16 21:39 [PATCH 0/4] Generalize orgtbl formatting with functions Jason Riedy
2008-04-16 21:39 ` [PATCH 1/4] Refactor orgtbl-to-generic; explicitly separate heading from body Jason Riedy
2008-04-16 21:39 ` [PATCH 2/4] Support last-line specializers Jason Riedy
2008-04-16 21:39 ` [PATCH 3/4] Allow functions for some orgtbl parameters Jason Riedy
2008-04-16 21:39 ` Jason Riedy [this message]
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=1208381994-7893-5-git-send-email-jason@acm.org \
--to=jason@acm.org \
--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).