Explorar o código

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

Carsten Dominik %!s(int64=14) %!d(string=hai) anos
pai
achega
da0f4997fb
Modificáronse 6 ficheiros con 381 adicións e 270 borrados
  1. 321 241
      doc/org.texi
  2. 44 16
      lisp/ob-calc.el
  3. 12 9
      lisp/org-id.el
  4. 1 1
      lisp/org-list.el
  5. 2 2
      lisp/org.el
  6. 1 1
      testing/org-test.el

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 321 - 241
doc/org.texi


+ 44 - 16
lisp/ob-calc.el

@@ -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))))

+ 12 - 9
lisp/org-id.el

@@ -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."

+ 1 - 1
lisp/org-list.el

@@ -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))

+ 2 - 2
lisp/org.el

@@ -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)

+ 1 - 1
testing/org-test.el

@@ -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\\)\".

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio