diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-12-11 17:42:53 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-12-11 17:42:53 +0100 |
commit | acedf35ce08b9df4a0dcbcd1413e7d85f1182034 (patch) | |
tree | 240e26f10d2feb66e8c0cd0634082fcb7bd577e5 /lisp/org/org-indent.el | |
parent | 39321b94bfa4e50401e30caedfd09a06629f5bd2 (diff) | |
download | emacs-acedf35ce08b9df4a0dcbcd1413e7d85f1182034.tar.gz emacs-acedf35ce08b9df4a0dcbcd1413e7d85f1182034.tar.bz2 emacs-acedf35ce08b9df4a0dcbcd1413e7d85f1182034.zip |
Update to Org mode 7.4
Diffstat (limited to 'lisp/org/org-indent.el')
-rw-r--r-- | lisp/org/org-indent.el | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 39ba445eb93..a177a6f2a04 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.3 +;; Version: 7.4 ;; ;; This file is part of GNU Emacs. ;; @@ -38,6 +38,10 @@ (eval-when-compile (require 'cl)) +(defvar org-inlinetask-min-level) +(declare-function org-inlinetask-get-task-level "org-inlinetask" ()) +(declare-function org-inlinetask-in-task-p "org-inlinetask" ()) + (defgroup org-indent nil "Options concerning dynamic virtual outline indentation." :tag "Org Indent" @@ -219,35 +223,49 @@ useful to make it ever so slightly different." (defun org-indent-add-properties (beg end) "Add indentation properties between BEG and END. Assumes that BEG is at the beginning of a line." - (when (or t org-indent-mode) - (let ((inhibit-modification-hooks t) - ov b e n level exit nstars) - (with-silent-modifications - (save-excursion - (goto-char beg) - (while (not exit) - (setq e end) - (if (not (re-search-forward org-indent-outline-re nil t)) - (setq e (point-max) exit t) - (setq e (match-beginning 0)) - (if (>= e end) (setq exit t)) - (setq level (- (match-end 0) (match-beginning 0) 1)) - (setq nstars (- (* (1- level) org-indent-indentation-per-level) - (1- level))) - (add-text-properties - (point-at-bol) (point-at-eol) - (list 'line-prefix - (aref org-indent-stars nstars) - 'wrap-prefix - (aref org-indent-strings - (* level org-indent-indentation-per-level))))) - (when (and b (> e b)) - (add-text-properties - b e (list 'line-prefix (aref org-indent-strings n) - 'wrap-prefix (aref org-indent-strings n)))) - (setq b (1+ (point-at-eol)) - n (* (or level 0) org-indent-indentation-per-level)))))))) + (let* ((inhibit-modification-hooks t) + (inlinetaskp (featurep 'org-inlinetask)) + (get-real-level (lambda (pos lvl) + (save-excursion + (goto-char pos) + (if (and inlinetaskp (org-inlinetask-in-task-p)) + (org-inlinetask-get-task-level) + lvl)))) + (b beg) + (e end) + (level 0) + (n 0) + exit nstars) + (with-silent-modifications + (save-excursion + (goto-char beg) + (while (not exit) + (setq e end) + (if (not (re-search-forward org-indent-outline-re nil t)) + (setq e (point-max) exit t) + (setq e (match-beginning 0)) + (if (>= e end) (setq exit t)) + (unless (and inlinetaskp (org-inlinetask-in-task-p)) + (setq level (- (match-end 0) (match-beginning 0) 1))) + (setq nstars (* (1- (funcall get-real-level e level)) + (1- org-indent-indentation-per-level))) + (add-text-properties + (point-at-bol) (point-at-eol) + (list 'line-prefix + (aref org-indent-stars nstars) + 'wrap-prefix + (aref org-indent-strings + (* (funcall get-real-level e level) + org-indent-indentation-per-level))))) + (when (> e b) + (add-text-properties + b e (list 'line-prefix (aref org-indent-strings n) + 'wrap-prefix (aref org-indent-strings n)))) + (setq b (1+ (point-at-eol)) + n (* (funcall get-real-level b level) + org-indent-indentation-per-level))))))) +(defvar org-inlinetask-min-level) (defun org-indent-refresh-section () "Refresh indentation properties in the current outline section. Point is assumed to be at the beginning of a headline." @@ -255,7 +273,11 @@ Point is assumed to be at the beginning of a headline." (when org-indent-mode (let (beg end) (save-excursion - (when (ignore-errors (org-back-to-heading)) + (when (ignore-errors (let ((outline-regexp (format "\\*\\{1,%s\\}[ \t]+" + (if (featurep 'org-inlinetask) + (1- org-inlinetask-min-level) + "")))) + (org-back-to-heading))) (setq beg (point)) (setq end (or (save-excursion (or (outline-next-heading) (point))))) (org-indent-remove-properties beg end) @@ -268,7 +290,11 @@ Point is assumed to be at the beginning of a headline." (when org-indent-mode (let ((beg (point)) (end limit)) (save-excursion - (and (ignore-errors (org-back-to-heading t)) + (and (ignore-errors (let ((outline-regexp (format "\\*\\{1,%s\\}[ \t]+" + (if (featurep 'org-inlinetask) + (1- org-inlinetask-min-level) + "")))) + (org-back-to-heading))) (setq beg (point)))) (org-indent-remove-properties beg end) (org-indent-add-properties beg end))) |