1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-02-08 21:38:10 +00:00

org-colview: Fix :id in columnview

* lisp/org-colview.el (org-dblock-write:columnview): Fix typo in pcase
  so ID are properly recognized in current document.

* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add tests.
This commit is contained in:
Nicolas Goaziou 2016-02-27 09:21:11 +01:00
parent 7bcd3e6a79
commit 07e514b58b
2 changed files with 43 additions and 1 deletions

View File

@ -1400,7 +1400,7 @@ PARAMS is a property list of parameters:
(setq view-file (match-string-no-properties 1 id-string))
(unless (file-exists-p view-file)
(user-error "No such file: %S" id-string)))
((and (let idpos (org-find-entry-with-id id)) idpos)
((and (let idpos (org-find-entry-with-id id)) (guard idpos))
(setq view-pos idpos))
((let `(,filename . ,position) (org-id-find id))
(setq view-file filename)

View File

@ -1198,6 +1198,48 @@
<point>#+BEGIN: columnview :hlines 1 :id global
#+END:
* H2
** H2.1"
(let ((org-columns-default-format "%ITEM")) (org-update-dblock))
(buffer-substring-no-properties (point) (outline-next-heading)))))
(should
(equal
"#+BEGIN: columnview :hlines 1 :id \"id\"
| ITEM |
|------|
| H2 |
| H2.1 |
#+END:
"
(org-test-with-temp-text
"
* H
<point>#+BEGIN: columnview :hlines 1 :id \"id\"
#+END:
* H2
:PROPERTIES:
:ID: id
:END:
** H2.1"
(let ((org-columns-default-format "%ITEM")) (org-update-dblock))
(buffer-substring-no-properties (point) (outline-next-heading)))))
(should
(equal
"#+BEGIN: columnview :hlines 1 :id id
| ITEM |
|------|
| H2 |
| H2.1 |
#+END:
"
(org-test-with-temp-text
"
* H
<point>#+BEGIN: columnview :hlines 1 :id id
#+END:
* H2
:PROPERTIES:
:ID: id
:END:
** H2.1"
(let ((org-columns-default-format "%ITEM")) (org-update-dblock))
(buffer-substring-no-properties (point) (outline-next-heading)))))