From: Stefan Huchler <stefan.huchler@mail.de>
To: emacs-orgmode@gnu.org
Subject: how to force org-mode to interpret number as string
Date: Wed, 05 Mar 2014 04:45:11 +0100 [thread overview]
Message-ID: <87siqx9um0.fsf@mars.lan> (raw)
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?
next reply other threads:[~2014-03-05 3:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 3:45 Stefan Huchler [this message]
2014-03-05 15:09 ` how to force org-mode to interpret number as string 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87siqx9um0.fsf@mars.lan \
--to=stefan.huchler@mail.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).