1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

Make org-get-limited-outline-regexp usable outside of org.

This allows org-narrow-to-subtree to function in Outline mode.

* lisp/org-macs.el (org-get-limited-outline-regexp): Use
  outline-regexp instead of org-outline-regexp when not in Org mode.
This commit is contained in:
Nicolas Richard 2014-07-22 18:29:00 +02:00 committed by Bastien Guerry
parent 2cd70ef915
commit 3d7a9f8517

View File

@ -352,11 +352,16 @@ point nowhere."
(defun org-get-limited-outline-regexp ()
"Return outline-regexp with limited number of levels.
The number of levels is controlled by `org-inlinetask-min-level'"
(if (or (not (derived-mode-p 'org-mode)) (not (featurep 'org-inlinetask)))
org-outline-regexp
(let* ((limit-level (1- org-inlinetask-min-level))
(nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
(format "\\*\\{1,%d\\} " nstars))))
(cond ((not (derived-mode-p 'org-mode))
outline-regexp)
((not (featurep 'org-inlinetask))
org-outline-regexp)
(t
(let* ((limit-level (1- org-inlinetask-min-level))
(nstars (if org-odd-levels-only
(1- (* limit-level 2))
limit-level)))
(format "\\*\\{1,%d\\} " nstars)))))
(defun org-format-seconds (string seconds)
"Compatibility function replacing format-seconds."