emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-clock: Align formula column in clock tables
@ 2017-03-18  7:44 Yasushi SHOJI
  2017-03-19 10:00 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Yasushi SHOJI @ 2017-03-18  7:44 UTC (permalink / raw)
  To: emacs-orgmode

* lisp/org-clock.el (org-clocktable-write-default): Align formula
  column in clock tables.

  Here is an ECM:

  * foo
  ** sub
     :LOGBOOK:
     CLOCK: [2017-03-18 Sat 15:00]--[2017-03-18 Sat 15:15] =>  0:15
     :END:
  ** sub2
     :LOGBOOK:
     CLOCK: [2017-03-18 Sat 15:15]--[2017-03-18 Sat 15:30] =>  0:15
     :END:
  ** sub3
  *** subsub1
      :LOGBOOK:
      CLOCK: [2017-03-18 Sat 13:00]--[2017-03-18 Sat 13:15] =>  0:15
      :END:
  *** subsub1
      :LOGBOOK:
      CLOCK: [2017-03-18 Sat 14:00]--[2017-03-18 Sat 14:15] =>  0:15
      :END:
  * bar
    :LOGBOOK:
    CLOCK: [2017-03-18 Sat 13:15]--[2017-03-18 Sat 13:30] =>  0:15
    :END:
  * table
  #+BEGIN: clocktable :maxlevel 3 :scope file :formula %
  #+CAPTION: Clock summary at [2017-03-18 Sat 16:50]
  | Headline      |   Time |      |      |     % |
  |---------------+--------+------+------+-------|
  | *Total time*  | *1:15* |      |      | 100.0 |
  |---------------+--------+------+------+-------|
  | foo           |   1:00 |      |      |  80.0 |
  | \_  sub       |        | 0:15 |      |  20.0 |
  | \_  sub2      |        | 0:15 |      |  20.0 |
  | \_  sub3      |        | 0:30 |      |  40.0 |
  | \_    subsub1 |        |      | 0:15 |  20.0 |
  | \_    subsub1 |        |      | 0:15 |  20.0 |
  | bar           |   0:15 |      |      |  20.0 |
  #+END:
---
 lisp/org-clock.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index ffa1b3003..73afd87e6 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2622,6 +2622,7 @@ from the dynamic block definition."
 		 ;; Empty fields for higher levels.
 		 (make-string (max 0 (1- (min time-columns level))) ?|)
 		 hlc (org-minutes-to-clocksum-string time) hlc "|" ; time
+		 (make-string (max 0 (- time-columns level)) ?|)
 		 (if (eq formula '%)
 		     (format "%.1f |" (* 100 (/ time (float total-time))))
 		   "")
-- 
2.11.0

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

* Re: [PATCH] org-clock: Align formula column in clock tables
  2017-03-18  7:44 [PATCH] org-clock: Align formula column in clock tables Yasushi SHOJI
@ 2017-03-19 10:00 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2017-03-19 10:00 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hello,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> * lisp/org-clock.el (org-clocktable-write-default): Align formula
>   column in clock tables.
>
>   Here is an ECM:
>
>   * foo
>   ** sub
>      :LOGBOOK:
>      CLOCK: [2017-03-18 Sat 15:00]--[2017-03-18 Sat 15:15] =>  0:15
>      :END:
>   ** sub2
>      :LOGBOOK:
>      CLOCK: [2017-03-18 Sat 15:15]--[2017-03-18 Sat 15:30] =>  0:15
>      :END:
>   ** sub3
>   *** subsub1
>       :LOGBOOK:
>       CLOCK: [2017-03-18 Sat 13:00]--[2017-03-18 Sat 13:15] =>  0:15
>       :END:
>   *** subsub1
>       :LOGBOOK:
>       CLOCK: [2017-03-18 Sat 14:00]--[2017-03-18 Sat 14:15] =>  0:15
>       :END:
>   * bar
>     :LOGBOOK:
>     CLOCK: [2017-03-18 Sat 13:15]--[2017-03-18 Sat 13:30] =>  0:15
>     :END:
>   * table
>
>   #+BEGIN: clocktable :maxlevel 3 :scope file :formula %
>   #+CAPTION: Clock summary at [2017-03-18 Sat 16:50]
>
>   | Headline      |   Time |      |      |     % |
>   |---------------+--------+------+------+-------|
>   | *Total time*  | *1:15* |      |      | 100.0 |
>   |---------------+--------+------+------+-------|
>   | foo           |   1:00 |      |      |  80.0 |
>   | \_  sub       |        | 0:15 |      |  20.0 |
>   | \_  sub2      |        | 0:15 |      |  20.0 |
>   | \_  sub3      |        | 0:30 |      |  40.0 |
>   | \_    subsub1 |        |      | 0:15 |  20.0 |
>   | \_    subsub1 |        |      | 0:15 |  20.0 |
>   | bar           |   0:15 |      |      |  20.0 |
>   #+END:
> ---
>  lisp/org-clock.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index ffa1b3003..73afd87e6 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -2622,6 +2622,7 @@ from the dynamic block definition."
>  		 ;; Empty fields for higher levels.
>  		 (make-string (max 0 (1- (min time-columns level))) ?|)
>  		 hlc (org-minutes-to-clocksum-string time) hlc "|" ; time
> +		 (make-string (max 0 (- time-columns level)) ?|)
>  		 (if (eq formula '%)
>  		     (format "%.1f |" (* 100 (/ time (float total-time))))
>  		   "")

Applied, with a proper commit message. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-03-19 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-18  7:44 [PATCH] org-clock: Align formula column in clock tables Yasushi SHOJI
2017-03-19 10:00 ` Nicolas Goaziou

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