emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jason Riedy <jason@acm.org>
To: emacs-orgmode@gnu.org
Cc: Jason Riedy <jason@acm.org>
Subject: [PATCH 2/4] Allow an explicitly nil :tstart and :tend to suppress the strings.
Date: Sun,  4 May 2008 18:54:41 -0700	[thread overview]
Message-ID: <1209952483-23714-3-git-send-email-jason@acm.org> (raw)
In-Reply-To: <1209952483-23714-2-git-send-email-jason@acm.org>

Passing explicit nils to leave out start and end strings feels
natural.  Also, transforming org-mode tables into other org-mode
tables can use :tstart and :tend to specify directives, so I
don't want to change the default splice setting for those.

Signed-off-by: Jason Riedy <jason@acm.org>
---
 ChangeLog         |    2 ++
 lisp/org-table.el |   12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 69710ec..d70bc98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
 	* lisp/org-table.el (*orgtbl-default-fmt*): New variable.
 	(orgtbl-format-line): Use the value of *orgtbl-default-fmt*
 	when there is no other fmt available.
+	(orgtbl-to-generic): Allow an explicitly nil :tstart or
+	:tend to suppress the appropriate string.
 
 2008-05-02  Carsten Dominik  <dominik@science.uva.nl>
 
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 17441cd..19dd74a 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3773,8 +3773,10 @@ directly by `orgtbl-send-table'.  See manual."
 
     ;; Put header
     (unless splicep
-      (push (or (orgtbl-eval-str (plist-get params :tstart))
-		"ERROR: no :tstart") *orgtbl-rtn*))
+      (if (not (plist-member params :tstart))
+          (push "ERROR: no :tstart" *orgtbl-rtn*)
+        (let ((tstart (orgtbl-eval-str (plist-get params :tstart))))
+          (if tstart (push tstart *orgtbl-rtn*)))))
 
     ;; Do we have a heading section?  If so, format it and handle the
     ;; trailing hline.
@@ -3801,8 +3803,10 @@ directly by `orgtbl-send-table'.  See manual."
     (orgtbl-format-section nil)
 
     (unless splicep
-      (push (or (orgtbl-eval-str (plist-get params :tend))
-		"ERROR: no :tend") *orgtbl-rtn*))
+      (if (not (plist-member params :tend))
+          (push "ERROR: no :tend" *orgtbl-rtn*)
+        (let ((tend (orgtbl-eval-str (plist-get params :tend))))
+          (if tend (push tend *orgtbl-rtn*)))))
 
     (mapconcat 'identity (nreverse (if remove-nil-linesp
 				       (remq nil *orgtbl-rtn*)
-- 
1.5.5.rc1.121.g1594

  reply	other threads:[~2008-05-05  1:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05  1:54 [PATCH 0/4] Adding orgtbl-to-orbtbl and cleaning orgtbl-to-sqlinsert Jason Riedy
2008-05-05  1:54 ` [PATCH 1/4] Provide an *orgtbl-default-fmt* for entries not in a fmt plist Jason Riedy
2008-05-05  1:54   ` Jason Riedy [this message]
2008-05-05  1:54     ` [PATCH 3/4] Add an orgtbl-to-orgtbl transformation Jason Riedy
2008-05-05  1:54       ` [PATCH 4/4] Clean up orgtbl-sqlinsert Jason Riedy
2008-05-05  5:15 ` [PATCH 0/4] Adding orgtbl-to-orbtbl and cleaning orgtbl-to-sqlinsert Carsten Dominik
2008-05-05  6:34   ` Jason Riedy

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=1209952483-23714-3-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).