summaryrefslogtreecommitdiff
path: root/lisp/org/org-inlinetask.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org/org-inlinetask.el')
-rw-r--r--lisp/org/org-inlinetask.el87
1 files changed, 65 insertions, 22 deletions
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index cd378bc8bcd..d4be908c5ed 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.31a
+;; Version: 6.33
;; This file is part of GNU Emacs.
@@ -35,7 +35,7 @@
;;
;; Visibility cycling exempts these nodes from cycling. So whenever their
;; parent is opened, so are these tasks. This will only work with
-;; `org-cycle', so if you are also using orther commands to show/hide
+;; `org-cycle', so if you are also using other commands to show/hide
;; entries, you will occasionally find these tasks to behave like
;; all other outline nodes, seemingly splitting the text of the parent
;; into children.
@@ -70,7 +70,7 @@
;; Also, if you want to use refiling and archiving for inline tasks,
;; The END line must be present to make things work properly.
;;
-;; This package installs one new comand:
+;; This package installs one new command:
;;
;; C-c C-x t Insert a new inline task with END line
@@ -93,6 +93,12 @@ the value of this variable."
:group 'org-inlinetask
:type 'boolean)
+(defcustom org-inlinetask-export t
+ "Non-nil means, export inline tasks.
+When nil, they will not be exported."
+ :group 'org-inlinetask
+ :type 'boolean)
+
(defvar org-odd-levels-only)
(defvar org-keyword-time-regexp)
(defvar org-drawer-regexp)
@@ -139,24 +145,42 @@ Either remove headline and meta data, or do special formatting."
(setq content (buffer-substring beg (1- (point-at-bol))))
(delete-region beg (1+ (match-end 0))))
(goto-char beg)
- (when (string-match org-complex-heading-regexp headline)
- (setq headline (concat
- (if (match-end 2)
- (concat (match-string 2 headline) " ") "")
- (match-string 4 headline)))
- (if (not (string-match "\\S-" content))
- (setq content nil)
- (if (string-match "[ \t\n]+\\'" content)
- (setq content (substring content 0 (match-beginning 0))))
- (setq content (org-remove-indentation content))
- (if latexp (setq content (concat "\\quad \\\\\n" content))))
- (insert "- ")
- (setq indent (make-string (current-column) ?\ ))
- (insert headline " ::")
- (when content
- (insert (if htmlp " " (concat "\n" indent))
- (mapconcat 'identity (org-split-string content "\n")
- (concat "\n" indent)) "\n"))))))
+ (when org-inlinetask-export
+ (when (string-match org-complex-heading-regexp headline)
+ (setq headline (concat
+ (if (match-end 2)
+ (concat (match-string 2 headline) " ") "")
+ (match-string 4 headline)))
+ (when content
+ (if (not (string-match "\\S-" content))
+ (setq content nil)
+ (if (string-match "[ \t\n]+\\'" content)
+ (setq content (substring content 0 (match-beginning 0))))
+ (setq content (org-remove-indentation content))
+ (if latexp (setq content (concat "\\quad \\\\\n" content)))))
+ (insert (make-string (org-inlinetask-get-current-indentation) ?\ )
+ "- ")
+ (setq indent (make-string (current-column) ?\ ))
+ (insert headline " ::")
+ (if content
+ (insert (if htmlp " " (concat "\n" indent))
+ (mapconcat 'identity (org-split-string content "\n")
+ (concat "\n" indent)) "\n")
+ (insert "\n"))
+ (insert indent)
+ (backward-delete-char 2)
+ (insert "THISISTHEINLINELISTTEMINATOR\n"))))))
+
+(defun org-inlinetask-get-current-indentation ()
+ "Get the indentation of the last non-while line above this one."
+ (save-excursion
+ (beginning-of-line 1)
+ (skip-chars-backward " \t\n")
+ (beginning-of-line 1)
+ (or (org-at-item-p)
+ (looking-at "[ \t]*"))
+ (goto-char (match-end 0))
+ (current-column)))
(defun org-inlinetask-fontify (limit)
"Fontify the inline tasks."
@@ -180,13 +204,32 @@ Either remove headline and meta data, or do special formatting."
org-inlinetask-min-level))
(replace-match "")))
+(defun org-inlinetask-remove-terminator ()
+ (let (beg end)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "THISISTHEINLINELISTTEMINATOR\n" nil t)
+ (setq beg (match-beginning 0) end (match-end 0))
+ (save-excursion
+ (beginning-of-line 1)
+ (and (looking-at "<p\\(ara\\)?>THISISTHEINLINELISTTEMINATOR[ \t\n]*</p\\(ara\\)?>")
+ (setq beg (point) end (match-end 0))))
+ (delete-region beg end)))))
+
(eval-after-load "org-exp"
'(add-hook 'org-export-preprocess-after-tree-selection-hook
'org-inlinetask-export-handler))
(eval-after-load "org"
'(add-hook 'org-font-lock-hook 'org-inlinetask-fontify))
+(eval-after-load "org-html"
+ '(add-hook 'org-export-html-final-hook 'org-inlinetask-remove-terminator))
+(eval-after-load "org-latex"
+ '(add-hook 'org-export-latex-final-hook 'org-inlinetask-remove-terminator))
+(eval-after-load "org-ascii"
+ '(add-hook 'org-export-ascii-final-hook 'org-inlinetask-remove-terminator))
+(eval-after-load "org-docbook"
+ '(add-hook 'org-export-docbook-final-hook 'org-inlinetask-remove-terminator))
(provide 'org-inlinetask)
-;; arch-tag: b0974e46-1d51-49d5-8bda-737617019a1b
;;; org-inlinetask.el ends here