Ver Fonte

Fix arg handling for org-contents

When odd levels are being used, change the interpretation of a
numerical arg to S-TAB.

Michael Brand writes:

> I like the org-indent-mode with the soft-indentation but even more I
> like the hard-indentation with `#+STARTUP: odd hidestars' instead for
> which I have a question.
>
> This is the content of the example file oddeven:
> -*- mode: org -*-
> #+STARTUP: oddeven hidestars content
> * 1 Org Mode
> ** 1.1 Introduction
> *** 1.1.1 Installation
>
> This is the content of the example file odd:
> -*- mode: org -*-
> #+STARTUP: odd hidestars content
> * 1 Org Mode
> *** 1.1 Introduction
> ***** 1.1.1 Installation
>
> The different _Emacs-faces_ (colors) for the heading levels are the same
> when comparing the two files. This Emacs-internal adaptation I
> appreciate a lot.
>
> C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_ with
> the file odd. Is this how it is intended to work for the file odd?
Carsten Dominik há 15 anos atrás
pai
commit
c1524ad9fa
2 ficheiros alterados com 9 adições e 3 exclusões
  1. 5 0
      lisp/ChangeLog
  2. 4 3
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-09-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-shifttab): Interpret arg differently when using only
+	odd levels.
+
 2009-09-09  Bastien Guerry  <bzg@altern.org>
 
 	* org.el (org-check-agenda-file): Use a more explicit message

+ 4 - 3
lisp/org.el

@@ -14617,9 +14617,10 @@ See the individual commands for more information."
   (cond
    ((org-at-table-p) (call-interactively 'org-table-previous-field))
    ((integerp arg)
-    (message "Content view to level: %d" arg)
-    (org-content (prefix-numeric-value arg))
-    (setq org-cycle-global-status 'overview))
+    (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg)))
+      (message "Content view to level: %d" arg)
+      (org-content (prefix-numeric-value arg2))
+      (setq org-cycle-global-status 'overview)))
    (t (call-interactively 'org-global-cycle))))
 
 (defun org-shiftmetaleft ()