[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [bug] canonical context not work in 8.3

From: Nicolas Goaziou
Subject: Re: [O] [bug] canonical context not work in 8.3
Date: Mon, 10 Aug 2015 23:39:58 +0200

Samuel Wales <address@hidden> writes:

> On 8/10/15, Nicolas Goaziou <address@hidden> wrote:
>> I pushed the new function to code base. However, due to the nature of
>> the change, it landed in master. So it will be available in Org 8.4.
> thank you.  will it work in 8.3 (maint) if i load it after loading
> org?

If you don't plan to use "outline.el", you can override `show-children'
with the following:

--8<---------------cut here---------------start------------->8---
(defun show-children (&optional level)
  "Show all direct subheadings of this heading.
Prefix arg LEVEL is how many levels below the current level should be shown.
Default is enough to cause the following heading to appear."
    (org-back-to-heading t)
    (let* ((current-level (funcall outline-level))
           (max-level (org-get-valid-level
                       current-level (if level (prefix-numeric-value level) 1)))
           (end (save-excursion (org-end-of-subtree t t)))
           (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)")
           (past-first-child nil)
           ;; Make sure to skip inlinetasks.
           (re (format regexp-fmt
                        ((not (featurep 'org-inlinetask)) "")
                        (org-odd-levels-only (- (* 2 org-inlinetask-min-level)
                        (t (1- org-inlinetask-min-level))))))
      ;; Display parent heading.
      (outline-flag-region (line-end-position 0) (line-end-position) nil)
      ;; Display children.  First child may be deeper than expected
      ;; MAX-LEVEL.  Since we want to display it anyway, adjust
      ;; MAX-LEVEL accordingly.
      (while (re-search-forward re end t)
        (unless past-first-child
          (setq re (format regexp-fmt
                           (max (funcall outline-level) max-level)))
          (setq past-first-child t))
        (outline-flag-region (line-end-position 0) (line-end-position) nil)))))
--8<---------------cut here---------------end--------------->8---

However, the patch that landed in master implements `org-show-children'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]