emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* agenda csv export: three problems (batch, koi8-r and commas)
@ 2007-05-31  9:23 Ruslan Kosolapov
  2007-05-31 12:27 ` Jason F. McBrayer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ruslan Kosolapov @ 2007-05-31  9:23 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]


org-mode 4.75, emacs-snapshot (latest from debian sid)



--[ 1. Problems with -batch ]--

Command 
$ emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv "t")'
fails with 
Debugger entered--Lisp error: (void-function org-batch-agenda-csv)
  (org-batch-agenda-csv "t")
  eval((org-batch-agenda-csv "t"))
  command-line-1(("-l" "/home/rk/.emacs" "-eval" "(org-batch-agenda-csv \"t\")"))
  command-line()
  normal-top-level()

It's look like problem with autoload (unfortunatelly I dont know how
emacs works, so, maybe I wrong).


Command
$ emacs -batch -l ~/.emacs -eval '(load-library "org") (org-batch-agenda-csv "t")'
returns nothing useful.  And I don't know why :)


Only command 
emacs -batch -l ~/.emacs -eval '(my-make-csv)'
returns agenda in csv format.

Maybe fix of this issue is a documentation fix - maybe I do something
wrong :)




--[ 2. Problems with koi8-r ]--

I use koi8-r for my org-file, its works well in most cases.

But in csv I got junk instead koi8-r symbols.  As far as I understand,
html export works the same way, and in html I see html-entities
instead koi8-r.  In browser its look good, but not in terminal and
perl.

I tried to use utf-8, and fail too.

Of course, I execute emacs in the same locale as my org-file.

This issue is critical for me.



--[ 3. Problems with , and "" ]--

As far as I know, strings in csv should be quoted, else there will be
problems if string contains comma.

Now I see than "head" field placed in csv without quotes.  So, if I
use comma in heading text, csv-parsing script fails.

It is not problem for me because I do not use comma in heading text,
but this is a bug.

At other side, using types and quotation in csv output mean more
complex parser for it.  So, maybe better do not fix it by quotation
adding.

In MS Excel I can specify delimiter symbol for csv export, sometimes
it very useful.  I attach patch which implements this feature in
org-mode.

Changeable delimiter can be used as fix of "comma in heading" issue.

Patch (oh, no, it's so small :(  ;)  ):

[-- Attachment #2: org-mode-patch-for-csv-delimiter --]
[-- Type: application/octet-stream, Size: 720 bytes --]

--- org.el.orig	2007-05-31 15:51:32.000000000 +0700
+++ org.el	2007-05-31 16:07:32.000000000 +0700
@@ -1813,6 +1813,11 @@
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-agenda-csv-delimiter ","
+  "Delimiter for fields in csv export of agenda."
+  :group 'org-agenda-export
+  :type 'string)
+
 (defgroup org-agenda-custom-commands nil
  "Options concerning agenda views in Org-mode."
  :tag "Org Agenda Custom Commands"
@@ -14491,7 +14496,7 @@
 	   (mapconcat 'org-agenda-export-csv-mapper
 		      '(org-category txt type todo tags date time-of-day extra
 				     priority-letter priority)
-		      ","))
+		      org-agenda-csv-delimiter))
 	  (princ "\n"))))))
 
 (defun org-fix-agenda-info (props)

[-- Attachment #3: Type: text/plain, Size: 1344 bytes --]




--[ Additional info ]--

.emacs:

(setq my-work-agenda-dir "/home/rk/work/doc/tasks/")
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(defun maf (filename)
  (concat my-work-agenda-dir filename))
(defun gtd ()
  (interactive)
  (find-file (maf "work.org"))
  )
(defun my-make-csv ()
  (gtd)
  (org-batch-agenda-csv "t"))
(setq org-agenda-files (list (maf "work.org")))


org-file (with koi8-r symbols, I hope mail does not corrupt them :) ):

#+STARTUP: lognotestate
#+STARTUP: showall
#+TAGS: { rk(r) sveta(s) kir(k) zalomlenkov(z) ilnar(i) sgunkin(g) const(c) max(m) ikryak(v) } ATT MS
#+SEQ_TODO: NEW NEXT RESCHEDULED | DONE CANCELED
#+SEQ_TODO: WAITING SOMEDAY | CANCELED
#+SEQ_TODO: FREEZED | CANCELED
#+LINK: wiki http://trac.qa.plesk.ru:8080/wiki/
#+TITLE:     QAA Tasks
#+AUTHOR:    rk
#+EMAIL:     rk@plesk.ru
#+LANGUAGE:  ru
#+OPTIONS:   H:4 num:t toc:t \n:nil @:t ::t |:t ^:t *:t TeX:t LaTeX:nil skip:t

#+CATEGORY: Incoming
* Incoming

#+CATEGORY: WorkFlow
* WorkFlow
** NEW Changelog для продуктов via RSS		:rk:kir:

#+CATEGORY: General
* General
** NEXT разобраться с backup failed на psaqa	:rk:
** NEW сделать нормальным репозиторий файлов для AD
** NEW проблема с именами preconditions		:rk:


-- 
Ruslan Kosolapov
Plesk QA Department Second Manager
SWsoft, Inc.

[-- Attachment #4: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: agenda csv export: three problems (batch, koi8-r and commas)
  2007-05-31  9:23 agenda csv export: three problems (batch, koi8-r and commas) Ruslan Kosolapov
@ 2007-05-31 12:27 ` Jason F. McBrayer
  2007-05-31 12:59   ` Ruslan Kosolapov
  2007-05-31 14:41   ` Carsten Dominik
  2007-05-31 12:53 ` Ruslan Kosolapov
  2007-06-01  7:07 ` Carsten Dominik
  2 siblings, 2 replies; 6+ messages in thread
From: Jason F. McBrayer @ 2007-05-31 12:27 UTC (permalink / raw)
  To: Ruslan Kosolapov; +Cc: emacs-orgmode

Ruslan Kosolapov <rkosolapov@swsoft.com> writes:

> org-mode 4.75, emacs-snapshot (latest from debian sid)
> --[ 3. Problems with , and "" ]--
>
> As far as I know, strings in csv should be quoted, else there will be
> problems if string contains comma.
>
> Now I see than "head" field placed in csv without quotes.  So, if I
> use comma in heading text, csv-parsing script fails.
>

I wondered about this immediately after csv agenda export was added,
so I tested it.  My testing showed that commas in headlines are
converted to semicolon on export (it must be getting done earlier in
the code than where you looked at it being placed in the csv).
Probably not The Right Thing, but good enough, and surely easier than
worrying about quoting.

-- 
+-----------------------------------------------------------+
| Jason F. McBrayer                    jmcbray@carcosa.net  |
| If someone conquers a thousand times a thousand others in |
| battle, and someone else conquers himself, the latter one |
| is the greatest of all conquerors.  --- The Dhammapada    |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: agenda csv export: three problems (batch, koi8-r and commas)
  2007-05-31  9:23 agenda csv export: three problems (batch, koi8-r and commas) Ruslan Kosolapov
  2007-05-31 12:27 ` Jason F. McBrayer
@ 2007-05-31 12:53 ` Ruslan Kosolapov
  2007-06-01  7:07 ` Carsten Dominik
  2 siblings, 0 replies; 6+ messages in thread
From: Ruslan Kosolapov @ 2007-05-31 12:53 UTC (permalink / raw)
  To: emacs-orgmode


 RK> --[ 3. Problems with , and "" ]--

  Oh, sorry, I see org-agenda-export-csv-mapper only now :)
 
  So, problem with comma does not exists.
  So, my patch is wrong.

-- 
Ruslan Kosolapov
Plesk QA Department Second Manager
SWsoft, Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: agenda csv export: three problems (batch, koi8-r and commas)
  2007-05-31 12:27 ` Jason F. McBrayer
@ 2007-05-31 12:59   ` Ruslan Kosolapov
  2007-05-31 14:41   ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: Ruslan Kosolapov @ 2007-05-31 12:59 UTC (permalink / raw)
  To: emacs-orgmode


 >> org-mode 4.75, emacs-snapshot (latest from debian sid)
 >> --[ 3. Problems with , and "" ]--
 >> As far as I know, strings in csv should be quoted, else there will be
 >> problems if string contains comma.
 >> Now I see than "head" field placed in csv without quotes.  So, if I
 >> use comma in heading text, csv-parsing script fails.
 JFM> I wondered about this immediately after csv agenda export was
 JFM> added, so I tested it.  My testing showed that commas in
 JFM> headlines are converted to semicolon on export (it must be
 JFM> getting done earlier in the code than where you looked at it
 JFM> being placed in the csv).  Probably not The Right Thing, but
 JFM> good enough, and surely easier than worrying about quoting.

  Yes, I already found org-agenda-export-csv-mapper.
  Shame on me :(


PS: this is strange, but when I test this issue, I didn't see such
substitution.  Now I can not repeat that case, all works fine.  Maybe
bug was in my eyes.

-- 
Ruslan Kosolapov
Plesk QA Department Second Manager
SWsoft, Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: agenda csv export: three problems (batch, koi8-r and commas)
  2007-05-31 12:27 ` Jason F. McBrayer
  2007-05-31 12:59   ` Ruslan Kosolapov
@ 2007-05-31 14:41   ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2007-05-31 14:41 UTC (permalink / raw)
  To: Jason F. McBrayer; +Cc: Ruslan Kosolapov, emacs-orgmode


On May 31, 2007, at 14:27, Jason F. McBrayer wrote:

> Ruslan Kosolapov <rkosolapov@swsoft.com> writes:
>
>> org-mode 4.75, emacs-snapshot (latest from debian sid)
>> --[ 3. Problems with , and "" ]--
>>
>> As far as I know, strings in csv should be quoted, else there will be
>> problems if string contains comma.
>>
>> Now I see than "head" field placed in csv without quotes.  So, if I
>> use comma in heading text, csv-parsing script fails.
>>
>
> I wondered about this immediately after csv agenda export was added,
> so I tested it.  My testing showed that commas in headlines are
> converted to semicolon on export (it must be getting done earlier in
> the code than where you looked at it being placed in the csv).
> Probably not The Right Thing, but good enough, and surely easier than
> worrying about quoting.

Exactly.  Of course fancier stuff could be done, but I guess this
easy thing is still the best.

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: agenda csv export: three problems (batch, koi8-r and commas)
  2007-05-31  9:23 agenda csv export: three problems (batch, koi8-r and commas) Ruslan Kosolapov
  2007-05-31 12:27 ` Jason F. McBrayer
  2007-05-31 12:53 ` Ruslan Kosolapov
@ 2007-06-01  7:07 ` Carsten Dominik
  2 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2007-06-01  7:07 UTC (permalink / raw)
  To: Ruslan Kosolapov; +Cc: emacs-orgmode


On May 31, 2007, at 11:23, Ruslan Kosolapov wrote:

>
> org-mode 4.75, emacs-snapshot (latest from debian sid)
>
> --[ 1. Problems with -batch ]--
>
> Command
> $ emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv "t")'
> fails with
> Debugger entered--Lisp error: (void-function org-batch-agenda-csv)

This function needs to be autoloaded, as you realized yourself.
  Appearently you do not have

   (require 'org-install)

in .emacs as the instructions require (if you are running a
downloaded version of org-mode instead of the one that comes
with Emacs.  This file does install
the autoloads for all entry points, including this one.

> Command
> $ emacs -batch -l ~/.emacs -eval '(load-library "org") 
> (org-batch-agenda-csv "t")'
> returns nothing useful.  And I don't know why :)

The would be another solution, except that -eval takes only
a single form.  So you would have to do

    -eval '(progn (load-library "org") (org-batch-agenda-csv "t"))'

or

    -eval '(load-library "org")' -eval '(org-batch-agenda-csv "t")'

> --[ 2. Problems with koi8-r ]--
>
> I use koi8-r for my org-file, its works well in most cases.
>
> But in csv I got junk instead koi8-r symbols.  As far as I understand,
> html export works the same way, and in html I see html-entities
> instead koi8-r.  In browser its look good, but not in terminal and
> perl.
>
> I tried to use utf-8, and fail too.

I don't know how to fix this.  I am just using princ to send
the lines to STDOUT - if you figure out what else to do
to get better non-ascii representation there, let me know.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-01  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31  9:23 agenda csv export: three problems (batch, koi8-r and commas) Ruslan Kosolapov
2007-05-31 12:27 ` Jason F. McBrayer
2007-05-31 12:59   ` Ruslan Kosolapov
2007-05-31 14:41   ` Carsten Dominik
2007-05-31 12:53 ` Ruslan Kosolapov
2007-06-01  7:07 ` Carsten Dominik

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).