Browse Source

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

Carsten Dominik 14 years ago
parent
commit
9bd1c338a0
6 changed files with 70 additions and 14 deletions
  1. 1 1
      contrib/lisp/org-lparse.el
  2. 2 1
      doc/orgcard.tex
  3. 2 0
      lisp/ob-keys.el
  4. 61 8
      lisp/ob.el
  5. 2 2
      lisp/org-html.el
  6. 2 2
      lisp/org.el

+ 1 - 1
contrib/lisp/org-lparse.el

@@ -199,7 +199,7 @@ OPT-PLIST is the export options list."
 			 (string-match "^\\.\\.?/" path)))
 			 (string-match "^\\.\\.?/" path)))
 		   "file")
 		   "file")
 		  (t "internal")))
 		  (t "internal")))
-      (setq path (org-extract-attributes (org-link-unescape path)))
+      (setq path (org-extract-attributes path))
       (setq attr (get-text-property 0 'org-attributes path))
       (setq attr (get-text-property 0 'org-attributes path))
       (setq desc1 (if (match-end 5) (match-string 5 line))
       (setq desc1 (if (match-end 5) (match-string 5 line))
 	    desc2 (if (match-end 2) (concat type ":" path) path)
 	    desc2 (if (match-end 2) (concat type ":" path) path)

+ 2 - 1
doc/orgcard.tex

@@ -445,6 +445,7 @@ formula, \kbd{:=} a field formula.
 \key{execute code block at point}{C-c C-c}
 \key{execute code block at point}{C-c C-c}
 \key{open results of code block at point}{C-c C-o}
 \key{open results of code block at point}{C-c C-o}
 \key{check code block at point for errors}{C-c C-v c}
 \key{check code block at point for errors}{C-c C-v c}
+\key{insert a header argument with completion}{C-c C-v j}
 \key{view expanded body of code block at point}{C-c C-v v}
 \key{view expanded body of code block at point}{C-c C-v v}
 \key{view information about code block at point}{C-c C-v I}
 \key{view information about code block at point}{C-c C-v I}
 \key{go to named code block}{C-c C-v g}
 \key{go to named code block}{C-c C-v g}
@@ -460,7 +461,7 @@ formula, \kbd{:=} a field formula.
 \key{tangle code blocks in supplied file}{C-c C-v f}
 \key{tangle code blocks in supplied file}{C-c C-v f}
 \key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v i}
 \key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v i}
 \key{switch to the session of the current code block}{C-c C-v z}
 \key{switch to the session of the current code block}{C-c C-v z}
-\key{load expanded body of the current code block into a session}{C-c C-v l}
+\key{load the current code block into a session}{C-c C-v l}
 \key{view sha1 hash of the current code block}{C-c C-v a}
 \key{view sha1 hash of the current code block}{C-c C-v a}
 
 
 \section{Completion}
 \section{Completion}

+ 2 - 0
lisp/ob-keys.el

@@ -74,6 +74,8 @@ functions which are assigned key bindings, and see
     ("f" . org-babel-tangle-file)
     ("f" . org-babel-tangle-file)
     ("\C-c" . org-babel-check-src-block)
     ("\C-c" . org-babel-check-src-block)
     ("c" . org-babel-check-src-block)
     ("c" . org-babel-check-src-block)
+    ("\C-j" . org-babel-insert-header-arg)
+    ("j" . org-babel-insert-header-arg)
     ("\C-l" . org-babel-load-in-session)
     ("\C-l" . org-babel-load-in-session)
     ("l" . org-babel-load-in-session)
     ("l" . org-babel-load-in-session)
     ("\C-i" . org-babel-lob-ingest)
     ("\C-i" . org-babel-lob-ingest)

+ 61 - 8
lisp/ob.el

@@ -353,10 +353,35 @@ then run `org-babel-pop-to-session'."
 
 
 (add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe)
 (add-hook 'org-metadown-hook 'org-babel-pop-to-session-maybe)
 
 
+(defconst org-babel-common-header-args-w-values
+  '((cache	. ((no yes)))
+    (cmdline	. :any)
+    (colnames	. ((nil no yes)))
+    (comments	. ((no link yes org both noweb)))
+    (dir	. :any)
+    (eval	. ((never query)))
+    (exports	. ((code results both none)))
+    (file	. :any)
+    (hlines	. ((no yes)))
+    (mkdirp	. ((yes no)))
+    (no-expand)
+    (noeval)
+    (noweb	. ((yes no tangle)))
+    (noweb-ref	. :any)
+    (padline	. ((yes no)))
+    (results	. ((file list vector table scalar verbatim)
+		    (raw org html latex code pp wrap)
+		    (replace silent append prepend)
+		    (output value)))
+    (rownames	. ((no yes)))
+    (sep	. :any)
+    (session	. :any)
+    (shebang	. :any)
+    (tangle	. ((tangle yes no :any)))
+    (var	. :any)))
+
 (defconst org-babel-header-arg-names
 (defconst org-babel-header-arg-names
-  '(cache cmdline colnames dir exports file noweb results
-    session tangle var eval noeval comments no-expand shebang
-    padline noweb-ref)
+  (mapcar #'car org-babel-common-header-args-w-values)
   "Common header arguments used by org-babel.
   "Common header arguments used by org-babel.
 Note that individual languages may define their own language
 Note that individual languages may define their own language
 specific header arguments as well.")
 specific header arguments as well.")
@@ -572,6 +597,35 @@ arguments and pop open the results in a preview buffer."
 		 header name))))
 		 header name))))
     (message "No suspicious header arguments found.")))
     (message "No suspicious header arguments found.")))
 
 
+;;;###autoload
+(defun org-babel-insert-header-arg ()
+  "Insert a header argument selecting from lists of common args and values."
+  (interactive)
+  (let ((arg (org-icompleting-read
+	      "Header Arg: "
+	      (mapcar
+	       (lambda (header-spec) (symbol-name (car header-spec)))
+	       org-babel-common-header-args-w-values))))
+    (insert arg ":")
+    (let ((vals (cdr (assoc (intern arg)
+			    org-babel-common-header-args-w-values))))
+      (when vals
+	(insert
+	 " "
+	 (cond
+	  ((eq vals :any)
+	   (read-from-minibuffer "value: "))
+	  ((listp vals)
+	   (mapconcat
+	    (lambda (group)
+	      (let ((arg (org-icompleting-read
+			  "value: "
+			  (cons "default" (mapcar #'symbol-name group)))))
+		(if (and arg (not (string= "default" arg)))
+		    (concat arg " ")
+		  "")))
+	    vals ""))))))))
+
 ;;;###autoload
 ;;;###autoload
 (defun org-babel-load-in-session (&optional arg info)
 (defun org-babel-load-in-session (&optional arg info)
   "Load the body of the current source-code block.
   "Load the body of the current source-code block.
@@ -1804,12 +1858,11 @@ Later elements of PLISTS override the values of previous elements.
 This takes into account some special considerations for certain
 This takes into account some special considerations for certain
 parameters when merging lists."
 parameters when merging lists."
   (let ((results-exclusive-groups
   (let ((results-exclusive-groups
-	 '(("file" "list" "vector" "table" "scalar" "verbatim")
-	   ("raw" "org" "html" "latex" "code" "pp" "wrap")
-	   ("replace" "silent" "append" "prepend")
-	   ("output" "value")))
+	 (mapcar (lambda (group) (mapcar #'symbol-name group))
+		 (cdr (assoc 'results org-babel-common-header-args-w-values))))
 	(exports-exclusive-groups
 	(exports-exclusive-groups
-	 '(("code" "results" "both" "none")))
+	 (mapcar (lambda (group) (mapcar #'symbol-name group))
+		 (cdr (assoc 'exports org-babel-common-header-args-w-values))))
 	(variable-index 0)
 	(variable-index 0)
 	params results exports tangle noweb cache vars shebang comments padline)
 	params results exports tangle noweb cache vars shebang comments padline)
     (flet ((e-merge (exclusive-groups &rest result-params)
     (flet ((e-merge (exclusive-groups &rest result-params)

+ 2 - 2
lisp/org-html.el

@@ -1046,9 +1046,9 @@ OPT-PLIST is the export options list."
 
 
        (t
        (t
 	;; just publish the path, as default
 	;; just publish the path, as default
-	(setq rpl (concat "@<i>&lt;" type ":"
+	(setq rpl (concat "<i>&lt;" type ":"
 			  (save-match-data (org-link-unescape path))
 			  (save-match-data (org-link-unescape path))
-			  "&gt;@</i>"))))
+			  "&gt;</i>"))))
       (setq line (replace-match rpl t t line)
       (setq line (replace-match rpl t t line)
 	    start (+ start (length rpl))))
 	    start (+ start (length rpl))))
     line))
     line))

+ 2 - 2
lisp/org.el

@@ -5020,7 +5020,7 @@ stacked delimiters is N.  Escaping delimiters is not possible."
 
 
 (defvar org-match-substring-regexp
 (defvar org-match-substring-regexp
   (concat
   (concat
-   "\\([^\\]\\)\\([_^]\\)\\("
+   "\\([^\\]\\|^\\)\\([_^]\\)\\("
    "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
    "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
    "\\|"
    "\\|"
    "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
    "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
@@ -5030,7 +5030,7 @@ stacked delimiters is N.  Escaping delimiters is not possible."
 
 
 (defvar org-match-substring-with-braces-regexp
 (defvar org-match-substring-with-braces-regexp
   (concat
   (concat
-   "\\([^\\]\\)\\([_^]\\)\\("
+   "\\([^\\]\\|^\\)\\([_^]\\)\\("
    "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
    "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
    "\\)")
    "\\)")
   "The regular expression matching a sub- or superscript, forcing braces.")
   "The regular expression matching a sub- or superscript, forcing braces.")