From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cecil Westerhof Subject: Re: Only display hours and minutes, not seconds Date: Mon, 25 Nov 2013 15:42:52 +0100 Message-ID: References: <87a9hqkyj9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113382b4f583da04ec016080 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkxNK-0006RN-Cv for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 09:42:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkxNF-0003b8-Ls for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 09:42:58 -0500 Received: from mail-qa0-x22d.google.com ([2607:f8b0:400d:c00::22d]:57286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkxNF-0003av-Fp for emacs-orgmode@gnu.org; Mon, 25 Nov 2013 09:42:53 -0500 Received: by mail-qa0-f45.google.com with SMTP id o15so3079473qap.4 for ; Mon, 25 Nov 2013 06:42:52 -0800 (PST) In-Reply-To: <87a9hqkyj9.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a113382b4f583da04ec016080 Content-Type: text/plain; charset=ISO-8859-1 2013/10/31 Nick Dokos > Cecil Westerhof writes: > > > I have the following table: > > |----------| > > | Duration | > > |----------| > > | 2@ 15 | > > | 2@ 30 | > > | 2@ 30 | > > | 0@ 45 | > > |----------| > > | 8@ 0' 0" | > > |----------| > > #+TBLFM: @>$1=vsum(@2..@-1) > > > > I would like the total be displayed like: > > 8@ 00' > > instead of: > > 8@ 0' 0" > > > > Is this possible? > > > > You can get close by setting org-calc-default-modes as follows: > > (setq org-calc-default-modes '(calc-internal-prec 12 > calc-float-format (float 8) > calc-angle-mode deg > calc-prefer-frac nil > calc-symbolic-mode nil > calc-date-format (YYYY "-" MM "-" DD " " > Www (" " hh ":" mm)) > calc-display-working-message t > calc-hms-format "%s@ %02s'")) > > This is the default setting except for calc-hms-format. It does not > quite do what you want, but it's close (I expected the %02s to zero-fill > on the left, but apparently it does not for the %s format): > > |----------| > | Duration | > |----------| > | 2@ 15 | > | 2@ 30 | > | 2@ 30 | > | 0@ 45 | > |----------| > | 8@ 0' | > |----------| > #+TBLFM: @>$1=vsum(@2..@-1) > I never answered. T_T I use the following now in my init: (require 'org-table) (setq org-calc-default-modes (cons 'calc-hms-format (cons '"%s@ %02s" org-calc-default-modes))) The require is necessary to get org-calc-default-modes defined. The calc-hms-format is not defined, so this works, but I will write a function so also the other values can be changed. The reason I use this, is that this does not have side effects. When the defaults change, your way would have a side effect. The zero fill only works with a number format. That is the reason I can not get it the way I want, but I can live with that. -- Cecil Westerhof --001a113382b4f583da04ec016080 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
2013= /10/31 Nick Dokos <ndokos@gmail.com>
Cecil Westerhof <cldwesterhof@gmail.com> writes:

> I have the following table:
> |----------|
> | Duration |
> |----------|
> | 2@ 15=A0=A0=A0 |
> | 2@ 30=A0=A0=A0 |
> | 2@ 30=A0=A0=A0 |
> | 0@ 45=A0=A0=A0 |
> |----------|
> | 8@ 0' 0" |
> |----------|
> #+TBLFM: @>$1=3Dvsum(@2..@-1)
>
> I would like the total be displayed like:
> =A0=A0=A0 8@ 00'
> instead of:
> =A0=A0=A0 8@ 0' 0"
>
> Is this possible?
>

You can get close by setting org-calc-default-modes as follows:=

(setq org-calc-default-modes '(calc-internal-prec 12
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-float-f= ormat (float 8)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-angle-m= ode deg
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-prefer-= frac nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-symboli= c-mode nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-date-fo= rmat (YYYY "-" MM "-" DD " " Www (" &quo= t; hh ":" mm))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-display= -working-message t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc-hms-for= mat "%s@ %02s'"))

This is the default setting except for calc-hms-format. It does not
quite do what you want, but it's close (I expected the %02s to zero-fil= l
on the left, but apparently it does not for the %s format):

|----------|
| Duration |
|----------|
| 2@ 15 =A0 =A0|
| 2@ 30 =A0 =A0|
| 2@ 30 =A0 =A0|
| 0@ 45 =A0 =A0|
|----------|
| 8@ =A00' =A0 |
|----------|
#+TBLFM: @>$1=3Dvsum(@2..@-1)

I nev= er answered. T_T I use the following now in my init:
(require 'org-t= able)
(setq org-calc-default-modes (cons 'calc-hms-format (cons '= ;"%s@ %02s" org-calc-default-modes)))

The require is necessary to get org-ca= lc-default-modes defined. The calc-hms-format is not defined, so this works= , but I will write a function so also the other values can be changed.

The reason I use this, is that this do= es not have side effects. When the defaults change, your way would have a s= ide effect.

The zero fill only work= s with a number format. That is the reason I can not get it the way I want,= but I can live with that.


--
Cecil Westerhof
--001a113382b4f583da04ec016080--