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

This commit is contained in:
Bastien Guerry 2011-03-01 09:20:20 +01:00
commit 02ee22345d
16 changed files with 112 additions and 113 deletions

View File

@ -503,6 +503,7 @@ lisp/org-publish.elc:
lisp/org-protocol.elc: lisp/org.el
lisp/org-remember.elc: lisp/org.el
lisp/org-rmail.elc: lisp/org.el
lisp/org-special-blocks.elc: lisp/org-compat.el
lisp/org-src.elc: lisp/org-macs.el lisp/org-compat.el
lisp/org-table.elc: lisp/org.el
lisp/org-taskjuggler.elc: lisp/org.el lisp/org-exp.el

View File

@ -29,6 +29,7 @@
;;; Code:
(require 'ob)
(require 'calc)
(require 'calc-store)
(unless (featurep 'xemacs) (require 'calc-trail))
(eval-when-compile (require 'ob-comint))
@ -83,6 +84,7 @@
(with-current-buffer (get-buffer "*Calculator*")
(calc-eval (calc-top 1)))))
(defvar var-syms) ; Dynamically scoped from org-babel-execute:calc
(defun ob-calc-maybe-resolve-var (el)
(if (consp el)
(if (and (equal 'var (car el)) (member (cadr el) var-syms))

View File

@ -248,7 +248,8 @@ This function is called by `org-babel-exp-do-export'. The code
block will be evaluated. Optional argument SILENT can be used to
inhibit insertion of results into the buffer."
(when (and org-export-babel-evaluate
(not (equal hash (org-babel-result-hash))))
(not (equal hash (org-babel-exp-in-export-file
(org-babel-result-hash)))))
(let ((lang (nth 0 info))
(body (nth 1 info)))
(setf (nth 2 info) (org-babel-exp-in-export-file

View File

@ -130,6 +130,7 @@ Emacs-lisp table, otherwise return the results as a string."
"Return the buffer associated with SESSION."
(cdr (assoc session org-babel-python-buffers)))
(defvar py-default-interpreter)
(defun org-babel-python-initiate-session-by-key (&optional session)
"Initiate a python session.
If there is not a current inferior-process-buffer in SESSION

View File

@ -57,6 +57,7 @@
(declare-function org-at-table-p "org" (&optional table-type))
(declare-function org-count "org" (CL-ITEM CL-SEQ))
(declare-function org-in-item-p "org-list" ())
(declare-function org-at-item-p "org-list" ())
(defvar org-babel-ref-split-regexp
"[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")

View File

@ -97,7 +97,8 @@ example above."
variables)))
(unless (stringp source-block)
(setq source-block (symbol-name source-block)))
(org-babel-trim
((lambda (result)
(org-babel-trim (if (stringp result) result (format "%S" result))))
(if (and source-block (> (length source-block) 0))
(let ((params
(eval `(org-babel-parse-header-arguments

View File

@ -35,6 +35,7 @@
(require 'org-macs)
(defvar org-babel-call-process-region-original)
(defvar org-src-lang-modes)
(declare-function show-all "outline" ())
(declare-function tramp-compat-make-temp-file "tramp-compat"
(filename &optional dir-flag))
@ -74,6 +75,7 @@
(declare-function org-babel-lob-execute-maybe "ob-lob" ())
(declare-function org-number-sequence "org-compat" (from &optional to inc))
(declare-function org-in-item-p "org-list" ())
(declare-function org-at-item-p "org-list" ())
(declare-function org-list-parse-list "org-list" (&optional delete))
(declare-function org-list-to-generic "org-list" (LIST PARAMS))
(declare-function org-list-struct "org-list" ())
@ -1393,12 +1395,13 @@ following the source block."
"Read the table at `point' into emacs-lisp."
(mapcar (lambda (row)
(if (and (symbolp row) (equal row 'hline)) row
(mapcar #'org-babel-read row)))
(mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval)) row)))
(org-table-to-lisp)))
(defun org-babel-read-list ()
"Read the list at `point' into emacs-lisp."
(mapcar #'org-babel-read (mapcar #'cadr (cdr (org-list-parse-list)))))
(mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval))
(mapcar #'cadr (cdr (org-list-parse-list)))))
(defvar org-link-types-re)
(defun org-babel-read-link ()
@ -1908,18 +1911,18 @@ block but are passed literally to the \"example-block\"."
(apply #'string (reverse out)))))
str))))
(defun org-babel-read (cell)
(defun org-babel-read (cell &optional inhibit-lisp-eval)
"Convert the string value of CELL to a number if appropriate.
Otherwise if cell looks like lisp (meaning it starts with a
\"(\" or a \"'\") then read it as lisp, otherwise return it
unmodified as a string.
This is taken almost directly from `org-read-prop'."
Otherwise if cell looks like lisp (meaning it starts with a \"(\"
or a \"'\") then read it as lisp, otherwise return it unmodified
as a string. Optional argument NO-LISP-EVAL inhibits lisp
evaluation for situations in which is it not appropriate."
(if (and (stringp cell) (not (equal cell "")))
(or (org-babel-number-p cell)
(if (or (equal "(" (substring cell 0 1))
(equal "'" (substring cell 0 1))
(equal "`" (substring cell 0 1)))
(if (and (not inhibit-lisp-eval)
(or (equal "(" (substring cell 0 1))
(equal "'" (substring cell 0 1))
(equal "`" (substring cell 0 1))))
(eval (read cell))
(progn (set-text-properties 0 (length cell) nil cell) cell)))
cell))

View File

@ -4307,7 +4307,7 @@ of what a project is and how to check if it stuck, customize the variable
(defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param.
(defvar list-diary-entries-hook)
(defvar diary-time-regexp)
(defun org-get-entries-from-diary (date)
"Get the (Emacs Calendar) diary entries for DATE."
(require 'diary-lib)
@ -4695,7 +4695,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
marker hdmarker deadlinep scheduledp clockp closedp inactivep
donep tmp priority category ee txt timestr tags b0 b3 e3 head
todo-state end-of-match)
todo-state end-of-match show-all)
(goto-char (point-min))
(while (setq end-of-match (re-search-forward regexp nil t))
(setq b0 (match-beginning 0)
@ -5051,7 +5051,7 @@ FRACTION is what fraction of the head-warning time has passed."
(cons (marker-position mm) a)))
deadline-results))
d2 diff pos pos1 category tags donep
ee txt head pastschedp todo-state face timestr s habitp)
ee txt head pastschedp todo-state face timestr s habitp show-all)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@ -5473,12 +5473,6 @@ The modified list may contain inherited tags, and tags matched by
(append new list)
(append list new)))))
(defun org-eval (form)
"Eval FORM and return result."
(condition-case error
(eval form)
(error (format "%%![Error: %s]" error))))
(defun org-compile-prefix-format (key)
"Compile the prefix format into a Lisp form that can be evaluated.
The resulting form is returned and stored in the variable

View File

@ -211,7 +211,7 @@ this heading."
(current-time)))
category todo priority ltags itags atags
;; end of variables that will be used for saving context
location afile heading buffer level newfile-p visiting)
location afile heading buffer level newfile-p infile-p visiting)
;; Find the local archive location
(setq location (org-get-local-archive-location)

View File

@ -1054,7 +1054,7 @@ Point will remain at the first line after the inserted text."
(setq beg (point))
(cond
((and (eq type 'entry) (org-mode-p))
(org-capture-verify-tree txt)
(org-capture-verify-tree (org-capture-get :template))
(org-paste-subtree nil template t))
((and (memq type '(item checkitem))
(org-mode-p)

View File

@ -76,6 +76,8 @@
(require 'cl))
(require 'org)
(defvar backend) ; dynamically scoped from caller
(defvar org-exp-blocks-block-regexp
(concat
"^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)"

View File

@ -1817,7 +1817,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(org-table-last-column-widths (copy-sequence
org-table-last-column-widths))
fnum fields line lines olines gr colgropen line-fmt align
caption shortn label attr floatp placement
caption width shortn label attr floatp placement
longtblp tblenv tabular-env)
(if org-export-latex-tables-verbatim
(let* ((tbl (concat "\\begin{verbatim}\n" raw-table

View File

@ -476,8 +476,8 @@ This checks `org-list-ending-method'."
"Is point in a line starting a hand-formatted item?"
(save-excursion
(beginning-of-line)
(and (not (eq (nth 2 (org-list-context)) 'invalid))
(looking-at (org-item-re)))))
(and (looking-at (org-item-re))
(not (eq (nth 2 (org-list-context)) 'invalid)))))
(defun org-at-item-bullet-p ()
"Is point at the bullet of a plain list item?"
@ -514,89 +514,75 @@ Context will be a cell like (MIN MAX CONTEXT) where MIN and MAX
are boundaries and CONTEXT is a symbol among `drawer', `block',
`invalid', `inlinetask' and nil.
Contexts `block' and `invalid' refer to
`org-list-forbidden-blocks'."
Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
(save-match-data
(save-excursion
(beginning-of-line)
(let* ((outline-regexp (org-get-limited-outline-regexp))
;; Can't use org-drawers-regexp as this function might be
;; called in buffers not in Org mode
(drawers-re (concat "^[ \t]*:\\("
(mapconcat 'regexp-quote org-drawers "\\|")
"\\):[ \t]*$"))
(case-fold-search t)
;; Compute position of surrounding headings. This is the
;; default context.
(heading
(save-excursion
(list
(or (and (org-at-heading-p) (point-at-bol))
(outline-previous-heading)
(point-min))
(or (outline-next-heading)
(point-max))
nil)))
(prev-head (car heading))
(next-head (nth 1 heading))
;; Is point inside a drawer?
(drawerp
(when (and (org-in-regexps-block-p
drawers-re "^[ \t]*:END:" prev-head)
(save-excursion
(beginning-of-line)
(and (not (looking-at drawers-re))
(not (looking-at "^[ \t]*:END:")))))
(save-excursion
(list
(progn
(re-search-backward drawers-re prev-head t)
(1+ (point-at-eol)))
(if (re-search-forward "^[ \t]*:END:" next-head t)
(1- (point-at-bol))
next-head)
'drawer))))
;; Is point strictly in a block, and of which type?
(blockp
(save-excursion
(when (and (org-in-regexps-block-p
"^[ \t]*#\\+begin_" "^[ \t]*#\\+end_" prev-head)
(save-excursion
(beginning-of-line)
(not (looking-at
"^[ \t]*#\\+\\(begin\\|end\\)_"))))
(list
(progn
(re-search-backward
"^[ \t]*#\\+begin_\\(\\S-+\\)" prev-head t)
(1+ (point-at-eol)))
(save-match-data
(if (re-search-forward "^[ \t]*#\\+end_" next-head t)
(1- (point-at-bol))
next-head))
(if (member (downcase (match-string 1))
org-list-forbidden-blocks)
'invalid
'block)))))
;; Is point in an inlinetask?
(inlinetaskp
(when (and (featurep 'org-inlinetask)
(org-inlinetask-in-task-p)
(not (looking-at "^\\*+")))
(save-excursion
(list
(progn (org-inlinetask-goto-beginning)
(1+ (point-at-eol)))
(progn
(org-inlinetask-goto-end)
(forward-line -1)
(1- (point-at-bol)))
'inlinetask))))
;; List actual candidates
(context-list
(delq nil (list heading drawerp blockp inlinetaskp))))
;; Return the closest context around
(assq (apply 'max (mapcar 'car context-list)) context-list)))))
(org-with-limited-levels
(beginning-of-line)
(let* ((case-fold-search t) (pos (point)) beg end
;; Compute position of surrounding headings. This is the
;; default context.
(heading
(save-excursion
(list (or (and (org-at-heading-p) (point-at-bol))
(outline-previous-heading)
(point-min))
(or (outline-next-heading) (point-max))
nil)))
(prev-head (car heading))
(next-head (nth 1 heading))
;; Is point inside a drawer?
(drawerp
(save-excursion
(let ((end-re "^[ \t]*:END:")
;; Can't use org-drawers-regexp as this function
;; might be called in buffers not in Org mode
(drawers-re (concat "^[ \t]*:\\("
(mapconcat 'regexp-quote org-drawers "\\|")
"\\):[ \t]*$")))
(and (not (looking-at drawers-re))
(not (looking-at end-re))
(setq beg (and (re-search-backward drawers-re prev-head t)
(1+ (point-at-eol))))
(setq end (or (and (re-search-forward end-re next-head t)
(1- (match-beginning 0)))
next-head))
(>= end pos)
(list beg end 'drawer)))))
;; Is point strictly in a block, and of which type?
(blockp
(save-excursion
(let ((block-re "^[ \t]*#\\+\\(begin\\|end\\)_") type)
(and (not (looking-at block-re))
(setq beg (and (re-search-backward block-re prev-head t)
(1+ (point-at-eol))))
(looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)")
(setq type (downcase (match-string 1)))
(goto-char beg)
(setq end (or (and (re-search-forward block-re next-head t)
(1- (point-at-bol)))
next-head))
(>= end pos)
(equal (downcase (match-string 1)) "end")
(list beg end (if (member type org-list-forbidden-blocks)
'invalid 'block))))))
;; Is point in an inlinetask?
(inlinetaskp
(when (featurep 'org-inlinetask)
(save-excursion
(let* ((stars-re (org-inlinetask-outline-regexp))
(end-re (concat stars-re "END[ \t]*$")))
(and (not (looking-at "^\\*+"))
(setq beg (and (re-search-backward stars-re prev-head t)
(1+ (point-at-eol))))
(not (looking-at end-re))
(setq end (and (re-search-forward end-re next-head t)
(1- (match-beginning 0))))
(> (point) pos)
(list beg end 'inlinetask))))))
;; List actual candidates
(context-list (delq nil (list heading drawerp blockp inlinetaskp))))
;; Return the closest context around
(assq (apply 'max (mapcar 'car context-list)) context-list)))))
(defun org-list-struct ()
"Return structure of list at point.
@ -1197,8 +1183,7 @@ This function modifies STRUCT."
;; 4. Insert effectively item into buffer
(goto-char item)
(org-indent-to-column ind)
(insert body)
(insert item-sep)
(insert body item-sep)
;; 5. Add new item to STRUCT.
(mapc (lambda (e)
(let ((p (car e))
@ -1238,7 +1223,7 @@ This function modifies STRUCT."
;; SIZE-OFFSET.
(t (setcar e (+ p size-offset))
(setcar (nthcdr 6 e) (+ end size-offset))))))
struct)
struct)
(push (list item ind bullet nil box nil (+ item item-size)) struct)
(setq struct (sort struct (lambda (e1 e2) (< (car e1) (car e2)))))
;; 6. If not BEFOREP, new item must appear after ITEM, so

View File

@ -40,6 +40,8 @@
;; user to add this class to his or her stylesheet if this div is to
;; mean anything.
(require 'org-compat)
(defvar org-special-blocks-ignore-regexp "^\\(LaTeX\\|HTML\\)$"
"A regexp indicating the names of blocks that should be ignored
by org-special-blocks. These blocks will presumably be

View File

@ -3715,7 +3715,7 @@ to execute outside of tables."
If it is a table to be sent away to a receiver, do it.
With prefix arg, also recompute table."
(interactive "P")
(let ((pos (point)) action consts-str consts cst)
(let ((pos (point)) action consts-str consts cst const-str)
(save-excursion
(beginning-of-line 1)
(setq action (cond

View File

@ -18201,6 +18201,12 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(display-buffer buf)
(sit-for 0))))
(defun org-eval (form)
"Eval FORM and return result."
(condition-case error
(eval form)
(error (format "%%![Error: %s]" error))))
(defun org-in-commented-line ()
"Is point in a line starting with `#'?"
(equal (char-after (point-at-bol)) ?#))