From: Ivanov Dmitry <usr345@gmail.com>
To: David Maus <dmaus@ictsoc.de>
Cc: emacs-orgmode@gnu.org
Subject: Re[6]: programming for org-mode
Date: Sun, 8 Aug 2010 19:49:25 +0400 [thread overview]
Message-ID: <1245668073.20100808194925@gmail.com> (raw)
In-Reply-To: <87mxsxvc3o.wl%dmaus@ictsoc.de>
[-- Attachment #1.1: Type: text/plain, Size: 1608 bytes --]
I modified the scheme and the function. I think, that these 2 if-s just complicate the code for comprehension: we have 3 cases,
for each of them we should return the appropriate value.
Here is my variant of the function, including the fix, that you suggested:
(defun org-read-prop (prop)
"Convert the string property PROP to a number if appropriate.
Otherwise if prop looks like a list (meaning it starts with a
'(') then read it as lisp, otherwise return it unmodified as a
string."
(if (and (stringp prop) (not (equal prop "")))
(let ((out (string-to-number prop)))
(if (equal out 0)
(cond
((or
(equal "(" (substring prop 0 1))
(equal "'" (substring prop 0 1)))
(condition-case nil
(read prop)
(error prop)))
((string-match "^\\(+0\\|-0\\|0\\)$" prop)
0)
(t
(set-text-properties 0 (length prop) nil prop)
prop))
out))
prop))
All the tests work fine with the new version.
When I tried
(org-read-prop "(1 2 3))") -> (1 2 3)
It gave me (1 2 3), ignoring the last ')'. Seems to be the read function bug.
At last I got rid of these nasty little squares on the scheme :)
[-- Attachment #1.2: Type: text/html, Size: 4603 bytes --]
[-- Attachment #2: org-collector.pdf --]
[-- Type: application/pdf, Size: 6968 bytes --]
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-08-08 16:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-15 4:52 programming for org-mode Ivanov Dmitry
2010-07-15 17:26 ` Eric Schulte
2010-07-15 20:15 ` David Maus
2010-07-15 20:21 ` David Maus
2010-07-15 21:40 ` Nick Dokos
2010-07-15 21:53 ` Eric Schulte
2010-07-15 22:17 ` Nick Dokos
2010-08-05 12:33 ` Re[2]: " Ivanov Dmitry
[not found] ` <AANLkTi=wrOCCrZxRZTGgvNKGjy2jmnogiA91bYnHAExV@mail.gmail.com>
2010-08-06 7:33 ` Re[4]: " Ivanov Dmitry
2010-08-07 13:12 ` Re[2]: " David Maus
2010-08-07 15:29 ` Re[4]: " Ivanov Dmitry
2010-08-08 6:43 ` David Maus
2010-08-08 15:49 ` Ivanov Dmitry [this message]
2010-08-09 19:16 ` Re[6]: " David Maus
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=1245668073.20100808194925@gmail.com \
--to=usr345@gmail.com \
--cc=dmaus@ictsoc.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).