emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Different face for org-table fields with formulas
@ 2011-12-04  7:15 Dov Grobgeld
  2011-12-05 21:29 ` Dov Grobgeld
  0 siblings, 1 reply; 4+ messages in thread
From: Dov Grobgeld @ 2011-12-04  7:15 UTC (permalink / raw)
  To: emacs-orgmode

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

Has anyone hacked up the use of using a different face for org-table fields
with formulas. This would be useful for quickly realizing what are inputs
and outputs in a org spreadsheet. Currently I do this by adding the
formatting ";~%.4f~" to my formulas. But it would be nicer if this was a
settable property.

Thanks!
Dov

[-- Attachment #2: Type: text/html, Size: 510 bytes --]

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

* Re: Different face for org-table fields with formulas
  2011-12-04  7:15 Different face for org-table fields with formulas Dov Grobgeld
@ 2011-12-05 21:29 ` Dov Grobgeld
  2011-12-06  8:06   ` Rainer M Krug
  0 siblings, 1 reply; 4+ messages in thread
From: Dov Grobgeld @ 2011-12-05 21:29 UTC (permalink / raw)
  To: emacs-orgmode

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

I had a look at the org-mode sources and found that this was quite trivial
to implement on the source level. E.g. the following patch embeds the
output of an org formula in ~~ to make it org-verbatim. This is easily
changed to another couple of characters that may then be set in
org-emphasis-alist to whatever formatting I fancy.

index edcdbe1..9ad01d4 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2572,7 +2572,7 @@ $1->    %s\n" orig formula form0 form))
         (message "")))
     (if (listp ev) (setq fmt nil ev "#ERROR"))
     (org-table-justify-field-maybe
-     (if fmt (format fmt (string-to-number ev)) ev))
+     (format "~%s~" (if fmt (format fmt (string-to-number ev)) ev)))
     (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
         (call-interactively 'org-return)
       (setq ndown 0)))



On Sun, Dec 4, 2011 at 09:15, Dov Grobgeld <dov.grobgeld@gmail.com> wrote:

> Has anyone hacked up the use of using a different face for org-table
> fields with formulas. This would be useful for quickly realizing what are
> inputs and outputs in a org spreadsheet. Currently I do this by adding the
> formatting ";~%.4f~" to my formulas. But it would be nicer if this was a
> settable property.
>
> Thanks!
> Dov
>
>

[-- Attachment #2: Type: text/html, Size: 3250 bytes --]

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

* Re: Different face for org-table fields with formulas
  2011-12-05 21:29 ` Dov Grobgeld
@ 2011-12-06  8:06   ` Rainer M Krug
  2011-12-11 13:05     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer M Krug @ 2011-12-06  8:06 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/12/11 22:29, Dov Grobgeld wrote:
> I had a look at the org-mode sources and found that this was quite 
> trivial to implement on the source level. E.g. the following patch 
> embeds the output of an org formula in ~~ to make it org-verbatim.
> This is easily changed to another couple of characters that may
> then be set in org-emphasis-alist to whatever formatting I fancy.
> 
> index edcdbe1..9ad01d4 100644 --- a/lisp/org-table.el +++
> b/lisp/org-table.el @@ -2572,7 +2572,7 @@ $1->    %s\n" orig
> formula form0 form)) (message ""))) (if (listp ev) (setq fmt nil ev
> "#ERROR")) (org-table-justify-field-maybe -     (if fmt (format fmt
> (string-to-number ev)) ev)) +     (format "~%s~" (if fmt (format
> fmt (string-to-number ev)) ev))) (if (and down (> ndown 0)
> (looking-at ".*\n[ \t]*|[^-]")) (call-interactively 'org-return) 
> (setq ndown 0)))
> 
> 

I haven't tried it out, but I think that would be very nice as a
standard feature in org.

Cheers,

Rainer

> 
> On Sun, Dec 4, 2011 at 09:15, Dov Grobgeld <dov.grobgeld@gmail.com 
> <mailto:dov.grobgeld@gmail.com>> wrote:
> 
> Has anyone hacked up the use of using a different face for
> org-table fields with formulas. This would be useful for quickly
> realizing what are inputs and outputs in a org spreadsheet.
> Currently I do this by adding the formatting ";~%.4f~" to my
> formulas. But it would be nicer if this was a settable property.
> 
> Thanks! Dov
> 
> 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7dzR4ACgkQoYgNqgF2egoueACgiG4Cqjc97RyFZ+TzVsqBYkWU
mZUAn3Npki29EerHBQ54y7qEzi2K7pEC
=3eFu
-----END PGP SIGNATURE-----

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

* Re: Different face for org-table fields with formulas
  2011-12-06  8:06   ` Rainer M Krug
@ 2011-12-11 13:05     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2011-12-11 13:05 UTC (permalink / raw)
  To: R.M.Krug; +Cc: Dov Grobgeld, emacs-orgmode

Rainer M Krug <r.m.krug@gmail.com> writes:

> I haven't tried it out, but I think that would be very nice as a
> standard feature in org.

You can now customize `org-table-formula-field-format'.

Thanks to Dov for this idea!

Best,

-- 
 Bastien

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

end of thread, other threads:[~2011-12-11 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-04  7:15 Different face for org-table fields with formulas Dov Grobgeld
2011-12-05 21:29 ` Dov Grobgeld
2011-12-06  8:06   ` Rainer M Krug
2011-12-11 13:05     ` Bastien

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