Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-05-22 15:28:48 +02:00
commit 61eb86e06c
2 changed files with 3 additions and 21 deletions

View File

@ -237,17 +237,9 @@ display, as a string."
"* " "* "
(org-columns-compact-links value))) (org-columns-compact-links value)))
(`(,_ ,_ ,_ ,_ nil) value) (`(,_ ,_ ,_ ,_ nil) value)
;; If PRINTF is set, and we are displaying a number, obey to ;; If PRINTF is set, assume we are displaying a number and
;; it. Otherwise, raise an error. ;; obey to the format string.
(`(,_ ,name ,_ ,_ ,printf) (`(,_ ,name ,_ ,_ ,printf) (format printf (string-to-number value)))
(when (or (not (string-match-p "[0-9]" value))
(and (string-match-p "[1-9]" value)
(= 0 (string-to-number value))))
(user-error "Invalid value: %S. \
Format string in operator implies column %S only contains numbers"
value
name))
(format printf (string-to-number value)))
(_ (error "Invalid column specification format: %S" spec))))) (_ (error "Invalid column specification format: %S" spec)))))
(defun org-columns--collect-values (&optional compiled-fmt) (defun org-columns--collect-values (&optional compiled-fmt)

View File

@ -223,16 +223,6 @@
:END:" :END:"
(let ((org-columns-default-format "%A{+;%.1f}")) (org-columns)) (let ((org-columns-default-format "%A{+;%.1f}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))) (get-char-property (point) 'org-columns-value-modified))))
;; Raise an error when format strings are applied to non-numbers.
(should-error
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
:A: foo
:END:"
(let ((org-columns-default-format "%A{+;%.2f}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))
;; {:} sums times. Plain numbers are hours. ;; {:} sums times. Plain numbers are hours.
(should (should
(equal (equal