瀏覽代碼

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

David Arroyo Menendez 11 年之前
父節點
當前提交
2de63285fe

+ 4 - 0
contrib/lisp/org-colview-xemacs.el

@@ -477,6 +477,7 @@ This is the compiled version of the format.")
 (defvar org-colview-initial-truncate-line-value nil
 (defvar org-colview-initial-truncate-line-value nil
   "Remember the value of `truncate-lines' across colview.")
   "Remember the value of `truncate-lines' across colview.")
 
 
+;;;###autoload
 (defun org-columns-remove-overlays ()
 (defun org-columns-remove-overlays ()
   "Remove all currently active column overlays."
   "Remove all currently active column overlays."
   (interactive)
   (interactive)
@@ -820,6 +821,7 @@ around it."
   (let ((value (get-char-property (point) 'org-columns-value)))
   (let ((value (get-char-property (point) 'org-columns-value)))
     (org-open-link-from-string value arg)))
     (org-open-link-from-string value arg)))
 
 
+;;;###autoload
 (defun org-columns-get-format-and-top-level ()
 (defun org-columns-get-format-and-top-level ()
   (let (fmt)
   (let (fmt)
     (when (condition-case nil (org-back-to-heading) (error nil))
     (when (condition-case nil (org-back-to-heading) (error nil))
@@ -1091,6 +1093,7 @@ Don't set this, this is meant for dynamic scoping.")
                     (org-overlay-display ov (format fmt val))))))
                     (org-overlay-display ov (format fmt val))))))
 	    org-columns-overlays))))
 	    org-columns-overlays))))
 
 
+;;;###autoload
 (defun org-columns-compute (property)
 (defun org-columns-compute (property)
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   (interactive)
   (interactive)
@@ -1187,6 +1190,7 @@ Don't set this, this is meant for dynamic scoping.")
 	(setq sum (+ (string-to-number (pop l)) (/ sum 60))))
 	(setq sum (+ (string-to-number (pop l)) (/ sum 60))))
       sum)))
       sum)))
 
 
+;;;###autoload
 (defun org-columns-number-to-string (n fmt &optional printf)
 (defun org-columns-number-to-string (n fmt &optional printf)
   "Convert a computed column number to a string value, according to FMT."
   "Convert a computed column number to a string value, according to FMT."
   (cond
   (cond

+ 2 - 0
lisp/ob-C.el

@@ -32,6 +32,8 @@
 ;;; Code:
 ;;; Code:
 (require 'ob)
 (require 'ob)
 (require 'cc-mode)
 (require 'cc-mode)
+(eval-when-compile
+  (require 'cl))
 
 
 (declare-function org-entry-get "org"
 (declare-function org-entry-get "org"
 		  (pom property &optional inherit literal-nil))
 		  (pom property &optional inherit literal-nil))

+ 2 - 0
lisp/ob-clojure.el

@@ -45,6 +45,8 @@
 
 
 ;;; Code:
 ;;; Code:
 (require 'ob)
 (require 'ob)
+(eval-when-compile
+  (require 'cl))
 
 
 (declare-function cider-current-ns "ext:cider-interaction" ())
 (declare-function cider-current-ns "ext:cider-interaction" ())
 (declare-function nrepl-send-string-sync "ext:nrepl-client" (input &optional ns session))
 (declare-function nrepl-send-string-sync "ext:nrepl-client" (input &optional ns session))

+ 2 - 4
lisp/ob-python.el

@@ -47,15 +47,13 @@
   :group 'org-babel
   :group 'org-babel
   :type 'string)
   :type 'string)
 
 
-(defcustom org-babel-python-mode 'python
+(defcustom org-babel-python-mode
+  (if (or (featurep 'xemacs) (featurep 'python-mode)) 'python-mode 'python)
   "Preferred python mode for use in running python interactively.
   "Preferred python mode for use in running python interactively.
 This will typically be either 'python or 'python-mode."
 This will typically be either 'python or 'python-mode."
   :group 'org-babel
   :group 'org-babel
   :version "24.4"
   :version "24.4"
   :package-version '(Org . "8.0")
   :package-version '(Org . "8.0")
-  :set (lambda (var val)
-	 (set-default var (if (or (featurep 'xemacs) (featurep 'python-mode))
-			      'python-mode 'python)))
   :type 'symbol)
   :type 'symbol)
 
 
 (defvar org-src-preserve-indentation)
 (defvar org-src-preserve-indentation)

+ 0 - 2
lisp/ob-tangle.el

@@ -27,8 +27,6 @@
 
 
 ;;; Code:
 ;;; Code:
 (require 'org-src)
 (require 'org-src)
-(eval-when-compile
-  (require 'cl))
 
 
 (declare-function org-edit-special "org" (&optional arg))
 (declare-function org-edit-special "org" (&optional arg))
 (declare-function org-link-escape "org" (text &optional table))
 (declare-function org-link-escape "org" (text &optional table))

+ 2 - 0
lisp/org-agenda.el

@@ -69,6 +69,7 @@
 (declare-function calendar-persian-date-string  "cal-persia" (&optional date))
 (declare-function calendar-persian-date-string  "cal-persia" (&optional date))
 (declare-function calendar-check-holidays       "holidays" (date))
 (declare-function calendar-check-holidays       "holidays" (date))
 
 
+(declare-function org-columns-remove-overlays "org-colview" ())
 (declare-function org-datetree-find-date-create "org-datetree"
 (declare-function org-datetree-find-date-create "org-datetree"
 		  (date &optional keep-restriction))
 		  (date &optional keep-restriction))
 (declare-function org-columns-quit              "org-colview" ())
 (declare-function org-columns-quit              "org-colview" ())
@@ -5452,6 +5453,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 	(>= days n)
 	(>= days n)
       (<= days n))))
       (<= days n))))
 
 
+;;;###autoload
 (defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
 (defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
   (&optional end)
   (&optional end)
   "Do we have a reason to ignore this TODO entry because it has a time stamp?"
   "Do we have a reason to ignore this TODO entry because it has a time stamp?"

+ 1 - 0
lisp/org-archive.el

@@ -135,6 +135,7 @@ information."
 	  (match-string 1))
 	  (match-string 1))
 	 (t org-archive-location))))))
 	 (t org-archive-location))))))
 
 
+;;;###autoload
 (defun org-add-archive-files (files)
 (defun org-add-archive-files (files)
   "Splice the archive files into the list of files.
   "Splice the archive files into the list of files.
 This implies visiting all these files and finding out what the
 This implies visiting all these files and finding out what the

+ 3 - 0
lisp/org-clock.el

@@ -1873,6 +1873,7 @@ will be easy to remove."
       (overlay-put ov 'end-glyph (make-glyph tx)))
       (overlay-put ov 'end-glyph (make-glyph tx)))
     (push ov org-clock-overlays)))
     (push ov org-clock-overlays)))
 
 
+;;;###autoload
 (defun org-clock-remove-overlays (&optional beg end noremove)
 (defun org-clock-remove-overlays (&optional beg end noremove)
   "Remove the occur highlights from the buffer.
   "Remove the occur highlights from the buffer.
 BEG and END are ignored.  If NOREMOVE is nil, remove this function
 BEG and END are ignored.  If NOREMOVE is nil, remove this function
@@ -2145,6 +2146,7 @@ If you can combine both, the month starting day will have priority."
    ((= n 3) "3rd")
    ((= n 3) "3rd")
    ((= n 4) "4th")))
    ((= n 4) "4th")))
 
 
+;;;###autoload
 (defun org-clocktable-shift (dir n)
 (defun org-clocktable-shift (dir n)
   "Try to shift the :block date of the clocktable at point.
   "Try to shift the :block date of the clocktable at point.
 Point must be in the #+BEGIN: line of a clocktable, or this function
 Point must be in the #+BEGIN: line of a clocktable, or this function
@@ -2754,6 +2756,7 @@ This function is made for clock tables."
 (defvar org-clock-loaded nil
 (defvar org-clock-loaded nil
   "Was the clock file loaded?")
   "Was the clock file loaded?")
 
 
+;;;###autoload
 (defun org-clock-update-time-maybe ()
 (defun org-clock-update-time-maybe ()
   "If this is a CLOCK line, update it and return t.
   "If this is a CLOCK line, update it and return t.
 Otherwise, return nil."
 Otherwise, return nil."

+ 5 - 0
lisp/org-colview.el

@@ -323,6 +323,7 @@ for the duration of the command.")
 (defvar org-colview-initial-truncate-line-value nil
 (defvar org-colview-initial-truncate-line-value nil
   "Remember the value of `truncate-lines' across colview.")
   "Remember the value of `truncate-lines' across colview.")
 
 
+;;;###autoload
 (defun org-columns-remove-overlays ()
 (defun org-columns-remove-overlays ()
   "Remove all currently active column overlays."
   "Remove all currently active column overlays."
   (interactive)
   (interactive)
@@ -670,6 +671,7 @@ around it."
   (let ((value (get-char-property (point) 'org-columns-value)))
   (let ((value (get-char-property (point) 'org-columns-value)))
     (org-open-link-from-string value arg)))
     (org-open-link-from-string value arg)))
 
 
+;;;###autoload
 (defun org-columns-get-format-and-top-level ()
 (defun org-columns-get-format-and-top-level ()
   (let ((fmt (org-columns-get-format)))
   (let ((fmt (org-columns-get-format)))
     (org-columns-goto-top-level)
     (org-columns-goto-top-level)
@@ -951,6 +953,8 @@ display, or in the #+COLUMNS line of the current buffer."
 
 
 (defvar org-inlinetask-min-level
 (defvar org-inlinetask-min-level
   (if (featurep 'org-inlinetask) org-inlinetask-min-level 15))
   (if (featurep 'org-inlinetask) org-inlinetask-min-level 15))
+
+;;;###autoload
 (defun org-columns-compute (property)
 (defun org-columns-compute (property)
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   (interactive)
   (interactive)
@@ -1054,6 +1058,7 @@ display, or in the #+COLUMNS line of the current buffer."
 	(setq sum (+ (string-to-number (pop l)) (/ sum 60))))
 	(setq sum (+ (string-to-number (pop l)) (/ sum 60))))
       sum)))
       sum)))
 
 
+;;;###autoload
 (defun org-columns-number-to-string (n fmt &optional printf)
 (defun org-columns-number-to-string (n fmt &optional printf)
   "Convert a computed column number to a string value, according to FMT."
   "Convert a computed column number to a string value, according to FMT."
   (cond
   (cond

+ 3 - 5
lisp/org-docview.el

@@ -44,12 +44,10 @@
 
 
 
 
 (require 'org)
 (require 'org)
+(require 'doc-view)
 
 
-(declare-function doc-view-goto-page "ext:doc-view" (page))
-(declare-function image-mode-window-get "ext:image-mode"
-		  (prop &optional winprops))
-
-(org-autoload "doc-view" '(doc-view-goto-page))
+(declare-function doc-view-goto-page "doc-view" (page))
+(declare-function image-mode-window-get "image-mode" (prop &optional winprops))
 
 
 (org-add-link-type "docview" 'org-docview-open 'org-docview-export)
 (org-add-link-type "docview" 'org-docview-open 'org-docview-export)
 (add-hook 'org-store-link-functions 'org-docview-store-link)
 (add-hook 'org-store-link-functions 'org-docview-store-link)

+ 116 - 119
lisp/org-element.el

@@ -3550,100 +3550,97 @@ Assume point is at the beginning of the timestamp."
 (defun org-element-timestamp-interpreter (timestamp contents)
 (defun org-element-timestamp-interpreter (timestamp contents)
   "Interpret TIMESTAMP object as Org syntax.
   "Interpret TIMESTAMP object as Org syntax.
 CONTENTS is nil."
 CONTENTS is nil."
-  ;; Use `:raw-value' if specified.
-  (or (org-element-property :raw-value timestamp)
-      ;; Otherwise, build timestamp string.
-      (let* ((repeat-string
-	      (concat
-	       (case (org-element-property :repeater-type timestamp)
-		 (cumulate "+") (catch-up "++") (restart ".+"))
-	       (let ((val (org-element-property :repeater-value timestamp)))
-		 (and val (number-to-string val)))
-	       (case (org-element-property :repeater-unit timestamp)
-		 (hour "h") (day "d") (week "w") (month "m") (year "y"))))
-	     (warning-string
-	      (concat
-	       (case (org-element-property :warning-type timestamp)
-		 (first "--")
-		 (all "-"))
-	       (let ((val (org-element-property :warning-value timestamp)))
-		 (and val (number-to-string val)))
-	       (case (org-element-property :warning-unit timestamp)
-		 (hour "h") (day "d") (week "w") (month "m") (year "y"))))
-	     (build-ts-string
-	      ;; Build an Org timestamp string from TIME.  ACTIVEP is
-	      ;; non-nil when time stamp is active.  If WITH-TIME-P is
-	      ;; non-nil, add a time part.  HOUR-END and MINUTE-END
-	      ;; specify a time range in the timestamp.  REPEAT-STRING
-	      ;; is the repeater string, if any.
-	      (lambda (time activep &optional with-time-p hour-end minute-end)
-		(let ((ts (format-time-string
-			   (funcall (if with-time-p 'cdr 'car)
-				    org-time-stamp-formats)
-			   time)))
-		  (when (and hour-end minute-end)
-		    (string-match "[012]?[0-9]:[0-5][0-9]" ts)
-		    (setq ts
-			  (replace-match
-			   (format "\\&-%02d:%02d" hour-end minute-end)
-			   nil nil ts)))
-		  (unless activep (setq ts (format "[%s]" (substring ts 1 -1))))
-		  (dolist (s (list repeat-string warning-string))
-		    (when (org-string-nw-p s)
-		      (setq ts (concat (substring ts 0 -1)
-				       " "
-				       s
-				       (substring ts -1)))))
-		  ;; Return value.
-		  ts)))
-	     (type (org-element-property :type timestamp)))
-	(case type
-	  ((active inactive)
-	   (let* ((minute-start (org-element-property :minute-start timestamp))
-		  (minute-end (org-element-property :minute-end timestamp))
-		  (hour-start (org-element-property :hour-start timestamp))
-		  (hour-end (org-element-property :hour-end timestamp))
-		  (time-range-p (and hour-start hour-end minute-start minute-end
-				     (or (/= hour-start hour-end)
-					 (/= minute-start minute-end)))))
-	     (funcall
-	      build-ts-string
-	      (encode-time 0
-			   (or minute-start 0)
-			   (or hour-start 0)
-			   (org-element-property :day-start timestamp)
-			   (org-element-property :month-start timestamp)
-			   (org-element-property :year-start timestamp))
-	      (eq type 'active)
-	      (and hour-start minute-start)
-	      (and time-range-p hour-end)
-	      (and time-range-p minute-end))))
-	  ((active-range inactive-range)
-	   (let ((minute-start (org-element-property :minute-start timestamp))
-		 (minute-end (org-element-property :minute-end timestamp))
-		 (hour-start (org-element-property :hour-start timestamp))
-		 (hour-end (org-element-property :hour-end timestamp)))
-	     (concat
-	      (funcall
-	       build-ts-string (encode-time
-				0
-				(or minute-start 0)
-				(or hour-start 0)
-				(org-element-property :day-start timestamp)
-				(org-element-property :month-start timestamp)
-				(org-element-property :year-start timestamp))
-	       (eq type 'active-range)
-	       (and hour-start minute-start))
-	      "--"
-	      (funcall build-ts-string
-		       (encode-time 0
-				    (or minute-end 0)
-				    (or hour-end 0)
-				    (org-element-property :day-end timestamp)
-				    (org-element-property :month-end timestamp)
-				    (org-element-property :year-end timestamp))
-		       (eq type 'active-range)
-		       (and hour-end minute-end)))))))))
+  (let* ((repeat-string
+	  (concat
+	   (case (org-element-property :repeater-type timestamp)
+	     (cumulate "+") (catch-up "++") (restart ".+"))
+	   (let ((val (org-element-property :repeater-value timestamp)))
+	     (and val (number-to-string val)))
+	   (case (org-element-property :repeater-unit timestamp)
+	     (hour "h") (day "d") (week "w") (month "m") (year "y"))))
+	 (warning-string
+	  (concat
+	   (case (org-element-property :warning-type timestamp)
+	     (first "--")
+	     (all "-"))
+	   (let ((val (org-element-property :warning-value timestamp)))
+	     (and val (number-to-string val)))
+	   (case (org-element-property :warning-unit timestamp)
+	     (hour "h") (day "d") (week "w") (month "m") (year "y"))))
+	 (build-ts-string
+	  ;; Build an Org timestamp string from TIME.  ACTIVEP is
+	  ;; non-nil when time stamp is active.  If WITH-TIME-P is
+	  ;; non-nil, add a time part.  HOUR-END and MINUTE-END
+	  ;; specify a time range in the timestamp.  REPEAT-STRING is
+	  ;; the repeater string, if any.
+	  (lambda (time activep &optional with-time-p hour-end minute-end)
+	    (let ((ts (format-time-string
+		       (funcall (if with-time-p 'cdr 'car)
+				org-time-stamp-formats)
+		       time)))
+	      (when (and hour-end minute-end)
+		(string-match "[012]?[0-9]:[0-5][0-9]" ts)
+		(setq ts
+		      (replace-match
+		       (format "\\&-%02d:%02d" hour-end minute-end)
+		       nil nil ts)))
+	      (unless activep (setq ts (format "[%s]" (substring ts 1 -1))))
+	      (dolist (s (list repeat-string warning-string))
+		(when (org-string-nw-p s)
+		  (setq ts (concat (substring ts 0 -1)
+				   " "
+				   s
+				   (substring ts -1)))))
+	      ;; Return value.
+	      ts)))
+	 (type (org-element-property :type timestamp)))
+    (case type
+      ((active inactive)
+       (let* ((minute-start (org-element-property :minute-start timestamp))
+	      (minute-end (org-element-property :minute-end timestamp))
+	      (hour-start (org-element-property :hour-start timestamp))
+	      (hour-end (org-element-property :hour-end timestamp))
+	      (time-range-p (and hour-start hour-end minute-start minute-end
+				 (or (/= hour-start hour-end)
+				     (/= minute-start minute-end)))))
+	 (funcall
+	  build-ts-string
+	  (encode-time 0
+		       (or minute-start 0)
+		       (or hour-start 0)
+		       (org-element-property :day-start timestamp)
+		       (org-element-property :month-start timestamp)
+		       (org-element-property :year-start timestamp))
+	  (eq type 'active)
+	  (and hour-start minute-start)
+	  (and time-range-p hour-end)
+	  (and time-range-p minute-end))))
+      ((active-range inactive-range)
+       (let ((minute-start (org-element-property :minute-start timestamp))
+	     (minute-end (org-element-property :minute-end timestamp))
+	     (hour-start (org-element-property :hour-start timestamp))
+	     (hour-end (org-element-property :hour-end timestamp)))
+	 (concat
+	  (funcall
+	   build-ts-string (encode-time
+			    0
+			    (or minute-start 0)
+			    (or hour-start 0)
+			    (org-element-property :day-start timestamp)
+			    (org-element-property :month-start timestamp)
+			    (org-element-property :year-start timestamp))
+	   (eq type 'active-range)
+	   (and hour-start minute-start))
+	  "--"
+	  (funcall build-ts-string
+		   (encode-time 0
+				(or minute-end 0)
+				(or hour-end 0)
+				(org-element-property :day-end timestamp)
+				(org-element-property :month-end timestamp)
+				(org-element-property :year-end timestamp))
+		   (eq type 'active-range)
+		   (and hour-end minute-end))))))))
 
 
 (defun org-element-timestamp-successor ()
 (defun org-element-timestamp-successor ()
   "Search for the next timestamp object.
   "Search for the next timestamp object.
@@ -4810,7 +4807,7 @@ the value to store.  Nothing will be stored if
     (unless org-element--cache (org-element-cache-reset))
     (unless org-element--cache (org-element-cache-reset))
     (puthash pos data org-element--cache)))
     (puthash pos data org-element--cache)))
 
 
-(defsubst org-element--shift-positions (element offset)
+(defsubst org-element--cache-shift-positions (element offset)
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
 Properties containing buffer positions are `:begin', `:end',
 Properties containing buffer positions are `:begin', `:end',
 `:contents-begin', `:contents-end' and `:structure'.  They are
 `:contents-begin', `:contents-end' and `:structure'.  They are
@@ -4819,12 +4816,12 @@ modified by side-effect.  Return modified element."
     ;; Shift :structure property for the first plain list only: it is
     ;; Shift :structure property for the first plain list only: it is
     ;; the only one that really matters and it prevents from shifting
     ;; the only one that really matters and it prevents from shifting
     ;; it more than once.
     ;; it more than once.
-    (when (eq (car element) 'plain-list)
-      (let ((structure (plist-get properties :structure)))
-	(when (<= (plist-get properties :begin) (caar structure))
-	  (dolist (item structure)
-	    (incf (car item) offset)
-	    (incf (nth 6 item) offset)))))
+    (when (and (eq (org-element-type element) 'plain-list)
+	       (not (eq (org-element-type (plist-get properties :parent))
+			'item)))
+      (dolist (item (plist-get properties :structure))
+	(incf (car item) offset)
+	(incf (nth 6 item) offset)))
     (plist-put properties :begin (+ (plist-get properties :begin) offset))
     (plist-put properties :begin (+ (plist-get properties :begin) offset))
     (plist-put properties :end (+ (plist-get properties :end) offset))
     (plist-put properties :end (+ (plist-get properties :end) offset))
     (dolist (key '(:contents-begin :contents-end :post-affiliated))
     (dolist (key '(:contents-begin :contents-end :post-affiliated))
@@ -4996,14 +4993,14 @@ removed from the cache."
 		   (let* ((conflictp (consp (caar value)))
 		   (let* ((conflictp (consp (caar value)))
 			  (value-to-shift (if conflictp (cdr value) value)))
 			  (value-to-shift (if conflictp (cdr value) value)))
 		     ;; Shift element part.
 		     ;; Shift element part.
-		     (org-element--shift-positions (car value-to-shift) offset)
+		     (org-element--cache-shift-positions (car value-to-shift) offset)
 		     ;; Shift objects part.
 		     ;; Shift objects part.
 		     (dolist (object-data (cdr value-to-shift))
 		     (dolist (object-data (cdr value-to-shift))
 		       (incf (car object-data) offset)
 		       (incf (car object-data) offset)
 		       (dolist (successor (nth 1 object-data))
 		       (dolist (successor (nth 1 object-data))
 			 (incf (cdr successor) offset))
 			 (incf (cdr successor) offset))
 		       (dolist (object (cddr object-data))
 		       (dolist (object (cddr object-data))
-			 (org-element--shift-positions object offset)))
+			 (org-element--cache-shift-positions object offset)))
 		     ;; Shift key-value pair.
 		     ;; Shift key-value pair.
 		     (let* ((new-key (+ key offset))
 		     (let* ((new-key (+ key offset))
 			    (new-value (gethash new-key org-element--cache)))
 			    (new-value (gethash new-key org-element--cache)))
@@ -5038,22 +5035,22 @@ removed from the cache."
 		;; Preserve any element ending before BEG.  If it
 		;; Preserve any element ending before BEG.  If it
 		;; overlaps the BEG-END area, remove it.
 		;; overlaps the BEG-END area, remove it.
 		(t
 		(t
-		 (when (let ((element (car value)))
-			 (or (>= (org-element-property :end element) beg)
-			     ;; Special case: footnote definitions and
-			     ;; plain lists can end with blank lines.
-			     ;; Modifying those can also alter last
-			     ;; element inside.  We must therefore
-			     ;; remove these elements from cache.
-			     (let ((parent
-				    (org-element-property :parent element)))
-			       (and (memq (org-element-type parent)
-					  '(footnote-definition plain-list))
-				    (>= (org-element-property :end parent) beg)
-				    (= (org-element-property :contents-end
-							     parent)
-				       (org-element-property :end element))))))
-		   (remhash key org-element--cache)))))
+		 (let ((element (car value)))
+		   (if (>= (org-element-property :end element) beg)
+		       (remhash key org-element--cache)
+		     ;; Special case: footnote definitions and plain
+		     ;; lists can end with blank lines.  Modifying
+		     ;; those can also alter last element inside.  We
+		     ;; must therefore remove them from cache.
+		     (let ((parent (org-element-property :parent element)))
+		       (when (and parent (eq (org-element-type parent) 'item))
+			 (setq parent (org-element-property :parent parent)))
+		       (when (and (memq (org-element-type parent)
+					'(footnote-definition plain-list))
+				  (>= (org-element-property :end parent) beg)
+				  (= (org-element-property :contents-end parent)
+				     (org-element-property :end element)))
+			 (remhash key org-element--cache))))))))
 	   org-element--cache)
 	   org-element--cache)
 	  ;; Signal cache as up-to-date.
 	  ;; Signal cache as up-to-date.
 	  (org-element--cache-cancel-changes))))))
 	  (org-element--cache-cancel-changes))))))

+ 4 - 0
lisp/org-id.el

@@ -233,6 +233,7 @@ With optional argument FORCE, force the creation of a new ID."
     (org-entry-put (point) "ID" nil))
     (org-entry-put (point) "ID" nil))
   (org-id-get (point) 'create))
   (org-id-get (point) 'create))
 
 
+;;;###autoload
 (defun org-id-copy ()
 (defun org-id-copy ()
   "Copy the ID of the entry at point to the kill ring.
   "Copy the ID of the entry at point to the kill ring.
 Create an ID if necessary."
 Create an ID if necessary."
@@ -258,6 +259,7 @@ In any case, the ID of the entry is returned."
 	(org-id-add-location id (buffer-file-name (buffer-base-buffer)))
 	(org-id-add-location id (buffer-file-name (buffer-base-buffer)))
 	id)))))
 	id)))))
 
 
+;;;###autoload
 (defun org-id-get-with-outline-path-completion (&optional targets)
 (defun org-id-get-with-outline-path-completion (&optional targets)
   "Use `outline-path-completion' to retrieve the ID of an entry.
   "Use `outline-path-completion' to retrieve the ID of an entry.
 TARGETS may be a setting for `org-refile-targets' to define
 TARGETS may be a setting for `org-refile-targets' to define
@@ -274,6 +276,7 @@ If necessary, the ID is created."
     (prog1 (org-id-get pom 'create)
     (prog1 (org-id-get pom 'create)
       (move-marker pom nil))))
       (move-marker pom nil))))
 
 
+;;;###autoload
 (defun org-id-get-with-outline-drilling (&optional targets)
 (defun org-id-get-with-outline-drilling (&optional targets)
   "Use an outline-cycling interface to retrieve the ID of an entry.
   "Use an outline-cycling interface to retrieve the ID of an entry.
 This only finds entries in the current buffer, using `org-get-location'.
 This only finds entries in the current buffer, using `org-get-location'.
@@ -320,6 +323,7 @@ With optional argument MARKERP, return the position as a new marker."
 
 
 ;; Creating new IDs
 ;; Creating new IDs
 
 
+;;;###autoload
 (defun org-id-new (&optional prefix)
 (defun org-id-new (&optional prefix)
   "Create a new globally unique ID.
   "Create a new globally unique ID.
 
 

+ 0 - 8
lisp/org-macs.el

@@ -283,14 +283,6 @@ we turn off invisibility temporarily.  Use this in a `let' form."
        (<= (match-beginning n) pos)
        (<= (match-beginning n) pos)
        (>= (match-end n) pos)))
        (>= (match-end n) pos)))
 
 
-(defun org-autoload (file functions)
-  "Establish autoload for all FUNCTIONS in FILE, if not bound already."
-  (let ((d (format "Documentation will be available after `%s.el' is loaded."
-		   file))
-	f)
-    (while (setq f (pop functions))
-      (or (fboundp f) (autoload f file d t)))))
-
 (defun org-match-line (re)
 (defun org-match-line (re)
   "Looking-at at the beginning of the current line."
   "Looking-at at the beginning of the current line."
   (save-excursion
   (save-excursion

+ 3 - 0
lisp/org-table.el

@@ -921,6 +921,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
     (setq org-table-may-need-update nil)
     (setq org-table-may-need-update nil)
     ))
     ))
 
 
+;;;###autoload
 (defun org-table-begin (&optional table-type)
 (defun org-table-begin (&optional table-type)
   "Find the beginning of the table and return its position.
   "Find the beginning of the table and return its position.
 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
@@ -934,6 +935,7 @@ With argument TABLE-TYPE, go to the beginning of a table.el-type table."
       (beginning-of-line 2)
       (beginning-of-line 2)
       (point))))
       (point))))
 
 
+;;;###autoload
 (defun org-table-end (&optional table-type)
 (defun org-table-end (&optional table-type)
   "Find the end of the table and return its position.
   "Find the end of the table and return its position.
 With argument TABLE-TYPE, go to the end of a table.el-type table."
 With argument TABLE-TYPE, go to the end of a table.el-type table."
@@ -1205,6 +1207,7 @@ Return t when the line exists, nil if it does not exist."
 		(< (setq cnt (1+ cnt)) N)))
 		(< (setq cnt (1+ cnt)) N)))
     (= cnt N)))
     (= cnt N)))
 
 
+;;;###autoload
 (defun org-table-blank-field ()
 (defun org-table-blank-field ()
   "Blank the current table field or active region."
   "Blank the current table field or active region."
   (interactive)
   (interactive)

+ 19 - 44
lisp/org.el

@@ -115,24 +115,33 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
 (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
 (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
+(declare-function org-clocktable-shift "org-clock" (dir n))
 (declare-function org-clock-get-last-clock-out-time "org-clock" ())
 (declare-function org-clock-get-last-clock-out-time "org-clock" ())
+(declare-function org-clock-update-time-maybe "org-clock" ())
+(declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove))
 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
 (declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
 (declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
 
 
+(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
 (declare-function orgtbl-mode "org-table" (&optional arg))
 (declare-function orgtbl-mode "org-table" (&optional arg))
 (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
 (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
 (declare-function org-beamer-mode "ox-beamer" ())
 (declare-function org-beamer-mode "ox-beamer" ())
+(declare-function org-table-blank-field "org-table" ())
 (declare-function org-table-edit-field "org-table" (arg))
 (declare-function org-table-edit-field "org-table" (arg))
+(declare-function org-table-insert-row "org-table" (&optional arg))
 (declare-function org-table-justify-field-maybe "org-table" (&optional new))
 (declare-function org-table-justify-field-maybe "org-table" (&optional new))
 (declare-function org-table-set-constants "org-table" ())
 (declare-function org-table-set-constants "org-table" ())
 (declare-function org-table-calc-current-TBLFM "org-table" (&optional arg))
 (declare-function org-table-calc-current-TBLFM "org-table" (&optional arg))
 (declare-function org-id-get-create "org-id" (&optional force))
 (declare-function org-id-get-create "org-id" (&optional force))
+(declare-function org-add-archive-files "org-archive" (files))
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
 (declare-function org-agenda-list "org-agenda" (&optional arg start-day span))
 (declare-function org-agenda-list "org-agenda" (&optional arg start-day span))
 (declare-function org-agenda-redo "org-agenda" (&optional all))
 (declare-function org-agenda-redo "org-agenda" (&optional all))
 (declare-function org-table-align "org-table" ())
 (declare-function org-table-align "org-table" ())
+(declare-function org-table-begin "org-table" (&optional table-type))
+(declare-function org-table-end "org-table" (&optional table-type))
 (declare-function org-table-paste-rectangle "org-table" ())
 (declare-function org-table-paste-rectangle "org-table" ())
 (declare-function org-table-maybe-eval-formula "org-table" ())
 (declare-function org-table-maybe-eval-formula "org-table" ())
 (declare-function org-table-maybe-recalculate-line "org-table" ())
 (declare-function org-table-maybe-recalculate-line "org-table" ())
@@ -161,6 +170,10 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-element-restriction "org-element" (element))
 (declare-function org-element-restriction "org-element" (element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-element-type "org-element" (element))
 
 
+(defsubst org-uniquify (list)
+  "Non-destructively remove duplicate elements from LIST."
+  (let ((res (copy-sequence list))) (delete-dups res)))
+
 ;; load languages based on value of `org-babel-load-languages'
 ;; load languages based on value of `org-babel-load-languages'
 (defvar org-babel-load-languages)
 (defvar org-babel-load-languages)
 
 
@@ -1721,17 +1734,15 @@ In tables, the special behavior of RET has precedence."
   :group 'org-link-follow
   :group 'org-link-follow
   :type 'boolean)
   :type 'boolean)
 
 
-(defcustom org-mouse-1-follows-link 450
+(defcustom org-mouse-1-follows-link
+  (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
   "Non-nil means mouse-1 on a link will follow the link.
   "Non-nil means mouse-1 on a link will follow the link.
 A longer mouse click will still set point.  Does not work on XEmacs.
 A longer mouse click will still set point.  Does not work on XEmacs.
 Needs to be set before org.el is loaded."
 Needs to be set before org.el is loaded."
   :group 'org-link-follow
   :group 'org-link-follow
   :version "24.4"
   :version "24.4"
   :package-version '(Org . "8.3")
   :package-version '(Org . "8.3")
-  :set (lambda (var val)
-	 (set-default var (if (boundp 'mouse-1-click-follows-link)
-			      mouse-1-click-follows-link t)))
-  :type '(choice 
+  :type '(choice
 	  (const :tag "A double click follows the link" 'double)
 	  (const :tag "A double click follows the link" 'double)
 	  (const :tag "Unconditionally follow the link with mouse-1" t)
 	  (const :tag "Unconditionally follow the link with mouse-1" t)
 	  (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
 	  (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
@@ -4244,12 +4255,6 @@ Normal means, no org-mode-specific context."
   "Detect the first line outside a table when searching from within it.
   "Detect the first line outside a table when searching from within it.
 This works for both table types.")
 This works for both table types.")
 
 
-;; Autoload the functions in org-table.el that are needed by functions here.
-
-(eval-and-compile
-  (org-autoload "org-table"
-		'(org-table-begin org-table-blank-field org-table-end)))
-
 (defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: "
 (defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: "
   "Detect a #+TBLFM line.")
   "Detect a #+TBLFM line.")
 
 
@@ -4330,12 +4335,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
 	(re-search-forward org-table-any-border-regexp nil 1))))
 	(re-search-forward org-table-any-border-regexp nil 1))))
   (unless quietly (message "Mapping tables: done")))
   (unless quietly (message "Mapping tables: done")))
 
 
-;; Declare and autoload functions from org-agenda.el
-
-(eval-and-compile
-  (org-autoload "org-agenda"
-		'(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))
-
 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end))
 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end))
 (declare-function org-clock-update-mode-line "org-clock" ())
 (declare-function org-clock-update-mode-line "org-clock" ())
 (declare-function org-resolve-clocks "org-clock"
 (declare-function org-resolve-clocks "org-clock"
@@ -4361,11 +4360,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
 Return nil if no clock is running."
 Return nil if no clock is running."
   (marker-buffer org-clock-marker))
   (marker-buffer org-clock-marker))
 
 
-(eval-and-compile
-  (org-autoload "org-clock" '(org-clock-remove-overlays
-			      org-clock-update-time-maybe
-			      org-clocktable-shift)))
-
 (defun org-check-running-clock ()
 (defun org-check-running-clock ()
   "Check if the current buffer contains the running clock.
   "Check if the current buffer contains the running clock.
 If yes, offer to stop it and to save the buffer with the changes."
 If yes, offer to stop it and to save the buffer with the changes."
@@ -4565,33 +4559,18 @@ Otherwise, these types are allowed:
 
 
 (defalias 'org-advertized-archive-subtree 'org-archive-subtree)
 (defalias 'org-advertized-archive-subtree 'org-archive-subtree)
 
 
-(eval-and-compile
-  (org-autoload "org-archive"
-		'(org-add-archive-files)))
-
-;; Autoload Column View Code
+;; Declare Column View Code
 
 
 (declare-function org-columns-number-to-string "org-colview" (n fmt &optional printf))
 (declare-function org-columns-number-to-string "org-colview" (n fmt &optional printf))
 (declare-function org-columns-get-format-and-top-level "org-colview" ())
 (declare-function org-columns-get-format-and-top-level "org-colview" ())
 (declare-function org-columns-compute "org-colview" (property))
 (declare-function org-columns-compute "org-colview" (property))
 
 
-(org-autoload (if (featurep 'xemacs) "org-colview-xemacs" "org-colview")
-	      '(org-columns-number-to-string
-		org-columns-get-format-and-top-level
-		org-columns-compute
-		org-columns-remove-overlays))
-
-;; Autoload ID code
+;; Declare ID code
 
 
 (declare-function org-id-store-link "org-id")
 (declare-function org-id-store-link "org-id")
 (declare-function org-id-locations-load "org-id")
 (declare-function org-id-locations-load "org-id")
 (declare-function org-id-locations-save "org-id")
 (declare-function org-id-locations-save "org-id")
 (defvar org-id-track-globally)
 (defvar org-id-track-globally)
-(org-autoload "org-id"
-	      '(org-id-new
-		org-id-copy
-		org-id-get-with-outline-path-completion
-		org-id-get-with-outline-drilling))
 
 
 ;;; Variables for pre-computed regular expressions, all buffer local
 ;;; Variables for pre-computed regular expressions, all buffer local
 
 
@@ -12858,7 +12837,7 @@ This function is run automatically after each state change to a DONE state."
 	 (org-log-done nil)
 	 (org-log-done nil)
 	 (org-todo-log-states nil)
 	 (org-todo-log-states nil)
 	 re type n what ts time to-state)
 	 re type n what ts time to-state)
-    (when (and repeat (not (zerop (string-to-number repeat))))
+    (when (and repeat (not (zerop (string-to-number (substring repeat 1)))))
       (if (eq org-log-repeat t) (setq org-log-repeat 'state))
       (if (eq org-log-repeat t) (setq org-log-repeat 'state))
       (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
       (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
 			 org-todo-repeat-to-state))
 			 org-todo-repeat-to-state))
@@ -21816,10 +21795,6 @@ for the search purpose."
   "Return the reverse of STRING."
   "Return the reverse of STRING."
   (apply 'string (reverse (string-to-list string))))
   (apply 'string (reverse (string-to-list string))))
 
 
-(defsubst org-uniquify (list)
-  "Non-destructively remove duplicate elements from LIST."
-  (let ((res (copy-sequence list))) (delete-dups res)))
-
 (defun org-uniquify-alist (alist)
 (defun org-uniquify-alist (alist)
   "Merge elements of ALIST with the same key.
   "Merge elements of ALIST with the same key.
 
 

+ 1 - 2
lisp/ox-html.el

@@ -674,7 +674,7 @@ The function should return the string to be exported."
 
 
 ;;;; LaTeX
 ;;;; LaTeX
 
 
-(defcustom org-html-with-latex t
+(defcustom org-html-with-latex org-export-with-latex
   "Non-nil means process LaTeX math snippets.
   "Non-nil means process LaTeX math snippets.
 
 
 When set, the exporter will process LaTeX environments and
 When set, the exporter will process LaTeX environments and
@@ -695,7 +695,6 @@ t              Synonym for `mathjax'."
   :group 'org-export-html
   :group 'org-export-html
   :version "24.4"
   :version "24.4"
   :package-version '(Org . "8.0")
   :package-version '(Org . "8.0")
-  :set (lambda (var val) (set-default var org-export-with-latex))
   :type '(choice
   :type '(choice
 	  (const :tag "Do not process math in any way" nil)
 	  (const :tag "Do not process math in any way" nil)
 	  (const :tag "Use dvipng to make images" dvipng)
 	  (const :tag "Use dvipng to make images" dvipng)

+ 1 - 2
lisp/ox-odt.el

@@ -705,7 +705,7 @@ The function should return the string to be exported."
 
 
 ;;;; LaTeX
 ;;;; LaTeX
 
 
-(defcustom org-odt-with-latex t
+(defcustom org-odt-with-latex org-export-with-latex
   "Non-nil means process LaTeX math snippets.
   "Non-nil means process LaTeX math snippets.
 
 
 When set, the exporter will process LaTeX environments and
 When set, the exporter will process LaTeX environments and
@@ -726,7 +726,6 @@ t              Synonym for `mathjax'."
   :group 'org-export-odt
   :group 'org-export-odt
   :version "24.4"
   :version "24.4"
   :package-version '(Org . "8.0")
   :package-version '(Org . "8.0")
-  :set (lambda (var val) (set-default var org-export-with-latex))
   :type '(choice
   :type '(choice
 	  (const :tag "Do not process math in any way" nil)
 	  (const :tag "Do not process math in any way" nil)
 	  (const :tag "Use dvipng to make images" dvipng)
 	  (const :tag "Use dvipng to make images" dvipng)

+ 57 - 11
lisp/ox-org.el

@@ -87,6 +87,7 @@ setting of `org-html-htmlize-output-type' is 'css."
     (line-break . org-org-identity)
     (line-break . org-org-identity)
     (link . org-org-identity)
     (link . org-org-identity)
     (node-property . org-org-identity)
     (node-property . org-org-identity)
+    (template . org-org-template)
     (paragraph . org-org-identity)
     (paragraph . org-org-identity)
     (plain-list . org-org-identity)
     (plain-list . org-org-identity)
     (planning . org-org-identity)
     (planning . org-org-identity)
@@ -140,16 +141,54 @@ CONTENTS is its contents, as a string or nil.  INFO is ignored."
   "Transcode KEYWORD element back into Org syntax.
   "Transcode KEYWORD element back into Org syntax.
 CONTENTS is nil.  INFO is ignored.  This function ignores
 CONTENTS is nil.  INFO is ignored.  This function ignores
 keywords targeted at other export back-ends."
 keywords targeted at other export back-ends."
-  (unless (member (org-element-property :key keyword)
-		  (mapcar
-		   (lambda (block-cons)
-		     (and (eq (cdr block-cons) 'org-element-export-block-parser)
-			  (car block-cons)))
-		   org-element-block-name-alist))
-    (org-element-keyword-interpreter keyword nil)))
+  (let ((key (org-element-property :key keyword)))
+    (unless (or (member key
+			(mapcar
+			 (lambda (block-cons)
+			   (and (eq (cdr block-cons)
+				    'org-element-export-block-parser)
+				(car block-cons)))
+			 org-element-block-name-alist))
+		(member key
+			'("AUTHOR" "CREATOR" "DATE" "DESCRIPTION" "EMAIL"
+			  "KEYWORDS" "TITLE")))
+      (org-element-keyword-interpreter keyword nil))))
+
+(defun org-org-template (contents info)
+  "Return Org document template with document keywords.
+CONTENTS is the transcoded contents string.  INFO is a plist used
+as a communication channel."
+  (concat
+   (and (plist-get info :time-stamp-file)
+	(format-time-string "# Created %Y-%m-%d %a %H:%M\n"))
+   (format "#+TITLE: %s\n" (org-export-data (plist-get info :title) info))
+   (and (plist-get info :with-date)
+	(let ((date (org-export-data (org-export-get-date info) info)))
+	  (and (org-string-nw-p date)
+	       (format "#+DATE: %s\n" date))))
+   (and (plist-get info :with-author)
+	(let ((author (org-export-data (plist-get info :author) info)))
+	  (and (org-string-nw-p author)
+	       (format "#+AUTHOR: %s\n" author))))
+   (and (plist-get info :with-email)
+	(let ((email (org-export-data (plist-get info :email) info)))
+	  (and (org-string-nw-p email)
+	       (format "#+EMAIL: %s\n" email))))
+   (and (eq (plist-get info :with-creator) t)
+	(org-string-nw-p (plist-get info :creator))
+	(format "#+CREATOR: %s\n" (plist-get info :creator)))
+   (and (org-string-nw-p (plist-get info :keywords))
+	(format "#+KEYWORDS: %s\n" (plist-get info :keywords)))
+   (and (org-string-nw-p (plist-get info :description))
+	(format "#+DESCRIPTION: %s\n" (plist-get info :description)))
+   contents
+   (and (eq (plist-get info :with-creator) 'comment)
+	(org-string-nw-p (plist-get info :creator))
+	(format "\n# %s\n" (plist-get info :creator)))))
 
 
 ;;;###autoload
 ;;;###autoload
-(defun org-org-export-as-org (&optional async subtreep visible-only ext-plist)
+(defun org-org-export-as-org
+  (&optional async subtreep visible-only body-only ext-plist)
   "Export current buffer to an Org buffer.
   "Export current buffer to an Org buffer.
 
 
 If narrowing is active in the current buffer, only export its
 If narrowing is active in the current buffer, only export its
@@ -168,6 +207,9 @@ first.
 When optional argument VISIBLE-ONLY is non-nil, don't export
 When optional argument VISIBLE-ONLY is non-nil, don't export
 contents of hidden elements.
 contents of hidden elements.
 
 
+When optional argument BODY-ONLY is non-nil, strip document
+keywords from output.
+
 EXT-PLIST, when provided, is a property list with external
 EXT-PLIST, when provided, is a property list with external
 parameters overriding Org default settings, but still inferior to
 parameters overriding Org default settings, but still inferior to
 file-local settings.
 file-local settings.
@@ -177,10 +219,11 @@ be displayed when `org-export-show-temporary-export-buffer' is
 non-nil."
 non-nil."
   (interactive)
   (interactive)
   (org-export-to-buffer 'org "*Org ORG Export*"
   (org-export-to-buffer 'org "*Org ORG Export*"
-    async subtreep visible-only nil ext-plist (lambda () (org-mode))))
+    async subtreep visible-only body-only ext-plist (lambda () (org-mode))))
 
 
 ;;;###autoload
 ;;;###autoload
-(defun org-org-export-to-org (&optional async subtreep visible-only ext-plist)
+(defun org-org-export-to-org
+  (&optional async subtreep visible-only body-only ext-plist)
   "Export current buffer to an org file.
   "Export current buffer to an org file.
 
 
 If narrowing is active in the current buffer, only export its
 If narrowing is active in the current buffer, only export its
@@ -199,6 +242,9 @@ first.
 When optional argument VISIBLE-ONLY is non-nil, don't export
 When optional argument VISIBLE-ONLY is non-nil, don't export
 contents of hidden elements.
 contents of hidden elements.
 
 
+When optional argument BODY-ONLY is non-nil, strip document
+keywords from output.
+
 EXT-PLIST, when provided, is a property list with external
 EXT-PLIST, when provided, is a property list with external
 parameters overriding Org default settings, but still inferior to
 parameters overriding Org default settings, but still inferior to
 file-local settings.
 file-local settings.
@@ -207,7 +253,7 @@ Return output file name."
   (interactive)
   (interactive)
   (let ((outfile (org-export-output-file-name ".org" subtreep)))
   (let ((outfile (org-export-output-file-name ".org" subtreep)))
     (org-export-to-file 'org outfile
     (org-export-to-file 'org outfile
-      async subtreep visible-only nil ext-plist)))
+      async subtreep visible-only body-only ext-plist)))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-org-publish-to-org (plist filename pub-dir)
 (defun org-org-publish-to-org (plist filename pub-dir)

+ 5 - 5
lisp/ox.el

@@ -90,6 +90,11 @@
 (defvar org-table-number-regexp)
 (defvar org-table-number-regexp)
 
 
 
 
+(defsubst org-export-get-parent (blob)
+  "Return BLOB parent or nil.
+BLOB is the element or object considered."
+  (org-element-property :parent blob))
+
 
 
 ;;; Internal Variables
 ;;; Internal Variables
 ;;
 ;;
@@ -5156,11 +5161,6 @@ Return the new string."
 ;; `org-export-get-genealogy' returns the full genealogy of a given
 ;; `org-export-get-genealogy' returns the full genealogy of a given
 ;; element or object, from closest parent to full parse tree.
 ;; element or object, from closest parent to full parse tree.
 
 
-(defsubst org-export-get-parent (blob)
-  "Return BLOB parent or nil.
-BLOB is the element or object considered."
-  (org-element-property :parent blob))
-
 (defun org-export-get-genealogy (blob)
 (defun org-export-get-genealogy (blob)
   "Return full genealogy relative to a given element or object.
   "Return full genealogy relative to a given element or object.
 
 

+ 8 - 0
testing/examples/babel.org

@@ -413,6 +413,9 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
 
 
 **** function definition
 **** function definition
 
 
+comments for ":var":
+- The "or" is to deal with a property not present.
+- The t is to get property inheritance.
 #+NAME: src_block_location_shell
 #+NAME: src_block_location_shell
 #+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
 #+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
 #+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
 #+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
@@ -433,6 +436,11 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
 #+HEADER: :var e='nil
 #+HEADER: :var e='nil
 #+BEGIN_SRC emacs-lisp :exports results
 #+BEGIN_SRC emacs-lisp :exports results
   (setq
   (setq
+   ;; - The first `or' together with ":var <var>='nil" is to check for
+   ;;   a value bound from an optional call argument, in the examples
+   ;;   here: c=5, e=6
+   ;; - The second `or' is to deal with a property not present
+   ;; - The t is to get property inheritance
    a (or a (string-to-number
    a (or a (string-to-number
             (or (org-entry-get org-babel-current-src-block-location "a" t)
             (or (org-entry-get org-babel-current-src-block-location "a" t)
                 "0")))
                 "0")))

+ 32 - 25
testing/lisp/test-org-element.el

@@ -2211,16 +2211,17 @@ Outside list"
   "Test clock interpreter."
   "Test clock interpreter."
   ;; Running clock.
   ;; Running clock.
   (should
   (should
-   (equal (let ((org-clock-string "CLOCK:"))
-	    (org-test-parse-and-interpret "CLOCK: [2012-01-01 sun. 00:01]"))
-	  "CLOCK: [2012-01-01 sun. 00:01]\n"))
+   (string-match
+    "CLOCK: \\[2012-01-01 .* 00:01\\]"
+    (let ((org-clock-string "CLOCK:"))
+      (org-test-parse-and-interpret "CLOCK: [2012-01-01 sun. 00:01]"))))
   ;; Closed clock.
   ;; Closed clock.
   (should
   (should
-   (equal
+   (string-match
+    "CLOCK: \\[2012-01-01 .* 00:01\\]--\\[2012-01-01 .* 00:02\\] =>  0:01"
     (let ((org-clock-string "CLOCK:"))
     (let ((org-clock-string "CLOCK:"))
       (org-test-parse-and-interpret "
       (org-test-parse-and-interpret "
-CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01"))
-    "CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01\n")))
+CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01")))))
 
 
 (ert-deftest test-org-element/comment-interpreter ()
 (ert-deftest test-org-element/comment-interpreter ()
   "Test comment interpreter."
   "Test comment interpreter."
@@ -2320,12 +2321,12 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01"))
 	(org-deadline-string "DEADLINE:")
 	(org-deadline-string "DEADLINE:")
 	(org-scheduled-string "SCHEDULED:"))
 	(org-scheduled-string "SCHEDULED:"))
     (should
     (should
-     (equal
+     (string-match
+      "\\* Headline
+DEADLINE: <2012-03-29 .*?> SCHEDULED: <2012-03-29 .*?> CLOSED: \\[2012-03-29 .*?\\]"
       (org-test-parse-and-interpret
       (org-test-parse-and-interpret
        "* Headline
        "* Headline
-DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]")
-      "* Headline
-DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
+DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu.]")))))
 
 
 (ert-deftest test-org-element/property-drawer-interpreter ()
 (ert-deftest test-org-element/property-drawer-interpreter ()
   "Test property drawer interpreter."
   "Test property drawer interpreter."
@@ -2395,8 +2396,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
 (ert-deftest test-org-element/timestamp-interpreter ()
 (ert-deftest test-org-element/timestamp-interpreter ()
   "Test timestamp interpreter."
   "Test timestamp interpreter."
   ;; Active.
   ;; Active.
-  (should (equal (org-test-parse-and-interpret "<2012-03-29 thu. 16:40>")
-		 "<2012-03-29 thu. 16:40>\n"))
+  (should
+   (string-match "<2012-03-29 .* 16:40>"
+		 (org-test-parse-and-interpret "<2012-03-29 thu. 16:40>")))
   (should
   (should
    (string-match "<2012-03-29 .* 16:40>"
    (string-match "<2012-03-29 .* 16:40>"
 		 (org-element-timestamp-interpreter
 		 (org-element-timestamp-interpreter
@@ -2404,8 +2406,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
 		    (:type active :year-start 2012 :month-start 3 :day-start 29
 		    (:type active :year-start 2012 :month-start 3 :day-start 29
 			   :hour-start 16 :minute-start 40)) nil)))
 			   :hour-start 16 :minute-start 40)) nil)))
   ;; Inactive.
   ;; Inactive.
-  (should (equal (org-test-parse-and-interpret "[2012-03-29 thu. 16:40]")
-		 "[2012-03-29 thu. 16:40]\n"))
+  (should
+   (string-match "\\[2012-03-29 .* 16:40\\]"
+		 (org-test-parse-and-interpret "[2012-03-29 thu. 16:40]")))
   (should
   (should
    (string-match
    (string-match
     "\\[2012-03-29 .* 16:40\\]"
     "\\[2012-03-29 .* 16:40\\]"
@@ -2414,9 +2417,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
        (:type inactive :year-start 2012 :month-start 3 :day-start 29
        (:type inactive :year-start 2012 :month-start 3 :day-start 29
 	      :hour-start 16 :minute-start 40)) nil)))
 	      :hour-start 16 :minute-start 40)) nil)))
   ;; Active range.
   ;; Active range.
-  (should (equal (org-test-parse-and-interpret
-		  "<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>")
-		 "<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>\n"))
+  (should
+   (string-match "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>"
+		 (org-test-parse-and-interpret
+		  "<2012-03-29 thu. 16:40>--<2012-03-29 thu. 16:41>")))
   (should
   (should
    (string-match
    (string-match
     "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>"
     "<2012-03-29 .* 16:40>--<2012-03-29 .* 16:41>"
@@ -2426,9 +2430,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
 	      :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3
 	      :hour-start 16 :minute-start 40 :year-end 2012 :month-end 3
 	      :day-end 29 :hour-end 16 :minute-end 41)) nil)))
 	      :day-end 29 :hour-end 16 :minute-end 41)) nil)))
   ;; Inactive range.
   ;; Inactive range.
-  (should (equal (org-test-parse-and-interpret
-		  "[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]")
-		 "[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]\n"))
+  (should
+   (string-match "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]"
+		 (org-test-parse-and-interpret
+		  "[2012-03-29 thu. 16:40]--[2012-03-29 thu. 16:41]")))
   (should
   (should
    (string-match
    (string-match
     "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]"
     "\\[2012-03-29 .* 16:40\\]--\\[2012-03-29 .* 16:41\\]"
@@ -2441,8 +2446,9 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
   (should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>")
   (should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>")
 		 "<%%diary-float t 4 2>\n"))
 		 "<%%diary-float t 4 2>\n"))
   ;; Timestamp with repeater interval, with delay, with both.
   ;; Timestamp with repeater interval, with delay, with both.
-  (should (equal (org-test-parse-and-interpret "<2012-03-29 thu. +1y>")
-		 "<2012-03-29 thu. +1y>\n"))
+  (should
+   (string-match "<2012-03-29 .* \\+1y>"
+		 (org-test-parse-and-interpret "<2012-03-29 thu. +1y>")))
   (should
   (should
    (string-match
    (string-match
     "<2012-03-29 .* \\+1y>"
     "<2012-03-29 .* \\+1y>"
@@ -2469,9 +2475,10 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
 	      :repeater-type cumulate :repeater-value 1 :repeater-unit year))
 	      :repeater-type cumulate :repeater-value 1 :repeater-unit year))
      nil)))
      nil)))
   ;; Timestamp range with repeater interval
   ;; Timestamp range with repeater interval
-  (should (equal (org-test-parse-and-interpret
-		  "<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>")
-		 "<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>\n"))
+  (should
+   (string-match "<2012-03-29 .* \\+1y>--<2012-03-30 .* \\+1y>"
+		 (org-test-parse-and-interpret
+		  "<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>")))
   (should
   (should
    (string-match
    (string-match
     "<2012-03-29 .* \\+1y>--<2012-03-30 .* \\+1y>"
     "<2012-03-29 .* \\+1y>--<2012-03-30 .* \\+1y>"

+ 21 - 20
testing/lisp/test-ox.el

@@ -400,11 +400,11 @@ Paragraph"
 		       nil nil nil '(:with-archived-trees t))))))
 		       nil nil nil '(:with-archived-trees t))))))
   ;; Clocks.
   ;; Clocks.
   (should
   (should
-   (equal "CLOCK: [2012-04-29 sun. 10:45]\n"
-	  (let ((org-clock-string "CLOCK:"))
-	    (org-test-with-temp-text "CLOCK: [2012-04-29 sun. 10:45]"
-	      (org-export-as (org-test-default-backend)
-			     nil nil nil '(:with-clocks t))))))
+   (string-match "CLOCK: \\[2012-04-29 .* 10:45\\]"
+		 (let ((org-clock-string "CLOCK:"))
+		   (org-test-with-temp-text "CLOCK: [2012-04-29 sun. 10:45]"
+		     (org-export-as (org-test-default-backend)
+				    nil nil nil '(:with-clocks t))))))
   (should
   (should
    (equal ""
    (equal ""
 	  (let ((org-clock-string "CLOCK:"))
 	  (let ((org-clock-string "CLOCK:"))
@@ -464,11 +464,12 @@ Paragraph"
 			 nil nil nil '(:with-inlinetasks nil)))))))
 			 nil nil nil '(:with-inlinetasks nil)))))))
   ;; Plannings.
   ;; Plannings.
   (should
   (should
-   (equal "CLOSED: [2012-04-29 sun. 10:45]\n"
-	  (let ((org-closed-string "CLOSED:"))
-	    (org-test-with-temp-text "CLOSED: [2012-04-29 sun. 10:45]"
-	      (org-export-as (org-test-default-backend)
-			     nil nil nil '(:with-planning t))))))
+   (string-match
+    "CLOSED: \\[2012-04-29 .* 10:45\\]"
+    (let ((org-closed-string "CLOSED:"))
+      (org-test-with-temp-text "CLOSED: [2012-04-29 sun. 10:45]"
+	(org-export-as (org-test-default-backend)
+		       nil nil nil '(:with-planning t))))))
   (should
   (should
    (equal ""
    (equal ""
 	  (let ((org-closed-string "CLOSED:"))
 	  (let ((org-closed-string "CLOSED:"))
@@ -505,8 +506,8 @@ Paragraph"
   "Test `org-export-with-timestamps' specifications."
   "Test `org-export-with-timestamps' specifications."
   ;; t value.
   ;; t value.
   (should
   (should
-   (equal
-    "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>\n"
+   (string-match
+    "\\[2012-04-29 .*? 10:45\\]<2012-04-29 .*? 10:45>"
     (org-test-with-temp-text "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>"
     (org-test-with-temp-text "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>"
       (org-export-as (org-test-default-backend)
       (org-export-as (org-test-default-backend)
 		     nil nil nil '(:with-timestamps t)))))
 		     nil nil nil '(:with-timestamps t)))))
@@ -519,24 +520,24 @@ Paragraph"
 		     nil nil nil '(:with-timestamps nil)))))
 		     nil nil nil '(:with-timestamps nil)))))
   ;; `active' value.
   ;; `active' value.
   (should
   (should
-   (equal
-    "<2012-03-29 Thu>\n\nParagraph <2012-03-29 Thu>[2012-03-29 Thu]"
+   (string-match
+    "<2012-03-29 .*?>\n\nParagraph <2012-03-29 .*?>\\[2012-03-29 .*?\\]"
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"<2012-03-29 Thu>[2012-03-29 Thu]
 	"<2012-03-29 Thu>[2012-03-29 Thu]
 
 
 Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
 Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
-      (org-trim (org-export-as (org-test-default-backend)
-			       nil nil nil '(:with-timestamps active))))))
+      (org-export-as (org-test-default-backend)
+		     nil nil nil '(:with-timestamps active)))))
   ;; `inactive' value.
   ;; `inactive' value.
   (should
   (should
-   (equal
-    "[2012-03-29 Thu]\n\nParagraph <2012-03-29 Thu>[2012-03-29 Thu]"
+   (string-match
+    "\\[2012-03-29 .*?\\]\n\nParagraph <2012-03-29 .*?>\\[2012-03-29 .*?\\]"
     (org-test-with-temp-text
     (org-test-with-temp-text
 	"<2012-03-29 Thu>[2012-03-29 Thu]
 	"<2012-03-29 Thu>[2012-03-29 Thu]
 
 
 Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
 Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
-      (org-trim (org-export-as (org-test-default-backend)
-			       nil nil nil '(:with-timestamps inactive)))))))
+      (org-export-as (org-test-default-backend)
+		     nil nil nil '(:with-timestamps inactive))))))
 
 
 (ert-deftest test-org-export/comment-tree ()
 (ert-deftest test-org-export/comment-tree ()
   "Test if export process ignores commented trees."
   "Test if export process ignores commented trees."