emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to force org-mode to interpret number as string
@ 2014-03-05  3:45 Stefan Huchler
  2014-03-05 15:09 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Huchler @ 2014-03-05  3:45 UTC (permalink / raw)
  To: emacs-orgmode


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 | mayor@gotham-city.com |
| Butcher     | Peking        |   5.000 | Jinping@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:
: 
: "Jinping@china.cn"
: 
: 5.0
: 
: "Peking"
: 
: "Butcher"


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

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

end of thread, other threads:[~2014-03-13 14:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05  3:45 how to force org-mode to interpret number as string Stefan Huchler
2014-03-05 15:09 ` Bastien
2014-03-05 21:06   ` Stefan Huchler
2014-03-06 17:14     ` Eric Schulte
2014-03-07  4:12       ` Stefan Huchler
2014-03-07  5:34         ` Eric Schulte
2014-03-07 14:10           ` Stefan Huchler
2014-03-13 14:37             ` Bastien

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