emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Vitaly <jauthu@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Fwd: request of numeric arguments handling by +STARTUP: content
Date: Sun, 24 Feb 2013 09:18:49 +0100	[thread overview]
Message-ID: <87wqtyazva.fsf@bzg.ath.cx> (raw)
In-Reply-To: <CAADtcTu7EqK38+jfXZQpCbYU63JQvAooL8=odbn8CyGB6Oo0mw@mail.gmail.com> (Vitaly's message of "Sun, 24 Feb 2013 09:01:32 +0300")

[-- 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

      reply	other threads:[~2013-02-24  8:18 UTC|newest]

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87wqtyazva.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jauthu@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 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).