emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Property for startup visibility?
@ 2008-05-06 19:24 Richard KLINDA
  2008-05-07  1:53 ` Peter Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Richard KLINDA @ 2008-05-06 19:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello, is there a property for setting the startup visibility (folden,
children or subtree) of a tree?

Thanks,
Richard

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

* Re: Property for startup visibility?
  2008-05-06 19:24 Property for startup visibility? Richard KLINDA
@ 2008-05-07  1:53 ` Peter Jones
  2008-05-07 11:39   ` Richard KLINDA
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Jones @ 2008-05-07  1:53 UTC (permalink / raw)
  To: Richard KLINDA; +Cc: emacs-orgmode

Richard KLINDA <rklinda@gmail.com> writes:
> Hello, is there a property for setting the startup visibility (folden,
> children or subtree) of a tree?

Place this in your .org file.  I keep it near the top:

#+STARTUP: showall

Search the manual for "startup" for more options.

-- 
Peter Jones, pmade inc.
http://pmade.com

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

* Re: Property for startup visibility?
  2008-05-07  1:53 ` Peter Jones
@ 2008-05-07 11:39   ` Richard KLINDA
  2008-05-07 15:23     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Richard KLINDA @ 2008-05-07 11:39 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> Regarding 'Re: Property for startup visibility?'; Peter Jones adds:


  > Richard KLINDA <rklinda@gmail.com> writes:
  >> Hello, is there a property for setting the startup visibility
  >> (folden, children or subtree) of a tree?

  > Place this in your .org file.  I keep it near the top:

  > #+STARTUP: showall

  > Search the manual for "startup" for more options.

Thanks, but I would like to set this up on a tree-by-tree basis
(complementing the #+STARTUP option).

For example, currently I have a project file:

,----
| * Task 1
| 
| ** ...
| ** ...
| 
| * Task 2
| 
| ** ..
| ** ..
| 
| * Task 3
|
| ** ..
| ** ..
`----

What I want is setting it up to open like this:

,----
| * Task 1...  (Folded)
| 
| * Task 2     (Content)
| ** ..
| ** ..
| 
| * Task 3...  (Folded)
`----

Does it make sense?  IMHO it could be a nice job for properties.

Richard

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

* Re: Re: Property for startup visibility?
  2008-05-07 11:39   ` Richard KLINDA
@ 2008-05-07 15:23     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2008-05-07 15:23 UTC (permalink / raw)
  To: Richard KLINDA; +Cc: emacs-orgmode


On May 7, 2008, at 1:39 PM, Richard KLINDA wrote:

>>>>>> Regarding 'Re: Property for startup visibility?'; Peter Jones  
>>>>>> adds:
>
>
>> Richard KLINDA <rklinda@gmail.com> writes:
>>> Hello, is there a property for setting the startup visibility
>>> (folden, children or subtree) of a tree?
>
>> Place this in your .org file.  I keep it near the top:
>
>> #+STARTUP: showall
>
>> Search the manual for "startup" for more options.
>
> Thanks, but I would like to set this up on a tree-by-tree basis
> (complementing the #+STARTUP option).


Hmmm, I see now what you mean.  I am not convinced how useful this
would be, because I suspect that the visibility you'd like
will often change?

Something like this is easily hacked, see below.  Why don't
you test it a while and then report back with a good example
and use case.  Then we can make a decision about including it.

The following looks for a :visibility: property with value
"folded" or "children" or "all".  Installing it in the hook will run  
it after the global STARTUP visibility has been set.

- Carsten

(defun org-property-visibility ()
   "Switch subtree visibility according to :visibility: property."
   (interactive)
   (let (state)
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward
	      "^[ \t]*:visibility:[ \t]+\\([a-z]+\\)"
	      nil t)
	(setq state (match-string 1))
	(save-excursion
	  (org-back-to-heading t)
	  (hide-subtree)
	  (org-reveal)
	  (cond
	   ((equal state "children")
	    (org-show-hidden-entry)
	    (show-children))
	   ((equal state "all")
	    (show-subtree)))))
       (org-cycle-hide-drawers 'all))))

(add-hook 'org-mode-hook 'org-property-visibility)

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

end of thread, other threads:[~2008-05-07 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-06 19:24 Property for startup visibility? Richard KLINDA
2008-05-07  1:53 ` Peter Jones
2008-05-07 11:39   ` Richard KLINDA
2008-05-07 15:23     ` Carsten Dominik

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