emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Parser - which values are possible for `archivedp'?
@ 2014-03-04 14:16 Thorsten Jolitz
  2014-03-04 14:35 ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-03-04 14:16 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

the name of headline attribute `archivedp' suggests its just a boolean
nil/t variable, but in parse trees I see e.g. a list as value 

,-----------------------
| :archivedp ("ARCHIVE")
`-----------------------

and I vaguely remember that I have seen different symbols as values of
this attribute too. 

So what do I have to expect as values here? A list of strings or nil? Or
something else too? Whatever is defined in 

,---------------------------------------------------
| org-archive-tag is a variable defined in `org.el'.
| Its value is "ARCHIVE"
`---------------------------------------------------

? 

PS 

If the tag is just a string like in this case, why is it shown as
list in the parse tree?

-- 
cheers,
Thorsten

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:16 Parser - which values are possible for `archivedp'? Thorsten Jolitz
@ 2014-03-04 14:35 ` Nick Dokos
  2014-03-04 14:47   ` Thorsten Jolitz
  2014-03-04 14:52   ` Thorsten Jolitz
  0 siblings, 2 replies; 8+ messages in thread
From: Nick Dokos @ 2014-03-04 14:35 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List, 
>
> the name of headline attribute `archivedp' suggests its just a boolean
> nil/t variable, but in parse trees I see e.g. a list as value 
>
> ,-----------------------
> | :archivedp ("ARCHIVE")
> `-----------------------
>
> and I vaguely remember that I have seen different symbols as values of
> this attribute too. 
>
> So what do I have to expect as values here? A list of strings or nil? Or
> something else too? Whatever is defined in 
>
> ,---------------------------------------------------
> | org-archive-tag is a variable defined in `org.el'.
> | Its value is "ARCHIVE"
> `---------------------------------------------------
>
> ? 
>
> PS 
>
> If the tag is just a string like in this case, why is it shown as
> list in the parse tree?

It is set like this
  (let
   ...
   (archivedp (member org-archive-tag tags))
   ...)

in org-element.el. It is effectively a boolean, but there is no
need to reduce the return value of ``member'' to t if it is non-nil:

,----
|    member is a built-in function in `C source code'.
| 
| (member ELT LIST)
| 
| Return non-nil if ELT is an element of LIST.  Comparison done with `equal'.
`----

So if non-nil, it will be a list of tags, starting with the value of
org-archive-tag. AFAICT, the rest of the tags can be arbitrary.

-- 
Nick

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:35 ` Nick Dokos
@ 2014-03-04 14:47   ` Thorsten Jolitz
  2014-03-04 14:51     ` Jonathan Leech-Pepin
  2014-03-04 14:52   ` Thorsten Jolitz
  1 sibling, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-03-04 14:47 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List, 
>>
>> the name of headline attribute `archivedp' suggests its just a boolean
>> nil/t variable, but in parse trees I see e.g. a list as value 
>>
>> ,-----------------------
>> | :archivedp ("ARCHIVE")
>> `-----------------------
>>
>> and I vaguely remember that I have seen different symbols as values of
>> this attribute too. 
>>
>> So what do I have to expect as values here? A list of strings or nil? Or
>> something else too? Whatever is defined in 
>>
>> ,---------------------------------------------------
>> | org-archive-tag is a variable defined in `org.el'.
>> | Its value is "ARCHIVE"
>> `---------------------------------------------------
>>
>> ? 
>>
>> PS 
>>
>> If the tag is just a string like in this case, why is it shown as
>> list in the parse tree?
>
> It is set like this
>   (let
>    ...
>    (archivedp (member org-archive-tag tags))
>    ...)
>
> in org-element.el. It is effectively a boolean, but there is no
> need to reduce the return value of ``member'' to t if it is non-nil:
>
> ,----
> |    member is a built-in function in `C source code'.
> | 
> | (member ELT LIST)
> | 
> | Return non-nil if ELT is an element of LIST.  Comparison done with
> | equal'.
> `----
>
> So if non-nil, it will be a list of tags, starting with the value of
> org-archive-tag. AFAICT, the rest of the tags can be arbitrary.


** Second Level 2 :tag:my:ARCHIVE:


,------------------------------------------------
| :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
`------------------------------------------------

-- 
cheers,
Thorsten

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:47   ` Thorsten Jolitz
@ 2014-03-04 14:51     ` Jonathan Leech-Pepin
  2014-03-04 14:58       ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Leech-Pepin @ 2014-03-04 14:51 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]

Hello,

On 4 March 2014 09:47, Thorsten Jolitz <tjolitz@gmail.com> wrote:

> Nick Dokos <ndokos@gmail.com> writes:
>
> > Thorsten Jolitz <tjolitz@gmail.com> writes:
> >
> >> Hi List,
> >>
> >> the name of headline attribute `archivedp' suggests its just a boolean
> >> nil/t variable, but in parse trees I see e.g. a list as value
> >>
> >> ,-----------------------
> >> | :archivedp ("ARCHIVE")
> >> `-----------------------
> >>
> >> and I vaguely remember that I have seen different symbols as values of
> >> this attribute too.
> >>
> >> So what do I have to expect as values here? A list of strings or nil? Or
> >> something else too? Whatever is defined in
> >>
> >> ,---------------------------------------------------
> >> | org-archive-tag is a variable defined in `org.el'.
> >> | Its value is "ARCHIVE"
> >> `---------------------------------------------------
> >>
> >> ?
> >>
> >> PS
> >>
> >> If the tag is just a string like in this case, why is it shown as
> >> list in the parse tree?
> >
> > It is set like this
> >   (let
> >    ...
> >    (archivedp (member org-archive-tag tags))
> >    ...)
> >
> > in org-element.el. It is effectively a boolean, but there is no
> > need to reduce the return value of ``member'' to t if it is non-nil:
> >
> > ,----
> > |    member is a built-in function in `C source code'.
> > |
> > | (member ELT LIST)
> > |
> > | Return non-nil if ELT is an element of LIST.  Comparison done with
> > | equal'.
> > `----
> >
> > So if non-nil, it will be a list of tags, starting with the value of
> > org-archive-tag. AFAICT, the rest of the tags can be arbitrary.
>
>
> ** Second Level 2 :tag:my:ARCHIVE:
>
>
> ,------------------------------------------------
> | :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
> `------------------------------------------------
>

Change the order of the tags so that Archive comes before the others and
you get:

** Second level 2 :ARCHIVE:tag:my:
:tags ("tag" "my") :archivedp ("ARCHIVE" "tag" "my")

Regards,
Jon


> --
> cheers,
> Thorsten
>
>
>

[-- Attachment #2: Type: text/html, Size: 3306 bytes --]

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:35 ` Nick Dokos
  2014-03-04 14:47   ` Thorsten Jolitz
@ 2014-03-04 14:52   ` Thorsten Jolitz
  1 sibling, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-03-04 14:52 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List, 
>>
>> the name of headline attribute `archivedp' suggests its just a boolean
>> nil/t variable, but in parse trees I see e.g. a list as value 
>>
>> ,-----------------------
>> | :archivedp ("ARCHIVE")
>> `-----------------------
>>
>> and I vaguely remember that I have seen different symbols as values of
>> this attribute too. 
>>
>> So what do I have to expect as values here? A list of strings or nil? Or
>> something else too? Whatever is defined in 
>>
>> ,---------------------------------------------------
>> | org-archive-tag is a variable defined in `org.el'.
>> | Its value is "ARCHIVE"
>> `---------------------------------------------------
>>
>> ? 
>>
>> PS 
>>
>> If the tag is just a string like in this case, why is it shown as
>> list in the parse tree?
>
> It is set like this
>   (let
>    ...
>    (archivedp (member org-archive-tag tags))
>    ...)
>
> in org-element.el. It is effectively a boolean, but there is no
> need to reduce the return value of ``member'' to t if it is non-nil:
>
> ,----
> |    member is a built-in function in `C source code'.
> | 
> | (member ELT LIST)
> | 
> | Return non-nil if ELT is an element of LIST.  Comparison done with
> | equal'.
> `----
>
> So if non-nil, it will be a list of tags, starting with the value of
> org-archive-tag. AFAICT, the rest of the tags can be arbitrary.

[ups ... I sent this unfinished by accident first]

Ok, thanks, this explains a lot, and it seems that Org-mode inserts the
:ARCHIVE: tag always at the end, and other tags in front of it: 

,-----------------------------------
| ** Second Level 2 :tag:my:ARCHIVE:
`-----------------------------------

so it will almost always look like this:

,------------------------------------------------
| :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
`------------------------------------------------



-- 
cheers,
Thorsten

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:51     ` Jonathan Leech-Pepin
@ 2014-03-04 14:58       ` Thorsten Jolitz
  2014-03-04 15:44         ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Jolitz @ 2014-03-04 14:58 UTC (permalink / raw)
  To: emacs-orgmode

Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com> writes:

> Hello,
>
> On 4 March 2014 09:47, Thorsten Jolitz <tjolitz@gmail.com> wrote:
>
>     
>     Nick Dokos <ndokos@gmail.com> writes:
>     
>     > Thorsten Jolitz <tjolitz@gmail.com> writes:
>     >
>     >> Hi List,
>     >>
>     >> the name of headline attribute `archivedp' suggests its just a
>     boolean
>     >> nil/t variable, but in parse trees I see e.g. a list as value
>     >>
>     >> ,-----------------------
>     >> | :archivedp ("ARCHIVE")
>     >> `-----------------------
>     >>
>     >> and I vaguely remember that I have seen different symbols as
>     values of
>     >> this attribute too.
>     >>
>     >> So what do I have to expect as values here? A list of strings
>     or nil? Or
>     >> something else too? Whatever is defined in
>     >>
>     >> ,---------------------------------------------------
>     >> | org-archive-tag is a variable defined in `org.el'.
>     >> | Its value is "ARCHIVE"
>     >> `---------------------------------------------------
>     >>
>     >> ?
>     >>
>     >> PS
>     >>
>     >> If the tag is just a string like in this case, why is it shown
>     as
>     >> list in the parse tree?
>     >
>     > It is set like this
>     > (let
>     > ...
>     > (archivedp (member org-archive-tag tags))
>     > ...)
>     >
>     > in org-element.el. It is effectively a boolean, but there is no
>     > need to reduce the return value of ``member'' to t if it is
>     non-nil:
>     >
>     > ,----
>     > | member is a built-in function in `C source code'.
>     > |
>     > | (member ELT LIST)
>     > |
>     > | Return non-nil if ELT is an element of LIST. Comparison done
>     with
>     > | equal'.
>     > `----
>     >
>     > So if non-nil, it will be a list of tags, starting with the
>     value of
>     > org-archive-tag. AFAICT, the rest of the tags can be arbitrary.
>     
>     
>     
>     ** Second Level 2 :tag:my:ARCHIVE:
>     
>     
>     ,------------------------------------------------
>     | :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
>     `------------------------------------------------
>
> Change the order of the tags so that Archive comes before the others
> and you get:
>
> ** Second level 2 :ARCHIVE:tag:my:
> :tags ("tag" "my") :archivedp ("ARCHIVE" "tag" "my")

A very useful feature of the `member' function in lisp programming, but
not that great in this case I would say ... why not use (car (member ...))?
Then its just a string, and the single value of interest.

-- 
cheers,
Thorsten

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 14:58       ` Thorsten Jolitz
@ 2014-03-04 15:44         ` Nick Dokos
  2014-03-04 16:19           ` Thorsten Jolitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2014-03-04 15:44 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

>>     > So if non-nil, it will be a list of tags, starting with the
>>     value of
>>     > org-archive-tag. AFAICT, the rest of the tags can be arbitrary.
>>     
>>     
>>     
>>     ** Second Level 2 :tag:my:ARCHIVE:
>>     
>>     
>>     ,------------------------------------------------
>>     | :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
>>     `------------------------------------------------
>>
>> Change the order of the tags so that Archive comes before the others
>> and you get:
>>
>> ** Second level 2 :ARCHIVE:tag:my:
>> :tags ("tag" "my") :archivedp ("ARCHIVE" "tag" "my")
>
> A very useful feature of the `member' function in lisp programming, but
> not that great in this case I would say ... why not use (car (member ...))?
> Then its just a string, and the single value of interest.

Why? All that matters is whether it's nil or not.

Nick

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

* Re: Parser - which values are possible for `archivedp'?
  2014-03-04 15:44         ` Nick Dokos
@ 2014-03-04 16:19           ` Thorsten Jolitz
  0 siblings, 0 replies; 8+ messages in thread
From: Thorsten Jolitz @ 2014-03-04 16:19 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>>>     > So if non-nil, it will be a list of tags, starting with the
>>>     value of
>>>     > org-archive-tag. AFAICT, the rest of the tags can be arbitrary.
>>>     
>>>     
>>>     
>>>     ** Second Level 2 :tag:my:ARCHIVE:
>>>     
>>>     
>>>     ,------------------------------------------------
>>>     | :tags ("tag" "my") [...] :archivedp ("ARCHIVE")
>>>     `------------------------------------------------
>>>
>>> Change the order of the tags so that Archive comes before the others
>>> and you get:
>>>
>>> ** Second level 2 :ARCHIVE:tag:my:
>>> :tags ("tag" "my") :archivedp ("ARCHIVE" "tag" "my")
>>
>> A very useful feature of the `member' function in lisp programming, but
>> not that great in this case I would say ... why not use (car (member
>> ...))?
>> Then its just a string, and the single value of interest.
>
> Why? All that matters is whether it's nil or not.

Why not? With a tiny change in the code one would get rid of potential
redundancy in the parse tree, would cause less surprise for people who
look at the parsers output (what does ":archivedp ("ARCHIVE" "tag"
"my")" mean?) and would get something more logical (the value of
:archivedp is either nil or the string in org-archive-tag). 

But its not really that important I guess, I just needed to know what
kind of values to expect in that place - thanks for the hints. I
use that in another program where it does matter if its a boolean, a
string or a list of strings ...

-- 
cheers,
Thorsten

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

end of thread, other threads:[~2014-03-04 16:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04 14:16 Parser - which values are possible for `archivedp'? Thorsten Jolitz
2014-03-04 14:35 ` Nick Dokos
2014-03-04 14:47   ` Thorsten Jolitz
2014-03-04 14:51     ` Jonathan Leech-Pepin
2014-03-04 14:58       ` Thorsten Jolitz
2014-03-04 15:44         ` Nick Dokos
2014-03-04 16:19           ` Thorsten Jolitz
2014-03-04 14:52   ` Thorsten Jolitz

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