From 98026d21e3901d64bb12db3f07166731d6ecb685 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 23 Apr 2010 20:52:28 +0200 Subject: [PATCH 01/12] New hooks to attach commands to S-cursor hooks --- lisp/ChangeLog | 3 +++ lisp/org.el | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 713139469..1a53d439c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-04-23 Carsten Dominik + * 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. diff --git a/lisp/org.el b/lisp/org.el index f21e5bb20..c0369f35f 100644 --- a/lisp/org.el +++ b/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)) From ff3855027811bae0bc071fc9989952b5a6dd5f2a Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 23 Apr 2010 20:57:47 +0200 Subject: [PATCH 02/12] Allow a dash in the name of a latex document class setup. A line like #+LATEX_CLASS: auto-report will now work. Report by Nicolas Girad. --- lisp/ChangeLog | 3 +++ lisp/org-latex.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1a53d439c..9087453ed 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-04-23 Carsten Dominik + * 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. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 67d974570..8e3cd7fee 100644 --- a/lisp/org-latex.el +++ b/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) From 07198e34f6b9895498cdf0aa840c5dddaef070e0 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 23 Apr 2010 21:02:19 +0200 Subject: [PATCH 03/12] XEmacs compatibility fix --- lisp/ChangeLog | 2 ++ lisp/org.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9087453ed..ad6d7c6c5 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-04-23 Carsten Dominik + * org.el (org-set-autofill-regexps): XEmacs compatibility. + * org-latex.el (org-export-latex-set-initial-vars): Allow "-" in latex class definitions diff --git a/lisp/org.el b/lisp/org.el index c0369f35f..62df86cee 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17790,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") From c59da3a3dd5ec282f955994e309d8fe008acb171 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 23 Apr 2010 21:24:19 +0200 Subject: [PATCH 04/12] Add tags matching to clock tables Adam Elliott writes: > I have attached a git patch against master that implements a new > parameter to clock tables, "tags". This parameter is a tags-query as a > string and is used to filter the headlines which are consulted when > building the clock table. > > In my search of the archives to see if this feature already existed, I > found a reference here: > http://article.gmane.org/gmane.emacs.orgmode/17304 > suggesting it was difficult. The patch is not so large, though, so > perhaps I am missing something. > > My rationale in implementing this feature was to keep track of the > occasional task item that is not billable, yet still makes sense to > include in the overall project structure. Of course I could just avoid > clocking the task item, or manually delete clock lines before generating > a report, but this feature reduces the chance for error; no doubt there > are other workflows enabled with this feature as well. I don't make > significant use of tags myself, but I know many do. > > In order to maintain a sensible report, headlines that don't match the > tag filter may be included if they have descendants that do. Any time > clocked directly on non-matching headlines, however, is excluded. > > Specifying even a simple filter noticeably slows down clock table > generation for non-toy reports, particularly for clock table reports > with :step. If there is no filter, though, there is no degradation in > performance. > > Tag filter syntax is the standard one, as described at: > http://orgmode.org/manual/Matching-tags-and-properties.html > Only tags are considered at the moment, although I suspect querying > against all properties would be possible (if even slower). > > Examples: > > * development > CLOCK: => 1:00 > *** task 1 > CLOCK: => 1:00 > *** task 2 :must: > ***** task 2a > CLOCK: => 1:00 > ***** task 2b :mustnot: > CLOCK: => 1:00 > > Note I am using an unconventional but legal(ish) clock format for > brevity. Clock tables are also pruned to only relevant lines. > > [1] #+BEGIN: clocktable > | | *Total time* | *4:00* | | | > |---+--------------+--------+------+------| > | 1 | development | 4:00 | | | > | 2 | task 1 | | 1:00 | | > | 2 | task 2 | | 2:00 | | > | 3 | task 2a | | | 1:00 | > | 3 | task 2b | | | 1:00 | > > [2] #+BEGIN: clocktable :tags "must" > | | *Total time* | *2:00* | | | > |---+--------------+--------+------+------| > | 1 | development | 2:00 | | | > | 2 | task 2 | | 2:00 | | > | 3 | task 2a | | | 1:00 | > | 3 | task 2b | | | 1:00 | > > [3] #+BEGIN: clocktable :tags "-mustnot" > | | *Total time* | *3:00* | | | > |---+--------------+--------+------+------| > | 1 | development | 3:00 | | | > | 2 | task 1 | | 1:00 | | > | 2 | task 2 | | 1:00 | | > | 3 | task 2a | | | 1:00 | > > [4] #+BEGIN: clocktable :tags "must-mustnot" > | | *Total time* | *1:00* | | | > |---+--------------+--------+------+------| > | 1 | development | 1:00 | | | > | 2 | task 2 | | 1:00 | | > | 3 | task 2a | | | 1:00 | > > [5] #+BEGIN: clocktable :tags "must+mustnot" > | | *Total time* | *1:00* | | | > |---+--------------+--------+------+------| > | 1 | development | 1:00 | | | > | 2 | task 2 | | 1:00 | | > | 3 | task 2b | | | 1:00 | > > As you can see, in examples 2, 4, and 5, the time clocked on > "development" itself is being removed. Example 2 illustrates the effect > of tag inheritance. > > Adam --- doc/org.texi | 1 + lisp/ChangeLog | 4 ++++ lisp/org-clock.el | 59 ++++++++++++++++++++++++++++++++++++----------- 3 files changed, 51 insertions(+), 13 deletions(-) mode change 100644 => 100755 lisp/org-clock.el diff --git a/doc/org.texi b/doc/org.texi index 69e23e0ca..5c13e07bf 100644 --- a/doc/org.texi +++ b/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.} diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad6d7c6c5..ea730e309 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2010-04-23 Carsten Dominik + * 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 "-" diff --git a/lisp/org-clock.el b/lisp/org-clock.el old mode 100644 new mode 100755 index d1805e66d..c8bf6cc8c --- a/lisp/org-clock.el +++ b/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)) From 0483c0b595e594990eaf1b9782ee2d22582e09f3 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 23 Apr 2010 21:31:45 +0200 Subject: [PATCH 05/12] Added a symlink `.dir-locals.el --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) create mode 120000 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 120000 index 000000000..2c9dc3539 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1 @@ +.dir-settings.el \ No newline at end of file From 3a7f7dbccaa306dbb170ecbea50e238cc757a69c Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 02:17:07 +0200 Subject: [PATCH 06/12] Fix typos --- doc/org.texi | 4 ++-- lisp/org-publish.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 5c13e07bf..527ce719a 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10477,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 @@ -12709,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 diff --git a/lisp/org-publish.el b/lisp/org-publish.el index 894354fe7..328d9611c 100644 --- a/lisp/org-publish.el +++ b/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. From 0340cf14b71e3ffe9b81efb02e594176f71de5ed Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 10:22:49 +0200 Subject: [PATCH 07/12] Fix table formula bug with negative result numbers Willian Henney writes: > The following is using today's git trunk of org-mode with emacs > 23.1.94.1 (aquamacs 2.0preview5) > > Consider the following table > > | -8 | > | | > | | > | | > #+TBLFM: $1=@-1 - 1::@1$1=-8 > > Evaluate formulas once (C-u C-c *): > > | -8 | > | -9 | > |----| > | -1 | > > Evaluate formulas again (C-u C-c *): > > | -8 | > | -9 | > |----| > |----| > > What I expected: > > | -8 | > | -9 | > | -10 | > | -11 | > > The problem always seems to start at -10. When I turn on table > debugging, it first calculates the -10 value correctly, but then fails > to recognise the -10 cell as a number when calculating the next row, > using 0 instead, which results in -1. This is because during the > intermediate formatting of the cell the minus sign in -10 abuts the > column separator: "|-10 |", and the "|-" part is then interpreted as > the beginning of an hline. --- lisp/ChangeLog | 5 +++++ lisp/org-table.el | 1 + 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa5703ae5..f4800f05c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-24 Carsten Dominik + + * 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 * org-clock.el (org-clock-sum): New argument HEADLINE-FILTER. diff --git a/lisp/org-table.el b/lisp/org-table.el index c2df70626..430975986 100644 --- a/lisp/org-table.el +++ b/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)))) From f357e5f644078a28eb11133131002ddbca3e0cb8 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 14:14:15 +0200 Subject: [PATCH 08/12] Change the dot in section numbers to underscore, to get valid CSS class names --- lisp/ChangeLog | 4 ++++ lisp/org-html.el | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f4800f05c..1a2508274 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2010-04-24 Carsten Dominik + * org-html.el (org-export-as-html, org-html-level-start): + Change the dot in section numbers to underscore, to get valid + CSS class names. + * org-table.el (org-table-justify-field-maybe): Make sure that inserting a value does not turn a line into a hline. diff --git a/lisp/org-html.el b/lisp/org-html.el index 71f62ebfd..133bffab3 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -871,7 +871,9 @@ lang=\"%s\" xml:lang=\"%s\"> t t line))) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) (setq txt (replace-match "" t t txt))) - (setq href (format "sec-%s" snumber)) + (setq href + (replace-regexp-in-string + "\\." "_" (format "sec-%s" snumber))) (setq href (or (cdr (assoc href org-export-preferred-target-alist)) href)) (push (format @@ -2085,8 +2087,11 @@ When TITLE is nil, just close all open levels." " " title))) (unless (= head-count 1) (insert "\n\n")) (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) - (setq suffix (or href snumber)) - (setq href (or href (concat "sec-" snumber))) + (setq suffix (or href + (replace-regexp-in-string "\\." "_" snumber))) + (setq href (or href + (replace-regexp-in-string + "\\." "_" (concat "sec-" snumber)))) (insert (format "\n
\n%s%s\n
\n" suffix level (if extra-class (concat " " extra-class) "") level href From 7ef9685bcf3bf50e0e505b17a63c01f04ad82959 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 14:16:26 +0200 Subject: [PATCH 09/12] Revert "Change the dot in section numbers to underscore, to get valid CSS class names" This reverts commit f357e5f644078a28eb11133131002ddbca3e0cb8. --- lisp/ChangeLog | 4 ---- lisp/org-html.el | 11 +++-------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1a2508274..f4800f05c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,9 +1,5 @@ 2010-04-24 Carsten Dominik - * org-html.el (org-export-as-html, org-html-level-start): - Change the dot in section numbers to underscore, to get valid - CSS class names. - * org-table.el (org-table-justify-field-maybe): Make sure that inserting a value does not turn a line into a hline. diff --git a/lisp/org-html.el b/lisp/org-html.el index 133bffab3..71f62ebfd 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -871,9 +871,7 @@ lang=\"%s\" xml:lang=\"%s\"> t t line))) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) (setq txt (replace-match "" t t txt))) - (setq href - (replace-regexp-in-string - "\\." "_" (format "sec-%s" snumber))) + (setq href (format "sec-%s" snumber)) (setq href (or (cdr (assoc href org-export-preferred-target-alist)) href)) (push (format @@ -2087,11 +2085,8 @@ When TITLE is nil, just close all open levels." " " title))) (unless (= head-count 1) (insert "\n
\n")) (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) - (setq suffix (or href - (replace-regexp-in-string "\\." "_" snumber))) - (setq href (or href - (replace-regexp-in-string - "\\." "_" (concat "sec-" snumber)))) + (setq suffix (or href snumber)) + (setq href (or href (concat "sec-" snumber))) (insert (format "\n
\n%s%s\n
\n" suffix level (if extra-class (concat " " extra-class) "") level href From 44622297420c16676b11dfa8b306098ded0081e7 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 10:22:49 +0200 Subject: [PATCH 10/12] Fix table formula bug with negative result numbers Willian Henney writes: > The following is using today's git trunk of org-mode with emacs > 23.1.94.1 (aquamacs 2.0preview5) > > Consider the following table > > | -8 | > | | > | | > | | > #+TBLFM: $1=@-1 - 1::@1$1=-8 > > Evaluate formulas once (C-u C-c *): > > | -8 | > | -9 | > |----| > | -1 | > > Evaluate formulas again (C-u C-c *): > > | -8 | > | -9 | > |----| > |----| > > What I expected: > > | -8 | > | -9 | > | -10 | > | -11 | > > The problem always seems to start at -10. When I turn on table > debugging, it first calculates the -10 value correctly, but then fails > to recognise the -10 cell as a number when calculating the next row, > using 0 instead, which results in -1. This is because during the > intermediate formatting of the cell the minus sign in -10 abuts the > column separator: "|-10 |", and the "|-" part is then interpreted as > the beginning of an hline. --- lisp/ChangeLog | 5 +++++ lisp/org-table.el | 1 + 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa5703ae5..f4800f05c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-24 Carsten Dominik + + * 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 * org-clock.el (org-clock-sum): New argument HEADLINE-FILTER. diff --git a/lisp/org-table.el b/lisp/org-table.el index c2df70626..430975986 100644 --- a/lisp/org-table.el +++ b/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)))) From bc0a6c624d2eb3647c8905299f1dcb4a16e3ff6a Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sat, 24 Apr 2010 09:08:27 -0600 Subject: [PATCH 11/12] babel: adding :no-expand option to code blocks to inhibit body expansion --- contrib/babel/lisp/org-babel-tangle.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/babel/lisp/org-babel-tangle.el b/contrib/babel/lisp/org-babel-tangle.el index b66d66ee6..2f7f8a223 100644 --- a/contrib/babel/lisp/org-babel-tangle.el +++ b/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)))))) From b8adc74894bcb9b086517aacef262cd8d97bb5c3 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sat, 24 Apr 2010 09:21:14 -0600 Subject: [PATCH 12/12] babel: ob-emacs-lisp and ob-clojure now only wrap bodies in `let' forms when variables are present --- contrib/babel/lisp/langs/org-babel-clojure.el | 5 +++-- .../babel/lisp/langs/org-babel-emacs-lisp.el | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/contrib/babel/lisp/langs/org-babel-clojure.el b/contrib/babel/lisp/langs/org-babel-clojure.el index ffd07ec82..cd72d9394 100644 --- a/contrib/babel/lisp/langs/org-babel-clojure.el +++ b/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." diff --git a/contrib/babel/lisp/langs/org-babel-emacs-lisp.el b/contrib/babel/lisp/langs/org-babel-emacs-lisp.el index 073ee3daf..f15afe3e8 100644 --- a/contrib/babel/lisp/langs/org-babel-emacs-lisp.el +++ b/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."