emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marco Wahl <marcowahlsoft@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Uwe Brauer <oub@mat.ucm.es>
Subject: Re: shrink table in columnmode view (poor man's issue system)
Date: Sun, 26 Sep 2021 12:09:12 +0200	[thread overview]
Message-ID: <878rzjlkc7.fsf@gmail.com> (raw)
In-Reply-To: <87czowrgeu.fsf@mat.ucm.es> (Uwe Brauer's message of "Sat, 25 Sep 2021 14:25:13 +0200")

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	other threads:[~2021-09-26 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 12:25 shrink table in columnmode view (poor man's issue system) Uwe Brauer
2021-09-26 10:09 ` Marco Wahl [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rzjlkc7.fsf@gmail.com \
    --to=marcowahlsoft@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).