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

This commit is contained in:
Carsten Dominik 2010-11-04 16:46:25 +01:00
commit da0f4997fb
6 changed files with 423 additions and 334 deletions

File diff suppressed because it is too large Load Diff

View File

@ -40,22 +40,50 @@
(defun org-babel-execute:calc (body params) (defun org-babel-execute:calc (body params)
"Execute a block of calc code with Babel." "Execute a block of calc code with Babel."
(mapcar (let* ((vars (mapcar #'cdr (org-babel-get-header params :var)))
(lambda (line) (var-syms (mapcar #'car vars))
(when (> (length line) 0) (var-names (mapcar #'symbol-name var-syms)))
(if (string= "'" (substring line 0 1)) (mapc
(funcall (lookup-key calc-mode-map (substring line 1)) nil) (lambda (pair)
(calc-push-list (calc-push-list (list (cdr pair)))
(list ((lambda (res) (calc-store-into (car pair)))
(cond vars)
((numberp res) res) (mapcar
((listp res) (error "calc error \"%s\" on input \"%s\"" (lambda (line)
(cadr res) line)) (when (> (length line) 0)
(t res)) (cond
(if (numberp res) res (math-read-number res))) ;; simple variable name
(calc-eval line))))))) ((member line var-names) (calc-recall (intern line)))
(mapcar #'org-babel-trim ;; stack operation
(split-string (org-babel-expand-body:calc body params) "[\n\r]"))) ((string= "'" (substring line 0 1))
(funcall (lookup-key calc-mode-map (substring line 1)) nil))
;; complex expression
(t
(calc-push-list
(list ((lambda (res)
(cond
((numberp res) res)
((math-read-number res) (math-read-number res))
((listp res) (error "calc error \"%s\" on input \"%s\""
(cadr res) line))
(t (calc-eval
(math-evaluate-expr
;; resolve user variables, calc built in
;; variables are handled automatically
;; upstream by calc
(mapcar (lambda (el)
(if (and (consp el) (equal 'var (car el))
(member (cadr el) var-syms))
(progn
(calc-recall (cadr el))
(prog1 (calc-top 1)
(calc-pop 1)))
el))
;; parse line into calc objects
(first (math-read-exprs line))))))))
(calc-eval line))))))))
(mapcar #'org-babel-trim
(split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
(save-excursion (save-excursion
(set-buffer (get-buffer "*Calculator*")) (set-buffer (get-buffer "*Calculator*"))
(calc-eval (calc-top 1)))) (calc-eval (calc-top 1))))

View File

@ -600,15 +600,18 @@ optional argument MARKERP, return the position as a new marker."
(defun org-id-store-link () (defun org-id-store-link ()
"Store a link to the current entry, using its ID." "Store a link to the current entry, using its ID."
(interactive) (interactive)
(let* ((link (org-make-link "id:" (org-id-get-create))) (when (and (buffer-file-name (buffer-base-buffer)) (org-mode-p))
(case-fold-search nil) (let* ((link (org-make-link "id:" (org-id-get-create)))
(desc (save-excursion (case-fold-search nil)
(org-back-to-heading t) (desc (save-excursion
(or (and (looking-at org-complex-heading-regexp) (org-back-to-heading t)
(if (match-end 4) (match-string 4) (match-string 0))) (or (and (looking-at org-complex-heading-regexp)
link)))) (if (match-end 4)
(org-store-link-props :link link :description desc :type "id") (match-string 4)
link)) (match-string 0)))
link))))
(org-store-link-props :link link :description desc :type "id")
link)))
(defun org-id-open (id) (defun org-id-open (id)
"Go to the entry with id ID." "Go to the entry with id ID."

View File

@ -2029,7 +2029,7 @@ sublevels as a list of strings."
(while (org-search-forward-unenclosed org-item-beginning-re end t) (while (org-search-forward-unenclosed org-item-beginning-re end t)
(save-excursion (save-excursion
(beginning-of-line) (beginning-of-line)
(setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) (setq ltype (cond ((org-looking-at-p "^[ \t]*[0-9]") 'ordered)
((org-at-item-description-p) 'descriptive) ((org-at-item-description-p) 'descriptive)
(t 'unordered)))) (t 'unordered))))
(let* ((indent1 (org-get-indentation)) (let* ((indent1 (org-get-indentation))

View File

@ -11962,13 +11962,13 @@ T Show entries with a specific TODO keyword.
m Show entries selected by a tags/property match. m Show entries selected by a tags/property match.
p Enter a property name and its value (both with completion on existing p Enter a property name and its value (both with completion on existing
names/values) and show entries with that property. names/values) and show entries with that property.
/ Show entries matching a regular expression (`r' can be used as well) r Show entries matching a regular expression (`/' can be used as well)
d Show deadlines due within `org-deadline-warning-days'. d Show deadlines due within `org-deadline-warning-days'.
b Show deadlines and scheduled items before a date. b Show deadlines and scheduled items before a date.
a Show deadlines and scheduled items after a date." a Show deadlines and scheduled items after a date."
(interactive "P") (interactive "P")
(let (ans kwd value) (let (ans kwd value)
(message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty [d]eadlines\n [b]efore-date [a]fter-date") (message "Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date")
(setq ans (read-char-exclusive)) (setq ans (read-char-exclusive))
(cond (cond
((equal ans ?d) ((equal ans ?d)

View File

@ -197,7 +197,7 @@ files."
(defun org-test-current-defun () (defun org-test-current-defun ()
"Test the current function." "Test the current function."
(interactive) (interactive)
(ert (car (which-function)))) (ert (which-function)))
(defun org-test-run-all-tests () (defun org-test-run-all-tests ()
"Run all defined tests matching \"\\(org\\|ob\\)\". "Run all defined tests matching \"\\(org\\|ob\\)\".