فهرست منبع

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Carsten Dominik 15 سال پیش
والد
کامیت
23812f9cf1
9فایلهای تغییر یافته به همراه68 افزوده شده و 63 حذف شده
  1. 1 19
      contrib/lisp/org-mime.el
  2. 1 0
      doc/org.texi
  3. 1 1
      lisp/ob-haskell.el
  4. 4 23
      lisp/ob-org.el
  5. 1 0
      lisp/ob.el
  6. 22 0
      lisp/org-exp.el
  7. 17 11
      lisp/org-footnote.el
  8. 15 5
      lisp/org-html.el
  9. 6 4
      lisp/org.el

+ 1 - 19
contrib/lisp/org-mime.el

@@ -175,7 +175,7 @@ export that region, otherwise export the entire body."
                        (point-max)))
          (raw-body (buffer-substring html-start html-end))
          (tmp-file (make-temp-name (expand-file-name "mail" temporary-file-directory)))
-         (body (org-mime-org-export "org" raw-body tmp-file))
+         (body (org-export-string raw-body "org" (file-name-directory tmp-file)))
          ;; because we probably don't want to skip part of our mail
          (org-export-skip-text-before-1st-heading nil)
          ;; because we probably don't want to export a huge style file
@@ -198,24 +198,6 @@ export that region, otherwise export the entire body."
       (insert (org-mime-multipart body html)
               (mapconcat 'identity html-images "\n")))))
 
-(defun org-mime-org-export (fmt body tmp-file)
-  "Org-Export BODY to format FMT with the file name set to
-TMP-FILE during export."
-  (save-excursion
-    (with-temp-buffer
-      (insert org-mime-default-header)
-      (insert body)
-      (write-file tmp-file)
-      (org-load-modules-maybe)
-      (unless org-local-vars
-        (setq org-local-vars (org-get-local-variables)))
-      (substring
-       (eval ;; convert to fmt -- mimicing `org-run-like-in-org-mode'
-        (list 'let org-local-vars 
-              (list (intern (concat "org-export-as-" fmt))
-                    nil nil nil ''string t)))
-       (if (string= fmt "org") (length org-mime-default-header) 0)))))
-
 (defun org-mime-apply-html-hook (html)
   (if org-mime-html-hook
       (with-temp-buffer

+ 1 - 0
doc/org.texi

@@ -8625,6 +8625,7 @@ You may also define additional attributes for the figure.  As this is
 backend-specific, see the sections about the individual backends for more
 information.
 
+@xref{Handling links,the discussion of image links}.
 
 @node Literal examples, Include files, Images and tables, Markup
 @section Literal examples

+ 1 - 1
lisp/ob-haskell.el

@@ -130,7 +130,7 @@ then create one.  Return the initialized session."
 	    (format "let %s = %s"
 		    (car pair)
 		    (org-babel-haskell-var-to-haskell (cdr pair))))
-   (mapcar #'cdr (org-babel-get-header params :var)) "\n"))
+   (mapcar #'cdr (org-babel-get-header params :var))))
 
 (defun org-babel-haskell-table-or-string (results)
   "Convert RESULTS to an Emacs-lisp table or string.

+ 4 - 23
lisp/ob-org.el

@@ -30,8 +30,7 @@
 ;;; Code:
 (require 'ob)
 
-(declare-function org-load-modules-maybe "org" (&optional force))
-(declare-function org-get-local-variables "org" ())
+(declare-function org-export-string "org-exp" (string fmt &optional dir))
 
 (defvar org-babel-default-header-args:org
   '((:results . "raw silent") (:exports . "results"))
@@ -47,29 +46,11 @@ This function is called by `org-babel-execute-src-block'."
   (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
 	(body (replace-regexp-in-string "^," "" body)))
     (cond
-     ((member "latex" result-params) (org-babel-org-export body "latex"))
-     ((member "html" result-params)  (org-babel-org-export body "html"))
-     ((member "ascii" result-params) (org-babel-org-export body "ascii"))
+     ((member "latex" result-params) (org-export-string body "latex"))
+     ((member "html" result-params)  (org-export-string body "html"))
+     ((member "ascii" result-params) (org-export-string body "ascii"))
      (t body))))
 
-(defvar org-local-vars)
-(defun org-babel-org-export (body fmt)
-  "Export BODY to FMT using Org-mode's export facilities. "
-  (when (get-buffer " org-mode-tmp")
-    (error "Nested call to org-export: from org code block exporting results"))
-  (let ((tmp-file (org-babel-temp-file "org-")))
-    (with-temp-buffer
-      (insert org-babel-org-default-header)
-      (insert body)
-      (write-file tmp-file)
-      (org-load-modules-maybe)
-      (unless org-local-vars
-	(setq org-local-vars (org-get-local-variables)))
-      (eval ;; convert to fmt -- mimicking `org-run-like-in-org-mode'
-       (list 'let org-local-vars 
-	     (list (intern (concat "org-export-as-" fmt))
-		   nil nil nil ''string t))))))
-
 (defun org-babel-prep-session:org (session params)
   "Return an error because org does not support sessions."
   (error "Org does not support sessions"))

+ 1 - 0
lisp/ob.el

@@ -69,6 +69,7 @@
 (declare-function org-babel-lob-get-info "ob-lob" nil)
 (declare-function org-babel-ref-split-args "ob-ref" (arg-string))
 (declare-function org-babel-ref-parse "ob-ref" (assignment))
+(declare-function org-babel-ref-resolve "ob-ref" (ref))
 (declare-function org-babel-lob-execute-maybe "ob-lob" ())
 (declare-function org-number-sequence "org-compat" (from &optional to inc))
 

+ 22 - 0
lisp/org-exp.el

@@ -2613,6 +2613,28 @@ command."
 
 (defvar org-export-htmlized-org-css-url) ;; defined in org-html.el
 
+(defun org-export-string (string fmt &optional dir)
+  "Export STRING to FMT using existing export facilities.
+During export STRING is saved to a temporary file whose location
+could vary.  Optional argument DIR can be used to force the
+directory in which the temporary file is created during export
+which can be useful for resolving relative paths.  Dir defaults
+to the value of `temporary-file-directory'."
+  (let ((temporary-file-directory (or dir temporary-file-directory))
+	(tmp-file (make-temp-file "org-")))
+    (unwind-protect
+	(with-temp-buffer
+	  (insert string)
+	  (write-file tmp-file)
+	  (org-load-modules-maybe)
+	  (unless org-local-vars
+	    (setq org-local-vars (org-get-local-variables)))
+	  (eval ;; convert to fmt -- mimicing `org-run-like-in-org-mode'
+	   (list 'let org-local-vars
+		 (list (intern (concat "org-export-as-" fmt))
+		       nil nil nil ''string t))))
+      (delete-file tmp-file))))
+
 ;;;###autoload
 (defun org-export-as-org (arg &optional hidden ext-plist
 			      to-buffer body-only pub-dir)

+ 17 - 11
lisp/org-footnote.el

@@ -49,6 +49,7 @@
 (declare-function org-in-verbatim-emphasis "org" ())
 (declare-function org-inside-latex-macro-p "org" ())
 (defvar org-odd-levels-only) ;; defined in org.el
+(defvar message-signature-separator) ;; defined in message.el
 
 (defconst org-footnote-re
   (concat "[^][\n]"   ; to make sure it is not at the beginning of a line
@@ -188,7 +189,7 @@ with start and label of the footnote if there is a definition at point."
       (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))))
 
 (defun org-footnote-goto-previous-reference (label)
-  "Find the next previous of the footnote with label LABEL."
+  "Find the first closest (to point) reference of footnote with label LABEL."
   (interactive "sLabel: ")
   (org-mark-ring-push)
   (setq label (org-footnote-normalize-label label))
@@ -302,15 +303,19 @@ or new, let the user edit the definition of the footnote."
      (t
       (setq re (concat "^" org-footnote-tag-for-non-org-mode-files "[ \t]*$"))
       (unless (re-search-forward re nil t)
-	(goto-char (point-max))
-	(skip-chars-backward " \t\r\n")
-	(insert "\n\n")
-	(delete-region (point) (point-max))
-	(insert org-footnote-tag-for-non-org-mode-files "\n"))
-      (goto-char (point-max))
-      (skip-chars-backward " \t\r\n")))
-    (insert "\n\n")
-    (insert "[" label "] ")
+	(let ((max (if (and (eq major-mode 'message-mode)
+			    (re-search-forward message-signature-separator nil t))
+		       (progn (beginning-of-line) (point))
+		     (goto-char (point-max)))))
+	  (skip-chars-backward " \t\r\n")
+	  (delete-region (point) max)
+	  (insert "\n\n")
+	  (insert org-footnote-tag-for-non-org-mode-files "\n")))))
+    ;; Skip existing footnotes
+    (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t)
+      (forward-line))
+    (insert "[" label "] \n")
+    (goto-char (1- (point)))
     (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))
 
 ;;;###autoload
@@ -506,7 +511,8 @@ ENTRY is (fn-label num-mark definition)."
     (beginning-of-line 0))
   (if (looking-at "[ \t]*#\\+TBLFM:") (beginning-of-line 2))
   (end-of-line 1)
-  (skip-chars-backward "\n\r\t "))
+  (skip-chars-backward "\n\r\t ")
+  (forward-line))
 
 (defun org-footnote-delete (&optional label)
   "Delete the footnote at point.

+ 15 - 5
lisp/org-html.el

@@ -126,6 +126,9 @@ not be modified."
   .target { }
   .timestamp { color: #bebebe; }
   .timestamp-kwd { color: #5f9ea0; }
+  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
+  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
+  .center {margin-left:auto; margin-right:auto; text-align:center;}
   p.verse { margin-left: 3% }
   pre {
 	border: 1pt solid #AEBDCC;
@@ -136,7 +139,13 @@ not be modified."
         overflow:auto;
   }
   table { border-collapse: collapse; }
-  td, th { vertical-align: top; }
+  td, th { vertical-align: top;  }
+  th.right  { text-align:center;  }
+  th.left   { text-align:center;   }
+  th.center { text-align:center; }
+  td.right  { text-align:right;  }
+  td.left   { text-align:left;   }
+  td.center { text-align:center; }
   dt { font-weight: bold; }
   div.figure { padding: 0.5em; }
   div.figure p { text-align: center; }
@@ -757,7 +766,8 @@ MAY-INLINE-P allows inlining it as an image."
 	    ((or
 		(not type)
 		(string= type "http")
-		(string= type "https"))
+		(string= type "https")
+		(string= type "file"))
 	       (if fragment
 		  (setq thefile (concat thefile "#" fragment))))
 
@@ -1910,7 +1920,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	(push (concat rowstart
 		      (mapconcat
 		       (lambda (x)
-			 (setq i (1+ i) ali (format "@@align%03d@@" i))
+			 (setq i (1+ i) ali (format "@@class%03d@@" i))
 			 (if (and (< i nfields) ; make sure no rogue line causes an error here
 				  (string-match org-table-number-regexp x))
 			     (incf (aref fnum i)))
@@ -1982,12 +1992,12 @@ lang=\"%s\" xml:lang=\"%s\">
     (setq html (mapcar
 		(lambda (x)
 		  (replace-regexp-in-string
-		   "@@align\\([0-9]+\\)@@"
+		   "@@class\\([0-9]+\\)@@"
 		   (lambda (txt)
 		     (if (not org-export-html-table-align-individual-fields)
 			 ""
 		       (setq n (string-to-number (match-string 1 txt)))
-		       (format " style=\"text-align:%s\""
+		       (format " class=\"%s\""
 			       (or (nth n aligns) "left"))))
 		   x))
 		html))

+ 6 - 4
lisp/org.el

@@ -5772,7 +5772,8 @@ in special contexts.
   `org-cycle-emulate-tab' for details.
 
 - Special case: if point is at the beginning of the buffer and there is
-  no headline in line 1, this function will act as if called with prefix arg.
+  no headline in line 1, this function will act as if called with prefix arg
+  (C-u TAB, same as S-TAB) also when called without prefix arg.
   But only if also the variable `org-cycle-global-at-bob' is t."
   (interactive "P")
   (org-load-modules-maybe)
@@ -5798,7 +5799,7 @@ in special contexts.
 		      (if nstars (format "\\{1,%d\\}" nstars) "+")
 		      " \\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)"))
 	     (t (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))))
-	   (bob-special (and org-cycle-global-at-bob (bobp)
+	   (bob-special (and org-cycle-global-at-bob (not arg) (bobp)
 			     (not (looking-at outline-regexp))))
 	   (org-cycle-hook
 	    (if bob-special
@@ -5814,6 +5815,7 @@ in special contexts.
       (cond
 
        ((equal arg '(16))
+	(setq last-command 'dummy)
 	(org-set-startup-visibility)
 	(message "Startup visibility, plus VISIBILITY properties"))
 
@@ -9426,6 +9428,7 @@ in all files.  If AVOID-POS is given, ignore matches near that position."
 				     (regexp-quote s))
 			     nil t))
 	;; OK, found a match
+	(setq type 'dedicated)
 	(goto-char (match-beginning 0)))
        ((and (not org-link-search-inhibit-query)
 	     (eq org-link-search-must-match-exact-headline 'query-to-create)
@@ -16234,8 +16237,7 @@ BEG and END default to the buffer boundaries."
       (widen)
       (setq beg (or beg (point-min)) end (or end (point-max)))
       (goto-char (point-min))
-      ;; (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([-+~.:/\\_0-9a-zA-Z ]+"
-      (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([-+~.:/\\_0-9a-zA-Z \x00080-\xfffff]+"
+      (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
 			(substring (org-image-file-name-regexp) 0 -2)
 			"\\)\\]" (if include-linked "" "\\]")))
 	    old file ov img)