From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dov Grobgeld Subject: Re: Different face for org-table fields with formulas Date: Mon, 5 Dec 2011 23:29:41 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba1efd823e4ac504b35f043a Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXg6Z-0008La-UD for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 16:29:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXg6Y-0007qE-Lu for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 16:29:43 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:62707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXg6Y-0007q7-H9 for emacs-orgmode@gnu.org; Mon, 05 Dec 2011 16:29:42 -0500 Received: by iapp10 with SMTP id p10so7319596iap.0 for ; Mon, 05 Dec 2011 13:29:41 -0800 (PST) In-Reply-To: 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 --90e6ba1efd823e4ac504b35f043a Content-Type: text/plain; charset=UTF-8 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 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 > > --90e6ba1efd823e4ac504b35f043a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I had a look at the org-mode sources and found that th= is was quite trivial to implement on the source level. E.g. the following p= atch embeds the output of an org formula in ~~ to make it org-verbatim. Thi= s is easily changed to another couple of characters that may then be set in= org-emphasis-alist to whatever formatting I fancy.

index edcdbe1..9ad0= 1d4 100644
--- a/lisp/org-table.el<= br style=3D"font-family: courier new,monospace;"> +++ b/lisp/org-table.el=
@@ -2572,7 +2572,7 @@ $1->=C2=A0=C2=A0= =C2=A0 %s\n" orig formula form0 form))
=C2=A0=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 (message "")))
=C2=A0=C2=A0=C2=A0=C2=A0 (if (listp ev) (setq fmt nil ev "#ERROR= "))
=C2=A0=C2=A0=C2=A0=C2= =A0 (org-table-justify-field-maybe
-=C2=A0= =C2=A0=C2=A0 =C2=A0(if fmt (format fmt (string-to-number ev)) ev)) +=C2=A0=C2=A0=C2=A0 =C2= =A0(format "~%s~" (if fmt (format fmt (string-to-number ev)) ev))= )
=C2=A0=C2=A0=C2=A0=C2=A0 (if (and down (= > ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
=C2=A0=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 (call-interactively 'org-return)
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (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 reali= zing 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 sett= able property.

Thanks!
Dov


--90e6ba1efd823e4ac504b35f043a--