emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Ivanov Dmitry <usr345@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re[2]: programming for org-mode
Date: Sat, 07 Aug 2010 15:12:32 +0200	[thread overview]
Message-ID: <87lj8ia7nj.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <226505391.20100805163301@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2547 bytes --]

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.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: 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

  parent reply	other threads:[~2010-08-08 17:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15  4:52 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     ` David Maus [this message]
2010-08-07 15:29       ` Ivanov Dmitry
2010-08-08  6:43         ` David Maus
2010-08-08 15:49           ` Re[6]: " Ivanov Dmitry
2010-08-09 19:16             ` 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=87lj8ia7nj.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=usr345@gmail.com \
    --subject='Re: Re[2]: programming for org-mode' \
    /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

Code repositories for project(s) associated with this 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).