* Clock/add_time Format
@ 2008-05-15 2:33 Peter Jones
2008-05-15 3:54 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Peter Jones @ 2008-05-15 2:33 UTC (permalink / raw
To: emacs-orgmode
It looks like org-mode universally uses "%d:%02d" to format times
(about 7 times). Because of my OCD, I'd prefer it to be "%02d:%02d".
I'm thinking about adding in a new customizable variable,
org-time-format (defaulting it to the current format string), and
replace all instances of the current format string with this variable.
Does that sound like something that would be more generally useful,
enough so to accept a patch?
--
Peter Jones, pmade inc.
http://pmade.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Clock/add_time Format
2008-05-15 2:33 Clock/add_time Format Peter Jones
@ 2008-05-15 3:54 ` Carsten Dominik
2008-05-16 3:20 ` Peter Jones
0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-05-15 3:54 UTC (permalink / raw
To: Peter Jones; +Cc: emacs-orgmode
Sure please make the patch.
- Carsten
On May 15, 2008, at 4:33 AM, Peter Jones wrote:
> It looks like org-mode universally uses "%d:%02d" to format times
> (about 7 times). Because of my OCD, I'd prefer it to be "%02d:%02d".
>
> I'm thinking about adding in a new customizable variable,
> org-time-format (defaulting it to the current format string), and
> replace all instances of the current format string with this variable.
>
> Does that sound like something that would be more generally useful,
> enough so to accept a patch?
>
> --
> Peter Jones, pmade inc.
> http://pmade.com
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Clock/add_time Format
2008-05-15 3:54 ` Carsten Dominik
@ 2008-05-16 3:20 ` Peter Jones
2008-05-16 5:38 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Peter Jones @ 2008-05-16 3:20 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
Carsten Dominik <dominik@science.uva.nl> writes:
> Sure please make the patch.
Attached. At this point I've just created the patch. I'll have some
time tomorrow to actually use it and see how it feels.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clock-format.diff --]
[-- Type: text/x-patch, Size: 3995 bytes --]
From 335a6fcaf50277e5f9362763bc21e6482af6fda6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@pmade.com>
Date: Thu, 15 May 2008 21:16:41 -0600
Subject: [PATCH] Add org-time-clocksum-format customize variable
Replace all occurrences of the format string "%d:%02d" with
org-time-clocksum-format, which contains the same string by default.
This allows anyone to customize the appearance of clock summaries.
For example:
(setq org-time-clocksum-format "%02d:%02d")
---
lisp/org-clock.el | 6 +++---
lisp/org-colview-xemacs.el | 2 +-
lisp/org-colview.el | 2 +-
lisp/org.el | 8 +++++++-
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index fe84167..089eb55 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -197,7 +197,7 @@ of a different task.")
(h (floor delta 3600))
(m (floor (- delta (* 3600 h)) 60)))
(setq org-mode-line-string
- (propertize (format "-[%d:%02d (%s)]" h m org-clock-heading)
+ (propertize (format (concat "-[" org-time-clocksum-format " (%s)]") h m org-clock-heading)
'help-echo "Org-mode clock is running"))
(force-mode-line-update)))
@@ -375,7 +375,7 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(setq global-mode-string
(delq 'org-mode-line-string global-mode-string))
(force-mode-line-update)
- (message "Clock stopped at %s after HH:MM = %d:%02d%s" te h m
+ (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
(if remove " => LINE REMOVED" "")))))))
(defun org-clock-cancel ()
@@ -487,7 +487,7 @@ in the echo area."
(when org-remove-highlights-with-change
(org-add-hook 'before-change-functions 'org-remove-clock-overlays
nil 'local))))
- (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m)))
+ (message (concat "Total file time: " org-time-clocksum-format " (%d hours and %d minutes)") h m h m)))
(defvar org-clock-overlays nil)
(make-variable-buffer-local 'org-clock-overlays)
diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
index cc32116..da5d837 100644
--- a/lisp/org-colview-xemacs.el
+++ b/lisp/org-colview-xemacs.el
@@ -1042,7 +1042,7 @@ Don't set this, this is meant for dynamic scoping.")
(cond
((eq fmt 'add_times)
(let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
- (format "%d:%02d" h m)))
+ (format org-time-clocksum-format h m)))
((eq fmt 'checkbox)
(cond ((= n (floor n)) "[X]")
((> n 1.) "[-]")
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5d3127a..9bad58b 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -837,7 +837,7 @@ Don't set this, this is meant for dynamic scoping.")
(cond
((eq fmt 'add_times)
(let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
- (format "%d:%02d" h m)))
+ (format org-time-clocksum-format h m)))
((eq fmt 'checkbox)
(cond ((= n (floor n)) "[X]")
((> n 1.) "[-]")
diff --git a/lisp/org.el b/lisp/org.el
index 971e98c..ae0cfd9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1598,6 +1598,12 @@ end of the second format."
(concat "[" (substring f 1 -1) "]")
f)))
+(defcustom org-time-clocksum-format "%d:%02d"
+ "The format string used when creating CLOCKSUM lines, or when
+org-mode generates a time duration."
+ :group 'org-time
+ :type 'string)
+
(defcustom org-deadline-warning-days 14
"No. of days before expiration during which a deadline becomes active.
This variable governs the display in sparse trees and in the agenda.
@@ -11352,7 +11358,7 @@ If there is already a time stamp at the cursor position, update it."
"Compute H:MM from a number of minutes."
(let ((h (/ m 60)))
(setq m (- m (* 60 h)))
- (format "%d:%02d" h m)))
+ (format org-time-clocksum-format h m)))
(defun org-hh:mm-string-to-minutes (s)
"Convert a string H:MM to a number of minutes."
--
1.5.3.7
[-- Attachment #3: Type: text/plain, Size: 46 bytes --]
--
Peter Jones, pmade inc.
http://pmade.com
[-- Attachment #4: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Re: Clock/add_time Format
2008-05-16 3:20 ` Peter Jones
@ 2008-05-16 5:38 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2008-05-16 5:38 UTC (permalink / raw
To: Peter Jones; +Cc: emacs-orgmode
Applied thanks.
- Carsten
On May 16, 2008, at 5:20 AM, Peter Jones wrote:
> Carsten Dominik <dominik@science.uva.nl> writes:
>> Sure please make the patch.
>
> Attached. At this point I've just created the patch. I'll have some
> time tomorrow to actually use it and see how it feels.
>
> From 335a6fcaf50277e5f9362763bc21e6482af6fda6 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Thu, 15 May 2008 21:16:41 -0600
> Subject: [PATCH] Add org-time-clocksum-format customize variable
>
> Replace all occurrences of the format string "%d:%02d" with
> org-time-clocksum-format, which contains the same string by default.
>
> This allows anyone to customize the appearance of clock summaries.
>
> For example:
>
> (setq org-time-clocksum-format "%02d:%02d")
> ---
> lisp/org-clock.el | 6 +++---
> lisp/org-colview-xemacs.el | 2 +-
> lisp/org-colview.el | 2 +-
> lisp/org.el | 8 +++++++-
> 4 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index fe84167..089eb55 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -197,7 +197,7 @@ of a different task.")
> (h (floor delta 3600))
> (m (floor (- delta (* 3600 h)) 60)))
> (setq org-mode-line-string
> - (propertize (format "-[%d:%02d (%s)]" h m org-clock-heading)
> + (propertize (format (concat "-[" org-time-clocksum-format
> " (%s)]") h m org-clock-heading)
> 'help-echo "Org-mode clock is running"))
> (force-mode-line-update)))
>
> @@ -375,7 +375,7 @@ If there is no running clock, throw an error,
> unless FAIL-QUIETLY is set."
> (setq global-mode-string
> (delq 'org-mode-line-string global-mode-string))
> (force-mode-line-update)
> - (message "Clock stopped at %s after HH:MM = %d:%02d%s" te h m
> + (message (concat "Clock stopped at %s after HH:MM = " org-time-
> clocksum-format "%s") te h m
> (if remove " => LINE REMOVED" "")))))))
>
> (defun org-clock-cancel ()
> @@ -487,7 +487,7 @@ in the echo area."
> (when org-remove-highlights-with-change
> (org-add-hook 'before-change-functions 'org-remove-clock-overlays
> nil 'local))))
> - (message "Total file time: %d:%02d (%d hours and %d minutes)" h
> m h m)))
> + (message (concat "Total file time: " org-time-clocksum-format
> " (%d hours and %d minutes)") h m h m)))
>
> (defvar org-clock-overlays nil)
> (make-variable-buffer-local 'org-clock-overlays)
> diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
> index cc32116..da5d837 100644
> --- a/lisp/org-colview-xemacs.el
> +++ b/lisp/org-colview-xemacs.el
> @@ -1042,7 +1042,7 @@ Don't set this, this is meant for dynamic
> scoping.")
> (cond
> ((eq fmt 'add_times)
> (let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
> - (format "%d:%02d" h m)))
> + (format org-time-clocksum-format h m)))
> ((eq fmt 'checkbox)
> (cond ((= n (floor n)) "[X]")
> ((> n 1.) "[-]")
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index 5d3127a..9bad58b 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -837,7 +837,7 @@ Don't set this, this is meant for dynamic
> scoping.")
> (cond
> ((eq fmt 'add_times)
> (let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
> - (format "%d:%02d" h m)))
> + (format org-time-clocksum-format h m)))
> ((eq fmt 'checkbox)
> (cond ((= n (floor n)) "[X]")
> ((> n 1.) "[-]")
> diff --git a/lisp/org.el b/lisp/org.el
> index 971e98c..ae0cfd9 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -1598,6 +1598,12 @@ end of the second format."
> (concat "[" (substring f 1 -1) "]")
> f)))
>
> +(defcustom org-time-clocksum-format "%d:%02d"
> + "The format string used when creating CLOCKSUM lines, or when
> +org-mode generates a time duration."
> + :group 'org-time
> + :type 'string)
> +
> (defcustom org-deadline-warning-days 14
> "No. of days before expiration during which a deadline becomes
> active.
> This variable governs the display in sparse trees and in the agenda.
> @@ -11352,7 +11358,7 @@ If there is already a time stamp at the
> cursor position, update it."
> "Compute H:MM from a number of minutes."
> (let ((h (/ m 60)))
> (setq m (- m (* 60 h)))
> - (format "%d:%02d" h m)))
> + (format org-time-clocksum-format h m)))
>
> (defun org-hh:mm-string-to-minutes (s)
> "Convert a string H:MM to a number of minutes."
> --
> 1.5.3.7
>
>
> --
> Peter Jones, pmade inc.
> http://pmade.com
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-16 5:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15 2:33 Clock/add_time Format Peter Jones
2008-05-15 3:54 ` Carsten Dominik
2008-05-16 3:20 ` Peter Jones
2008-05-16 5:38 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.