Browse Source

Merge branch 'master' into max-sticky-agenda

Carsten Dominik 13 years ago
parent
commit
79472e466f
9 changed files with 153 additions and 117 deletions
  1. 57 47
      EXPERIMENTAL/org-e-html.el
  2. 56 49
      EXPERIMENTAL/org-e-odt.el
  3. 8 0
      doc/org.texi
  4. 3 4
      lisp/ob-table.el
  5. 5 3
      lisp/ob-tangle.el
  6. 3 1
      lisp/ob.el
  7. 11 1
      lisp/org-agenda.el
  8. 7 9
      lisp/org-bbdb.el
  9. 3 3
      lisp/org.el

+ 57 - 47
EXPERIMENTAL/org-e-html.el

@@ -56,6 +56,7 @@
 (declare-function org-element-parse-secondary-string
 (declare-function org-element-parse-secondary-string
 		  "org-element" (string restriction &optional buffer))
 		  "org-element" (string restriction &optional buffer))
 (defvar org-element-string-restrictions)
 (defvar org-element-string-restrictions)
+(defvar org-element-object-restrictions)
 
 
 (declare-function org-export-clean-table "org-export" (table specialp))
 (declare-function org-export-clean-table "org-export" (table specialp))
 (declare-function org-export-data "org-export" (data backend info))
 (declare-function org-export-data "org-export" (data backend info))
@@ -1566,10 +1567,13 @@ This function shouldn't be used for floats.  See
    (when (plist-get info :style-include-scripts)
    (when (plist-get info :style-include-scripts)
      org-e-html-scripts)))
      org-e-html-scripts)))
 
 
-(defun org-e-html-mathjax-config (template options in-buffer)
+(defun org-e-html-mathjax-config (info)
   "Insert the user setup into the matchjax template."
   "Insert the user setup into the matchjax template."
   (when (member (plist-get info :LaTeX-fragments) '(mathjax t))
   (when (member (plist-get info :LaTeX-fragments) '(mathjax t))
-    (let (name val (yes "   ") (no "// ") x)
+    (let ((template org-e-html-mathjax-template)
+	  (options org-e-html-mathjax-options)
+	  (in-buffer (or (plist-get info :mathjax) ""))
+	  name val (yes "   ") (no "// ") x)
       (mapc
       (mapc
        (lambda (e)
        (lambda (e)
 	 (setq name (car e) val (nth 1 e))
 	 (setq name (car e) val (nth 1 e))
@@ -1725,9 +1729,7 @@ original parsed data.  INFO is a plist holding export options."
 <head>"
 <head>"
    (org-e-html-meta-info info)		; meta
    (org-e-html-meta-info info)		; meta
    (org-e-html-style info)		; style
    (org-e-html-style info)		; style
-   (org-e-html-mathjax-config		; mathjax
-    org-e-html-mathjax-template org-e-html-mathjax-options
-    (or (plist-get info :mathjax) ""))
+   (org-e-html-mathjax-config info)	; mathjax
    "
    "
 </head>"
 </head>"
 
 
@@ -2061,7 +2063,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   (concat
   (concat
    ;; Insert separator between two footnotes in a row.
    ;; Insert separator between two footnotes in a row.
    (let ((prev (org-export-get-previous-element footnote-reference info)))
    (let ((prev (org-export-get-previous-element footnote-reference info)))
-     (when (and (listp prev) (eq (car prev) 'footnote-reference))
+     (when (eq (org-element-type prev) 'footnote-reference)
        org-e-html-footnote-separator))
        org-e-html-footnote-separator))
    (cond
    (cond
     ((not (org-export-footnote-first-reference-p footnote-reference info))
     ((not (org-export-footnote-first-reference-p footnote-reference info))
@@ -2092,7 +2094,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   "Transcode an HEADLINE element from Org to HTML.
   "Transcode an HEADLINE element from Org to HTML.
 CONTENTS holds the contents of the headline.  INFO is a plist
 CONTENTS holds the contents of the headline.  INFO is a plist
 holding contextual information."
 holding contextual information."
-  (let* ((numberedp (plist-get info :section-numbers))
+  (let* ((numberedp (org-export-numbered-headline-p headline info))
 	 (level (org-export-get-relative-level headline info))
 	 (level (org-export-get-relative-level headline info))
 	 (todo (and (plist-get info :with-todo-keywords)
 	 (todo (and (plist-get info :with-todo-keywords)
 		    (let ((todo (org-element-property
 		    (let ((todo (org-element-property
@@ -2126,7 +2128,7 @@ holding contextual information."
 CONTENTS holds the contents of the headline.  INFO is a plist
 CONTENTS holds the contents of the headline.  INFO is a plist
 holding contextual information."
 holding contextual information."
   (let* ((class (plist-get info :latex-class))
   (let* ((class (plist-get info :latex-class))
-	 (numberedp (plist-get info :section-numbers))
+	 (numberedp (org-export-numbered-headline-p headline info))
 	 ;; Get level relative to current parsed data.
 	 ;; Get level relative to current parsed data.
 	 (level (org-export-get-relative-level headline info))
 	 (level (org-export-get-relative-level headline info))
 	 ;; (class-sectionning (assoc class org-e-html-classes))
 	 ;; (class-sectionning (assoc class org-e-html-classes))
@@ -2396,8 +2398,8 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
     (cond
     (cond
      ((string= key "latex") value)
      ((string= key "latex") value)
      ((string= key "index") (format "\\index{%s}" value))
      ((string= key "index") (format "\\index{%s}" value))
-     ((string= key "target")
-      (format "\\label{%s}" (org-export-solidify-link-text value)))
+     ;; Invisible targets.
+     ((string= key "target") nil)	; FIXME
      ((string= key "toc")
      ((string= key "toc")
       (let ((value (downcase value)))
       (let ((value (downcase value)))
 	(cond
 	(cond
@@ -2545,50 +2547,58 @@ INFO is a plist holding contextual information.  See
     (cond
     (cond
      ;; Image file.
      ;; Image file.
      (imagep (org-e-html-link--inline-image link info))
      (imagep (org-e-html-link--inline-image link info))
-     ;; Target or radioed target: replace link with the normalized
-     ;; custom-id/target name.
-     ((member type '("target" "radio"))
+     ;; Radioed target: Target's name is obtained from original raw
+     ;; link.  Path is parsed and transcoded in order to have a proper
+     ;; display of the contents.
+     ((string= type "radio")
       (format "<a href=\"#%s\">%s</a>"
       (format "<a href=\"#%s\">%s</a>"
 	      (org-export-solidify-link-text path)
 	      (org-export-solidify-link-text path)
-	      (or desc (org-export-secondary-string path 'e-html info))))
+	      (org-export-secondary-string
+	       (org-element-parse-secondary-string
+		path (cdr (assq 'radio-target org-element-object-restrictions)))
+	       'e-html info)))
      ;; Links pointing to an headline: Find destination and build
      ;; Links pointing to an headline: Find destination and build
-     ;; appropriate referencing commanding.
+     ;; appropriate referencing command.
      ((member type '("custom-id" "fuzzy" "id"))
      ((member type '("custom-id" "fuzzy" "id"))
       (let ((destination (if (string= type "fuzzy")
       (let ((destination (if (string= type "fuzzy")
 			     (org-export-resolve-fuzzy-link link info)
 			     (org-export-resolve-fuzzy-link link info)
 			   (org-export-resolve-id-link link info))))
 			   (org-export-resolve-id-link link info))))
-	;; Fuzzy link points to a target.  Do as above.
 	(case (org-element-type destination)
 	(case (org-element-type destination)
-	  (target
-	   (format "<a href=\"#%s\">%s</a>"
-		   (org-export-solidify-link-text (org-element-property
-						   :raw-value destination))
+	  ;; Fuzzy link points nowhere.
+	  ('nil
+	   (format "<i>%s</i>"
 		   (or desc (org-export-secondary-string
 		   (or desc (org-export-secondary-string
 			     (org-element-property :raw-link link)
 			     (org-element-property :raw-link link)
 			     'e-html info))))
 			     'e-html info))))
-	  ;; Fuzzy link points to an headline.  If headlines are
-	  ;; numbered and the link has no description, display
-	  ;; headline's number.  Otherwise, display description or
-	  ;; headline's title.
+	  ;; Fuzzy link points to an invisible target.
+	  (keyword nil)
+	  ;; LINK points to an headline.  If headlines are numbered
+	  ;; and the link has no description, display headline's
+	  ;; number.  Otherwise, display description or headline's
+	  ;; title.
 	  (headline
 	  (headline
-	   (let ((label
-		  (format "sec-%s"
-			  (mapconcat
-			   'number-to-string
-			   (org-export-get-headline-number destination info)
-			   "-"))))
-	     (if (and (plist-get info :section-numbers) (not desc))
-		 (format "\\ref{%s}" label)
-	       (format "<a href=\"#%s\">%s</a>"
-		       label (or desc
-				 (org-export-secondary-string
-				  (org-element-property :title destination)
-				  'e-html info))))))
-	  ;; Fuzzy link points nowhere.
+	   (let* ((headline-no (org-export-get-headline-number destination info))
+		  (label (format "sec-%s" (mapconcat 'number-to-string
+						     headline-no "-")))
+		  (section-no (mapconcat 'number-to-string headline-no ".")))
+	     (setq desc
+		   (cond
+		    (desc desc)
+		    ((plist-get info :section-numbers) section-no)
+		    (t (org-export-secondary-string
+			(org-element-property :title destination)
+			'e-html info))))
+	     (format "<a href=\"#%s\">%s</a>" label desc)))
+          ;; Fuzzy link points to a target.  Do as above.
 	  (otherwise
 	  (otherwise
-	   (format "<i>%s</i>" (or desc (org-export-secondary-string
-					 (org-element-property :raw-link link)
-					 'e-html info)))))))
+	   (let ((path (org-export-solidify-link-text path)))
+	     (unless desc
+	       (setq desc (let ((number (org-export-get-ordinal
+					 destination info)))
+			    (when number
+			      (if (atom number) (number-to-string number)
+				(mapconcat 'number-to-string number "."))))))
+	     (format "<a href=\"#%s\">%s</a>" path (or desc "FIXME")))))))
      ;; Coderef: replace link with the reference name or the
      ;; Coderef: replace link with the reference name or the
      ;; equivalent line number.
      ;; equivalent line number.
      ((string= type "coderef")
      ((string= type "coderef")
@@ -2635,7 +2645,7 @@ the plist used as a communication channel."
 	 (class (cdr (assoc style '((footnote . "footnote")
 	 (class (cdr (assoc style '((footnote . "footnote")
 				    (verse . nil)))))
 				    (verse . nil)))))
 	 (extra (if class (format " class=\"%s\"" class) ""))
 	 (extra (if class (format " class=\"%s\"" class) ""))
-	 (parent (car (org-export-get-genealogy paragraph info))))
+	 (parent (org-export-get-parent paragraph info)))
     (cond
     (cond
      ((and (equal (car parent) 'item)
      ((and (equal (car parent) 'item)
 	   (= (org-element-property :begin paragraph)
 	   (= (org-element-property :begin paragraph)
@@ -3060,13 +3070,13 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 
 
 ;;;; Target
 ;;;; Target
 
 
-(defun org-e-html-target (target text info)
+(defun org-e-html-target (target contents info)
   "Transcode a TARGET object from Org to HTML.
   "Transcode a TARGET object from Org to HTML.
-TEXT is the text of the target.  INFO is a plist holding
-contextual information."
+CONTENTS is nil.  INFO is a plist holding contextual
+information."
   (let ((id (org-export-solidify-link-text
   (let ((id (org-export-solidify-link-text
-	     (org-element-property :raw-value target))))
-    (format "<a id=\"%s\" name=\"%s\">%s</a>" id id text)))
+	     (org-element-property :value target))))
+    (format "<a id=\"%s\" name=\"%s\"/>" id id)))
 
 
 
 
 ;;;; Time-stamp
 ;;;; Time-stamp

+ 56 - 49
EXPERIMENTAL/org-e-odt.el

@@ -1838,6 +1838,7 @@ formula file."
 (declare-function org-element-parse-secondary-string
 (declare-function org-element-parse-secondary-string
 		  "org-element" (string restriction &optional buffer))
 		  "org-element" (string restriction &optional buffer))
 (defvar org-element-string-restrictions)
 (defvar org-element-string-restrictions)
+(defvar org-element-object-restrictions)
 
 
 (declare-function org-export-clean-table "org-export" (table specialp))
 (declare-function org-export-clean-table "org-export" (table specialp))
 (declare-function org-export-data "org-export" (data backend info))
 (declare-function org-export-data "org-export" (data backend info))
@@ -3488,7 +3489,8 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 
 
 (defun org-e-odt-footnote-def (raw info) ; FIXME
 (defun org-e-odt-footnote-def (raw info) ; FIXME
   (if (equal (org-element-type raw) 'org-data)
   (if (equal (org-element-type raw) 'org-data)
-      (org-trim (org-export-data raw 'e-odt info))
+      (org-trim (org-export-data raw 'e-odt info)) ; fix paragraph
+						   ; style
     (org-odt-format-stylized-paragraph
     (org-odt-format-stylized-paragraph
      'footnote (org-trim (org-export-secondary-string raw 'e-odt info)))))
      'footnote (org-trim (org-export-secondary-string raw 'e-odt info)))))
 
 
@@ -3501,7 +3503,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   (concat
   (concat
    ;; Insert separator between two footnotes in a row.
    ;; Insert separator between two footnotes in a row.
    (let ((prev (org-export-get-previous-element footnote-reference info)))
    (let ((prev (org-export-get-previous-element footnote-reference info)))
-     (when (and (listp prev) (eq (car prev) 'footnote-reference))
+     (when (eq (org-element-type prev) 'footnote-reference)
        org-e-odt-footnote-separator))
        org-e-odt-footnote-separator))
    (cond
    (cond
     ((not (org-export-footnote-first-reference-p footnote-reference info))
     ((not (org-export-footnote-first-reference-p footnote-reference info))
@@ -3536,7 +3538,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   "Transcode an HEADLINE element from Org to HTML.
   "Transcode an HEADLINE element from Org to HTML.
 CONTENTS holds the contents of the headline.  INFO is a plist
 CONTENTS holds the contents of the headline.  INFO is a plist
 holding contextual information."
 holding contextual information."
-  (let* ((numberedp (plist-get info :section-numbers))
+  (let* ((numberedp (org-export-numbered-headline-p headline info))
 	 (level (org-export-get-relative-level headline info))
 	 (level (org-export-get-relative-level headline info))
 	 (todo (and (plist-get info :with-todo-keywords)
 	 (todo (and (plist-get info :with-todo-keywords)
 		    (let ((todo (org-element-property
 		    (let ((todo (org-element-property
@@ -3570,7 +3572,7 @@ holding contextual information."
 CONTENTS holds the contents of the headline.  INFO is a plist
 CONTENTS holds the contents of the headline.  INFO is a plist
 holding contextual information."
 holding contextual information."
   (let* ((class (plist-get info :latex-class))
   (let* ((class (plist-get info :latex-class))
-	 (numberedp (plist-get info :section-numbers))
+	 (numberedp (org-export-numbered-headline-p headline info))
 	 ;; Get level relative to current parsed data.
 	 ;; Get level relative to current parsed data.
 	 (level (org-export-get-relative-level headline info))
 	 (level (org-export-get-relative-level headline info))
 	 ;; (class-sectionning (assoc class org-e-odt-classes))
 	 ;; (class-sectionning (assoc class org-e-odt-classes))
@@ -3789,8 +3791,9 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
     (cond
     (cond
      ((string= key "latex") value)
      ((string= key "latex") value)
      ((string= key "index") (format "\\index{%s}" value))
      ((string= key "index") (format "\\index{%s}" value))
-     ((string= key "target")
-      (format "\\label{%s}" (org-export-solidify-link-text value)))
+     ((string= key "target") nil	; FIXME
+      ;; (format "\\label{%s}" (org-export-solidify-link-text value))
+      )
      ((string= key "toc")
      ((string= key "toc")
       (let ((value (downcase value)))
       (let ((value (downcase value)))
 	(cond
 	(cond
@@ -3942,53 +3945,58 @@ INFO is a plist holding contextual information.  See
     (cond
     (cond
      ;; Image file.
      ;; Image file.
      (imagep (org-e-odt-link--inline-image link info))
      (imagep (org-e-odt-link--inline-image link info))
-     ;; Target or radioed target: replace link with the normalized
-     ;; custom-id/target name.
-     ((member type '("target" "radio"))
+     ;; Radioed target: Target's name is obtained from original raw
+     ;; link.  Path is parsed and transcoded in order to have a proper
+     ;; display of the contents.
+     ((string= type "radio")
       (org-e-odt-format-internal-link
       (org-e-odt-format-internal-link
-       (or desc (org-export-secondary-string path 'e-odt info))
+       (org-export-secondary-string
+	(org-element-parse-secondary-string
+	 path (cdr (assq 'radio-target org-element-object-restrictions)))
+	'e-odt info)
        (org-export-solidify-link-text path)))
        (org-export-solidify-link-text path)))
      ;; Links pointing to an headline: Find destination and build
      ;; Links pointing to an headline: Find destination and build
-     ;; appropriate referencing commanding.
+     ;; appropriate referencing command.
      ((member type '("custom-id" "fuzzy" "id"))
      ((member type '("custom-id" "fuzzy" "id"))
       (let ((destination (if (string= type "fuzzy")
       (let ((destination (if (string= type "fuzzy")
 			     (org-export-resolve-fuzzy-link link info)
 			     (org-export-resolve-fuzzy-link link info)
 			   (org-export-resolve-id-link link info))))
 			   (org-export-resolve-id-link link info))))
-	;; Fuzzy link points to a target.  Do as above.
 	(case (org-element-type destination)
 	(case (org-element-type destination)
-	  (target
-	   (org-e-odt-format-internal-link
-	    (or desc
-		(org-export-secondary-string
-		 (org-element-property :raw-link link)
-		 'e-odt info))
-	    (org-export-solidify-link-text
-	     (org-element-property :raw-value destination))))
-	  ;; Fuzzy link points to an headline.  If headlines are
-	  ;; numbered and the link has no description, display
-	  ;; headline's number.  Otherwise, display description or
-	  ;; headline's title.
-	  (headline
-	   (let ((label
-		  (format "sec-%s"
-			  (mapconcat
-			   'number-to-string
-			   (org-export-get-headline-number destination info)
-			   "-"))))
-	     (if (and (plist-get info :section-numbers) (not desc))
-		 (format "\\ref{%s}" label)
-	       (org-e-odt-format-internal-link
-		(or desc
-		    (org-export-secondary-string
-		     (org-element-property :title destination)
-		     'e-odt info)) label))))
 	  ;; Fuzzy link points nowhere.
 	  ;; Fuzzy link points nowhere.
-	  (otherwise
+	  ('nil
 	   (org-e-odt-format-fontify
 	   (org-e-odt-format-fontify
-	    (or desc
-		(org-export-secondary-string
-		 (org-element-property :raw-link link)
-		 'e-odt info)) 'emphasis)))))
+	    (or desc (org-export-secondary-string
+		      (org-element-property :raw-link link)
+		      'e-odt info)) 'emphasis))
+	  ;; Fuzzy link points to an invisible target.
+	  (keyword nil)
+	  ;; LINK points to an headline.  If headlines are numbered
+	  ;; and the link has no description, display headline's
+	  ;; number.  Otherwise, display description or headline's
+	  ;; title.
+	  (headline
+	   (let* ((headline-no (org-export-get-headline-number destination info))
+		  (label (format "sec-%s" (mapconcat 'number-to-string
+						     headline-no "-")))
+		  (section-no (mapconcat 'number-to-string headline-no ".")))
+	     (setq desc
+		   (cond
+		    (desc desc)
+		    ((plist-get info :section-numbers) section-no)
+		    (t (org-export-secondary-string
+			(org-element-property :title destination)
+			'e-odt info))))
+	     (org-e-odt-format-internal-link desc label)))
+	  ;; Fuzzy link points to a target.  Do as above.
+	  (otherwise
+	   (let ((path (org-export-solidify-link-text path)))
+	     (unless desc
+	       (setq desc (let ((number (org-export-get-ordinal
+					 destination info)))
+			    (when number
+			      (if (atom number) (number-to-string number)
+				(mapconcat 'number-to-string number "."))))))
+	     (org-e-odt-format-internal-link (or desc "FIXME") path))))))
      ;; Coderef: replace link with the reference name or the
      ;; Coderef: replace link with the reference name or the
      ;; equivalent line number.
      ;; equivalent line number.
      ((string= type "coderef")
      ((string= type "coderef")
@@ -4032,7 +4040,7 @@ the plist used as a communication channel."
 	 (class (cdr (assoc style '((footnote . "footnote")
 	 (class (cdr (assoc style '((footnote . "footnote")
 				    (verse . nil)))))
 				    (verse . nil)))))
 	 (extra (if class (format " class=\"%s\"" class) ""))
 	 (extra (if class (format " class=\"%s\"" class) ""))
-	 (parent (car (org-export-get-genealogy paragraph info)))
+	 (parent (org-export-get-parent paragraph info))
 	 (parent-type (org-element-type parent))
 	 (parent-type (org-element-type parent))
 	 (style (case parent-type
 	 (style (case parent-type
 		  (quote-block 'quote)
 		  (quote-block 'quote)
@@ -4384,13 +4392,12 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 
 
 ;;;; Target
 ;;;; Target
 
 
-(defun org-e-odt-target (target text info)
+(defun org-e-odt-target (target contents info)
   "Transcode a TARGET object from Org to HTML.
   "Transcode a TARGET object from Org to HTML.
-TEXT is the text of the target.  INFO is a plist holding
-contextual information."
+CONTENTS is nil.  INFO is a plist holding contextual
+information."
   (org-e-odt-format-anchor
   (org-e-odt-format-anchor
-   text (org-export-solidify-link-text
-	 (org-element-property :raw-value target))))
+   "" (org-export-solidify-link-text (org-element-property :value target))))
 
 
 
 
 ;;;; Time-stamp
 ;;;; Time-stamp

+ 8 - 0
doc/org.texi

@@ -14098,6 +14098,14 @@ evaluation.  If @code{:noweb no}, the default, then the reference is not
 expanded before evaluation.  See the @ref{noweb-ref} header argument for
 expanded before evaluation.  See the @ref{noweb-ref} header argument for
 a more flexible way to resolve noweb references.
 a more flexible way to resolve noweb references.
 
 
+It is possible to include the @emph{results} of a code block rather than the
+body.  This is done by appending parenthesis to the code block name which may
+optionally contain arguments to the code block as shown below.
+
+@example
+<<code-block-name(optional arguments)>>
+@end example
+
 Note: the default value, @code{:noweb no}, was chosen to ensure that
 Note: the default value, @code{:noweb no}, was chosen to ensure that
 correct code is not broken in a language, such as Ruby, where
 correct code is not broken in a language, such as Ruby, where
 @code{<<arg>>} is a syntactically valid construct.  If @code{<<arg>>} is not
 @code{<<arg>>} is a syntactically valid construct.  If @code{<<arg>>} is not

+ 3 - 4
lisp/ob-table.el

@@ -75,9 +75,8 @@ results
 
 
 NOTE: by default string variable names are interpreted as
 NOTE: by default string variable names are interpreted as
 references to source-code blocks, to force interpretation of a
 references to source-code blocks, to force interpretation of a
-cell's value as a string, prefix the identifier with two \"$\"s
-rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the
-example above.
+cell's value as a string, prefix the identifier a \"$\" (e.g.,
+\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\").
 
 
 NOTE: it is also possible to pass header arguments to the code
 NOTE: it is also possible to pass header arguments to the code
 block.  In this case a table cell should hold the string value of
 block.  In this case a table cell should hold the string value of
@@ -97,7 +96,7 @@ as shown in the example below.
 		     (delq nil (mapcar
 		     (delq nil (mapcar
 				(lambda (el)
 				(lambda (el)
 				  (if (eq '$ el)
 				  (if (eq '$ el)
-				      (setq quote t)
+				      (prog1 nil (setq quote t))
 				    (prog1 (if quote
 				    (prog1 (if quote
 					       (format "\"%s\"" el)
 					       (format "\"%s\"" el)
 					     (org-babel-clean-text-properties el))
 					     (org-babel-clean-text-properties el))

+ 5 - 3
lisp/ob-tangle.el

@@ -192,9 +192,11 @@ exported source code blocks by language."
   (when only-this-block
   (when only-this-block
     (unless (org-babel-where-is-src-block-head)
     (unless (org-babel-where-is-src-block-head)
       (error "Point is not currently inside of a code block"))
       (error "Point is not currently inside of a code block"))
-    (unless target-file
-      (setq target-file
-	    (read-from-minibuffer "Tangle to: " (buffer-file-name))))
+    (save-match-data
+      (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info))))
+		  target-file)
+	(setq target-file
+	      (read-from-minibuffer "Tangle to: " (buffer-file-name)))))
     (narrow-to-region (match-beginning 0) (match-end 0)))
     (narrow-to-region (match-beginning 0) (match-end 0)))
   (save-excursion
   (save-excursion
     (let ((block-counter 0)
     (let ((block-counter 0)

+ 3 - 1
lisp/ob.el

@@ -2225,6 +2225,8 @@ block but are passed literally to the \"example-block\"."
           (setq index (point))
           (setq index (point))
           (nb-add
           (nb-add
 	   (with-current-buffer parent-buffer
 	   (with-current-buffer parent-buffer
+	     (save-restriction
+	       (widen)
 	     (mapconcat ;; interpose PREFIX between every line
 	     (mapconcat ;; interpose PREFIX between every line
 	      #'identity
 	      #'identity
 	      (split-string
 	      (split-string
@@ -2284,7 +2286,7 @@ block but are passed literally to the \"example-block\"."
 				   "could not be resolved (see "
 				   "could not be resolved (see "
 				   "`org-babel-noweb-error-langs')"))
 				   "`org-babel-noweb-error-langs')"))
 		    "")))
 		    "")))
-	       "[\n\r]") (concat "\n" prefix)))))
+	       "[\n\r]") (concat "\n" prefix))))))
         (nb-add (buffer-substring index (point-max)))))
         (nb-add (buffer-substring index (point-max)))))
     new-body))
     new-body))
 
 

+ 11 - 1
lisp/org-agenda.el

@@ -6098,8 +6098,18 @@ could bind the variable in the options section of a custom command.")
       (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 (get-text-property 0 'org-todo-regexp x))
 	(setq re (get-text-property 0 'org-todo-regexp x))
 	(when (and re
 	(when (and re
+		   ;; Test `pl' because if there's no heading content,
+		   ;; there's no point matching to highlight.  Note
+		   ;; that if we didn't test `pl' first, and there
+		   ;; happened to be no keyword from `org-todo-regexp'
+		   ;; on this heading line, then the `equal' comparison
+		   ;; afterwards would spuriously succeed in the case
+		   ;; where `pl' is nil -- causing an args-out-of-range
+		   ;; error when we try to add text properties to text
+		   ;; that isn't there.
+		   pl
 		   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
 		   (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
-					x (or pl 0)) pl))
+					x pl) pl))
 	  (add-text-properties
 	  (add-text-properties
 	   (or (match-end 1) (match-end 0)) (match-end 0)
 	   (or (match-end 1) (match-end 0)) (match-end 0)
 	   (list 'face (org-get-todo-face (match-string 2 x)))
 	   (list 'face (org-get-todo-face (match-string 2 x)))

+ 7 - 9
lisp/org-bbdb.el

@@ -112,11 +112,9 @@
           (&optional dont-check-disk already-in-db-buffer))
           (&optional dont-check-disk already-in-db-buffer))
 (declare-function bbdb-split "ext:bbdb" (string separators))
 (declare-function bbdb-split "ext:bbdb" (string separators))
 (declare-function bbdb-string-trim "ext:bbdb" (string))
 (declare-function bbdb-string-trim "ext:bbdb" (string))
-(declare-function bbdb-record-get-field "ext:bbdb"
-		  (fn file &optional arglist fileonly))
-;; These two functions below are part of BBDB3:
-(declare-function bbdb-search-name "ext:bbdb" (regexp &optional layout))
-(declare-function bbdb-search-organization "ext:bbdb" (regexp &optional layout))
+(declare-function bbdb-record-get-field "ext:bbdb" (record field))
+(declare-function bbdb-search-name "ext:bbdb-com" (regexp &optional layout))
+(declare-function bbdb-search-organization "ext:bbdb-com" (regexp &optional layout))
 
 
 (declare-function calendar-leap-year-p "calendar" (year))
 (declare-function calendar-leap-year-p "calendar" (year))
 (declare-function diary-ordinal-suffix "diary-lib" (n))
 (declare-function diary-ordinal-suffix "diary-lib" (n))
@@ -228,10 +226,10 @@ italicized, in all other cases it is left unchanged."
   (let ((inhibit-redisplay (not debug-on-error))
   (let ((inhibit-redisplay (not debug-on-error))
 	(bbdb-electric-p nil))
 	(bbdb-electric-p nil))
     (if (fboundp 'bbdb-name)
     (if (fboundp 'bbdb-name)
-        (org-bbdb-open-old)
-      (org-bbdb-open-new))))
+        (org-bbdb-open-old name)
+      (org-bbdb-open-new name))))
 
 
-(defun org-bbdb-open-old ()
+(defun org-bbdb-open-old (name)
   (catch 'exit
   (catch 'exit
     ;; Exact match on name
     ;; Exact match on name
     (bbdb-name (concat "\\`" name "\\'") nil)
     (bbdb-name (concat "\\`" name "\\'") nil)
@@ -251,7 +249,7 @@ italicized, in all other cases it is left unchanged."
       (delete-window (get-buffer-window "*BBDB*"))
       (delete-window (get-buffer-window "*BBDB*"))
       (error "No matching BBDB record"))))
       (error "No matching BBDB record"))))
 
 
-(defun org-bbdb-open-new ()
+(defun org-bbdb-open-new (name)
   (catch 'exit
   (catch 'exit
     ;; Exact match on name
     ;; Exact match on name
     (bbdb-search-name (concat "\\`" name "\\'") nil)
     (bbdb-search-name (concat "\\`" name "\\'") nil)

+ 3 - 3
lisp/org.el

@@ -7948,7 +7948,7 @@ the following will happen:
   repeater intact.
   repeater intact.
 - the start days in the repeater in the original entry will be shifted
 - the start days in the repeater in the original entry will be shifted
   to past the last clone.
   to past the last clone.
-I this way you can spell out a number of instances of a repeating task,
+In this way you can spell out a number of instances of a repeating task,
 and still retain the repeater to cover future instances of the task."
 and still retain the repeater to cover future instances of the task."
   (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
   (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
   (let (beg end template task idprop
   (let (beg end template task idprop
@@ -7975,7 +7975,7 @@ and still retain the repeater to cover future instances of the task."
     (setq end (point))
     (setq end (point))
     (setq template (buffer-substring beg end))
     (setq template (buffer-substring beg end))
     (when (and doshift
     (when (and doshift
-	       (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template))
+	       (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template))
       (delete-region beg end)
       (delete-region beg end)
       (setq end beg)
       (setq end beg)
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
       (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
@@ -8006,7 +8006,7 @@ and still retain the repeater to cover future instances of the task."
 		(while (re-search-forward org-ts-regexp nil t)
 		(while (re-search-forward org-ts-regexp nil t)
 		  (save-excursion
 		  (save-excursion
 		    (goto-char (match-beginning 0))
 		    (goto-char (match-beginning 0))
-		    (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)")
+		    (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)")
 			(delete-region (match-beginning 1) (match-end 1)))))))
 			(delete-region (match-beginning 1) (match-end 1)))))))
 	    (setq task (buffer-string)))
 	    (setq task (buffer-string)))
 	  (insert task))
 	  (insert task))