comparison lisp/org/org-inlinetask.el @ 111506:5cb272c831e8

Install org-mode version 7.3
author Carsten Dominik <carsten.dominik@gmail.com>
date Thu, 11 Nov 2010 22:10:19 -0600
parents a150e8a14679
children a7740098b594
comparison
equal deleted inserted replaced
111505:62aa3653746a 111506:5cb272c831e8
3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. 3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
4 ;; 4 ;;
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> 5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Keywords: outlines, hypermedia, calendar, wp 6 ;; Keywords: outlines, hypermedia, calendar, wp
7 ;; Homepage: http://orgmode.org 7 ;; Homepage: http://orgmode.org
8 ;; Version: 7.01 8 ;; Version: 7.3
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify 12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 13
88 It is strongly recommended that you set `org-cycle-max-level' not at all, 88 It is strongly recommended that you set `org-cycle-max-level' not at all,
89 or to a number smaller than this one. In fact, when `org-cycle-max-level' is 89 or to a number smaller than this one. In fact, when `org-cycle-max-level' is
90 not set, it will be assumed to be one less than the value of smaller than 90 not set, it will be assumed to be one less than the value of smaller than
91 the value of this variable." 91 the value of this variable."
92 :group 'org-inlinetask 92 :group 'org-inlinetask
93 :type 'boolean) 93 :type '(choice
94 (const :tag "Off" nil)
95 (integer)))
94 96
95 (defcustom org-inlinetask-export t 97 (defcustom org-inlinetask-export t
96 "Non-nil means export inline tasks. 98 "Non-nil means export inline tasks.
97 When nil, they will not be exported." 99 When nil, they will not be exported."
98 :group 'org-inlinetask 100 :group 'org-inlinetask
102 (defvar org-keyword-time-regexp) 104 (defvar org-keyword-time-regexp)
103 (defvar org-drawer-regexp) 105 (defvar org-drawer-regexp)
104 (defvar org-complex-heading-regexp) 106 (defvar org-complex-heading-regexp)
105 (defvar org-property-end-re) 107 (defvar org-property-end-re)
106 108
107 (defcustom org-inlinetask-defaut-state nil 109 (defcustom org-inlinetask-default-state nil
108 "Non-nil means make inline tasks have a TODO keyword initially. 110 "Non-nil means make inline tasks have a TODO keyword initially.
109 This should be the state `org-inlinetask-insert-task' should use by 111 This should be the state `org-inlinetask-insert-task' should use by
110 default, or nil of no state should be assigned." 112 default, or nil of no state should be assigned."
111 :group 'org-inlinetask 113 :group 'org-inlinetask
112 :type '(choice 114 :type '(choice
113 (const :tag "No state" nil) 115 (const :tag "No state" nil)
114 (string :tag "Specific state"))) 116 (string :tag "Specific state")))
115 117
116 (defun org-inlinetask-insert-task (&optional no-state) 118 (defun org-inlinetask-insert-task (&optional no-state)
117 "Insert an inline task. 119 "Insert an inline task.
118 If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'." 120 If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'."
119 (interactive "P") 121 (interactive "P")
120 (or (bolp) (newline)) 122 (or (bolp) (newline))
121 (let ((indent org-inlinetask-min-level)) 123 (let ((indent org-inlinetask-min-level))
122 (if org-odd-levels-only 124 (if org-odd-levels-only
123 (setq indent (- (* 2 indent) 1))) 125 (setq indent (- (* 2 indent) 1)))
124 (insert (make-string indent ?*) 126 (insert (make-string indent ?*)
125 (if (or no-state (not org-inlinetask-defaut-state)) 127 (if (or no-state (not org-inlinetask-default-state))
126 " \n" 128 " \n"
127 (concat " " org-inlinetask-defaut-state " \n")) 129 (concat " " org-inlinetask-default-state " \n"))
128 (make-string indent ?*) " END\n")) 130 (make-string indent ?*) " END\n"))
129 (end-of-line -1)) 131 (end-of-line -1))
130 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) 132 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
133
134 (defun org-inlinetask-in-task-p ()
135 "Return true if point is inside an inline task."
136 (save-excursion
137 (let* ((nstars (if org-odd-levels-only
138 (1- (* 2 (or org-inlinetask-min-level 200)))
139 (or org-inlinetask-min-level 200)))
140 (stars-re (concat "^\\(?:\\*\\{"
141 (format "%d" (- nstars 1))
142 ",\\}\\)[ \t]+"))
143 (task-beg-re (concat stars-re "\\(?:.*\\)"))
144 (task-end-re (concat stars-re "\\(?:END\\|end\\)")))
145 (beginning-of-line)
146 (or (looking-at task-beg-re)
147 (and (re-search-forward "^\\*+[ \t]+" nil t)
148 (progn (beginning-of-line) (looking-at task-end-re)))))))
131 149
132 (defvar htmlp) ; dynamically scoped into the next function 150 (defvar htmlp) ; dynamically scoped into the next function
133 (defvar latexp) ; dynamically scoped into the next function 151 (defvar latexp) ; dynamically scoped into the next function
134 (defun org-inlinetask-export-handler () 152 (defun org-inlinetask-export-handler ()
135 "Handle headlines with level larger or equal to `org-inlinetask-min-level'. 153 "Handle headlines with level larger or equal to `org-inlinetask-min-level'.