Changing timestamps granularly.

This commit is contained in:
Carsten Dominik 2008-03-03 14:15:19 +01:00
parent f119c04eeb
commit e34824029d
3 changed files with 72 additions and 24 deletions

View File

@ -3,6 +3,10 @@
* org.el (org-toggle-region-items): New function. * org.el (org-toggle-region-items): New function.
(org-toggle-region-headings): New function. (org-toggle-region-headings): New function.
(org-time-stamp-rounding-minutes): This is now a list of two
values.
(org-current-time, org-read-date, org-timestamp-change): Use the
new structure of org-time-stamp-rounding-minutes.
2008-03-03 Bastien Guerry <bzg@altern.org> 2008-03-03 Bastien Guerry <bzg@altern.org>

View File

@ -9,15 +9,22 @@
** Incompatible changes ** Incompatible changes
- The variable `org-time-stamp-rounding-minutes' is now a list
of two values - if you have configured this variable before,
please do it again.
** Details ** Details
*** New keyword search agenda view *** New keyword search agenda view
`C-c a s' now invokes a special agenda view that can be used `C-c a s' now invokes a special agenda view that can be used
to search notes by keyword and regular expressions. The to search notes by keyword and regular expressions. In
search knows the boundaries of an entry, can use simple particular, it does not require a single regular expression
Boolean logic and is reasonably fast. For example, the or string to search for, but it can search for a number
search string keywords or regexps that can occur in arbitrary sequence in
the entry. The search knows the boundaries of an entry, can
use simple Boolean logic and is reasonably fast. For
example, the search string
: +computer +wifi -ethernet -{8\.11[bg]} : +computer +wifi -ethernet -{8\.11[bg]}
@ -43,17 +50,24 @@
*** Many new extensions available in the CONTRIB directory *** Many new extensions available in the CONTRIB directory
The new development model already starts to pay off, a number - The new development model already starts to pay off, a
of interesting extensions are now part of the distribution. number of interesting extensions are now part of the
Check the file CONTRIB/README for a list. distribution. Check the file CONTRIB/README for a list.
Interesting for developers may be that there is a file - There is a new variable `org-default-extensions'.
org-id.el which implements global ID's for org-mode entries. Configuring this variable makes it *very* easy to load
These can be used in dependency implementations, for these extensions.
example.
- Interesting for developers may be that there is a file
org-id.el which implements global ID's for org-mode
entries. These can be used in dependency implementations,
or to tie clock tables and column view tables to entries.
*** Misc *** Misc
- Phil Jackson's org-irc.el is now part of the Org-mode core,
which means it will become part of Emacs soon.
- M-RET can again be used to split a line so tha the rest of - M-RET can again be used to split a line so tha the rest of
the line becomes the new heading. However, if you do this the line becomes the new heading. However, if you do this
in a heading containing tags, the tags will stay in the old in a heading containing tags, the tags will stay in the old
@ -64,6 +78,19 @@
same variable also influences line splitting in items and in same variable also influences line splitting in items and in
tables. tables.
- The value variable `org-time-stamp-rounding-minutes' is now
a list of two values. The first applies when creating a new
time stamp. The second applies when modifying a timestamp
with S-up/down. The default for this new task is 5 minutes,
but 15 may also be a very good value for many people. If
S-up/down is used on a time stamp where the minute part is
not compatible with this granularity it will be made so.
You can bypass this by using a prefix argument to exactly
specify the number of minutes to shift.
This was a proposal by Adam Spiers.
- `C-c -' has now more functions: - `C-c -' has now more functions:
+ In a table, add a hline as before + In a table, add a hline as before
+ In an item list, cycle bullet type as before + In an item list, cycle bullet type as before
@ -85,7 +112,7 @@
Based on proposals by Bastien. Based on proposals by Bastien.
* Version 5.22 * Version 5.22

41
org.el
View File

@ -1958,14 +1958,24 @@ the time stamp will always be forced into the second line."
"Formats for `format-time-string' which are used for time stamps. "Formats for `format-time-string' which are used for time stamps.
It is not recommended to change this constant.") It is not recommended to change this constant.")
(defcustom org-time-stamp-rounding-minutes 0 (defcustom org-time-stamp-rounding-minutes '(0 5)
"Number of minutes to round time stamps to upon insertion. "Number of minutes to round time stamps to.
When zero, insert the time unmodified. Useful rounding numbers These are two values, the first applies when first creating a time stamp.
should be factors of 60, so for example 5, 10, 15. The second applies when changing it with the commands `S-up' and `S-down'.
When this is not zero, you can still force an exact time-stamp by using When changing the time stamp, this means that it will change in steps
a double prefix argument to a time-stamp command like `C-c .' or `C-c !'." of N minues, as given by the second value.
When a setting is 0 or 1, insert the time unmodified. Useful rounding
numbers should be factors of 60, so for example 5, 10, 15.
When this is larger than 1, you can still force an exact time-stamp by using
a double prefix argument to a time-stamp command like `C-c .' or `C-c !',
and by using a prefix arg to `S-up/down' to specify the exact number
of minutes to shift."
:group 'org-time :group 'org-time
:type 'integer) :type '(list
(integer :tag "when inserting times")
(integer :tag "when modifying times")))
(defcustom org-display-custom-times nil (defcustom org-display-custom-times nil
"Non-nil means, overlay custom formats over all time stamps. "Non-nil means, overlay custom formats over all time stamps.
@ -5076,8 +5086,8 @@ The following commands are available:
(defun org-current-time () (defun org-current-time ()
"Current time, possibly rounded to `org-time-stamp-rounding-minutes'." "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
(if (> org-time-stamp-rounding-minutes 0) (if (> (car org-time-stamp-rounding-minutes) 1)
(let ((r org-time-stamp-rounding-minutes) (let ((r (car org-time-stamp-rounding-minutes))
(time (decode-time))) (time (decode-time)))
(apply 'encode-time (apply 'encode-time
(append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
@ -17704,7 +17714,7 @@ the time/date that is used for everything that is not specified by the
user." user."
(require 'parse-time) (require 'parse-time)
(let* ((org-time-stamp-rounding-minutes (let* ((org-time-stamp-rounding-minutes
(if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes)) (if (equal with-time '(16)) '(0 0) org-time-stamp-rounding-minutes))
(org-dcst org-display-custom-times) (org-dcst org-display-custom-times)
(ct (org-current-time)) (ct (org-current-time))
(def (or default-time ct)) (def (or default-time ct))
@ -18502,7 +18512,7 @@ With prefix ARG, change that many days."
ans)) ans))
(defun org-toggle-timestamp-type () (defun org-toggle-timestamp-type ()
"" "Toggle the type (<active> or [inactive]) of a time stamp."
(interactive) (interactive)
(when (org-at-timestamp-p t) (when (org-at-timestamp-p t)
(save-excursion (save-excursion
@ -18520,8 +18530,9 @@ The date will be changed by N times WHAT. WHAT can be `day', `month',
in the timestamp determines what will be changed." in the timestamp determines what will be changed."
(let ((pos (point)) (let ((pos (point))
with-hm inactive with-hm inactive
(dm (max (nth 1 org-time-stamp-rounding-minutes-when-changing) 1))
org-ts-what org-ts-what
extra extra rem
ts time time0) ts time time0)
(if (not (org-at-timestamp-p t)) (if (not (org-at-timestamp-p t))
(error "Not at a timestamp")) (error "Not at a timestamp"))
@ -18543,6 +18554,12 @@ in the timestamp determines what will be changed."
(if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts)
(setq with-hm t)) (setq with-hm t))
(setq time0 (org-parse-time-string ts)) (setq time0 (org-parse-time-string ts))
(when (and (eq org-ts-what 'minute)
(eq current-prefix-arg nil))
(setq n (* dm (signum n)))
(when (not (= 0 (setq rem (% (nth 1 time0) dm))))
(setcar (cdr time0) (+ (nth 1 time0)
(if (> n 0) (- rem) (- dm rem))))))
(setq time (setq time
(encode-time (or (car time0) 0) (encode-time (or (car time0) 0)
(+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)) (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0))