Re: [O] Best practice for canceled/moved recurring events

2016-07-24 Thread Jason Riedy
And sabrewo...@gmail.com writes:
> What is the best way of dealing with scenarios where (1) the meeting "next
> week" is on the Wednesday and (2) the meeting "two weeks" after that (or
> whatever) is canceled?

Right now, I keep the typical meeting (titled with "Standing: ")
and add exceptions as separate events ("Exception: ").  The
version of owncloud I'm using as a sync target for org and my
phone doesn't handle exceptions anyways.




Re: [O] org-caldav for Google or Zimbra?

2013-09-26 Thread Jason Riedy
And Eric S. Fraga writes:
 Can you expand on this?  I am not sure what you mean by
 endpoint.  I use org-caldav-sync several times a day and it
 generally works very well with Google's calendar service.

Google has deprecated the URL in org-caldav, and that old URL
does not work for me.  The new one is documented at
  
https://developers.google.com/google-apps/calendar/caldav/v2/guide#new_endpoint

Fiddling with the regexp in org-caldav-events-url triggers an
error apparently in the authentication code:

 Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
   url-http-handle-authentication(nil)
   url-http-parse-headers()
   url-http-chunked-encoding-after-change-function(415 440 25)
   url-http-wait-for-headers-change-function(1 453 452)
   url-http-generic-filter(#process apidata.googleusercontent.com HTTP/1.1 
 401 Unauthorized\nWWW-Authenticate: Bearer 
 realm=\https://www.google.com/accounts/AuthSubRequest\\nContent-Type: 
 text/html; charset=UTF-8\nDate: Thu, 26 Sep 2013 13:48:37 GMT\nExpires: Thu, 
 26 Sep 2013 13:48:37 GMT\nCache-Control: private, 
 max-age=0\nX-Content-Type-Options: nosniff\nX-Frame-Options: 
 SAMEORIGIN\nX-XSS-Protection: 1; mode=block\nServer: GSE\nAlternate-Protocol: 
 443:quic\nTransfer-Encoding: chunked\n\ne\nLogin Required\n0\n\n)
   accept-process-output(#process apidata.googleusercontent.com)
   #[0 \302\303\300@!)\207 [(#process apidata.googleusercontent.com) 
 inhibit-quit nil accept-process-output] 2 \n\n(fn)]()
   funcall(#[0 \302\303\300@!)\207 [(#process 
 apidata.googleusercontent.com) inhibit-quit nil accept-process-output] 2 
 \n\n(fn)])
   
 url-retrieve-synchronously(https://apidata.googleusercontent.com/caldav/v2/jason.riedy/events/;)
   
 url-http-options(https://apidata.googleusercontent.com/caldav/v2/jason.riedy/events/;)
   
 url-dav-supported-p(https://apidata.googleusercontent.com/caldav/v2/jason.riedy/events/;)
   (if (url-dav-supported-p (org-caldav-events-url)) nil (error The URL %s 
 does not seem to accept DAV requests (org-caldav-events-url)))
   org-caldav-sync()
   eval((org-caldav-sync) nil)
   eval-last-sexp-1(nil)
   eval-last-sexp(nil)
   call-interactively(eval-last-sexp nil nil)

Someone on github reported the same issue.
-- 
Jason




Re: [O] org-caldav for Google or Zimbra?

2013-09-26 Thread Jason Riedy
And David Engster writes:
 Google has changed authentication on the new endpoint to
 OAuth. Julien has written an OAuth2 client implementation,
 which is in GNU ELPA, but I didn't have time to look at it
 yet. Not sure when I get to it; I hope someone beats me to it.

Ok, well understood.  Thank you!
-- 
Jason




Re: [O] using orgtbl-sqlinsert

2013-09-25 Thread Jason Riedy
And Eric Abrahamsen writes:
 I've got a table I'm trying to insert into a sqlite
 database. I've been looking at orgtbl-sqlinsert and this
 page[fn:1], but I suspect all that is out of date.

FYI, I have changed employers and thus no longer have up-to-date
paperwork at the FSF for assignment.  That is only one reason I
haven't updated anything relevant to the orgtbl-sqlinsert
procrasti-working hack...

A more important reason is that I suspect a method using
org-babel would be much better.

I was looking for a semi-one-off method to convert a table
definition into something within my workflow at the time.  Org
mode was somewhat new and seemed useful (now proven that it is
very useful).  I was focused on *my* workflow, but the mindset
behind org-babel is more general.  I apologize, but I have not
had the time to look into adapting the mechanism or pursuing the
generalization.
-- 
Jason



[O] org-caldav for Google or Zimbra?

2013-09-24 Thread Jason Riedy
Does anyone have org-caldav working with the new Google endpoint
or Zimbra?  The former errors out (there's an issue on github,
but I don't want a github account to ask there), and the latter
uses a different URL scheme...

Zimbra's URL scheme is
  https://server.example.com/dav/username/calendarname
with a calendarname is Calendar.  Special-casing
org-caldav-events-url for my server appears to work.  Feels like
that function could be over-ridden per server / target org file,
but I'm not quite sure what the right granularity should be.

Hm.  Perhaps having each synced calendar in a separate org file
might work.  Each org file could set some file-wide parameters
like calendar URL.
-- 
Jason, who no longer has relevant papers on file...




[Orgmode] Re: File local variables and export?

2009-05-05 Thread Jason Riedy
And Carsten Dominik writes:
 I can smuggle the value in by adding an entry to
 org-export-plist-vars referring to
 org-export-latex-image-default-option and pulling the value from
 the plist, but that feels incorrect.

 To me it sounds correct, actually.  I have added this, and will
 add other variables as needed.

I was thinking about using file locals to pass arguments along to
custom functions...  Carrying a central registry feels funny.   Why
do you prefer org-export-plist-vars?

Jason


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] File local variables and export?

2009-05-04 Thread Jason Riedy
I'm trying to change org-export-latex-image-default-option to
width=.7\\linewidth in a file local variable.  It's set correctly as a
buffer local variable, and it's having no effect on the export.  My
guess is that the buffer-local property is stopping it as soon as
org-export-as-latex runs set-buffer.

I can smuggle the value in by adding an entry to org-export-plist-vars
referring to org-export-latex-image-default-option and pulling the value
from the plist, but that feels incorrect.

Am I missing something?  Or should I look into grabbing
buffer-local-variables before set-buffer and setting the variables in
the output buffer?

BTW, there's a typo in org-export-region-as-latex's docstring.  Replace
retunr with return...  That pops up in the docbook export, too. ;)

Jason



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH] Place org-export-latex-inline-image-extensions in the LaTeX custom group

2009-05-03 Thread Jason Riedy
Just fixing a typo.  The :group should be org-export-latex and not 
org-export-html.

Signed-off-by: Jason Riedy ja...@acm.org
---
 lisp/org-latex.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 718fc56..edf5069 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -274,7 +274,7 @@ Note that this depends on the way the LaTeX file is 
processed.
 The default setting (pdf and jpg) assumes that pdflatex is doing the
 processing.  If you are using latex and dvips or something similar,
 only postscript files can be included.
-  :group 'org-export-html
+  :group 'org-export-latex
   :type '(repeat (string :tag Extension)))
 
 (defcustom org-export-latex-coding-system nil
-- 
1.6.3.rc3.184.g9852e




___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [PATCH 0/4] Adding orgtbl-to-orbtbl and cleaning orgtbl-to-sqlinsert.

2008-05-05 Thread Jason Riedy
And Carsten Dominik writes:
 git://repo.or.cz/org-mode/ejr.git master

 Can you explain to step by step what I would have to do to
 pull these changes from your repository into a local branch in my own
 repository?  Thanks.

One long-term version is to add that repo as a named remote:
  git remote add ejr git://repo.or.cz/org-mode/ejr.git
Then you can update all your remotes in one go:
  git remote update
Or just grab one:
  git fetch ejr
If you want to remove that remote repo later, use
  git remote rm ejr
After fetching,
  git branch -r
should list the remote branches, including ejr/master, or
  git branch -a
lists all of the branches.

A short-term version is just
  git fetch git://repo.or.cz/org-mode/ejr.git master:refs/heads/ejr-tmp
to slurp it into a local ejr-tmp branch.  The typical
  git branch -D ejr-tmp
would delete that branch.  Note that for deleting branches
added via git remote, you need to pass -r to git branch as well.

The command
  git log -p --stat --color ..ejr/master
should give a pretty, colorized listing of the changes in
ejr/master and not in your current index.  Just
  git diff --color ..ejr/master
should give a colorized diff between your index and ejr/master.
You can base those off HEAD, i.e. HEAD..ejr/master, to see the
differences between your currently committed work and the named
branch (ejr/master).

The difference between HEAD and your current (unnamed) index
only matters if you've added changes to your index explicitly
(through git add) or implicitly (through a partial merge).
The OUTPUT FORMAT section of git-diff's man page (conveniently
also available as git diff --help) gives a list of which
sub-commands provide which diffs, in case you feel like poking
around to get a feel for how each level works.

Many of these work in various forms through Emacs and eshell, but
I admit I rarely use them directly from Emacs.  And git has many
more, newer gadgets that may be nicer.  The few simple tools fit
how I think well enough that I kinda stopped following the
improvements.

As an alternate method not using remotes, you could just save the
patches to an mbox (say ejr-silly-patches.mbox), create a branch,
then use
  git am ejr-silly-patches.mbox
to import the patches.  Some people prefer that method, and it
can make replying with corrections and requests a bit easier
if your mail reader can poke around individual mbox files.

And to save some digging in man pages and annoyance in the
future, applying a patch that adds files is easiest with
  git apply --index foo.patch
That option will add the changes, including new files, to the
index directly.  Then to see the differences before committing, you
need git diff HEAD.  Just using git apply does not update the
index and hence won't include the new files automatically, so
you'd need to find them and add them.

Jason


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 1/4] Provide an *orgtbl-default-fmt* for entries not in a fmt plist.

2008-05-04 Thread Jason Riedy
The *orgtbl-default-fmt* is a hook for orgtbl transformations to
ensure a destination-sensible default for columns not present in
a fmt plist.  The leaving the value at nil changes no existing
behavior.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 ChangeLog |6 ++
 lisp/org-table.el |5 -
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15c9602..69710ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-04  Jason Riedy  [EMAIL PROTECTED]
+
+   * 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.
+
 2008-05-02  Carsten Dominik  [EMAIL PROTECTED]
 
* lisp/org.el (org-read-date-analyze): . as an alias for +0 in
diff --git a/lisp/org-table.el b/lisp/org-table.el
index ef1d932..17441cd 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3631,6 +3631,7 @@ First element has index 0, or I0 if given.
 ;; Formatting parameters for the current table section.
 (defvar *orgtbl-hline* nil Text used for horizontal lines)
 (defvar *orgtbl-sep* nil Text used as a column separator)
+(defvar *orgtbl-default-fmt* nil Default format for each entry)
 (defvar *orgtbl-fmt* nil Format for each entry)
 (defvar *orgtbl-efmt* nil Format for numbers)
 (defvar *orgtbl-lfmt* nil Format for an entire line, overrides fmt)
@@ -3672,7 +3673,9 @@ First element has index 0, or I0 if given.
 (orgtbl-apply-fmt efmt (match-string 1 f)
   (match-string 2 f))
   f)))
-(orgtbl-apply-fmt (orgtbl-get-fmt *orgtbl-fmt* i) f)))
+ (orgtbl-apply-fmt (or (orgtbl-get-fmt *orgtbl-fmt* i)
+   *orgtbl-default-fmt*)
+   f)))
 line)))
   (push (if *orgtbl-lfmt*
(orgtbl-apply-fmt *orgtbl-lfmt* line)
-- 
1.5.5.rc1.121.g1594



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 3/4] Add an orgtbl-to-orgtbl transformation.

2008-05-04 Thread Jason Riedy
Useful for documenting orgtbl transformation and formatting
functions.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 ChangeLog |2 ++
 lisp/org-table.el |   16 
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d70bc98..d8f1a3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
when there is no other fmt available.
(orgtbl-to-generic): Allow an explicitly nil :tstart or
:tend to suppress the appropriate string.
+   (orgtbl-to-orgtbl): New function for translating to another orgtbl
+   table.
 
 2008-05-02  Carsten Dominik  [EMAIL PROTECTED]
 
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 19dd74a..af12a4c 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3917,6 +3917,22 @@ this function is called.
   :hlstart @headitem )))
 (orgtbl-to-generic table (org-combine-plists params2 params
 
+(defun orgtbl-to-orgtbl (table params)
+  Convert the orgtbl-mode TABLE into another orgtbl-mode table.
+Useful when slicing one table into many.  The :hline, :sep,
+:lstart, and :lend provide orgtbl framing.  The default nil :tstart
+and :tend suppress strings without splicing; they can be set to
+provide ORGTBL directives for the generated table.
+  (let* ((params2
+ (list
+   :tstart nil :tend nil
+   :hline |---
+   :sep  | 
+   :lstart | 
+   :lend  |))
+(params (org-combine-plists params2 params)))
+(orgtbl-to-generic table params)))
+
 (provide 'org-table)
 
 ;; arch-tag: 4d21cfdd-0268-440a-84b0-09237a0fe0ef
-- 
1.5.5.rc1.121.g1594



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 4/4] Clean up orgtbl-sqlinsert.

2008-05-04 Thread Jason Riedy
Use the default fmt function, collect only the first header
line for field names, and don't call plist-get for the table
name on every line.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 contrib/ChangeLog|7 +++
 contrib/lisp/orgtbl-sqlinsert.el |   13 +++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 5db4bb3..85a7a27 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-04  Jason Riedy  [EMAIL PROTECTED]
+
+   * lisp/orgtbl-sqlinsert.el (orgtbl-to-sqlinsert): Use the
+   default fmt function, collect only the first header line for
+   field names, and don't call plist-get for the table name on
+   every line.
+
 2008-04-15  Jason Riedy  [EMAIL PROTECTED]
 
* lisp/orgtbl-sqlinsert.el: New file.
diff --git a/contrib/lisp/orgtbl-sqlinsert.el b/contrib/lisp/orgtbl-sqlinsert.el
index 869f74f..648e44c 100644
--- a/contrib/lisp/orgtbl-sqlinsert.el
+++ b/contrib/lisp/orgtbl-sqlinsert.el
@@ -64,6 +64,8 @@ this function is called.
   org-table-last-alignment ))
 (nowebname (plist-get params :nowebname))
 (breakvals (plist-get params :breakvals))
+ (firstheader t)
+ (*orgtbl-default-fmt* 'orgtbl-sql-strip-and-quote)
 (params2
  (list
   :sqlname name
@@ -72,12 +74,10 @@ this function is called.
)
  BEGIN TRANSACTION;))
   :tend (lambda () (concat COMMIT; (if nowebname \n@  )))
-  :fmt (lambda (str) (orgtbl-sql-strip-and-quote str))
-; :hfmt (lambda (f) (push (concat [ f ]) hdrlist) )
-  :hfmt (lambda (f) (push f hdrlist) )
-  :hlfmt (lambda (lst) nil)
+  :hfmt (lambda (f) (progn (if firstheader (push f hdrlist)) ))
+  :hlfmt (lambda (lst) (setq firstheader nil))
   :lstart (lambda () (concat INSERT INTO 
- (plist-get params :sqlname) ( 
+ sqlname ( 
  (mapconcat 'identity (reverse hdrlist)
 , )
   ) (if breakvals \n  )
@@ -86,7 +86,8 @@ this function is called.
   :sep  , 
   :hline nil
   :remove-nil-lines t))
-(params (org-combine-plists params2 params)))
+(params (org-combine-plists params2 params))
+ (sqlname (plist-get params :sqlname)))
 (orgtbl-to-generic table params)))
 
 (defun orgtbl-sql-quote (str)
-- 
1.5.5.rc1.121.g1594



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 0/4] Adding orgtbl-to-orbtbl and cleaning orgtbl-to-sqlinsert.

2008-05-04 Thread Jason Riedy
I needed an orgtbl-to-orgtbl transformation when writing up
transformation examples.  It seems pretty core, so I've
added it to org-table.el.  The function needs a way to
suppress :tstart and :tend strings, so I added support
for explicit nils.

Cleaning up the orgtbl-to-sqlinsert function lead to some cute
little problems.  One was that formatting columns with plist
would pass values through directly rather than quoting them.
So I a general *orgtbl-default-fmt* variable to handle all
columns that aren't in the plist.  A similar one for the header
might be useful, but I haven't needed it.

All these can be pulled from
  git://repo.or.cz/org-mode/ejr.git master

BTW, Bruno Haible's git ChangeLog merger has been working
wonderfully for me.  It also is in gnulib; see the message 
for how to generate it with gnulib-tool:
  http://article.gmane.org/gmane.comp.lib.gnulib.bugs/12653

Jason Riedy (4):
  Provide an *orgtbl-default-fmt* for entries not in a fmt plist.
  Allow an explicitly nil :tstart and :tend to suppress the strings.
  Add an orgtbl-to-orgtbl transformation.
  Clean up orgtbl-sqlinsert.

 ChangeLog|   10 ++
 contrib/ChangeLog|7 +++
 contrib/lisp/orgtbl-sqlinsert.el |   13 +++--
 lisp/org-table.el|   33 -
 4 files changed, 52 insertions(+), 11 deletions(-)



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 2/4] Allow an explicitly nil :tstart and :tend to suppress the strings.

2008-05-04 Thread Jason Riedy
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 [EMAIL PROTECTED]
---
 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  [EMAIL PROTECTED]
 
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



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Using Org-Mode Table Formatting Functions draft

2008-05-04 Thread Jason Riedy
#+TITLE: Using Org-Mode Table Formatting Functions
#+AUTHOR: Jason Riedy
#+EMAIL: [EMAIL PROTECTED]
#+LANGUAGE: en
#+TEXT: *Abstract:* Org-mode's ability to slice one table into many
#+TEXT: separately formatted destinations helps keep documentation
#+TEXT: and data in sync.  We provide an example using both the
#+TEXT: multiple-target facilities and formatting with functions.
#+TEXT: Side-effects in the functions gather header data necessary
#+TEXT: for generating flexible SQL insertion statements.

I'm not asking for this to be in Worg yet; it uses the patches
I just sent.  ;)

* Introduction

In large-scale data analysis, one often associates integers with
parameter name rather than strings.  The performance and storage
difference is significant for multi-gigabyte data sets.  But
integers are not at all convenient or descriptive.
Systems like [[http://www.r-project.org][R]] provide a =factor= data type that 
translates the
stored integers into user-level strings.
Emulating that construct in SQL is handy for data transfer with 
[[http://www.sqlite.org][SQLite]]
or out-of-core analysis in R using a 
[[http://cran.r-project.org/web/packages/SQLiteDF/index.html][SQL back-end]].
That leaves the problem of maintaining a registry of integer level
codes, string names, and documentation.

[[http://orgmode.org][Org-mode]] provide a fast, light-weight table mechanism 
that can be sent
in email, bundled with code, or embedded in documentation.  The tables
can be transformed and placed elsewhere.  It sounds like a perfect
registry, generating documentation and code from one data table.
Similar techniques could be used in a multi-lingual document to store
many translations in one table and send them to sections in specific
languages.

We start with a simple table:
#+ORGTBL: SEND exdoc orgtbl-to-orgtbl :skipcols (2) :fmt (1 =%s=) :hfmt (1 
%s)
#+ORGTBL: SEND exsql orgtbl-to-sqlinsert :sqlname extbl :fmt (2 %s) :tstart 
#+BEGIN_EXAMPLE\nBEGIN TRANSACTION; :tend COMMIT;\n#+END_EXAMPLE
| Name  | Level | Description |
|---+---+-|
| normx | 1 | norm(x, \infty) |
| normb | 2 | norm(b, \infty) |
| normA | 3 | norm(A, \infty) |

That one source table contains the documentation in the first and
third column:
#+BEGIN RECEIVE ORGTBL exdoc
| Name | Description |
|---
| =normx= | norm(x, \infty) |
| =normb= | norm(b, \infty) |
| =normA= | norm(A, \infty) |
#+END RECEIVE ORGTBL exdoc

The first two columns of the source table provide the data we must
transfer the SQL.  The third column can be used to embed some
documentation into the table itself after the string is sanitized for
SQL.  The remaining necessary information, the SQL destination table
name, can be provided as a parameter to =#+ORGTBL: SEND=, producing
the following code chunk:
#+BEGIN RECEIVE ORGTBL exsql
#+BEGIN_EXAMPLE
BEGIN TRANSACTION;
INSERT INTO extbl( Name, Level, Description ) VALUES ( 'normx' , 1 , 'norm(x, 
infty)' );
INSERT INTO extbl( Name, Level, Description ) VALUES ( 'normb' , 2 , 'norm(b, 
infty)' );
INSERT INTO extbl( Name, Level, Description ) VALUES ( 'normA' , 3 , 'norm(A, 
infty)' );
COMMIT;
#+END_EXAMPLE
#+END RECEIVE ORGTBL exsql

We will explain the parameters used to produce both outputs.  The SQL
insertion statements use functions as formatting parameters, some of
which are called purely for the side-effect of gathering the header
fields.  The SQL-generating code is distributed with org-mode in
=contrib/lisp/orgtbl-sqlinsert.el=.

* Specifying multiple destinations for a single table

Sending one table to multiple destinations is straight-forward.  Add
one =SEND= directive for each destination.  For example, the first
table has the following two directives prepended, with parameters
described later:
: #+ORGTBL: SEND exdoc orgtbl-to-orgtbl ...
: #+ORGTBL: SEND exsql orgtbl-to-sqlinsert ...

The documentation removes the second column and adds fiddly formatting
parameters with
: :skipcols (2) :fmt (1 =%s=) :hfmt (1 %s)

The SQL-generating line gathers the destination table name and passes
integers through unchanged with the parameters
: :sqlname extbl :fmt (2 %s)
The SQL table name defaults to the name of the target, =exsql= in this
case.  And the default formatting used for
other columns is =orgtbl-sql-strip-and-quote=.  That routine only
removes potentially non-portable constructs; it is not designed to
prevent insertion attacks.
We could apply =orgtbl-sql-strip-and-quote= to the first column of the
documentation table to ensure the strings match exactly, but it
easier to use simple, non-mangled strings as names.

By default, a block of insertions is wrapped in =BEGIN TRANSACTION=
and =COMMIT= statements.  These can be supressed by setting =:tstart=
and =:tend= to =nil=.  The example used in this document uses a
double-embedding trick to wrap the statement in an org-mode code block:
: :tstart #+BEGIN_EXAMPLE\nBEGIN TRANSACTION;
: :tend COMMIT;\n#+END_EXAMPLE
Similar wrapping can embed the SQL statements

[Orgmode] [PATCH] Support multiple destinations for each radio table.

2008-04-16 Thread Jason Riedy
You can slice a single table full of calculations in different ways
into separate destinations.  Or you can format the table differently.
There are many fun and exciting possible uses.

A fancier implementation would scan the document *once* for the
set of destinations.  That could help implement another function
to update all destinations from all sources.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
  This also can be fetched by pulling 
git://repo.or.cz/org-mode/ejr.git multitarget-radio-table

 ChangeLog |   11 +
 doc/org.texi  |6 ++-
 lisp/org-table.el |  127 +++--
 3 files changed, 89 insertions(+), 55 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ae71a9..8e89686 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-15  Jason Riedy  [EMAIL PROTECTED]
+
+   * lisp/org-table.el (orgtbl-gather-send-defs): New function to
+   gather all the SEND definitions before a table.
+   (orgtbl-send-replace-tbl): New function to find the RECEIVE
+   corresponding to the current name.
+   (orgtbl-send-table): Use the previous two functions and implement
+   multiple destinations for each table.
+
+   * doc/org.texi (Radio tables): Document multiple destinations.
+
 2008-04-15  Carsten Dominik  [EMAIL PROTECTED]
 
* lisp/org-agenda.el (org-agenda-columns-show-summaries)
diff --git a/doc/org.texi b/doc/org.texi
index c9eaab9..767830b 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8397,8 +8397,10 @@ in the receiver lines. @code{translation_function} is 
the Lisp function
 that does the translation.  Furthermore, the line can contain a list of
 arguments (alternating key and value) at the end.  The arguments will be
 passed as a property list to the translation function for
-interpretation.  A few standard parameters are already recognized and
-acted upon before the translation function is called:
+interpretation.  Multiple @code{#+ORGTBL: SEND} lines with different
[EMAIL PROTECTED] send the table's data to separate destinations.  A
+few standard parameters are already recognized and acted upon before the
+translation function is called:
 
 @table @code
 @item :skip N
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 1e1bd85..9193bf0 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3492,6 +3492,41 @@ overwritten, and the table is not marked as requiring 
realignment.
  (push ( (/ (apply '+ (mapcar (lambda (x) (if (string-match 
org-table-number-regexp x) 1 0)) column)) maxcol) org-table-number-fraction) 
org-table-last-alignment))
 (funcall func table nil)))
 
+(defun orgtbl-gather-send-defs ()
+  Gathers a plist of :name, :transform, :params for each destination before
+a radio table.
+  (save-excursion
+(goto-char (org-table-begin))
+(let (rtn)
+  (beginning-of-line 0)
+  (while (looking-at #\\+ORGTBL: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ 
\t\r\n]+\\)\\( +.*\\)?)
+   (let ((name (org-no-properties (match-string 1)))
+ (transform (intern (match-string 2)))
+ (params (if (match-end 3)
+ (read (concat ( (match-string 3) ))
+ (push (list :name name :transform transform :params params)
+   rtn)
+ (beginning-of-line 0)))
+  rtn)))
+
+(defun orgtbl-send-replace-tbl (name txt)
+  Find and replace table NAME with TXT.
+  (save-excursion
+(goto-char (point-min))
+(unless (re-search-forward
+(concat BEGIN RECEIVE ORGTBL + name \\([ \t]\\|$\\)) nil t)
+  (error Don't know where to insert translated table))
+(goto-char (match-beginning 0))
+(beginning-of-line 2)
+(save-excursion
+  (let ((beg (point)))
+   (unless (re-search-forward
+(concat END RECEIVE ORGTBL + name) nil t)
+ (error Cannot find end of insertion region))
+   (beginning-of-line 1)
+   (delete-region beg (point
+(insert txt \n)))
+
 (defun orgtbl-send-table (optional maybe)
   Send a tranformed version of this table to the receiver position.
 With argument MAYBE, fail quietly if no transformation is defined for
@@ -3501,59 +3536,45 @@ this table.
 (unless (org-at-table-p) (error Not at a table))
 ;; when non-interactive, we assume align has just happened.
 (when (interactive-p) (org-table-align))
-(save-excursion
-  (goto-char (org-table-begin))
-  (beginning-of-line 0)
-  (unless (looking-at #\\+ORGTBL: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ 
\t\r\n]+\\)\\( +.*\\)?)
-   (if maybe
-   (throw 'exit nil)
- (error Don't know how to transform this table.
-(let* ((name (match-string 1))
-  beg
-  (transform (intern (match-string 2)))
-  (params (if (match-end 3) (read (concat ( (match-string 3) )
-  (skip (plist-get params :skip))
-  (skipcols (plist-get params :skipcols))
-  (txt (buffer-substring-no-properties

[Orgmode] [PATCH 1/4] Refactor orgtbl-to-generic; explicitly separate heading from body.

2008-04-16 Thread Jason Riedy
Parameters are fluidly bound as early as possible.  Added one
helper function, orgtbl-format-section, and removed one,
org-get-param.  Also cleaned org-format-line.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 ChangeLog |   16 +++
 lisp/org-table.el |  124 
 2 files changed, 92 insertions(+), 48 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ae71a9..4569d3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-04-15  Jason Riedy  [EMAIL PROTECTED]
+
+   * lisp/org-table.el (*orgtbl-table*, *orgtbl-rtn*): Dynamically
+   bound variables to hold the input collection of lines and output
+   formatted text.
+   (*orgtbl-hline*, *orgtbl-sep*, *orgtbl-fmt*, *orgtbl-efmt*,
+   (*orgtbl-lfmt*, *orgtbl-lstart*, *orgtbl-lend*): Dynamically bound
+   format parameters.
+   (orgtbl-format-line): New function encapsulating formatting for a
+   single line.
+   (orgtbl-format-section): Similar for each section.  Rebinding the
+   dynamic vars customizes the formatting for each section.
+   (orgtbl-to-generic): Use orgtbl-format-line and
+   orgtbl-format-section.
+   (org-get-param): Now unused, so delete.
+
 2008-04-15  Carsten Dominik  [EMAIL PROTECTED]
 
* lisp/org-agenda.el (org-agenda-columns-show-summaries)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 1e1bd85..3cc70c1 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3602,15 +3602,51 @@ First element has index 0, or I0 if given.
 (insert txt)
 (goto-char pos)))
 
-(defun org-get-param (params header i sym optional hsym)
-  Get parameter value for symbol SYM.
-If this is a header line, actually get the value for the symbol with an
-additional \h\ inserted after the colon.
-If the value is a protperty list, get the element for the current column.
-Assumes variables VAL, PARAMS, HEAD and I to be scoped into the function.
-  (let ((val (plist-get params sym)))
-(and hsym header (setq val (or (plist-get params hsym) val)))
-(if (consp val) (plist-get val i) val)))
+;; Dynamically bound input and output for table formatting.
+(defvar *orgtbl-table* nil
+  Carries the current table through formatting routines.)
+(defvar *orgtbl-rtn* nil
+  Formatting routines push the output lines here.)
+;; Formatting parameters for the current table section.
+(defvar *orgtbl-hline* nil Text used for horizontal lines)
+(defvar *orgtbl-sep* nil Text used as a column separator)
+(defvar *orgtbl-fmt* nil Format for each entry)
+(defvar *orgtbl-efmt* nil Format for numbers)
+(defvar *orgtbl-lfmt* nil Format for an entire line, overrides fmt)
+(defvar *orgtbl-lstart* nil Text starting a row)
+(defvar *orgtbl-lend* nil Text ending a row)
+
+(defun orgtbl-format-line (line)
+  Format LINE as a table row.
+  (if (eq line 'hline) (if *orgtbl-hline* (push *orgtbl-hline* *orgtbl-rtn*))
+(let* ((i 0)
+  (line
+   (mapcar
+(lambda (f)
+  (setq i (1+ i))
+  (let* ((*orgtbl-fmt* (if (consp *orgtbl-fmt*)
+(plist-get *orgtbl-fmt* i)
+*orgtbl-fmt*))
+ (*orgtbl-efmt* (if (consp *orgtbl-efmt*)
+ (plist-get *orgtbl-efmt* i)
+ *orgtbl-efmt*))
+ (f (if (and *orgtbl-efmt*
+ (string-match orgtbl-exp-regexp f))
+(format *orgtbl-efmt* (match-string 1 f)
+(match-string 2 f))
+  f)))
+(if *orgtbl-fmt* (format *orgtbl-fmt* f) f)))
+line)))
+  (push (if *orgtbl-lfmt* (apply 'format *orgtbl-lfmt* line)
+ (concat *orgtbl-lstart* (mapconcat 'identity line *orgtbl-sep*)
+ *orgtbl-lend*))
+   *orgtbl-rtn*
+
+(defun orgtbl-format-section (section-stopper)
+  Format lines until the first occurrence of SECTION-STOPPER.
+  (progn
+(while (not (eq (car *orgtbl-table*) section-stopper))
+  (orgtbl-format-line (pop *orgtbl-table*)
 
 (defun orgtbl-to-generic (table params)
   Convert the orgtbl-mode TABLE to some other format.
@@ -3658,51 +3694,43 @@ Valid parameters are
 In addition to this, the parameters :skip and :skipcols are always handled
 directly by `orgtbl-send-table'.  See manual.
   (interactive)
-  (let* ((p params)
-(splicep (plist-get p :splice))
-(hline (plist-get p :hline))
-rtn line i fm efm lfmt h)
-
-;; Do we have a header?
-(if (and (not splicep) (listp (car table)) (memq 'hline table))
-   (setq h t))
+  (let* ((splicep (plist-get params :splice))
+(hline (plist-get params :hline))
+(*orgtbl-table* table)
+(*orgtbl-sep* (plist-get params :sep))
+(*orgtbl-efmt* (plist-get params :efmt))
+(*orgtbl-lstart* (plist

[Orgmode] [PATCH 2/4] Support last-line specializers.

2008-04-16 Thread Jason Riedy
Each of lstart, lend, and lfmt permits a last-line specialization
called llstart, etc. with corresponding heading versions.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 ChangeLog |   10 ++
 lisp/org-table.el |   32 
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4569d3a..13980bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2008-04-15  Jason Riedy  [EMAIL PROTECTED]
 
+   * lisp/org-table.el (*orgtbl-llfmt*, *orgtbl-llstart*)
+   (*orgtbl-llend*): Dynamic variables for last-line formatting.
+   (orgtbl-format-section): Shift formatting to support detecting the
+   last line and formatting it specially.
+   (orgtbl-to-generic): Document :ll* formats.  Set to the non-ll
+   formats unless overridden.
+   (orgtbl-to-latex): Suggest using :llend to suppress the final \\.
+
+2008-04-15  Jason Riedy  [EMAIL PROTECTED]
+
* lisp/org-table.el (*orgtbl-table*, *orgtbl-rtn*): Dynamically
bound variables to hold the input collection of lines and output
formatted text.
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 3cc70c1..2eb9938 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3613,8 +3613,11 @@ First element has index 0, or I0 if given.
 (defvar *orgtbl-fmt* nil Format for each entry)
 (defvar *orgtbl-efmt* nil Format for numbers)
 (defvar *orgtbl-lfmt* nil Format for an entire line, overrides fmt)
+(defvar *orgtbl-llfmt* nil Specializes lfmt for the last row)
 (defvar *orgtbl-lstart* nil Text starting a row)
+(defvar *orgtbl-llstart* nil Specializes lstart for the last row)
 (defvar *orgtbl-lend* nil Text ending a row)
+(defvar *orgtbl-llend* nil Specializes lend for the last row)
 
 (defun orgtbl-format-line (line)
   Format LINE as a table row.
@@ -3644,9 +3647,15 @@ First element has index 0, or I0 if given.
 
 (defun orgtbl-format-section (section-stopper)
   Format lines until the first occurrence of SECTION-STOPPER.
-  (progn
-(while (not (eq (car *orgtbl-table*) section-stopper))
-  (orgtbl-format-line (pop *orgtbl-table*)
+  (let (prevline)
+(progn
+  (while (not (eq (car *orgtbl-table*) section-stopper))
+   (if prevline (orgtbl-format-line prevline))
+   (setq prevline (pop *orgtbl-table*)))
+  (if prevline (let ((*orgtbl-lstart* *orgtbl-llstart*)
+(*orgtbl-lend* *orgtbl-llend*)
+(*orgtbl-lfmt* *orgtbl-llfmt*))
+(orgtbl-format-line prevline))
 
 (defun orgtbl-to-generic (table params)
   Convert the orgtbl-mode TABLE to some other format.
@@ -3670,17 +3679,20 @@ Valid parameters are
 May be nil to ignore hlines.
 
 :lstart String to start a new table line.
+:llstartString to start the last table line, defaults to :lstart.
 :lend   String to end a table line
+:llend  String to end the last table line, defaults to :lend.
 :sepSeparator between two fields
 :lfmt   Format for entire line, with enough %s to capture all fields.
 If this is present, :lstart, :lend, and :sep are ignored.
+:llfmt  Format for the entire last line, defaults to :lfmt.
 :fmtA format to be used to wrap the field, should contain
 %s for the original field value.  For example, to wrap
 everything in dollars, you could use :fmt \$%s$\.
 This may also be a property list with column numbers and
 formats. For example :fmt (2 \$%s$\ 4 \%s%%\)
 
-:hlstart :hlend :hlsep :hlfmt :hfmt
+:hlstart :hllstart :hlend :hllend :hlsep :hlfmt :hllfmt :hfmt
 Same as above, specific for the header lines in the table.
 All lines before the first hline are treated as header.
 If any of these is not present, the data line value is used.
@@ -3700,8 +3712,11 @@ directly by `orgtbl-send-table'.  See manual.
 (*orgtbl-sep* (plist-get params :sep))
 (*orgtbl-efmt* (plist-get params :efmt))
 (*orgtbl-lstart* (plist-get params :lstart))
+(*orgtbl-llstart* (or (plist-get params :llstart) *orgtbl-lstart*))
 (*orgtbl-lend* (plist-get params :lend))
+(*orgtbl-llend* (or (plist-get params :llend) *orgtbl-lend*))
 (*orgtbl-lfmt* (plist-get params :lfmt))
+(*orgtbl-llfmt* (or (plist-get params :llfmt) *orgtbl-lfmt*))
 (*orgtbl-fmt* (plist-get params :fmt))
 *orgtbl-rtn*)
 
@@ -3716,8 +3731,14 @@ directly by `orgtbl-send-table'.  See manual.
(progn
  (let* ((*orgtbl-lstart* (or (plist-get params :hlstart)
  *orgtbl-lstart*))
+(*orgtbl-llstart* (or (plist-get params :hllstart)
+  *orgtbl-llstart*))
 (*orgtbl-lend* (or (plist-get params :hlend) *orgtbl-lend*))
+(*orgtbl-llend* (or (plist-get params :hllend

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

2008-04-16 Thread Jason Riedy
Useful if the header formatting is used purely for side-effects.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 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  [EMAIL PROTECTED]
+
+   * 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  [EMAIL PROTECTED]
 
* 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
 
 :sepSeparator 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



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 0/4] Generalize orgtbl formatting with functions

2008-04-16 Thread Jason Riedy
This is lead-up to a contrib function that generates SQL insertions
from a table.  Using functions for some of the orgtbl parameters opens
up many possibilities.

Jason Riedy (4):
  Refactor orgtbl-to-generic; explicitly separate heading from body.
  Support last-line specializers.
  Allow functions for some orgtbl parameters.
  Add a :remove-nil-lines parameter to orgtbl-to-generic.

 ChangeLog |   45 +
 doc/org.texi  |5 +-
 lisp/org-table.el |  190 ++---
 3 files changed, 187 insertions(+), 53 deletions(-)



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug: Error in org-agenda-files = org-remember really breaks.

2008-04-14 Thread Jason Riedy
I haven't tried debugging this one, and I'm still not sure how I
figured out the problem.

I accidentally set org-agenda-files to a directory ~/.orgs
rather than (list ~/.orgs).  So something tried to read
the directory as a list of files...  And then org-remember
breaks in utterly confusing ways.  Some of the escape codes
are parsed correctly, some are not (e.g. %? and %!).  And
C-c C-c and C-c C-k both refuse to work correctly...

Good luck.  ;)

Jason



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] s/unser/user/ in lisp/org-table.el

2008-03-28 Thread Jason Riedy
Little, copyright-less change appended.

BTW, while I'm waiting for completion of my copyright assignment,
my little orgtbl changes are sitting in a fork on repo.or.gz:
  http://repo.or.cz/w/org-mode/ejr.git

The changes have been updated to the new structure, and
everything *appears* to work.

You may want to describe forks in README_GIT.  Pulling from a
fork would be a bit more controlled than giving out push access,
removing the various copyright concerns.  I don't know of a
sensible way to manage ChangeLog files.

Jason
--
diff --git a/lisp/org-table.el b/lisp/org-table.el
index ee83da7..fbeb5e8 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -176,7 +176,7 @@ fromaccept as input, do not present for editing
 t:  accept as input and present for editing
   :group 'org-table-calculation
   :type '(choice
- (const :tag Never, don't even check unser input for them nil)
+ (const :tag Never, don't even check user input for them nil)
  (const :tag Always, both as user input, and when editing t)
  (const :tag Convert user input, don't offer during editing 'from)))



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bruno Haible's git-merge-changelog

2008-03-28 Thread Jason Riedy
A quick search turned up Bruno Haible's git-merge-changelog:
  http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c

Potentially very useful.

Jason



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH 3/3] Allow functions for some orgtbl parameters.

2008-03-02 Thread Jason Riedy
Functions and dynamic binding permit some fun uses, including
gathering up header names for use in SQL insert statements.

Signed-off-by: Jason Riedy [EMAIL PROTECTED]
---
 org.el   |   38 ++
 org.texi |5 -
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/org.el b/org.el
index f38f6ae..6f17f1e 100644
--- a/org.el
+++ b/org.el
@@ -11778,16 +11778,26 @@ First element has index 0, or I0 if given.
(mapcar
 (lambda (f)
   (setq i (1+ i))
-  (let* ((fmt (if (consp fmt) (plist-get fmt i) fmt))
- (efmt (if (consp efmt) (plist-get efmt i) efmt))
+  (let* ((fmt (if (and (not (functionp fmt)) (consp fmt))
+  (plist-get fmt i) fmt))
+ (efmt (if (and (not (functionp efmt)) (consp efmt))
+   (plist-get efmt i) efmt))
  (f (if (and efmt (string-match orgtbl-exp-regexp f))
-(format efmt (match-string 1 f)
- (match-string 2 f))
+(if (functionp efmt) (funcall efmt
+  (match-string 1 f)
+  (match-string 2 f))
+  (format efmt (match-string 1 f)
+  (match-string 2 f)))
   f)))
-(if fmt (format fmt f) f)))
+(cond ((functionp fmt) (funcall fmt f))
+  (fmt (format fmt f))
+  (t f
 line)))
-  (push (if lfmt (apply 'format lfmt line)
- (concat lstart (mapconcat 'identity line sep) lend))
+  (push (cond ((functionp lfmt) (funcall lfmt line))
+ (lfmt (apply 'format lfmt line))
+ (t (concat (if (functionp lstart) (funcall lstart) lstart)
+(mapconcat 'identity line sep)
+(if (functionp lend) (funcall lend) lend
rtn
 
 (defun orgtbl-format-section (section-stopper)
@@ -11821,11 +11831,18 @@ Valid parameters are
 :hline  String to be inserted on horizontal separation lines.
 May be nil to ignore hlines.
 
+:sepSeparator between two fields
+
+  Each in the following group may be either a string or a function
+  of no arguments returning a string:
 :lstart String to start a new table line.
 :llstartString to start the last table line, defaults to :lstart.
 :lend   String to end a table line
 :llend  String to end the last table line, defaults to :lend.
-:sepSeparator between two fields
+
+  Each in the following group may be a string, a function of one
+  argument (the field or line) returning a string, or a plist
+  mapping columns to either of the above:
 :lfmt   Format for entire line, with enough %s to capture all fields.
 If this is present, :lstart, :lend, and :sep are ignored.
 :llfmt  Format for the entire last line, defaults to :lfmt.
@@ -11840,6 +11857,7 @@ Valid parameters are
 All lines before the first hline are treated as header.
 If any of these is not present, the data line value is used.
 
+  This may be either a string or a function of two arguments:
 :efmt   Use this format to print numbers with exponentials.
 The format should have %s twice for inserting mantissa
 and exponent, for example \%stimes10^{%s}\.  This
@@ -11906,11 +11924,13 @@ LaTeX are:
original field value.  For example, to wrap everything in dollars,
use :fmt \$%s$\.  This may also be a property list with column
numbers and formats.  For example :fmt (2 \$%s$\ 4 \%s%%\)
+   The format may also be a function that formats its one argument.
 
 :efmt  Format for transforming numbers with exponentials.  The format
should have %s twice for inserting mantissa and exponent, for
example \%stimes10^{%s}\.  LaTeX default is \%s,(%s)\.
This may also be a property list with column numbers and formats.
+   The format may also be a function that formats its two arguments.
 
 :llend If you find too much space below the last line of a table,
pass a value of \\ for :llend to suppress the final .
@@ -11972,6 +11992,8 @@ TeXInfo are:
everything in @kbd{}, you could use :fmt \@kbd{%s}\.
This may also be a property list with column numbers and
formats.  For example :fmt (2 \@kbd{%s}\ 4 \@code{%s}\).
+   Each format also may be a function that formats its one
+   argument.
 
 :cf \f1 f2..\The column fractions for the table.  By default these
are computed automatically from the width

[Orgmode] How I'm using these: Generating SQL insert statements.

2008-03-02 Thread Jason Riedy
This code is only partially baked, but it's working for me at the
moment.  I'm using my multi-target changes to generate both a
LaTeX description of the values as well as SQL insert statements
in separate noweb chunks.  The code leaves a spare blank line
in place of the header and cannot handle more than one header line,
but it's all I need...

Jason

(defun ejr/orgtbl-to-sqlinsert (table params)
  Convert the orgtbl-mode TABLE to SQL insert statements.
TABLE is a list, each entry either the symbol `hline' for a horizontal
separator line, or a list of fields for that line.
PARAMS is a property list of parameters that can influence the conversion.
Supports all parameters from `orgtbl-to-generic'.  Most important for
SQL are:

:spliceWhen set to t, return only insert statements, don't wrap
   them in a transaction.  Default is nil.

:sqlname   The name of the database table; defaults to the name of the
   target region.

:tstart, :tend
   The strings used to begin and commit the transaction.

:fmt   A format to be used to wrap the field value, should contain %s
   for the original field value.  The default wraps the
   value in the non-standard [] quote marks but does not
   protect against ] characters in the header name.  The
   format may also be a function that formats its one
   argument.

:hfmt  A function that gathers the []-quoted header names into a
   dynamically scoped variable HDRLIST.

The general parameters :skip and :skipcols have already been applied when
this function is called.
  (let* (hdrlist
 (alignment (mapconcat (lambda (x) (if x r l))
   org-table-last-alignment ))
 (params2
  (list
   :sqlname name
   :tstart BEGIN TRANSACTION;
   :tend COMMIT;
   :fmt [%s]
   :hfmt (lambda (f) (push (concat [ f ]) hdrlist) )
   :hlfmt (lambda (lst) nil)
   :lstart (lambda () (concat INSERT INTO 
  (plist-get params :sqlname) ( 
  (mapconcat 'identity (reverse hdrlist)
 , )
   ) VALUES ( ))
   :lend  );
   :sep  , 
   :hline nil)))
(orgtbl-to-generic table (org-combine-plists params2 params



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] One table, multiple radio targets?

2008-02-28 Thread Jason Riedy
Anyone have a clever way to generate multiple outputs from one
table?  It's pretty clear that orgtbl-send-table doesn't handle
multiple ORGTBL lines, and I'm not clever enough to hack in a
loop over multiple clauses on one ORGTBL line.

The context is a probably too clever mechanism to generate both
code and documentation at once.  I'm using noweb to document a
SQL schema, and a few tables are pre-loaded with data.  I'd like
to send one orgtbl-mode table to LaTeX and SQL insert statements.

Jason



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Git repository

2008-01-31 Thread Jason Riedy
And Russell Adams writes:
 When I was selecting a VC, I narrowed it down to Bazaar or Git. Being
 a prior Arch user, Bazaar fixed most of my complaints while using the
 same architecture.

The Arch architecture doesn't fit everyone.  In particular, a
colleague and I used tla to shoot changes back and forth rapidly.
We ended up with a history with at least 40% merge detritus.  git
doesn't bother recording merge information when the merge is
trivial (a fast-forward of one history to match another).  That
fit our working model and my mental model better.

Generally, git tracks contents rather than changes.  That's how
my head works as well, so most git functions do what I expect and
want.  Any technical differences are insignificant in comparison.

Git and Mercurial archives can exist on the far side of a dumb
transport like http.  They're not ideal necessarily, but they
function well enough.

Jason



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode