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)
"Execute a block of calc code with Babel."
(mapcar
(lambda (line)
(when (> (length line) 0)
(if (string= "'" (substring line 0 1))
(funcall (lookup-key calc-mode-map (substring line 1)) nil)
(calc-push-list
(list ((lambda (res)
(cond
((numberp res) res)
((listp res) (error "calc error \"%s\" on input \"%s\""
(cadr res) line))
(t res))
(if (numberp res) res (math-read-number res)))
(calc-eval line)))))))
(mapcar #'org-babel-trim
(split-string (org-babel-expand-body:calc body params) "[\n\r]")))
(let* ((vars (mapcar #'cdr (org-babel-get-header params :var)))
(var-syms (mapcar #'car vars))
(var-names (mapcar #'symbol-name var-syms)))
(mapc
(lambda (pair)
(calc-push-list (list (cdr pair)))
(calc-store-into (car pair)))
vars)
(mapcar
(lambda (line)
(when (> (length line) 0)
(cond
;; simple variable name
((member line var-names) (calc-recall (intern line)))
;; stack operation
((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
(set-buffer (get-buffer "*Calculator*"))
(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 ()
"Store a link to the current entry, using its ID."
(interactive)
(let* ((link (org-make-link "id:" (org-id-get-create)))
(case-fold-search nil)
(desc (save-excursion
(org-back-to-heading t)
(or (and (looking-at org-complex-heading-regexp)
(if (match-end 4) (match-string 4) (match-string 0)))
link))))
(org-store-link-props :link link :description desc :type "id")
link))
(when (and (buffer-file-name (buffer-base-buffer)) (org-mode-p))
(let* ((link (org-make-link "id:" (org-id-get-create)))
(case-fold-search nil)
(desc (save-excursion
(org-back-to-heading t)
(or (and (looking-at org-complex-heading-regexp)
(if (match-end 4)
(match-string 4)
(match-string 0)))
link))))
(org-store-link-props :link link :description desc :type "id")
link)))
(defun org-id-open (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)
(save-excursion
(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)
(t 'unordered))))
(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.
p Enter a property name and its value (both with completion on existing
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'.
b Show deadlines and scheduled items before a date.
a Show deadlines and scheduled items after a date."
(interactive "P")
(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))
(cond
((equal ans ?d)

View File

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