emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* request of numeric arguments handling by +STARTUP: content
@ 2013-02-24  5:55 Vitaly
  2013-02-24  6:01 ` Fwd: " Vitaly
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly @ 2013-02-24  5:55 UTC (permalink / raw)
  To: emacs-orgmode

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

I want to have CONTENTS showing headlines up to particular level N when
open file. I couldn't find such a thing in docs and VISIBILITY can't be
used since it takes no arguments too, so having multiple VISIBILITY
properties in every top-level headline is a bit stupid, not saying that it
can not solve the problem fully, because it also doesn't take argument for
"children" or "content".

Why not handling this somewhere in "+STARTUP: content N" or anywhere
similar? Since org-mode handles arguments for org-global-cycle, why not
handle them on startup?

I managed to get this behavior simply by calling the (org-global-cycle N)
in find-file-hook, but this is somewhat dirty.

Regards, Vitaly

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

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

* Fwd: request of numeric arguments handling by +STARTUP: content
  2013-02-24  5:55 request of numeric arguments handling by +STARTUP: content Vitaly
@ 2013-02-24  6:01 ` Vitaly
  2013-02-24  8:18   ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly @ 2013-02-24  6:01 UTC (permalink / raw)
  To: emacs-orgmode

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

I want to have CONTENTS showing headlines up to particular level N when
open file. I couldn't find such a thing in docs and VISIBILITY can't be
used since it takes no arguments too, so having multiple VISIBILITY
properties in every top-level headline is a bit stupid, not saying that it
can not solve the problem fully, because it also doesn't take argument for
"children" or "content".

Why not handling this somewhere in "+STARTUP: content N" or anywhere
similar? Since org-mode handles arguments for org-global-cycle, why not
handle them on startup?

I managed to get this behavior simply by calling the (org-global-cycle N)
in find-file-hook, but this is somewhat dirty.

Regards, Vitaly

// Sorry if this is duplicate. I tried to send it being not subscribed
before.

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

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

* Re: Fwd: request of numeric arguments handling by +STARTUP: content
  2013-02-24  6:01 ` Fwd: " Vitaly
@ 2013-02-24  8:18   ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2013-02-24  8:18 UTC (permalink / raw)
  To: Vitaly; +Cc: emacs-orgmode

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

Hi Vitaly,

Vitaly <jauthu@gmail.com> writes:

> Why not handling this somewhere in "+STARTUP: content N" or anywhere
> similar? Since org-mode handles arguments for org-global-cycle, why
> not handle them on startup?

The following patch handle content-2 and content-3 keywords, and allow
`org-startup-folded' to be set to an integer.

I don't like content-1 content-2, this is dirty.

But maybe we can simply allow integers for `org-startup-folded' and
then the user could `org-startup-folded' as a local variable.

Let me know what you think,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-startup-level.patch --]
[-- Type: text/x-patch, Size: 1716 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 1e22699..d446b66 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -587,6 +587,8 @@ the following lines anywhere in the buffer:
    #+STARTUP: fold              (or `overview', this is equivalent)
    #+STARTUP: nofold            (or `showall', this is equivalent)
    #+STARTUP: content
+   #+STARTUP: content-2         (up to headlines of level 2)
+   #+STARTUP: content-3         (up to headlines of level 3)
    #+STARTUP: showeverything
 
 By default, this option is ignored when Org opens agenda files
@@ -597,6 +599,7 @@ option, set `org-agenda-inhibit-startup' to nil."
 	  (const :tag "nofold: show all" nil)
 	  (const :tag "fold: overview" t)
 	  (const :tag "content: all headlines" content)
+	  (integerp :tag "content: all headlines up to N level" 2)
 	  (const :tag "show everything, even drawers" showeverything)))
 
 (defcustom org-startup-truncated t
@@ -4632,6 +4635,8 @@ After a match, the following groups carry important information:
     ("showall" org-startup-folded nil)
     ("showeverything" org-startup-folded showeverything)
     ("content" org-startup-folded content)
+    ("content-2" org-startup-folded 2)
+    ("content-3" org-startup-folded 3)
     ("indent" org-startup-indented t)
     ("noindent" org-startup-indented nil)
     ("hidestars" org-hide-leading-stars t)
@@ -6660,6 +6665,8 @@ With a numeric prefix, show all headlines up to that level."
   (cond
    ((eq org-startup-folded t)
     (org-cycle '(4)))
+   ((integerp org-startup-folded)
+    (org-global-cycle org-startup-folded))
    ((eq org-startup-folded 'content)
     (let ((this-command 'org-cycle) (last-command 'org-cycle))
       (org-cycle '(4)) (org-cycle '(4)))))

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

end of thread, other threads:[~2013-02-24  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24  5:55 request of numeric arguments handling by +STARTUP: content Vitaly
2013-02-24  6:01 ` Fwd: " Vitaly
2013-02-24  8:18   ` Bastien

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