forked from mirrors/org-mode
ob-tangle: Fix `org-babel-under-commented-heading-p'
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): `org-comment-string' is case sensitive and cannot be attached to other text.
This commit is contained in:
parent
ee8d564479
commit
7ae45b5331
|
@ -359,12 +359,17 @@ that the appropriate major-mode is set. SPEC has the form:
|
||||||
|
|
||||||
(defvar org-comment-string) ;; Defined in org.el
|
(defvar org-comment-string) ;; Defined in org.el
|
||||||
(defun org-babel-under-commented-heading-p ()
|
(defun org-babel-under-commented-heading-p ()
|
||||||
"Return t if currently under a commented heading."
|
"Non-nil if point is under a commented heading.
|
||||||
(unless (org-before-first-heading-p)
|
This function also checks ancestors of the current headline, if
|
||||||
(if (let ((hd (nth 4 (org-heading-components))))
|
any."
|
||||||
(and hd (string-match (concat "^" org-comment-string) hd)))
|
(cond
|
||||||
t
|
((org-before-first-heading-p) nil)
|
||||||
(save-excursion
|
((let ((headline (nth 4 (org-heading-components))))
|
||||||
|
(and headline
|
||||||
|
(let ((case-fold-search nil))
|
||||||
|
(org-string-match-p (concat "^" org-comment-string "\\(?: \\|$\\)")
|
||||||
|
headline)))))
|
||||||
|
(t (save-excursion
|
||||||
(and (org-up-heading-safe)
|
(and (org-up-heading-safe)
|
||||||
(org-babel-under-commented-heading-p))))))
|
(org-babel-under-commented-heading-p))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue