Make S-right/left work in column view for any timestamp

value of a property.
This commit is contained in:
Carsten Dominik 2008-09-18 10:24:57 +02:00
parent cad6c4dc3f
commit 8833885abb
5 changed files with 64 additions and 12 deletions

View file

@ -187,6 +187,13 @@
For more information, look at the variable
=org-columns-modify-value-for-display-function=.
*** In column view, date stamps now always have allowed values defined.
If a property value is a time stamp, S-left and S-right can
now be used to shift this date around.
This was a request by Chris Randle.
* Version 6.06
** Overview

View file

@ -3625,15 +3625,6 @@ release, number of tracks, and so on.
Properties can be conveniently edited and viewed in column view
(@pxref{Column view}).
Properties are like tags, but with a value. For example, in a file
where you document bugs and plan releases of a piece of software,
instead of using tags like @code{:release_1:}, @code{:release_2:}, it
can be more efficient to use a property @code{:Release:} with a value
@code{1.0} or @code{2.0}. Second, you can use properties to implement
(very basic) database capabilities in an Org buffer, for example to
create a list of Music CD's you own. You can edit and view properties
conveniently in column view (@pxref{Column view}).
@menu
* Property syntax:: How properties are spelled out
* Special properties:: Access to other Org mode features
@ -4034,7 +4025,7 @@ current column view.
Make the column narrower/wider by one character.
@kindex S-M-@key{right}
@item S-M-@key{right}
Insert a new column, to the right of the current column.
Insert a new column, to the left of the current column.
@kindex S-M-@key{left}
@item S-M-@key{left}
Delete the current column.

View file

@ -1,3 +1,15 @@
2008-09-18 Carsten Dominik <dominik@science.uva.nl>
* org-colview.el (org-colview-construct-allowed-dates): New
function.
(org-columns-next-allowed-value): Use
`org-colview-construct-allowed-dates'.
* org-colview-xemacs.el (org-colview-construct-allowed-dates): New
function.
(org-columns-next-allowed-value): Use
`org-colview-construct-allowed-dates'.
2008-09-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-protect-slash): New function.

View file

@ -735,7 +735,8 @@ an integer, select that value."
(and (memq
(nth 4 (assoc key org-columns-current-fmt-compiled))
'(checkbox checkbox-n-of-m checkbox-percent))
'("[ ]" "[X]"))))
'("[ ]" "[X]"))
(org-colview-construct-allowed-dates value)))
nval)
(when (integerp nth)
(setq nth (1- nth))
@ -784,6 +785,26 @@ an integer, select that value."
(and (nth 3 (assoc key org-columns-current-fmt-compiled))
(org-columns-update key))))))
(defun org-colview-construct-allowed-dates (s)
"Construct a list of three dates around the date in S.
This respects the format of the time stamp in S, active or non-active,
and also including time or not. S must be just a time stamp, no text
around it."
(when (string-match (concat "^" org-ts-regexp3 "$") s)
(let* ((time (org-parse-time-string s 'nodefaults))
(active (equal (string-to-char s) ?<))
(fmt (funcall (if (nth 1 time) 'cdr 'car) org-time-stamp-formats)))
(unless active (setq fmt (concat "[" (substring fmt 1 -1) "]")))
(setf (car time) (or (car time) 0))
(setf (nth 1 time) (or (nth 1 time) 0))
(setf (nth 2 time) (or (nth 2 time) 0))
(setq time-before (copy-sequence time))
(setq time-after (copy-sequence time))
(setf (nth 3 time-before) (1- (nth 3 time)))
(setf (nth 3 time-after) (1+ (nth 3 time)))
(mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
(list time-before time time-after)))))
(defun org-verify-version (task)
(cond
((eq task 'columns)

View file

@ -538,7 +538,8 @@ an integer, select that value."
(and (memq
(nth 4 (assoc key org-columns-current-fmt-compiled))
'(checkbox checkbox-n-of-m checkbox-percent))
'("[ ]" "[X]"))))
'("[ ]" "[X]"))
(org-colview-construct-allowed-dates value)))
nval)
(when (integerp nth)
(setq nth (1- nth))
@ -587,6 +588,26 @@ an integer, select that value."
(and (nth 3 (assoc key org-columns-current-fmt-compiled))
(org-columns-update key))))))
(defun org-colview-construct-allowed-dates (s)
"Construct a list of three dates around the date in S.
This respects the format of the time stamp in S, active or non-active,
and also including time or not. S must be just a time stamp, no text
around it."
(when (string-match (concat "^" org-ts-regexp3 "$") s)
(let* ((time (org-parse-time-string s 'nodefaults))
(active (equal (string-to-char s) ?<))
(fmt (funcall (if (nth 1 time) 'cdr 'car) org-time-stamp-formats)))
(unless active (setq fmt (concat "[" (substring fmt 1 -1) "]")))
(setf (car time) (or (car time) 0))
(setf (nth 1 time) (or (nth 1 time) 0))
(setf (nth 2 time) (or (nth 2 time) 0))
(setq time-before (copy-sequence time))
(setq time-after (copy-sequence time))
(setf (nth 3 time-before) (1- (nth 3 time)))
(setf (nth 3 time-after) (1+ (nth 3 time)))
(mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
(list time-before time time-after)))))
(defun org-verify-version (task)
(cond
((eq task 'columns)