emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* dynamic block for columnview: indent and TBLFM
@ 2011-11-02 17:06 Michael Brand
  2011-11-03 11:13 ` Michael Brand
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Brand @ 2011-11-02 17:06 UTC (permalink / raw)
  To: Org Mode; +Cc: Carsten Dominik

[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]

Hi all

There are some issues with dynamic block for columnview. Attached are
four minimal and complete example test files indent*_tbl*.org (remove
.txt) with different wrong behaviors dependent on if the dynamic block
is indented and if there is already a table from a previous update or
not. The test is always C-c C-c on the dynamic block header for
columnview with emacs -q, 23.3.

I searched related changes with git bisect to see if by chance I would
be able to resolve the issues by myself, but this seems too
complicated to me. If they might be interesting, from present to past:

- release_7.7-508-ga081581 (2011-11-02):

  still the same test results as release_6.30d-851-g74a59c0, see next

- commit 74a59c0c008e1123a0cadfa9933001bfc773ee85
  Author: Carsten Dominik <carsten.dominik@gmail.com>
  Date:   Fri Sep 18 09:12:26 2009 +0100

      Allow indented dynamic blocks

  - test results after change, release_6.30d-851-g74a59c0:

    | indent0_tbl0.org | nok | Lisp error, see attached backtrace |
    | indent0_tbl4.org | ok  | works as expected                  |
    | indent2_tbl0.org | nok | TBLFM deleted                      |
    | indent2_tbl4.org | nok | TBLFM deleted                      |

  - test results before change, release_6.30d-850-g60bf447:

    | indent0_tbl0.org | nok | Lisp error, see attached backtrace |
    | indent0_tbl4.org | ok  | works as expected                  |
    | indent2_tbl0.org | nok | misread as Local setup             |
    | indent2_tbl4.org | nok | misread as Local setup             |

- commit 3f1062a15d81aae2f1b10ea540f0d797711b492c
  Author: Carsten Dominik <carsten.dominik@gmail.com>
  Date:   Mon Sep 8 09:43:41 2008 +0200

      Save and restore formulas for column view capture.

  - test results after change, release_6.06b-53-g3f1062a:

    | indent0_tbl0.org | nok | Lisp error, see attached backtrace |
    | indent0_tbl4.org | ok  | works as expected                  |
    | indent2_tbl0.org | -   | indentation not supported          |
    | indent2_tbl4.org | -   | indentation not supported          |

  - test results before change, release_6.06b-52-g4aa23cf:

    | indent0_tbl0.org | nok | TBLFM deleted             |
    | indent0_tbl4.org | nok | TBLFM deleted             |
    | indent2_tbl0.org | -   | indentation not supported |
    | indent2_tbl4.org | -   | indentation not supported |

Michael

[-- Attachment #2: backtrace.txt --]
[-- Type: text/plain, Size: 4377 bytes --]

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("^#" nil)
  (while (string-match "^#" (car content-lines)) (insert (pop content-lines) "\n"))
  (progn (while (string-match "^#" ...) (insert ... "\n")))
  (if content-lines (progn (while ... ...)))
  (when content-lines (while (string-match "^#" ...) (insert ... "\n")))
  (progn (when (plist-get params :hlines) (setq tmp nil) (while tbl ...) (setq tbl ...)) (when vlines (setq tbl ...) (setq tbl ...)) (setq pos (point)) (when content-lines (while ... ...)) (insert (org-listtable-to-string tbl)) (when (plist-get params :width) (insert "\n|" ...)) (while (setq line ...) (when ... ... ...)) (if recalc (progn ... ...) (goto-char pos) (org-table-align)))
  (if tbl (progn (when ... ... ... ...) (when vlines ... ...) (setq pos ...) (when content-lines ...) (insert ...) (when ... ...) (while ... ...) (if recalc ... ... ...)))
  (when tbl (when (plist-get params :hlines) (setq tmp nil) (while tbl ...) (setq tbl ...)) (when vlines (setq tbl ...) (setq tbl ...)) (setq pos (point)) (when content-lines (while ... ...)) (insert (org-listtable-to-string tbl)) (when (plist-get params :width) (insert "\n|" ...)) (while (setq line ...) (when ... ... ...)) (if recalc (progn ... ...) (goto-char pos) (org-table-align)))
  (let ((pos ...) (hlines ...) (vlines ...) (maxlevel ...) (content-lines ...) (skip-empty-rows ...) tbl id idpos nfields tmp recalc line id-as-string view-file view-pos) (when (setq id ...) (setq id-as-string ...) (cond ... ... ... ... ... ... ...)) (with-current-buffer (if view-file ... ...) (save-excursion ...)) (goto-char pos) (move-marker pos nil) (when tbl (when ... ... ... ...) (when vlines ... ...) (setq pos ...) (when content-lines ...) (insert ...) (when ... ...) (while ... ...) (if recalc ... ... ...)))
  org-dblock-write:columnview((:name "columnview" :maxlevel 3 :id 114233DF-D019-449E-892C :indentation-column 0 :content #("#+TBLFM: $2 = ceil($3 / 8)\n" 0 26 (fontified t font-lock-fontified t face org-meta-line) 26 27 (fontified t font-lock-fontified t face org-meta-line))))
  funcall(org-dblock-write:columnview (:name "columnview" :maxlevel 3 :id 114233DF-D019-449E-892C :indentation-column 0 :content #("#+TBLFM: $2 = ceil($3 / 8)\n" 0 26 (fontified t font-lock-fontified t face org-meta-line) 26 27 (fontified t font-lock-fontified t face org-meta-line))))
  (let* ((pos ...) (line ...) (params ...) (name ...) (indent ...) (cmd ...)) (message "Updating dynamic block `%s' at line %d..." name line) (funcall cmd params) (message "Updating dynamic block `%s' at line %d...done" name line) (goto-char pos) (when (and indent ...) (setq indent ...) (save-excursion ... ... ... ...)))
  (save-window-excursion (let* (... ... ... ... ... ...) (message "Updating dynamic block `%s' at line %d..." name line) (funcall cmd params) (message "Updating dynamic block `%s' at line %d...done" name line) (goto-char pos) (when ... ... ...)))
  org-update-dblock()
  (save-excursion (org-update-dblock))
  (cond ((or ... org-occur-highlights org-latex-fragment-image-overlays) (and ... ...) (org-remove-occur-highlights) (org-remove-latex-fragment-image-overlays) (message "Temporary highlights/overlays removed from current buffer")) ((and ... ...) (funcall org-finish-function)) ((run-hook-with-args-until-success ...)) ((org-in-regexp org-ts-regexp-both) (org-timestamp-change 0 ...)) ((or ... ...) (call-interactively ...)) ((org-on-target-p) (call-interactively ...)) ((and ... ...) (call-interactively ...)) ((org-on-heading-p) (call-interactively ...)) ((org-at-table\.el-p) (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg ... ...) (call-interactively ...) (orgtbl-send-table ...)) ((or ... ...) (call-interactively ...)) ((org-at-item-checkbox-p) (let* ... ... ... ... ... ... ... ... ...)) ((org-at-item-p) (let* ... ... ... ... ...)) ((save-excursion ... ...) (beginning-of-line 1) (save-excursion ...)) ((save-excursion ... ...) (cond ... ...)) ((org-clock-update-time-maybe)) (t (or ... ...)))
  (let ((org-enable-table-editor t)) (cond (... ... ... ... ...) (... ...) (...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ... ... ... ...) (... ...) (... ...) (... ...) (... ... ...) (... ...) (...) (t ...)))
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)

[-- Attachment #3: indent0_tbl0.org.txt --]
[-- Type: text/plain, Size: 381 bytes --]

#+COLUMNS: %50ITEM(Task) %Days %5Effort({Hours}){+}
#+STARTUP: odd showall

#+BEGIN: columnview :maxlevel 3 :id 62b7c4f5-bc38-411e-b24f-ba9c4adb74da
#+TBLFM: $2 = ceil($3 / 8)
#+END:

* project
*** Total of Effort
    :PROPERTIES:
    :ID:       62b7c4f5-bc38-411e-b24f-ba9c4adb74da
    :END:
***** feature
******* TODO task
        :PROPERTIES:
        :Effort:   7
        :END:

[-- Attachment #4: indent0_tbl4.org.txt --]
[-- Type: text/plain, Size: 485 bytes --]

#+COLUMNS: %50ITEM(Task) %Days %5Effort({Hours}){+}
#+STARTUP: odd showall

#+BEGIN: columnview :maxlevel 3 :id ddb38905-fcbb-473b-99ef-d35194604ffa
| Task | Days | {Hours} |
|------+------+---------|
|      |      |         |
|      |      |         |
#+TBLFM: $2 = ceil($3 / 8)
#+END:

* project
*** Total of Effort
    :PROPERTIES:
    :ID:       ddb38905-fcbb-473b-99ef-d35194604ffa
    :END:
***** feature
******* TODO task
        :PROPERTIES:
        :Effort:   7
        :END:

[-- Attachment #5: indent2_tbl0.org.txt --]
[-- Type: text/plain, Size: 401 bytes --]

#+COLUMNS: %50ITEM(Task) %Days %5Effort({Hours}){+}
#+STARTUP: odd showall

* custom view
  #+BEGIN: columnview :maxlevel 3 :id f96484a3-c520-4abf-979e-e8ff2c047c54
  #+TBLFM: $2 = ceil($3 / 8)
  #+END:

* project
*** Total of Effort
    :PROPERTIES:
    :ID:       f96484a3-c520-4abf-979e-e8ff2c047c54
    :END:
***** feature
******* TODO task
        :PROPERTIES:
        :Effort:   7
        :END:

[-- Attachment #6: indent2_tbl4.org.txt --]
[-- Type: text/plain, Size: 513 bytes --]

#+COLUMNS: %50ITEM(Task) %Days %5Effort({Hours}){+}
#+STARTUP: odd showall

* custom view
  #+BEGIN: columnview :maxlevel 3 :id 52d4f620-6f41-414f-89d8-cd3e8e19a2f0
  | Task | Days | {Hours} |
  |------+------+---------|
  |      |      |         |
  |      |      |         |
  #+TBLFM: $2 = ceil($3 / 8)
  #+END:

* project
*** Total of Effort
    :PROPERTIES:
    :ID:       52d4f620-6f41-414f-89d8-cd3e8e19a2f0
    :END:
***** feature
******* TODO task
        :PROPERTIES:
        :Effort:   7
        :END:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dynamic block for columnview: indent and TBLFM
  2011-11-02 17:06 dynamic block for columnview: indent and TBLFM Michael Brand
@ 2011-11-03 11:13 ` Michael Brand
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Brand @ 2011-11-03 11:13 UTC (permalink / raw)
  To: Org Mode; +Cc: Carsten Dominik

There is another issue with export (to HTML) that I found out only now
to be related with indentation: The example below exports like
expected but when all lines below project are indented (by two spaces)
then the lines BEGIN and END are also exported.

* project
#+BEGIN: columnview :maxlevel 3 :id ddb38905-fcbb-473b-99ef
| Task                | Days |
|---------------------+------|
| *** Total of Effort |    1 |
| ***** feature       |    1 |
#+END:

Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-03 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-02 17:06 dynamic block for columnview: indent and TBLFM Michael Brand
2011-11-03 11:13 ` Michael Brand

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).