emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* shrink table in columnmode view (poor man's issue system)
@ 2021-09-25 12:25 Uwe Brauer
  2021-09-26 10:09 ` Marco Wahl
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2021-09-25 12:25 UTC (permalink / raw)
  To: emacs-orgmode

Hi 

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.

Any idea how to achieve that?

Thanks and regards

Uwe Brauer 

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 



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

* Re: shrink table in columnmode view (poor man's issue system)
  2021-09-25 12:25 shrink table in columnmode view (poor man's issue system) Uwe Brauer
@ 2021-09-26 10:09 ` Marco Wahl
  2021-09-26 15:13   ` Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Wahl @ 2021-09-26 10:09 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Uwe Brauer

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




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

* Re: shrink table in columnmode view (poor man's issue system)
  2021-09-26 10:09 ` Marco Wahl
@ 2021-09-26 15:13   ` Uwe Brauer
       [not found]     ` <87sfxqe3hu.fsf@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2021-09-26 15:13 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "MW" == Marco Wahl <marcowahlsoft@gmail.com> writes:

> 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") .

Aha, meanwhile I discovered that a dummy entry 

* Issues
   :PROPERTIES:
   :COLUMNS:  %50ITEM(Problem) %10Is(Issue Nr) %7TODO(Status) %26TAGS(Which) %17Date(Date) %7STATUS(Status){X/} 
   :ID:       Issues
   :END:

** <45>
   :PROPERTIES:
   :ID:      Issues 
   :Date:    
   :STATUS:   
   :Is:      0 
   :END:


Also works well sort of.

However, your solution is soo much *better* and works like charms, thanks a lot!

@maintainers, why not include this functionality into org-mode (most
likely  ‘org-insert-dblock.el’.


Regards

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: shrink table in columnmode view (poor man's issue system)
       [not found]     ` <87sfxqe3hu.fsf@gmail.com>
@ 2021-09-27 16:03       ` Uwe Brauer
  2021-09-27 16:39         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2021-09-27 16:03 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Uwe Brauer, Org Mode List

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


> Uwe Brauer <oub@mat.ucm.es> writes:

> Hi Uwe,

> Thanks for the feedback!

Thank you for the code! As I said, your code should be included. If you
have write access please push it.

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: shrink table in columnmode view (poor man's issue system)
  2021-09-27 16:03       ` Uwe Brauer
@ 2021-09-27 16:39         ` Bastien
  2021-09-27 18:53           ` Marco Wahl
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2021-09-27 16:39 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: Marco Wahl, Org Mode List

Hi Uwe,

Uwe Brauer <oub@mat.ucm.es> writes:

>> Thanks for the feedback!
>
> Thank you for the code! As I said, your code should be included. If you
> have write access please push it.

It's up to the maintainers to decide for pushing changes, and to
regular contributors, for areas they feel confident they can push,
like Marco does regularily (thanks).

I don't see any patch in this thread - am I missing something?

-- 
 Bastien


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

* Re: shrink table in columnmode view (poor man's issue system)
  2021-09-27 16:39         ` Bastien
@ 2021-09-27 18:53           ` Marco Wahl
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Wahl @ 2021-09-27 18:53 UTC (permalink / raw)
  To: Bastien; +Cc: Uwe Brauer, Org Mode List

Hi all!

Bastien <bzg@gnu.org> 
> Uwe Brauer <oub@mat.ucm.es> writes:
>> Thank you for the code! As I said, your code should be included. If you
>> have write access please push it.

Thanks Uwe.

> It's up to the maintainers to decide for pushing changes, and to
> regular contributors, for areas they feel confident they can push,
> like Marco does regularily (thanks).

Thanks Bastien.

> I don't see any patch in this thread - am I missing something?

There is no patch yet.  But I think the idea of Uwe is worthy to be
discussed.

Let me present the idea of Uwe with his columnview dynamic block example
(a little bit simplified.)

With the current state in Org one could get the following columnview
block in a respective Org file.

	#+BEGIN: columnview :format "%10ITEM(Problem) %5Is(Issue)"
	| Problem                                           | Issue |
	| Issues                                            |       |
	| Why is this item soooooooooooooooooooooooo wide ? |     9 |
	#+END:

The idea is to add a line with width indicators taken from the column
format.  Here (it is the first table line):

	#+BEGIN: columnview :format "%10ITEM(Problem) %5Is(Issue)"
        | <10>                                              | <5>   |
	| Problem                                           | Issue |
	| Issues                                            |       |
	| Why is this item soooooooooooooooooooooooo wide ? |     9 |
	#+END:

This would allow to use the C-c TAB feature to control the widths of the
columns.

We realized this using a newly defined personal dynamic block as
described in (info "(org) Dynamic Blocks").  Concretely:

	(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))

I think the idea is good.  But possibly the extra line is too much for
some people.  Further I'm sure that the code can be improved and I don't
feel 100% confident in this dynamic block area.


Best regards!



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

end of thread, other threads:[~2021-09-27 18:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 12:25 shrink table in columnmode view (poor man's issue system) Uwe Brauer
2021-09-26 10:09 ` Marco Wahl
2021-09-26 15:13   ` Uwe Brauer
     [not found]     ` <87sfxqe3hu.fsf@gmail.com>
2021-09-27 16:03       ` Uwe Brauer
2021-09-27 16:39         ` Bastien
2021-09-27 18:53           ` Marco Wahl

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).