emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[2]: [Orgmode] programming for org-mode


From: David Maus
Subject: Re: Re[2]: [Orgmode] programming for org-mode
Date: Sat, 07 Aug 2010 15:12:32 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hi Ivanov,

Ivanov Dmitry wrote: >Hi, Eric. I decided to draw schemes for
functions in your module org-collector.el. And started from
org-read-prop. Please, check my pdf file - my questions are marked
with green. If there are no attachments allowed in the mailing list,
you can get it here:

>http://live-wtr.ru/org/org-collector.pdf

,----
| 01. (defun org-read-prop (prop)
| 02.   "Convert the string property PROP to a number if appropriate.
| 03. Otherwise if prop looks like a list (meaning it starts with a
| 04. '(') then read it as lisp, otherwise return it unmodified as a
| 05. string."
| 06.   (if (and (stringp prop) (not (equal prop "")))
| 07.       (let ((out (string-to-number prop)))
| 08.         (if (equal out 0)
| 09.             (if (or (equal "(" (substring prop 0 1)) (equal "'" 
(substring prop 0 1)))
| 10.                 (read prop)
| 11.               (if (string-match "^\\(+0\\|-0\\|0\\)$" prop)
| 12.                   0
| 13.                 (progn (set-text-properties 0 (length prop) nil prop)
| 14.                        prop)))
| 15.           out))
| 16.     prop))
`----

If `prop' is a string and not empty, bind `out' to the result of
calling `string-to-number' with argument `prop'.  `string-to-number'
returns 0 if the string was a zero or if the string didn't contain
convertable characters.  Thus, if `out` ist /not/ zero, we return
`out'.

If it is, check if `prop' looks like a Lisp expression (Line 09).  If
it looks like a Lisp expresion, return this expression.

C-h f read RET:

,----
| read is a built-in function in `C source code'.
|
| (read &optional STREAM)
|
| Read one Lisp expression as text from STREAM, return as Lisp object.
| If STREAM is nil, use the value of `standard-input' (which see).
| STREAM or the value of `standard-input' may be:
|  a buffer (read from point and advance it)
|  a marker (read from where it points and advance it)
|  a function (call it with no arguments for each character,
|      call it with a char as argument to push a char back)
|  a string (takes text from string, starting at the beginning)
|  t (read text line using minibuffer and use it, or read from
|     standard input in batch mode).
|
| [back]
`----

If it didn't look like a Lisp expression, check if `out' is 0 because
`prop' is the string "0", "+0", or "-0".  If this is the case, return
0.  We don't use `unless' because in this case the function
`org-read-prop' would return nil.

HTH,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpp62KXap_rj.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]