all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Richard KLINDA <rklinda@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Property for startup visibility?
Date: Wed, 7 May 2008 17:23:34 +0200	[thread overview]
Message-ID: <3B5FB20C-6B72-4C69-9374-85FCC2F33173@science.uva.nl> (raw)
In-Reply-To: <87abj2jqc8.fsf@gmail.com>


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)

      reply	other threads:[~2008-05-07 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B5FB20C-6B72-4C69-9374-85FCC2F33173@science.uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=rklinda@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.