[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] how to force org-mode to interpret number as string
From: |
Stefan Huchler |
Subject: |
[O] how to force org-mode to interpret number as string |
Date: |
Wed, 05 Mar 2014 04:45:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
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 | address@hidden |
| Butcher | Peking | 5.000 | address@hidden |
#+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:
:
: "address@hidden"
:
: 5.0
:
: "Peking"
:
: "Butcher"
btw, is there a easier way to generate this dict(python) like "lines" in
elisp?
- [O] how to force org-mode to interpret number as string,
Stefan Huchler <=
- Re: [O] how to force org-mode to interpret number as string, Bastien, 2014/03/05
- Re: [O] how to force org-mode to interpret number as string, Stefan Huchler, 2014/03/05
- Re: [O] how to force org-mode to interpret number as string, Eric Schulte, 2014/03/06
- Re: [O] how to force org-mode to interpret number as string, Stefan Huchler, 2014/03/06
- Re: [O] how to force org-mode to interpret number as string, Eric Schulte, 2014/03/07
- Re: [O] how to force org-mode to interpret number as string, Stefan Huchler, 2014/03/07
- Re: [O] how to force org-mode to interpret number as string, Bastien, 2014/03/13