From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Fwd: request of numeric arguments handling by +STARTUP: content Date: Sun, 24 Feb 2013 09:18:49 +0100 Message-ID: <87wqtyazva.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9WnO-0005GL-PR for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 03:18:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9WnN-0003XB-Fi for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 03:18:54 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:62947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9WnN-0003X1-9g for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 03:18:53 -0500 Received: by mail-wi0-f175.google.com with SMTP id l13so2327171wie.2 for ; Sun, 24 Feb 2013 00:18:52 -0800 (PST) In-Reply-To: (Vitaly's message of "Sun, 24 Feb 2013 09:01:32 +0300") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Vitaly Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Vitaly, Vitaly 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, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-startup-level.patch 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))))) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--