Browse Source

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

Dan Davison 15 years ago
parent
commit
037061e7d8

+ 1 - 0
.dir-locals.el

@@ -0,0 +1 @@
+.dir-settings.el

+ 3 - 2
contrib/babel/lisp/langs/org-babel-clojure.el

@@ -127,8 +127,9 @@ specifying a var of the same value."
   (let ((vars-forms (mapconcat ;; define any variables
                       (lambda (pair)
                         (format "%s %s" (car pair) (org-babel-clojure-var-to-clojure (cdr pair))))
-                      vars "\n      ")))
-    (format "(let [%s]\n  %s)" vars-forms (org-babel-trim body))))
+                      vars "\n      "))
+	(body (org-babel-trim body)))
+    (if (> (length vars-forms) 0) (format "(let [%s]\n  %s)" vars-forms body) body)))
 
 (defun org-babel-prep-session:clojure (session params)
   "Prepare SESSION according to the header arguments specified in PARAMS."

+ 10 - 9
contrib/babel/lisp/langs/org-babel-emacs-lisp.el

@@ -45,15 +45,16 @@
          (processed-params (org-babel-process-params params))
          (result-params (third processed-params))
          (print-level nil) (print-length nil)
-         (body (concat "(let ("
-                       (mapconcat
-                        (lambda (var) (format "%S" (print `(,(car var) ',(cdr var)))))
-                        vars "\n      ")
-                       ")\n"
-                       (if (or (member "code" result-params)
-                               (member "pp" result-params))
-                           (concat "(pp " body ")") body) ")")))
-    body))
+         (body (if (> (length vars) 0)
+		   (concat "(let ("
+			 (mapconcat
+			  (lambda (var) (format "%S" (print `(,(car var) ',(cdr var)))))
+			  vars "\n      ")
+			 ")\n" body ")")
+		 body)))
+    (if (or (member "code" result-params)
+	    (member "pp" result-params))
+	(concat "(pp " body ")") body)))
 
 (defun org-babel-execute:emacs-lisp (body params)
   "Execute a block of emacs-lisp code with org-babel."

+ 8 - 5
contrib/babel/lisp/org-babel-tangle.el

@@ -187,13 +187,16 @@ code blocks by language."
                   (cons
                    (cons src-lang
                          (cons (list link source-name params
-                                     (funcall
-                                      (intern
-                                       (concat "org-babel-expand-body:" src-lang))
+                                     ((lambda (body)
+                                        (if (assoc :no-expand params)
+                                            body
+                                          (funcall
+                                           (intern (concat "org-babel-expand-body:" src-lang))
+                                           body
+                                           params)))
                                       (if (and (cdr (assoc :noweb params))
                                                (string= "yes" (cdr (assoc :noweb params))))
-                                          (org-babel-expand-noweb-references info) (second info))
-                                      params)
+                                          (org-babel-expand-noweb-references info) (second info)))
                                      (third (cdr (assoc
                                                   src-lang org-babel-tangle-langs))))
                                by-lang)) blocks))))))

+ 3 - 2
doc/org.texi

@@ -5582,6 +5582,7 @@ new table.  The @samp{BEGIN} line can specify options:
 :tend        @r{A time string specifying when to stop considering times.}
 :step        @r{@code{week} or @code{day}, to split the table into chunks.}
              @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
+:tags        @r{A tags match to select entries that should contribute}
 :link        @r{Link the item headlines in the table to their origins.}
 :formula     @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
              @r{As a special case, @samp{:formula %} adds a column with % time.}
@@ -10476,7 +10477,7 @@ respectively.  Any other value will mix files and folders.
 @code{nil} to turn off sorting.
 
 @item @code{:sitemap-ignore-case}
-@tab Should sorting be case-sensitively?  Default @code{nil}.
+@tab Should sorting be case-sensitive?  Default @code{nil}.
 
 @end multitable
 
@@ -12708,7 +12709,7 @@ with links transformation to Org syntax.
 chapter about publishing.
 @item
 @i{Stefan Vollmar} organized a video-recorded talk at the
-Max-PLanck-Institute for Neurology.  He also inspired the creation of a
+Max-Planck-Institute for Neurology.  He also inspired the creation of a
 concept index for HTML export.
 @item
 @i{J@"urgen Vollmer} contributed code generating the table of contents

+ 17 - 0
lisp/ChangeLog

@@ -1,5 +1,22 @@
+2010-04-24  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-table.el (org-table-justify-field-maybe): Make sure that
+	inserting a value does not turn a line into a hline.
+
 2010-04-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-sum): New argument HEADLINE-FILTER.
+	(org-clock-sum): Add property to selected headlines.
+	(org-dblock-write:clocktable): Make tags matcher.
+
+	* org.el (org-set-autofill-regexps): XEmacs compatibility.
+
+	* org-latex.el (org-export-latex-set-initial-vars): Allow "-"
+	in latex class definitions
+
+	* org.el (org-shiftup-hook, org-shiftdown-hook)
+	(org-shiftleft-hook, org-shiftright-hook): New hooks.
+
 	* org-entities.el (org-entities): Use \land and \lor for logical
 	operators.
 

+ 46 - 13
lisp/org-clock.el

@@ -1311,10 +1311,13 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
   "Holds the file total time in minutes, after a call to `org-clock-sum'.")
 (make-variable-buffer-local 'org-clock-file-total-minutes)
 
-(defun org-clock-sum (&optional tstart tend)
+(defun org-clock-sum (&optional tstart tend headline-filter)
   "Sum the times for each subtree.
 Puts the resulting times in minutes as a text property on each headline.
-TSTART and TEND can mark a time range to be considered."
+TSTART and TEND can mark a time range to be considered.  HEADLINE-FILTER is a
+zero-arg function that, if specified, is called for each headline in the time 
+range with point at the headline.  Headlines for which HEADLINE-FILTER returns
+nil are excluded from the clock summation."
   (interactive)
   (let* ((bmp (buffer-modified-p))
 	 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
@@ -1330,7 +1333,9 @@ TSTART and TEND can mark a time range to be considered."
     (if (stringp tend) (setq tend (org-time-string-to-seconds tend)))
     (if (consp tstart) (setq tstart (org-float-time tstart)))
     (if (consp tend) (setq tend (org-float-time tend)))
-    (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
+    (remove-text-properties (point-min) (point-max)
+                            '(:org-clock-minutes t
+                              :org-clock-force-headline-inclusion t))
     (save-excursion
       (goto-char (point-max))
       (while (re-search-backward re nil t)
@@ -1359,15 +1364,34 @@ TSTART and TEND can mark a time range to be considered."
 	      (let ((time (floor (- (org-float-time)
 				    (org-float-time org-clock-start-time)) 60)))
 		(setq t1 (+ t1 time))))
-	  (setq level (- (match-end 1) (match-beginning 1)))
-	  (when (or (> t1 0) (> (aref ltimes level) 0))
-	    (loop for l from 0 to level do
-		  (aset ltimes l (+ (aref ltimes l) t1)))
-	    (setq t1 0 time (aref ltimes level))
-	    (loop for l from level to (1- lmax) do
-		  (aset ltimes l 0))
-	    (goto-char (match-beginning 0))
-	    (put-text-property (point) (point-at-eol) :org-clock-minutes time)))))
+	  (let* ((headline-forced
+                  (get-text-property (point)
+                                     :org-clock-force-headline-inclusion))
+                 (headline-included
+                  (or (null headline-filter)
+                      (save-excursion
+                        (save-match-data (funcall headline-filter))))))
+	    (setq level (- (match-end 1) (match-beginning 1)))
+	    (when (or (> t1 0) (> (aref ltimes level) 0))
+	      (when (or headline-included headline-forced)
+                (if headline-included
+                    (loop for l from 0 to level do
+                          (aset ltimes l (+ (aref ltimes l) t1))))
+		(setq time (aref ltimes level))
+		(goto-char (match-beginning 0))
+		(put-text-property (point) (point-at-eol) :org-clock-minutes time)
+                (if headline-filter
+                    (save-excursion
+                      (save-match-data
+                        (while
+                            (> (funcall outline-level) 1)
+                          (outline-up-heading 1 t)
+                          (put-text-property
+                           (point) (point-at-eol)
+                           :org-clock-force-headline-inclusion t))))))
+	      (setq t1 0)
+	      (loop for l from level to (1- lmax) do
+		    (aset ltimes l 0)))))))
       (setq org-clock-file-total-minutes (aref ltimes 0)))
     (set-buffer-modified-p bmp)))
 
@@ -1687,6 +1711,8 @@ the currently selected interval size."
 	   (te (plist-get params :tend))
 	   (block (plist-get params :block))
 	   (link (plist-get params :link))
+	   (tags (plist-get params :tags))
+	   (matcher (if tags (cdr (org-make-tags-matcher tags))))
 	   ipos time p level hlc hdl tsp props content recalc formula pcol
 	   cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st)
       (setq org-clock-file-total-minutes nil)
@@ -1768,7 +1794,14 @@ the currently selected interval size."
 	(goto-char pos)
 
 	(unless scope-is-list
-	  (org-clock-sum ts te)
+	  (org-clock-sum ts te
+			 (unless (null matcher)
+			   (lambda ()
+			     (let ((tags-list
+				    (org-split-string
+				     (or (org-entry-get (point) "ALLTAGS") "")
+				     ":")))
+			       (eval matcher)))))
 	  (goto-char (point-min))
 	  (setq st t)
 	  (while (or (and (bobp) (prog1 st (setq st nil))

+ 1 - 1
lisp/org-latex.el

@@ -1086,7 +1086,7 @@ LEVEL indicates the default depth for export."
 	      (save-restriction
 		(widen)
 		(goto-char (point-min))
-		(and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
+		(and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(-[a-zA-Z]+\\)" nil t)
 		     (match-string 1))))
 	    (plist-get org-export-latex-options-plist :latex-class)
 	    org-export-latex-default-class)

+ 1 - 1
lisp/org-publish.el

@@ -184,7 +184,7 @@ sitemap of files or summary page for a given project.
                            Any other value will mix files and folders.
   :sitemap-alphabetically  The site map is normally sorted alphabetically.
                            Set this explicitly to nil to turn off sorting.
-  :sitemap-ignore-case     Should sorting be case-sensitively?  Default nil.
+  :sitemap-ignore-case     Should sorting be case-sensitive?  Default nil.
 
 The following properties control the creation of a concept index.
 

+ 1 - 0
lisp/org-table.el

@@ -830,6 +830,7 @@ Optional argument NEW may specify text to replace the current field content."
 		  (if (<= (length new) l)      ;; FIXME: length -> str-width?
 		      (setq n (format f new))
 		    (setq n (concat new "|") org-table-may-need-update t)))
+	      (if (equal (string-to-char n) ?-) (setq n (concat " " n)))
 	      (or (equal n o)
 		  (let (org-table-may-need-update)
 		    (replace-match n t t))))

+ 17 - 1
lisp/org.el

@@ -15930,6 +15930,18 @@ See `org-ctrl-c-ctrl-c-hook' for more information.")
 (defvar org-metareturn-hook nil
   "Hook for functions attaching themselves to `M-RET'.
 See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftup-hook nil
+  "Hook for functions attaching themselves to `S-up'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftdown-hook nil
+  "Hook for functions attaching themselves to `S-down'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftleft-hook nil
+  "Hook for functions attaching themselves to `S-left'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
+(defvar org-shiftright-hook nil
+  "Hook for functions attaching themselves to `S-right'.
+See `org-ctrl-c-ctrl-c-hook' for more information.")
 
 (defun org-modifier-cursor-error ()
   "Throw an error, a modified cursor command was applied in wrong context."
@@ -16126,6 +16138,7 @@ Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item',
 depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftup-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'previous-line))
    ((org-at-timestamp-p t)
@@ -16148,6 +16161,7 @@ Calls `org-timestamp-down' or `org-priority-down', or `org-next-item'
 depending on context.  See the individual commands for more information."
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftdown-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'next-line))
    ((org-at-timestamp-p t)
@@ -16175,6 +16189,7 @@ Depending on context, this does one of the following:
 - on a clocktable definition line, move time block into the future"
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftright-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'forward-char))
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
@@ -16209,6 +16224,7 @@ Depending on context, this does one of the following:
 - on a clocktable definition line, move time block into the past"
   (interactive "P")
   (cond
+   ((run-hook-with-args-until-success 'org-shiftleft-hook))
    ((and org-support-shift-select (org-region-active-p))
     (org-call-for-shift-select 'backward-char))
    ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
@@ -17774,7 +17790,7 @@ the functionality can be provided as a fall-back.")
   (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
   ;; Adaptive filling: To get full control, first make sure that
   ;; `adaptive-fill-regexp' never matches.  Then install our own matcher.
-  (unless (local-variable-p 'adaptive-fill-regexp)
+  (unless (local-variable-p 'adaptive-fill-regexp (current-buffer))
     (org-set-local 'org-adaptive-fill-regexp-backup
                    adaptive-fill-regexp))
   (org-set-local 'adaptive-fill-regexp "\000")