summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2011-03-19 07:42:30 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2011-03-19 07:42:30 +0100
commitbd089631fcae40b769564c612331028b2e15e40d (patch)
tree7db2d5871345be4c5fde6fc64f083f623efde873
parent622599ca07c9b5d0e2b63b8af1e3fbe6726b6784 (diff)
parent1bd87fb09fece5c558d639036246bd70b3d76aa4 (diff)
downloadorg-mode-bd089631fcae40b769564c612331028b2e15e40d.tar.gz
Merge branch 'master' of orgmode.org:org-mode
-rw-r--r--contrib/README1
-rw-r--r--contrib/lisp/org-contacts.el477
-rw-r--r--contrib/lisp/org-export-generic.el2
-rw-r--r--lisp/org-agenda.el6
-rw-r--r--lisp/org-clock.el11
-rw-r--r--lisp/org-colview.el13
-rw-r--r--lisp/org-docbook.el2
-rw-r--r--lisp/org-footnote.el25
-rw-r--r--lisp/org-html.el30
-rw-r--r--lisp/org-latex.el3
-rw-r--r--lisp/org-list.el63
-rw-r--r--lisp/org-taskjuggler.el170
-rw-r--r--lisp/org.el6
13 files changed, 680 insertions, 129 deletions
diff --git a/contrib/README b/contrib/README
index 9772c50..c076c89 100644
--- a/contrib/README
+++ b/contrib/README
@@ -16,6 +16,7 @@ org-bookmark.el --- Links to bookmarks
org-checklist.el --- org functions for checklist handling
org-choose.el --- Use TODO keywords to mark decision states
org-collector.el --- Collect properties into tables
+org-contacts --- Contacts management
org-contribdir.el --- Dummy file to mark the org contrib Lisp directory
org-depend.el --- TODO dependencies for Org-mode
org-drill.el --- Self-testing with org-learn
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
new file mode 100644
index 0000000..86b1741
--- /dev/null
+++ b/contrib/lisp/org-contacts.el
@@ -0,0 +1,477 @@
+;;; org-contacts.el --- Contacts management
+
+;; Copyright (C) 2010, 2011 Julien Danjou <julien@danjou.info>
+
+;; Author: Julien Danjou <julien@danjou.info>
+;; Keywords: outlines, hypermedia, calendar
+;;
+;; This file is NOT part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file contains the code for managing your contacts into Org-mode.
+
+;; To enter new contacts, you can use `org-capture' and a template just like
+;; this:
+
+;; ("c" "Contacts" entry (file "~/Org/contacts.org")
+;; "* %(org-contacts-template-name)
+;; :PROPERTIES:
+;; :EMAIL: %(org-contacts-template-email)
+;; :END:")))
+;;
+;;; Code:
+
+(eval-and-compile
+ (require 'org)
+ (require 'gnus)
+ (require 'gnus-art))
+
+(defgroup org-contacts nil
+ "Options concerning contacts management."
+ :group 'org)
+
+(defcustom org-contacts-files nil
+ "List of Org files to use as contacts source.
+If set to nil, all your Org files will be used."
+ :type '(repeat file)
+ :group 'org-contacts)
+
+(defcustom org-contacts-email-property "EMAIL"
+ "Name of the property for contact email address."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-birthday-property "BIRTHDAY"
+ "Name of the property for contact birthday date."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-last-read-mail-property "LAST_READ_MAIL"
+ "Name of the property for contact last read email link storage."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-icon-property "ICON"
+ "Name of the property for contact icon."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-nickname-property "NICKNAME"
+ "Name of the property for IRC nickname match."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-icon-size 32
+ "Size of the contacts icons."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-icon-use-gravatar (fboundp 'gravatar-retrieve)
+ "Whether use Gravatar to fetch contact icons."
+ :type 'boolean
+ :group 'org-contacts)
+
+(defcustom org-contacts-completion-ignore-case t
+ "Ignore case when completing contacts."
+ :type 'boolean
+ :group 'org-contacts)
+
+(defcustom org-contacts-group-prefix "+"
+ "Group prefix."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-matcher (concat org-contacts-email-property "<>\"\"")
+ "Matching rule for finding heading that are contacts.
+This can be a tag name, or a property check."
+ :type 'string
+ :group 'org-contacts)
+
+(defcustom org-contacts-email-link-description-format "%s (%d)"
+ "Format used to store links to email.
+This overrides `org-email-link-description-format' if set."
+ :group 'org-contacts
+ :type 'string)
+
+(defvar org-contacts-keymap
+ (let ((map (make-sparse-keymap)))
+ (define-key map "M" 'org-contacts-view-send-email)
+ (define-key map "i" 'org-contacts-view-switch-to-irc-buffer)
+ map)
+ "The keymap used in `org-contacts' result list.")
+
+(defun org-contacts-files ()
+ "Return list of Org files to use for contact management."
+ (or org-contacts-files (org-agenda-files t 'ifmode)))
+
+(defun org-contacts-filter (&optional name-match tags-match)
+ "Search for a contact maching NAME-MATCH and TAGS-MATCH.
+If both match values are nil, return all contacts."
+ (let ((tags-matcher
+ (if tags-match
+ (cdr (org-make-tags-matcher tags-match))
+ t))
+ (name-matcher
+ (if name-match
+ '(org-string-match-p name-match (org-get-heading t))
+ t))
+ (contacts-matcher
+ (cdr (org-make-tags-matcher org-contacts-matcher)))
+ markers result)
+ (dolist (file (org-contacts-files))
+ (org-check-agenda-file file)
+ (with-current-buffer (org-get-agenda-file-buffer file)
+ (unless (org-mode-p)
+ (error "File %s is no in `org-mode'" file))
+ (org-scan-tags
+ '(add-to-list 'markers (set-marker (make-marker) (point)))
+ `(and ,contacts-matcher ,tags-matcher ,name-matcher))))
+ (dolist (marker markers result)
+ (org-with-point-at marker
+ (add-to-list 'result
+ (list (org-get-heading t) marker (org-entry-properties marker 'all)))))))
+
+(when (not (fboundp 'completion-table-case-fold))
+ ;; That function is new in Emacs 24...
+ (defun completion-table-case-fold (table string pred action)
+ (let ((completion-ignore-case t))
+ (complete-with-action action table string pred))))
+
+(defun org-contacts-complete-name (&optional start)
+ "Complete text at START with a user name and email."
+ (let* ((end (point))
+ (start (or start
+ (save-excursion
+ (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
+ (goto-char (match-end 0))
+ (point))))
+ (orig (buffer-substring start end))
+ (completion-ignore-case org-contacts-completion-ignore-case)
+ (group-completion-p (org-string-match-p (concat "^" org-contacts-group-prefix) orig))
+ (completion-list
+ (if group-completion-p
+ (mapcar (lambda (group) (propertize (concat org-contacts-group-prefix group) 'org-contacts-group group))
+ (org-uniquify
+ (loop for contact in (org-contacts-filter)
+ with group-list
+ nconc (org-split-string
+ (or (cdr (assoc-string "ALLTAGS" (caddr contact))) "") ":"))))
+ (loop for contact in (org-contacts-filter)
+ ;; The contact name is always the car of the assoc-list
+ ;; returned by `org-contacts-filter'.
+ for contact-name = (car contact)
+ ;; Build the list of the user email addresses.
+ for email-list = (split-string (or
+ (cdr (assoc-string org-contacts-email-property (caddr contact)))
+ ""))
+ ;; If the user has email addresses…
+ if email-list
+ ;; … append a list of USER <EMAIL>.
+ nconc (loop for email in email-list
+ collect (org-contacts-format-email contact-name email)))))
+ (completion-list (all-completions orig completion-list)))
+ ;; If we are completing a group, and that's the only group, just return
+ ;; the real result.
+ (when (and group-completion-p
+ (= (length completion-list) 1))
+ (setq completion-list
+ (list (concat (car completion-list) ";: "
+ (mapconcat 'identity
+ (loop for contact in (org-contacts-filter
+ nil
+ (get-text-property 0 'org-contacts-group (car completion-list)))
+ ;; The contact name is always the car of the assoc-list
+ ;; returned by `org-contacts-filter'.
+ for contact-name = (car contact)
+ ;; Grab the first email of the contact
+ for email = (car (split-string (or
+ (cdr (assoc-string org-contacts-email-property (caddr contact)))
+ "")))
+ ;; If the user has an email address, append USER <EMAIL>.
+ if email collect (org-contacts-format-email contact-name email))
+ ", ")))))
+ (list start end (if org-contacts-completion-ignore-case
+ (apply-partially #'completion-table-case-fold completion-list)
+ completion-list))))
+
+(defun org-contacts-message-complete-function ()
+ "Function used in `completion-at-point-functions' in `message-mode'."
+ (let ((mail-abbrev-mode-regexp
+ "^\\(Resent-To\\|To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\|Disposition-Notification-To\\|Return-Receipt-To\\):"))
+ (when (mail-abbrev-in-expansion-header-p)
+ (org-contacts-complete-name))))
+
+(add-hook 'message-mode-hook
+ (lambda ()
+ (add-to-list 'completion-at-point-functions
+ 'org-contacts-message-complete-function)))
+
+(defun org-contacts-gnus-get-name-email ()
+ "Get name and email address from Gnus message."
+ (gnus-with-article-headers
+ (mail-extract-address-components
+ (or (mail-fetch-field "From") ""))))
+
+(defun org-contacts-gnus-article-from-get-marker ()
+ "Return a marker for a contact based on From."
+ (let* ((address (org-contacts-gnus-get-name-email))
+ (name (car address))
+ (email (cadr address)))
+ (cadar (or (org-contacts-filter
+ nil
+ (concat org-contacts-email-property "={\\b" (regexp-quote email) "\\b}"))
+ (when name
+ (org-contacts-filter
+ (concat "^" name "$")))))))
+
+(defun org-contacts-gnus-article-from-goto ()
+ "Go to contact in the From address of current Gnus message."
+ (interactive)
+ (let ((marker (org-contacts-gnus-article-from-get-marker)))
+ (when marker
+ (switch-to-buffer-other-window (marker-buffer marker))
+ (goto-char marker)
+ (when (org-mode-p)
+ (org-show-context 'agenda)
+ (save-excursion
+ (and (outline-next-heading)
+ ;; show the next heading
+ (org-flag-heading nil)))))))
+
+(define-key gnus-summary-mode-map ";" 'org-contacts-gnus-article-from-goto)
+
+(defun org-contacts-anniversaries (&optional field format)
+ "Compute FIELD anniversary for each contact, returning FORMAT.
+Default FIELD value is \"BIRTHDAY\".
+
+Format is a string matching the following format specification:
+
+ %h - Heading name
+ %l - Link to the heading
+ %y - Number of year
+ %Y - Number of year (ordinal)"
+ (let ((calendar-date-style 'american)
+ (entry ""))
+ (loop for contact in (org-contacts-filter)
+ for anniv = (let ((anniv (cdr (assoc-string
+ (or field org-contacts-birthday-property)
+ (caddr contact)))))
+ (when anniv
+ (calendar-gregorian-from-absolute
+ (org-time-string-to-absolute anniv))))
+ ;; Use `diary-anniversary' to compute anniversary.
+ if (and anniv (apply 'diary-anniversary anniv))
+ collect (format-spec (or format "Birthday: %l (%Y)")
+ `((?l . ,(org-with-point-at (cadr contact) (org-store-link nil)))
+ (?h . ,(car contact))
+ (?y . ,(- (calendar-extract-year date)
+ (calendar-extract-year anniv)))
+ (?Y . ,(let ((years (- (calendar-extract-year date)
+ (calendar-extract-year anniv))))
+ (format "%d%s" years (diary-ordinal-suffix years)))))))))
+
+(defun org-completing-read-date (prompt collection
+ &optional predicate require-match initial-input
+ hist def inherit-input-method)
+ "Like `completing-read' but reads a date.
+Only PROMPT and DEF are really used."
+ (org-read-date nil nil nil prompt nil def))
+
+(add-to-list 'org-property-set-functions-alist
+ `(,org-contacts-birthday-property . org-completing-read-date))
+
+(defun org-contacts-template-name (&optional return-value)
+ "Try to return the contact name for a template.
+If not found return RETURN-VALUE or something that would ask the user."
+ (or (car (org-contacts-gnus-get-name-email))
+ return-value
+ "%^{Name}"))
+
+(defun org-contacts-template-email (&optional return-value)
+ "Try to return the contact email for a template.
+If not found return RETURN-VALUE or something that would ask the user."
+ (or (cadr (org-contacts-gnus-get-name-email))
+ return-value
+ (concat "%^{" org-contacts-email-property "}p")))
+
+(defun org-contacts-gnus-store-last-mail ()
+ "Store a link between mails and contacts.
+
+This function should be called from `gnus-article-prepare-hook'."
+ (let ((marker (org-contacts-gnus-article-from-get-marker)))
+ (when marker
+ (with-current-buffer (marker-buffer marker)
+ (save-excursion
+ (goto-char marker)
+ (let* ((org-email-link-description-format (or org-contacts-email-link-description-format
+ org-email-link-description-format))
+ (link (gnus-with-article-buffer (org-store-link nil))))
+ (org-set-property org-contacts-last-read-mail-property link)))))))
+
+(add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-store-last-mail)
+
+(defun org-contacts-icon-as-string ()
+ (let ((image (org-contacts-get-icon)))
+ (concat
+ (propertize "-" 'display
+ (append
+ (if image
+ image
+ `'(space :width (,org-contacts-icon-size)))
+ '(:ascent center)))
+ " ")))
+
+;;;###autoload
+(defun org-contacts (name)
+ "Create agenda view for contacts matching NAME."
+ (interactive (list (read-string "Name: ")))
+ (let ((org-agenda-files (org-contacts-files))
+ (org-agenda-skip-function
+ (lambda () (org-agenda-skip-if nil `(notregexp ,name))))
+ (org-agenda-format (propertize
+ "%(org-contacts-icon-as-string)% p% s%(org-contacts-irc-number-of-unread-messages)%+T"
+ 'keymap org-contacts-keymap))
+ (org-agenda-overriding-header
+ (or org-agenda-overriding-header
+ (concat "List of contacts matching `" name "':"))))
+ (setq org-agenda-skip-regexp name)
+ (org-tags-view nil org-contacts-matcher)
+ (with-current-buffer org-agenda-buffer-name
+ (setq org-agenda-redo-command
+ (list 'org-contacts name)))))
+
+(defun org-contacts-completing-read (prompt
+ &optional predicate
+ initial-input hist def inherit-input-method)
+ "Call `completing-read' with contacts name as collection."
+ (org-completing-read
+ prompt (org-contacts-filter) predicate t initial-input hist def inherit-input-method))
+
+(defun org-contacts-format-email (name email)
+ "Format a mail address."
+ (unless email
+ (error "`email' cannot be nul"))
+ (if name
+ (concat name " <" email ">")
+ email))
+
+(defun org-contacts-check-mail-address (mail)
+ "Add MAIL address to contact at point if it does not have it."
+ (let ((mails (org-entry-get (point) org-contacts-email-property)))
+ (unless (member mail (split-string mails))
+ (when (yes-or-no-p
+ (format "Do you want to this address to %s?" (org-get-heading t)))
+ (org-set-property org-contacts-email-property (concat mails " " mail))))))
+
+(defun org-contacts-gnus-check-mail-address ()
+ "Check that contact has the current address recorded.
+This function should be called from `gnus-article-prepare-hook'."
+ (let ((marker (org-contacts-gnus-article-from-get-marker)))
+ (when marker
+ (org-with-point-at marker
+ (org-contacts-check-mail-address (cadr (org-contacts-gnus-get-name-email)))))))
+
+(add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-check-mail-address)
+
+(defun org-contacts-view-send-email (&optional ask)
+ "Send email to the contact at point.
+If ASK is set, ask for the email address even if there's only one address."
+ (interactive "P")
+ (let ((marker (org-get-at-bol 'org-hd-marker)))
+ (org-with-point-at marker
+ (let ((emails (org-entry-get (point) org-contacts-email-property)))
+ (if emails
+ (let ((email-list (split-string emails)))
+ (if (and (= (length email-list) 1) (not ask))
+ (compose-mail (org-contacts-format-email
+ (org-get-heading t) emails))
+ (let ((email (completing-read "Send mail to which address: " email-list)))
+ (org-contacts-check-mail-address email)
+ (compose-mail (org-contacts-format-email (org-get-heading t) email)))))
+ (error (format "This contact has no mail address set (no %s property)."
+ org-contacts-email-property)))))))
+
+(defun org-contacts-get-icon (&optional pom)
+ "Get icon for contact at POM."
+ (setq pom (or pom (point)))
+ (catch 'icon
+ ;; Use `org-contacts-icon-property'
+ (let ((image-data (org-entry-get pom org-contacts-icon-property)))
+ (when image-data
+ (throw 'icon
+ (if (fboundp 'gnus-rescale-image)
+ (gnus-rescale-image (create-image image-data)
+ (cons org-contacts-icon-size org-contacts-icon-size))
+ (create-image image-data)))))
+ ;; Next, try Gravatar
+ (when org-contacts-icon-use-gravatar
+ (let* ((gravatar-size org-contacts-icon-size)
+ (email-list (org-entry-get pom org-contacts-email-property))
+ (gravatar
+ (when email-list
+ (loop for email in (split-string email-list)
+ for gravatar = (gravatar-retrieve-synchronously email)
+ if (and gravatar
+ (not (eq gravatar 'error)))
+ return gravatar))))
+ (when gravatar (throw 'icon gravatar))))))
+
+(defun org-contacts-irc-buffer (&optional pom)
+ "Get the IRC buffer associated with the entry at POM."
+ (setq pom (or pom (point)))
+ (let ((nick (org-entry-get pom org-contacts-nickname-property)))
+ (when nick
+ (let ((buffer (get-buffer nick)))
+ (when buffer
+ (with-current-buffer buffer
+ (when (eq major-mode 'erc-mode)
+ buffer)))))))
+
+(defun org-contacts-irc-number-of-unread-messages (&optional pom)
+ "Return the number of unread messages for contact at POM."
+ (when (boundp 'erc-modified-channels-alist)
+ (let ((number (cadr (assoc (org-contacts-irc-buffer pom) erc-modified-channels-alist))))
+ (if number
+ (format (concat "%3d unread message" (if (> number 1) "s" " ") " ") number)
+ (make-string 21 ? )))))
+
+(defun org-contacts-view-switch-to-irc-buffer ()
+ "Switch to the IRC buffer of the current contact if it has one."
+ (interactive)
+ (let ((marker (org-get-at-bol 'org-hd-marker)))
+ (org-with-point-at marker
+ (switch-to-buffer-other-window (org-contacts-irc-buffer)))))
+
+(defun org-contacts-completing-read-nickname (prompt collection
+ &optional predicate require-match initial-input
+ hist def inherit-input-method)
+ "Like `completing-read' but reads a nickname."
+ (org-completing-read prompt (append collection (erc-nicknames-list)) predicate require-match
+ initial-input hist def inherit-input-method))
+
+(defun erc-nicknames-list ()
+ "Return all nicknames of all ERC buffers."
+ (loop for buffer in (erc-buffer-list)
+ nconc (with-current-buffer buffer
+ (loop for user-entry in (mapcar 'car (erc-get-channel-user-list))
+ collect (elt user-entry 1)))))
+
+(add-to-list 'org-property-set-functions-alist
+ `(,org-contacts-nickname-property . org-contacts-completing-read-nickname))
+
+(provide 'org-contacts)
diff --git a/contrib/lisp/org-export-generic.el b/contrib/lisp/org-export-generic.el
index f8e8c4a..93755d7 100644
--- a/contrib/lisp/org-export-generic.el
+++ b/contrib/lisp/org-export-generic.el
@@ -620,7 +620,7 @@ underlined headlines. The default is 3."
(lines (org-split-string
(org-export-preprocess-string
region
- :for-ascii t
+ :for-backend 'ascii
:skip-before-1st-heading
(plist-get opt-plist :skip-before-1st-heading)
:drawers (plist-get export-plist :drawers-export)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 61de6a4..1f046f2 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5329,9 +5329,9 @@ Any match of REMOVE-RE will be removed from TXT."
(while (string-match remove-re txt)
(setq txt (replace-match "" t t txt))))
- ;; Set org-heading property on `rtn' to mark the start of the
+ ;; Set org-heading property on `txt' to mark the start of the
;; heading.
- (setq txt (propertize txt 'org-heading t))
+ (add-text-properties 0 (length txt) '(org-heading t) txt)
;; Prepare the variables needed in the eval of the compiled format
(setq time (cond (s2 (concat
@@ -5592,7 +5592,7 @@ could bind the variable in the options section of a custom command.")
(goto-char (match-beginning 1))
(insert (format org-agenda-todo-keyword-format s)))))
(let ((pl (text-property-any 0 (length x) 'org-heading t x)))
- (setq re (concat (get-text-property 0 'org-todo-regexp x)))
+ (setq re (get-text-property 0 'org-todo-regexp x))
(when (and re
(equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
x (or pl 0)) pl))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index cc0e51f..c567a26 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -259,11 +259,12 @@ For more information, see `org-clocktable-write-default'."
:group 'org-clocktable
:type 'function)
+;; FIXME: translate es and nl last string "Clock summary at"
(defcustom org-clock-clocktable-language-setup
- '(("en" "File" "L" "Timestamp" "Headline" "Time" "ALL" "Total time" "File time")
- ("es" "Archivo" "N" "Fecha y hora" "Tarea" "Tiempo" "TODO" "Tiempo total" "Tiempo archivo")
- ("fr" "Fichier" "N" "Horodatage" "En-tête" "Durée" "TOUT" "Durée totale" "Durée fichier")
- ("nl" "Bestand" "N" "Tijdstip" "Hoofding" "Duur" "ALLES" "Totale duur" "Bestandstijd"))
+ '(("en" "File" "L" "Timestamp" "Headline" "Time" "ALL" "Total time" "File time" "Clock summary at")
+ ("es" "Archivo" "N" "Fecha y hora" "Tarea" "Tiempo" "TODO" "Tiempo total" "Tiempo archivo" "Clock summary at")
+ ("fr" "Fichier" "N" "Horodatage" "En-tête" "Durée" "TOUT" "Durée totale" "Durée fichier" "Horodatage sommaire à")
+ ("nl" "Bestand" "N" "Tijdstip" "Hoofding" "Duur" "ALLES" "Totale duur" "Bestandstijd" "Clock summary at"))
"Terms used in clocktable, translated to different languages."
:group 'org-clocktable
:type 'alist)
@@ -2099,7 +2100,7 @@ from the dynamic block defintion."
(or header
;; Format the standard header
(concat
- "Clock summary at ["
+ (nth 9 lwords) " ["
(substring
(format-time-string (cdr org-time-stamp-formats))
1 -1)
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 3a03453..09f735f 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -186,8 +186,17 @@ This is the compiled version of the format.")
title (nth 1 column)
ass (if (equal property "ITEM")
(cons "ITEM"
- (org-no-properties
- (org-get-at-bol 'txt)))
+ ;; When in a buffer, get the whole line,
+ ;; we'll clean it later…
+ (if (org-mode-p)
+ (save-match-data
+ (org-no-properties
+ (org-remove-tabs
+ (buffer-substring-no-properties
+ (point-at-bol) (point-at-eol)))))
+ ;; In agenda, just get the `txt' property
+ (org-no-properties
+ (org-get-at-bol 'txt))))
(assoc property props))
width (or (cdr (assoc property org-columns-current-maxwidths))
(nth 2 column)
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index f40cd97..02704c4 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -1378,7 +1378,7 @@ the alist of previous items."
(cond
;; At an item: insert appropriate tags in export buffer.
((assq pos struct)
- (string-match (concat "[ \t]*\\(\\S-+[ \t]+\\)"
+ (string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)"
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?"
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
"\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index f2b3489..9dbd6be 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -113,12 +113,14 @@ t create unique labels of the form [fn:1], [fn:2], ...
confirm like t, but let the user edit the created value. In particular,
the label can be removed from the minibuffer, to create
an anonymous footnote.
+random Automatically generate a unique, random label.
plain Automatically create plain number labels like [1]"
:group 'org-footnote
:type '(choice
(const :tag "Prompt for label" nil)
(const :tag "Create automatic [fn:N]" t)
(const :tag "Offer automatic [fn:N] for editing" confirm)
+ (const :tag "Create a random label" random)
(const :tag "Create automatic [N]" plain)))
(defcustom org-footnote-auto-adjust nil
@@ -253,16 +255,22 @@ This command prompts for a label. If this is a label referencing an
existing label, only insert the label. If the footnote label is empty
or new, let the user edit the definition of the footnote."
(interactive)
- (let* ((labels (org-footnote-all-labels))
+ (let* ((labels (and (not (equal org-footnote-auto-label 'random))
+ (org-footnote-all-labels)))
(propose (org-footnote-unique-label labels))
(label
- (if (member org-footnote-auto-label '(t plain))
- propose
+ (cond
+ ((member org-footnote-auto-label '(t plain))
+ propose)
+ ((equal org-footnote-auto-label 'random)
+ (require 'org-id)
+ (substring (org-id-uuid) 0 8))
+ (t
(completing-read
"Label (leave empty for anonymous): "
(mapcar 'list labels) nil nil
(if (eq org-footnote-auto-label 'confirm) propose nil)
- 'org-footnote-label-history))))
+ 'org-footnote-label-history)))))
(setq label (org-footnote-normalize-label label))
(cond
((equal label "")
@@ -291,6 +299,7 @@ or new, let the user edit the definition of the footnote."
;; No section, put footnote into the current outline node
nil
;; Try to find or make the special node
+ (goto-char (point-min))
(setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
(unless (or (re-search-forward re nil t)
(and (progn (widen) t)
@@ -310,10 +319,10 @@ or new, let the user edit the definition of the footnote."
(skip-chars-backward " \t\r\n")
(delete-region (point) max)
(insert "\n\n")
- (insert org-footnote-tag-for-non-org-mode-files "\n")))))
- ;; Skip existing footnotes
- (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t)
- (forward-line))
+ (insert org-footnote-tag-for-non-org-mode-files "\n")))
+ ;; Skip existing footnotes
+ (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t)
+ (forward-line))))
(insert "\n[" label "] \n")
(goto-char (1- (point)))
(message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 0abecac..eea425f 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -848,9 +848,9 @@ MAY-INLINE-P allows inlining it as an image."
(message "image %s %s" thefile org-par-open)
(org-export-html-format-image thefile org-par-open))
(concat
- "@<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
+ "<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
(org-export-html-format-desc desc)
- "@</a>")))))
+ "</a>")))))
(defun org-html-handle-links (line opt-plist)
"Return LINE with markup of Org mode links.
@@ -1530,9 +1530,6 @@ lang=\"%s\" xml:lang=\"%s\">
"@</a> ")
t t line)))))
- ;; Format the links
- (setq line (org-html-handle-links line opt-plist))
-
(setq line (org-html-handle-time-stamps line))
;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
@@ -1541,6 +1538,9 @@ lang=\"%s\" xml:lang=\"%s\">
(or (string-match org-table-hline-regexp line)
(setq line (org-html-expand line)))
+ ;; Format the links
+ (setq line (org-html-handle-links line opt-plist))
+
;; TODO items
(if (and (string-match org-todo-line-regexp line)
(match-beginning 2))
@@ -1829,7 +1829,7 @@ lang=\"%s\" xml:lang=\"%s\">
"Create image tag with source and attributes."
(save-match-data
(if (string-match "^ltxpng/" src)
- (format "@<img src=\"%s\" alt=\"%s\"/>"
+ (format "<img src=\"%s\" alt=\"%s\"/>"
src (org-find-text-property-in-string 'org-latex-src src))
(let* ((caption (org-find-text-property-in-string 'org-caption src))
(attr (org-find-text-property-in-string 'org-attributes src))
@@ -1837,20 +1837,20 @@ lang=\"%s\" xml:lang=\"%s\">
(setq caption (and caption (org-html-do-expand caption)))
(concat
(if caption
- (format "%s@<div %sclass=\"figure\">
-@<p>"
- (if org-par-open "@</p>\n" "")
+ (format "%s<div %sclass=\"figure\">
+<p>"
+ (if org-par-open "</p>\n" "")
(if label (format "id=\"%s\" " (org-solidify-link-text label)) "")))
- (format "@<img src=\"%s\"%s />"
+ (format "<img src=\"%s\"%s />"
src
(if (string-match "\\<alt=" (or attr ""))
(concat " " attr )
(concat " " attr " alt=\"" src "\"")))
(if caption
- (format "@</p>%s
-@</div>%s"
- (concat "\n@<p>" caption "@</p>")
- (if org-par-open "\n@<p>" ""))))))))
+ (format "</p>%s
+</div>%s"
+ (concat "\n<p>" caption "</p>")
+ (if org-par-open "\n<p>" ""))))))))
(defun org-export-html-get-bibliography ()
"Find bibliography, cut it out and return it."
@@ -2482,7 +2482,7 @@ the alist of previous items."
;; At an item: insert appropriate tags in export buffer.
((assq pos struct)
(string-match
- (concat "[ \t]*\\(\\S-+[ \t]+\\)"
+ (concat "[ \t]*\\(\\S-+[ \t]*\\)"
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?"
"\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
"\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 3c3869e..fbdeb5e 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2415,7 +2415,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
(match-beginning 0) (point-max)))))
(setq footnote (concat (org-trim (buffer-substring (point) end))
- " ")) ; prevent last } being part of a link
+ ; last } won't be part of a link or list.
+ "\n"))
(delete-region (point) end))
(goto-char foot-beg)
(delete-region foot-beg foot-end)
diff --git a/lisp/org-list.el b/lisp/org-list.el
index aea8634..b29089d 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2850,13 +2850,19 @@ items."
;; extra information that needs to be processed.
(lambda (item type depth)
(let* ((counter (pop item))
- (fmt (concat (cond
- ((eq type 'descriptive)
- (concat (org-trim (eval istart)) "%s"
- (eval ddend)))
- ((and counter (eq type 'ordered))
- (concat (eval icount) "%s"))
- (t (concat (eval istart) "%s")))
+ (fmt (concat
+ (cond
+ ((eq type 'descriptive)
+ ;; Stick DTSTART to ISTART by
+ ;; left-trimming the latter.
+ (concat (let ((s (eval istart)))
+ (or (and (string-match "[ \t\n\r]+\\'" s)
+ (replace-match "" t t s))
+ istart))
+ "%s" (eval ddend)))
+ ((and counter (eq type 'ordered))
+ (concat (eval icount) "%s"))
+ (t (concat (eval istart) "%s")))
(eval iend)))
(first (car item)))
;; Replace checkbox if any is found.
@@ -2868,12 +2874,17 @@ items."
((string-match "\\[-\\]" first)
(setq first (replace-match "$\\boxminus$" t t first))))
;; Insert descriptive term if TYPE is `descriptive'.
- (when (and (eq type 'descriptive)
- (string-match "^\\(.*\\)[ \t]+::" first))
- (setq first (concat
- (eval dtstart) (org-trim (match-string 1 first))
- (eval dtend) (eval ddstart)
- (org-trim (substring first (match-end 0))) "")))
+ (when (eq type 'descriptive)
+ (let* ((complete (string-match "^\\(.*\\)[ \t]+::" first))
+ (term (if complete
+ (save-match-data
+ (org-trim (match-string 1 first)))
+ "???"))
+ (desc (if complete
+ (org-trim (substring first (match-end 0)))
+ first)))
+ (setq first (concat (eval dtstart) term (eval dtend)
+ (eval ddstart) desc))))
(setcar item first)
(format fmt
(mapconcat (lambda (e)
@@ -2889,10 +2900,10 @@ items."
(fmt (concat (cond
(splicep "%s")
((eq type 'ordered)
- (concat (eval ostart) "\n%s" (eval oend)))
+ (concat (eval ostart) "%s" (eval oend)))
((eq type 'descriptive)
- (concat (eval dstart) "\n%s" (eval dend)))
- (t (concat (eval ustart) "\n%s" (eval uend))))
+ (concat (eval dstart) "%s" (eval dend)))
+ (t (concat (eval ustart) "%s" (eval uend))))
(eval lsep))))
(format fmt (mapconcat (lambda (e)
(funcall export-item e type depth))
@@ -2906,9 +2917,9 @@ with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
list
(org-combine-plists
- '(:splice nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
- :ustart "\\begin{itemize}" :uend "\\end{itemize}"
- :dstart "\\begin{description}" :dend "\\end{description}"
+ '(:splice nil :ostart "\\begin{enumerate}\n" :oend "\\end{enumerate}"
+ :ustart "\\begin{itemize}\n" :uend "\\end{itemize}"
+ :dstart "\\begin{description}\n" :dend "\\end{description}"
:dtstart "[" :dtend "] "
:istart "\\item " :iend "\n"
:icount (let ((enum (nth depth '("i" "ii" "iii" "iv"))))
@@ -2927,12 +2938,12 @@ with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
list
(org-combine-plists
- '(:splice nil :ostart "<ol>" :oend "\n</ol>"
- :ustart "<ul>" :uend "\n</ul>"
- :dstart "<dl>" :dend "</dl>"
+ '(:splice nil :ostart "<ol>\n" :oend "\n</ol>"
+ :ustart "<ul>\n" :uend "\n</ul>"
+ :dstart "<dl>\n" :dend "\n</dl>"
:dtstart "<dt>" :dtend "</dt>\n"
:ddstart "<dd>" :ddend "</dd>"
- :istart "<li>" :iend "\n</li>"
+ :istart "<li>" :iend "</li>"
:icount (format "<li value=\"%s\">" counter)
:isep "\n" :lsep "\n" :csep "\n"
:cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
@@ -2945,9 +2956,9 @@ with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
list
(org-combine-plists
- '(:splice nil :ostart "@itemize @minus" :oend "@end itemize"
- :ustart "@enumerate" :uend "@end enumerate"
- :dstart "@table @asis" :dend "@end table"
+ '(:splice nil :ostart "@itemize @minus\n" :oend "@end itemize"
+ :ustart "@enumerate\n" :uend "@end enumerate"
+ :dstart "@table @asis\n" :dend "@end table"
:dtstart " " :dtend "\n"
:istart "@item\n" :iend "\n"
:icount "@item\n"
diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index 8d6318e..9c88f5d 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -74,7 +74,7 @@
;; TaskJugglerUI.
;;
;; * Resources
-;;
+;;
;; Next you can define resources and assign those to work on specific
;; tasks. You can group your resources hierarchically. Tag the top
;; node of the resources with "taskjuggler_resource" (or whatever you
@@ -107,7 +107,7 @@
;; etc for tasks.
;;
;; * Dependencies
-;;
+;;
;; The exporter will handle dependencies that are defined in the tasks
;; either with the ORDERED attribute (see TODO dependencies in the Org
;; mode manual) or with the BLOCKER attribute (see org-depend.el) or
@@ -137,7 +137,7 @@
;; :Effort: 2.0
;; :BLOCKER: training_material { gapduration 1d } some_other_task
;; :END:
-;;
+;;
;;;; * TODO
;; - Use SCHEDULED and DEADLINE information (not just start and end
;; properties).
@@ -181,6 +181,11 @@ resources for the project."
:group 'org-export-taskjuggler
:type 'string)
+(defcustom org-export-taskjuggler-target-version 2.4
+ "Which version of TaskJuggler the exporter is targeting."
+ :group 'org-export-taskjuggler
+ :type 'number)
+
(defcustom org-export-taskjuggler-default-project-version "1.0"
"Default version string for the project."
:group 'org-export-taskjuggler
@@ -193,7 +198,7 @@ with `org-export-taskjuggler-project-tag'"
:group 'org-export-taskjuggler
:type 'integer)
-(defcustom org-export-taskjuggler-default-reports
+(defcustom org-export-taskjuggler-default-reports
'("taskreport \"Gantt Chart\" {
headline \"Project Gantt Chart\"
columns hierarchindex, name, start, end, effort, duration, completed, chart
@@ -212,7 +217,7 @@ with `org-export-taskjuggler-project-tag'"
:group 'org-export-taskjuggler
:type '(repeat (string :tag "Report")))
-(defcustom org-export-taskjuggler-default-global-properties
+(defcustom org-export-taskjuggler-default-global-properties
"shift s40 \"Part time shift\" {
workinghours wed, thu, fri off
}
@@ -221,7 +226,7 @@ with `org-export-taskjuggler-project-tag'"
define global properties such as shifts, accounts, rates,
vacation, macros and flags. Any property that is allowed within
the TaskJuggler file can be inserted. You could for example
-include another TaskJuggler file.
+include another TaskJuggler file.
The global properties are inserted after the project declaration
but before any resource and task declarations."
@@ -257,14 +262,15 @@ defined in `org-export-taskjuggler-default-reports'."
(setq-default org-done-keywords org-done-keywords)
(let* ((tasks
(org-taskjuggler-resolve-dependencies
- (org-taskjuggler-assign-task-ids
- (org-map-entries
- '(org-taskjuggler-components)
- org-export-taskjuggler-project-tag nil 'archive 'comment))))
+ (org-taskjuggler-assign-task-ids
+ (org-taskjuggler-compute-task-leafiness
+ (org-map-entries
+ '(org-taskjuggler-components)
+ org-export-taskjuggler-project-tag nil 'archive 'comment)))))
(resources
(org-taskjuggler-assign-resource-ids
- (org-map-entries
- '(org-taskjuggler-components)
+ (org-map-entries
+ '(org-taskjuggler-components)
org-export-taskjuggler-resource-tag nil 'archive 'comment)))
(filename (expand-file-name
(concat
@@ -278,9 +284,9 @@ defined in `org-export-taskjuggler-default-reports'."
(error "No tasks specified"))
;; add a default resource
(unless resources
- (setq resources
- `((("resource_id" . ,(user-login-name))
- ("headline" . ,user-full-name)
+ (setq resources
+ `((("resource_id" . ,(user-login-name))
+ ("headline" . ,user-full-name)
("level" . 1)))))
;; add a default allocation to the first task if none was given
(unless (assoc "allocate" (car tasks))
@@ -331,6 +337,10 @@ with the TaskJuggler GUI."
(command (concat process-name " " file-name)))
(start-process-shell-command process-name nil command)))
+(defun org-taskjuggler-targeting-tj3-p ()
+ "Return true if we are targeting TaskJuggler III."
+ (>= org-export-taskjuggler-target-version 3.0))
+
(defun org-taskjuggler-parent-is-ordered-p ()
"Return true if the parent of the current node has a property
\"ORDERED\". Return nil otherwise."
@@ -344,7 +354,9 @@ information, all the properties, etc."
(let* ((props (org-entry-properties))
(components (org-heading-components))
(level (nth 1 components))
- (headline (nth 4 components))
+ (headline
+ (replace-regexp-in-string
+ "\"" "\\\"" (nth 4 components) t t)) ; quote double quotes in headlines
(parent-ordered (org-taskjuggler-parent-is-ordered-p)))
(push (cons "level" level) props)
(push (cons "headline" headline) props)
@@ -362,16 +374,16 @@ a path to the current task."
(dolist (task tasks resolved-tasks)
(let ((level (cdr (assoc "level" task))))
(cond
- ((< previous-level level)
+ ((< previous-level level)
(setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
(dotimes (tmp (- level previous-level))
(push (list unique-id) unique-ids)
(push unique-id path)))
- ((= previous-level level)
+ ((= previous-level level)
(setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
(push unique-id (car unique-ids))
(setcar path unique-id))
- ((> previous-level level)
+ ((> previous-level level)
(dotimes (tmp (- previous-level level))
(pop unique-ids)
(pop path))
@@ -383,17 +395,37 @@ a path to the current task."
(setq previous-level level)
(setq resolved-tasks (append resolved-tasks (list task)))))))
-(defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
+(defun org-taskjuggler-compute-task-leafiness (tasks)
+ "Figure out if each task is a leaf by looking at it's level,
+and the level of its successor. If the successor is higher (ie
+deeper), then it's not a leaf."
+ (let (new-list)
+ (while (car tasks)
+ (let ((task (car tasks))
+ (successor (car (cdr tasks))))
+ (cond
+ ;; if a task has no successors it is a leaf
+ ((null successor)
+ (push (cons (cons "leaf-node" t) task) new-list))
+ ;; if the successor has a lower level than task it is a leaf
+ ((<= (cdr (assoc "level" successor)) (cdr (assoc "level" task)))
+ (push (cons (cons "leaf-node" t) task) new-list))
+ ;; otherwise examine the rest of the tasks
+ (t (push task new-list))))
+ (setq tasks (cdr tasks)))
+ (nreverse new-list)))
+
+(defun org-taskjuggler-assign-resource-ids (resources)
"Given a list of resources return the same list, assigning a
unique id to each resource."
(cond
((null resources) nil)
- (t
+ (t
(let* ((resource (car resources))
(unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
(push (cons "unique-id" unique-id) resource)
- (cons resource
- (org-taskjuggler-assign-resource-ids (cdr resources)
+ (cons resource
+ (org-taskjuggler-assign-resource-ids (cdr resources)
(cons unique-id unique-ids)))))))
(defun org-taskjuggler-resolve-dependencies (tasks)
@@ -405,24 +437,24 @@ unique id to each resource."
(depends (cdr (assoc "depends" task)))
(parent-ordered (cdr (assoc "parent-ordered" task)))
(blocker (cdr (assoc "BLOCKER" task)))
- (blocked-on-previous
+ (blocked-on-previous
(and blocker (string-match "previous-sibling" blocker)))
(dependencies
(org-taskjuggler-resolve-explicit-dependencies
- (append
+ (append
(and depends (org-taskjuggler-tokenize-dependencies depends))
- (and blocker (org-taskjuggler-tokenize-dependencies blocker)))
+ (and blocker (org-taskjuggler-tokenize-dependencies blocker)))
tasks))
previous-sibling)
; update previous sibling info
(cond
- ((< previous-level level)
+ ((< previous-level level)
(dotimes (tmp (- level previous-level))
(push task siblings)))
((= previous-level level)
(setq previous-sibling (car siblings))
(setcar siblings task))
- ((> previous-level level)
+ ((> previous-level level)
(dotimes (tmp (- previous-level level))
(pop siblings))
(setq previous-sibling (car siblings))
@@ -432,7 +464,7 @@ unique id to each resource."
(when (or (and previous-sibling parent-ordered) blocked-on-previous)
(push (format "!%s" (cdr (assoc "unique-id" previous-sibling))) dependencies))
; store dependency information
- (when dependencies
+ (when dependencies
(push (cons "depends" (mapconcat 'identity dependencies ", ")) task))
(setq previous-level level)
(setq resolved-tasks (append resolved-tasks (list task)))))))
@@ -442,10 +474,10 @@ unique id to each resource."
individual dependencies and return them as a list while keeping
the optional arguments (such as gapduration) for the
dependencies. A dependency will have to match `[-a-zA-Z0-9_]+'."
- (cond
+ (cond
((string-match "^ *$" dependencies) nil)
((string-match "^[ \t]*\\([-a-zA-Z0-9_]+\\([ \t]*{[^}]+}\\)?\\)[ \t,]*" dependencies)
- (cons
+ (cons
(substring dependencies (match-beginning 1) (match-end 1))
(org-taskjuggler-tokenize-dependencies (substring dependencies (match-end 0)))))
(t (error (format "invalid dependency id %s" dependencies)))))
@@ -459,27 +491,27 @@ where a matching tasks was found. If the dependency is
`org-taskjuggler-resolve-dependencies'). If there is no matching
task the dependency is ignored and a warning is displayed ."
(unless (null dependencies)
- (let*
+ (let*
;; the dependency might have optional attributes such as "{
;; gapduration 5d }", so only use the first string as id for the
;; dependency
((dependency (car dependencies))
(id (car (split-string dependency)))
- (optional-attributes
+ (optional-attributes
(mapconcat 'identity (cdr (split-string dependency)) " "))
(path (org-taskjuggler-find-task-with-id id tasks)))
- (cond
+ (cond
;; ignore previous sibling dependencies
((equal (car dependencies) "previous-sibling")
(org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))
;; if the id is found in another task use its path
- ((not (null path))
+ ((not (null path))
(cons (mapconcat 'identity (list path optional-attributes) " ")
- (org-taskjuggler-resolve-explicit-dependencies
+ (org-taskjuggler-resolve-explicit-dependencies
(cdr dependencies) tasks)))
;; warn about dangling dependency but otherwise ignore it
- (t (display-warning
- 'org-export-taskjuggler
+ (t (display-warning
+ 'org-export-taskjuggler
(format "No task with matching property \"task_id\" found for id %s" id))
(org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))))))
@@ -488,7 +520,7 @@ task the dependency is ignored and a warning is displayed ."
return nil."
(let ((task-id (cdr (assoc "task_id" (car tasks))))
(path (cdr (assoc "path" (car tasks)))))
- (cond
+ (cond
((null tasks) nil)
((equal task-id id) path)
(t (org-taskjuggler-find-task-with-id id (cdr tasks))))))
@@ -509,7 +541,7 @@ finally add more underscore characters (\"_\")."
(while (member id unique-ids)
(setq id (concat id "_")))
id))
-
+
(defun org-taskjuggler-clean-id (id)
"Clean and return ID to make it acceptable for taskjuggler."
(and id (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" id)))
@@ -524,7 +556,7 @@ specified it is calculated
(version (cdr (assoc "version" project)))
(start (cdr (assoc "start" project)))
(end (cdr (assoc "end" project))))
- (insert
+ (insert
(format "project %s \"%s\" \"%s\" %s +%sd {\n }\n"
unique-id headline version start
org-export-taskjuggler-default-project-duration))))
@@ -534,16 +566,16 @@ specified it is calculated
with separator \"\n\"."
(let ((filtered-items (remq nil items)))
(and filtered-items (mapconcat 'identity filtered-items "\n"))))
-
+
(defun org-taskjuggler-get-attributes (item attributes)
"Return all attribute as a single formated string. ITEM is an
alist representing either a resource or a task. ATTRIBUTES is a
list of symbols. Only entries from ITEM are considered that are
listed in ATTRIBUTES."
- (org-taskjuggler-filter-and-join
+ (org-taskjuggler-filter-and-join
(mapcar
- (lambda (attribute)
- (org-taskjuggler-filter-and-join
+ (lambda (attribute)
+ (org-taskjuggler-filter-and-join
(org-taskjuggler-get-attribute item attribute)))
attributes)))
@@ -551,7 +583,7 @@ listed in ATTRIBUTES."
"Return a list of strings containing the properly formatted
taskjuggler declaration for a given ATTRIBUTE in ITEM (an alist).
If the ATTRIBUTE is not in ITEM return nil."
- (cond
+ (cond
((null item) nil)
((equal (symbol-name attribute) (car (car item)))
(cons (format "%s %s" (symbol-name attribute) (cdr (car item)))
@@ -565,14 +597,14 @@ defines a property \"resource_id\" it will be used as the id for
this resource. Otherwise it will use the ID property. If neither
is defined it will calculate a unique id for the resource using
`org-taskjuggler-get-unique-id'."
- (let ((id (org-taskjuggler-clean-id
- (or (cdr (assoc "resource_id" resource))
- (cdr (assoc "ID" resource))
+ (let ((id (org-taskjuggler-clean-id
+ (or (cdr (assoc "resource_id" resource))
+ (cdr (assoc "ID" resource))
(cdr (assoc "unique-id" resource)))))
(headline (cdr (assoc "headline" resource)))
(attributes '(limits vacation shift booking efficiency journalentry rate)))
- (insert
- (concat
+ (insert
+ (concat
"resource " id " \"" headline "\" {\n "
(org-taskjuggler-get-attributes resource attributes) "\n"))))
@@ -584,9 +616,9 @@ Otherwise if it contains something like 3.0 it is assumed to be
days and will be translated into 3.0d. Other formats that
taskjuggler supports (like weeks, months and years) are currently
not supported."
- (cond
+ (cond
((null effort) effort)
- ((string-match "\\([0-9]+\\):\\([0-9]+\\)" effort)
+ ((string-match "\\([0-9]+\\):\\([0-9]+\\)" effort)
(let ((hours (string-to-number (match-string 1 effort)))
(minutes (string-to-number (match-string 2 effort))))
(format "%dh" (+ hours (/ minutes 60.0)))))
@@ -596,7 +628,7 @@ not supported."
(defun org-taskjuggler-get-priority (priority)
"Return a priority between 1 and 1000 based on PRIORITY, an
org-mode priority string."
- (max 1 (/ (* 1000 (- org-lowest-priority (string-to-char priority)))
+ (max 1 (/ (* 1000 (- org-lowest-priority (string-to-char priority)))
(- org-lowest-priority org-highest-priority))))
(defun org-taskjuggler-open-task (task)
@@ -608,31 +640,41 @@ org-mode priority string."
(priority-raw (cdr (assoc "PRIORITY" task)))
(priority (and priority-raw (org-taskjuggler-get-priority priority-raw)))
(state (cdr (assoc "TODO" task)))
- (complete (or (and (member state org-done-keywords) "100")
+ (complete (or (and (member state org-done-keywords) "100")
(cdr (assoc "complete" task))))
(parent-ordered (cdr (assoc "parent-ordered" task)))
(previous-sibling (cdr (assoc "previous-sibling" task)))
- (attributes
+ (milestone (or (cdr (assoc "milestone" task))
+ (and (assoc "leaf-node" task)
+ (not (or effort
+ (cdr (assoc "duration" task))
+ (cdr (assoc "end" task))
+ (cdr (assoc "period" task)))))))
+ (attributes
'(account start note duration endbuffer endcredit end
- flags journalentry length maxend maxstart milestone
- minend minstart period reference responsible
- scheduling startbuffer startcredit statusnote)))
+ flags journalentry length maxend maxstart minend
+ minstart period reference responsible scheduling
+ startbuffer startcredit statusnote)))
(insert
- (concat
- "task " unique-id " \"" headline "\" {\n"
+ (concat
+ "task " unique-id " \"" headline "\" {\n"
(if (and parent-ordered previous-sibling)
(format " depends %s\n" previous-sibling)
(and depends (format " depends %s\n" depends)))
- (and allocate (format " purge allocations\n allocate %s\n" allocate))
+ (and allocate (format " purge %s\n allocate %s\n"
+ (or (and (org-taskjuggler-targeting-tj3-p) "allocations")
+ "allocate")
+ allocate))
(and complete (format " complete %s\n" complete))
(and effort (format " effort %s\n" effort))
(and priority (format " priority %s\n" priority))
-
+ (and milestone (format " milestone\n"))
+
(org-taskjuggler-get-attributes task attributes)
"\n"))))
(defun org-taskjuggler-close-maybe (level)
- (while (> org-export-taskjuggler-old-level level)
+ (while (> org-export-taskjuggler-old-level level)
(insert "}\n")
(setq org-export-taskjuggler-old-level (1- org-export-taskjuggler-old-level)))
(when (= org-export-taskjuggler-old-level level)
diff --git a/lisp/org.el b/lisp/org.el
index 1a7192a..27a3949 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9019,7 +9019,7 @@ from."
(let ((ido-enter-matching-directory nil))
(apply 'ido-completing-read (concat (car args))
(if (consp (car (nth 1 args)))
- (mapcar (lambda (x) (car x)) (nth 1 args))
+ (mapcar 'car (nth 1 args))
(nth 1 args))
(cddr args)))
(if (and org-completion-use-iswitchb
@@ -9027,7 +9027,7 @@ from."
(listp (second args)))
(apply 'org-iswitchb-completing-read (concat (car args))
(if (consp (car (nth 1 args)))
- (mapcar (lambda (x) (car x)) (nth 1 args))
+ (mapcar 'car (nth 1 args))
(nth 1 args))
(cddr args))
(apply 'completing-read args)))))
@@ -12551,7 +12551,7 @@ instead of the agenda files."
(org-agenda-files))))))))
(defun org-make-tags-matcher (match)
- "Create the TAGS//TODO matcher form for the selection string MATCH."
+ "Create the TAGS/TODO matcher form for the selection string MATCH."
;; todo-only is scoped dynamically into this function, and the function
;; may change it if the matcher asks for it.
(unless match