diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-03-15 15:32:59 +0100 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2014-03-15 19:40:08 -0600 |
commit | 7ae45b533194be81496251a3548d367b0d03e2f1 (patch) | |
tree | 5219ea88892fe27855f4c1ca58dc7f1485064c6d | |
parent | ee8d56447925d22e836e463e7c75e5154ac09369 (diff) | |
download | org-mode-7ae45b533194be81496251a3548d367b0d03e2f1.tar.gz |
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.
-rw-r--r-- | lisp/ob-tangle.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 2910d7f..bf67410 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -359,12 +359,17 @@ that the appropriate major-mode is set. SPEC has the form: (defvar org-comment-string) ;; Defined in org.el (defun org-babel-under-commented-heading-p () - "Return t if currently under a commented heading." - (unless (org-before-first-heading-p) - (if (let ((hd (nth 4 (org-heading-components)))) - (and hd (string-match (concat "^" org-comment-string) hd))) - t - (save-excursion + "Non-nil if point is under a commented heading. +This function also checks ancestors of the current headline, if +any." + (cond + ((org-before-first-heading-p) nil) + ((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) (org-babel-under-commented-heading-p)))))) |