Commit f425a6ea authored by Carsten Dominik's avatar Carsten Dominik
Browse files

(org-occur-highlights): New variable.

        (org-highlight-new-match, org-remove-occur-highlights): New
        functions.
        (org-highlight-sparse-tree-matches): New option.
        (org-do-occur): New function.
        (org-get-heading): Make it work also at beginning of line.
        (org-category-table): New variable.
        (org-get-category-table, org-get-category)
        (org-camel-to-words, org-link-search): New functions.
        (org-select-this-todo-keyword): New variable.
        (org-todo-list): New command.
        (org-shiftright, org-shiftleft): New commands.
        (org-agenda-todo): Added prefix argument.
        (org-show-hierarchy-above): New option.
        (org-show-todo-tree): Numerical prefix creates tree for
        specific
        TODO keyword.
        (org-outline-level): New function, to assign a level to plain
        lists items.
        (org-cycle-include-plain-lists): New option.
        (org-mode): Use `org-outline-level' as value of
        `outline-level'.
        (org-cycle): Temporarily switch `outline-regexp' if
        `org-cycle-include-plain-lists' is non-nil.
        (org-start-icalendar-file): Fixed format bug.
        (org-agenda-get-day-entries): Create category table.
        (org-agenda-get-todos, org-agenda-get-timestamps)
        (org-agenda-get-deadlines, org-agenda-get-scheduled)
        (org-agenda-get-blocks): Use `org-get-category'.
        (org-context-in-file-links): Renamed from
        `org-line-numbers-in-file-links' .
parent 239f263d
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <dominik at science dot uva dot nl>
;; Keywords: outlines, hypermedia, calendar
;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
;; Version: 3.21
;; Version: 3.22
;;
;; This file is part of GNU Emacs.
;;
......@@ -59,6 +59,7 @@
;; (autoload 'org-mode "org" "Org mode" t)
;; (autoload 'org-diary "org" "Diary entries from Org mode")
;; (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
;; (autoload 'org-todo-list "org" "Multi-file todo list from Org mode" t)
;; (autoload 'org-store-link "org" "Store a link to the current location" t)
;; (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
;; (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
......@@ -81,6 +82,17 @@
;;
;; Changes:
;; -------
;; Version 3.22
;; - CamelCase words link to other locations in the same file.
;; - File links accept search options, to link to specific locations.
;; - Plain list items can be folded with `org-cycle'. See new option
;; `org-cycle-include-plain-lists'.
;; - Sparse trees for specific TODO keywords through numeric prefix
;; argument to `C-c C-v'.
;; - Global TODO list, also for specific keywords.
;; - Matches in sparse trees are highlighted (highlights disappear with
;; next buffer change due to editing).
;;
;; Version 3.21
;; - Improved CSS support for the HTML export. Thanks to Christian Egli.
;; - Editing support for hand-formatted lists
......@@ -241,7 +253,7 @@
;;; Customization variables
(defvar org-version "3.21"
(defvar org-version "3.22"
"The version number of the file org.el.")
(defun org-version ()
(interactive)
......@@ -785,6 +797,27 @@ agenda entries."
:tag "Org Structure"
:group 'org)
(defcustom org-cycle-include-plain-lists nil
"Non-nil means, include plain lists into visibility cycling.
This means that during cycling, plain list items will *temporarily* be
interpreted as outline headlines with a level given by 1000+i where i is the
indentation of the bullet. In all other operations, plain list items are
not seen as headlines. For example, you cannot assign a TODO keyword to
such an item."
:group 'org-structure
:type 'boolean)
(defcustom org-cycle-emulate-tab t
"Where should `org-cycle' emulate TAB.
nil Never
white Only in completely white lines
t Everywhere except in headlines"
:group 'org-structure
:type '(choice (const :tag "Never" nil)
(const :tag "Only in completely white lines" white)
(const :tag "Everywhere except in headlines" t)
))
(defcustom org-cycle-hook '(org-optimize-window-after-visibility-change)
"Hook that is run after `org-cycle' has changed the buffer visibility.
The function(s) in this hook must accept a single argument which indicates
......@@ -795,6 +828,29 @@ the values `folded', `children', or `subtree'."
:group 'org-structure
:type 'hook)
(defcustom org-highlight-sparse-tree-matches t
"Non-nil means, highlight all matches that define a sparse tree.
The highlights will automatically disappear the next time the buffer is
changed by an edit command."
:group 'org-structure
:type 'boolean)
(defcustom org-show-hierarchy-above t
"Non-nil means, show full hierarchy when showing a spot in the tree.
Turning this off makes sparse trees more compact, but also less clear."
:group 'org-structure
:type 'boolean)
(defcustom org-show-following-heading t
"Non-nil means, show heading following match in `org-occur'.
When doing an `org-occur' it is useful to show the headline which
follows the match, even if they do not match the regexp. This makes it
easier to edit directly inside the sparse tree. However, if you use
org-occur mainly as an overview, the following headlines are
unnecessary clutter."
:group 'org-structure
:type 'boolean)
(defcustom org-occur-hook '(org-first-headline-recenter)
"Hook that is run after `org-occur' has constructed a sparse tree.
This can be used to recenter the window to show as much of the structure
......@@ -818,6 +874,25 @@ body starts at column 0, indentation is not changed at all."
:group 'org-structure
:type 'boolean)
(defcustom org-plain-list-ordered-item-terminator t
"The character that makes a line with leading number an ordered list item.
Valid values are ?. and ?\). To get both terminators, use t. While
?. may look nicer, it creates the danger that a line with leading
number may be incorrectly interpreted as an item. ?\) therefore is
the safe choice."
:group 'org-structure
:type '(choice (const :tag "dot like in \"2.\"" ?.)
(const :tag "paren like in \"2)\"" ?\))
(const :tab "both" t)))
(defcustom org-auto-renumber-ordered-lists t
"Non-nil means, automatically renumber ordered plain lists.
Renumbering happens when the sequence have been changed with
\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
:group 'org-structure
:type 'boolean)
(defcustom org-enable-fixed-width-editor t
"Non-nil means, lines starting with \":\" are treated as fixed-width.
This currently only means, they are never auto-wrapped.
......@@ -826,27 +901,6 @@ See also the QUOTE keyword."
:group 'org-structure
:type 'boolean)
(defcustom org-cycle-emulate-tab t
"Where should `org-cycle' emulate TAB.
nil Never
white Only in completely white lines
t Everywhere except in headlines"
:group 'org-structure
:type '(choice (const :tag "Never" nil)
(const :tag "Only in completely white lines" white)
(const :tag "Everywhere except in headlines" t)
))
(defcustom org-show-following-heading t
"Non-nil means, show heading following match in `org-occur'.
When doing an `org-occur' it is useful to show the headline which
follows the match, even if they do not match the regexp. This makes it
easier to edit directly inside the sparse tree. However, if you use
org-occur mainly as an overview, the following headlines are
unnecessary clutter."
:group 'org-structure
:type 'boolean)
(defcustom org-archive-location "%s_archive::"
"The location where subtrees should be archived.
This string consists of two parts, separated by a double-colon.
......@@ -896,25 +950,6 @@ first line, so it is probably best to use this in combinations with
:group 'org-structure
:type 'boolean)
(defcustom org-plain-list-ordered-item-terminator t
"The character that makes a line with leading number an ordered list item.
Valid values are ?. and ?\). To get both terminators, use t. While
?. may look nicer, it creates the danger that a line with leading
number may be incorrectly interpreted as an item. ?\) therefore is
the safe choice."
:group 'org-structure
:type '(choice (const :tag "dot like in \"2.\"" ?.)
(const :tag "paren like in \"2)\"" ?\))
(const :tab "both" t)))
(defcustom org-auto-renumber-ordered-lists t
"Non-nil means, automatically renumber ordered plain lists.
Renumbering happens when the sequence have been changed with
\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
:group 'org-structure
:type 'boolean)
(defgroup org-link nil
"Options concerning links in Org-mode."
:tag "Org Link"
......@@ -942,10 +977,11 @@ Changing this varable requires a re-launch of Emacs of become effective."
:group 'org-link
:type 'boolean)
(defcustom org-line-numbers-in-file-links t
"Non-nil means, file links from `org-store-link' contain line numbers.
The line number will be added to the file name with :NNN and interpreted
by the command `org-open-at-point'.
(defcustom org-context-in-file-links t
"Non-nil means, file links from `org-store-link' contain context.
The line number will be added to the file name with :: as separator and
used to find the context when the link is activated by the command
`org-open-at-point'.
Using a prefix arg to the command \\[org-store-link] (`org-store-link')
negates this setting for the duration of the command."
:group 'org-link
......@@ -1168,7 +1204,7 @@ See also the variable `org-table-auto-blank-field'."
(const :tag "on" t)
(const :tag "on, optimized" optimized)))
;; FIXME: We could have a third option which makes it jump onle over the first
;; FIXME: We could have a third option which makes it jump only over the first
;; hline in a table.
(defcustom org-table-tab-jumps-over-hlines t
"Non-nil means, tab in the last column of a table with jump over a hline.
......@@ -1443,7 +1479,7 @@ This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
:group 'org-export
:type 'boolean)
(defcustom org-export-plain-list-max-depth 3
(defcustom org-export-plain-list-max-depth 20
"Maximum depth of hand-formatted lists in HTML export.
Org-mode parses hand-formatted enumeration and bullet lists and
......@@ -1626,7 +1662,6 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
:group 'org-export
:type 'boolean)
;; FIXME: not yet used.
(defcustom org-icalendar-combined-name "OrgMode"
"Calendar name for the combined iCalendar representing all agenda files."
:group 'org-export
......@@ -1983,6 +2018,7 @@ The following commands are available:
(easy-menu-add org-tbl-menu)
(org-install-agenda-files-menu)
(setq outline-regexp "\\*+")
(setq outline-level 'org-outline-level)
(if org-startup-truncated (setq truncate-lines t))
(org-set-regexps-and-options)
(set (make-local-variable 'font-lock-unfontify-region-function)
......@@ -2088,11 +2124,28 @@ The following commands are available:
'keymap org-mouse-map))
t)))
(defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>")
(defun org-activate-camels (limit)
"Run through the buffer and add overlays to dates."
(if (re-search-forward org-camel-regexp limit t)
(progn
(add-text-properties (match-beginning 0) (match-end 0)
(list 'mouse-face 'highlight
'keymap org-mouse-map))
t)))
(defun org-font-lock-level ()
(save-excursion
(org-back-to-heading t)
(- (match-end 0) (match-beginning 0))))
(defun org-outline-level ()
(save-excursion
(looking-at outline-regexp)
(if (match-beginning 1)
(+ (org-get-string-indentation (match-string 1)) 1000)
(- (match-end 0) (match-beginning 0)))))
(defvar org-font-lock-keywords nil)
(defun org-set-font-lock-defaults ()
......@@ -2100,6 +2153,7 @@ The following commands are available:
(list
'(org-activate-links (0 'org-link))
'(org-activate-dates (0 'org-link))
'(org-activate-camels (0 'org-link))
(list (concat "^\\*+[ \t]*" org-not-done-regexp)
'(1 'org-warning t))
(list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
......@@ -2199,120 +2253,125 @@ The following commands are available:
;; special case: use global cycling
(setq arg t))
(cond
(let ((outline-regexp
(if org-cycle-include-plain-lists
"\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
outline-regexp)))
((org-at-table-p 'any)
;; Enter the table or move to the next field in the table
(or (org-table-recognize-table.el)
(progn
(org-table-justify-field-maybe)
(org-table-next-field))))
(cond
((eq arg t) ;; Global cycling
((org-at-table-p 'any)
;; Enter the table or move to the next field in the table
(or (org-table-recognize-table.el)
(progn
(org-table-justify-field-maybe)
(org-table-next-field))))
(cond
((and (eq last-command this-command)
(eq org-cycle-global-status 'overview))
;; We just created the overview - now do table of contents
;; This can be slow in very large buffers, so indicate action
(message "CONTENTS...")
(save-excursion
;; Visit all headings and show their offspring
(goto-char (point-max))
(catch 'exit
(while (and (progn (condition-case nil
(outline-previous-visible-heading 1)
(error (goto-char (point-min))))
t)
(looking-at outline-regexp))
(show-branches)
(if (bobp) (throw 'exit nil))))
(message "CONTENTS...done"))
(setq org-cycle-global-status 'contents)
(run-hook-with-args 'org-cycle-hook 'contents))
((and (eq last-command this-command)
(eq org-cycle-global-status 'contents))
;; We just showed the table of contents - now show everything
(show-all)
(message "SHOW ALL")
(setq org-cycle-global-status 'all)
(run-hook-with-args 'org-cycle-hook 'all))
((eq arg t) ;; Global cycling
(t
;; Default action: go to overview
(hide-sublevels 1)
(message "OVERVIEW")
(setq org-cycle-global-status 'overview)
(run-hook-with-args 'org-cycle-hook 'overview))))
(cond
((and (eq last-command this-command)
(eq org-cycle-global-status 'overview))
;; We just created the overview - now do table of contents
;; This can be slow in very large buffers, so indicate action
(message "CONTENTS...")
(save-excursion
;; Visit all headings and show their offspring
(goto-char (point-max))
(catch 'exit
(while (and (progn (condition-case nil
(outline-previous-visible-heading 1)
(error (goto-char (point-min))))
t)
(looking-at outline-regexp))
(show-branches)
(if (bobp) (throw 'exit nil))))
(message "CONTENTS...done"))
(setq org-cycle-global-status 'contents)
(run-hook-with-args 'org-cycle-hook 'contents))
((integerp arg)
;; Show-subtree, ARG levels up from here.
(save-excursion
(org-back-to-heading)
(outline-up-heading (if (< arg 0) (- arg)
(- (outline-level) arg)))
(org-show-subtree)))
((and (eq last-command this-command)
(eq org-cycle-global-status 'contents))
;; We just showed the table of contents - now show everything
(show-all)
(message "SHOW ALL")
(setq org-cycle-global-status 'all)
(run-hook-with-args 'org-cycle-hook 'all))
((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
;; At a heading: rotate between three different views
(org-back-to-heading)
(let ((goal-column 0) eoh eol eos)
;; First, some boundaries
(t
;; Default action: go to overview
(hide-sublevels 1)
(message "OVERVIEW")
(setq org-cycle-global-status 'overview)
(run-hook-with-args 'org-cycle-hook 'overview))))
((integerp arg)
;; Show-subtree, ARG levels up from here.
(save-excursion
(org-back-to-heading)
(outline-up-heading (if (< arg 0) (- arg)
(- (outline-level) arg)))
(org-show-subtree)))
((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
;; At a heading: rotate between three different views
(org-back-to-heading)
(let ((goal-column 0) eoh eol eos)
;; First, some boundaries
(save-excursion
(beginning-of-line 2)
(while (and (not (eobp)) ;; this is like `next-line'
(get-char-property (1- (point)) 'invisible))
(beginning-of-line 2)) (setq eol (point)))
(outline-end-of-heading) (setq eoh (point))
(outline-end-of-subtree) (setq eos (point))
(outline-next-heading))
;; Find out what to do next and set `this-command'
(cond
((= eos eoh)
;; Nothing is hidden behind this heading
(message "EMPTY ENTRY")
(setq org-cycle-subtree-status nil))
((>= eol eos)
;; Entire subtree is hidden in one line: open it
(org-show-entry)
(show-children)
(message "CHILDREN")
(setq org-cycle-subtree-status 'children)
(run-hook-with-args 'org-cycle-hook 'children))
((and (eq last-command this-command)
(eq org-cycle-subtree-status 'children))
;; We just showed the children, now show everything.
(org-show-subtree)
(message "SUBTREE")
(setq org-cycle-subtree-status 'subtree)
(run-hook-with-args 'org-cycle-hook 'subtree))
(t
;; Default action: hide the subtree.
(hide-subtree)
(message "FOLDED")
(setq org-cycle-subtree-status 'folded)
(run-hook-with-args 'org-cycle-hook 'folded)))))
;; TAB emulation
(buffer-read-only (org-back-to-heading))
((if (and (eq org-cycle-emulate-tab 'white)
(save-excursion (beginning-of-line 1) (looking-at "[ \t]+$")))
t
(eq org-cycle-emulate-tab t))
(if (and (looking-at "[ \n\r\t]")
(string-match "^[ \t]*$" (buffer-substring
(point-at-bol) (point))))
(progn
(beginning-of-line 1)
(and (looking-at "[ \t]+") (replace-match ""))))
(indent-relative))
(org-back-to-heading)
(save-excursion
(beginning-of-line 2)
(while (and (not (eobp)) ;; this is like `next-line'
(get-char-property (1- (point)) 'invisible))
(beginning-of-line 2)) (setq eol (point)))
(outline-end-of-heading) (setq eoh (point))
(outline-end-of-subtree) (setq eos (point))
(outline-next-heading))
;; Find out what to do next and set `this-command'
(cond
((= eos eoh)
;; Nothing is hidden behind this heading
(message "EMPTY ENTRY")
(setq org-cycle-subtree-status nil))
((>= eol eos)
;; Entire subtree is hidden in one line: open it
(org-show-entry)
(show-children)
(message "CHILDREN")
(setq org-cycle-subtree-status 'children)
(run-hook-with-args 'org-cycle-hook 'children))
((and (eq last-command this-command)
(eq org-cycle-subtree-status 'children))
;; We just showed the children, now show everything.
(org-show-subtree)
(message "SUBTREE")
(setq org-cycle-subtree-status 'subtree)
(run-hook-with-args 'org-cycle-hook 'subtree))
(t
;; Default action: hide the subtree.
(hide-subtree)
(message "FOLDED")
(setq org-cycle-subtree-status 'folded)
(run-hook-with-args 'org-cycle-hook 'folded)))))
;; TAB emulation
(buffer-read-only (org-back-to-heading))
((if (and (eq org-cycle-emulate-tab 'white)
(save-excursion (beginning-of-line 1) (looking-at "[ \t]+$")))
t
(eq org-cycle-emulate-tab t))
(if (and (looking-at "[ \n\r\t]")
(string-match "^[ \t]*$" (buffer-substring
(point-at-bol) (point))))
(progn
(beginning-of-line 1)
(and (looking-at "[ \t]+") (replace-match ""))))
(indent-relative))
(t (save-excursion
(org-back-to-heading)
(org-cycle)))))
(t (save-excursion
(org-back-to-heading)
(org-cycle))))))
(defun org-optimize-window-after-visibility-change (state)
"Adjust the window after a change in outline visibility.
......@@ -3150,6 +3209,7 @@ At all other locations, this simply calls `ispell-complete-word'."
(if (equal (char-before (point)) ?\ ) (backward-char 1))
(skip-chars-backward "a-zA-Z0-9_:$")
(point)))
(camel (equal (char-before beg) ?*))
(texp (equal (char-before beg) ?\\))
(opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
beg)
......@@ -3157,6 +3217,7 @@ At all other locations, this simply calls `ispell-complete-word'."
(pattern (buffer-substring-no-properties beg end))
(completion-ignore-case opt)
(type nil)
(tbl nil)
(table (cond
(opt
(setq type :opt)
......@@ -3171,6 +3232,14 @@ At all other locations, this simply calls `ispell-complete-word'."
(buffer-substring (point-at-bol) beg))
(setq type :todo)
(mapcar 'list org-todo-keywords))
(camel
(setq type :camel)
(save-excursion
(goto-char (point-min))
(while (re-search-forward org-todo-line-regexp nil t)
(push (list (org-make-org-heading-camel (match-string 3)))
tbl)))
tbl)
(t (progn (ispell-complete-word arg) (throw 'exit nil)))))
(completion (try-completion pattern table)))
(cond ((eq completion t)
......@@ -3251,6 +3320,17 @@ prefix arg, switch to that state."
(completing-read "State: " (mapcar (lambda(x) (list x))
org-todo-keywords)
nil t))
((eq arg 'right)
(if this
(if tail (car tail) nil)
(car org-todo-keywords)))
((eq arg 'left)
(if (equal member org-todo-keywords)
nil
(if this
(nth (- (length org-todo-keywords) (length tail) 2)
org-todo-keywords)
org-done-string)))
(arg
;; user requests a specific state
(nth (1- (prefix-numeric-value arg))
......@@ -3282,10 +3362,19 @@ prefix arg, switch to that state."
(defun org-show-todo-tree (arg)
"Make a compact tree which shows all headlines marked with TODO.
The tree will show the lines where the regexp matches, and all higher
headlines above the match."
headlines above the match.
With \\[universal-argument] prefix, also show the DONE entries.
With a numeric prefix N, construct a sparse tree for the Nth element
of `org-todo-keywords'."
(interactive "P")
(let ((case-fold-search nil)
(kwd-re (if arg org-todo-regexp org-not-done-regexp)))
(kwd-re
(cond ((null arg) org-not-done-regexp)
((equal arg '(4)) org-todo-regexp)
((<= (prefix-numeric-value arg) (length org-todo-keywords))
(regexp-quote (nth (1- (prefix-numeric-value arg))
org-todo-keywords)))
(t (error "Invalid prefix argument: %s" arg)))))
(message "%d TODO entries found"
(org-occur (concat "^" outline-regexp " +" kwd-re )))))
......@@ -3322,6 +3411,7 @@ to make sure editing the matching entry is easy.
if CALLBACK is non-nil, it is a function which is called to confirm
that the match should indeed be shown."
(interactive "sRegexp: ")
(org-remove-occur-highlights nil nil t)
(setq regexp (org-check-occur-regexp regexp))
(let ((cnt 0))
(save-excursion
......@@ -3329,8 +3419,11 @@ that the match should indeed be shown."
(hide-sublevels 1)
(while (re-search-forward regexp nil t)
(when (or (not callback)
(funcall callback))
(save-match-data (funcall callback)))
(setq cnt (1+ cnt))
(org-highlight-new-match (match-beginning 0) (match-end 0))
(add-hook 'before-change-functions 'org-remove-occur-highlights
nil 'local)
(org-show-hierarchy-above))))
(run-hooks 'org-occur-hook)
(if (interactive-p)
......@@ -3341,17 +3434,36 @@ that the match should indeed be shown."
"Make sure point and the headings hierarchy above is visible."
(if (org-on-heading-p t)
(org-flag-heading nil) ; only show the heading
(org-show-hidden-entry)) ; show entire entry
(and (org-invisible-p) (org-show-hidden-entry))) ; show entire entry
(save-excursion
(and org-show-following-heading
(outline-next-heading)
(org-flag-heading nil))) ; show the next heading
(save-excursion ; show all higher headings
(while (condition-case nil
(progn (org-up-heading-all 1) t)
(error nil))
(org-flag-heading nil))))
(when org-show-hierarchy-above
(save-excursion ; show all higher headings
(while (condition-case nil
(progn (org-up-heading-all 1) t)
(error nil))
(org-flag-heading nil)))))
(defvar org-occur-highlights nil)
(defun org-highlight-new-match (beg end)
"Highlight from BEG to END and mark the highlight is an occur headline."
(let ((ov (make-overlay beg end)))
(overlay-put ov 'face 'secondary-selection)
(push ov org-occur-highlights)))
(defun org-remove-occur-highlights (&optional beg end noremove)
"Remove the occur highlights from the buffer.
BEG and END are ignored. If NOREMOVE is nil, remove this function
from the before-change-functions in the current buffer."
(interactive)
(mapc 'delete-overlay org-occur-highlights)
(setq org-occur-highlights nil)
(unless noremove
(remove-hook 'before-change-functions
'org-remove-occur-highlights 'local)))
;;; Priorities
(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
......@@ -3767,13 +3879,19 @@ With prefix ARG, change by that many units."
"Increase the date in the time stamp by one day.
With prefix ARG, change that many days."
(interactive "p")
(org-timestamp-change (prefix-numeric-value arg) 'day))
(if (and (not (org-at-timestamp-p))
(org-on-heading-p))
(org-todo 'up)
(org-timestamp-change (prefix-numeric-value arg) 'day)))
(defun org-timestamp-down-day (&optional arg)
"Decrease the date in the time stamp by one day.
With prefix ARG, change that many days."
(interactive "p")
(org-timestamp-change (- (prefix-numeric-value arg)) 'day))
(if (and (not (org-at-timestamp-p))
(org-on-heading-p))
(org-todo 'down)
(org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
(defsubst org-pos-in-match-range (pos n)
(and (match-beginning n)
......@@ -3781,7 +3899,7 @@ With prefix ARG, change that many days."
(>= (match-end n) pos)))
(defun org-at-timestamp-p ()
"Determine if the cursor is or at a timestamp."
"Determine if the cursor is in or at a timestamp."
(interactive)
(let* ((tsr org-ts-regexp2)
(pos (point))
......@@ -4269,7 +4387,7 @@ NDAYS defaults to `org-agenda-ndays'."
(put-text-property s (1- (point)) 'face
'org-link)
(if rtnall (insert
(org-finalize-agenda-entries ;; FIXME: condition needed
(org-finalize-agenda-entries
(org-agenda-add-time-grid-maybe
rtnall nd todayp))
"\n"))
......@@ -4291,6 +4409,65 @@ NDAYS defaults to `org-agenda-ndays'."
(if (not org-select-agenda-window) (select-window win))
(message "")))
(defvar org-select-this-todo-keyword nil)