emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shrink table in columnmode view (poor man's issue system)


From: Marco Wahl
Subject: Re: shrink table in columnmode view (poor man's issue system)
Date: Sun, 26 Sep 2021 12:09:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi!

Uwe Brauer <oub@mat.ucm.es> writes:
> I use the following org file to organise my issues.
> It works quite well, however I would like to have a shrink option
> automatically in my columnview.

Your suggestion looks quite useful to me.

> Any idea how to achieve that?

One possibility is to write your own dynamic block writer function.
Find documentation at (info "(org) Dynamic Blocks") .

> File starts here:
>
> #+begin_src 
> #+STARTUP: shrink
>
> * Issues
>    :PROPERTIES:
>    :COLUMNS:  %50ITEM(Problem) %10Is(Issue Nr) %7TODO(Status) %26TAGS(Which) 
> %17Date(Date) %7STATUS(Status){X/} 
>    :ID:       Issues
>    :END:
>
> ** TODO Why is  \eqref{eq:section4-sh15}: not used in the proof of 
> proposition 5 (section 4)
>    :PROPERTIES:
>    :ID:       Issues
>    :Date:     <2021-09-25 sáb>
>    :STATUS:   [ ]
>    :Is:       9
>    :END:
>
> The table is generated like this
> #+BEGIN: columnview  :hlines 2 :skip-empty-rows t :indent nil  :format 
> "%5ITEM(Problem) %5Is(Issue) %12TODO  %12Date %7Status(Status){X/}"
> | Problem                                                                     
>          | Issue | TODO | Date         | Status |
> |--------------------------------------------------------------------------------------+-------+------+--------------+--------|
> | Issues                                                                      
>          |       |      |              | [0/1]  |
> |--------------------------------------------------------------------------------------+-------+------+--------------+--------|
> | Why is  \eqref{eq:section4-sh15}: not used in the proof of proposition 5 
> (section 4) |     9 | TODO | <2021-09-25 sáb> | [ ]    |
> #+END:
>
>
> But I would like to have this
>
> #+BEGIN: columnview  :hlines 2 :skip-empty-rows t :indent nil  :format 
> "%5ITEM(Problem) %5Is(Issue) %12TODO  %12Date %7Status(Status){X/}"
> |<45>
> | Problem                                                                     
>          | Issue | TODO | Date         | Status |
> |--------------------------------------------------------------------------------------+-------+------+--------------+--------|
> | Issues                                                                      
>          |       |      |              | [0/1]  |
> |--------------------------------------------------------------------------------------+-------+------+--------------+--------|
> | Why is  \eqref{eq:section4-sh15}: not used in the proof of proposition 5 
> (section 4) |     9 | TODO | <2021-09-25 sáb> | [ ]    |
> #+END:
>
> #+end_src 

Concretely check out this proposition (tested with your example).  Have

        (defun org-dblock-write:columnview2 (params)
          "Write the column view table.
        
        Like org-dblock-write:columnview but write a line with shrink widths 
taken from the
        column view format.
        
        PARAMS is the same as in `org-dblock-write:columnview'."
          (insert (format "|%s|\n"
                          (mapconcat
                           (lambda (x) (concat "<" (number-to-string x) ">"))
                           (mapcar (lambda (x) (nth 2 x)) 
(org-columns-compile-format
                                                      (plist-get params 
:format)))
                           "|")))
          (org-dblock-write:columnview params))

defined.  E.g. type C-x C-e after the last paren.

Then use "columnview2" instead of "columnview" and get

#+BEGIN: columnview2  :hlines 2 :skip-empty-rows t :indent nil  :format 
"%5ITEM(Problem) %5Is(Issue) %12TODO  %12Date %7Status(Status){X/}"
| <5>                                                                           
       | <5>   | <12> | <12>             | <7>    |
| Problem                                                                       
       | Issue | TODO | Date             | Status |
|--------------------------------------------------------------------------------------+-------+------+------------------+--------|
| Issues                                                                        
       |       |      |                  | [0/1]  |
|--------------------------------------------------------------------------------------+-------+------+------------------+--------|
| Why is  \eqref{eq:section4-sh15}: not used in the proof of proposition 5 
(section 4) | 9     | TODO | <2021-09-25 sáb> | [ ]    |
#+END:


HTH





reply via email to

[Prev in Thread] Current Thread [Next in Thread]