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-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>

View File

@ -9,15 +9,22 @@
** 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
*** New keyword search agenda view
`C-c a s' now invokes a special agenda view that can be used
to search notes by keyword and regular expressions. The
search knows the boundaries of an entry, can use simple
Boolean logic and is reasonably fast. For example, the
search string
to search notes by keyword and regular expressions. In
particular, it does not require a single regular expression
or string to search for, but it can search for a number
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]}
@ -43,17 +50,24 @@
*** Many new extensions available in the CONTRIB directory
The new development model already starts to pay off, a number
of interesting extensions are now part of the distribution.
Check the file CONTRIB/README for a list.
- The new development model already starts to pay off, a
number of interesting extensions are now part of the
distribution. Check the file CONTRIB/README for a list.
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, for
example.
- There is a new variable `org-default-extensions'.
Configuring this variable makes it *very* easy to load
these extensions.
- 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
- 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
the line becomes the new heading. However, if you do this
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
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:
+ In a table, add a hline as before
+ In an item list, cycle bullet type as before
@ -85,7 +112,7 @@
Based on proposals by Bastien.
* 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.
It is not recommended to change this constant.")
(defcustom org-time-stamp-rounding-minutes 0
"Number of minutes to round time stamps to upon insertion.
When zero, insert the time unmodified. Useful rounding numbers
should be factors of 60, so for example 5, 10, 15.
When this is not zero, 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 !'."
(defcustom org-time-stamp-rounding-minutes '(0 5)
"Number of minutes to round time stamps to.
These are two values, the first applies when first creating a time stamp.
The second applies when changing it with the commands `S-up' and `S-down'.
When changing the time stamp, this means that it will change in steps
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
:type 'integer)
:type '(list
(integer :tag "when inserting times")
(integer :tag "when modifying times")))
(defcustom org-display-custom-times nil
"Non-nil means, overlay custom formats over all time stamps.
@ -5076,8 +5086,8 @@ The following commands are available:
(defun org-current-time ()
"Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
(if (> org-time-stamp-rounding-minutes 0)
(let ((r org-time-stamp-rounding-minutes)
(if (> (car org-time-stamp-rounding-minutes) 1)
(let ((r (car org-time-stamp-rounding-minutes))
(time (decode-time)))
(apply 'encode-time
(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."
(require 'parse-time)
(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)
(ct (org-current-time))
(def (or default-time ct))
@ -18502,7 +18512,7 @@ With prefix ARG, change that many days."
ans))
(defun org-toggle-timestamp-type ()
""
"Toggle the type (<active> or [inactive]) of a time stamp."
(interactive)
(when (org-at-timestamp-p t)
(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."
(let ((pos (point))
with-hm inactive
(dm (max (nth 1 org-time-stamp-rounding-minutes-when-changing) 1))
org-ts-what
extra
extra rem
ts time time0)
(if (not (org-at-timestamp-p t))
(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)
(setq with-hm t))
(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
(encode-time (or (car time0) 0)
(+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0))