Add and test the `get-org-table-fix-info' function
This commit is contained in:
parent
0bfce93f5d
commit
fc6b395b59
59
README.org
59
README.org
@ -2782,6 +2782,7 @@ SCHEDULED: <2023-06-30 Fri>
|
||||
:NDISK: 1
|
||||
:PUBLISHER: Deutsche Grammophon
|
||||
:END:
|
||||
,#+NAME: CD collection
|
||||
,#+BEGIN: columnview :hlines 1 :id "CD collection"
|
||||
| TITLE | ARTIST | GENRES | N | PUBLISHER |
|
||||
|---------------------+----------+-----------------+---+---------------------|
|
||||
@ -2789,6 +2790,17 @@ SCHEDULED: <2023-06-30 Fri>
|
||||
| | | Classic | | |
|
||||
| Goldberg Variations | G. Gould | Classic Baroque | 1 | Deutsche Grammophon |
|
||||
,#+END:
|
||||
|
||||
,#+BEGIN_SRC emacs-lisp :results pp :wrap "src emacs-lisp :eval never"
|
||||
(get-org-table-fix-info 10 1)
|
||||
,#+END_SRC
|
||||
|
||||
,#+RESULTS:
|
||||
,#+begin_src emacs-lisp :eval never
|
||||
((dynamic-block "CD collection" 902 1377
|
||||
(:hlines 1 :id "CD collection")
|
||||
"columnview"))
|
||||
,#+end_src
|
||||
#+end_src
|
||||
|
||||
*** Org introspection
|
||||
@ -3005,6 +3017,53 @@ The property is from the drawer of headline matching TARGET and LEVEL."
|
||||
(unless match (message "Can't find \"#+COLUMNS:\" keyword")))))
|
||||
#+end_src
|
||||
|
||||
#+caption[Help to make tables from org-insert-columns-dblock blocks]:
|
||||
#+caption: Help to make tables from org-insert-columns-dblock blocks.
|
||||
#+name: lst:get-org-table-fix-info
|
||||
#+begin_src emacs-lisp :results silent
|
||||
(defun get-org-table-fix-info (limit debug)
|
||||
(let ((done nil) (n 0))
|
||||
(org-with-point-at 1
|
||||
(while (and (< n limit)
|
||||
(re-search-forward org-table-line-regexp nil t))
|
||||
(setq n (1+ n))
|
||||
(let* ((eap (org-element-at-point))
|
||||
(k (car eap))
|
||||
(p (plist-get (cadr eap) :parent))
|
||||
(kk (car p))
|
||||
(pp (plist-get (cadr p) :parent))
|
||||
(kkk (car pp)))
|
||||
(when (> debug 0)
|
||||
(message "k=`%s' kk=`%s' kkk=`%s'" k kk kkk))
|
||||
(when-let ((ok (and (eq k 'table-row)
|
||||
(eq kk 'table)
|
||||
(eq kkk 'dynamic-block)))
|
||||
(beg (plist-get (cadr pp) :begin))
|
||||
(end (plist-get (cadr pp) :end)))
|
||||
(push (list 'dynamic-block (plist-get (cadr pp) :name) beg end
|
||||
(read (concat "(" (plist-get (cadr pp) :arguments) ")"))
|
||||
(plist-get (cadr pp) :block-name))
|
||||
done)
|
||||
(goto-char end))
|
||||
(when-let ((ok (and (eq k 'table-row)
|
||||
(eq kk 'table)
|
||||
(eq kkk 'section)))
|
||||
(beg (plist-get (cadr p) :begin))
|
||||
(end (plist-get (cadr p) :end)))
|
||||
(when (> debug 0)
|
||||
(push (list 'table (plist-get (cadr p) :name) beg end) done))
|
||||
(goto-char end))
|
||||
(when-let ((ok (eq k 'src-block))
|
||||
(end (plist-get (cadr eap) :end))
|
||||
(beg (plist-get (cadr eap) :begin)))
|
||||
(when (> debug 0)
|
||||
(push (list 'src-block (plist-get (cadr eap) :name) beg end) done))
|
||||
(goto-char end))
|
||||
(when (> debug 1)
|
||||
(pp-display-expression eap grok-org-output)))))
|
||||
(nreverse done)))
|
||||
#+end_src
|
||||
|
||||
*** [[https://github.com/bdarcus/citar][Citar: citing bibliography]] with [[https://orgmode.org/][Org Mode]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:citing-bibliography
|
||||
|
Loading…
Reference in New Issue
Block a user