Przeglądaj źródła

New option `org-table-formula-field-format'.

Format for fields which contain the result of a formula.
For example, using \"~%s~\" will display the result within tilde
characters.  Beware that modifying the display can prevent the
field from being used in another formula.

Based on an idea of Dov Grobgeld.
Bastien Guerry 13 lat temu
rodzic
commit
7a513b2c00
1 zmienionych plików z 10 dodań i 1 usunięć
  1. 10 1
      lisp/org-table.el

+ 10 - 1
lisp/org-table.el

@@ -241,6 +241,14 @@ days."
 		 (symbol :tag "Hours  " 'hours)
 		 (symbol :tag "Days   " 'days)))
 
+(defcustom org-table-formula-field-format "%s"
+  "Format for fields which contain the result of a formula.
+For example, using \"~%s~\" will display the result within tilde
+characters.  Beware that modifying the display can prevent the
+field from being used in another formula."
+  :group 'org-table-settings
+  :type 'string)
+
 (defcustom org-table-formula-evaluate-inline t
   "Non-nil means TAB and RET evaluate a formula in current table field.
 If the current field starts with an equal sign, it is assumed to be a formula
@@ -2572,7 +2580,8 @@ $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 org-table-formula-field-format
+		 (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)))