I try to generate mail drafts from a table as template-tokens. 

The Problem is that that org-mode seems to auto-format the salary column
as a number. I donĀ“t need to calc this numbers so saving/getting it as
string would be what I want. 

It not only butchers the string because he interprets the numbers behind
of the . as decimal point, while in germany we use the "," for that, and
the point as a way to mark thousends.

But even if he would understand that the number is 5000 and not 5, if
the outcommented replace-regexp throughs a error because its not string.

To convert it back makes no sense, the fields will always be interpreted
as replacement-strings.


#+TBLNAME: jobs
| jobname     | city          |  salary | email                 |
| Taxi-driver | New York City | 500.000 | ma...@gotham-city.com |
| Butcher     | Peking        |   5.000 | jinp...@china.cn      |

#+SRC_NAME: generate_job_mails_from_table
#+BEGIN_SRC emacs-lisp :var table=jobs header=jobs[0] data=jobs[1:-1] :results 
output

(setq column-length (length header))
(setq lines)
(dolist (line data)
  (setq tmp-line)
  (dotimes (i column-length)
    (add-to-list 'tmp-line (cons (nth i header) (nth i line)))
;    (print (nth i line)
  )
  (add-to-list 'lines tmp-line)
)

(message-mail)
(setq line1 (car lines))
(insert (cdr (assoc "email" line1)))
(message-goto-subject)
(insert "applying for the job: $jobname")
(dolist (var line1)
;  (replace-regexp (concat "$"(car var)) (cdr var ))
  (print (cdr var))
)
  
#+END_SRC

#+RESULTS:
: 
: "jinp...@china.cn"
: 
: 5.0
: 
: "Peking"
: 
: "Butcher"


btw, is there a easier way to generate this dict(python) like "lines" in
elisp?


Reply via email to