emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Expanded property drawers as per file option
@ 2013-05-28 14:21 Karl Voit
  2013-05-28 14:40 ` Thorsten Jolitz
  2013-05-28 14:45 ` Thorsten Jolitz
  0 siblings, 2 replies; 9+ messages in thread
From: Karl Voit @ 2013-05-28 14:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I could not find anything yet which says that it's possible (or not)
to define a file variable which enables PROPERTY drawers to be
expanded (only in this current file).

My use case: I usually never store major meta-data in drawers. So I
like the default behavior with closed property drawers.  Except in
my "contacts.org" where I store basic data of persons I want to see.

Therefore, I would like to have these drawers expanded whenever I
expand the heading of a person. In other words: heading content
expanded -> property drawer expanded. All other Org-mode files
should keep their behavior that I manually have to expand drawers
when I want to see their content.

Is there a method to get this kind of behavior?

Thanks!

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: Expanded property drawers as per file option
  2013-05-28 14:21 Expanded property drawers as per file option Karl Voit
@ 2013-05-28 14:40 ` Thorsten Jolitz
  2013-05-28 14:45 ` Thorsten Jolitz
  1 sibling, 0 replies; 9+ messages in thread
From: Thorsten Jolitz @ 2013-05-28 14:40 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi!
>
> I could not find anything yet which says that it's possible (or not)
> to define a file variable which enables PROPERTY drawers to be
> expanded (only in this current file).
>
> My use case: I usually never store major meta-data in drawers. So I
> like the default behavior with closed property drawers.  Except in
> my "contacts.org" where I store basic data of persons I want to see.
>
> Therefore, I would like to have these drawers expanded whenever I
> expand the heading of a person. In other words: heading content
> expanded -> property drawer expanded. All other Org-mode files
> should keep their behavior that I manually have to expand drawers
> when I want to see their content.
>
> Is there a method to get this kind of behavior?
>
> Thanks!


This does the job, but maybe there is some inbuilt functionality too. 

,-------------------------------------
| (defun find-org-contracts ()
| (find-file "/path/to/contracts.org")
| (show-all))
| 
| (find-org-contracts)
`-------------------------------------


-- 
cheers,
Thorsten

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

* Re: Expanded property drawers as per file option
  2013-05-28 14:21 Expanded property drawers as per file option Karl Voit
  2013-05-28 14:40 ` Thorsten Jolitz
@ 2013-05-28 14:45 ` Thorsten Jolitz
  2013-05-28 14:58   ` Thorsten Jolitz
  1 sibling, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-05-28 14:45 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi!
>
> I could not find anything yet which says that it's possible (or not)
> to define a file variable which enables PROPERTY drawers to be
> expanded (only in this current file).
>
> My use case: I usually never store major meta-data in drawers. So I
> like the default behavior with closed property drawers.  Except in
> my "contacts.org" where I store basic data of persons I want to see.
>
> Therefore, I would like to have these drawers expanded whenever I
> expand the heading of a person. In other words: heading content
> expanded -> property drawer expanded. All other Org-mode files
> should keep their behavior that I manually have to expand drawers
> when I want to see their content.
>
> Is there a method to get this kind of behavior?

or maybe better an interactive version:

,-------------------------------------
| (defun find-org-contracts ()
| (interactive "fFile: ")
| (find-file "/path/to/contracts.org")
| (show-all))
| 
| M-x find-org-contracts
`-------------------------------------

-- 
cheers,
Thorsten

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

* Re: Expanded property drawers as per file option
  2013-05-28 14:45 ` Thorsten Jolitz
@ 2013-05-28 14:58   ` Thorsten Jolitz
  2013-05-29  4:31     ` Feng Shu
  0 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-05-28 14:58 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Karl Voit <devnull@Karl-Voit.at> writes:
>
>> Hi!
>>
>> I could not find anything yet which says that it's possible (or not)
>> to define a file variable which enables PROPERTY drawers to be
>> expanded (only in this current file).
>>
>> My use case: I usually never store major meta-data in drawers. So I
>> like the default behavior with closed property drawers.  Except in
>> my "contacts.org" where I store basic data of persons I want to see.
>>
>> Therefore, I would like to have these drawers expanded whenever I
>> expand the heading of a person. In other words: heading content
>> expanded -> property drawer expanded. All other Org-mode files
>> should keep their behavior that I manually have to expand drawers
>> when I want to see their content.
>>
>> Is there a method to get this kind of behavior?

sorry, that was a bit too hurried, I think this one is what you might
need:

,-------------------------------------
| (defun find-org-contracts ()
| (interactive)
| (find-file "/path/to/contracts.org")
| (show-all))
| 
| M-x find-org-contracts
`-------------------------------------

-- 
cheers,
Thorsten

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

* Re: Expanded property drawers as per file option
  2013-05-28 14:58   ` Thorsten Jolitz
@ 2013-05-29  4:31     ` Feng Shu
  2013-05-29 20:09       ` Karl Voit
  0 siblings, 1 reply; 9+ messages in thread
From: Feng Shu @ 2013-05-29  4:31 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Karl Voit <devnull@Karl-Voit.at> writes:
>>
>>> Hi!
>>>
>>> I could not find anything yet which says that it's possible (or not)
>>> to define a file variable which enables PROPERTY drawers to be
>>> expanded (only in this current file).
>>>
>>> My use case: I usually never store major meta-data in drawers. So I
>>> like the default behavior with closed property drawers.  Except in
>>> my "contacts.org" where I store basic data of persons I want to see.
>>>
>>> Therefore, I would like to have these drawers expanded whenever I
>>> expand the heading of a person. In other words: heading content
>>> expanded -> property drawer expanded. All other Org-mode files
>>> should keep their behavior that I manually have to expand drawers
>>> when I want to see their content.
>>>
>>> Is there a method to get this kind of behavior?
>
> sorry, that was a bit too hurried, I think this one is what you might
> need:
>
> ,-------------------------------------
> | (defun find-org-contracts ()
> | (interactive)
> | (find-file "/path/to/contracts.org")
> | (show-all))
> | 
> | M-x find-org-contracts
> `-------------------------------------

I use:

#+STARTUP: showeverything

-- 

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

* Re: Expanded property drawers as per file option
  2013-05-29  4:31     ` Feng Shu
@ 2013-05-29 20:09       ` Karl Voit
  2013-05-29 22:32         ` Thorsten Jolitz
  2013-06-01  6:13         ` Carsten Dominik
  0 siblings, 2 replies; 9+ messages in thread
From: Karl Voit @ 2013-05-29 20:09 UTC (permalink / raw)
  To: emacs-orgmode

* Feng Shu <tumashu@gmail.com> wrote:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>>
>> ,-------------------------------------
>> | (defun find-org-contracts ()
>> | (interactive)
>> | (find-file "/path/to/contracts.org")
>> | (show-all))
>> | 
>> | M-x find-org-contracts
>> `-------------------------------------
>
> I use:
> #+STARTUP: showeverything

Those two methods result in expanded properties, yes.

However, I obviously was not precise enough to explain my
requirement which is more complicated than "showeverything".


I would like to have all headings folded when I open the file (as it
is now). Then I navigate to a heading of a person by using text
search or arrow keys and TAB (to expand hierarchies). 

On the heading of the "target" person, I want TAB to expand also the
properties drawer, not only the content of the heading with
properties collapsed.


Example:

I start with contacts.org like this:

    * job
    * family

I go to "job" and expand using TAB:

    * job
      * Bob
      * Peter
      * Susan
    * family

After that, I navigate to "Peter" and press TAB once again to expand
the heading of Peter *and* its property drawer all together (only
for "Peter"):

    * job
      * Bob
      * Peter
        :PROPERTIES:
        :EMAIL: peter@example.com
        :COMPANY: Acme
        :ADDRESS: Hiscity, hisstreet 42
        :END:

        - met him at conference XY in 2009
        - works in the field of foobar

      * Susan
    * family


The desired difference to my current situation is, that I do not
have to navigate on the PROPERTY line and press TAB to open the
drawer for email, company name, address, and so forth.


Usual behavior: PROPERTY drawer stays collapsed when its
corresponding heading gets expanded.

My wish: PROPERTY drawer gets collapsed when its corresponding
heading gets expanded.


I know that this is a very specific requirement and it spares me
only one positioning effort followed by TAB. However, for contacts
it would eliminate one annoyance for my work flow :-)

Thanks for your comments, thoughts, tipps!


-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: Expanded property drawers as per file option
  2013-05-29 20:09       ` Karl Voit
@ 2013-05-29 22:32         ` Thorsten Jolitz
  2013-06-01  6:13         ` Carsten Dominik
  1 sibling, 0 replies; 9+ messages in thread
From: Thorsten Jolitz @ 2013-05-29 22:32 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> * Feng Shu <tumashu@gmail.com> wrote:
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>>
>>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>>>
>>> ,-------------------------------------
>>> | (defun find-org-contracts ()
>>> | (interactive)
>>> | (find-file "/path/to/contracts.org")
>>> | (show-all))
>>> |
>>> | M-x find-org-contracts
>>> `-------------------------------------
>>
>> I use:
>> #+STARTUP: showeverything
>
> Those two methods result in expanded properties, yes.
>
> However, I obviously was not precise enough to explain my
> requirement which is more complicated than "showeverything".
>
> I would like to have all headings folded when I open the file (as it
> is now). Then I navigate to a heading of a person by using text
> search or arrow keys and TAB (to expand hierarchies).

For me both 'show-entry' and 'show-children' open the property drawer of
a headline. I actually use these two for visibility cycling:

,-------------------------------------------------------
| [From `outline-mode-easy-bindings']
|
| (defun outline-show-more ()
|   (interactive)
|   (when (outline-on-heading-p)
|     (cond ((and (outline-subheadings-p)
|                 (not (outline-subheadings-visible-p)))
|            (show-children))
|           ((and (not (outline-subheadings-p))
|                 (not (outline-body-visible-p)))
|            (show-subtree))
|           ((and (outline-body-p)
|                 (not (outline-body-visible-p)))
|            (show-entry))
|           (t
|            (show-subtree)))))
|
|
| (defun outline-hide-more ()
|   (interactive)
|   (when (outline-on-heading-p)
|     (cond ((and (outline-body-p)
|                 (outline-body-visible-p))
|            (hide-entry)
|            (hide-leaves))
|           (t
|            (hide-subtree)))))
`-------------------------------------------------------

With these bindings:

,---------------------------------------------------------------------
| (let ((map outline-mode-map))
|   (outshine-define-key-with-fallback
|    map (kbd "M-<left>") (outline-hide-more) (outline-on-heading-p))
|   (outshine-define-key-with-fallback
|    map (kbd "M-<right>") (outline-show-more) (outline-on-heading-p)) [...]
`---------------------------------------------------------------------

and these docs:

,---------------------------------------------------------------------------
| <M-right> runs the command outline-show-more, which is an interactive Lisp
| function in `outshine.el'.
|
| It is bound to <M-right>.
|
| (outline-show-more)
`---------------------------------------------------------------------------

,--------------------------------------------------------------------
| outline-hide-more is an interactive Lisp function in `outshine.el'.
|
| (outline-hide-more)
`--------------------------------------------------------------------


--
cheers,
Thorsten

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

* Re: Expanded property drawers as per file option
  2013-05-29 20:09       ` Karl Voit
  2013-05-29 22:32         ` Thorsten Jolitz
@ 2013-06-01  6:13         ` Carsten Dominik
  2013-06-01 16:30           ` Karl Voit
  1 sibling, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2013-06-01  6:13 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode


On 29.5.2013, at 22:09, Karl Voit <devnull@Karl-Voit.at> wrote:

> * Feng Shu <tumashu@gmail.com> wrote:
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>> 
>>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>>> 
>>> ,-------------------------------------
>>> | (defun find-org-contracts ()
>>> | (interactive)
>>> | (find-file "/path/to/contracts.org")
>>> | (show-all))
>>> | 
>>> | M-x find-org-contracts
>>> `-------------------------------------
>> 
>> I use:
>> #+STARTUP: showeverything
> 
> Those two methods result in expanded properties, yes.
> 
> However, I obviously was not precise enough to explain my
> requirement which is more complicated than "showeverything"
> 
> 
> I would like to have all headings folded when I open the file (as it
> is now). Then I navigate to a heading of a person by using text
> search or arrow keys and TAB (to expand hierarchies). 

Hi,

an imperfect solution that might work for you anyway is to create a local version
of `org-cycle-hook' and remove `org-cycle-hide-drawers' from the value of this
variable.  This is imperfect because org-cycle-hide-drawers is also called
sometimes explicitly, for example after moving a subtree.  But it will cause
drawers to stay open after TAB.

To try this, make the following line the first line of your file:

# -*- mode: org; org-cycle-hook: (org-cycle-hide-archived-subtrees org-cycle-hide-inline-tasks org-cycle-show-empty-lines org-optimize-window-after-visibility-change) -*-

Then kill the buffer and visit it again.  Check the value of `org-cycle-hook' with `C-h v', you should see that the variable has a local value in this buffer.

If you then press TAB twice on"Peter", the drawer will be open.

Hope this helps.

- Carsten


> 
> On the heading of the "target" person, I want TAB to expand also the
> properties drawer, not only the content of the heading with
> properties collapsed.
> 
> 
> Example:
> 
> I start with contacts.org like this:
> 
>    * job
>    * family
> 
> I go to "job" and expand using TAB:
> 
>    * job
>      * Bob
>      * Peter
>      * Susan
>    * family
> 
> After that, I navigate to "Peter" and press TAB once again to expand
> the heading of Peter *and* its property drawer all together (only
> for "Peter"):
> 
>    * job
>      * Bob
>      * Peter
>        :PROPERTIES:
>        :EMAIL: peter@example.com
>        :COMPANY: Acme
>        :ADDRESS: Hiscity, hisstreet 42
>        :END:
> 
>        - met him at conference XY in 2009
>        - works in the field of foobar
> 
>      * Susan
>    * family
> 
> 
> The desired difference to my current situation is, that I do not
> have to navigate on the PROPERTY line and press TAB to open the
> drawer for email, company name, address, and so forth.
> 
> 
> Usual behavior: PROPERTY drawer stays collapsed when its
> corresponding heading gets expanded.
> 
> My wish: PROPERTY drawer gets collapsed when its corresponding
> heading gets expanded.
> 
> 
> I know that this is a very specific requirement and it spares me
> only one positioning effort followed by TAB. However, for contacts
> it would eliminate one annoyance for my work flow :-)
> 
> Thanks for your comments, thoughts, tipps!
> 
> 
> -- 
> mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
>> get Memacs from https://github.com/novoid/Memacs <
> 
> https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
> 
> 

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

* Re: Expanded property drawers as per file option
  2013-06-01  6:13         ` Carsten Dominik
@ 2013-06-01 16:30           ` Karl Voit
  0 siblings, 0 replies; 9+ messages in thread
From: Karl Voit @ 2013-06-01 16:30 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten!

* Carsten Dominik <carsten.dominik@gmail.com> wrote:
>
> On 29.5.2013, at 22:09, Karl Voit <devnull@Karl-Voit.at> wrote:
>> 
>> I would like to have all headings folded when I open the file (as it
>> is now). Then I navigate to a heading of a person by using text
>> search or arrow keys and TAB (to expand hierarchies). 
>
> To try this, make the following line the first line of your file:
>
> # -*- mode: org; org-cycle-hook: (org-cycle-hide-archived-subtrees org-cycle-hide-inline-tasks org-cycle-show-empty-lines org-optimize-window-after-visibility-change) -*-
>
> Then kill the buffer and visit it again.  Check the value of `org-cycle-hook' with `C-h v', you should see that the variable has a local value in this buffer.
>
> If you then press TAB twice on"Peter", the drawer will be open.

Yes, this works as described. Imperfect but it fixes my issue with
reasonable effort and functionality.

And I also learned that I can "overwrite" functions with local file
definitions. Quite handy.

Vielen Dank und einen schönen Gruß aus der schönen Steiermark!

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

end of thread, other threads:[~2013-06-01 16:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 14:21 Expanded property drawers as per file option Karl Voit
2013-05-28 14:40 ` Thorsten Jolitz
2013-05-28 14:45 ` Thorsten Jolitz
2013-05-28 14:58   ` Thorsten Jolitz
2013-05-29  4:31     ` Feng Shu
2013-05-29 20:09       ` Karl Voit
2013-05-29 22:32         ` Thorsten Jolitz
2013-06-01  6:13         ` Carsten Dominik
2013-06-01 16:30           ` Karl Voit

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