Parcourir la source

Merge branch 'master' of orgmode.org:org-mode

Carsten Dominik il y a 14 ans
Parent
commit
bd089631fc

+ 1 - 0
contrib/README

@@ -16,6 +16,7 @@ org-bookmark.el          --- Links to bookmarks
 org-checklist.el         --- org functions for checklist handling
 org-checklist.el         --- org functions for checklist handling
 org-choose.el            --- Use TODO keywords to mark decision states
 org-choose.el            --- Use TODO keywords to mark decision states
 org-collector.el         --- Collect properties into tables
 org-collector.el         --- Collect properties into tables
+org-contacts             --- Contacts management
 org-contribdir.el        --- Dummy file to mark the org contrib Lisp directory
 org-contribdir.el        --- Dummy file to mark the org contrib Lisp directory
 org-depend.el            --- TODO dependencies for Org-mode
 org-depend.el            --- TODO dependencies for Org-mode
 org-drill.el             --- Self-testing with org-learn
 org-drill.el             --- Self-testing with org-learn

+ 477 - 0
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)

+ 1 - 1
contrib/lisp/org-export-generic.el

@@ -620,7 +620,7 @@ underlined headlines.  The default is 3."
 	 (lines (org-split-string
 	 (lines (org-split-string
 		 (org-export-preprocess-string
 		 (org-export-preprocess-string
 		  region
 		  region
-		  :for-ascii t
+		  :for-backend 'ascii
 		  :skip-before-1st-heading
 		  :skip-before-1st-heading
 		  (plist-get opt-plist :skip-before-1st-heading)
 		  (plist-get opt-plist :skip-before-1st-heading)
 		  :drawers (plist-get export-plist :drawers-export)
 		  :drawers (plist-get export-plist :drawers-export)

+ 3 - 3
lisp/org-agenda.el

@@ -5329,9 +5329,9 @@ Any match of REMOVE-RE will be removed from TXT."
 	(while (string-match remove-re txt)
 	(while (string-match remove-re txt)
 	  (setq txt (replace-match "" t t 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.
       ;; 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
       ;; Prepare the variables needed in the eval of the compiled format
       (setq time (cond (s2 (concat
       (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))
 	      (goto-char (match-beginning 1))
 	      (insert (format org-agenda-todo-keyword-format s)))))
 	      (insert (format org-agenda-todo-keyword-format s)))))
       (let ((pl (text-property-any 0 (length x) 'org-heading t x)))
       (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
 	(when (and re
 		   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
 		   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
 					x (or pl 0)) pl))
 					x (or pl 0)) pl))

+ 6 - 5
lisp/org-clock.el

@@ -259,11 +259,12 @@ For more information, see `org-clocktable-write-default'."
   :group 'org-clocktable
   :group 'org-clocktable
   :type 'function)
   :type 'function)
 
 
+;; FIXME: translate es and nl last string "Clock summary at"
 (defcustom org-clock-clocktable-language-setup
 (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."
   "Terms used in clocktable, translated to different languages."
   :group 'org-clocktable
   :group 'org-clocktable
   :type 'alist)
   :type 'alist)
@@ -2099,7 +2100,7 @@ from the dynamic block defintion."
        (or header
        (or header
 	   ;; Format the standard header
 	   ;; Format the standard header
 	   (concat
 	   (concat
-	    "Clock summary at ["
+	    (nth 9 lwords) " ["
 	    (substring
 	    (substring
 	     (format-time-string (cdr org-time-stamp-formats))
 	     (format-time-string (cdr org-time-stamp-formats))
 	     1 -1)
 	     1 -1)

+ 11 - 2
lisp/org-colview.el

@@ -186,8 +186,17 @@ This is the compiled version of the format.")
 	    title (nth 1 column)
 	    title (nth 1 column)
 	    ass (if (equal property "ITEM")
 	    ass (if (equal property "ITEM")
 		    (cons "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))
 		  (assoc property props))
 	    width (or (cdr (assoc property org-columns-current-maxwidths))
 	    width (or (cdr (assoc property org-columns-current-maxwidths))
 		      (nth 2 column)
 		      (nth 2 column)

+ 1 - 1
lisp/org-docbook.el

@@ -1378,7 +1378,7 @@ the alist of previous items."
     (cond
     (cond
      ;; At an item: insert appropriate tags in export buffer.
      ;; At an item: insert appropriate tags in export buffer.
      ((assq pos struct)
      ((assq pos struct)
-      (string-match (concat "[ \t]*\\(\\S-+[ \t]+\\)"
+      (string-match (concat "[ \t]*\\(\\S-+[ \t]*\\)"
 			    "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?"
 			    "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\]\\)?"
 			    "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
 			    "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
 			    "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"
 			    "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"

+ 17 - 8
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,
 confirm    like t, but let the user edit the created value.  In particular,
            the label can be removed from the minibuffer, to create
            the label can be removed from the minibuffer, to create
            an anonymous footnote.
            an anonymous footnote.
+random	   Automatically generate a unique, random label.
 plain      Automatically create plain number labels like [1]"
 plain      Automatically create plain number labels like [1]"
   :group 'org-footnote
   :group 'org-footnote
   :type '(choice
   :type '(choice
 	  (const :tag "Prompt for label" nil)
 	  (const :tag "Prompt for label" nil)
 	  (const :tag "Create automatic [fn:N]" t)
 	  (const :tag "Create automatic [fn:N]" t)
 	  (const :tag "Offer automatic [fn:N] for editing" confirm)
 	  (const :tag "Offer automatic [fn:N] for editing" confirm)
+	  (const :tag "Create a random label" random)
 	  (const :tag "Create automatic [N]" plain)))
 	  (const :tag "Create automatic [N]" plain)))
 
 
 (defcustom org-footnote-auto-adjust nil
 (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
 existing label, only insert the label.  If the footnote label is empty
 or new, let the user edit the definition of the footnote."
 or new, let the user edit the definition of the footnote."
   (interactive)
   (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))
 	 (propose (org-footnote-unique-label labels))
 	 (label
 	 (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
 	    (completing-read
 	     "Label (leave empty for anonymous): "
 	     "Label (leave empty for anonymous): "
 	     (mapcar 'list labels) nil nil
 	     (mapcar 'list labels) nil nil
 	     (if (eq org-footnote-auto-label 'confirm) propose 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))
     (setq label (org-footnote-normalize-label label))
     (cond
     (cond
      ((equal label "")
      ((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
 	  ;; No section, put footnote into the current outline node
 	  nil
 	  nil
 	;; Try to find or make the special node
 	;; Try to find or make the special node
+	(goto-char (point-min))
 	(setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
 	(setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
 	(unless (or (re-search-forward re nil t)
 	(unless (or (re-search-forward re nil t)
 		    (and (progn (widen) 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")
 	  (skip-chars-backward " \t\r\n")
 	  (delete-region (point) max)
 	  (delete-region (point) max)
 	  (insert "\n\n")
 	  (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")
     (insert "\n[" label "] \n")
     (goto-char (1- (point)))
     (goto-char (1- (point)))
     (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))
     (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))

+ 15 - 15
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)
 	       (message "image %s %s" thefile org-par-open)
 	       (org-export-html-format-image thefile org-par-open))
 	       (org-export-html-format-image thefile org-par-open))
 	    (concat
 	    (concat
-	       "@<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
+	       "<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
 	       (org-export-html-format-desc desc)
 	       (org-export-html-format-desc desc)
-	       "@</a>")))))
+	       "</a>")))))
 
 
 (defun org-html-handle-links (line opt-plist)
 (defun org-html-handle-links (line opt-plist)
   "Return LINE with markup of Org mode links.
   "Return LINE with markup of Org mode links.
@@ -1530,9 +1530,6 @@ lang=\"%s\" xml:lang=\"%s\">
 				  "@</a> ")
 				  "@</a> ")
 			  t t line)))))
 			  t t line)))))
 
 
-	  ;; Format the links
-	  (setq line (org-html-handle-links line opt-plist))
-
 	  (setq line (org-html-handle-time-stamps line))
 	  (setq line (org-html-handle-time-stamps line))
 
 
 	  ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
 	  ;; 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)
 	  (or (string-match org-table-hline-regexp line)
 	      (setq line (org-html-expand line)))
 	      (setq line (org-html-expand line)))
 
 
+	  ;; Format the links
+	  (setq line (org-html-handle-links line opt-plist))
+
 	  ;; TODO items
 	  ;; TODO items
 	  (if (and (string-match org-todo-line-regexp line)
 	  (if (and (string-match org-todo-line-regexp line)
 		   (match-beginning 2))
 		   (match-beginning 2))
@@ -1829,7 +1829,7 @@ lang=\"%s\" xml:lang=\"%s\">
   "Create image tag with source and attributes."
   "Create image tag with source and attributes."
   (save-match-data
   (save-match-data
     (if (string-match "^ltxpng/" src)
     (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))
                 src (org-find-text-property-in-string 'org-latex-src src))
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
 	     (attr (org-find-text-property-in-string 'org-attributes 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)))
 	(setq caption (and caption (org-html-do-expand caption)))
 	(concat
 	(concat
 	(if caption
 	(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)) "")))
 		    (if label (format "id=\"%s\" " (org-solidify-link-text label)) "")))
-	(format "@<img src=\"%s\"%s />"
+	(format "<img src=\"%s\"%s />"
 		src
 		src
 		(if (string-match "\\<alt=" (or attr ""))
 		(if (string-match "\\<alt=" (or attr ""))
 		    (concat " " attr )
 		    (concat " " attr )
 		  (concat " " attr " alt=\"" src "\"")))
 		  (concat " " attr " alt=\"" src "\"")))
 	(if caption
 	(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 ()
 (defun org-export-html-get-bibliography ()
   "Find bibliography, cut it out and return it."
   "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.
      ;; At an item: insert appropriate tags in export buffer.
      ((assq pos struct)
      ((assq pos struct)
       (string-match
       (string-match
-       (concat "[ \t]*\\(\\S-+[ \t]+\\)"
+       (concat "[ \t]*\\(\\S-+[ \t]*\\)"
 	       "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?"
 	       "\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\]\\)?"
 	       "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
 	       "\\(?:\\(\\[[ X-]\\]\\)[ \t]+\\)?"
 	       "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"
 	       "\\(?:\\(.*\\)[ \t]+::[ \t]+\\)?"

+ 2 - 1
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)
 			    (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
 				(match-beginning 0) (point-max)))))
 				(match-beginning 0) (point-max)))))
 		 (setq footnote (concat (org-trim (buffer-substring (point) end))
 		 (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))
 		 (delete-region (point) end))
 	       (goto-char foot-beg)
 	       (goto-char foot-beg)
 	       (delete-region foot-beg foot-end)
 	       (delete-region foot-beg foot-end)

+ 37 - 26
lisp/org-list.el

@@ -2850,13 +2850,19 @@ items."
 	   ;; extra information that needs to be processed.
 	   ;; extra information that needs to be processed.
 	   (lambda (item type depth)
 	   (lambda (item type depth)
 	     (let* ((counter (pop item))
 	     (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)))
 				 (eval iend)))
 		    (first (car item)))
 		    (first (car item)))
 	       ;; Replace checkbox if any is found.
 	       ;; Replace checkbox if any is found.
@@ -2868,12 +2874,17 @@ items."
 		((string-match "\\[-\\]" first)
 		((string-match "\\[-\\]" first)
 		 (setq first (replace-match "$\\boxminus$" t t first))))
 		 (setq first (replace-match "$\\boxminus$" t t first))))
 	       ;; Insert descriptive term if TYPE is `descriptive'.
 	       ;; 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)
 	       (setcar item first)
 	       (format fmt
 	       (format fmt
 		       (mapconcat (lambda (e)
 		       (mapconcat (lambda (e)
@@ -2889,10 +2900,10 @@ items."
 		    (fmt (concat (cond
 		    (fmt (concat (cond
 				  (splicep "%s")
 				  (splicep "%s")
 				  ((eq type 'ordered)
 				  ((eq type 'ordered)
-				   (concat (eval ostart) "\n%s" (eval oend)))
+				   (concat (eval ostart) "%s" (eval oend)))
 				  ((eq type 'descriptive)
 				  ((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))))
 				 (eval lsep))))
 	       (format fmt (mapconcat (lambda (e)
 	       (format fmt (mapconcat (lambda (e)
 					(funcall export-item e type depth))
 					(funcall export-item e type depth))
@@ -2906,9 +2917,9 @@ with overruling parameters for `org-list-to-generic'."
   (org-list-to-generic
   (org-list-to-generic
    list
    list
    (org-combine-plists
    (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 "] "
 	       :dtstart "[" :dtend "] "
 	       :istart "\\item " :iend "\n"
 	       :istart "\\item " :iend "\n"
 	       :icount (let ((enum (nth depth '("i" "ii" "iii" "iv"))))
 	       :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
   (org-list-to-generic
    list
    list
    (org-combine-plists
    (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"
 	       :dtstart "<dt>" :dtend "</dt>\n"
 	       :ddstart "<dd>" :ddend "</dd>"
 	       :ddstart "<dd>" :ddend "</dd>"
-	       :istart "<li>" :iend "\n</li>"
+	       :istart "<li>" :iend "</li>"
 	       :icount (format "<li value=\"%s\">" counter)
 	       :icount (format "<li value=\"%s\">" counter)
 	       :isep "\n" :lsep "\n" :csep "\n"
 	       :isep "\n" :lsep "\n" :csep "\n"
 	       :cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
 	       :cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
@@ -2945,9 +2956,9 @@ with overruling parameters for `org-list-to-generic'."
   (org-list-to-generic
   (org-list-to-generic
    list
    list
    (org-combine-plists
    (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"
 	       :dtstart " " :dtend "\n"
 	       :istart "@item\n" :iend "\n"
 	       :istart "@item\n" :iend "\n"
 	       :icount "@item\n"
 	       :icount "@item\n"

+ 106 - 64
lisp/org-taskjuggler.el

@@ -74,7 +74,7 @@
 ;; TaskJugglerUI.
 ;; TaskJugglerUI.
 ;;
 ;;
 ;; * Resources
 ;; * Resources
-;; 
+;;
 ;; Next you can define resources and assign those to work on specific
 ;; Next you can define resources and assign those to work on specific
 ;; tasks. You can group your resources hierarchically. Tag the top
 ;; tasks. You can group your resources hierarchically. Tag the top
 ;; node of the resources with "taskjuggler_resource" (or whatever you
 ;; node of the resources with "taskjuggler_resource" (or whatever you
@@ -107,7 +107,7 @@
 ;; etc for tasks.
 ;; etc for tasks.
 ;;
 ;;
 ;; * Dependencies
 ;; * Dependencies
-;; 
+;;
 ;; The exporter will handle dependencies that are defined in the tasks
 ;; The exporter will handle dependencies that are defined in the tasks
 ;; either with the ORDERED attribute (see TODO dependencies in the Org
 ;; either with the ORDERED attribute (see TODO dependencies in the Org
 ;; mode manual) or with the BLOCKER attribute (see org-depend.el) or
 ;; mode manual) or with the BLOCKER attribute (see org-depend.el) or
@@ -137,7 +137,7 @@
 ;;   :Effort:   2.0
 ;;   :Effort:   2.0
 ;;   :BLOCKER:  training_material { gapduration 1d } some_other_task
 ;;   :BLOCKER:  training_material { gapduration 1d } some_other_task
 ;;   :END:
 ;;   :END:
-;; 
+;;
 ;;;; * TODO
 ;;;; * TODO
 ;;   - Use SCHEDULED and DEADLINE information (not just start and end
 ;;   - Use SCHEDULED and DEADLINE information (not just start and end
 ;;     properties).
 ;;     properties).
@@ -181,6 +181,11 @@ resources for the project."
   :group 'org-export-taskjuggler
   :group 'org-export-taskjuggler
   :type 'string)
   :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"
 (defcustom org-export-taskjuggler-default-project-version "1.0"
   "Default version string for the project."
   "Default version string for the project."
   :group 'org-export-taskjuggler
   :group 'org-export-taskjuggler
@@ -193,7 +198,7 @@ with `org-export-taskjuggler-project-tag'"
   :group 'org-export-taskjuggler
   :group 'org-export-taskjuggler
   :type 'integer)
   :type 'integer)
 
 
-(defcustom org-export-taskjuggler-default-reports 
+(defcustom org-export-taskjuggler-default-reports
   '("taskreport \"Gantt Chart\" {
   '("taskreport \"Gantt Chart\" {
   headline \"Project Gantt Chart\"
   headline \"Project Gantt Chart\"
   columns hierarchindex, name, start, end, effort, duration, completed, chart
   columns hierarchindex, name, start, end, effort, duration, completed, chart
@@ -212,7 +217,7 @@ with `org-export-taskjuggler-project-tag'"
   :group 'org-export-taskjuggler
   :group 'org-export-taskjuggler
   :type '(repeat (string :tag "Report")))
   :type '(repeat (string :tag "Report")))
 
 
-(defcustom org-export-taskjuggler-default-global-properties 
+(defcustom org-export-taskjuggler-default-global-properties
   "shift s40 \"Part time shift\" {
   "shift s40 \"Part time shift\" {
   workinghours wed, thu, fri off
   workinghours wed, thu, fri off
 }
 }
@@ -221,7 +226,7 @@ with `org-export-taskjuggler-project-tag'"
 define global properties such as shifts, accounts, rates,
 define global properties such as shifts, accounts, rates,
 vacation, macros and flags. Any property that is allowed within
 vacation, macros and flags. Any property that is allowed within
 the TaskJuggler file can be inserted. You could for example
 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
 The global properties are inserted after the project declaration
 but before any resource and task declarations."
 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)
   (setq-default org-done-keywords org-done-keywords)
   (let* ((tasks
   (let* ((tasks
 	  (org-taskjuggler-resolve-dependencies
 	  (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
 	 (resources
 	  (org-taskjuggler-assign-resource-ids
 	  (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)))
 	    org-export-taskjuggler-resource-tag nil 'archive 'comment)))
 	 (filename (expand-file-name
 	 (filename (expand-file-name
 		    (concat
 		    (concat
@@ -278,9 +284,9 @@ defined in `org-export-taskjuggler-default-reports'."
       (error "No tasks specified"))
       (error "No tasks specified"))
     ;; add a default resource
     ;; add a default resource
     (unless resources
     (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)))))
 	       ("level" . 1)))))
     ;; add a default allocation to the first task if none was given
     ;; add a default allocation to the first task if none was given
     (unless (assoc "allocate" (car tasks))
     (unless (assoc "allocate" (car tasks))
@@ -331,6 +337,10 @@ with the TaskJuggler GUI."
 	 (command (concat process-name " " file-name)))
 	 (command (concat process-name " " file-name)))
     (start-process-shell-command process-name nil command)))
     (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 ()
 (defun org-taskjuggler-parent-is-ordered-p ()
   "Return true if the parent of the current node has a property
   "Return true if the parent of the current node has a property
 \"ORDERED\". Return nil otherwise."
 \"ORDERED\". Return nil otherwise."
@@ -344,7 +354,9 @@ information, all the properties, etc."
   (let* ((props (org-entry-properties))
   (let* ((props (org-entry-properties))
 	 (components (org-heading-components))
 	 (components (org-heading-components))
 	 (level (nth 1 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)))
 	 (parent-ordered (org-taskjuggler-parent-is-ordered-p)))
     (push (cons "level" level) props)
     (push (cons "level" level) props)
     (push (cons "headline" headline) props)
     (push (cons "headline" headline) props)
@@ -362,16 +374,16 @@ a path to the current task."
     (dolist (task tasks resolved-tasks)
     (dolist (task tasks resolved-tasks)
       (let ((level (cdr (assoc "level" task))))
       (let ((level (cdr (assoc "level" task))))
 	(cond
 	(cond
-	 ((< previous-level level) 
+	 ((< previous-level level)
 	  (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
 	  (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
 	  (dotimes (tmp (- level previous-level))
 	  (dotimes (tmp (- level previous-level))
 	    (push (list unique-id) unique-ids)
 	    (push (list unique-id) unique-ids)
 	    (push unique-id path)))
 	    (push unique-id path)))
-	 ((= previous-level level) 
+	 ((= previous-level level)
 	  (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
 	  (setq unique-id (org-taskjuggler-get-unique-id task (car unique-ids)))
 	  (push unique-id (car unique-ids))
 	  (push unique-id (car unique-ids))
 	  (setcar path unique-id))
 	  (setcar path unique-id))
-	 ((> previous-level level) 
+	 ((> previous-level level)
 	  (dotimes (tmp (- previous-level level))
 	  (dotimes (tmp (- previous-level level))
 	    (pop unique-ids)
 	    (pop unique-ids)
 	    (pop path))
 	    (pop path))
@@ -383,17 +395,37 @@ a path to the current task."
 	(setq previous-level level)
 	(setq previous-level level)
 	(setq resolved-tasks (append resolved-tasks (list task)))))))
 	(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
   "Given a list of resources return the same list, assigning a
 unique id to each resource."
 unique id to each resource."
   (cond
   (cond
    ((null resources) nil)
    ((null resources) nil)
-   (t 
+   (t
     (let* ((resource (car resources))
     (let* ((resource (car resources))
 	   (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
 	   (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
       (push (cons "unique-id" unique-id) resource)
       (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)))))))
 						 (cons unique-id unique-ids)))))))
 
 
 (defun org-taskjuggler-resolve-dependencies (tasks)
 (defun org-taskjuggler-resolve-dependencies (tasks)
@@ -405,24 +437,24 @@ unique id to each resource."
 	     (depends (cdr (assoc "depends" task)))
 	     (depends (cdr (assoc "depends" task)))
 	     (parent-ordered (cdr (assoc "parent-ordered" task)))
 	     (parent-ordered (cdr (assoc "parent-ordered" task)))
 	     (blocker (cdr (assoc "BLOCKER" task)))
 	     (blocker (cdr (assoc "BLOCKER" task)))
-	     (blocked-on-previous 
+	     (blocked-on-previous
 	      (and blocker (string-match "previous-sibling" blocker)))
 	      (and blocker (string-match "previous-sibling" blocker)))
 	     (dependencies
 	     (dependencies
 	      (org-taskjuggler-resolve-explicit-dependencies
 	      (org-taskjuggler-resolve-explicit-dependencies
-	       (append 
+	       (append
 		(and depends (org-taskjuggler-tokenize-dependencies depends))
 		(and depends (org-taskjuggler-tokenize-dependencies depends))
-		(and blocker (org-taskjuggler-tokenize-dependencies blocker))) 
+		(and blocker (org-taskjuggler-tokenize-dependencies blocker)))
 	       tasks))
 	       tasks))
 	      previous-sibling)
 	      previous-sibling)
 	; update previous sibling info
 	; update previous sibling info
 	(cond
 	(cond
-	 ((< previous-level level) 
+	 ((< previous-level level)
 	  (dotimes (tmp (- level previous-level))
 	  (dotimes (tmp (- level previous-level))
 	    (push task siblings)))
 	    (push task siblings)))
 	 ((= previous-level level)
 	 ((= previous-level level)
 	  (setq previous-sibling (car siblings))
 	  (setq previous-sibling (car siblings))
 	  (setcar siblings task))
 	  (setcar siblings task))
-	 ((> previous-level level) 
+	 ((> previous-level level)
 	  (dotimes (tmp (- previous-level level))
 	  (dotimes (tmp (- previous-level level))
 	    (pop siblings))
 	    (pop siblings))
 	  (setq previous-sibling (car 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)
 	(when (or (and previous-sibling parent-ordered) blocked-on-previous)
 	  (push (format "!%s" (cdr (assoc "unique-id" previous-sibling))) dependencies))
 	  (push (format "!%s" (cdr (assoc "unique-id" previous-sibling))) dependencies))
 	; store dependency information
 	; store dependency information
-	(when dependencies 
+	(when dependencies
 	  (push (cons "depends" (mapconcat 'identity dependencies ", ")) task))
 	  (push (cons "depends" (mapconcat 'identity dependencies ", ")) task))
 	(setq previous-level level)
 	(setq previous-level level)
 	(setq resolved-tasks (append resolved-tasks (list task)))))))
 	(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
 individual dependencies and return them as a list while keeping
 the optional arguments (such as gapduration) for the
 the optional arguments (such as gapduration) for the
 dependencies. A dependency will have to match `[-a-zA-Z0-9_]+'."
 dependencies. A dependency will have to match `[-a-zA-Z0-9_]+'."
-  (cond 
+  (cond
    ((string-match "^ *$" dependencies) nil)
    ((string-match "^ *$" dependencies) nil)
    ((string-match "^[ \t]*\\([-a-zA-Z0-9_]+\\([ \t]*{[^}]+}\\)?\\)[ \t,]*" dependencies)
    ((string-match "^[ \t]*\\([-a-zA-Z0-9_]+\\([ \t]*{[^}]+}\\)?\\)[ \t,]*" dependencies)
-    (cons 
+    (cons
      (substring dependencies (match-beginning 1) (match-end 1))
      (substring dependencies (match-beginning 1) (match-end 1))
      (org-taskjuggler-tokenize-dependencies (substring dependencies (match-end 0)))))
      (org-taskjuggler-tokenize-dependencies (substring dependencies (match-end 0)))))
    (t (error (format "invalid dependency id %s" dependencies)))))
    (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
 `org-taskjuggler-resolve-dependencies'). If there is no matching
 task the dependency is ignored and a warning is displayed ."
 task the dependency is ignored and a warning is displayed ."
   (unless (null dependencies)
   (unless (null dependencies)
-    (let* 
+    (let*
 	;; the dependency might have optional attributes such as "{
 	;; the dependency might have optional attributes such as "{
 	;; gapduration 5d }", so only use the first string as id for the
 	;; gapduration 5d }", so only use the first string as id for the
 	;; dependency
 	;; dependency
 	((dependency (car dependencies))
 	((dependency (car dependencies))
 	 (id (car (split-string dependency)))
 	 (id (car (split-string dependency)))
-	 (optional-attributes 
+	 (optional-attributes
 	  (mapconcat 'identity (cdr (split-string dependency)) " "))
 	  (mapconcat 'identity (cdr (split-string dependency)) " "))
 	 (path (org-taskjuggler-find-task-with-id id tasks)))
 	 (path (org-taskjuggler-find-task-with-id id tasks)))
-      (cond 
+      (cond
        ;; ignore previous sibling dependencies
        ;; ignore previous sibling dependencies
        ((equal (car dependencies) "previous-sibling")
        ((equal (car dependencies) "previous-sibling")
 	(org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))
 	(org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))
        ;; if the id is found in another task use its path
        ;; if the id is found in another task use its path
-       ((not (null path)) 
+       ((not (null path))
 	(cons (mapconcat 'identity (list path optional-attributes) " ")
 	(cons (mapconcat 'identity (list path optional-attributes) " ")
-	      (org-taskjuggler-resolve-explicit-dependencies 
+	      (org-taskjuggler-resolve-explicit-dependencies
 	       (cdr dependencies) tasks)))
 	       (cdr dependencies) tasks)))
        ;; warn about dangling dependency but otherwise ignore it
        ;; 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))
 	   (format "No task with matching property \"task_id\" found for id %s" id))
 	  (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))))))
 	  (org-taskjuggler-resolve-explicit-dependencies (cdr dependencies) tasks))))))
 
 
@@ -488,7 +520,7 @@ task the dependency is ignored and a warning is displayed ."
 return nil."
 return nil."
   (let ((task-id (cdr (assoc "task_id" (car tasks))))
   (let ((task-id (cdr (assoc "task_id" (car tasks))))
 	(path (cdr (assoc "path" (car tasks)))))
 	(path (cdr (assoc "path" (car tasks)))))
-    (cond 
+    (cond
      ((null tasks) nil)
      ((null tasks) nil)
      ((equal task-id id) path)
      ((equal task-id id) path)
      (t (org-taskjuggler-find-task-with-id id (cdr tasks))))))
      (t (org-taskjuggler-find-task-with-id id (cdr tasks))))))
@@ -509,7 +541,7 @@ finally add more underscore characters (\"_\")."
     (while (member id unique-ids)
     (while (member id unique-ids)
       (setq id (concat id "_")))
       (setq id (concat id "_")))
     id))
     id))
-	
+
 (defun org-taskjuggler-clean-id (id)
 (defun org-taskjuggler-clean-id (id)
   "Clean and return ID to make it acceptable for taskjuggler."
   "Clean and return ID to make it acceptable for taskjuggler."
   (and id (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" id)))
   (and id (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" id)))
@@ -524,7 +556,7 @@ specified it is calculated
 	(version (cdr (assoc "version" project)))
 	(version (cdr (assoc "version" project)))
 	(start (cdr (assoc "start" project)))
 	(start (cdr (assoc "start" project)))
 	(end (cdr (assoc "end" project))))
 	(end (cdr (assoc "end" project))))
-    (insert 
+    (insert
      (format "project %s \"%s\" \"%s\" %s +%sd {\n }\n"
      (format "project %s \"%s\" \"%s\" %s +%sd {\n }\n"
 	     unique-id headline version start
 	     unique-id headline version start
 	     org-export-taskjuggler-default-project-duration))))
 	     org-export-taskjuggler-default-project-duration))))
@@ -534,16 +566,16 @@ specified it is calculated
 with separator \"\n\"."
 with separator \"\n\"."
   (let ((filtered-items (remq nil items)))
   (let ((filtered-items (remq nil items)))
     (and filtered-items (mapconcat 'identity filtered-items "\n"))))
     (and filtered-items (mapconcat 'identity filtered-items "\n"))))
-  
+
 (defun org-taskjuggler-get-attributes (item attributes)
 (defun org-taskjuggler-get-attributes (item attributes)
   "Return all attribute as a single formated string. ITEM is an
   "Return all attribute as a single formated string. ITEM is an
 alist representing either a resource or a task. ATTRIBUTES is a
 alist representing either a resource or a task. ATTRIBUTES is a
 list of symbols. Only entries from ITEM are considered that are
 list of symbols. Only entries from ITEM are considered that are
 listed in ATTRIBUTES."
 listed in ATTRIBUTES."
-  (org-taskjuggler-filter-and-join 
+  (org-taskjuggler-filter-and-join
    (mapcar
    (mapcar
-    (lambda (attribute) 
-      (org-taskjuggler-filter-and-join 
+    (lambda (attribute)
+      (org-taskjuggler-filter-and-join
        (org-taskjuggler-get-attribute item attribute)))
        (org-taskjuggler-get-attribute item attribute)))
     attributes)))
     attributes)))
 
 
@@ -551,7 +583,7 @@ listed in ATTRIBUTES."
   "Return a list of strings containing the properly formatted
   "Return a list of strings containing the properly formatted
 taskjuggler declaration for a given ATTRIBUTE in ITEM (an alist).
 taskjuggler declaration for a given ATTRIBUTE in ITEM (an alist).
 If the ATTRIBUTE is not in ITEM return nil."
 If the ATTRIBUTE is not in ITEM return nil."
-  (cond 
+  (cond
    ((null item) nil)
    ((null item) nil)
    ((equal (symbol-name attribute) (car (car item)))
    ((equal (symbol-name attribute) (car (car item)))
     (cons (format "%s %s" (symbol-name attribute) (cdr (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
 this resource. Otherwise it will use the ID property. If neither
 is defined it will calculate a unique id for the resource using
 is defined it will calculate a unique id for the resource using
 `org-taskjuggler-get-unique-id'."
 `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)))))
 		 (cdr (assoc "unique-id" resource)))))
 	(headline (cdr (assoc "headline" resource)))
 	(headline (cdr (assoc "headline" resource)))
 	(attributes '(limits vacation shift booking efficiency journalentry rate)))
 	(attributes '(limits vacation shift booking efficiency journalentry rate)))
-    (insert 
-     (concat 
+    (insert
+     (concat
       "resource " id " \"" headline "\" {\n "
       "resource " id " \"" headline "\" {\n "
       (org-taskjuggler-get-attributes resource attributes) "\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
 days and will be translated into 3.0d. Other formats that
 taskjuggler supports (like weeks, months and years) are currently
 taskjuggler supports (like weeks, months and years) are currently
 not supported."
 not supported."
-  (cond 
+  (cond
    ((null effort) effort)
    ((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)))
     (let ((hours (string-to-number (match-string 1 effort)))
 	  (minutes (string-to-number (match-string 2 effort))))
 	  (minutes (string-to-number (match-string 2 effort))))
       (format "%dh" (+ hours (/ minutes 60.0)))))
       (format "%dh" (+ hours (/ minutes 60.0)))))
@@ -596,7 +628,7 @@ not supported."
 (defun org-taskjuggler-get-priority (priority)
 (defun org-taskjuggler-get-priority (priority)
   "Return a priority between 1 and 1000 based on PRIORITY, an
   "Return a priority between 1 and 1000 based on PRIORITY, an
 org-mode priority string."
 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))))
 	    (- org-lowest-priority org-highest-priority))))
 
 
 (defun org-taskjuggler-open-task (task)
 (defun org-taskjuggler-open-task (task)
@@ -608,31 +640,41 @@ org-mode priority string."
 	(priority-raw (cdr (assoc "PRIORITY" task)))
 	(priority-raw (cdr (assoc "PRIORITY" task)))
 	(priority (and priority-raw (org-taskjuggler-get-priority priority-raw)))
 	(priority (and priority-raw (org-taskjuggler-get-priority priority-raw)))
 	(state (cdr (assoc "TODO" task)))
 	(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))))
 		      (cdr (assoc "complete" task))))
 	(parent-ordered (cdr (assoc "parent-ordered" task)))
 	(parent-ordered (cdr (assoc "parent-ordered" task)))
 	(previous-sibling (cdr (assoc "previous-sibling" 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
 	 '(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
     (insert
-     (concat 
-      "task " unique-id " \"" headline "\" {\n" 
+     (concat
+      "task " unique-id " \"" headline "\" {\n"
       (if (and parent-ordered previous-sibling)
       (if (and parent-ordered previous-sibling)
 	  (format " depends %s\n" previous-sibling)
 	  (format " depends %s\n" previous-sibling)
 	(and depends (format " depends %s\n" depends)))
 	(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 complete (format " complete %s\n" complete))
       (and effort (format " effort %s\n" effort))
       (and effort (format " effort %s\n" effort))
       (and priority (format " priority %s\n" priority))
       (and priority (format " priority %s\n" priority))
-      
+      (and milestone (format " milestone\n"))
+
       (org-taskjuggler-get-attributes task attributes)
       (org-taskjuggler-get-attributes task attributes)
       "\n"))))
       "\n"))))
 
 
 (defun org-taskjuggler-close-maybe (level)
 (defun org-taskjuggler-close-maybe (level)
-  (while (> org-export-taskjuggler-old-level level) 
+  (while (> org-export-taskjuggler-old-level level)
     (insert "}\n")
     (insert "}\n")
     (setq org-export-taskjuggler-old-level (1- org-export-taskjuggler-old-level)))
     (setq org-export-taskjuggler-old-level (1- org-export-taskjuggler-old-level)))
   (when (= org-export-taskjuggler-old-level level)
   (when (= org-export-taskjuggler-old-level level)

+ 3 - 3
lisp/org.el

@@ -9019,7 +9019,7 @@ from."
        (let ((ido-enter-matching-directory nil))
        (let ((ido-enter-matching-directory nil))
 	 (apply 'ido-completing-read (concat (car args))
 	 (apply 'ido-completing-read (concat (car args))
 		(if (consp (car (nth 1 args)))
 		(if (consp (car (nth 1 args)))
-		    (mapcar (lambda (x) (car x)) (nth 1 args))
+		    (mapcar 'car (nth 1 args))
 		  (nth 1 args))
 		  (nth 1 args))
 		(cddr args)))
 		(cddr args)))
      (if (and org-completion-use-iswitchb
      (if (and org-completion-use-iswitchb
@@ -9027,7 +9027,7 @@ from."
 	      (listp (second args)))
 	      (listp (second args)))
 	 (apply 'org-iswitchb-completing-read (concat (car args))
 	 (apply 'org-iswitchb-completing-read (concat (car args))
 		(if (consp (car (nth 1 args)))
 		(if (consp (car (nth 1 args)))
-		    (mapcar (lambda (x) (car x)) (nth 1 args))
+		    (mapcar 'car (nth 1 args))
 		  (nth 1 args))
 		  (nth 1 args))
 		(cddr args))
 		(cddr args))
        (apply 'completing-read args)))))
        (apply 'completing-read args)))))
@@ -12551,7 +12551,7 @@ instead of the agenda files."
 		     (org-agenda-files))))))))
 		     (org-agenda-files))))))))
 
 
 (defun org-make-tags-matcher (match)
 (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
   ;; todo-only is scoped dynamically into this function, and the function
   ;; may change it if the matcher asks for it.
   ;; may change it if the matcher asks for it.
   (unless match
   (unless match