2008-06-10 06:26:09 +00:00
|
|
|
|
;;; org-agenda.el --- Dynamic task and appointment lists for Org
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2013-01-01 15:04:24 +00:00
|
|
|
|
;; Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Carsten Dominik <carsten at orgmode dot org>
|
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, wp
|
|
|
|
|
;; Homepage: http://orgmode.org
|
|
|
|
|
;;
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
;;
|
2008-05-06 12:45:52 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 12:45:52 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 12:45:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file contains the code for creating and using the Agenda for Org-mode.
|
2011-08-10 07:07:37 +00:00
|
|
|
|
;;
|
|
|
|
|
;; The functions `org-batch-agenda', `org-batch-agenda-csv', and
|
|
|
|
|
;; `org-batch-store-agenda-views' are implemented as macros to provide
|
2012-01-10 10:56:15 +00:00
|
|
|
|
;; a convenient way for extracting agenda information from the command
|
2012-08-11 17:10:44 +00:00
|
|
|
|
;; line. The Lisp does not evaluate parameters of a macro call; thus
|
2011-08-10 07:07:37 +00:00
|
|
|
|
;; it is not necessary to quote the parameters passed to one of those
|
2012-08-11 17:10:44 +00:00
|
|
|
|
;; functions. E.g. you can write:
|
2011-08-10 07:07:37 +00:00
|
|
|
|
;;
|
|
|
|
|
;; emacs -batch -l ~/.emacs -eval '(org-batch-agenda "a" org-agenda-span 7)'
|
|
|
|
|
;;
|
2012-08-11 17:10:44 +00:00
|
|
|
|
;; To export an agenda spanning 7 days. If `org-batch-agenda' would
|
2011-08-10 07:07:37 +00:00
|
|
|
|
;; have been implemented as a regular function you'd have to quote the
|
2012-08-11 17:10:44 +00:00
|
|
|
|
;; symbol org-agenda-span. Moreover: To use a symbol as parameter
|
2011-08-10 07:07:37 +00:00
|
|
|
|
;; value you would have to double quote the symbol.
|
|
|
|
|
;;
|
|
|
|
|
;; This is a hack, but it works even when running Org byte-compiled.
|
|
|
|
|
;;
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2008-03-28 10:38:31 +00:00
|
|
|
|
(require 'org)
|
2012-08-12 22:36:15 +00:00
|
|
|
|
(require 'org-macs)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(eval-when-compile
|
2010-04-18 14:47:57 +00:00
|
|
|
|
(require 'cl))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-05-06 11:56:34 +00:00
|
|
|
|
(declare-function diary-add-to-list "diary-lib"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(date string specifier &optional marker globcolor literal))
|
2008-03-28 10:38:31 +00:00
|
|
|
|
(declare-function calendar-absolute-from-iso "cal-iso" (date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(declare-function calendar-astro-date-string "cal-julian" (&optional date))
|
|
|
|
|
(declare-function calendar-bahai-date-string "cal-bahai" (&optional date))
|
|
|
|
|
(declare-function calendar-chinese-date-string "cal-china" (&optional date))
|
|
|
|
|
(declare-function calendar-coptic-date-string "cal-coptic" (&optional date))
|
|
|
|
|
(declare-function calendar-ethiopic-date-string "cal-coptic" (&optional date))
|
|
|
|
|
(declare-function calendar-french-date-string "cal-french" (&optional date))
|
|
|
|
|
(declare-function calendar-goto-date "cal-move" (date))
|
|
|
|
|
(declare-function calendar-hebrew-date-string "cal-hebrew" (&optional date))
|
|
|
|
|
(declare-function calendar-islamic-date-string "cal-islam" (&optional date))
|
|
|
|
|
(declare-function calendar-iso-date-string "cal-iso" (&optional date))
|
2008-04-29 05:15:41 +00:00
|
|
|
|
(declare-function calendar-iso-from-absolute "cal-iso" (date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(declare-function calendar-julian-date-string "cal-julian" (&optional date))
|
|
|
|
|
(declare-function calendar-mayan-date-string "cal-mayan" (&optional date))
|
|
|
|
|
(declare-function calendar-persian-date-string "cal-persia" (&optional date))
|
2011-10-28 14:53:36 +00:00
|
|
|
|
(declare-function calendar-check-holidays "holidays" (date))
|
|
|
|
|
|
2009-11-15 06:43:37 +00:00
|
|
|
|
(declare-function org-datetree-find-date-create "org-datetree"
|
|
|
|
|
(date &optional keep-restriction))
|
2008-04-18 03:42:38 +00:00
|
|
|
|
(declare-function org-columns-quit "org-colview" ())
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(declare-function diary-date-display-form "diary-lib" (&optional type))
|
2009-10-05 15:13:56 +00:00
|
|
|
|
(declare-function org-mobile-write-agenda-for-mobile "org-mobile" (file))
|
2009-10-20 11:24:55 +00:00
|
|
|
|
(declare-function org-habit-insert-consistency-graphs
|
|
|
|
|
"org-habit" (&optional line))
|
|
|
|
|
(declare-function org-is-habit-p "org-habit" (&optional pom))
|
|
|
|
|
(declare-function org-habit-parse-todo "org-habit" (&optional pom))
|
2009-11-15 06:43:37 +00:00
|
|
|
|
(declare-function org-habit-get-priority "org-habit" (habit &optional moment))
|
2011-08-25 13:20:10 +00:00
|
|
|
|
(declare-function org-pop-to-buffer-same-window "org-compat"
|
2011-07-18 17:25:10 +00:00
|
|
|
|
(&optional buffer-or-name norecord label))
|
2012-08-12 22:36:15 +00:00
|
|
|
|
(declare-function org-agenda-columns "org-colview" ())
|
|
|
|
|
(declare-function org-add-archive-files "org-archive" (files))
|
2012-09-02 10:52:38 +00:00
|
|
|
|
(declare-function org-capture "org-capture" (&optional goto keys))
|
2011-07-18 17:25:10 +00:00
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar calendar-mode-map) ; defined in calendar.el
|
2012-08-30 09:52:16 +00:00
|
|
|
|
(defvar org-clock-current-task nil) ; defined in org-clock.el
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el
|
|
|
|
|
(defvar org-habit-show-habits) ; defined in org-habit.el
|
2009-10-20 11:24:55 +00:00
|
|
|
|
(defvar org-habit-show-habits-only-for-today)
|
2012-09-17 16:57:58 +00:00
|
|
|
|
(defvar org-habit-show-all-today)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;; Defined somewhere in this file, but used before definition.
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-agenda-buffer-name "*Org Agenda*")
|
|
|
|
|
(defvar org-agenda-overriding-header nil)
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(defvar org-agenda-title-append nil)
|
2012-05-18 11:16:11 +00:00
|
|
|
|
(org-no-warnings (defvar entry)) ;; unprefixed, from calendar.el
|
|
|
|
|
(org-no-warnings (defvar date)) ;; unprefixed, from calendar.el
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar original-date) ; dynamically scoped, calendar.el does scope this
|
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-agenda-undo-list nil
|
|
|
|
|
"List of undoable operations in the agenda since last refresh.")
|
|
|
|
|
(defvar org-agenda-pending-undo-list nil
|
|
|
|
|
"In a series of undo commands, this is the list of remaining undo items.")
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-confirm-kill 1
|
|
|
|
|
"When set, remote killing from the agenda buffer needs confirmation.
|
|
|
|
|
When t, a confirmation is always needed. When a number N, confirmation is
|
|
|
|
|
only needed when the text to be killed contains more than N non-white lines."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "Always" t)
|
2009-04-01 11:58:27 +00:00
|
|
|
|
(integer :tag "When more than N lines")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-compact-blocks nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means make the block agenda more compact.
|
2011-06-03 19:09:46 +00:00
|
|
|
|
This is done globally by leaving out lines like the agenda span
|
|
|
|
|
name and week number or the separator lines."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda
|
2008-04-17 16:26:27 +00:00
|
|
|
|
:type 'boolean)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-01-18 07:22:18 +00:00
|
|
|
|
(defcustom org-agenda-block-separator ?=
|
|
|
|
|
"The separator between blocks in the agenda.
|
|
|
|
|
If this is a string, it will be used as the separator, with a newline added.
|
2011-06-03 19:09:46 +00:00
|
|
|
|
If it is a character, it will be repeated to fill the window width.
|
|
|
|
|
If nil the separator is disabled. In `org-agenda-custom-commands' this
|
|
|
|
|
addresses the separator between the current and the previous block."
|
2009-01-18 07:22:18 +00:00
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type '(choice
|
2011-06-03 19:09:46 +00:00
|
|
|
|
(const :tag "Disabled" nil)
|
2009-01-18 07:22:18 +00:00
|
|
|
|
(character)
|
|
|
|
|
(string)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-export nil
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Options concerning exporting agenda views in Org-mode."
|
|
|
|
|
:tag "Org Agenda Export"
|
|
|
|
|
:group 'org-agenda)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-with-colors t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means use colors in agenda views."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-export
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-exporter-settings nil
|
|
|
|
|
"Alist of variable/value pairs that should be active during agenda export.
|
2009-06-18 07:56:59 +00:00
|
|
|
|
This is a good place to set options for ps-print and for htmlize.
|
|
|
|
|
Note that the way this is implemented, the values will be evaluated
|
|
|
|
|
before assigned to the variables. So make sure to quote values you do
|
|
|
|
|
*not* want evaluated, for example
|
|
|
|
|
|
|
|
|
|
(setq org-agenda-exporter-settings
|
|
|
|
|
'((ps-print-color-p 'black-white)))"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-export
|
|
|
|
|
:type '(repeat
|
|
|
|
|
(list
|
|
|
|
|
(variable)
|
|
|
|
|
(sexp :tag "Value"))))
|
|
|
|
|
|
2009-02-27 09:36:54 +00:00
|
|
|
|
(defcustom org-agenda-before-write-hook '(org-agenda-add-entry-text)
|
2012-09-18 06:40:11 +00:00
|
|
|
|
"Hook run in a temporary buffer before writing the agenda to an export file.
|
|
|
|
|
A useful function for this hook is `org-agenda-add-entry-text'."
|
2009-02-26 19:30:46 +00:00
|
|
|
|
:group 'org-agenda-export
|
|
|
|
|
:type 'hook
|
|
|
|
|
:options '(org-agenda-add-entry-text))
|
|
|
|
|
|
2009-02-27 09:36:54 +00:00
|
|
|
|
(defcustom org-agenda-add-entry-text-maxlines 0
|
2009-02-26 19:30:46 +00:00
|
|
|
|
"Maximum number of entry text lines to be added to agenda.
|
2009-02-27 09:36:54 +00:00
|
|
|
|
This is only relevant when `org-agenda-add-entry-text' is part of
|
2012-09-18 06:40:11 +00:00
|
|
|
|
`org-agenda-before-write-hook', which is the default.
|
2009-02-27 09:36:54 +00:00
|
|
|
|
When this is 0, nothing will happen. When it is greater than 0, it
|
|
|
|
|
specifies the maximum number of lines that will be added for each entry
|
2009-08-27 07:56:46 +00:00
|
|
|
|
that is listed in the agenda view.
|
|
|
|
|
|
|
|
|
|
Note that this variable is not used during display, only when exporting
|
2010-07-15 20:26:51 +00:00
|
|
|
|
the agenda. For agenda display, see the variables `org-agenda-entry-text-mode'
|
|
|
|
|
and `org-agenda-entry-text-maxlines'."
|
2009-02-26 19:30:46 +00:00
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
2009-03-08 15:53:05 +00:00
|
|
|
|
(defcustom org-agenda-add-entry-text-descriptive-links t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means export org-links as descriptive links in agenda added text.
|
2009-03-08 15:53:05 +00:00
|
|
|
|
This variable applies to the text added to the agenda when
|
|
|
|
|
`org-agenda-add-entry-text-maxlines' is larger than 0.
|
|
|
|
|
When this variable nil, the URL will (also) be shown."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2012-09-21 08:04:14 +00:00
|
|
|
|
(defcustom org-agenda-export-html-style nil
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"The style specification for exported HTML Agenda files.
|
|
|
|
|
If this variable contains a string, it will replace the default <style>
|
|
|
|
|
section as produced by `htmlize'.
|
|
|
|
|
Since there are different ways of setting style information, this variable
|
|
|
|
|
needs to contain the full HTML structure to provide a style, including the
|
|
|
|
|
surrounding HTML tags. The style specifications should include definitions
|
|
|
|
|
the fonts used by the agenda, here is an example:
|
|
|
|
|
|
|
|
|
|
<style type=\"text/css\">
|
|
|
|
|
p { font-weight: normal; color: gray; }
|
|
|
|
|
.org-agenda-structure {
|
|
|
|
|
font-size: 110%;
|
|
|
|
|
color: #003399;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
.org-todo {
|
|
|
|
|
color: #cc6666;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
2009-03-21 13:33:52 +00:00
|
|
|
|
.org-agenda-done {
|
|
|
|
|
color: #339933;
|
|
|
|
|
}
|
2008-03-22 15:52:18 +00:00
|
|
|
|
.org-done {
|
|
|
|
|
color: #339933;
|
|
|
|
|
}
|
|
|
|
|
.title { text-align: center; }
|
|
|
|
|
.todo, .deadline { color: red; }
|
|
|
|
|
.done { color: green; }
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
or, if you want to keep the style in a file,
|
|
|
|
|
|
|
|
|
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
|
|
|
|
|
|
|
|
|
|
As the value of this option simply gets inserted into the HTML <head> header,
|
2012-09-19 10:10:20 +00:00
|
|
|
|
you can \"misuse\" it to also add other text to the header."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-export
|
|
|
|
|
:group 'org-export-html
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2010-05-06 04:21:31 +00:00
|
|
|
|
(defcustom org-agenda-persistent-filter nil
|
|
|
|
|
"When set, keep filters from one agenda view to the next."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-custom-commands nil
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Options concerning agenda views in Org-mode."
|
|
|
|
|
:tag "Org Agenda Custom Commands"
|
|
|
|
|
:group 'org-agenda)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defconst org-sorting-choice
|
|
|
|
|
'(choice
|
|
|
|
|
(const time-up) (const time-down)
|
2013-03-11 17:18:11 +00:00
|
|
|
|
(const timestamp-up) (const timestamp-down)
|
|
|
|
|
(const scheduled-up) (const scheduled-down)
|
|
|
|
|
(const deadline-up) (const deadline-down)
|
|
|
|
|
(const ts-up) (const ts-down)
|
|
|
|
|
(const tsia-up) (const tsia-down)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(const category-keep) (const category-up) (const category-down)
|
|
|
|
|
(const tag-down) (const tag-up)
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(const priority-up) (const priority-down)
|
2008-09-18 11:45:49 +00:00
|
|
|
|
(const todo-state-up) (const todo-state-down)
|
2009-03-27 16:50:21 +00:00
|
|
|
|
(const effort-up) (const effort-down)
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(const habit-up) (const habit-down)
|
2010-04-30 05:31:43 +00:00
|
|
|
|
(const alpha-up) (const alpha-down)
|
2009-03-27 16:50:21 +00:00
|
|
|
|
(const user-defined-up) (const user-defined-down))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Sorting choices.")
|
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
;; Keep custom values for `org-agenda-filter-preset' compatible with
|
|
|
|
|
;; the new variable `org-agenda-tag-filter-preset'.
|
2013-03-14 12:53:52 +00:00
|
|
|
|
(org-defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
|
|
|
|
|
(org-defvaralias 'org-agenda-filter 'org-agenda-tag-filter)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
|
2013-03-16 17:56:56 +00:00
|
|
|
|
(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp)
|
|
|
|
|
"List of types searched for when creating the daily/weekly agenda.
|
|
|
|
|
This variable is a list of symbols that controls the types of
|
|
|
|
|
items that appear in the daily/weekly agenda. Allowed symbols in this
|
|
|
|
|
list are are
|
|
|
|
|
|
|
|
|
|
:timestamp List items containing a date stamp or date range matching
|
|
|
|
|
the selected date. This includes sexp entries in angular
|
|
|
|
|
brackets.
|
|
|
|
|
|
|
|
|
|
:sexp List entries resulting from plain diary-like sexps.
|
|
|
|
|
|
|
|
|
|
:deadline List deadline due on that date. When the date is today,
|
|
|
|
|
also list any deadlines past due, or due within
|
|
|
|
|
`org-deadline-warning-days'. `:deadline' must appear before
|
|
|
|
|
`:scheduled' if the setting of
|
|
|
|
|
`org-agenda-skip-scheduled-if-deadline-is-shown' is to have
|
|
|
|
|
any effect.
|
|
|
|
|
|
|
|
|
|
:deadline* Same as above, but only include the deadline if it has an
|
|
|
|
|
hour specification as [h]h:mm.
|
|
|
|
|
|
|
|
|
|
:scheduled List all items which are scheduled for the given date.
|
|
|
|
|
The diary for *today* also contains items which were
|
|
|
|
|
scheduled earlier and are not yet marked DONE.
|
|
|
|
|
|
|
|
|
|
:scheduled* Same as above, but only include the scheduled item if it
|
|
|
|
|
has an hour specification as [h]h:mm.
|
|
|
|
|
|
|
|
|
|
By default, all four non-starred types are turned on.
|
|
|
|
|
|
|
|
|
|
When :scheduled* or :deadline* are included, :schedule or :deadline
|
|
|
|
|
will be ignored.
|
|
|
|
|
|
|
|
|
|
Never set this variable globally using `setq', because then it
|
|
|
|
|
will apply to all future agenda commands. Instead, bind it with
|
|
|
|
|
`let' to scope it dynamically into the agenda-constructing
|
|
|
|
|
command. A good way to set it is through options in
|
|
|
|
|
`org-agenda-custom-commands'. For a more flexible (though
|
|
|
|
|
somewhat less efficient) way of determining what is included in
|
|
|
|
|
the daily/weekly agenda, see `org-agenda-skip-function'.")
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defconst org-agenda-custom-commands-local-options
|
2012-08-11 17:10:44 +00:00
|
|
|
|
`(repeat :tag "Local settings for this command. Remember to quote values"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(choice :tag "Setting"
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(list :tag "Heading for this block"
|
|
|
|
|
(const org-agenda-overriding-header)
|
|
|
|
|
(string :tag "Headline"))
|
|
|
|
|
(list :tag "Files to be searched"
|
|
|
|
|
(const org-agenda-files)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat (file))))
|
|
|
|
|
(list :tag "Sorting strategy"
|
|
|
|
|
(const org-agenda-sorting-strategy)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat
|
|
|
|
|
,org-sorting-choice)))
|
|
|
|
|
(list :tag "Prefix format"
|
|
|
|
|
(const org-agenda-prefix-format :value " %-12:c%?-12t% s")
|
|
|
|
|
(string))
|
|
|
|
|
(list :tag "Number of days in agenda"
|
|
|
|
|
(const org-agenda-span)
|
|
|
|
|
(choice (const :tag "Day" 'day)
|
|
|
|
|
(const :tag "Week" 'week)
|
|
|
|
|
(const :tag "Month" 'month)
|
|
|
|
|
(const :tag "Year" 'year)
|
|
|
|
|
(integer :tag "Custom")))
|
|
|
|
|
(list :tag "Fixed starting date"
|
|
|
|
|
(const org-agenda-start-day)
|
|
|
|
|
(string :value "2007-11-01"))
|
|
|
|
|
(list :tag "Start on day of week"
|
|
|
|
|
(const org-agenda-start-on-weekday)
|
|
|
|
|
(choice :value 1
|
|
|
|
|
(const :tag "Today" nil)
|
|
|
|
|
(integer :tag "Weekday No.")))
|
|
|
|
|
(list :tag "Include data from diary"
|
|
|
|
|
(const org-agenda-include-diary)
|
|
|
|
|
(boolean))
|
|
|
|
|
(list :tag "Deadline Warning days"
|
|
|
|
|
(const org-deadline-warning-days)
|
|
|
|
|
(integer :value 1))
|
|
|
|
|
(list :tag "Category filter preset"
|
|
|
|
|
(const org-agenda-category-filter-preset)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat
|
|
|
|
|
(string :tag "+category or -category"))))
|
|
|
|
|
(list :tag "Tags filter preset"
|
|
|
|
|
(const org-agenda-tag-filter-preset)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat
|
|
|
|
|
(string :tag "+tag or -tag"))))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(list :tag "Regexp filter preset"
|
|
|
|
|
(const org-agenda-regexp-filter-preset)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat
|
|
|
|
|
(string :tag "+regexp or -regexp"))))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(list :tag "Set daily/weekly entry types"
|
|
|
|
|
(const org-agenda-entry-types)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
2013-03-16 17:56:56 +00:00
|
|
|
|
(set :greedy t :value ,org-agenda-entry-types
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(const :deadline)
|
|
|
|
|
(const :scheduled)
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(const :deadline*)
|
|
|
|
|
(const :scheduled*)
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(const :timestamp)
|
|
|
|
|
(const :sexp))))
|
|
|
|
|
(list :tag "Standard skipping condition"
|
|
|
|
|
:value (org-agenda-skip-function '(org-agenda-skip-entry-if))
|
|
|
|
|
(const org-agenda-skip-function)
|
|
|
|
|
(list
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(list
|
|
|
|
|
(choice
|
|
|
|
|
:tag "Skipping range"
|
|
|
|
|
(const :tag "Skip entry" org-agenda-skip-entry-if)
|
|
|
|
|
(const :tag "Skip subtree" org-agenda-skip-subtree-if))
|
|
|
|
|
(repeat :inline t :tag "Conditions for skipping"
|
2010-03-12 13:44:26 +00:00
|
|
|
|
(choice
|
2012-08-11 17:10:44 +00:00
|
|
|
|
:tag "Condition type"
|
|
|
|
|
(list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
|
|
|
|
|
(list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
|
|
|
|
|
(list :tag "TODO state is" :inline t
|
|
|
|
|
(const 'todo)
|
|
|
|
|
(choice
|
|
|
|
|
(const :tag "any not-done state" 'todo)
|
|
|
|
|
(const :tag "any done state" 'done)
|
|
|
|
|
(const :tag "any state" 'any)
|
|
|
|
|
(list :tag "Keyword list"
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat (string :tag "Keyword")))))
|
|
|
|
|
(list :tag "TODO state is not" :inline t
|
|
|
|
|
(const 'nottodo)
|
|
|
|
|
(choice
|
|
|
|
|
(const :tag "any not-done state" 'todo)
|
|
|
|
|
(const :tag "any done state" 'done)
|
|
|
|
|
(const :tag "any state" 'any)
|
|
|
|
|
(list :tag "Keyword list"
|
|
|
|
|
(const :format "" quote)
|
|
|
|
|
(repeat (string :tag "Keyword")))))
|
|
|
|
|
(const :tag "scheduled" 'scheduled)
|
|
|
|
|
(const :tag "not scheduled" 'notscheduled)
|
|
|
|
|
(const :tag "deadline" 'deadline)
|
|
|
|
|
(const :tag "no deadline" 'notdeadline)
|
|
|
|
|
(const :tag "timestamp" 'timestamp)
|
|
|
|
|
(const :tag "no timestamp" 'nottimestamp))))))
|
|
|
|
|
(list :tag "Non-standard skipping condition"
|
|
|
|
|
:value (org-agenda-skip-function)
|
|
|
|
|
(const org-agenda-skip-function)
|
|
|
|
|
(sexp :tag "Function or form (quoted!)"))
|
|
|
|
|
(list :tag "Any variable"
|
|
|
|
|
(variable :tag "Variable")
|
|
|
|
|
(sexp :tag "Value (sexp)"))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Selection of examples for agenda command settings.
|
|
|
|
|
This will be spliced into the custom type of
|
|
|
|
|
`org-agenda-custom-commands'.")
|
|
|
|
|
|
|
|
|
|
|
2013-03-16 17:54:26 +00:00
|
|
|
|
(defcustom org-agenda-custom-commands
|
|
|
|
|
'(("n" "Agenda and all TODO's" ((agenda "") (alltodo ""))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Custom commands for the agenda.
|
|
|
|
|
These commands will be offered on the splash screen displayed by the
|
|
|
|
|
agenda dispatcher \\[org-agenda]. Each entry is a list like this:
|
|
|
|
|
|
|
|
|
|
(key desc type match settings files)
|
|
|
|
|
|
|
|
|
|
key The key (one or more characters as a string) to be associated
|
|
|
|
|
with the command.
|
|
|
|
|
desc A description of the command, when omitted or nil, a default
|
|
|
|
|
description is built using MATCH.
|
|
|
|
|
type The command type, any of the following symbols:
|
|
|
|
|
agenda The daily/weekly agenda.
|
|
|
|
|
todo Entries with a specific TODO keyword, in all agenda files.
|
|
|
|
|
search Entries containing search words entry or headline.
|
|
|
|
|
tags Tags/Property/TODO match in all agenda files.
|
|
|
|
|
tags-todo Tags/P/T match in all agenda files, TODO entries only.
|
|
|
|
|
todo-tree Sparse tree of specific TODO keyword in *current* file.
|
|
|
|
|
tags-tree Sparse tree with all tags matches in *current* file.
|
|
|
|
|
occur-tree Occur sparse tree for *current* file.
|
|
|
|
|
... A user-defined function.
|
|
|
|
|
match What to search for:
|
|
|
|
|
- a single keyword for TODO keyword searches
|
|
|
|
|
- a tags match expression for tags searches
|
|
|
|
|
- a word search expression for text searches.
|
|
|
|
|
- a regular expression for occur searches
|
|
|
|
|
For all other commands, this should be the empty string.
|
|
|
|
|
settings A list of option settings, similar to that in a let form, so like
|
|
|
|
|
this: ((opt1 val1) (opt2 val2) ...). The values will be
|
|
|
|
|
evaluated at the moment of execution, so quote them when needed.
|
|
|
|
|
files A list of files file to write the produced agenda buffer to
|
|
|
|
|
with the command `org-store-agenda-views'.
|
|
|
|
|
If a file name ends in \".html\", an HTML version of the buffer
|
|
|
|
|
is written out. If it ends in \".ps\", a postscript version is
|
2008-12-16 14:25:23 +00:00
|
|
|
|
produced. Otherwise, only the plain text is written to the file.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
You can also define a set of commands, to create a composite agenda buffer.
|
|
|
|
|
In this case, an entry looks like this:
|
|
|
|
|
|
|
|
|
|
(key desc (cmd1 cmd2 ...) general-settings-for-whole-set files)
|
|
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
|
|
desc A description string to be displayed in the dispatcher menu.
|
|
|
|
|
cmd An agenda command, similar to the above. However, tree commands
|
2012-03-08 12:50:19 +00:00
|
|
|
|
are not allowed, but instead you can get agenda and global todo list.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
So valid commands for a set are:
|
|
|
|
|
(agenda \"\" settings)
|
|
|
|
|
(alltodo \"\" settings)
|
|
|
|
|
(stuck \"\" settings)
|
|
|
|
|
(todo \"match\" settings files)
|
|
|
|
|
(search \"match\" settings files)
|
|
|
|
|
(tags \"match\" settings files)
|
|
|
|
|
(tags-todo \"match\" settings files)
|
|
|
|
|
|
|
|
|
|
Each command can carry a list of options, and another set of options can be
|
|
|
|
|
given for the whole set of commands. Individual command options take
|
|
|
|
|
precedence over the general options.
|
|
|
|
|
|
|
|
|
|
When using several characters as key to a command, the first characters
|
|
|
|
|
are prefix commands. For the dispatcher to display useful information, you
|
|
|
|
|
should provide a description for the prefix, like
|
|
|
|
|
|
|
|
|
|
(setq org-agenda-custom-commands
|
|
|
|
|
'((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
|
|
|
|
|
(\"hl\" tags \"+HOME+Lisa\")
|
|
|
|
|
(\"hp\" tags \"+HOME+Peter\")
|
|
|
|
|
(\"hk\" tags \"+HOME+Kim\")))"
|
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type `(repeat
|
|
|
|
|
(choice :value ("x" "Describe command here" tags "" nil)
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(list :tag "Single command"
|
|
|
|
|
(string :tag "Access Key(s) ")
|
|
|
|
|
(option (string :tag "Description"))
|
|
|
|
|
(choice
|
|
|
|
|
(const :tag "Agenda" agenda)
|
|
|
|
|
(const :tag "TODO list" alltodo)
|
|
|
|
|
(const :tag "Search words" search)
|
|
|
|
|
(const :tag "Stuck projects" stuck)
|
|
|
|
|
(const :tag "Tags/Property match (all agenda files)" tags)
|
|
|
|
|
(const :tag "Tags/Property match of TODO entries (all agenda files)" tags-todo)
|
|
|
|
|
(const :tag "TODO keyword search (all agenda files)" todo)
|
|
|
|
|
(const :tag "Tags sparse tree (current buffer)" tags-tree)
|
|
|
|
|
(const :tag "TODO keyword tree (current buffer)" todo-tree)
|
|
|
|
|
(const :tag "Occur tree (current buffer)" occur-tree)
|
|
|
|
|
(sexp :tag "Other, user-defined function"))
|
|
|
|
|
(string :tag "Match (only for some commands)")
|
|
|
|
|
,org-agenda-custom-commands-local-options
|
|
|
|
|
(option (repeat :tag "Export" (file :tag "Export to"))))
|
|
|
|
|
(list :tag "Command series, all agenda files"
|
|
|
|
|
(string :tag "Access Key(s)")
|
|
|
|
|
(string :tag "Description ")
|
|
|
|
|
(repeat :tag "Component"
|
|
|
|
|
(choice
|
|
|
|
|
(list :tag "Agenda"
|
|
|
|
|
(const :format "" agenda)
|
|
|
|
|
(const :tag "" :format "" "")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "TODO list (all keywords)"
|
|
|
|
|
(const :format "" alltodo)
|
|
|
|
|
(const :tag "" :format "" "")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "Search words"
|
|
|
|
|
(const :format "" search)
|
|
|
|
|
(string :tag "Match")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "Stuck projects"
|
|
|
|
|
(const :format "" stuck)
|
|
|
|
|
(const :tag "" :format "" "")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "Tags search"
|
|
|
|
|
(const :format "" tags)
|
|
|
|
|
(string :tag "Match")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "Tags search, TODO entries only"
|
|
|
|
|
(const :format "" tags-todo)
|
|
|
|
|
(string :tag "Match")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "TODO keyword search"
|
|
|
|
|
(const :format "" todo)
|
|
|
|
|
(string :tag "Match")
|
|
|
|
|
,org-agenda-custom-commands-local-options)
|
|
|
|
|
(list :tag "Other, user-defined function"
|
|
|
|
|
(symbol :tag "function")
|
|
|
|
|
(string :tag "Match")
|
|
|
|
|
,org-agenda-custom-commands-local-options)))
|
|
|
|
|
|
|
|
|
|
(repeat :tag "Settings for entire command set"
|
|
|
|
|
(list (variable :tag "Any variable")
|
|
|
|
|
(sexp :tag "Value")))
|
|
|
|
|
(option (repeat :tag "Export" (file :tag "Export to"))))
|
|
|
|
|
(cons :tag "Prefix key documentation"
|
|
|
|
|
(string :tag "Access Key(s)")
|
|
|
|
|
(string :tag "Description ")))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-query-register ?o
|
|
|
|
|
"The register holding the current query string.
|
2008-12-16 14:25:23 +00:00
|
|
|
|
The purpose of this is that if you construct a query string interactively,
|
2008-03-22 15:52:18 +00:00
|
|
|
|
you can then use it to define a custom command."
|
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type 'character)
|
|
|
|
|
|
|
|
|
|
(defcustom org-stuck-projects
|
|
|
|
|
'("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") nil "")
|
|
|
|
|
"How to identify stuck projects.
|
|
|
|
|
This is a list of four items:
|
2009-02-19 16:11:54 +00:00
|
|
|
|
1. A tags/todo/property matcher string that is used to identify a project.
|
|
|
|
|
See the manual for a description of tag and property searches.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
The entire tree below a headline matched by this is considered one project.
|
|
|
|
|
2. A list of TODO keywords identifying non-stuck projects.
|
|
|
|
|
If the project subtree contains any headline with one of these todo
|
|
|
|
|
keywords, the project is considered to be not stuck. If you specify
|
|
|
|
|
\"*\" as a keyword, any TODO keyword will mark the project unstuck.
|
|
|
|
|
3. A list of tags identifying non-stuck projects.
|
|
|
|
|
If the project subtree contains any headline with one of these tags,
|
|
|
|
|
the project is considered to be not stuck. If you specify \"*\" as
|
2009-04-24 13:37:38 +00:00
|
|
|
|
a tag, any tag will mark the project unstuck. Note that this is about
|
|
|
|
|
the explicit presence of a tag somewhere in the subtree, inherited
|
2013-01-14 14:25:16 +00:00
|
|
|
|
tags do not count here. If inherited tags make a project not stuck,
|
2009-04-24 13:37:38 +00:00
|
|
|
|
use \"-TAG\" in the tags part of the matcher under (1.) above.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
4. An arbitrary regular expression matching non-stuck projects.
|
|
|
|
|
|
2009-03-19 09:21:21 +00:00
|
|
|
|
If the project turns out to be not stuck, search continues also in the
|
|
|
|
|
subtree to see if any of the subtasks have project status.
|
|
|
|
|
|
|
|
|
|
See also the variable `org-tags-match-list-sublevels' which applies
|
|
|
|
|
to projects matched by this search as well.
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
After defining this variable, you may use \\[org-agenda-list-stuck-projects]
|
|
|
|
|
or `C-c a #' to produce the list."
|
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(list
|
|
|
|
|
(string :tag "Tags/TODO match to identify a project")
|
|
|
|
|
(repeat :tag "Projects are *not* stuck if they have an entry with TODO keyword any of" (string))
|
|
|
|
|
(repeat :tag "Projects are *not* stuck if they have an entry with TAG being any of" (string))
|
2009-04-24 13:37:38 +00:00
|
|
|
|
(regexp :tag "Projects are *not* stuck if this regexp matches inside the subtree")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(defcustom org-agenda-filter-effort-default-operator "<"
|
|
|
|
|
"The default operator for effort estimate filtering.
|
2008-11-10 20:50:54 +00:00
|
|
|
|
If you select an effort estimate limit without first pressing an operator,
|
2008-10-20 21:01:23 +00:00
|
|
|
|
this one will be used."
|
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(choice (const :tag "less or equal" "<")
|
|
|
|
|
(const :tag "greater or equal"">")
|
|
|
|
|
(const :tag "equal" "=")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defgroup org-agenda-skip nil
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Options concerning skipping parts of agenda files."
|
|
|
|
|
:tag "Org Agenda Skip"
|
|
|
|
|
:group 'org-agenda)
|
2011-01-14 10:01:01 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-skip-function-global nil
|
|
|
|
|
"Function to be called at each match during agenda construction.
|
|
|
|
|
If this function returns nil, the current match should not be skipped.
|
2011-02-01 12:05:13 +00:00
|
|
|
|
If the function decided to skip an agenda match, is must return the
|
2011-01-14 10:01:01 +00:00
|
|
|
|
buffer position from which the search should be continued.
|
|
|
|
|
This may also be a Lisp form, which will be evaluated.
|
|
|
|
|
|
|
|
|
|
This variable will be applied to every agenda match, including
|
|
|
|
|
tags/property searches and TODO lists. So try to make the test function
|
|
|
|
|
do its checking as efficiently as possible. To implement a skipping
|
|
|
|
|
condition just for specific agenda commands, use the variable
|
|
|
|
|
`org-agenda-skip-function' which can be set in the options section
|
|
|
|
|
of custom agenda commands."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:type 'sexp)
|
|
|
|
|
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(defgroup org-agenda-daily/weekly nil
|
|
|
|
|
"Options concerning the daily/weekly agenda."
|
|
|
|
|
:tag "Org Agenda Daily/Weekly"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
(defgroup org-agenda-todo-list nil
|
|
|
|
|
"Options concerning the global todo list agenda view."
|
|
|
|
|
:tag "Org Agenda Todo List"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
(defgroup org-agenda-match-view nil
|
|
|
|
|
"Options concerning the general tags/property/todo match agenda view."
|
|
|
|
|
:tag "Org Agenda Match View"
|
|
|
|
|
:group 'org-agenda)
|
2009-10-14 11:36:36 +00:00
|
|
|
|
(defgroup org-agenda-search-view nil
|
|
|
|
|
"Options concerning the general tags/property/todo match agenda view."
|
|
|
|
|
:tag "Org Agenda Match View"
|
|
|
|
|
:group 'org-agenda)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-06-19 22:20:12 +00:00
|
|
|
|
(defvar org-agenda-archives-mode nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means the agenda will include archived items.
|
2008-06-19 22:20:12 +00:00
|
|
|
|
If this is the symbol `trees', trees in the selected agenda scope
|
|
|
|
|
that are marked with the ARCHIVE tag will be included anyway. When this is
|
|
|
|
|
t, also all archive files associated with the current selection of agenda
|
|
|
|
|
files will be included.")
|
|
|
|
|
|
2013-04-05 23:51:29 +00:00
|
|
|
|
(defcustom org-agenda-restriction-lock-highlight-subtree t
|
|
|
|
|
"Non-nil means highlight the whole subtree when restriction is active.
|
|
|
|
|
Otherwise only highlight the headline. Highlighting the whole subtree is
|
|
|
|
|
useful to ensure no edits happen beyond the restricted region."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-06-11 14:18:21 +00:00
|
|
|
|
(defcustom org-agenda-skip-comment-trees t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means skip trees that start with the COMMENT keyword.
|
2008-12-16 14:25:23 +00:00
|
|
|
|
When nil, these trees are also scanned by agenda commands."
|
2008-06-11 14:18:21 +00:00
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-todo-list-sublevels t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means check also the sublevels of a TODO entry for TODO entries.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When nil, the sublevels of a TODO entry are not checked, resulting in
|
|
|
|
|
potentially much shorter TODO lists."
|
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-todo-list
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-todo-ignore-with-date nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means don't show entries with a date in the global todo list.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
You can use this if you prefer to mark mere appointments with a TODO keyword,
|
|
|
|
|
but don't want them to show up in the TODO list.
|
|
|
|
|
When this is set, it also covers deadlines and scheduled items, the settings
|
|
|
|
|
of `org-agenda-todo-ignore-scheduled' and `org-agenda-todo-ignore-deadlines'
|
2009-02-18 14:51:51 +00:00
|
|
|
|
will be ignored.
|
|
|
|
|
See also the variable `org-agenda-tags-todo-honor-ignore-options'."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-todo-list
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2010-11-25 18:32:56 +00:00
|
|
|
|
(defcustom org-agenda-todo-ignore-timestamp nil
|
|
|
|
|
"Non-nil means don't show entries with a timestamp.
|
|
|
|
|
This applies when creating the global todo list.
|
|
|
|
|
Valid values are:
|
|
|
|
|
|
|
|
|
|
past Don't show entries for today or in the past.
|
|
|
|
|
|
|
|
|
|
future Don't show entries with a timestamp in the future.
|
|
|
|
|
The idea behind this is that if it has a future
|
|
|
|
|
timestamp, you don't want to think about it until the
|
|
|
|
|
date.
|
|
|
|
|
|
|
|
|
|
all Don't show any entries with a timestamp in the global todo list.
|
|
|
|
|
The idea behind this is that by setting a timestamp, you
|
|
|
|
|
have already \"taken care\" of this item.
|
|
|
|
|
|
2012-08-11 17:10:44 +00:00
|
|
|
|
This variable can also have an integer as a value. If positive (N),
|
|
|
|
|
todos with a timestamp N or more days in the future will be ignored. If
|
2011-01-18 01:51:42 +00:00
|
|
|
|
negative (-N), todos with a timestamp N or more days in the past will be
|
2012-08-11 17:10:44 +00:00
|
|
|
|
ignored. If 0, todos with a timestamp either today or in the future will
|
|
|
|
|
be ignored. For example, a value of -1 will exclude todos with a
|
2011-01-18 01:51:42 +00:00
|
|
|
|
timestamp in the past (yesterday or earlier), while a value of 7 will
|
|
|
|
|
exclude todos with a timestamp a week or more in the future.
|
|
|
|
|
|
2010-11-25 18:32:56 +00:00
|
|
|
|
See also `org-agenda-todo-ignore-with-date'.
|
|
|
|
|
See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
|
|
|
|
|
to make his option also apply to the tags-todo list."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-todo-list
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-11-25 18:32:56 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Ignore future timestamp todos" future)
|
|
|
|
|
(const :tag "Ignore past or present timestamp todos" past)
|
|
|
|
|
(const :tag "Ignore all timestamp todos" all)
|
2011-01-18 01:51:42 +00:00
|
|
|
|
(const :tag "Show timestamp todos" nil)
|
|
|
|
|
(integer :tag "Ignore if N or more days in past(-) or future(+).")))
|
2010-11-25 18:32:56 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-todo-ignore-scheduled nil
|
2010-02-12 23:06:15 +00:00
|
|
|
|
"Non-nil means, ignore some scheduled TODO items when making TODO list.
|
2010-02-15 06:55:51 +00:00
|
|
|
|
This applies when creating the global todo list.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
Valid values are:
|
|
|
|
|
|
|
|
|
|
past Don't show entries scheduled today or in the past.
|
|
|
|
|
|
|
|
|
|
future Don't show entries scheduled in the future.
|
|
|
|
|
The idea behind this is that by scheduling it, you don't want to
|
|
|
|
|
think about it until the scheduled date.
|
|
|
|
|
|
2010-02-14 21:41:54 +00:00
|
|
|
|
all Don't show any scheduled entries in the global todo list.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
The idea behind this is that by scheduling it, you have already
|
|
|
|
|
\"taken care\" of this item.
|
|
|
|
|
|
2010-02-15 06:55:51 +00:00
|
|
|
|
t Same as `all', for backward compatibility.
|
2010-02-14 21:41:54 +00:00
|
|
|
|
|
2012-08-11 17:10:44 +00:00
|
|
|
|
This variable can also have an integer as a value. See
|
2011-01-18 01:51:42 +00:00
|
|
|
|
`org-agenda-todo-ignore-timestamp' for more details.
|
|
|
|
|
|
2009-02-18 14:51:51 +00:00
|
|
|
|
See also `org-agenda-todo-ignore-with-date'.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
|
|
|
|
|
to make his option also apply to the tags-todo list."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-todo-list
|
2010-02-12 23:06:15 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Ignore future-scheduled todos" future)
|
|
|
|
|
(const :tag "Ignore past- or present-scheduled todos" past)
|
|
|
|
|
(const :tag "Ignore all scheduled todos" all)
|
|
|
|
|
(const :tag "Ignore all scheduled todos (compatibility)" t)
|
2011-01-18 01:51:42 +00:00
|
|
|
|
(const :tag "Show scheduled todos" nil)
|
|
|
|
|
(integer :tag "Ignore if N or more days in past(-) or future(+).")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-todo-ignore-deadlines nil
|
2010-02-12 23:06:15 +00:00
|
|
|
|
"Non-nil means ignore some deadlined TODO items when making TODO list.
|
2010-03-24 12:13:53 +00:00
|
|
|
|
There are different motivations for using different values, please think
|
|
|
|
|
carefully when configuring this variable.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
|
2010-07-15 20:26:51 +00:00
|
|
|
|
This applies when creating the global todo list.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
Valid values are:
|
|
|
|
|
|
|
|
|
|
near Don't show near deadline entries. A deadline is near when it is
|
|
|
|
|
closer than `org-deadline-warning-days' days. The idea behind this
|
|
|
|
|
is that such items will appear in the agenda anyway.
|
|
|
|
|
|
2010-03-24 12:13:53 +00:00
|
|
|
|
far Don't show TODO entries where a deadline has been defined, but
|
|
|
|
|
the deadline is not near. This is useful if you don't want to
|
|
|
|
|
use the todo list to figure out what to do now.
|
|
|
|
|
|
|
|
|
|
past Don't show entries with a deadline timestamp for today or in the past.
|
|
|
|
|
|
|
|
|
|
future Don't show entries with a deadline timestamp in the future, not even
|
|
|
|
|
when they become `near' ones. Use it with caution.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
|
2010-04-01 11:11:54 +00:00
|
|
|
|
all Ignore all TODO entries that do have a deadline.
|
2010-02-12 23:06:15 +00:00
|
|
|
|
|
2010-02-14 21:41:54 +00:00
|
|
|
|
t Same as `near', for backward compatibility.
|
|
|
|
|
|
2012-08-11 17:10:44 +00:00
|
|
|
|
This variable can also have an integer as a value. See
|
2011-01-18 01:51:42 +00:00
|
|
|
|
`org-agenda-todo-ignore-timestamp' for more details.
|
|
|
|
|
|
2009-02-18 14:51:51 +00:00
|
|
|
|
See also `org-agenda-todo-ignore-with-date'.
|
2010-02-14 21:41:54 +00:00
|
|
|
|
See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
|
|
|
|
|
to make his option also apply to the tags-todo list."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-todo-list
|
2010-02-12 23:06:15 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Ignore near deadlines" near)
|
|
|
|
|
(const :tag "Ignore near deadlines (compatibility)" t)
|
2010-02-14 21:41:54 +00:00
|
|
|
|
(const :tag "Ignore far deadlines" far)
|
2010-02-12 23:06:15 +00:00
|
|
|
|
(const :tag "Ignore all TODOs with a deadlines" all)
|
2011-01-18 01:51:42 +00:00
|
|
|
|
(const :tag "Show all TODOs, even if they have a deadline" nil)
|
|
|
|
|
(integer :tag "Ignore if N or more days in past(-) or future(+).")))
|
2009-01-25 06:39:26 +00:00
|
|
|
|
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(defcustom org-agenda-todo-ignore-time-comparison-use-seconds nil
|
|
|
|
|
"Time unit to use when possibly ignoring an agenda item.
|
|
|
|
|
|
|
|
|
|
See the docstring of various `org-agenda-todo-ignore-*' options.
|
|
|
|
|
The default is to compare time stamps using days. An item is thus
|
|
|
|
|
considered to be in the future if it is at least one day after today.
|
|
|
|
|
Non-nil means to compare time stamps using seconds. An item is then
|
|
|
|
|
considered future if it has a time value later than current time."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-todo-list
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-09-26 10:06:19 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Compare time with days" nil)
|
|
|
|
|
(const :tag "Compare time with seconds" t)))
|
|
|
|
|
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(defcustom org-agenda-tags-todo-honor-ignore-options nil
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
"Non-nil means honor todo-list ignores options also in tags-todo search.
|
2009-01-25 06:39:26 +00:00
|
|
|
|
The variables
|
|
|
|
|
`org-agenda-todo-ignore-with-date',
|
2010-11-25 18:32:56 +00:00
|
|
|
|
`org-agenda-todo-ignore-timestamp',
|
|
|
|
|
`org-agenda-todo-ignore-scheduled',
|
2009-01-25 06:39:26 +00:00
|
|
|
|
`org-agenda-todo-ignore-deadlines'
|
|
|
|
|
make the global TODO list skip entries that have time stamps of certain
|
|
|
|
|
kinds. If this option is set, the same options will also apply for the
|
|
|
|
|
tags-todo search, which is the general tags/property matcher
|
|
|
|
|
restricted to unfinished TODO entries only."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-todo-list
|
|
|
|
|
:group 'org-agenda-match-view
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-skip-scheduled-if-done nil
|
|
|
|
|
"Non-nil means don't show scheduled items in agenda when they are done.
|
|
|
|
|
This is relevant for the daily/weekly agenda, not for the TODO list. And
|
|
|
|
|
it applies only to the actual date of the scheduling. Warnings about
|
|
|
|
|
an item with a past scheduling dates are always turned off when the item
|
|
|
|
|
is DONE."
|
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2009-08-07 21:59:07 +00:00
|
|
|
|
(defcustom org-agenda-skip-scheduled-if-deadline-is-shown nil
|
|
|
|
|
"Non-nil means skip scheduling line if same entry shows because of deadline.
|
2013-03-12 17:58:18 +00:00
|
|
|
|
|
|
|
|
|
In the agenda of today, an entry can show up multiple times
|
|
|
|
|
because it is both scheduled and has a nearby deadline, and maybe
|
|
|
|
|
a plain time stamp as well.
|
|
|
|
|
|
|
|
|
|
When this variable is nil, the entry will be shown several times.
|
|
|
|
|
|
|
|
|
|
When set to t, then only the deadline is shown and the fact that
|
|
|
|
|
the entry is scheduled today or was scheduled previously is not
|
|
|
|
|
shown.
|
|
|
|
|
|
|
|
|
|
When set to the symbol `not-today', skip scheduled previously,
|
|
|
|
|
but not scheduled today.
|
|
|
|
|
|
|
|
|
|
When set to the symbol `repeated-after-deadline', skip scheduled
|
|
|
|
|
items if they are repeated beyond the current dealine."
|
2009-08-07 21:59:07 +00:00
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "Always" t)
|
2013-03-12 17:58:18 +00:00
|
|
|
|
(const :tag "Not when scheduled today" not-today)
|
|
|
|
|
(const :tag "When repeated past deadline" repeated-after-deadline)))
|
2009-08-07 21:59:07 +00:00
|
|
|
|
|
2012-01-29 12:02:27 +00:00
|
|
|
|
(defcustom org-agenda-skip-timestamp-if-deadline-is-shown nil
|
|
|
|
|
"Non-nil means skip timestamp line if same entry shows because of deadline.
|
|
|
|
|
In the agenda of today, an entry can show up multiple times
|
|
|
|
|
because it has both a plain timestamp and has a nearby deadline.
|
|
|
|
|
When this variable is t, then only the deadline is shown and the
|
|
|
|
|
fact that the entry has a timestamp for or including today is not
|
|
|
|
|
shown. When this variable is nil, the entry will be shown
|
|
|
|
|
several times."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:version "24.1"
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "Always" t)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-skip-deadline-if-done nil
|
2008-12-16 14:25:23 +00:00
|
|
|
|
"Non-nil means don't show deadlines when the corresponding item is done.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When nil, the deadline is still shown and should give you a happy feeling.
|
|
|
|
|
This is relevant for the daily/weekly agenda. And it applied only to the
|
2008-12-16 14:25:23 +00:00
|
|
|
|
actually date of the deadline. Warnings about approaching and past-due
|
2008-03-22 15:52:18 +00:00
|
|
|
|
deadlines are always turned off when the item is DONE."
|
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2010-02-17 21:46:02 +00:00
|
|
|
|
(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil
|
|
|
|
|
"Non-nil means skip deadline prewarning when entry is also scheduled.
|
|
|
|
|
This will apply on all days where a prewarning for the deadline would
|
|
|
|
|
be shown, but not at the day when the entry is actually due. On that day,
|
|
|
|
|
the deadline will be shown anyway.
|
2012-10-26 10:47:47 +00:00
|
|
|
|
This variable may be set to nil, t, the symbol `pre-scheduled',
|
|
|
|
|
or a number which will then give the number of days before the actual
|
|
|
|
|
deadline when the prewarnings should resume. The symbol `pre-scheduled'
|
|
|
|
|
eliminates the deadline prewarning only prior to the scheduled date.
|
2010-02-17 21:46:02 +00:00
|
|
|
|
This can be used in a workflow where the first showing of the deadline will
|
|
|
|
|
trigger you to schedule it, and then you don't want to be reminded of it
|
|
|
|
|
because you will take care of it on the day when scheduled."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-02-17 21:46:02 +00:00
|
|
|
|
:type '(choice
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(const :tag "Always show prewarning" nil)
|
2012-10-26 10:47:47 +00:00
|
|
|
|
(const :tag "Remove prewarning prior to scheduled date" pre-scheduled)
|
2010-02-17 21:46:02 +00:00
|
|
|
|
(const :tag "Remove prewarning if entry is scheduled" t)
|
|
|
|
|
(integer :tag "Restart prewarning N days before deadline")))
|
|
|
|
|
|
2013-02-05 16:35:51 +00:00
|
|
|
|
(defcustom org-agenda-skip-scheduled-delay-if-deadline nil
|
|
|
|
|
"Non-nil means skip scheduled delay when entry also has a deadline.
|
|
|
|
|
This variable may be set to nil, t, the symbol `post-deadline',
|
|
|
|
|
or a number which will then give the number of days after the actual
|
|
|
|
|
scheduled date when the delay should expire. The symbol `post-deadline'
|
|
|
|
|
eliminates the schedule delay when the date is posterior to the deadline."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2013-02-05 16:35:51 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Always honor delay" nil)
|
|
|
|
|
(const :tag "Ignore delay if posterior to the deadline" post-deadline)
|
|
|
|
|
(const :tag "Ignore delay if entry has a deadline" t)
|
|
|
|
|
(integer :tag "Honor delay up until N days after the scheduled date")))
|
|
|
|
|
|
2011-10-04 12:30:32 +00:00
|
|
|
|
(defcustom org-agenda-skip-additional-timestamps-same-entry nil
|
2009-04-22 07:40:40 +00:00
|
|
|
|
"When nil, multiple same-day timestamps in entry make multiple agenda lines.
|
|
|
|
|
When non-nil, after the search for timestamps has matched once in an
|
|
|
|
|
entry, the rest of the entry will not be searched."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-skip-timestamp-if-done nil
|
|
|
|
|
"Non-nil means don't select item by timestamp or -range if it is DONE."
|
|
|
|
|
:group 'org-agenda-skip
|
2009-01-25 06:39:26 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-03-06 09:35:19 +00:00
|
|
|
|
(defcustom org-agenda-dim-blocked-tasks t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means dim blocked tasks in the agenda display.
|
2009-02-19 10:12:52 +00:00
|
|
|
|
This causes some overhead during agenda construction, but if you
|
|
|
|
|
have turned on `org-enforce-todo-dependencies',
|
|
|
|
|
`org-enforce-todo-checkbox-dependencies', or any other blocking
|
|
|
|
|
mechanism, this will create useful feedback in the agenda.
|
|
|
|
|
|
2009-11-12 12:39:29 +00:00
|
|
|
|
Instead of t, this variable can also have the value `invisible'.
|
2009-02-19 10:12:52 +00:00
|
|
|
|
Then blocked tasks will be invisible and only become visible when
|
|
|
|
|
they become unblocked. An exemption to this behavior is when a task is
|
|
|
|
|
blocked because of unchecked checkboxes below it. Since checkboxes do
|
|
|
|
|
not show up in the agenda views, making this task invisible you remove any
|
|
|
|
|
trace from agenda views that there is something to do. Therefore, a task
|
|
|
|
|
that is blocked because of checkboxes will never be made invisible, it
|
|
|
|
|
will only be dimmed."
|
2009-01-27 16:56:27 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:group 'org-agenda-todo-list
|
2013-01-06 11:31:20 +00:00
|
|
|
|
:version "24.3"
|
2009-01-27 16:56:27 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Do not dim" nil)
|
2011-11-28 14:23:27 +00:00
|
|
|
|
(const :tag "Dim to a gray face" t)
|
2009-11-12 12:39:29 +00:00
|
|
|
|
(const :tag "Make invisible" invisible)))
|
2009-01-27 16:56:27 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-timeline-show-empty-dates 3
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means `org-timeline' also shows dates without an entry.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When nil, only the days which actually have entries are shown.
|
|
|
|
|
When t, all days between the first and the last date are shown.
|
|
|
|
|
When an integer, show also empty dates, but if there is a gap of more than
|
|
|
|
|
N days, just insert a special line indicating the size of the gap."
|
|
|
|
|
:group 'org-agenda-skip
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "None" nil)
|
|
|
|
|
(const :tag "All" t)
|
2009-04-01 11:58:27 +00:00
|
|
|
|
(integer :tag "at most")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defgroup org-agenda-startup nil
|
|
|
|
|
"Options concerning initial settings in the Agenda in Org Mode."
|
|
|
|
|
:tag "Org Agenda Startup"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
2010-08-11 07:45:36 +00:00
|
|
|
|
(defcustom org-agenda-menu-show-matcher t
|
2011-02-01 12:05:13 +00:00
|
|
|
|
"Non-nil means show the match string in the agenda dispatcher menu.
|
2010-08-15 05:50:29 +00:00
|
|
|
|
When nil, the matcher string is not shown, but is put into the help-echo
|
2010-08-11 07:40:57 +00:00
|
|
|
|
property so than moving the mouse over the command shows it.
|
2010-08-15 05:50:29 +00:00
|
|
|
|
Setting it to nil is good if matcher strings are very long and/or if
|
2012-08-15 08:31:22 +00:00
|
|
|
|
you want to use two-columns display (see `org-agenda-menu-two-columns')."
|
2010-08-11 07:40:57 +00:00
|
|
|
|
:group 'org-agenda
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-08-11 07:40:57 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-13 08:19:24 +00:00
|
|
|
|
(define-obsolete-variable-alias 'org-agenda-menu-two-column 'org-agenda-menu-two-columns "24.3")
|
2012-08-15 08:31:22 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-menu-two-columns nil
|
2010-08-11 07:40:57 +00:00
|
|
|
|
"Non-nil means, use two columns to show custom commands in the dispatcher.
|
2010-08-11 07:45:36 +00:00
|
|
|
|
If you use this, you probably want to set `org-agenda-menu-show-matcher'
|
|
|
|
|
to nil."
|
2010-08-11 07:40:57 +00:00
|
|
|
|
:group 'org-agenda
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-08-11 07:40:57 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-13 08:19:24 +00:00
|
|
|
|
(define-obsolete-variable-alias 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3")
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(defcustom org-agenda-finalize-hook nil
|
2012-09-18 06:40:11 +00:00
|
|
|
|
"Hook run just before displaying an agenda buffer.
|
|
|
|
|
The buffer is still writable when the hook is called.
|
|
|
|
|
|
|
|
|
|
You can modify some of the buffer substrings but you should be
|
|
|
|
|
extra careful not to modify the text properties of the agenda
|
|
|
|
|
headlines as the agenda display heavily relies on them."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-mouse-1-follows-link nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means mouse-1 on a link will follow the link in the agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
A longer mouse click will still set point. Does not work on XEmacs.
|
|
|
|
|
Needs to be set before org.el is loaded."
|
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-start-with-follow-mode nil
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"The initial value of follow mode in a newly created agenda window."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2011-09-24 19:21:53 +00:00
|
|
|
|
(defcustom org-agenda-follow-indirect nil
|
|
|
|
|
"Non-nil means `org-agenda-follow-mode' displays only the
|
|
|
|
|
current item's tree, in an indirect buffer."
|
|
|
|
|
:group 'org-agenda
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2011-09-24 19:21:53 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2009-11-13 13:48:00 +00:00
|
|
|
|
(defcustom org-agenda-show-outline-path t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means show outline path in echo area after line motion."
|
2009-11-13 13:48:00 +00:00
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(defcustom org-agenda-start-with-entry-text-mode nil
|
|
|
|
|
"The initial value of entry-text-mode in a newly created agenda window."
|
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-entry-text-maxlines 5
|
2009-11-12 12:39:29 +00:00
|
|
|
|
"Number of text lines to be added when `E' is pressed in the agenda.
|
2009-08-27 07:56:46 +00:00
|
|
|
|
|
|
|
|
|
Note that this variable only used during agenda display. Add add entry text
|
|
|
|
|
when exporting the agenda, configure the variable
|
|
|
|
|
`org-agenda-add-entry-ext-maxlines'."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
2009-09-04 11:43:27 +00:00
|
|
|
|
(defcustom org-agenda-entry-text-exclude-regexps nil
|
|
|
|
|
"List of regular expressions to clean up entry text.
|
|
|
|
|
The complete matches of all regular expressions in this list will be
|
|
|
|
|
removed from entry text before it is shown in the agenda."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type '(repeat (regexp)))
|
|
|
|
|
|
2013-03-01 16:27:50 +00:00
|
|
|
|
(defcustom org-agenda-entry-text-leaders " > "
|
|
|
|
|
"Text prepended to the entry text in agenda buffers."
|
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2009-09-04 11:43:27 +00:00
|
|
|
|
(defvar org-agenda-entry-text-cleanup-hook nil
|
|
|
|
|
"Hook that is run after basic cleanup of entry text to be shown in agenda.
|
|
|
|
|
This cleanup is done in a temporary buffer, so the function may inspect and
|
|
|
|
|
change the entire buffer.
|
|
|
|
|
Some default stuff like drawers and scheduling/deadline dates will already
|
|
|
|
|
have been removed when this is called, as will any matches for regular
|
|
|
|
|
expressions listed in `org-agenda-entry-text-exclude-regexps'.")
|
|
|
|
|
|
2008-04-13 17:26:31 +00:00
|
|
|
|
(defvar org-agenda-include-inactive-timestamps nil
|
2012-03-09 13:36:03 +00:00
|
|
|
|
"Non-nil means include inactive time stamps in agenda and timeline.
|
|
|
|
|
Dynamically scoped.")
|
2008-04-10 12:48:59 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-windows nil
|
|
|
|
|
"Options concerning the windows used by the Agenda in Org Mode."
|
|
|
|
|
:tag "Org Agenda Windows"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-window-setup 'reorganize-frame
|
|
|
|
|
"How the agenda buffer should be displayed.
|
|
|
|
|
Possible values for this option are:
|
|
|
|
|
|
|
|
|
|
current-window Show agenda in the current window, keeping all other windows.
|
|
|
|
|
other-window Use `switch-to-buffer-other-window' to display agenda.
|
|
|
|
|
reorganize-frame Show only two windows on the current frame, the current
|
|
|
|
|
window and the agenda.
|
2009-09-22 11:11:29 +00:00
|
|
|
|
other-frame Use `switch-to-buffer-other-frame' to display agenda.
|
|
|
|
|
Also, when exiting the agenda, kill that frame.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
See also the variable `org-agenda-restore-windows-after-quit'."
|
|
|
|
|
:group 'org-agenda-windows
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const current-window)
|
|
|
|
|
(const other-frame)
|
|
|
|
|
(const other-window)
|
|
|
|
|
(const reorganize-frame)))
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-window-frame-fractions '(0.5 . 0.75)
|
|
|
|
|
"The min and max height of the agenda window as a fraction of frame height.
|
|
|
|
|
The value of the variable is a cons cell with two numbers between 0 and 1.
|
|
|
|
|
It only matters if `org-agenda-window-setup' is `reorganize-frame'."
|
|
|
|
|
:group 'org-agenda-windows
|
|
|
|
|
:type '(cons (number :tag "Minimum") (number :tag "Maximum")))
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-restore-windows-after-quit nil
|
2011-02-12 13:00:26 +00:00
|
|
|
|
"Non-nil means restore window configuration upon exiting agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
Before the window configuration is changed for displaying the agenda,
|
|
|
|
|
the current status is recorded. When the agenda is exited with
|
|
|
|
|
`q' or `x' and this option is set, the old state is restored. If
|
|
|
|
|
`org-agenda-window-setup' is `other-frame', the value of this
|
2009-09-29 03:08:15 +00:00
|
|
|
|
option will be ignored."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-windows
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(defcustom org-agenda-ndays nil
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Number of days to include in overview display.
|
2009-03-03 17:26:41 +00:00
|
|
|
|
Should be 1 or 7.
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
Obsolete, see `org-agenda-span'."
|
2012-08-11 17:10:44 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'integer)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
|
2012-09-24 15:59:23 +00:00
|
|
|
|
(make-obsolete-variable 'org-agenda-ndays 'org-agenda-span "24.1")
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-span 'week
|
|
|
|
|
"Number of days to include in overview display.
|
|
|
|
|
Can be day, week, month, year, or any number of days.
|
2009-03-03 17:26:41 +00:00
|
|
|
|
Custom commands can set this variable in the options section."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
:type '(choice (const :tag "Day" day)
|
|
|
|
|
(const :tag "Week" week)
|
|
|
|
|
(const :tag "Month" month)
|
|
|
|
|
(const :tag "Year" year)
|
|
|
|
|
(integer :tag "Custom")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-start-on-weekday 1
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means start the overview always on the specified weekday.
|
2013-04-03 16:05:19 +00:00
|
|
|
|
0 denotes Sunday, 1 denotes Monday, etc.
|
2009-03-03 17:26:41 +00:00
|
|
|
|
When nil, always start on the current day.
|
|
|
|
|
Custom commands can set this variable in the options section."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type '(choice (const :tag "Today" nil)
|
2009-04-01 11:58:27 +00:00
|
|
|
|
(integer :tag "Weekday No.")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-show-all-dates t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means `org-agenda' shows every day in the selected range.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When nil, only the days which actually have entries are shown."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-format-date 'org-agenda-format-date-aligned
|
|
|
|
|
"Format string for displaying dates in the agenda.
|
|
|
|
|
Used by the daily/weekly agenda and by the timeline. This should be
|
|
|
|
|
a format string understood by `format-time-string', or a function returning
|
|
|
|
|
the formatted date as a string. The function must take a single argument,
|
|
|
|
|
a calendar-style date list like (month day year)."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type '(choice
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(function :tag "Function")))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-format-date-aligned (date)
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Format a DATE string for display in the daily/weekly agenda, or timeline.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
This function makes sure that dates are aligned for easy reading."
|
|
|
|
|
(require 'cal-iso)
|
|
|
|
|
(let* ((dayname (calendar-day-name date))
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(day (cadr date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(day-of-week (calendar-day-of-week date))
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(month (car date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(monthname (calendar-month-name month))
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(year (nth 2 date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(iso-week (org-days-to-iso-week
|
|
|
|
|
(calendar-absolute-from-gregorian date)))
|
|
|
|
|
(weekyear (cond ((and (= month 1) (>= iso-week 52))
|
|
|
|
|
(1- year))
|
|
|
|
|
((and (= month 12) (<= iso-week 1))
|
|
|
|
|
(1+ year))
|
|
|
|
|
(t year)))
|
|
|
|
|
(weekstring (if (= day-of-week 1)
|
|
|
|
|
(format " W%02d" iso-week)
|
|
|
|
|
"")))
|
|
|
|
|
(format "%-10s %2d %s %4d%s"
|
|
|
|
|
dayname day monthname year weekstring)))
|
|
|
|
|
|
2010-11-19 19:14:37 +00:00
|
|
|
|
(defcustom org-agenda-time-leading-zero nil
|
|
|
|
|
"Non-nil means use leading zero for military times in agenda.
|
|
|
|
|
For example, 9:30am would become 09:30 rather than 9:30."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-11-19 19:14:37 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2010-11-05 17:37:33 +00:00
|
|
|
|
(defcustom org-agenda-timegrid-use-ampm nil
|
|
|
|
|
"When set, show AM/PM style timestamps on the timegrid."
|
|
|
|
|
:group 'org-agenda
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-11-05 17:37:33 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-time-of-day-to-ampm (time)
|
|
|
|
|
"Convert TIME of a string like '13:45' to an AM/PM style time string."
|
|
|
|
|
(let* ((hour-number (string-to-number (substring time 0 -3)))
|
|
|
|
|
(minute (substring time -2))
|
2010-11-12 22:59:39 +00:00
|
|
|
|
(ampm "am"))
|
2010-11-05 17:37:33 +00:00
|
|
|
|
(cond
|
|
|
|
|
((equal hour-number 12)
|
2010-11-12 22:59:39 +00:00
|
|
|
|
(setq ampm "pm"))
|
2010-11-05 17:37:33 +00:00
|
|
|
|
((> hour-number 12)
|
2010-11-12 22:59:39 +00:00
|
|
|
|
(setq ampm "pm")
|
2010-11-05 17:37:33 +00:00
|
|
|
|
(setq hour-number (- hour-number 12))))
|
|
|
|
|
(concat
|
|
|
|
|
(if org-agenda-time-leading-zero
|
|
|
|
|
(format "%02d" hour-number)
|
|
|
|
|
(format "%02s" (number-to-string hour-number)))
|
|
|
|
|
":" minute ampm)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-time-of-day-to-ampm-maybe (time)
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Conditionally convert TIME to AM/PM format based on `org-agenda-timegrid-use-ampm'."
|
2010-11-05 17:37:33 +00:00
|
|
|
|
(if org-agenda-timegrid-use-ampm
|
|
|
|
|
(org-agenda-time-of-day-to-ampm time)
|
|
|
|
|
time))
|
|
|
|
|
|
2008-04-08 14:14:14 +00:00
|
|
|
|
(defcustom org-agenda-weekend-days '(6 0)
|
|
|
|
|
"Which days are weekend?
|
|
|
|
|
These days get the special face `org-agenda-date-weekend' in the agenda
|
|
|
|
|
and timeline buffers."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type '(set :greedy t
|
|
|
|
|
(const :tag "Monday" 1)
|
|
|
|
|
(const :tag "Tuesday" 2)
|
|
|
|
|
(const :tag "Wednesday" 3)
|
|
|
|
|
(const :tag "Thursday" 4)
|
|
|
|
|
(const :tag "Friday" 5)
|
|
|
|
|
(const :tag "Saturday" 6)
|
|
|
|
|
(const :tag "Sunday" 0)))
|
|
|
|
|
|
2011-10-22 06:31:18 +00:00
|
|
|
|
(defcustom org-agenda-move-date-from-past-immediately-to-today t
|
2012-01-10 10:56:15 +00:00
|
|
|
|
"Non-nil means jump to today when moving a past date forward in time.
|
2011-10-22 06:31:18 +00:00
|
|
|
|
When using S-right in the agenda to move a a date forward, and the date
|
|
|
|
|
stamp currently points to the past, the first key press will move it
|
|
|
|
|
to today. WHen nil, just move one day forward even if the date stays
|
|
|
|
|
in the past."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2011-10-22 06:31:18 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-include-diary nil
|
2009-03-03 17:26:41 +00:00
|
|
|
|
"If non-nil, include in the agenda entries from the Emacs Calendar's diary.
|
|
|
|
|
Custom commands can set this variable in the options section."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2010-03-15 01:00:59 +00:00
|
|
|
|
(defcustom org-agenda-include-deadlines t
|
|
|
|
|
"If non-nil, include entries within their deadline warning period.
|
|
|
|
|
Custom commands can set this variable in the options section."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-03-15 01:00:59 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-repeating-timestamp-show-all t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means show all occurrences of a repeating stamp in the agenda.
|
2011-02-02 09:35:56 +00:00
|
|
|
|
When set to a list of strings, only show occurrences of repeating
|
|
|
|
|
stamps for these TODO keywords. When nil, only one occurrence is
|
|
|
|
|
shown, either today or the nearest into the future."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
2011-02-02 09:35:56 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Show repeating stamps" t)
|
|
|
|
|
(repeat :tag "Show repeating stamps for these TODO keywords"
|
|
|
|
|
(string :tag "TODO Keyword"))
|
|
|
|
|
(const :tag "Don't show repeating stamps" nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-scheduled-past-days 10000
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Number of days to continue listing scheduled items not marked DONE.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When an item is scheduled on a date, it shows up in the agenda on this
|
|
|
|
|
day and will be listed until it is marked done for the number of days
|
|
|
|
|
given here."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2009-04-01 11:58:27 +00:00
|
|
|
|
:type 'integer)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(defcustom org-agenda-log-mode-items '(closed clock)
|
|
|
|
|
"List of items that should be shown in agenda log mode.
|
|
|
|
|
This list may contain the following symbols:
|
|
|
|
|
|
|
|
|
|
closed Show entries that have been closed on that day.
|
|
|
|
|
clock Show entries that have received clocked time on that day.
|
2009-03-09 07:44:36 +00:00
|
|
|
|
state Show all logged state changes.
|
|
|
|
|
Note that instead of changing this variable, you can also press `C-u l' in
|
|
|
|
|
the agenda to display all available LOG items temporarily."
|
2008-11-05 16:26:52 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type '(set :greedy t (const closed) (const clock) (const state)))
|
|
|
|
|
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(defcustom org-agenda-clock-consistency-checks
|
2011-04-24 15:21:47 +00:00
|
|
|
|
'(:max-duration "10:00" :min-duration 0 :max-gap "0:05"
|
2011-04-26 15:22:50 +00:00
|
|
|
|
:gap-ok-around ("4:00")
|
|
|
|
|
:default-face ((:background "DarkRed") (:foreground "white"))
|
|
|
|
|
:overlap-face nil :gap-face nil :no-end-time-face nil
|
|
|
|
|
:long-face nil :short-face nil)
|
|
|
|
|
"This is a property list, with the following keys:
|
2011-04-19 22:13:31 +00:00
|
|
|
|
|
|
|
|
|
:max-duration Mark clocking chunks that are longer than this time.
|
|
|
|
|
This is a time string like \"HH:MM\", or the number
|
|
|
|
|
of minutes as an integer.
|
|
|
|
|
|
|
|
|
|
:min-duration Mark clocking chunks that are shorter that this.
|
|
|
|
|
This is a time string like \"HH:MM\", or the number
|
|
|
|
|
of minutes as an integer.
|
|
|
|
|
|
|
|
|
|
:max-gap Mark gaps between clocking chunks that are longer than
|
|
|
|
|
this duration. A number of minutes, or a string
|
|
|
|
|
like \"HH:MM\".
|
|
|
|
|
|
|
|
|
|
:gap-ok-around List of times during the day which are usually not working
|
|
|
|
|
times. When a gap is detected, but the gap contains any
|
|
|
|
|
of these times, the gap is *not* reported. For example,
|
|
|
|
|
if this is (\"4:00\" \"13:00\") then gaps that contain
|
|
|
|
|
4:00 in the morning (i.e. the night) and 13:00
|
|
|
|
|
(i.e. a typical lunch time) do not cause a warning.
|
|
|
|
|
You should have at least one time during the night in this
|
|
|
|
|
list, or otherwise the first task each morning will trigger
|
2011-04-26 15:22:50 +00:00
|
|
|
|
a warning because it follows a long gap.
|
|
|
|
|
|
|
|
|
|
Furthermore, the following properties can be used to define faces for
|
|
|
|
|
issue display.
|
|
|
|
|
|
|
|
|
|
:default-face the default face, if the specific face is undefined
|
|
|
|
|
:overlap-face face for overlapping clocks
|
|
|
|
|
:gap-face face for gaps between clocks
|
|
|
|
|
:no-end-time-face face for incomplete clocks
|
|
|
|
|
:long-face face for clock intervals that are too long
|
|
|
|
|
:short-face face for clock intervals that are too short"
|
2011-04-19 22:13:31 +00:00
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:group 'org-clock
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2011-04-19 22:13:31 +00:00
|
|
|
|
:type 'plist)
|
|
|
|
|
|
2009-04-03 08:24:44 +00:00
|
|
|
|
(defcustom org-agenda-log-mode-add-notes t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means add first line of notes to log entries in agenda views.
|
2009-04-03 08:24:44 +00:00
|
|
|
|
If a log item like a state change or a clock entry is associated with
|
|
|
|
|
notes, the first line of these notes will be added to the entry in the
|
|
|
|
|
agenda display."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2009-05-14 07:40:53 +00:00
|
|
|
|
(defcustom org-agenda-start-with-log-mode nil
|
2012-07-28 16:53:11 +00:00
|
|
|
|
"The initial value of log-mode in a newly created agenda window.
|
|
|
|
|
See `org-agenda-log-mode' and `org-agenda-log-mode-items' for further
|
|
|
|
|
explanations on the possible values."
|
2009-05-14 07:40:53 +00:00
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
2012-07-28 16:53:11 +00:00
|
|
|
|
:type '(choice (const :tag "Don't show log items" nil)
|
|
|
|
|
(const :tag "Show only log items" 'only)
|
|
|
|
|
(const :tag "Show all possible log items" 'clockcheck)
|
|
|
|
|
(repeat :tag "Choose among possible values for `org-agenda-log-mode-items'"
|
|
|
|
|
(choice (const :tag "Show closed log items" 'closed)
|
|
|
|
|
(const :tag "Show clocked log items" 'clock)
|
|
|
|
|
(const :tag "Show all logged state changes" 'state)))))
|
2009-05-14 07:40:53 +00:00
|
|
|
|
|
2008-04-06 15:53:34 +00:00
|
|
|
|
(defcustom org-agenda-start-with-clockreport-mode nil
|
|
|
|
|
"The initial value of clockreport-mode in a newly created agenda window."
|
|
|
|
|
:group 'org-agenda-startup
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-clockreport-parameter-plist '(:link t :maxlevel 2)
|
|
|
|
|
"Property list with parameters for the clocktable in clockreport mode.
|
|
|
|
|
This is the display mode that shows a clock table in the daily/weekly
|
|
|
|
|
agenda, the properties for this dynamic block can be set here.
|
|
|
|
|
The usual clocktable parameters are allowed here, but you cannot set
|
|
|
|
|
the properties :name, :tstart, :tend, :block, and :scope - these will
|
|
|
|
|
be overwritten to make sure the content accurately reflects the
|
|
|
|
|
current display in the agenda."
|
|
|
|
|
:group 'org-agenda-daily/weekly
|
|
|
|
|
:type 'plist)
|
|
|
|
|
|
2010-01-04 22:28:23 +00:00
|
|
|
|
(defcustom org-agenda-search-view-always-boolean nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means the search string is interpreted as individual parts.
|
2010-01-04 22:28:23 +00:00
|
|
|
|
|
|
|
|
|
The search string for search view can either be interpreted as a phrase,
|
|
|
|
|
or as a list of snippets that define a boolean search for a number of
|
|
|
|
|
strings.
|
|
|
|
|
|
|
|
|
|
When this is non-nil, the string will be split on whitespace, and each
|
|
|
|
|
snippet will be searched individually, and all must match in order to
|
2010-01-12 07:28:44 +00:00
|
|
|
|
select an entry. A snippet is then a single string of non-white
|
|
|
|
|
characters, or a string in double quotes, or a regexp in {} braces.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
If a snippet is preceded by \"-\", the snippet must *not* match.
|
2010-01-12 07:28:44 +00:00
|
|
|
|
\"+\" is syntactic sugar for positive selection. Each snippet may
|
|
|
|
|
be found as a full word or a partial word, but see the variable
|
|
|
|
|
`org-agenda-search-view-force-full-words'.
|
2010-01-04 22:28:23 +00:00
|
|
|
|
|
|
|
|
|
When this is nil, search will look for the entire search phrase as one,
|
|
|
|
|
with each space character matching any amount of whitespace, including
|
|
|
|
|
line breaks.
|
|
|
|
|
|
|
|
|
|
Even when this is nil, you can still switch to Boolean search dynamically
|
2010-07-15 20:26:51 +00:00
|
|
|
|
by preceding the first snippet with \"+\" or \"-\". If the first snippet
|
2010-01-04 22:28:23 +00:00
|
|
|
|
is a regexp marked with braces like \"{abc}\", this will also switch to
|
|
|
|
|
boolean search."
|
|
|
|
|
:group 'org-agenda-search-view
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-01-04 22:28:23 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-03-14 12:53:52 +00:00
|
|
|
|
(org-defvaralias 'org-agenda-search-view-search-words-only
|
|
|
|
|
'org-agenda-search-view-always-boolean)
|
2010-01-04 22:28:23 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-search-view-force-full-words nil
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Non-nil means, search words must be matches as complete words.
|
2010-01-04 22:28:23 +00:00
|
|
|
|
When nil, they may also match part of a word."
|
2009-10-14 11:36:36 +00:00
|
|
|
|
:group 'org-agenda-search-view
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2009-10-14 11:36:36 +00:00
|
|
|
|
:type 'boolean)
|
2008-04-06 15:53:34 +00:00
|
|
|
|
|
2012-12-24 13:49:04 +00:00
|
|
|
|
(defcustom org-agenda-search-view-max-outline-level nil
|
|
|
|
|
"Maximum outline level to display in search view.
|
|
|
|
|
E.g. when this is set to 1, the search view will only
|
|
|
|
|
show headlines of level 1."
|
|
|
|
|
:group 'org-agenda-search-view
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-12-24 13:49:04 +00:00
|
|
|
|
:type 'integer)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-time-grid nil
|
|
|
|
|
"Options concerning the time grid in the Org-mode Agenda."
|
|
|
|
|
:tag "Org Agenda Time Grid"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
2009-02-25 12:01:28 +00:00
|
|
|
|
(defcustom org-agenda-search-headline-for-time t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means search headline for a time-of-day.
|
2009-02-25 12:01:28 +00:00
|
|
|
|
If the headline contains a time-of-day in one format or another, it will
|
|
|
|
|
be used to sort the entry into the time sequence of items for a day.
|
|
|
|
|
Some people have time stamps in the headline that refer to the creation
|
|
|
|
|
time or so, and then this produces an unwanted side effect. If this is
|
|
|
|
|
the case for your, use this variable to turn off searching the headline
|
|
|
|
|
for a time."
|
|
|
|
|
:group 'org-agenda-time-grid
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-use-time-grid t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means show a time grid in the agenda schedule.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
A time grid is a set of lines for specific times (like every two hours between
|
|
|
|
|
8:00 and 20:00). The items scheduled for a day at specific times are
|
|
|
|
|
sorted in between these lines.
|
|
|
|
|
For details about when the grid will be shown, and what it will look like, see
|
|
|
|
|
the variable `org-agenda-time-grid'."
|
|
|
|
|
:group 'org-agenda-time-grid
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-time-grid
|
|
|
|
|
'((daily today require-timed)
|
|
|
|
|
"----------------"
|
|
|
|
|
(800 1000 1200 1400 1600 1800 2000))
|
|
|
|
|
|
|
|
|
|
"The settings for time grid for agenda display.
|
|
|
|
|
This is a list of three items. The first item is again a list. It contains
|
|
|
|
|
symbols specifying conditions when the grid should be displayed:
|
|
|
|
|
|
|
|
|
|
daily if the agenda shows a single day
|
|
|
|
|
weekly if the agenda shows an entire week
|
|
|
|
|
today show grid on current date, independent of daily/weekly display
|
|
|
|
|
require-timed show grid only if at least one item has a time specification
|
|
|
|
|
|
2008-04-28 20:47:04 +00:00
|
|
|
|
The second item is a string which will be placed behind the grid time.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
The third item is a list of integers, indicating the times that should have
|
|
|
|
|
a grid line."
|
|
|
|
|
:group 'org-agenda-time-grid
|
|
|
|
|
:type
|
|
|
|
|
'(list
|
|
|
|
|
(set :greedy t :tag "Grid Display Options"
|
|
|
|
|
(const :tag "Show grid in single day agenda display" daily)
|
|
|
|
|
(const :tag "Show grid in weekly agenda display" weekly)
|
|
|
|
|
(const :tag "Always show grid for today" today)
|
|
|
|
|
(const :tag "Show grid only if any timed entries are present"
|
|
|
|
|
require-timed)
|
|
|
|
|
(const :tag "Skip grid times already present in an entry"
|
|
|
|
|
remove-match))
|
|
|
|
|
(string :tag "Grid String")
|
|
|
|
|
(repeat :tag "Grid Times" (integer :tag "Time"))))
|
|
|
|
|
|
2010-12-12 08:25:03 +00:00
|
|
|
|
(defcustom org-agenda-show-current-time-in-grid t
|
|
|
|
|
"Non-nil means show the current time in the time grid."
|
|
|
|
|
:group 'org-agenda-time-grid
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-12-12 08:25:03 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-current-time-string
|
|
|
|
|
"now - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
|
|
|
"The string for the current time marker in the agenda."
|
|
|
|
|
:group 'org-agenda-time-grid
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-12-12 08:25:03 +00:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-sorting nil
|
|
|
|
|
"Options concerning sorting in the Org-mode Agenda."
|
|
|
|
|
:tag "Org Agenda Sorting"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-sorting-strategy
|
2009-10-19 08:17:49 +00:00
|
|
|
|
'((agenda habit-down time-up priority-down category-keep)
|
|
|
|
|
(todo priority-down category-keep)
|
|
|
|
|
(tags priority-down category-keep)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(search category-keep))
|
|
|
|
|
"Sorting structure for the agenda items of a single day.
|
|
|
|
|
This is a list of symbols which will be used in sequence to determine
|
|
|
|
|
if an entry should be listed before another entry. The following
|
|
|
|
|
symbols are recognized:
|
|
|
|
|
|
2009-03-27 16:50:21 +00:00
|
|
|
|
time-up Put entries with time-of-day indications first, early first
|
|
|
|
|
time-down Put entries with time-of-day indications first, late first
|
2013-02-05 14:03:29 +00:00
|
|
|
|
timestamp-up Sort by any timestamp, early first
|
|
|
|
|
timestamp-down Sort by any timestamp, late first
|
|
|
|
|
scheduled-up Sort by scheduled timestamp, early first
|
|
|
|
|
scheduled-down Sort by scheduled timestamp, late first
|
|
|
|
|
deadline-up Sort by deadline timestamp, early first
|
|
|
|
|
deadline-down Sort by deadline timestamp, late first
|
|
|
|
|
ts-up Sort by active timestamp, early first
|
|
|
|
|
ts-down Sort by active timestamp, late first
|
|
|
|
|
tsia-up Sort by inactive timestamp, early first
|
|
|
|
|
tsia-down Sort by inactive timestamp, late first
|
2009-03-27 16:50:21 +00:00
|
|
|
|
category-keep Keep the default order of categories, corresponding to the
|
|
|
|
|
sequence in `org-agenda-files'.
|
|
|
|
|
category-up Sort alphabetically by category, A-Z.
|
|
|
|
|
category-down Sort alphabetically by category, Z-A.
|
|
|
|
|
tag-up Sort alphabetically by last tag, A-Z.
|
|
|
|
|
tag-down Sort alphabetically by last tag, Z-A.
|
|
|
|
|
priority-up Sort numerically by priority, high priority last.
|
|
|
|
|
priority-down Sort numerically by priority, high priority first.
|
|
|
|
|
todo-state-up Sort by todo state, tasks that are done last.
|
|
|
|
|
todo-state-down Sort by todo state, tasks that are done first.
|
|
|
|
|
effort-up Sort numerically by estimated effort, high effort last.
|
|
|
|
|
effort-down Sort numerically by estimated effort, high effort first.
|
|
|
|
|
user-defined-up Sort according to `org-agenda-cmp-user-defined', high last.
|
|
|
|
|
user-defined-down Sort according to `org-agenda-cmp-user-defined', high first.
|
2009-10-19 08:17:49 +00:00
|
|
|
|
habit-up Put entries that are habits first
|
|
|
|
|
habit-down Put entries that are habits last
|
2010-04-30 05:31:43 +00:00
|
|
|
|
alpha-up Sort headlines alphabetically
|
|
|
|
|
alpha-down Sort headlines alphabetically, reversed
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
The different possibilities will be tried in sequence, and testing stops
|
|
|
|
|
if one comparison returns a \"not-equal\". For example, the default
|
|
|
|
|
'(time-up category-keep priority-down)
|
|
|
|
|
means: Pull out all entries having a specified time of day and sort them,
|
|
|
|
|
in order to make a time schedule for the current day the first thing in the
|
|
|
|
|
agenda listing for the day. Of the entries without a time indication, keep
|
|
|
|
|
the grouped in categories, don't sort the categories, but keep them in
|
|
|
|
|
the sequence given in `org-agenda-files'. Within each category sort by
|
|
|
|
|
priority.
|
|
|
|
|
|
|
|
|
|
Leaving out `category-keep' would mean that items will be sorted across
|
|
|
|
|
categories by priority.
|
|
|
|
|
|
|
|
|
|
Instead of a single list, this can also be a set of list for specific
|
|
|
|
|
contents, with a context symbol in the car of the list, any of
|
2009-10-17 15:43:48 +00:00
|
|
|
|
`agenda', `todo', `tags', `search' for the corresponding agenda views.
|
2009-03-03 17:26:41 +00:00
|
|
|
|
|
|
|
|
|
Custom commands can bind this variable in the options section."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-sorting
|
|
|
|
|
:type `(choice
|
|
|
|
|
(repeat :tag "General" ,org-sorting-choice)
|
|
|
|
|
(list :tag "Individually"
|
|
|
|
|
(cons (const :tag "Strategy for Weekly/Daily agenda" agenda)
|
|
|
|
|
(repeat ,org-sorting-choice))
|
|
|
|
|
(cons (const :tag "Strategy for TODO lists" todo)
|
|
|
|
|
(repeat ,org-sorting-choice))
|
|
|
|
|
(cons (const :tag "Strategy for Tags matches" tags)
|
2009-10-17 15:43:48 +00:00
|
|
|
|
(repeat ,org-sorting-choice))
|
|
|
|
|
(cons (const :tag "Strategy for search matches" search)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(repeat ,org-sorting-choice)))))
|
|
|
|
|
|
2009-03-27 16:50:21 +00:00
|
|
|
|
(defcustom org-agenda-cmp-user-defined nil
|
|
|
|
|
"A function to define the comparison `user-defined'.
|
|
|
|
|
This function must receive two arguments, agenda entry a and b.
|
|
|
|
|
If a>b, return +1. If a<b, return -1. If they are equal as seen by
|
|
|
|
|
the user comparison, return nil.
|
|
|
|
|
When this is defined, you can make `user-defined-up' and `user-defined-down'
|
|
|
|
|
part of an agenda sorting strategy."
|
|
|
|
|
:group 'org-agenda-sorting
|
|
|
|
|
:type 'symbol)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-sort-agenda-notime-is-late t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means items without time are considered late.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
This is only relevant for sorting. When t, items which have no explicit
|
|
|
|
|
time like 15:30 will be considered as 99:01, i.e. later than any items which
|
|
|
|
|
do have a time. When nil, the default time is before 0:00. You can use this
|
|
|
|
|
option to decide if the schedule for today should come before or after timeless
|
|
|
|
|
agenda entries."
|
|
|
|
|
:group 'org-agenda-sorting
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(defcustom org-sort-agenda-noeffort-is-high t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means items without effort estimate are sorted as high effort.
|
2009-03-31 16:22:31 +00:00
|
|
|
|
This also applies when filtering an agenda view with respect to the
|
|
|
|
|
< or > effort operator. Then, tasks with no effort defined will be treated
|
|
|
|
|
as tasks with high effort.
|
2008-04-17 16:26:27 +00:00
|
|
|
|
When nil, such items are sorted as 0 minutes effort."
|
|
|
|
|
:group 'org-agenda-sorting
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defgroup org-agenda-line-format nil
|
|
|
|
|
"Options concerning the entry prefix in the Org-mode agenda display."
|
|
|
|
|
:tag "Org Agenda Line Format"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-prefix-format
|
2012-09-12 16:20:20 +00:00
|
|
|
|
'((agenda . " %i %-12:c%?-12t% s")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(timeline . " % s")
|
2010-10-29 13:49:32 +00:00
|
|
|
|
(todo . " %i %-12:c")
|
|
|
|
|
(tags . " %i %-12:c")
|
|
|
|
|
(search . " %i %-12:c"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Format specifications for the prefix of items in the agenda views.
|
2011-08-25 13:20:10 +00:00
|
|
|
|
An alist with five entries, each for the different agenda types. The
|
|
|
|
|
keys of the sublists are `agenda', `timeline', `todo', `search' and `tags'.
|
2011-07-21 10:16:36 +00:00
|
|
|
|
The values are format strings.
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
This format works similar to a printf format, with the following meaning:
|
|
|
|
|
|
2011-08-25 13:20:10 +00:00
|
|
|
|
%c the category of the item, \"Diary\" for entries from the diary,
|
2011-07-21 10:16:36 +00:00
|
|
|
|
or as given by the CATEGORY keyword or derived from the file name
|
2011-08-19 13:16:38 +00:00
|
|
|
|
%e the effort required by the item
|
2012-09-12 09:41:50 +00:00
|
|
|
|
%l the level of the item (insert X space(s) if item is of level X)
|
2011-07-21 10:16:36 +00:00
|
|
|
|
%i the icon category of the item, see `org-agenda-category-icon-alist'
|
|
|
|
|
%T the last tag of the item (ignore inherited tags, which come first)
|
|
|
|
|
%t the HH:MM time-of-day specification if one applies to the entry
|
2008-03-22 15:52:18 +00:00
|
|
|
|
%s Scheduling/Deadline information, a short string
|
2013-01-23 23:21:31 +00:00
|
|
|
|
%b show breadcrumbs, i.e., the names of the higher levels
|
2010-12-21 07:26:34 +00:00
|
|
|
|
%(expression) Eval EXPRESSION and replace the control string
|
2010-12-17 22:18:15 +00:00
|
|
|
|
by the result
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
All specifiers work basically like the standard `%s' of printf, but may
|
2012-09-12 09:41:50 +00:00
|
|
|
|
contain two additional characters: a question mark just after the `%'
|
2011-07-21 10:16:36 +00:00
|
|
|
|
and a whitespace/punctuation character just before the final letter.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
If the first character after `%' is a question mark, the entire field
|
2011-08-25 13:20:10 +00:00
|
|
|
|
will only be included if the corresponding value applies to the current
|
|
|
|
|
entry. This is useful for fields which should have fixed width when
|
|
|
|
|
present, but zero width when absent. For example, \"%?-12t\" will
|
|
|
|
|
result in a 12 character time field if a time of the day is specified,
|
2011-07-21 10:16:36 +00:00
|
|
|
|
but will completely disappear in entries which do not contain a time.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2013-02-20 15:38:34 +00:00
|
|
|
|
If there is punctuation or whitespace character just before the
|
|
|
|
|
final format letter, this character will be appended to the field
|
|
|
|
|
value if the value is not empty. For example, the format
|
|
|
|
|
\"%-12:c\" leads to \"Diary: \" if the category is \"Diary\". If
|
|
|
|
|
the category is empty, no additional colon is inserted.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2011-08-25 13:20:10 +00:00
|
|
|
|
The default value for the agenda sublist is \" %-12:c%?-12t% s\",
|
2011-07-21 10:16:36 +00:00
|
|
|
|
which means:
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
- Indent the line with two space characters
|
2011-07-21 10:16:36 +00:00
|
|
|
|
- Give the category a 12 chars wide field, padded with whitespace on
|
2008-03-22 15:52:18 +00:00
|
|
|
|
the right (because of `-'). Append a colon if there is a category
|
|
|
|
|
(because of `:').
|
|
|
|
|
- If there is a time-of-day, put it into a 12 chars wide field. If no
|
|
|
|
|
time, don't put in an empty field, just skip it (because of '?').
|
2011-07-21 10:16:36 +00:00
|
|
|
|
- Finally, put the scheduling information.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
See also the variables `org-agenda-remove-times-when-in-prefix' and
|
2009-03-03 17:26:41 +00:00
|
|
|
|
`org-agenda-remove-tags'.
|
|
|
|
|
|
|
|
|
|
Custom commands can set this variable in the options section."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(string :tag "General format")
|
|
|
|
|
(list :greedy t :tag "View dependent"
|
|
|
|
|
(cons (const agenda) (string :tag "Format"))
|
|
|
|
|
(cons (const timeline) (string :tag "Format"))
|
|
|
|
|
(cons (const todo) (string :tag "Format"))
|
|
|
|
|
(cons (const tags) (string :tag "Format"))
|
|
|
|
|
(cons (const search) (string :tag "Format"))))
|
|
|
|
|
:group 'org-agenda-line-format)
|
|
|
|
|
|
|
|
|
|
(defvar org-prefix-format-compiled nil
|
2012-03-02 16:40:54 +00:00
|
|
|
|
"The compiled prefix format and associated variables.
|
|
|
|
|
This is a list where first element is a list of variable bindings, and second
|
2012-03-01 15:49:23 +00:00
|
|
|
|
element is the compiled format expression. See the variable
|
|
|
|
|
`org-agenda-prefix-format'.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-todo-keyword-format "%-1s"
|
|
|
|
|
"Format for the TODO keyword in agenda lines.
|
|
|
|
|
Set this to something like \"%-12s\" if you want all TODO keywords
|
|
|
|
|
to occupy a fixed space in the agenda display."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2012-01-29 09:51:46 +00:00
|
|
|
|
(defcustom org-agenda-diary-sexp-prefix nil
|
|
|
|
|
"A regexp that matches part of a diary sexp entry
|
|
|
|
|
which should be treated as scheduling/deadline information in
|
|
|
|
|
`org-agenda'.
|
|
|
|
|
|
|
|
|
|
For example, you can use this to extract the `diary-remind-message' from
|
|
|
|
|
`diary-remind' entries."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice (const :tag "None" nil) (regexp :tag "Regexp")))
|
|
|
|
|
|
2008-11-12 11:51:17 +00:00
|
|
|
|
(defcustom org-agenda-timerange-leaders '("" "(%d/%d): ")
|
|
|
|
|
"Text preceding timerange entries in the agenda view.
|
|
|
|
|
This is a list with two strings. The first applies when the range
|
|
|
|
|
is entirely on one day. The second applies if the range spans several days.
|
|
|
|
|
The strings may have two \"%d\" format specifiers which will be filled
|
|
|
|
|
with the sequence number of the days, and the total number of days in the
|
|
|
|
|
range, respectively."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(list
|
|
|
|
|
(string :tag "Deadline today ")
|
|
|
|
|
(choice :tag "Deadline relative"
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(function))))
|
|
|
|
|
|
2013-03-25 14:54:36 +00:00
|
|
|
|
(defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Text preceding scheduled items in the agenda view.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
This is a list with two strings. The first applies when the item is
|
|
|
|
|
scheduled on the current day. The second applies when it has been scheduled
|
2008-06-09 07:09:26 +00:00
|
|
|
|
previously, it may contain a %d indicating that this is the nth time that
|
|
|
|
|
this item is scheduled, due to automatic rescheduling of unfinished items
|
|
|
|
|
for the following day. So this number is one larger than the number of days
|
|
|
|
|
that passed since this item was scheduled first."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-line-format
|
2013-02-27 13:29:46 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type '(list
|
|
|
|
|
(string :tag "Scheduled today ")
|
|
|
|
|
(string :tag "Scheduled previously")))
|
|
|
|
|
|
2009-12-16 07:53:18 +00:00
|
|
|
|
(defcustom org-agenda-inactive-leader "["
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Text preceding item pulled into the agenda by inactive time stamps.
|
2009-12-16 07:53:18 +00:00
|
|
|
|
These entries are added to the agenda when pressing \"[\"."
|
|
|
|
|
:group 'org-agenda-line-format
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2009-12-16 07:53:18 +00:00
|
|
|
|
:type '(list
|
|
|
|
|
(string :tag "Scheduled today ")
|
|
|
|
|
(string :tag "Scheduled previously")))
|
|
|
|
|
|
2013-03-25 14:54:36 +00:00
|
|
|
|
(defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: " "%2d d. ago: ")
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Text preceding deadline items in the agenda view.
|
2013-02-27 13:29:46 +00:00
|
|
|
|
This is a list with three strings. The first applies when the item has its
|
|
|
|
|
deadline on the current day. The second applies when the deadline is in the
|
|
|
|
|
future, the third one when it is in the past. The strings may contain %d
|
|
|
|
|
to capture the number of days."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-line-format
|
2013-02-27 13:29:46 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:type '(list
|
|
|
|
|
(string :tag "Deadline today ")
|
2008-03-28 14:42:31 +00:00
|
|
|
|
(choice :tag "Deadline relative"
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(function))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-remove-times-when-in-prefix t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means remove duplicate time specifications in agenda items.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When the format `org-agenda-prefix-format' contains a `%t' specifier, a
|
|
|
|
|
time-of-day specification in a headline or diary entry is extracted and
|
|
|
|
|
placed into the prefix. If this option is non-nil, the original specification
|
|
|
|
|
\(a timestamp or -range, or just a plain time(range) specification like
|
|
|
|
|
11:30-4pm) will be removed for agenda display. This makes the agenda less
|
|
|
|
|
cluttered.
|
|
|
|
|
The option can be t or nil. It may also be the symbol `beg', indicating
|
2010-04-13 05:41:39 +00:00
|
|
|
|
that the time should only be removed when it is located at the beginning of
|
2008-03-22 15:52:18 +00:00
|
|
|
|
the headline/diary entry."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Always" t)
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "When at beginning of entry" beg)))
|
|
|
|
|
|
2010-07-12 18:57:24 +00:00
|
|
|
|
(defcustom org-agenda-remove-timeranges-from-blocks nil
|
|
|
|
|
"Non-nil means remove time ranges specifications in agenda
|
|
|
|
|
items that span on several days."
|
|
|
|
|
:group 'org-agenda-line-format
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-07-12 18:57:24 +00:00
|
|
|
|
:type 'boolean)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-default-appointment-duration nil
|
|
|
|
|
"Default duration for appointments that only have a starting time.
|
|
|
|
|
When nil, no duration is specified in such cases.
|
|
|
|
|
When non-nil, this must be the number of minutes, e.g. 60 for one hour."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice
|
|
|
|
|
(integer :tag "Minutes")
|
|
|
|
|
(const :tag "No default duration")))
|
|
|
|
|
|
2008-11-27 08:25:50 +00:00
|
|
|
|
(defcustom org-agenda-show-inherited-tags t
|
2013-01-11 16:15:17 +00:00
|
|
|
|
"Non-nil means show inherited tags in each agenda line.
|
|
|
|
|
|
|
|
|
|
When this option is set to 'always, it take precedences over
|
|
|
|
|
`org-agenda-use-tag-inheritance' and inherited tags are shown
|
|
|
|
|
in every agenda.
|
|
|
|
|
|
|
|
|
|
When this option is set to t (the default), inherited tags are
|
|
|
|
|
shown when they are available, i.e. when the value of
|
|
|
|
|
`org-agenda-use-tag-inheritance' has been taken into account.
|
|
|
|
|
|
|
|
|
|
This can be set to a list of agenda types in which the agenda
|
|
|
|
|
must display the inherited tags. Available types are 'todo,
|
|
|
|
|
'agenda, 'search and 'timeline.
|
|
|
|
|
|
|
|
|
|
When set to nil, never show inherited tags in agenda lines."
|
2008-11-27 08:25:50 +00:00
|
|
|
|
:group 'org-agenda-line-format
|
2013-01-11 16:15:17 +00:00
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:version "24.3"
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Show inherited tags when available" t)
|
|
|
|
|
(const :tag "Always show inherited tags" 'always)
|
|
|
|
|
(repeat :tag "Show inherited tags only in selected agenda types"
|
|
|
|
|
(symbol :tag "Agenda type"))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2013-01-07 15:12:52 +00:00
|
|
|
|
(defcustom org-agenda-use-tag-inheritance '(todo search timeline agenda)
|
|
|
|
|
"List of agenda view types where to use tag inheritance.
|
|
|
|
|
|
|
|
|
|
In tags/tags-todo/tags-tree agenda views, tag inheritance is
|
|
|
|
|
controlled by `org-use-tag-inheritance'. In other agenda types,
|
2013-01-11 16:15:17 +00:00
|
|
|
|
`org-use-tag-inheritance' is not used for the selection of the
|
|
|
|
|
agenda entries. Still, you may want the agenda to be aware of
|
|
|
|
|
the inherited tags anyway, e.g. for later tag filtering.
|
2013-01-07 15:12:52 +00:00
|
|
|
|
|
2013-01-11 16:15:17 +00:00
|
|
|
|
Allowed value are 'todo, 'search, 'timeline and 'agenda.
|
2013-01-07 21:02:33 +00:00
|
|
|
|
|
2013-01-11 16:15:17 +00:00
|
|
|
|
This variable has no effect if `org-agenda-show-inherited-tags'
|
|
|
|
|
is set to 'always. In that case, the agenda is aware of those
|
|
|
|
|
tags.
|
|
|
|
|
|
|
|
|
|
The default value sets tags in every agenda type. Setting this
|
|
|
|
|
option to nil will speed up non-tags agenda view a lot."
|
2013-01-07 21:02:33 +00:00
|
|
|
|
:group 'org-agenda
|
2013-01-11 16:15:17 +00:00
|
|
|
|
:version "24.3"
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Use tag inheritance in all agenda types" t)
|
|
|
|
|
(repeat :tag "Use tag inheritance in selected agenda types"
|
|
|
|
|
(symbol :tag "Agenda type"))))
|
2013-01-07 15:12:52 +00:00
|
|
|
|
|
2009-11-20 16:54:51 +00:00
|
|
|
|
(defcustom org-agenda-hide-tags-regexp nil
|
|
|
|
|
"Regular expression used to filter away specific tags in agenda views.
|
|
|
|
|
This means that these tags will be present, but not be shown in the agenda
|
2010-07-15 20:26:51 +00:00
|
|
|
|
line. Secondary filtering will still work on the hidden tags.
|
2009-11-20 16:54:51 +00:00
|
|
|
|
Nil means don't hide any tags."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Hide none" nil)
|
|
|
|
|
(string :tag "Regexp ")))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defcustom org-agenda-remove-tags nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means remove the tags from the headline copy in the agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When this is the symbol `prefix', only remove tags when
|
|
|
|
|
`org-agenda-prefix-format' contains a `%T' specifier."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Always" t)
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "When prefix format contains %T" prefix)))
|
|
|
|
|
|
2013-03-14 12:53:52 +00:00
|
|
|
|
(org-defvaralias 'org-agenda-remove-tags-when-in-prefix
|
|
|
|
|
'org-agenda-remove-tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-02-01 22:49:03 +00:00
|
|
|
|
(defcustom org-agenda-tags-column (if (featurep 'xemacs) -79 -80)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Shift tags in agenda items to this column.
|
|
|
|
|
If this number is positive, it specifies the column. If it is negative,
|
|
|
|
|
it means that the tags should be flushright to that column. For example,
|
|
|
|
|
-80 works well for a normal 80 character screen."
|
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
2013-03-14 12:53:52 +00:00
|
|
|
|
(org-defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-03-03 11:44:53 +00:00
|
|
|
|
(defcustom org-agenda-fontify-priorities 'cookies
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means highlight low and high priorities in agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
When t, the highest priority entries are bold, lowest priority italic.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
However, settings in `org-priority-faces' will overrule these faces.
|
2009-03-03 11:44:53 +00:00
|
|
|
|
When this variable is the symbol `cookies', only fontify the
|
|
|
|
|
cookies, not the entire task.
|
2008-09-19 14:10:09 +00:00
|
|
|
|
This may also be an association list of priority faces, whose
|
|
|
|
|
keys are the character values of `org-highest-priority',
|
|
|
|
|
`org-default-priority', and `org-lowest-priority' (the default values
|
2009-09-04 09:28:10 +00:00
|
|
|
|
are ?A, ?B, and ?C, respectively). The face may be a named face, a
|
|
|
|
|
color as a string, or a list like `(:background \"Red\")'.
|
|
|
|
|
If it is a color, the variable `org-faces-easy-properties'
|
|
|
|
|
determines if it is a foreground or a background color."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
:group 'org-agenda-line-format
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never" nil)
|
|
|
|
|
(const :tag "Defaults" t)
|
2009-03-03 11:44:53 +00:00
|
|
|
|
(const :tag "Cookies only" cookies)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(repeat :tag "Specify"
|
|
|
|
|
(list (character :tag "Priority" :value ?A)
|
2009-09-04 09:28:10 +00:00
|
|
|
|
(choice :tag "Face "
|
|
|
|
|
(string :tag "Color")
|
|
|
|
|
(sexp :tag "Face"))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(defcustom org-agenda-day-face-function nil
|
|
|
|
|
"Function called to determine what face should be used to display a day.
|
2012-08-11 17:10:44 +00:00
|
|
|
|
The only argument passed to that function is the day. It should
|
2010-11-12 15:34:24 +00:00
|
|
|
|
returns a face, or nil if does not want to specify a face and let
|
|
|
|
|
the normal rules apply."
|
|
|
|
|
:group 'org-agenda-line-format
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-11-12 15:34:24 +00:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2010-10-29 13:49:32 +00:00
|
|
|
|
(defcustom org-agenda-category-icon-alist nil
|
|
|
|
|
"Alist of category icon to be displayed in agenda views.
|
|
|
|
|
|
|
|
|
|
Each entry should have the following format:
|
|
|
|
|
|
|
|
|
|
(CATEGORY-REGEXP FILE-OR-DATA TYPE DATA-P PROPS)
|
|
|
|
|
|
|
|
|
|
Where CATEGORY-REGEXP is a regexp matching the categories where
|
|
|
|
|
the icon should be displayed.
|
|
|
|
|
FILE-OR-DATA either a file path or a string containing image data.
|
|
|
|
|
|
2012-01-10 10:56:15 +00:00
|
|
|
|
The other fields can be omitted safely if not needed:
|
2010-10-29 13:49:32 +00:00
|
|
|
|
TYPE indicates the image type.
|
|
|
|
|
DATA-P is a boolean indicating whether the FILE-OR-DATA string is
|
|
|
|
|
image data.
|
|
|
|
|
PROPS are additional image attributes to assign to the image,
|
|
|
|
|
like, e.g. `:ascent center'.
|
|
|
|
|
|
|
|
|
|
(\"Org\" \"/path/to/icon.png\" nil nil :ascent center)
|
|
|
|
|
|
|
|
|
|
If you want to set the display properties yourself, just put a
|
|
|
|
|
list as second element:
|
|
|
|
|
|
|
|
|
|
(CATEGORY-REGEXP (MY PROPERTY LIST))
|
|
|
|
|
|
|
|
|
|
For example, to display a 16px horizontal space for Emacs
|
|
|
|
|
category, you can use:
|
|
|
|
|
|
|
|
|
|
(\"Emacs\" '(space . (:width (16))))"
|
|
|
|
|
:group 'org-agenda-line-format
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-11-05 19:43:45 +00:00
|
|
|
|
:type '(alist :key-type (string :tag "Regexp matching category")
|
|
|
|
|
:value-type (choice (list :tag "Icon"
|
|
|
|
|
(string :tag "File or data")
|
|
|
|
|
(symbol :tag "Type")
|
|
|
|
|
(boolean :tag "Data?")
|
|
|
|
|
(repeat :tag "Extra image properties" :inline t symbol))
|
|
|
|
|
(list :tag "Display properties" sexp))))
|
2010-10-29 13:49:32 +00:00
|
|
|
|
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(defgroup org-agenda-column-view nil
|
|
|
|
|
"Options concerning column view in the agenda."
|
|
|
|
|
:tag "Org Agenda Column View"
|
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-columns-show-summaries t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means show summaries for columns displayed in the agenda view."
|
2008-04-15 09:02:10 +00:00
|
|
|
|
:group 'org-agenda-column-view
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-columns-compute-summary-properties t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means recompute all summary properties before column view.
|
2008-04-15 09:02:10 +00:00
|
|
|
|
When column view in the agenda is listing properties that have a summary
|
|
|
|
|
operator, it can go to all relevant buffers and recompute the summaries
|
|
|
|
|
there. This can mean overhead for the agenda column view, but is necessary
|
|
|
|
|
to have thing up to date.
|
|
|
|
|
As a special case, a CLOCKSUM property also makes sure that the clock
|
|
|
|
|
computations are current."
|
|
|
|
|
:group 'org-agenda-column-view
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(defcustom org-agenda-columns-add-appointments-to-effort-sum nil
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means the duration of an appointment will add to day effort.
|
2008-04-17 16:26:27 +00:00
|
|
|
|
The property to which appointment durations will be added is the one given
|
|
|
|
|
in the option `org-effort-property'. If an appointment does not have
|
|
|
|
|
an end time, `org-agenda-default-appointment-duration' will be used. If that
|
|
|
|
|
is not set, an appointment without end time will not contribute to the time
|
|
|
|
|
estimate."
|
|
|
|
|
:group 'org-agenda-column-view
|
|
|
|
|
:type 'boolean)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
|
2009-10-19 03:41:26 +00:00
|
|
|
|
(defcustom org-agenda-auto-exclude-function nil
|
|
|
|
|
"A function called with a tag to decide if it is filtered on '/ RET'.
|
|
|
|
|
The sole argument to the function, which is called once for each
|
|
|
|
|
possible tag, is a string giving the name of the tag. The
|
|
|
|
|
function should return either nil if the tag should be included
|
2009-11-20 22:17:55 +00:00
|
|
|
|
as normal, or \"-<TAG>\" to exclude the tag.
|
|
|
|
|
Note that for the purpose of tag filtering, only the lower-case version of
|
|
|
|
|
all tags will be considered, so that this function will only ever see
|
|
|
|
|
the lower-case version of all tags."
|
2009-10-19 03:41:26 +00:00
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'function)
|
|
|
|
|
|
2011-07-11 19:48:44 +00:00
|
|
|
|
(defcustom org-agenda-bulk-custom-functions nil
|
2011-07-19 09:35:41 +00:00
|
|
|
|
"Alist of characters and custom functions for bulk actions.
|
2011-07-11 19:48:44 +00:00
|
|
|
|
For example, this value makes those two functions available:
|
|
|
|
|
|
|
|
|
|
'((?R set-category)
|
|
|
|
|
(?C bulk-cut))
|
|
|
|
|
|
2011-07-19 09:35:41 +00:00
|
|
|
|
With selected entries in an agenda buffer, `B R' will call
|
2011-08-25 13:20:10 +00:00
|
|
|
|
the custom function `set-category' on the selected entries.
|
2011-07-19 09:35:41 +00:00
|
|
|
|
Note that functions in this alist don't need to be quoted."
|
2011-07-11 19:48:44 +00:00
|
|
|
|
:type 'alist
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2011-07-11 19:48:44 +00:00
|
|
|
|
:group 'org-agenda)
|
|
|
|
|
|
2010-08-20 06:32:01 +00:00
|
|
|
|
(defmacro org-agenda-with-point-at-orig-entry (string &rest body)
|
|
|
|
|
"Execute BODY with point at location given by `org-hd-marker' property.
|
|
|
|
|
If STRING is non-nil, the text property will be fetched from position 0
|
|
|
|
|
in that string. If STRING is nil, it will be fetched from the beginning
|
|
|
|
|
of the current line."
|
2011-08-10 05:51:10 +00:00
|
|
|
|
(org-with-gensyms (marker)
|
|
|
|
|
`(let ((,marker (get-text-property (if string 0 (point-at-bol))
|
2011-12-11 13:47:25 +00:00
|
|
|
|
'org-hd-marker ,string)))
|
2011-08-10 05:51:10 +00:00
|
|
|
|
(with-current-buffer (marker-buffer ,marker)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char ,marker)
|
|
|
|
|
,@body)))))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
|
(def-edebug-spec org-agenda-with-point-at-orig-entry (form body))
|
2010-08-20 06:32:01 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-add-agenda-custom-command (entry)
|
|
|
|
|
"Replace or add a command in `org-agenda-custom-commands'.
|
|
|
|
|
This is mostly for hacking and trying a new command - once the command
|
|
|
|
|
works you probably want to add it to `org-agenda-custom-commands' for good."
|
|
|
|
|
(let ((ass (assoc (car entry) org-agenda-custom-commands)))
|
|
|
|
|
(if ass
|
|
|
|
|
(setcdr ass (cdr entry))
|
|
|
|
|
(push entry org-agenda-custom-commands))))
|
|
|
|
|
|
2012-03-19 20:38:12 +00:00
|
|
|
|
;;; Define the org-agenda-mode
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defvar org-agenda-mode-map (make-sparse-keymap)
|
|
|
|
|
"Keymap for `org-agenda-mode'.")
|
2013-03-14 12:53:52 +00:00
|
|
|
|
(org-defvaralias 'org-agenda-keymap 'org-agenda-mode-map)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defvar org-agenda-menu) ; defined later in this file.
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-agenda-restrict nil) ; defined later in this file.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-follow-mode nil)
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(defvar org-agenda-entry-text-mode nil)
|
2008-04-04 21:44:48 +00:00
|
|
|
|
(defvar org-agenda-clockreport-mode nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-show-log nil)
|
|
|
|
|
(defvar org-agenda-redo-command nil)
|
|
|
|
|
(defvar org-agenda-query-string nil)
|
2009-01-01 08:49:25 +00:00
|
|
|
|
(defvar org-agenda-mode-hook nil
|
2012-09-18 06:40:11 +00:00
|
|
|
|
"Hook run after `org-agenda-mode' is turned on.
|
|
|
|
|
The buffer is still writable when this hook is called.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-type nil)
|
|
|
|
|
(defvar org-agenda-force-single-file nil)
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-agenda-bulk-marked-entries nil
|
|
|
|
|
"List of markers that refer to marked entries in the agenda.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-03-01 15:49:23 +00:00
|
|
|
|
;;; Multiple agenda buffers support
|
2012-08-26 21:44:49 +00:00
|
|
|
|
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(defcustom org-agenda-sticky nil
|
|
|
|
|
"Non-nil means agenda q key will bury agenda buffers.
|
|
|
|
|
Agenda commands will then show existing buffer instead of generating new ones.
|
|
|
|
|
When nil, `q' will kill the single agenda buffer."
|
|
|
|
|
:group 'org-agenda
|
2012-09-29 21:46:02 +00:00
|
|
|
|
:version "24.3"
|
2012-09-28 14:37:23 +00:00
|
|
|
|
:type 'boolean)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
|
2012-10-02 06:50:46 +00:00
|
|
|
|
|
2012-08-26 21:44:49 +00:00
|
|
|
|
;;;###autoload
|
2012-03-10 13:33:21 +00:00
|
|
|
|
(defun org-toggle-sticky-agenda (&optional arg)
|
|
|
|
|
"Toggle `org-agenda-sticky'."
|
|
|
|
|
(interactive "P")
|
2012-03-10 16:44:23 +00:00
|
|
|
|
(let ((new-value (if arg
|
|
|
|
|
(> (prefix-numeric-value arg) 0)
|
2012-03-10 13:33:21 +00:00
|
|
|
|
(not org-agenda-sticky))))
|
|
|
|
|
(if (equal new-value org-agenda-sticky)
|
2012-04-22 21:15:04 +00:00
|
|
|
|
(and (org-called-interactively-p 'interactive)
|
2012-04-22 13:27:21 +00:00
|
|
|
|
(message "Sticky agenda was already %s"
|
|
|
|
|
(if org-agenda-sticky "enabled" "disabled")))
|
2012-03-10 13:33:21 +00:00
|
|
|
|
(setq org-agenda-sticky new-value)
|
|
|
|
|
(org-agenda-kill-all-agenda-buffers)
|
2012-04-22 21:15:04 +00:00
|
|
|
|
(and (org-called-interactively-p 'interactive)
|
2012-04-22 13:27:21 +00:00
|
|
|
|
(message "Sticky agenda was %s"
|
|
|
|
|
(if org-agenda-sticky "enabled" "disabled"))))))
|
2012-03-10 13:33:21 +00:00
|
|
|
|
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(defvar org-agenda-buffer nil
|
2012-03-02 16:40:54 +00:00
|
|
|
|
"Agenda buffer currently being generated.")
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
(defvar org-agenda-last-prefix-arg nil)
|
|
|
|
|
(defvar org-agenda-this-buffer-name nil)
|
|
|
|
|
(defvar org-agenda-doing-sticky-redo nil)
|
|
|
|
|
(defvar org-agenda-this-buffer-is-sticky nil)
|
|
|
|
|
|
|
|
|
|
(defconst org-agenda-local-vars
|
2012-03-10 06:55:00 +00:00
|
|
|
|
'(org-agenda-this-buffer-name
|
|
|
|
|
org-agenda-undo-list
|
|
|
|
|
org-agenda-pending-undo-list
|
|
|
|
|
org-agenda-follow-mode
|
|
|
|
|
org-agenda-entry-text-mode
|
|
|
|
|
org-agenda-clockreport-mode
|
|
|
|
|
org-agenda-show-log
|
|
|
|
|
org-agenda-redo-command
|
|
|
|
|
org-agenda-query-string
|
|
|
|
|
org-agenda-type
|
|
|
|
|
org-agenda-bulk-marked-entries
|
|
|
|
|
org-agenda-undo-has-started-in
|
|
|
|
|
org-agenda-info
|
2012-08-28 16:29:18 +00:00
|
|
|
|
org-agenda-pre-window-conf
|
2012-03-10 06:55:00 +00:00
|
|
|
|
org-agenda-columns-active
|
2013-03-11 21:11:38 +00:00
|
|
|
|
org-agenda-tag-filter-overlays
|
2012-03-10 06:55:00 +00:00
|
|
|
|
org-agenda-tag-filter
|
2013-03-11 21:11:38 +00:00
|
|
|
|
org-agenda-cat-filter-overlays
|
2012-03-10 06:55:00 +00:00
|
|
|
|
org-agenda-category-filter
|
2013-03-11 21:11:38 +00:00
|
|
|
|
org-agenda-re-filter-overlays
|
|
|
|
|
org-agenda-regexp-filter
|
2012-03-10 06:55:00 +00:00
|
|
|
|
org-agenda-markers
|
|
|
|
|
org-agenda-last-search-view-search-was-boolean
|
|
|
|
|
org-agenda-filtered-by-category
|
|
|
|
|
org-agenda-filter-form
|
|
|
|
|
org-agenda-cycle-counter
|
|
|
|
|
org-agenda-last-prefix-arg)
|
|
|
|
|
"Variables that must be local in agenda buffers to allow multiple buffers.")
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-mode ()
|
|
|
|
|
"Mode for time-sorted view on action items in Org-mode files.
|
|
|
|
|
|
|
|
|
|
The following commands are available:
|
|
|
|
|
|
|
|
|
|
\\{org-agenda-mode-map}"
|
|
|
|
|
(interactive)
|
2012-03-03 16:04:12 +00:00
|
|
|
|
(cond (org-agenda-doing-sticky-redo
|
|
|
|
|
;; Refreshing sticky agenda-buffer
|
2012-04-17 09:25:22 +00:00
|
|
|
|
;;
|
2012-03-03 16:04:12 +00:00
|
|
|
|
;; Preserve the value of `org-agenda-local-vars' variables,
|
|
|
|
|
;; while letting `kill-all-local-variables' kill the rest
|
|
|
|
|
(let ((save (buffer-local-variables)))
|
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(mapc 'make-local-variable org-agenda-local-vars)
|
|
|
|
|
(dolist (elem save)
|
|
|
|
|
(let ((var (car elem))
|
|
|
|
|
(val (cdr elem)))
|
|
|
|
|
(when (and val
|
|
|
|
|
(member var org-agenda-local-vars))
|
|
|
|
|
(set var val)))))
|
|
|
|
|
(set (make-local-variable 'org-agenda-this-buffer-is-sticky) t))
|
|
|
|
|
(org-agenda-sticky
|
|
|
|
|
;; Creating a sticky Agenda buffer for the first time
|
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(mapc 'make-local-variable org-agenda-local-vars)
|
|
|
|
|
(set (make-local-variable 'org-agenda-this-buffer-is-sticky) t))
|
|
|
|
|
(t
|
|
|
|
|
;; Creating a non-sticky agenda buffer
|
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(set (make-local-variable 'org-agenda-this-buffer-is-sticky) nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-undo-list nil
|
2009-06-22 19:54:42 +00:00
|
|
|
|
org-agenda-pending-undo-list nil
|
2009-06-26 07:27:08 +00:00
|
|
|
|
org-agenda-bulk-marked-entries nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq major-mode 'org-agenda-mode)
|
|
|
|
|
;; Keep global-font-lock-mode from turning on font-lock-mode
|
|
|
|
|
(org-set-local 'font-lock-global-modes (list 'not major-mode))
|
|
|
|
|
(setq mode-name "Org-Agenda")
|
|
|
|
|
(use-local-map org-agenda-mode-map)
|
|
|
|
|
(easy-menu-add org-agenda-menu)
|
|
|
|
|
(if org-startup-truncated (setq truncate-lines t))
|
2009-08-27 05:42:05 +00:00
|
|
|
|
(org-set-local 'line-move-visual nil)
|
2012-09-27 22:12:53 +00:00
|
|
|
|
(org-add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
|
|
|
|
|
;; Make sure properties are removed when copying text
|
2012-04-28 19:36:58 +00:00
|
|
|
|
(make-local-variable 'filter-buffer-substring-functions)
|
|
|
|
|
(add-hook 'filter-buffer-substring-functions
|
|
|
|
|
(lambda (fun start end delete)
|
|
|
|
|
(substring-no-properties (funcall fun start end delete))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(unless org-agenda-keep-modes
|
|
|
|
|
(setq org-agenda-follow-mode org-agenda-start-with-follow-mode
|
2009-08-27 07:56:46 +00:00
|
|
|
|
org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode
|
2008-04-04 21:44:48 +00:00
|
|
|
|
org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode
|
2009-05-14 07:40:53 +00:00
|
|
|
|
org-agenda-show-log org-agenda-start-with-log-mode))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(easy-menu-change
|
|
|
|
|
'("Agenda") "Agenda Files"
|
|
|
|
|
(append
|
|
|
|
|
(list
|
|
|
|
|
(vector
|
|
|
|
|
(if (get 'org-agenda-files 'org-restrict)
|
|
|
|
|
"Restricted to single file"
|
|
|
|
|
"Edit File List")
|
|
|
|
|
'(org-edit-agenda-file-list)
|
|
|
|
|
(not (get 'org-agenda-files 'org-restrict)))
|
|
|
|
|
"--")
|
|
|
|
|
(mapcar 'org-file-menu-entry (org-agenda-files))))
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(apply
|
|
|
|
|
(if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)
|
|
|
|
|
(list 'org-agenda-mode-hook)))
|
|
|
|
|
|
|
|
|
|
(substitute-key-definition 'undo 'org-agenda-undo
|
|
|
|
|
org-agenda-mode-map global-map)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-i" 'org-agenda-goto)
|
|
|
|
|
(org-defkey org-agenda-mode-map [(tab)] 'org-agenda-goto)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-m" 'org-agenda-switch-to)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-k" 'org-agenda-kill)
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark)
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "*" 'org-agenda-bulk-mark-all)
|
2013-01-06 11:31:20 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "#" 'org-agenda-dim-blocked-tasks)
|
2011-02-03 19:03:51 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "%" 'org-agenda-bulk-mark-regexp)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark)
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-unmark-all)
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "B" 'org-agenda-bulk-action)
|
2012-09-02 10:52:38 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "k" 'org-agenda-capture)
|
2012-09-01 08:53:47 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "A" 'org-agenda-append-agenda)
|
2009-04-30 14:11:35 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload)
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-a" 'org-agenda-archive-default)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-xa" 'org-agenda-toggle-archive-tag)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-xA" 'org-agenda-archive-to-archive-sibling)
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive)
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c$" 'org-agenda-archive)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "$" 'org-agenda-archive)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link)
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map " " 'org-agenda-show-and-scroll-up)
|
|
|
|
|
(org-defkey org-agenda-mode-map [backspace] 'org-agenda-show-scroll-down)
|
2009-10-21 14:55:09 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\d" 'org-agenda-show-scroll-down)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset)
|
|
|
|
|
(org-defkey org-agenda-mode-map [(control shift left)] 'org-agenda-todo-previousset)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer)
|
|
|
|
|
(org-defkey org-agenda-mode-map "o" 'delete-other-windows)
|
|
|
|
|
(org-defkey org-agenda-mode-map "L" 'org-agenda-recenter)
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "t" 'org-agenda-todo)
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "a" 'org-agenda-archive-default-with-confirmation)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags)
|
2008-10-16 12:04:04 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "." 'org-agenda-goto-today)
|
|
|
|
|
(org-defkey org-agenda-mode-map "j" 'org-agenda-goto-date)
|
|
|
|
|
(org-defkey org-agenda-mode-map "d" 'org-agenda-day-view)
|
|
|
|
|
(org-defkey org-agenda-mode-map "w" 'org-agenda-week-view)
|
|
|
|
|
(org-defkey org-agenda-mode-map "y" 'org-agenda-year-view)
|
2008-03-28 14:42:31 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-z" 'org-agenda-add-note)
|
|
|
|
|
(org-defkey org-agenda-mode-map "z" 'org-agenda-add-note)
|
Time stamps: Changing time ranges as a block.
Anupam Sengupta writes:
> I routinely use time ranges (and occasionally time-stamp ranges)
> in my org files to document the scheduled block of time for a
> meeting or activity. As an example, I will mark meetings as:
>
> * A Meeting
> <2009-03-12 Thu 10:00-11:00>
>
> As often happens with meetings, rescheduling needs to be done and
> I use S-<up> or S-<down> on the time-stamp to make the
> modifications. While this works fine, it usually leads to a
> duplication when the *time* part of the time-stamp needs to be
> changed.
>
> For the same example above, if the time-block has now changed to
> 11:00-12:00, then I need to do S-<up> on both the "10:00" and the
> "11:00" string. I.e,
>
>
> * A Meeting
> <2009-03-12 Thu 11:00-11:00>
> ^
> +---------------- After the first S-<up>
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^
> +---------------- After the second S-<up>
>
> Can we have a feature (with a toggle option perhaps) which would
> *move* the block (i.e., both time entries) by the same amount
> when either one is moved in the same direction. I.e., the
> proposal is to have:
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^ ^
> | |
> | +---------- Automatically shifted
> +---------------- After the S-<up>
This is in fact how changing time works in many applications, and
it does make sense here as well. The commits implements this
change.
It also implements a way to change the start time of an entry from
the agenda. The date is normally changed with S-right/left.
Now, if you add a C-u prefix, the hour will be changed. If you
immediately press S-right/left again, hours will continue to be
changed.
A double prefix will do the same for minutes.
2009-03-13 08:26:53 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map [(shift right)] 'org-agenda-do-date-later)
|
|
|
|
|
(org-defkey org-agenda-mode-map [(shift left)] 'org-agenda-do-date-earlier)
|
|
|
|
|
(org-defkey org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-do-date-later)
|
|
|
|
|
(org-defkey org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-do-date-earlier)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(org-defkey org-agenda-mode-map ">" 'org-agenda-date-prompt)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-s" 'org-agenda-schedule)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline)
|
|
|
|
|
(let ((l '(1 2 3 4 5 6 7 8 9 0)))
|
|
|
|
|
(while l (org-defkey org-agenda-mode-map
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(int-to-string (pop l)) 'digit-argument)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-08-27 14:08:55 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "F" 'org-agenda-follow-mode)
|
2008-04-04 21:44:48 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "R" 'org-agenda-clockreport-mode)
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "E" 'org-agenda-entry-text-mode)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
|
2010-03-15 01:00:59 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
|
|
|
|
|
(org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "g" (lambda () (interactive) (org-agenda-redo t)))
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "e" 'org-agenda-set-effort)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-xe" 'org-agenda-set-effort)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-e"
|
|
|
|
|
'org-clock-modify-effort-estimate)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-xp" 'org-agenda-set-property)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "q" 'org-agenda-quit)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "Q" 'org-agenda-Quit)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "x" 'org-agenda-exit)
|
2011-12-31 11:45:05 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-x\C-w" 'org-agenda-write)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-x\C-s" 'org-save-all-org-buffers)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags)
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "n" 'org-agenda-next-line)
|
|
|
|
|
(org-defkey org-agenda-mode-map "p" 'org-agenda-previous-line)
|
2012-08-07 21:11:26 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "N" 'org-agenda-next-item)
|
|
|
|
|
(org-defkey org-agenda-mode-map "P" 'org-agenda-previous-item)
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(substitute-key-definition 'next-line 'org-agenda-next-line
|
|
|
|
|
org-agenda-mode-map global-map)
|
|
|
|
|
(substitute-key-definition 'previous-line 'org-agenda-previous-line
|
|
|
|
|
org-agenda-mode-map global-map)
|
2008-10-01 07:25:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line)
|
2012-09-28 06:29:38 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "," 'org-agenda-priority)
|
|
|
|
|
(org-defkey org-agenda-mode-map "i" 'org-agenda-diary-entry)
|
|
|
|
|
(org-defkey org-agenda-mode-map "c" 'org-agenda-goto-calendar)
|
|
|
|
|
(org-defkey org-agenda-mode-map "C" 'org-agenda-convert-date)
|
|
|
|
|
(org-defkey org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
|
|
|
|
|
(org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
|
|
|
|
|
(org-defkey org-agenda-mode-map "h" 'org-agenda-holidays)
|
|
|
|
|
(org-defkey org-agenda-mode-map "H" 'org-agenda-holidays)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-i" 'org-agenda-clock-in)
|
|
|
|
|
(org-defkey org-agenda-mode-map "I" 'org-agenda-clock-in)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-o" 'org-agenda-clock-out)
|
|
|
|
|
(org-defkey org-agenda-mode-map "O" 'org-agenda-clock-out)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-x" 'org-agenda-clock-cancel)
|
|
|
|
|
(org-defkey org-agenda-mode-map "X" 'org-agenda-clock-cancel)
|
2010-08-11 14:10:14 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-j" 'org-clock-goto)
|
|
|
|
|
(org-defkey org-agenda-mode-map "J" 'org-agenda-clock-goto)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "+" 'org-agenda-priority-up)
|
|
|
|
|
(org-defkey org-agenda-mode-map "-" 'org-agenda-priority-down)
|
|
|
|
|
(org-defkey org-agenda-mode-map [(shift up)] 'org-agenda-priority-up)
|
|
|
|
|
(org-defkey org-agenda-mode-map [(shift down)] 'org-agenda-priority-down)
|
|
|
|
|
(org-defkey org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
|
|
|
|
|
(org-defkey org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
|
2009-08-27 14:08:55 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "f" 'org-agenda-later)
|
|
|
|
|
(org-defkey org-agenda-mode-map "b" 'org-agenda-earlier)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-agenda-columns)
|
2009-05-21 22:38:46 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(org-defkey org-agenda-mode-map "[" 'org-agenda-manipulate-query-add)
|
|
|
|
|
(org-defkey org-agenda-mode-map "]" 'org-agenda-manipulate-query-subtract)
|
|
|
|
|
(org-defkey org-agenda-mode-map "{" 'org-agenda-manipulate-query-add-re)
|
|
|
|
|
(org-defkey org-agenda-mode-map "}" 'org-agenda-manipulate-query-subtract-re)
|
2008-09-05 17:02:14 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "/" 'org-agenda-filter-by-tag)
|
2013-03-16 18:40:02 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "=" 'org-agenda-filter-by-regexp)
|
|
|
|
|
(org-defkey org-agenda-mode-map "|" 'org-agenda-filter-remove-all)
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\\" 'org-agenda-filter-by-tag-refine)
|
2013-04-05 06:36:17 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "~" 'org-agenda-limit-interactively)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "<" 'org-agenda-filter-by-category)
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "^" 'org-agenda-filter-by-top-headline)
|
2009-07-26 18:54:17 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map ";" 'org-timer-set-timer)
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(define-key org-agenda-mode-map "?" 'org-agenda-show-the-flagging-note)
|
2009-09-17 12:33:44 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull)
|
|
|
|
|
(org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-04-21 06:38:09 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map [mouse-2] 'org-agenda-goto-mouse)
|
|
|
|
|
(org-defkey org-agenda-mode-map [mouse-3] 'org-agenda-show-mouse)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when org-agenda-mouse-1-follows-link
|
2009-11-06 15:54:26 +00:00
|
|
|
|
(org-defkey org-agenda-mode-map [follow-link] 'mouse-face))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
|
|
|
|
|
'("Agenda"
|
|
|
|
|
("Agenda Files")
|
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
("Agenda Dates"
|
|
|
|
|
["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
|
|
|
|
|
["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)]
|
|
|
|
|
["Jump to date" org-agenda-goto-date (org-agenda-check-type nil 'agenda)])
|
|
|
|
|
"--"
|
|
|
|
|
("View"
|
|
|
|
|
["Day View" org-agenda-day-view
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
:style radio :selected (eq org-agenda-current-span 'day)
|
2009-09-15 18:18:51 +00:00
|
|
|
|
:keys "v d (or just d)"]
|
|
|
|
|
["Week View" org-agenda-week-view
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
:style radio :selected (eq org-agenda-current-span 'week)
|
2009-09-15 18:18:51 +00:00
|
|
|
|
:keys "v w (or just w)"]
|
|
|
|
|
["Month View" org-agenda-month-view
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
:style radio :selected (eq org-agenda-current-span 'month)
|
2009-09-15 18:18:51 +00:00
|
|
|
|
:keys "v m"]
|
|
|
|
|
["Year View" org-agenda-year-view
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
:style radio :selected (eq org-agenda-current-span 'year)
|
2009-09-15 18:18:51 +00:00
|
|
|
|
:keys "v y"]
|
|
|
|
|
"--"
|
|
|
|
|
["Include Diary" org-agenda-toggle-diary
|
|
|
|
|
:style toggle :selected org-agenda-include-diary
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)]
|
2010-03-15 01:00:59 +00:00
|
|
|
|
["Include Deadlines" org-agenda-toggle-deadlines
|
|
|
|
|
:style toggle :selected org-agenda-include-deadlines
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)]
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Use Time Grid" org-agenda-toggle-time-grid
|
|
|
|
|
:style toggle :selected org-agenda-use-time-grid
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)]
|
|
|
|
|
"--"
|
|
|
|
|
["Show clock report" org-agenda-clockreport-mode
|
|
|
|
|
:style toggle :selected org-agenda-clockreport-mode
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda)]
|
|
|
|
|
["Show some entry text" org-agenda-entry-text-mode
|
|
|
|
|
:style toggle :selected org-agenda-entry-text-mode
|
|
|
|
|
:active t]
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Show Logbook entries" org-agenda-log-mode
|
|
|
|
|
:style toggle :selected org-agenda-show-log
|
|
|
|
|
:active (org-agenda-check-type nil 'agenda 'timeline)
|
|
|
|
|
:keys "v l (or just l)"]
|
|
|
|
|
["Include archived trees" org-agenda-archives-mode
|
|
|
|
|
:style toggle :selected org-agenda-archives-mode :active t
|
|
|
|
|
:keys "v a"]
|
|
|
|
|
["Include archive files" (org-agenda-archives-mode t)
|
|
|
|
|
:style toggle :selected (eq org-agenda-archives-mode t) :active t
|
|
|
|
|
:keys "v A"]
|
|
|
|
|
"--"
|
|
|
|
|
["Remove Restriction" org-agenda-remove-restriction-lock org-agenda-restrict])
|
2011-12-31 11:45:05 +00:00
|
|
|
|
["Write view to file" org-agenda-write t]
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Rebuild buffer" org-agenda-redo t]
|
|
|
|
|
["Save all Org-mode Buffers" org-save-all-org-buffers t]
|
|
|
|
|
"--"
|
|
|
|
|
["Show original entry" org-agenda-show t]
|
2008-03-22 15:52:18 +00:00
|
|
|
|
["Go To (other window)" org-agenda-goto t]
|
|
|
|
|
["Go To (this window)" org-agenda-switch-to t]
|
2012-09-02 10:52:38 +00:00
|
|
|
|
["Capture with cursor date" org-agenda-capture t]
|
2008-03-22 15:52:18 +00:00
|
|
|
|
["Follow Mode" org-agenda-follow-mode
|
|
|
|
|
:style toggle :selected org-agenda-follow-mode :active t]
|
2012-09-24 15:19:12 +00:00
|
|
|
|
;; ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t]
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
("TODO"
|
|
|
|
|
["Cycle TODO" org-agenda-todo t]
|
|
|
|
|
["Next TODO set" org-agenda-todo-nextset t]
|
|
|
|
|
["Previous TODO set" org-agenda-todo-previousset t]
|
|
|
|
|
["Add note" org-agenda-add-note t])
|
|
|
|
|
("Archive/Refile/Delete"
|
2009-10-30 14:53:00 +00:00
|
|
|
|
["Archive default" org-agenda-archive-default t]
|
|
|
|
|
["Archive default" org-agenda-archive-default-with-confirmation t]
|
2008-04-08 10:29:28 +00:00
|
|
|
|
["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t]
|
2008-04-10 06:27:56 +00:00
|
|
|
|
["Move to archive sibling" org-agenda-archive-to-archive-sibling t]
|
2009-06-22 19:54:42 +00:00
|
|
|
|
["Archive subtree" org-agenda-archive t]
|
2009-09-15 18:18:51 +00:00
|
|
|
|
"--"
|
|
|
|
|
["Refile" org-agenda-refile t]
|
|
|
|
|
"--"
|
|
|
|
|
["Delete subtree" org-agenda-kill t])
|
2009-06-22 19:54:42 +00:00
|
|
|
|
("Bulk action"
|
2009-09-07 12:54:32 +00:00
|
|
|
|
["Mark entry" org-agenda-bulk-mark t]
|
2012-05-05 07:21:22 +00:00
|
|
|
|
["Mark all" org-agenda-bulk-mark-all t]
|
2011-02-03 19:03:51 +00:00
|
|
|
|
["Mark matching regexp" org-agenda-bulk-mark-regexp t]
|
2009-09-07 12:54:32 +00:00
|
|
|
|
["Unmark entry" org-agenda-bulk-unmark t]
|
2012-09-01 08:53:47 +00:00
|
|
|
|
["Unmark all entries" org-agenda-bulk-unmark-all :active t :keys "U"])
|
2012-08-11 17:10:44 +00:00
|
|
|
|
["Act on all marked" org-agenda-bulk-action t]
|
2009-06-22 19:54:42 +00:00
|
|
|
|
"--"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
("Tags and Properties"
|
|
|
|
|
["Show all Tags" org-agenda-show-tags t]
|
|
|
|
|
["Set Tags current line" org-agenda-set-tags (not (org-region-active-p))]
|
|
|
|
|
["Change tag in region" org-agenda-set-tags (org-region-active-p)]
|
|
|
|
|
"--"
|
|
|
|
|
["Column View" org-columns t])
|
2009-09-15 18:18:51 +00:00
|
|
|
|
("Deadline/Schedule"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
["Schedule" org-agenda-schedule t]
|
|
|
|
|
["Set Deadline" org-agenda-deadline t]
|
|
|
|
|
"--"
|
|
|
|
|
["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)]
|
Time stamps: Changing time ranges as a block.
Anupam Sengupta writes:
> I routinely use time ranges (and occasionally time-stamp ranges)
> in my org files to document the scheduled block of time for a
> meeting or activity. As an example, I will mark meetings as:
>
> * A Meeting
> <2009-03-12 Thu 10:00-11:00>
>
> As often happens with meetings, rescheduling needs to be done and
> I use S-<up> or S-<down> on the time-stamp to make the
> modifications. While this works fine, it usually leads to a
> duplication when the *time* part of the time-stamp needs to be
> changed.
>
> For the same example above, if the time-block has now changed to
> 11:00-12:00, then I need to do S-<up> on both the "10:00" and the
> "11:00" string. I.e,
>
>
> * A Meeting
> <2009-03-12 Thu 11:00-11:00>
> ^
> +---------------- After the first S-<up>
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^
> +---------------- After the second S-<up>
>
> Can we have a feature (with a toggle option perhaps) which would
> *move* the block (i.e., both time entries) by the same amount
> when either one is moved in the same direction. I.e., the
> proposal is to have:
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^ ^
> | |
> | +---------- Automatically shifted
> +---------------- After the S-<up>
This is in fact how changing time works in many applications, and
it does make sense here as well. The commits implements this
change.
It also implements a way to change the start time of an entry from
the agenda. The date is normally changed with S-right/left.
Now, if you add a C-u prefix, the hour will be changed. If you
immediately press S-right/left again, hours will continue to be
changed.
A double prefix will do the same for minutes.
2009-03-13 08:26:53 +00:00
|
|
|
|
["Change Time +1 hour" org-agenda-do-date-later :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u S-right"]
|
|
|
|
|
["Change Time -1 hour" org-agenda-do-date-earlier :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u S-left"]
|
|
|
|
|
["Change Time + min" org-agenda-date-later :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u C-u S-right"]
|
|
|
|
|
["Change Time - min" org-agenda-date-earlier :active (org-agenda-check-type nil 'agenda 'timeline) :keys "C-u C-u S-left"]
|
2008-03-22 15:52:18 +00:00
|
|
|
|
["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)])
|
2009-08-29 18:21:15 +00:00
|
|
|
|
("Clock and Effort"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
["Clock in" org-agenda-clock-in t]
|
|
|
|
|
["Clock out" org-agenda-clock-out t]
|
|
|
|
|
["Clock cancel" org-agenda-clock-cancel t]
|
2009-08-29 18:21:15 +00:00
|
|
|
|
["Goto running clock" org-clock-goto t]
|
|
|
|
|
"--"
|
|
|
|
|
["Set Effort" org-agenda-set-effort t]
|
|
|
|
|
["Change clocked effort" org-clock-modify-effort-estimate
|
|
|
|
|
(org-clock-is-active)])
|
2008-03-22 15:52:18 +00:00
|
|
|
|
("Priority"
|
|
|
|
|
["Set Priority" org-agenda-priority t]
|
|
|
|
|
["Increase Priority" org-agenda-priority-up t]
|
|
|
|
|
["Decrease Priority" org-agenda-priority-down t]
|
2012-09-28 06:29:38 +00:00
|
|
|
|
["Show Priority" org-show-priority t])
|
2008-03-22 15:52:18 +00:00
|
|
|
|
("Calendar/Diary"
|
|
|
|
|
["New Diary Entry" org-agenda-diary-entry (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Goto Calendar" org-agenda-goto-calendar (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Phases of the Moon" org-agenda-phases-of-moon (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Sunrise/Sunset" org-agenda-sunrise-sunset (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Holidays" org-agenda-holidays (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
["Convert" org-agenda-convert-date (org-agenda-check-type nil 'agenda 'timeline)]
|
|
|
|
|
"--"
|
2013-01-27 22:44:27 +00:00
|
|
|
|
["Create iCalendar File" org-icalendar-combine-agenda-files t])
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Undo Remote Editing" org-agenda-undo org-agenda-undo-list]
|
2008-06-19 22:20:12 +00:00
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
("MobileOrg"
|
|
|
|
|
["Push Files and Views" org-mobile-push t]
|
2009-09-17 11:45:01 +00:00
|
|
|
|
["Get Captured and Flagged" org-mobile-pull t]
|
|
|
|
|
["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "C-c a ?"]
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Show note / unflag" org-agenda-show-the-flagging-note t]
|
2009-05-21 22:38:46 +00:00
|
|
|
|
"--"
|
2009-09-15 18:18:51 +00:00
|
|
|
|
["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t])
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"--"
|
|
|
|
|
["Quit" org-agenda-quit t]
|
|
|
|
|
["Exit and Release Buffers" org-agenda-exit t]
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
;;; Agenda undo
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-allow-remote-undo t
|
2010-01-21 15:15:40 +00:00
|
|
|
|
"Non-nil means allow remote undo from the agenda buffer.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-undo-has-started-in nil
|
|
|
|
|
"Buffers that have already seen `undo-start' in the current undo sequence.")
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-undo ()
|
|
|
|
|
"Undo a remote editing step in the agenda.
|
|
|
|
|
This undoes changes both in the agenda buffer and in the remote buffer
|
|
|
|
|
that have been changed along."
|
|
|
|
|
(interactive)
|
|
|
|
|
(or org-agenda-allow-remote-undo
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Check the variable `org-agenda-allow-remote-undo' to activate remote undo"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (not (eq this-command last-command))
|
|
|
|
|
(setq org-agenda-undo-has-started-in nil
|
|
|
|
|
org-agenda-pending-undo-list org-agenda-undo-list))
|
|
|
|
|
(if (not org-agenda-pending-undo-list)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No further undo information"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((entry (pop org-agenda-pending-undo-list))
|
|
|
|
|
buf line cmd rembuf)
|
|
|
|
|
(setq cmd (pop entry) line (pop entry))
|
|
|
|
|
(setq rembuf (nth 2 entry))
|
|
|
|
|
(org-with-remote-undo rembuf
|
|
|
|
|
(while (bufferp (setq buf (pop entry)))
|
|
|
|
|
(if (pop entry)
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(let ((last-undo-buffer buf)
|
|
|
|
|
(inhibit-read-only t))
|
|
|
|
|
(unless (memq buf org-agenda-undo-has-started-in)
|
|
|
|
|
(push buf org-agenda-undo-has-started-in)
|
|
|
|
|
(make-local-variable 'pending-undo-list)
|
|
|
|
|
(undo-start))
|
|
|
|
|
(while (and pending-undo-list
|
|
|
|
|
(listp pending-undo-list)
|
|
|
|
|
(not (car pending-undo-list)))
|
|
|
|
|
(pop pending-undo-list))
|
|
|
|
|
(undo-more 1))))))
|
2009-08-27 08:24:09 +00:00
|
|
|
|
(org-goto-line line)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "`%s' undone (buffer %s)" cmd (buffer-name rembuf))))
|
|
|
|
|
|
|
|
|
|
(defun org-verify-change-for-undo (l1 l2)
|
|
|
|
|
"Verify that a real change occurred between the undo lists L1 and L2."
|
|
|
|
|
(while (and l1 (listp l1) (null (car l1))) (pop l1))
|
|
|
|
|
(while (and l2 (listp l2) (null (car l2))) (pop l2))
|
|
|
|
|
(not (eq l1 l2)))
|
|
|
|
|
|
|
|
|
|
;;; Agenda dispatch
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-restrict-begin (make-marker))
|
|
|
|
|
(defvar org-agenda-restrict-end (make-marker))
|
|
|
|
|
(defvar org-agenda-last-dispatch-buffer nil)
|
|
|
|
|
(defvar org-agenda-overriding-restriction nil)
|
|
|
|
|
|
2012-08-23 09:08:47 +00:00
|
|
|
|
(defcustom org-agenda-custom-commands-contexts nil
|
2012-08-24 10:14:54 +00:00
|
|
|
|
"Alist of custom agenda keys and contextual rules.
|
2012-08-23 09:08:47 +00:00
|
|
|
|
|
|
|
|
|
For example, if you have a custom agenda command \"p\" and you
|
|
|
|
|
want this command to be accessible only from plain text files,
|
|
|
|
|
use this:
|
|
|
|
|
|
2013-01-12 08:20:17 +00:00
|
|
|
|
'((\"p\" ((in-file . \"\\.txt\"))))
|
2012-08-23 09:08:47 +00:00
|
|
|
|
|
2012-08-24 10:14:54 +00:00
|
|
|
|
Here are the available contexts definitions:
|
2012-08-23 09:08:47 +00:00
|
|
|
|
|
|
|
|
|
in-file: command displayed only in matching files
|
|
|
|
|
in-mode: command displayed only in matching modes
|
|
|
|
|
not-in-file: command not displayed in matching files
|
|
|
|
|
not-in-mode: command not displayed in matching modes
|
2013-01-31 10:06:04 +00:00
|
|
|
|
in-buffer: command displayed only in matching buffers
|
|
|
|
|
not-in-buffer: command not displayed in matching buffers
|
2012-08-24 10:14:54 +00:00
|
|
|
|
[function]: a custom function taking no argument
|
2012-08-23 09:08:47 +00:00
|
|
|
|
|
|
|
|
|
If you define several checks, the agenda command will be
|
2012-08-24 10:14:54 +00:00
|
|
|
|
accessible if there is at least one valid check.
|
|
|
|
|
|
|
|
|
|
You can also bind a key to another agenda custom command
|
|
|
|
|
depending on contextual rules.
|
|
|
|
|
|
2013-01-12 08:20:17 +00:00
|
|
|
|
'((\"p\" \"q\" ((in-file . \"\\.txt\"))))
|
2012-08-24 10:14:54 +00:00
|
|
|
|
|
|
|
|
|
Here it means: in .txt files, use \"p\" as the key for the
|
|
|
|
|
agenda command otherwise associated with \"q\". (The command
|
|
|
|
|
originally associated with \"q\" is not displayed to avoid
|
|
|
|
|
duplicates.)"
|
2012-09-29 21:46:02 +00:00
|
|
|
|
:version "24.3"
|
2012-08-23 09:08:47 +00:00
|
|
|
|
:group 'org-agenda-custom-commands
|
2012-08-23 15:04:43 +00:00
|
|
|
|
:type '(repeat (list :tag "Rule"
|
2012-08-24 10:14:54 +00:00
|
|
|
|
(string :tag " Agenda key")
|
2012-08-23 15:04:43 +00:00
|
|
|
|
(string :tag "Replace by command")
|
2012-08-23 09:08:47 +00:00
|
|
|
|
(repeat :tag "Available when"
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(choice
|
|
|
|
|
(cons :tag "Condition"
|
|
|
|
|
(choice
|
|
|
|
|
(const :tag "In file" in-file)
|
|
|
|
|
(const :tag "Not in file" not-in-file)
|
2013-01-31 10:06:04 +00:00
|
|
|
|
(const :tag "In buffer" in-buffer)
|
|
|
|
|
(const :tag "Not in buffer" not-in-buffer)
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(const :tag "In mode" in-mode)
|
|
|
|
|
(const :tag "Not in mode" not-in-mode))
|
|
|
|
|
(regexp))
|
|
|
|
|
(function :tag "Custom function"))))))
|
2012-08-23 09:08:47 +00:00
|
|
|
|
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(defcustom org-agenda-max-entries nil
|
|
|
|
|
"Maximum number of entries to display in an agenda.
|
|
|
|
|
This can be nil (no limit) or an integer or an alist of agenda
|
|
|
|
|
types with an associated number of entries to display in this
|
|
|
|
|
type."
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2013-02-06 16:16:35 +00:00
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(choice (symbol :tag "No limit" nil)
|
|
|
|
|
(integer :tag "Max number of entries")
|
|
|
|
|
(repeat
|
|
|
|
|
(cons (choice :tag "Agenda type"
|
|
|
|
|
(const agenda)
|
|
|
|
|
(const todo)
|
|
|
|
|
(const tags)
|
|
|
|
|
(const search)
|
|
|
|
|
(const timeline))
|
|
|
|
|
(integer :tag "Max number of entries")))))
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-max-todos nil
|
|
|
|
|
"Maximum number of TODOs to display in an agenda.
|
|
|
|
|
This can be nil (no limit) or an integer or an alist of agenda
|
|
|
|
|
types with an associated number of entries to display in this
|
|
|
|
|
type."
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2013-02-06 16:16:35 +00:00
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(choice (symbol :tag "No limit" nil)
|
|
|
|
|
(integer :tag "Max number of entries")
|
|
|
|
|
(repeat
|
|
|
|
|
(cons (choice :tag "Agenda type"
|
|
|
|
|
(const agenda)
|
|
|
|
|
(const todo)
|
|
|
|
|
(const tags)
|
|
|
|
|
(const search)
|
|
|
|
|
(const timeline))
|
|
|
|
|
(integer :tag "Max number of entries")))))
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-max-tags nil
|
|
|
|
|
"Maximum number of tagged entries to display in an agenda.
|
|
|
|
|
This can be nil (no limit) or an integer or an alist of agenda
|
|
|
|
|
types with an associated number of entries to display in this
|
|
|
|
|
type."
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2013-02-06 16:16:35 +00:00
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(choice (symbol :tag "No limit" nil)
|
|
|
|
|
(integer :tag "Max number of entries")
|
|
|
|
|
(repeat
|
|
|
|
|
(cons (choice :tag "Agenda type"
|
|
|
|
|
(const agenda)
|
|
|
|
|
(const todo)
|
|
|
|
|
(const tags)
|
|
|
|
|
(const search)
|
|
|
|
|
(const timeline))
|
|
|
|
|
(integer :tag "Max number of entries")))))
|
|
|
|
|
|
|
|
|
|
(defcustom org-agenda-max-effort nil
|
|
|
|
|
"Maximum cumulated effort duration for the agenda.
|
|
|
|
|
This can be nil (no limit) or a number of minutes (as an integer)
|
|
|
|
|
or an alist of agenda types with an associated number of minutes
|
|
|
|
|
to limit entries to in this type."
|
2013-02-26 17:21:28 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2013-02-06 16:16:35 +00:00
|
|
|
|
:group 'org-agenda-custom-commands
|
|
|
|
|
:type '(choice (symbol :tag "No limit" nil)
|
|
|
|
|
(integer :tag "Max number of entries")
|
|
|
|
|
(repeat
|
|
|
|
|
(cons (choice :tag "Agenda type"
|
|
|
|
|
(const agenda)
|
|
|
|
|
(const todo)
|
|
|
|
|
(const tags)
|
|
|
|
|
(const search)
|
|
|
|
|
(const timeline))
|
|
|
|
|
(integer :tag "Max number of entries")))))
|
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-keys nil)
|
|
|
|
|
(defvar org-match nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;###autoload
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(defun org-agenda (&optional arg org-keys restriction)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Dispatch agenda commands to collect entries to the agenda buffer.
|
|
|
|
|
Prompts for a command to execute. Any prefix arg will be passed
|
|
|
|
|
on to the selected command. The default selections are:
|
|
|
|
|
|
|
|
|
|
a Call `org-agenda-list' to display the agenda for current day or week.
|
|
|
|
|
t Call `org-todo-list' to display the global todo list.
|
|
|
|
|
T Call `org-todo-list' to display the global todo list, select only
|
|
|
|
|
entries with a specific TODO keyword (the user gets a prompt).
|
|
|
|
|
m Call `org-tags-view' to display headlines with tags matching
|
|
|
|
|
a condition (the user is prompted for the condition).
|
|
|
|
|
M Like `m', but select only TODO entries, no ordinary headlines.
|
|
|
|
|
L Create a timeline for the current buffer.
|
|
|
|
|
e Export views to associated files.
|
2009-02-13 22:21:10 +00:00
|
|
|
|
s Search entries for keywords.
|
2012-08-28 10:35:05 +00:00
|
|
|
|
S Search entries for keywords, only with TODO keywords.
|
2009-10-02 06:30:18 +00:00
|
|
|
|
/ Multi occur across all agenda files and also files listed
|
2009-02-13 22:21:10 +00:00
|
|
|
|
in `org-agenda-text-search-extra-files'.
|
|
|
|
|
< Restrict agenda commands to buffer, subtree, or region.
|
|
|
|
|
Press several times to get the desired effect.
|
|
|
|
|
> Remove a previous restriction.
|
|
|
|
|
# List \"stuck\" projects.
|
|
|
|
|
! Configure what \"stuck\" means.
|
|
|
|
|
C Configure custom agenda commands.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
More commands can be added by configuring the variable
|
|
|
|
|
`org-agenda-custom-commands'. In particular, specific tags and TODO keyword
|
|
|
|
|
searches can be pre-defined in this way.
|
|
|
|
|
|
|
|
|
|
If the current buffer is in Org-mode and visiting a file, you can also
|
|
|
|
|
first press `<' once to indicate that the agenda should be temporarily
|
|
|
|
|
\(until the next use of \\[org-agenda]) restricted to the current file.
|
|
|
|
|
Pressing `<' twice means to restrict to the current subtree or region
|
|
|
|
|
\(if active)."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(let* ((prefix-descriptions nil)
|
2012-03-03 13:57:32 +00:00
|
|
|
|
(org-agenda-buffer-name org-agenda-buffer-name)
|
2009-08-29 18:16:28 +00:00
|
|
|
|
(org-agenda-window-setup (if (equal (buffer-name)
|
|
|
|
|
org-agenda-buffer-name)
|
|
|
|
|
'current-window
|
|
|
|
|
org-agenda-window-setup))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-custom-commands-orig org-agenda-custom-commands)
|
|
|
|
|
(org-agenda-custom-commands
|
|
|
|
|
;; normalize different versions
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(cond ((stringp (cdr x))
|
|
|
|
|
(push x prefix-descriptions)
|
|
|
|
|
nil)
|
|
|
|
|
((stringp (nth 1 x)) x)
|
|
|
|
|
((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
|
|
|
|
|
(t (cons (car x) (cons "" (cdr x))))))
|
|
|
|
|
org-agenda-custom-commands)))
|
2012-08-23 09:08:47 +00:00
|
|
|
|
(org-agenda-custom-commands
|
2012-08-24 10:14:54 +00:00
|
|
|
|
(org-contextualize-keys
|
2012-08-23 09:08:47 +00:00
|
|
|
|
org-agenda-custom-commands org-agenda-custom-commands-contexts))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(buf (current-buffer))
|
|
|
|
|
(bfn (buffer-file-name (buffer-base-buffer)))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
entry key type org-match lprops ans)
|
2009-09-15 21:55:17 +00:00
|
|
|
|
;; Turn off restriction unless there is an overriding one,
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(unless org-agenda-overriding-restriction
|
2009-11-12 12:39:44 +00:00
|
|
|
|
(unless (org-bound-and-true-p org-agenda-keep-restricted-file-list)
|
2009-09-15 21:55:17 +00:00
|
|
|
|
;; There is a request to keep the file list in place
|
|
|
|
|
(put 'org-agenda-files 'org-restrict nil))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-restrict nil)
|
|
|
|
|
(move-marker org-agenda-restrict-begin nil)
|
|
|
|
|
(move-marker org-agenda-restrict-end nil))
|
|
|
|
|
;; Delete old local properties
|
|
|
|
|
(put 'org-agenda-redo-command 'org-lprops nil)
|
2011-02-18 14:15:54 +00:00
|
|
|
|
;; Delete previously set last-arguments
|
|
|
|
|
(put 'org-agenda-redo-command 'last-args nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; Remember where this call originated
|
|
|
|
|
(setq org-agenda-last-dispatch-buffer (current-buffer))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(unless org-keys
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq ans (org-agenda-get-restriction-and-command prefix-descriptions)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
org-keys (car ans)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
restriction (cdr ans)))
|
2012-08-28 12:37:33 +00:00
|
|
|
|
;; If we have sticky agenda buffers, set a name for the buffer,
|
|
|
|
|
;; depending on the invoking keys. The user may still set this
|
|
|
|
|
;; as a command option, which will overwrite what we do here.
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(setq org-agenda-buffer-name
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(format "*Org Agenda(%s)*" org-keys)))
|
2009-11-12 12:39:29 +00:00
|
|
|
|
;; Establish the restriction, if any
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when (and (not org-agenda-overriding-restriction) restriction)
|
|
|
|
|
(put 'org-agenda-files 'org-restrict (list bfn))
|
|
|
|
|
(cond
|
|
|
|
|
((eq restriction 'region)
|
|
|
|
|
(setq org-agenda-restrict t)
|
|
|
|
|
(move-marker org-agenda-restrict-begin (region-beginning))
|
|
|
|
|
(move-marker org-agenda-restrict-end (region-end)))
|
|
|
|
|
((eq restriction 'subtree)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq org-agenda-restrict t)
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(move-marker org-agenda-restrict-begin (point))
|
|
|
|
|
(move-marker org-agenda-restrict-end
|
|
|
|
|
(progn (org-end-of-subtree t)))))))
|
|
|
|
|
|
|
|
|
|
;; For example the todo list should not need it (but does...)
|
|
|
|
|
(cond
|
2012-08-28 16:26:10 +00:00
|
|
|
|
((setq entry (assoc org-keys org-agenda-custom-commands))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry)))
|
|
|
|
|
(progn
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(setq type (nth 2 entry) org-match (eval (nth 3 entry))
|
2009-10-30 07:16:00 +00:00
|
|
|
|
lprops (nth 4 entry))
|
2012-08-28 11:02:01 +00:00
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(setq org-agenda-buffer-name
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(or (and (stringp org-match) (format "*Org Agenda(%s:%s)*" org-keys org-match))
|
|
|
|
|
(format "*Org Agenda(%s)*" org-keys))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(put 'org-agenda-redo-command 'org-lprops lprops)
|
|
|
|
|
(cond
|
|
|
|
|
((eq type 'agenda)
|
|
|
|
|
(org-let lprops '(org-agenda-list current-prefix-arg)))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
((eq type 'agenda*)
|
|
|
|
|
(org-let lprops '(org-agenda-list current-prefix-arg nil nil t)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'alltodo)
|
|
|
|
|
(org-let lprops '(org-todo-list current-prefix-arg)))
|
|
|
|
|
((eq type 'search)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-search-view current-prefix-arg org-match nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'stuck)
|
|
|
|
|
(org-let lprops '(org-agenda-list-stuck-projects
|
|
|
|
|
current-prefix-arg)))
|
|
|
|
|
((eq type 'tags)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-tags-view current-prefix-arg org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'tags-todo)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-tags-view '(4) org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'todo)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-todo-list org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'tags-tree)
|
|
|
|
|
(org-check-for-org-mode)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-match-sparse-tree current-prefix-arg org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'todo-tree)
|
|
|
|
|
(org-check-for-org-mode)
|
|
|
|
|
(org-let lprops
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
|
'(org-occur (concat "^" org-outline-regexp "[ \t]*"
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(regexp-quote org-match) "\\>"))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq type 'occur-tree)
|
|
|
|
|
(org-check-for-org-mode)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(org-occur org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((functionp type)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(funcall type org-match)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((fboundp type)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(org-let lprops '(funcall type org-match)))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(t (user-error "Invalid custom agenda command type %s" type))))
|
2011-03-06 17:12:35 +00:00
|
|
|
|
(org-agenda-run-series (nth 1 entry) (cddr entry))))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
((equal org-keys "C")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-custom-commands org-agenda-custom-commands-orig)
|
|
|
|
|
(customize-variable 'org-agenda-custom-commands))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
((equal org-keys "a") (call-interactively 'org-agenda-list))
|
|
|
|
|
((equal org-keys "s") (call-interactively 'org-search-view))
|
|
|
|
|
((equal org-keys "S") (org-call-with-arg 'org-search-view (or arg '(4))))
|
|
|
|
|
((equal org-keys "t") (call-interactively 'org-todo-list))
|
|
|
|
|
((equal org-keys "T") (org-call-with-arg 'org-todo-list (or arg '(4))))
|
|
|
|
|
((equal org-keys "m") (call-interactively 'org-tags-view))
|
|
|
|
|
((equal org-keys "M") (org-call-with-arg 'org-tags-view (or arg '(4))))
|
|
|
|
|
((equal org-keys "e") (call-interactively 'org-store-agenda-views))
|
|
|
|
|
((equal org-keys "?") (org-tags-view nil "+FLAGGED")
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(org-add-hook
|
|
|
|
|
'post-command-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(unless (current-message)
|
|
|
|
|
(let* ((m (org-agenda-get-any-marker))
|
|
|
|
|
(note (and m (org-entry-get m "THEFLAGGINGNOTE"))))
|
|
|
|
|
(when note
|
|
|
|
|
(message (concat
|
|
|
|
|
"FLAGGING-NOTE ([?] for more info): "
|
|
|
|
|
(org-add-props
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\\\n" "//"
|
|
|
|
|
(copy-sequence note))
|
|
|
|
|
nil 'face 'org-warning)))))))
|
|
|
|
|
t t))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
((equal org-keys "L")
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(unless (derived-mode-p 'org-mode)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "This is not an Org-mode file"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(unless restriction
|
|
|
|
|
(put 'org-agenda-files 'org-restrict (list bfn))
|
|
|
|
|
(org-call-with-arg 'org-timeline arg)))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
((equal org-keys "#") (call-interactively 'org-agenda-list-stuck-projects))
|
|
|
|
|
((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files))
|
|
|
|
|
((equal org-keys "!") (customize-variable 'org-stuck-projects))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(t (user-error "Invalid agenda key"))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2011-02-19 11:13:42 +00:00
|
|
|
|
(defun org-agenda-append-agenda ()
|
|
|
|
|
"Append another agenda view to the current one.
|
|
|
|
|
This function allows interactive building of block agendas.
|
|
|
|
|
Agenda views are separated by `org-agenda-block-separator'."
|
|
|
|
|
(interactive)
|
2012-08-28 16:46:57 +00:00
|
|
|
|
(unless (derived-mode-p 'org-agenda-mode)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Can only append from within agenda buffer"))
|
2011-02-19 11:13:42 +00:00
|
|
|
|
(let ((org-agenda-multi t))
|
|
|
|
|
(org-agenda)
|
2012-08-28 23:05:34 +00:00
|
|
|
|
(widen)
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2013-04-10 09:40:30 +00:00
|
|
|
|
(setq buffer-read-only t)
|
2012-08-28 23:05:34 +00:00
|
|
|
|
(org-agenda-fit-window-to-buffer)))
|
2011-02-19 11:13:42 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-normalize-custom-commands (cmds)
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Normalize custom commands CMDS."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(cond ((stringp (cdr x)) nil)
|
|
|
|
|
((stringp (nth 1 x)) x)
|
|
|
|
|
((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
|
|
|
|
|
(t (cons (car x) (cons "" (cdr x))))))
|
|
|
|
|
cmds)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-get-restriction-and-command (prefix-descriptions)
|
|
|
|
|
"The user interface for selecting an agenda command."
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(let* ((bfn (buffer-file-name (buffer-base-buffer)))
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(restrict-ok (and bfn (derived-mode-p 'org-mode)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(region-p (org-region-active-p))
|
|
|
|
|
(custom org-agenda-custom-commands)
|
|
|
|
|
(selstring "")
|
|
|
|
|
restriction second-time
|
2010-08-11 07:40:57 +00:00
|
|
|
|
c entry key type match prefixes rmheader header-end custom1 desc
|
|
|
|
|
line lines left right n n1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(org-switch-to-buffer-other-window " *Agenda Commands*")
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert (eval-when-compile
|
|
|
|
|
(let ((header
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Press key for an agenda command: < Buffer, subtree/region restriction
|
2008-03-22 15:52:18 +00:00
|
|
|
|
-------------------------------- > Remove restriction
|
|
|
|
|
a Agenda for current week or day e Export agenda views
|
|
|
|
|
t List of all TODO entries T Entries with special TODO kwd
|
2008-09-17 11:39:24 +00:00
|
|
|
|
m Match a TAGS/PROP/TODO query M Like m, but only TODO entries
|
2012-08-28 10:35:05 +00:00
|
|
|
|
s Search for keywords S Like s, but only TODO entries
|
2008-03-22 15:52:18 +00:00
|
|
|
|
L Timeline for current buffer # List stuck projects (!=configure)
|
2012-08-28 10:35:05 +00:00
|
|
|
|
/ Multi-occur C Configure custom agenda commands
|
|
|
|
|
? Find :FLAGGED: entries * Toggle sticky agenda views
|
2008-03-22 15:52:18 +00:00
|
|
|
|
")
|
|
|
|
|
(start 0))
|
|
|
|
|
(while (string-match
|
|
|
|
|
"\\(^\\| \\|(\\)\\(\\S-\\)\\( \\|=\\)"
|
|
|
|
|
header start)
|
|
|
|
|
(setq start (match-end 0))
|
|
|
|
|
(add-text-properties (match-beginning 2) (match-end 2)
|
|
|
|
|
'(face bold) header))
|
|
|
|
|
header)))
|
2012-12-20 04:46:41 +00:00
|
|
|
|
(setq header-end (point-marker))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while t
|
|
|
|
|
(setq custom1 custom)
|
|
|
|
|
(when (eq rmheader t)
|
2009-08-27 08:24:09 +00:00
|
|
|
|
(org-goto-line 1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(re-search-forward ":" nil t)
|
|
|
|
|
(delete-region (match-end 0) (point-at-eol))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(looking-at "-+")
|
|
|
|
|
(delete-region (match-end 0) (point-at-eol))
|
|
|
|
|
(move-marker header-end (match-end 0)))
|
|
|
|
|
(goto-char header-end)
|
|
|
|
|
(delete-region (point) (point-max))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
|
|
|
|
|
;; Produce all the lines that describe custom commands and prefixes
|
|
|
|
|
(setq lines nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while (setq entry (pop custom1))
|
|
|
|
|
(setq key (car entry) desc (nth 1 entry)
|
2009-08-14 15:18:14 +00:00
|
|
|
|
type (nth 2 entry)
|
2009-08-18 05:30:26 +00:00
|
|
|
|
match (nth 3 entry))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (> (length key) 1)
|
|
|
|
|
(add-to-list 'prefixes (string-to-char key))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(setq line
|
|
|
|
|
(format
|
|
|
|
|
"%-4s%-14s"
|
|
|
|
|
(org-add-props (copy-sequence key)
|
|
|
|
|
'(face bold))
|
|
|
|
|
(cond
|
|
|
|
|
((string-match "\\S-" desc) desc)
|
|
|
|
|
((eq type 'agenda) "Agenda for current week or day")
|
2013-03-11 16:27:33 +00:00
|
|
|
|
((eq type 'agenda*) "Appointments for current week or day")
|
2010-08-11 07:40:57 +00:00
|
|
|
|
((eq type 'alltodo) "List of all TODO entries")
|
|
|
|
|
((eq type 'search) "Word search")
|
|
|
|
|
((eq type 'stuck) "List of stuck projects")
|
|
|
|
|
((eq type 'todo) "TODO keyword")
|
|
|
|
|
((eq type 'tags) "Tags query")
|
|
|
|
|
((eq type 'tags-todo) "Tags (TODO)")
|
|
|
|
|
((eq type 'tags-tree) "Tags tree")
|
|
|
|
|
((eq type 'todo-tree) "TODO kwd tree")
|
|
|
|
|
((eq type 'occur-tree) "Occur tree")
|
|
|
|
|
((functionp type) (if (symbolp type)
|
|
|
|
|
(symbol-name type)
|
|
|
|
|
"Lambda expression"))
|
|
|
|
|
(t "???"))))
|
2010-08-11 07:45:36 +00:00
|
|
|
|
(if org-agenda-menu-show-matcher
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(setq line
|
|
|
|
|
(concat line ": "
|
|
|
|
|
(cond
|
|
|
|
|
((stringp match)
|
|
|
|
|
(setq match (copy-sequence match))
|
|
|
|
|
(org-add-props match nil 'face 'org-warning))
|
2012-09-18 07:09:41 +00:00
|
|
|
|
((listp type)
|
|
|
|
|
(format "set of %d commands" (length type))))))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(if (org-string-nw-p match)
|
|
|
|
|
(add-text-properties
|
|
|
|
|
0 (length line) (list 'help-echo
|
2012-09-18 07:09:41 +00:00
|
|
|
|
(concat "Matcher: " match)) line)))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(push line lines)))
|
|
|
|
|
(setq lines (nreverse lines))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when prefixes
|
|
|
|
|
(mapc (lambda (x)
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(push
|
|
|
|
|
(format "%s %s"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-add-props (char-to-string x)
|
2010-08-11 07:40:57 +00:00
|
|
|
|
nil 'face 'bold)
|
|
|
|
|
(or (cdr (assoc (concat selstring
|
|
|
|
|
(char-to-string x))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
prefix-descriptions))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
"Prefix key"))
|
|
|
|
|
lines))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
prefixes))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
|
|
|
|
|
;; Check if we should display in two columns
|
2012-08-15 08:31:22 +00:00
|
|
|
|
(if org-agenda-menu-two-columns
|
2010-08-11 07:40:57 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq n (length lines)
|
|
|
|
|
n1 (+ (/ n 2) (mod n 2))
|
|
|
|
|
right (nthcdr n1 lines)
|
|
|
|
|
left (copy-sequence lines))
|
|
|
|
|
(setcdr (nthcdr (1- n1) left) nil))
|
|
|
|
|
(setq left lines right nil))
|
|
|
|
|
(while left
|
|
|
|
|
(insert "\n" (pop left))
|
|
|
|
|
(when right
|
|
|
|
|
(if (< (current-column) 40)
|
|
|
|
|
(move-to-column 40 t)
|
|
|
|
|
(insert " "))
|
|
|
|
|
(insert (pop right))))
|
|
|
|
|
|
|
|
|
|
;; Make the window the right size
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
2008-11-03 12:38:25 +00:00
|
|
|
|
(if second-time
|
|
|
|
|
(if (not (pos-visible-in-window-p (point-max)))
|
|
|
|
|
(org-fit-window-to-buffer))
|
|
|
|
|
(setq second-time t)
|
|
|
|
|
(org-fit-window-to-buffer))
|
2010-08-11 07:40:57 +00:00
|
|
|
|
|
|
|
|
|
;; Ask for selection
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Press key for agenda command%s:"
|
|
|
|
|
(if (or restrict-ok org-agenda-overriding-restriction)
|
|
|
|
|
(if org-agenda-overriding-restriction
|
|
|
|
|
" (restriction lock active)"
|
|
|
|
|
(if restriction
|
|
|
|
|
(format " (restricted to %s)" restriction)
|
|
|
|
|
" (unrestricted)"))
|
|
|
|
|
""))
|
|
|
|
|
(setq c (read-char-exclusive))
|
|
|
|
|
(message "")
|
|
|
|
|
(cond
|
|
|
|
|
((assoc (char-to-string c) custom)
|
|
|
|
|
(setq selstring (concat selstring (char-to-string c)))
|
|
|
|
|
(throw 'exit (cons selstring restriction)))
|
|
|
|
|
((memq c prefixes)
|
|
|
|
|
(setq selstring (concat selstring (char-to-string c))
|
|
|
|
|
prefixes nil
|
|
|
|
|
rmheader (or rmheader t)
|
|
|
|
|
custom (delq nil (mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(if (or (= (length (car x)) 1)
|
|
|
|
|
(/= (string-to-char (car x)) c))
|
|
|
|
|
nil
|
|
|
|
|
(cons (substring (car x) 1) (cdr x))))
|
|
|
|
|
custom))))
|
2012-03-10 06:55:00 +00:00
|
|
|
|
((eq c ?*)
|
2012-04-22 13:27:21 +00:00
|
|
|
|
(call-interactively 'org-toggle-sticky-agenda)
|
2012-03-10 06:55:00 +00:00
|
|
|
|
(sit-for 2))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((and (not restrict-ok) (memq c '(?1 ?0 ?<)))
|
|
|
|
|
(message "Restriction is only possible in Org-mode buffers")
|
|
|
|
|
(ding) (sit-for 1))
|
|
|
|
|
((eq c ?1)
|
|
|
|
|
(org-agenda-remove-restriction-lock 'noupdate)
|
|
|
|
|
(setq restriction 'buffer))
|
|
|
|
|
((eq c ?0)
|
|
|
|
|
(org-agenda-remove-restriction-lock 'noupdate)
|
|
|
|
|
(setq restriction (if region-p 'region 'subtree)))
|
|
|
|
|
((eq c ?<)
|
|
|
|
|
(org-agenda-remove-restriction-lock 'noupdate)
|
|
|
|
|
(setq restriction
|
|
|
|
|
(cond
|
|
|
|
|
((eq restriction 'buffer)
|
|
|
|
|
(if region-p 'region 'subtree))
|
|
|
|
|
((memq restriction '(subtree region))
|
|
|
|
|
nil)
|
|
|
|
|
(t 'buffer))))
|
|
|
|
|
((eq c ?>)
|
|
|
|
|
(org-agenda-remove-restriction-lock 'noupdate)
|
|
|
|
|
(setq restriction nil))
|
2012-08-28 10:35:05 +00:00
|
|
|
|
((and (equal selstring "") (memq c '(?s ?S ?a ?t ?m ?L ?C ?e ?T ?M ?# ?! ?/ ??)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(throw 'exit (cons (setq selstring (char-to-string c)) restriction)))
|
|
|
|
|
((and (> (length selstring) 0) (eq c ?\d))
|
|
|
|
|
(delete-window)
|
|
|
|
|
(org-agenda-get-restriction-and-command prefix-descriptions))
|
|
|
|
|
|
|
|
|
|
((equal c ?q) (error "Abort"))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(t (user-error "Invalid key %c" c))))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-08-28 11:36:43 +00:00
|
|
|
|
(defun org-agenda-fit-window-to-buffer ()
|
|
|
|
|
"Fit the window to the buffer size."
|
|
|
|
|
(and (memq org-agenda-window-setup '(reorganize-frame))
|
|
|
|
|
(fboundp 'fit-window-to-buffer)
|
|
|
|
|
(org-fit-window-to-buffer
|
|
|
|
|
nil
|
|
|
|
|
(floor (* (frame-height) (cdr org-agenda-window-frame-fractions)))
|
|
|
|
|
(floor (* (frame-height) (car org-agenda-window-frame-fractions))))))
|
|
|
|
|
|
2012-08-29 18:15:47 +00:00
|
|
|
|
(defvar org-cmd nil)
|
|
|
|
|
(defvar org-agenda-overriding-cmd nil)
|
|
|
|
|
(defvar org-agenda-overriding-arguments nil)
|
|
|
|
|
(defvar org-agenda-overriding-cmd-arguments nil)
|
2011-03-06 17:12:35 +00:00
|
|
|
|
(defun org-agenda-run-series (name series)
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Run agenda NAME as a SERIES of agenda commands."
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-let (nth 1 series) '(org-agenda-prepare name))
|
2012-04-13 22:15:18 +00:00
|
|
|
|
;; We need to reset agenda markers here, because when constructing a
|
2012-03-09 08:25:20 +00:00
|
|
|
|
;; block agenda, the individual blocks do not do that.
|
|
|
|
|
(org-agenda-reset-markers)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((org-agenda-multi t)
|
2011-03-06 17:12:35 +00:00
|
|
|
|
(redo (list 'org-agenda-run-series name (list 'quote series)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cmds (car series))
|
|
|
|
|
(gprops (nth 1 series))
|
|
|
|
|
match ;; The byte compiler incorrectly complains about this. Keep it!
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
org-cmd type lprops)
|
|
|
|
|
(while (setq org-cmd (pop cmds))
|
|
|
|
|
(setq type (car org-cmd)
|
|
|
|
|
match (eval (nth 1 org-cmd))
|
|
|
|
|
lprops (nth 2 org-cmd))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(let ((org-agenda-overriding-arguments
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(if (eq org-agenda-overriding-cmd org-cmd)
|
|
|
|
|
(or org-agenda-overriding-arguments
|
|
|
|
|
org-agenda-overriding-cmd-arguments))))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq type 'agenda)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(call-interactively 'org-agenda-list)))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
((eq type 'agenda*)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(funcall 'org-agenda-list nil nil t)))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
((eq type 'alltodo)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(call-interactively 'org-todo-list)))
|
|
|
|
|
((eq type 'search)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(org-search-view current-prefix-arg match nil)))
|
|
|
|
|
((eq type 'stuck)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(call-interactively 'org-agenda-list-stuck-projects)))
|
|
|
|
|
((eq type 'tags)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(org-tags-view current-prefix-arg match)))
|
|
|
|
|
((eq type 'tags-todo)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(org-tags-view '(4) match)))
|
|
|
|
|
((eq type 'todo)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(org-todo-list match)))
|
|
|
|
|
((fboundp type)
|
|
|
|
|
(org-let2 gprops lprops
|
|
|
|
|
'(funcall type match)))
|
|
|
|
|
(t (error "Invalid type in command series")))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(widen)
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(add-text-properties (point-min) (point-max)
|
2012-10-23 16:41:33 +00:00
|
|
|
|
`(org-series t org-series-redo-cmd ,redo)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-redo-command redo)
|
|
|
|
|
(goto-char (point-min)))
|
2012-08-28 11:36:43 +00:00
|
|
|
|
(org-agenda-fit-window-to-buffer)
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-let (nth 1 series) '(org-agenda-finalize)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro org-batch-agenda (cmd-key &rest parameters)
|
|
|
|
|
"Run an agenda command in batch mode and send the result to STDOUT.
|
|
|
|
|
If CMD-KEY is a string of length 1, it is used as a key in
|
|
|
|
|
`org-agenda-custom-commands' and triggers this command. If it is a
|
|
|
|
|
longer string it is used as a tags/todo match string.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
Parameters are alternating variable names and values that will be bound
|
2008-03-22 15:52:18 +00:00
|
|
|
|
before running the agenda command."
|
2011-08-10 05:56:29 +00:00
|
|
|
|
(org-eval-in-environment (org-make-parameter-alist parameters)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (> (length cmd-key) 2)
|
2011-08-10 05:56:29 +00:00
|
|
|
|
(org-tags-view nil cmd-key)
|
|
|
|
|
(org-agenda nil cmd-key)))
|
|
|
|
|
(set-buffer org-agenda-buffer-name)
|
2011-12-31 12:31:02 +00:00
|
|
|
|
(princ (buffer-string)))
|
2012-10-02 06:50:46 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-info nil)
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro org-batch-agenda-csv (cmd-key &rest parameters)
|
|
|
|
|
"Run an agenda command in batch mode and send the result to STDOUT.
|
|
|
|
|
If CMD-KEY is a string of length 1, it is used as a key in
|
|
|
|
|
`org-agenda-custom-commands' and triggers this command. If it is a
|
|
|
|
|
longer string it is used as a tags/todo match string.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
Parameters are alternating variable names and values that will be bound
|
2008-03-22 15:52:18 +00:00
|
|
|
|
before running the agenda command.
|
|
|
|
|
|
|
|
|
|
The output gives a line for each selected agenda item. Each
|
|
|
|
|
item is a list of comma-separated values, like this:
|
|
|
|
|
|
|
|
|
|
category,head,type,todo,tags,date,time,extra,priority-l,priority-n
|
|
|
|
|
|
|
|
|
|
category The category of the item
|
|
|
|
|
head The headline, without TODO kwd, TAGS and PRIORITY
|
|
|
|
|
type The type of the agenda entry, can be
|
|
|
|
|
todo selected in TODO match
|
|
|
|
|
tagsmatch selected in tags match
|
|
|
|
|
diary imported from diary
|
|
|
|
|
deadline a deadline on given date
|
|
|
|
|
scheduled scheduled on given date
|
|
|
|
|
timestamp entry has timestamp on given date
|
|
|
|
|
closed entry was closed on given date
|
|
|
|
|
upcoming-deadline warning about deadline
|
|
|
|
|
past-scheduled forwarded scheduled item
|
|
|
|
|
block entry has date block including g. date
|
|
|
|
|
todo The todo keyword, if any
|
|
|
|
|
tags All tags including inherited ones, separated by colons
|
|
|
|
|
date The relevant date, like 2007-2-14
|
|
|
|
|
time The time, like 15:00-16:50
|
|
|
|
|
extra Sting with extra planning info
|
|
|
|
|
priority-l The priority letter if any was given
|
|
|
|
|
priority-n The computed numerical priority
|
|
|
|
|
agenda-day The day in the agenda where this is listed"
|
2011-08-10 08:10:40 +00:00
|
|
|
|
(org-eval-in-environment (append '((org-agenda-remove-tags t))
|
2011-08-10 05:56:29 +00:00
|
|
|
|
(org-make-parameter-alist parameters))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (> (length cmd-key) 2)
|
2011-08-10 05:56:29 +00:00
|
|
|
|
(org-tags-view nil cmd-key)
|
|
|
|
|
(org-agenda nil cmd-key)))
|
|
|
|
|
(set-buffer org-agenda-buffer-name)
|
|
|
|
|
(let* ((lines (org-split-string (buffer-string) "\n"))
|
|
|
|
|
line)
|
|
|
|
|
(while (setq line (pop lines))
|
|
|
|
|
(catch 'next
|
|
|
|
|
(if (not (get-text-property 0 'org-category line)) (throw 'next nil))
|
|
|
|
|
(setq org-agenda-info
|
|
|
|
|
(org-fix-agenda-info (text-properties-at 0 line)))
|
|
|
|
|
(princ
|
2011-12-31 12:31:02 +00:00
|
|
|
|
(mapconcat 'org-agenda-export-csv-mapper
|
|
|
|
|
'(org-category txt type todo tags date time extra
|
|
|
|
|
priority-letter priority agenda-day)
|
|
|
|
|
","))
|
2011-08-10 05:56:29 +00:00
|
|
|
|
(princ "\n")))))
|
2012-10-02 06:50:46 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-fix-agenda-info (props)
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Make sure all properties on an agenda item have a canonical form.
|
|
|
|
|
This ensures the export commands can easily use it."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let (tmp re)
|
|
|
|
|
(when (setq tmp (plist-get props 'tags))
|
|
|
|
|
(setq props (plist-put props 'tags (mapconcat 'identity tmp ":"))))
|
|
|
|
|
(when (setq tmp (plist-get props 'date))
|
|
|
|
|
(if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp)))
|
|
|
|
|
(let ((calendar-date-display-form '(year "-" month "-" day)))
|
|
|
|
|
'((format "%4d, %9s %2s, %4s" dayname monthname day year))
|
|
|
|
|
|
|
|
|
|
(setq tmp (calendar-date-string tmp)))
|
|
|
|
|
(setq props (plist-put props 'date tmp)))
|
|
|
|
|
(when (setq tmp (plist-get props 'day))
|
|
|
|
|
(if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp)))
|
|
|
|
|
(let ((calendar-date-display-form '(year "-" month "-" day)))
|
|
|
|
|
(setq tmp (calendar-date-string tmp)))
|
|
|
|
|
(setq props (plist-put props 'day tmp))
|
|
|
|
|
(setq props (plist-put props 'agenda-day tmp)))
|
|
|
|
|
(when (setq tmp (plist-get props 'txt))
|
|
|
|
|
(when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
|
|
|
|
|
(plist-put props 'priority-letter (match-string 1 tmp))
|
|
|
|
|
(setq tmp (replace-match "" t t tmp)))
|
|
|
|
|
(when (and (setq re (plist-get props 'org-todo-regexp))
|
|
|
|
|
(setq re (concat "\\`\\.*" re " ?"))
|
|
|
|
|
(string-match re tmp))
|
|
|
|
|
(plist-put props 'todo (match-string 1 tmp))
|
|
|
|
|
(setq tmp (replace-match "" t t tmp)))
|
|
|
|
|
(plist-put props 'txt tmp)))
|
|
|
|
|
props)
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-export-csv-mapper (prop)
|
|
|
|
|
(let ((res (plist-get org-agenda-info prop)))
|
|
|
|
|
(setq res
|
|
|
|
|
(cond
|
|
|
|
|
((not res) "")
|
|
|
|
|
((stringp res) res)
|
|
|
|
|
(t (prin1-to-string res))))
|
|
|
|
|
(while (string-match "," res)
|
|
|
|
|
(setq res (replace-match ";" t t res)))
|
|
|
|
|
(org-trim res)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-store-agenda-views (&rest parameters)
|
2013-03-05 13:44:01 +00:00
|
|
|
|
"Store agenda views."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(eval (list 'org-batch-store-agenda-views)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro org-batch-store-agenda-views (&rest parameters)
|
|
|
|
|
"Run all custom agenda commands that have a file argument."
|
|
|
|
|
(let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands))
|
|
|
|
|
(pop-up-frames nil)
|
|
|
|
|
(dir default-directory)
|
2011-08-10 07:13:22 +00:00
|
|
|
|
(pars (org-make-parameter-alist parameters))
|
2012-08-28 16:26:10 +00:00
|
|
|
|
cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(while cmds
|
|
|
|
|
(setq cmd (pop cmds)
|
|
|
|
|
thiscmdkey (car cmd)
|
2012-08-28 11:02:01 +00:00
|
|
|
|
thiscmdcmd (cdr cmd)
|
|
|
|
|
match (nth 2 thiscmdcmd)
|
|
|
|
|
bufname (if org-agenda-sticky
|
|
|
|
|
(or (and (stringp match)
|
|
|
|
|
(format "*Org Agenda(%s:%s)*" thiscmdkey match))
|
|
|
|
|
(format "*Org Agenda(%s)*" thiscmdkey))
|
2012-07-30 10:19:17 +00:00
|
|
|
|
org-agenda-buffer-name)
|
2008-07-22 19:27:26 +00:00
|
|
|
|
cmd-or-set (nth 2 cmd)
|
|
|
|
|
opts (nth (if (listp cmd-or-set) 3 4) cmd)
|
|
|
|
|
files (nth (if (listp cmd-or-set) 4 5) cmd))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (stringp files) (setq files (list files)))
|
|
|
|
|
(when files
|
2011-08-10 07:13:22 +00:00
|
|
|
|
(org-eval-in-environment (append org-agenda-exporter-settings
|
|
|
|
|
opts pars)
|
|
|
|
|
(org-agenda nil thiscmdkey))
|
2012-07-30 10:19:17 +00:00
|
|
|
|
(set-buffer bufname)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while files
|
2011-08-10 07:13:22 +00:00
|
|
|
|
(org-eval-in-environment (append org-agenda-exporter-settings
|
|
|
|
|
opts pars)
|
2012-07-30 10:19:17 +00:00
|
|
|
|
(org-agenda-write (expand-file-name (pop files) dir) nil t bufname)))
|
|
|
|
|
(and (get-buffer bufname)
|
|
|
|
|
(kill-buffer bufname)))))))
|
2012-10-02 06:50:46 +00:00
|
|
|
|
|
2012-08-28 13:10:44 +00:00
|
|
|
|
(defvar org-agenda-current-span nil
|
|
|
|
|
"The current span used in the agenda view.") ; local variable in the agenda buffer
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(defun org-agenda-mark-header-line (pos)
|
|
|
|
|
"Mark the line at POS as an agenda structure header."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(put-text-property (point-at-bol) (point-at-eol)
|
|
|
|
|
'org-agenda-structural-header t)
|
|
|
|
|
(when org-agenda-title-append
|
|
|
|
|
(put-text-property (point-at-bol) (point-at-eol)
|
|
|
|
|
'org-agenda-title-append org-agenda-title-append))))
|
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-mobile-creating-agendas) ; defined in org-mobile.el
|
2011-12-28 17:07:35 +00:00
|
|
|
|
(defvar org-agenda-write-buffer-name "Agenda View")
|
2012-07-30 10:19:17 +00:00
|
|
|
|
(defun org-agenda-write (file &optional open nosettings agenda-bufname)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Write the current buffer (an agenda view) as a file.
|
|
|
|
|
Depending on the extension of the file name, plain text (.txt),
|
2013-02-08 14:06:01 +00:00
|
|
|
|
HTML (.html or .htm), PDF (.pdf) or Postscript (.ps) is produced.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
If the extension is .ics, run icalendar export over all files used
|
|
|
|
|
to construct the agenda and limit the export to entries listed in the
|
|
|
|
|
agenda now.
|
2013-02-08 14:06:01 +00:00
|
|
|
|
If the extension is .org, collect all subtrees corresponding to the
|
|
|
|
|
agenda entries and add them in an .org file.
|
2009-11-12 12:39:29 +00:00
|
|
|
|
With prefix argument OPEN, open the new file immediately.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
If NOSETTINGS is given, do not scope the settings of
|
|
|
|
|
`org-agenda-exporter-settings' into the export commands. This is used when
|
|
|
|
|
the settings have already been scoped and we do not wish to overrule other,
|
2012-07-30 10:19:17 +00:00
|
|
|
|
higher priority settings.
|
|
|
|
|
If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write."
|
2009-03-15 15:46:44 +00:00
|
|
|
|
(interactive "FWrite agenda to file: \nP")
|
2013-03-01 14:06:28 +00:00
|
|
|
|
(if (or (not (file-writable-p file))
|
|
|
|
|
(and (file-exists-p file)
|
2013-03-03 16:42:32 +00:00
|
|
|
|
(if (called-interactively-p 'any)
|
|
|
|
|
(not (y-or-n-p (format "Overwrite existing file %s? " file))))))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Cannot write agenda to file %s" file))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-let (if nosettings nil org-agenda-exporter-settings)
|
2010-08-12 21:31:09 +00:00
|
|
|
|
'(save-excursion
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-window-excursion
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(org-agenda-mark-filtered-text)
|
2013-02-08 14:06:01 +00:00
|
|
|
|
(let ((bs (copy-sequence (buffer-string))) beg content)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(org-agenda-unmark-filtered-text)
|
|
|
|
|
(with-temp-buffer
|
2011-12-28 17:07:35 +00:00
|
|
|
|
(rename-buffer org-agenda-write-buffer-name t)
|
2010-08-12 21:31:09 +00:00
|
|
|
|
(set-buffer-modified-p nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(insert bs)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(org-agenda-remove-marked-text 'org-filtered)
|
|
|
|
|
(while (setq beg (text-property-any (point-min) (point-max)
|
|
|
|
|
'org-filtered t))
|
|
|
|
|
(delete-region
|
|
|
|
|
beg (or (next-single-property-change beg 'org-filtered)
|
|
|
|
|
(point-max))))
|
2009-02-26 19:30:46 +00:00
|
|
|
|
(run-hooks 'org-agenda-before-write-hook)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(cond
|
2009-10-05 15:13:56 +00:00
|
|
|
|
((org-bound-and-true-p org-mobile-creating-agendas)
|
2009-10-11 16:09:55 +00:00
|
|
|
|
(org-mobile-write-agenda-for-mobile file))
|
2013-02-08 14:06:01 +00:00
|
|
|
|
((string-match "\\.org\\'" file)
|
|
|
|
|
(let (content p m message-log-max)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (setq p (next-single-property-change (point) 'org-hd-marker nil))
|
|
|
|
|
(goto-char p)
|
|
|
|
|
(setq m (get-text-property (point) 'org-hd-marker))
|
|
|
|
|
(when m
|
|
|
|
|
(push (save-excursion
|
|
|
|
|
(set-buffer (marker-buffer m))
|
|
|
|
|
(goto-char m)
|
2013-02-08 15:47:19 +00:00
|
|
|
|
(org-copy-subtree 1 nil t t)
|
2013-02-08 14:06:01 +00:00
|
|
|
|
org-subtree-clip)
|
|
|
|
|
content)))
|
|
|
|
|
(find-file file)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(mapcar (lambda (s) (org-paste-subtree 1 s)) (reverse content))
|
|
|
|
|
(write-file file)
|
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
(message "Org file written to %s" file)))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
((string-match "\\.html?\\'" file)
|
2010-08-19 19:52:18 +00:00
|
|
|
|
(require 'htmlize)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(set-buffer (htmlize-buffer (current-buffer)))
|
2012-09-19 10:10:20 +00:00
|
|
|
|
(when org-agenda-export-html-style
|
2008-11-01 12:48:54 +00:00
|
|
|
|
;; replace <style> section with org-agenda-export-html-style
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(kill-region (- (search-forward "<style") 6)
|
|
|
|
|
(search-forward "</style>"))
|
|
|
|
|
(insert org-agenda-export-html-style))
|
|
|
|
|
(write-file file)
|
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
(message "HTML written to %s" file))
|
|
|
|
|
((string-match "\\.ps\\'" file)
|
2009-02-26 19:31:58 +00:00
|
|
|
|
(require 'ps-print)
|
2010-08-12 21:31:09 +00:00
|
|
|
|
(ps-print-buffer-with-faces file)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(message "Postscript written to %s" file))
|
2009-02-26 19:31:58 +00:00
|
|
|
|
((string-match "\\.pdf\\'" file)
|
|
|
|
|
(require 'ps-print)
|
2010-08-12 21:31:09 +00:00
|
|
|
|
(ps-print-buffer-with-faces
|
|
|
|
|
(concat (file-name-sans-extension file) ".ps"))
|
2009-02-26 19:31:58 +00:00
|
|
|
|
(call-process "ps2pdf" nil nil nil
|
|
|
|
|
(expand-file-name
|
|
|
|
|
(concat (file-name-sans-extension file) ".ps"))
|
|
|
|
|
(expand-file-name file))
|
2010-08-19 19:54:12 +00:00
|
|
|
|
(delete-file (concat (file-name-sans-extension file) ".ps"))
|
2009-02-26 19:31:58 +00:00
|
|
|
|
(message "PDF written to %s" file))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
((string-match "\\.ics\\'" file)
|
2013-01-27 22:44:27 +00:00
|
|
|
|
(require 'ox-icalendar)
|
|
|
|
|
(org-icalendar-export-current-agenda (expand-file-name file)))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(t
|
|
|
|
|
(let ((bs (buffer-string)))
|
|
|
|
|
(find-file file)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert bs)
|
|
|
|
|
(save-buffer 0)
|
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
(message "Plain text written to %s" file))))))))
|
2012-08-01 14:32:36 +00:00
|
|
|
|
(set-buffer (or agenda-bufname
|
2012-12-19 14:30:23 +00:00
|
|
|
|
(and (org-called-interactively-p 'any) (buffer-name))
|
2012-08-01 14:32:36 +00:00
|
|
|
|
org-agenda-buffer-name)))
|
2009-03-15 15:46:44 +00:00
|
|
|
|
(when open (org-open-file file)))
|
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defvar org-agenda-tag-filter-overlays nil)
|
|
|
|
|
(defvar org-agenda-cat-filter-overlays nil)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(defvar org-agenda-re-filter-overlays nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(defun org-agenda-mark-filtered-text ()
|
|
|
|
|
"Mark all text hidden by filtering with a text property."
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda (o)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(when (equal (overlay-buffer o) (current-buffer))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
(put-text-property
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(overlay-start o) (overlay-end o)
|
2008-11-01 12:48:54 +00:00
|
|
|
|
'org-filtered t)))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(append org-agenda-tag-filter-overlays
|
2013-03-11 21:11:38 +00:00
|
|
|
|
org-agenda-cat-filter-overlays
|
|
|
|
|
org-agenda-re-filter-overlays))))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-unmark-filtered-text ()
|
|
|
|
|
"Remove the filtering text property."
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(remove-text-properties (point-min) (point-max) '(org-filtered t))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-remove-marked-text (property &optional value)
|
|
|
|
|
"Delete all text marked with VALUE of PROPERTY.
|
|
|
|
|
VALUE defaults to t."
|
2008-11-03 12:44:42 +00:00
|
|
|
|
(let (beg)
|
|
|
|
|
(setq value (or value t))
|
|
|
|
|
(while (setq beg (text-property-any (point-min) (point-max)
|
|
|
|
|
property value))
|
|
|
|
|
(delete-region
|
|
|
|
|
beg (or (next-single-property-change beg 'org-filtered)
|
|
|
|
|
(point-max))))))
|
2008-11-01 12:48:54 +00:00
|
|
|
|
|
2009-02-26 19:30:46 +00:00
|
|
|
|
(defun org-agenda-add-entry-text ()
|
|
|
|
|
"Add entry text to agenda lines.
|
|
|
|
|
This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the
|
|
|
|
|
entry text following headings shown in the agenda.
|
|
|
|
|
Drawers will be excluded, also the line with scheduling/deadline info."
|
2009-10-26 06:43:49 +00:00
|
|
|
|
(when (and (> org-agenda-add-entry-text-maxlines 0)
|
|
|
|
|
(not (org-bound-and-true-p org-mobile-creating-agendas)))
|
2009-08-27 13:18:25 +00:00
|
|
|
|
(let (m txt)
|
2009-02-27 09:36:54 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(if (not (setq m (org-get-at-bol 'org-hd-marker)))
|
2009-02-27 09:36:54 +00:00
|
|
|
|
(beginning-of-line 2)
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(setq txt (org-agenda-get-some-entry-text
|
2009-09-15 21:50:20 +00:00
|
|
|
|
m org-agenda-add-entry-text-maxlines " > "))
|
2009-02-27 09:36:54 +00:00
|
|
|
|
(end-of-line 1)
|
2010-08-21 05:09:20 +00:00
|
|
|
|
(if (string-match "\\S-" txt)
|
|
|
|
|
(insert "\n" txt)
|
2010-08-21 06:37:11 +00:00
|
|
|
|
(or (eobp) (forward-char 1))))))))
|
2009-02-26 19:30:46 +00:00
|
|
|
|
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(defun org-agenda-get-some-entry-text (marker n-lines &optional indent
|
|
|
|
|
&rest keep)
|
2009-08-24 16:43:10 +00:00
|
|
|
|
"Extract entry text from MARKER, at most N-LINES lines.
|
2009-09-15 21:50:20 +00:00
|
|
|
|
This will ignore drawers etc, just get the text.
|
|
|
|
|
If INDENT is given, prefix every line with this string. If KEEP is
|
2009-11-12 12:39:29 +00:00
|
|
|
|
given, it is a list of symbols, defining stuff that should not be
|
2009-09-15 21:50:20 +00:00
|
|
|
|
removed from the entry content. Currently only `planning' is allowed here."
|
2009-08-27 13:18:25 +00:00
|
|
|
|
(let (txt drawer-re kwd-time-re ind)
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(with-current-buffer (marker-buffer marker)
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(if (not (derived-mode-p 'org-mode))
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(setq txt "")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char marker)
|
2009-09-06 20:52:29 +00:00
|
|
|
|
(end-of-line 1)
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(setq txt (buffer-substring
|
2009-09-06 20:52:29 +00:00
|
|
|
|
(min (1+ (point)) (point-max))
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(progn (outline-next-heading) (point)))
|
|
|
|
|
drawer-re org-drawer-regexp
|
|
|
|
|
kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
|
|
|
|
|
".*\n?"))
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert txt)
|
|
|
|
|
(when org-agenda-add-entry-text-descriptive-links
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (org-activate-bracket-links (point-max))
|
|
|
|
|
(add-text-properties (match-beginning 0) (match-end 0)
|
|
|
|
|
'(face org-link))))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward org-bracket-link-regexp (point-max) t)
|
|
|
|
|
(set-text-properties (match-beginning 0) (match-end 0)
|
|
|
|
|
nil))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward drawer-re nil t)
|
|
|
|
|
(delete-region
|
|
|
|
|
(match-beginning 0)
|
|
|
|
|
(progn (re-search-forward
|
|
|
|
|
"^[ \t]*:END:.*\n?" nil 'move)
|
|
|
|
|
(point))))
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(unless (member 'planning keep)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward kwd-time-re nil t)
|
|
|
|
|
(replace-match "")))
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(goto-char (point-min))
|
2009-09-04 11:43:27 +00:00
|
|
|
|
(when org-agenda-entry-text-exclude-regexps
|
|
|
|
|
(let ((re-list org-agenda-entry-text-exclude-regexps) re)
|
|
|
|
|
(while (setq re (pop re-list))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward re nil t)
|
|
|
|
|
(replace-match "")))))
|
2009-09-06 05:05:25 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(skip-chars-backward " \t\n")
|
|
|
|
|
(if (looking-at "[ \t\n]+\\'") (replace-match ""))
|
2009-09-04 11:43:27 +00:00
|
|
|
|
|
|
|
|
|
;; find and remove min common indentation
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(untabify (point-min) (point-max))
|
|
|
|
|
(setq ind (org-get-indentation))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(unless (looking-at "[ \t]*$")
|
|
|
|
|
(setq ind (min ind (org-get-indentation))))
|
|
|
|
|
(beginning-of-line 2))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(unless (looking-at "[ \t]*$")
|
|
|
|
|
(move-to-column ind)
|
|
|
|
|
(delete-region (point-at-bol) (point)))
|
|
|
|
|
(beginning-of-line 2))
|
2009-09-04 11:43:27 +00:00
|
|
|
|
|
|
|
|
|
(run-hooks 'org-agenda-entry-text-cleanup-hook)
|
|
|
|
|
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(goto-char (point-min))
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(when indent
|
|
|
|
|
(while (and (not (eobp)) (re-search-forward "^" nil t))
|
|
|
|
|
(replace-match indent t t)))
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (looking-at "[ \t]*\n") (replace-match ""))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (> (org-current-line)
|
2009-08-27 07:56:46 +00:00
|
|
|
|
n-lines)
|
2009-08-27 08:24:09 +00:00
|
|
|
|
(org-goto-line (1+ n-lines))
|
2009-08-24 16:43:10 +00:00
|
|
|
|
(backward-char 1))
|
|
|
|
|
(setq txt (buffer-substring (point-min) (point)))))))))
|
|
|
|
|
txt))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-check-for-org-mode ()
|
|
|
|
|
"Make sure current buffer is in org-mode. Error if not."
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(or (derived-mode-p 'org-mode)
|
2009-09-24 08:09:33 +00:00
|
|
|
|
(error "Cannot execute org-mode agenda command on buffer in %s"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
major-mode)))
|
|
|
|
|
|
|
|
|
|
;;; Agenda prepare and finalize
|
|
|
|
|
|
2008-12-16 14:25:23 +00:00
|
|
|
|
(defvar org-agenda-multi nil) ; dynamically scoped
|
2012-08-28 16:29:18 +00:00
|
|
|
|
(defvar org-agenda-pre-window-conf nil)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(defvar org-agenda-columns-active nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-name nil)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defvar org-agenda-tag-filter nil)
|
|
|
|
|
(defvar org-agenda-category-filter nil)
|
2013-03-13 18:54:30 +00:00
|
|
|
|
(defvar org-agenda-regexp-filter nil)
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(defvar org-agenda-top-headline-filter nil)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defvar org-agenda-tag-filter-while-redo nil)
|
|
|
|
|
(defvar org-agenda-tag-filter-preset nil
|
2009-03-03 17:26:41 +00:00
|
|
|
|
"A preset of the tags filter used for secondary agenda filtering.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
This must be a list of strings, each string must be a single tag preceded
|
2009-03-03 17:26:41 +00:00
|
|
|
|
by \"+\" or \"-\".
|
|
|
|
|
This variable should not be set directly, but agenda custom commands can
|
2010-07-22 07:11:12 +00:00
|
|
|
|
bind it in the options section. The preset filter is a global property of
|
|
|
|
|
the entire agenda view. In a block agenda, it will not work reliably to
|
|
|
|
|
define a filter for one of the individual blocks. You need to set it in
|
|
|
|
|
the global options and expect it to be applied to the entire view.")
|
2009-03-03 17:26:41 +00:00
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defvar org-agenda-category-filter-preset nil
|
2012-01-10 10:56:15 +00:00
|
|
|
|
"A preset of the category filter used for secondary agenda filtering.
|
2011-12-31 16:10:44 +00:00
|
|
|
|
This must be a list of strings, each string must be a single category
|
|
|
|
|
preceded by \"+\" or \"-\".
|
|
|
|
|
This variable should not be set directly, but agenda custom commands can
|
|
|
|
|
bind it in the options section. The preset filter is a global property of
|
|
|
|
|
the entire agenda view. In a block agenda, it will not work reliably to
|
|
|
|
|
define a filter for one of the individual blocks. You need to set it in
|
|
|
|
|
the global options and expect it to be applied to the entire view.")
|
|
|
|
|
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(defvar org-agenda-regexp-filter-preset nil
|
|
|
|
|
"A preset of the regexp filter used for secondary agenda filtering.
|
|
|
|
|
This must be a list of strings, each string must be a single category
|
|
|
|
|
preceded by \"+\" or \"-\".
|
|
|
|
|
This variable should not be set directly, but agenda custom commands can
|
|
|
|
|
bind it in the options section. The preset filter is a global property of
|
|
|
|
|
the entire agenda view. In a block agenda, it will not work reliably to
|
|
|
|
|
define a filter for one of the individual blocks. You need to set it in
|
|
|
|
|
the global options and expect it to be applied to the entire view.")
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-use-sticky-p ()
|
2012-07-30 08:08:15 +00:00
|
|
|
|
"Return non-nil if an agenda buffer named
|
|
|
|
|
`org-agenda-buffer-name' exists and should be shown instead of
|
|
|
|
|
generating a new one."
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(and
|
|
|
|
|
;; turned off by user
|
|
|
|
|
org-agenda-sticky
|
|
|
|
|
;; For multi-agenda buffer already exists
|
|
|
|
|
(not org-agenda-multi)
|
|
|
|
|
;; buffer found
|
|
|
|
|
(get-buffer org-agenda-buffer-name)
|
|
|
|
|
;; C-u parameter is same as last call
|
|
|
|
|
(with-current-buffer (get-buffer org-agenda-buffer-name)
|
|
|
|
|
(and
|
|
|
|
|
(equal current-prefix-arg
|
|
|
|
|
org-agenda-last-prefix-arg)
|
|
|
|
|
;; In case user turned stickiness on, while having existing
|
|
|
|
|
;; Agenda buffer active, don't reuse that buffer, because it
|
|
|
|
|
;; does not have org variables local
|
|
|
|
|
org-agenda-this-buffer-is-sticky))))
|
|
|
|
|
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(defun org-agenda-prepare-window (abuf)
|
2012-07-30 08:08:15 +00:00
|
|
|
|
"Setup agenda buffer in the window."
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(let* ((awin (get-buffer-window abuf))
|
|
|
|
|
wconf)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(cond
|
|
|
|
|
((equal (current-buffer) abuf) nil)
|
|
|
|
|
(awin (select-window awin))
|
2012-03-09 13:36:03 +00:00
|
|
|
|
((not (setq wconf (current-window-configuration))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
((equal org-agenda-window-setup 'current-window)
|
|
|
|
|
(org-pop-to-buffer-same-window abuf))
|
|
|
|
|
((equal org-agenda-window-setup 'other-window)
|
|
|
|
|
(org-switch-to-buffer-other-window abuf))
|
|
|
|
|
((equal org-agenda-window-setup 'other-frame)
|
|
|
|
|
(switch-to-buffer-other-frame abuf))
|
|
|
|
|
((equal org-agenda-window-setup 'reorganize-frame)
|
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(org-switch-to-buffer-other-window abuf)))
|
|
|
|
|
;; additional test in case agenda is invoked from within agenda
|
|
|
|
|
;; buffer via elisp link
|
|
|
|
|
(unless (equal (current-buffer) abuf)
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(org-pop-to-buffer-same-window abuf))
|
2012-08-28 16:29:18 +00:00
|
|
|
|
(setq org-agenda-pre-window-conf
|
|
|
|
|
(or org-agenda-pre-window-conf wconf))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(defun org-agenda-prepare (&optional name)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(if (org-agenda-use-sticky-p)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(progn
|
2012-03-01 15:49:23 +00:00
|
|
|
|
;; Popup existing buffer
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-window (get-buffer org-agenda-buffer-name))
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(message "Sticky Agenda buffer, use `r' to refresh")
|
2012-08-28 11:36:43 +00:00
|
|
|
|
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
2012-08-28 11:31:52 +00:00
|
|
|
|
(throw 'exit "Sticky Agenda buffer, use `r' to refresh"))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(setq org-todo-keywords-for-agenda nil)
|
|
|
|
|
(setq org-drawers-for-agenda nil)
|
|
|
|
|
(unless org-agenda-persistent-filter
|
|
|
|
|
(setq org-agenda-tag-filter nil
|
2013-03-11 21:11:38 +00:00
|
|
|
|
org-agenda-category-filter nil
|
|
|
|
|
org-agenda-regexp-filter nil))
|
2012-08-21 16:12:16 +00:00
|
|
|
|
(put 'org-agenda-tag-filter :preset-filter
|
|
|
|
|
org-agenda-tag-filter-preset)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(put 'org-agenda-category-filter :preset-filter
|
|
|
|
|
org-agenda-category-filter-preset)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(put 'org-agenda-regexp-filter :preset-filter
|
|
|
|
|
org-agenda-regexp-filter-preset)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(if org-agenda-multi
|
|
|
|
|
(progn
|
|
|
|
|
(setq buffer-read-only nil)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(unless (or (bobp) org-agenda-compact-blocks
|
|
|
|
|
(not org-agenda-block-separator))
|
|
|
|
|
(insert "\n"
|
|
|
|
|
(if (stringp org-agenda-block-separator)
|
|
|
|
|
org-agenda-block-separator
|
|
|
|
|
(make-string (window-width) org-agenda-block-separator))
|
|
|
|
|
"\n"))
|
|
|
|
|
(narrow-to-region (point) (point-max)))
|
2012-04-13 22:15:18 +00:00
|
|
|
|
(setq org-done-keywords-for-agenda nil)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
2012-04-13 22:15:18 +00:00
|
|
|
|
;; Setting any org variables that are in org-agenda-local-vars
|
|
|
|
|
;; list need to be done after the prepare call
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-window (get-buffer-create org-agenda-buffer-name))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(setq buffer-read-only nil)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(org-agenda-reset-markers)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(let ((inhibit-read-only t)) (erase-buffer))
|
|
|
|
|
(org-agenda-mode)
|
|
|
|
|
(setq org-agenda-buffer (current-buffer))
|
|
|
|
|
(setq org-agenda-contributing-files nil)
|
|
|
|
|
(setq org-agenda-columns-active nil)
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-buffers (org-agenda-files nil 'ifmode))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(setq org-todo-keywords-for-agenda
|
|
|
|
|
(org-uniquify org-todo-keywords-for-agenda))
|
|
|
|
|
(setq org-done-keywords-for-agenda
|
|
|
|
|
(org-uniquify org-done-keywords-for-agenda))
|
|
|
|
|
(setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda))
|
|
|
|
|
(setq org-agenda-last-prefix-arg current-prefix-arg)
|
|
|
|
|
(setq org-agenda-this-buffer-name org-agenda-buffer-name)
|
|
|
|
|
(and name (not org-agenda-name)
|
|
|
|
|
(org-set-local 'org-agenda-name name)))
|
|
|
|
|
(setq buffer-read-only nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-08-12 22:36:15 +00:00
|
|
|
|
(defvar org-agenda-overriding-columns-format) ; From org-colview.el
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(defun org-agenda-finalize ()
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Finishing touch for the agenda buffer, called just before displaying it."
|
|
|
|
|
(unless org-agenda-multi
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(goto-char (point-min))
|
2012-12-20 14:34:10 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(while (org-activate-bracket-links (point-max))
|
|
|
|
|
(add-text-properties (match-beginning 0) (match-end 0)
|
|
|
|
|
'(face org-link))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (org-activate-plain-links (point-max))
|
|
|
|
|
(add-text-properties (match-beginning 0) (match-end 0)
|
|
|
|
|
'(face org-link))))
|
2013-01-08 13:29:29 +00:00
|
|
|
|
(unless (eq org-agenda-remove-tags t)
|
2013-01-06 08:20:30 +00:00
|
|
|
|
(org-agenda-align-tags))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(unless org-agenda-with-colors
|
2013-01-08 17:39:45 +00:00
|
|
|
|
(remove-text-properties (point-min) (point-max) '(face nil)))
|
|
|
|
|
(if (and (boundp 'org-agenda-overriding-columns-format)
|
|
|
|
|
org-agenda-overriding-columns-format)
|
|
|
|
|
(org-set-local 'org-agenda-overriding-columns-format
|
|
|
|
|
org-agenda-overriding-columns-format))
|
|
|
|
|
(if (and (boundp 'org-agenda-view-columns-initially)
|
|
|
|
|
org-agenda-view-columns-initially)
|
|
|
|
|
(org-agenda-columns))
|
|
|
|
|
(when org-agenda-fontify-priorities
|
|
|
|
|
(org-agenda-fontify-priorities))
|
|
|
|
|
(when (and org-agenda-dim-blocked-tasks org-blocker-hook)
|
|
|
|
|
(org-agenda-dim-blocked-tasks))
|
|
|
|
|
;; We need to widen when `org-agenda-finalize' is called from
|
|
|
|
|
;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in')
|
|
|
|
|
(when org-clock-current-task
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(org-agenda-mark-clocking-task)))
|
|
|
|
|
(when org-agenda-entry-text-mode
|
|
|
|
|
(org-agenda-entry-text-hide)
|
|
|
|
|
(org-agenda-entry-text-show))
|
|
|
|
|
(if (and (functionp 'org-habit-insert-consistency-graphs)
|
|
|
|
|
(save-excursion (next-single-property-change (point-min) 'org-habit-p)))
|
|
|
|
|
(org-habit-insert-consistency-graphs))
|
|
|
|
|
(setq org-agenda-type (org-get-at-bol 'org-agenda-type))
|
2013-01-11 16:15:17 +00:00
|
|
|
|
(unless (or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq org-agenda-type org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(and (listp org-agenda-use-tag-inheritance)
|
|
|
|
|
(not (memq org-agenda-type
|
|
|
|
|
org-agenda-use-tag-inheritance))))))
|
2013-01-08 17:39:45 +00:00
|
|
|
|
(let (mrk)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (equal (forward-line) 0)
|
|
|
|
|
(when (setq mrk (or (get-text-property (point) 'org-hd-marker)
|
|
|
|
|
(get-text-property (point) 'org-hd-marker)))
|
|
|
|
|
(put-text-property (point-at-bol) (point-at-eol)
|
|
|
|
|
'tags (org-with-point-at mrk
|
|
|
|
|
(delete-dups
|
|
|
|
|
(mapcar 'downcase (org-get-tags-at))))))))))
|
|
|
|
|
(run-hooks 'org-agenda-finalize-hook)
|
|
|
|
|
(when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter))
|
|
|
|
|
(org-agenda-filter-apply org-agenda-tag-filter 'tag))
|
|
|
|
|
(when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter))
|
|
|
|
|
(org-agenda-filter-apply org-agenda-category-filter 'category))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(when (or org-agenda-regexp-filter (get 'org-agenda-regexp-filter :preset-filter))
|
|
|
|
|
(org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
|
2013-01-08 17:39:45 +00:00
|
|
|
|
(org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-08-07 09:00:16 +00:00
|
|
|
|
(defun org-agenda-mark-clocking-task ()
|
|
|
|
|
"Mark the current clock entry in the agenda if it is present."
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(org-agenda-unmark-clocking-task)
|
2009-08-07 09:00:16 +00:00
|
|
|
|
(when (marker-buffer org-clock-hd-marker)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let (s ov)
|
|
|
|
|
(while (setq s (next-single-property-change (point) 'org-hd-marker))
|
|
|
|
|
(goto-char s)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(when (equal (org-get-at-bol 'org-hd-marker)
|
2009-08-07 09:00:16 +00:00
|
|
|
|
org-clock-hd-marker)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(setq ov (make-overlay (point-at-bol) (1+ (point-at-eol))))
|
|
|
|
|
(overlay-put ov 'type 'org-agenda-clocking)
|
|
|
|
|
(overlay-put ov 'face 'org-agenda-clocking)
|
|
|
|
|
(overlay-put ov 'help-echo
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"The clock is running in this item")))))))
|
2009-08-07 09:00:16 +00:00
|
|
|
|
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(defun org-agenda-unmark-clocking-task ()
|
|
|
|
|
"Unmark the current clocking task."
|
|
|
|
|
(mapc (lambda (o)
|
|
|
|
|
(if (eq (overlay-get o 'type) 'org-agenda-clocking)
|
|
|
|
|
(delete-overlay o)))
|
|
|
|
|
(overlays-in (point-min) (point-max))))
|
|
|
|
|
|
2009-03-03 11:44:53 +00:00
|
|
|
|
(defun org-agenda-fontify-priorities ()
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Make highest priority lines bold, and lowest italic."
|
|
|
|
|
(interactive)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority)
|
|
|
|
|
(delete-overlay o)))
|
2010-04-20 10:17:06 +00:00
|
|
|
|
(overlays-in (point-min) (point-max)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
2013-01-24 13:16:11 +00:00
|
|
|
|
(let (b e p ov h l)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward "\\[#\\(.\\)\\]" nil t)
|
|
|
|
|
(setq h (or (get-char-property (point) 'org-highest-priority)
|
|
|
|
|
org-highest-priority)
|
|
|
|
|
l (or (get-char-property (point) 'org-lowest-priority)
|
|
|
|
|
org-lowest-priority)
|
|
|
|
|
p (string-to-char (match-string 1))
|
2009-03-03 11:44:53 +00:00
|
|
|
|
b (match-beginning 0)
|
|
|
|
|
e (if (eq org-agenda-fontify-priorities 'cookies)
|
|
|
|
|
(match-end 0)
|
|
|
|
|
(point-at-eol))
|
2010-04-18 14:37:42 +00:00
|
|
|
|
ov (make-overlay b e))
|
|
|
|
|
(overlay-put
|
2008-03-22 15:52:18 +00:00
|
|
|
|
ov 'face
|
2013-01-24 13:16:11 +00:00
|
|
|
|
(cons (cond ((org-face-from-face-or-color
|
|
|
|
|
'priority nil
|
|
|
|
|
(cdr (assoc p org-priority-faces))))
|
|
|
|
|
((and (listp org-agenda-fontify-priorities)
|
|
|
|
|
(org-face-from-face-or-color
|
|
|
|
|
'priority nil
|
|
|
|
|
(cdr (assoc p org-agenda-fontify-priorities)))))
|
|
|
|
|
((equal p l) 'italic)
|
|
|
|
|
((equal p h) 'bold))
|
|
|
|
|
'org-priority))
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(overlay-put ov 'org-type 'org-priority)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2013-01-06 11:31:20 +00:00
|
|
|
|
(defun org-agenda-dim-blocked-tasks (&optional invisible)
|
2013-04-05 06:36:17 +00:00
|
|
|
|
"Dim currently blocked TODO's in the agenda display.
|
|
|
|
|
When INVISIBLE is non-nil, hide currently blocked TODO instead of
|
|
|
|
|
dimming them."
|
2013-03-19 08:57:11 +00:00
|
|
|
|
(interactive "P")
|
2013-03-19 12:05:36 +00:00
|
|
|
|
(when (org-called-interactively-p 'interactive)
|
2013-03-19 08:57:11 +00:00
|
|
|
|
(message "Dim or hide blocked tasks..."))
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo)
|
|
|
|
|
(delete-overlay o)))
|
2010-04-20 10:17:06 +00:00
|
|
|
|
(overlays-in (point-min) (point-max)))
|
2009-01-27 16:56:27 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((inhibit-read-only t)
|
2009-01-31 23:15:29 +00:00
|
|
|
|
(org-depend-tag-blocked nil)
|
2013-01-06 11:31:20 +00:00
|
|
|
|
(invis (or (not (null invisible))
|
|
|
|
|
(eq org-agenda-dim-blocked-tasks 'invisible)))
|
2009-02-19 10:12:52 +00:00
|
|
|
|
org-blocked-by-checkboxes
|
|
|
|
|
invis1 b e p ov h l)
|
2009-01-27 16:56:27 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (let ((pos (next-single-property-change (point) 'todo-state)))
|
|
|
|
|
(and pos (goto-char (1+ pos))))
|
2009-02-19 10:12:52 +00:00
|
|
|
|
(setq org-blocked-by-checkboxes nil invis1 invis)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let ((marker (org-get-at-bol 'org-hd-marker)))
|
2009-01-27 16:56:27 +00:00
|
|
|
|
(when (and marker
|
2011-08-24 14:35:36 +00:00
|
|
|
|
(with-current-buffer (marker-buffer marker)
|
|
|
|
|
(save-excursion (goto-char marker)
|
|
|
|
|
(org-entry-blocked-p))))
|
2009-02-19 10:12:52 +00:00
|
|
|
|
(if org-blocked-by-checkboxes (setq invis1 nil))
|
2009-09-03 04:18:38 +00:00
|
|
|
|
(setq b (if invis1
|
|
|
|
|
(max (point-min) (1- (point-at-bol)))
|
|
|
|
|
(point-at-bol))
|
2009-01-27 16:56:27 +00:00
|
|
|
|
e (point-at-eol)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
ov (make-overlay b e))
|
2009-02-19 10:12:52 +00:00
|
|
|
|
(if invis1
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(overlay-put ov 'invisible t)
|
|
|
|
|
(overlay-put ov 'face 'org-agenda-dimmed-todo-face))
|
2013-01-06 11:31:20 +00:00
|
|
|
|
(overlay-put ov 'org-type 'org-blocked-todo))))))
|
2013-03-19 12:05:36 +00:00
|
|
|
|
(when (org-called-interactively-p 'interactive)
|
|
|
|
|
(message "Dim or hide blocked tasks...done")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defvar org-agenda-skip-function nil
|
|
|
|
|
"Function to be called at each match during agenda construction.
|
|
|
|
|
If this function returns nil, the current match should not be skipped.
|
|
|
|
|
Otherwise, the function must return a position from where the search
|
|
|
|
|
should be continued.
|
|
|
|
|
This may also be a Lisp form, it will be evaluated.
|
|
|
|
|
Never set this variable using `setq' or so, because then it will apply
|
2011-01-14 10:01:01 +00:00
|
|
|
|
to all future agenda commands. If you do want a global skipping condition,
|
|
|
|
|
use the option `org-agenda-skip-function-global' instead.
|
|
|
|
|
The correct usage for `org-agenda-skip-function' is to bind it with
|
|
|
|
|
`let' to scope it dynamically into the agenda-constructing command.
|
|
|
|
|
A good way to set it is through options in `org-agenda-custom-commands'.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-skip ()
|
|
|
|
|
"Throw to `:skip' in places that should be skipped.
|
|
|
|
|
Also moves point to the end of the skipped region, so that search can
|
|
|
|
|
continue from there."
|
2011-01-14 10:01:01 +00:00
|
|
|
|
(let ((p (point-at-bol)) to)
|
2013-01-22 15:39:23 +00:00
|
|
|
|
(when (or
|
2013-01-26 09:55:35 +00:00
|
|
|
|
(save-excursion (goto-char p) (looking-at comment-start-skip))
|
2013-01-22 15:39:23 +00:00
|
|
|
|
(and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
|
|
|
|
|
(get-text-property p :org-archived)
|
|
|
|
|
(org-end-of-subtree t))
|
|
|
|
|
(and org-agenda-skip-comment-trees
|
|
|
|
|
(get-text-property p :org-comment)
|
|
|
|
|
(org-end-of-subtree t))
|
|
|
|
|
(and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global)
|
|
|
|
|
(org-agenda-skip-eval org-agenda-skip-function)))
|
|
|
|
|
(goto-char to))
|
|
|
|
|
(org-in-src-block-p t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(throw :skip t))))
|
|
|
|
|
|
2011-01-14 10:01:01 +00:00
|
|
|
|
(defun org-agenda-skip-eval (form)
|
|
|
|
|
"If FORM is a function or a list, call (or eval) is and return result.
|
|
|
|
|
`save-excursion' and `save-match-data' are wrapped around the call, so point
|
|
|
|
|
and match data are returned to the previous state no matter what these
|
|
|
|
|
functions do."
|
|
|
|
|
(let (fp)
|
|
|
|
|
(and form
|
|
|
|
|
(or (setq fp (functionp form))
|
|
|
|
|
(consp form))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-match-data
|
|
|
|
|
(if fp
|
|
|
|
|
(funcall form)
|
|
|
|
|
(eval form)))))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-markers nil
|
|
|
|
|
"List of all currently active markers created by `org-agenda'.")
|
2009-09-02 12:37:47 +00:00
|
|
|
|
(defvar org-agenda-last-marker-time (org-float-time)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Creation time of the last agenda marker.")
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-new-marker (&optional pos)
|
|
|
|
|
"Return a new agenda marker.
|
|
|
|
|
Org-mode keeps a list of these markers and resets them when they are
|
|
|
|
|
no longer in use."
|
|
|
|
|
(let ((m (copy-marker (or pos (point)))))
|
2009-09-02 12:37:47 +00:00
|
|
|
|
(setq org-agenda-last-marker-time (org-float-time))
|
2012-04-17 09:25:22 +00:00
|
|
|
|
(if org-agenda-buffer
|
2012-04-16 22:52:39 +00:00
|
|
|
|
(with-current-buffer org-agenda-buffer
|
|
|
|
|
(push m org-agenda-markers))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(push m org-agenda-markers))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
m))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-reset-markers ()
|
|
|
|
|
"Reset markers created by `org-agenda'."
|
|
|
|
|
(while org-agenda-markers
|
|
|
|
|
(move-marker (pop org-agenda-markers) nil)))
|
|
|
|
|
|
2008-05-02 07:01:56 +00:00
|
|
|
|
(defun org-agenda-save-markers-for-cut-and-paste (beg end)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
"Save relative positions of markers in region.
|
|
|
|
|
This check for agenda markers in all agenda buffers currently active."
|
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(when (eq major-mode 'org-agenda-mode)
|
|
|
|
|
(mapc (lambda (m) (org-check-and-save-marker m beg end))
|
|
|
|
|
org-agenda-markers)))))
|
2008-05-02 07:01:56 +00:00
|
|
|
|
|
2009-08-27 07:56:46 +00:00
|
|
|
|
;;; Entry text mode
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-entry-text-show-here ()
|
2009-11-12 12:39:29 +00:00
|
|
|
|
"Add some text from the entry as context to the current line."
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(let (m txt o)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(setq m (org-get-at-bol 'org-hd-marker))
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(unless (marker-buffer m)
|
|
|
|
|
(error "No marker points to an entry here"))
|
|
|
|
|
(setq txt (concat "\n" (org-no-properties
|
|
|
|
|
(org-agenda-get-some-entry-text
|
2013-03-01 16:27:50 +00:00
|
|
|
|
m org-agenda-entry-text-maxlines
|
|
|
|
|
org-agenda-entry-text-leaders))))
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(when (string-match "\\S-" txt)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(setq o (make-overlay (point-at-bol) (point-at-eol)))
|
|
|
|
|
(overlay-put o 'evaporate t)
|
|
|
|
|
(overlay-put o 'org-overlay-type 'agenda-entry-content)
|
|
|
|
|
(overlay-put o 'after-string txt))))
|
2009-08-27 07:56:46 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-entry-text-show ()
|
|
|
|
|
"Add entry context for all agenda lines."
|
|
|
|
|
(interactive)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(while (not (bobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(when (org-get-at-bol 'org-hd-marker)
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(org-agenda-entry-text-show-here))
|
|
|
|
|
(beginning-of-line 0))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-entry-text-hide ()
|
|
|
|
|
"Remove any shown entry context."
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar (lambda (o)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(if (eq (overlay-get o 'org-overlay-type)
|
2009-08-27 07:56:46 +00:00
|
|
|
|
'agenda-entry-content)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(progn (delete-overlay o) t)))
|
2010-04-20 10:17:06 +00:00
|
|
|
|
(overlays-in (point-min) (point-max)))))
|
2009-08-27 07:56:46 +00:00
|
|
|
|
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(defun org-agenda-get-day-face (date)
|
|
|
|
|
"Return the face DATE should be displayed with."
|
|
|
|
|
(or (and (functionp org-agenda-day-face-function)
|
|
|
|
|
(funcall org-agenda-day-face-function date))
|
|
|
|
|
(cond ((org-agenda-todayp date)
|
|
|
|
|
'org-agenda-date-today)
|
|
|
|
|
((member (calendar-day-of-week date) org-agenda-weekend-days)
|
|
|
|
|
'org-agenda-date-weekend)
|
|
|
|
|
(t 'org-agenda-date))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;; Agenda timeline
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-only-exact-dates nil) ; dynamically scoped
|
|
|
|
|
|
2011-08-19 10:13:36 +00:00
|
|
|
|
(defun org-timeline (&optional dotodo)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Show a time-sorted view of the entries in the current org file.
|
|
|
|
|
Only entries with a time stamp of today or later will be listed. With
|
|
|
|
|
\\[universal-argument] prefix, all unfinished TODO items will also be shown,
|
|
|
|
|
under the current date.
|
|
|
|
|
If the buffer contains an active region, only check the region for
|
|
|
|
|
dates."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let* ((dopast t)
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(org-agenda-show-log-scoped org-agenda-show-log)
|
2013-04-13 09:46:16 +00:00
|
|
|
|
(org-agenda-show-log org-agenda-show-log-scoped)
|
2010-08-07 06:23:33 +00:00
|
|
|
|
(entry (buffer-file-name (or (buffer-base-buffer (current-buffer))
|
|
|
|
|
(current-buffer))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(date (calendar-current-date))
|
|
|
|
|
(beg (if (org-region-active-p) (region-beginning) (point-min)))
|
|
|
|
|
(end (if (org-region-active-p) (region-end) (point-max)))
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(day-numbers (org-get-all-dates
|
|
|
|
|
beg end 'no-ranges
|
|
|
|
|
t org-agenda-show-log-scoped ; always include today
|
|
|
|
|
org-timeline-show-empty-dates))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-deadline-warning-days 0)
|
|
|
|
|
(org-agenda-only-exact-dates t)
|
2010-11-29 19:18:31 +00:00
|
|
|
|
(today (org-today))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(past t)
|
|
|
|
|
args
|
2010-11-12 15:34:24 +00:00
|
|
|
|
s e rtn d emptyp)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-redo-command
|
2013-04-13 09:46:16 +00:00
|
|
|
|
(list 'let
|
|
|
|
|
(list (list 'org-agenda-show-log 'org-agenda-show-log))
|
|
|
|
|
(list 'org-switch-to-buffer-other-window (current-buffer))
|
|
|
|
|
(list 'org-timeline (list 'quote dotodo))))
|
|
|
|
|
(put 'org-agenda-redo-command 'org-lprops nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (not dopast)
|
|
|
|
|
;; Remove past dates from the list of dates.
|
|
|
|
|
(setq day-numbers (delq nil (mapcar (lambda(x)
|
|
|
|
|
(if (>= x today) x nil))
|
|
|
|
|
day-numbers))))
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare (concat "Timeline " (file-name-nondirectory entry)))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(org-compile-prefix-format 'timeline)
|
|
|
|
|
(org-set-sorting-strategy 'timeline)
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(if org-agenda-show-log-scoped (push :closed args))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(push :timestamp args)
|
|
|
|
|
(push :deadline args)
|
|
|
|
|
(push :scheduled args)
|
|
|
|
|
(push :sexp args)
|
|
|
|
|
(if dotodo (push :todo args))
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(insert "Timeline of file " entry "\n")
|
|
|
|
|
(add-text-properties (point-min) (point)
|
|
|
|
|
(list 'face 'org-agenda-structure))
|
|
|
|
|
(org-agenda-mark-header-line (point-min))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while (setq d (pop day-numbers))
|
|
|
|
|
(if (and (listp d) (eq (car d) :omitted))
|
|
|
|
|
(progn
|
|
|
|
|
(setq s (point))
|
|
|
|
|
(insert (format "\n[... %d empty days omitted]\n\n" (cdr d)))
|
|
|
|
|
(put-text-property s (1- (point)) 'face 'org-agenda-structure))
|
|
|
|
|
(if (listp d) (setq d (car d) emptyp t) (setq emptyp nil))
|
|
|
|
|
(if (and (>= d today)
|
|
|
|
|
dopast
|
|
|
|
|
past)
|
|
|
|
|
(progn
|
|
|
|
|
(setq past nil)
|
|
|
|
|
(insert (make-string 79 ?-) "\n")))
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(setq date (calendar-gregorian-from-absolute d))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq s (point))
|
|
|
|
|
(setq rtn (and (not emptyp)
|
|
|
|
|
(apply 'org-agenda-get-day-entries entry
|
|
|
|
|
date args)))
|
|
|
|
|
(if (or rtn (equal d today) org-timeline-show-empty-dates)
|
|
|
|
|
(progn
|
|
|
|
|
(insert
|
|
|
|
|
(if (stringp org-agenda-format-date)
|
|
|
|
|
(format-time-string org-agenda-format-date
|
|
|
|
|
(org-time-from-absolute date))
|
|
|
|
|
(funcall org-agenda-format-date date))
|
|
|
|
|
"\n")
|
2008-04-08 14:14:14 +00:00
|
|
|
|
(put-text-property s (1- (point)) 'face
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(org-agenda-get-day-face date))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(put-text-property s (1- (point)) 'org-date-line t)
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(put-text-property s (1- (point)) 'org-agenda-date-header t)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (equal d today)
|
|
|
|
|
(put-text-property s (1- (point)) 'org-today t))
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(and rtn (insert (org-agenda-finalize-entries rtn 'timeline) "\n"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(put-text-property s (1- (point)) 'day d)))))
|
|
|
|
|
(goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
|
|
|
|
|
(point-min)))
|
2013-04-13 09:46:16 +00:00
|
|
|
|
(add-text-properties
|
|
|
|
|
(point-min) (point-max)
|
|
|
|
|
`(org-agenda-type timeline org-redo-cmd ,org-agenda-redo-command))
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq buffer-read-only t)))
|
|
|
|
|
|
|
|
|
|
(defun org-get-all-dates (beg end &optional no-ranges force-today inactive empty pre-re)
|
|
|
|
|
"Return a list of all relevant day numbers from BEG to END buffer positions.
|
|
|
|
|
If NO-RANGES is non-nil, include only the start and end dates of a range,
|
|
|
|
|
not every single day in the range. If FORCE-TODAY is non-nil, make
|
|
|
|
|
sure that TODAY is included in the list. If INACTIVE is non-nil, also
|
|
|
|
|
inactive time stamps (those in square brackets) are included.
|
|
|
|
|
When EMPTY is non-nil, also include days without any entries."
|
|
|
|
|
(let ((re (concat
|
|
|
|
|
(if pre-re pre-re "")
|
|
|
|
|
(if inactive org-ts-regexp-both org-ts-regexp)))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
dates dates1 date day day1 day2 ts1 ts2 pos)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if force-today
|
2010-11-29 19:18:31 +00:00
|
|
|
|
(setq dates (list (org-today))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(while (re-search-forward re end t)
|
|
|
|
|
(setq day (time-to-days (org-time-string-to-time
|
2011-10-04 12:12:11 +00:00
|
|
|
|
(substring (match-string 1) 0 10)
|
|
|
|
|
(current-buffer) (match-beginning 0))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(or (memq day dates) (push day dates)))
|
|
|
|
|
(unless no-ranges
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(while (re-search-forward org-tr-regexp end t)
|
2011-10-04 12:12:11 +00:00
|
|
|
|
(setq pos (match-beginning 0))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq ts1 (substring (match-string 1) 0 10)
|
|
|
|
|
ts2 (substring (match-string 2) 0 10)
|
2011-10-04 12:12:11 +00:00
|
|
|
|
day1 (time-to-days (org-time-string-to-time
|
|
|
|
|
ts1 (current-buffer) pos))
|
|
|
|
|
day2 (time-to-days (org-time-string-to-time
|
|
|
|
|
ts2 (current-buffer) pos)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while (< (setq day1 (1+ day1)) day2)
|
|
|
|
|
(or (memq day1 dates) (push day1 dates)))))
|
|
|
|
|
(setq dates (sort dates '<))
|
|
|
|
|
(when empty
|
|
|
|
|
(while (setq day (pop dates))
|
|
|
|
|
(setq day2 (car dates))
|
|
|
|
|
(push day dates1)
|
|
|
|
|
(when (and day2 empty)
|
|
|
|
|
(if (or (eq empty t)
|
|
|
|
|
(and (numberp empty) (<= (- day2 day) empty)))
|
|
|
|
|
(while (< (setq day (1+ day)) day2)
|
|
|
|
|
(push (list day) dates1))
|
|
|
|
|
(push (cons :omitted (- day2 day)) dates1))))
|
|
|
|
|
(setq dates (nreverse dates1)))
|
|
|
|
|
dates)))
|
|
|
|
|
|
|
|
|
|
;;; Agenda Daily/Weekly
|
|
|
|
|
|
2009-03-03 17:26:41 +00:00
|
|
|
|
(defvar org-agenda-start-day nil ; dynamically scoped parameter
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Start day for the agenda view.
|
2013-02-22 12:04:40 +00:00
|
|
|
|
Custom commands can set this variable in the options section.
|
2013-04-03 16:05:19 +00:00
|
|
|
|
This is usually a string like \"2007-11-01\", \"+2d\" or any other
|
|
|
|
|
input allowed when reading a date through the Org calendar.
|
|
|
|
|
See the docstring of `org-read-date' for details.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-starting-day nil) ; local variable in the agenda buffer
|
2011-08-19 10:13:36 +00:00
|
|
|
|
(defvar org-arg-loc nil) ; local variable
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-08-30 10:11:57 +00:00
|
|
|
|
(defvar org-agenda-buffer-tmp-name nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;###autoload
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(defun org-agenda-list (&optional arg start-day span with-hour)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Produce a daily/weekly view from all files in variable `org-agenda-files'.
|
|
|
|
|
The view will be for the current day or week, but from the overview buffer
|
|
|
|
|
you will be able to go to other days/weeks.
|
|
|
|
|
|
|
|
|
|
With a numeric prefix argument in an interactive call, the agenda will
|
2011-08-19 10:13:36 +00:00
|
|
|
|
span ARG days. Lisp programs should instead specify SPAN to change
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
the number of days. SPAN defaults to `org-agenda-span'.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
START-DAY defaults to TODAY, or to the most recent match for the weekday
|
2013-03-11 16:27:33 +00:00
|
|
|
|
given in `org-agenda-start-on-weekday'.
|
|
|
|
|
|
|
|
|
|
When WITH-HOUR is non-nil, only include scheduled and deadline
|
|
|
|
|
items if they have an hour specification like [h]h:mm."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(if org-agenda-overriding-arguments
|
|
|
|
|
(setq arg (car org-agenda-overriding-arguments)
|
|
|
|
|
start-day (nth 1 org-agenda-overriding-arguments)
|
|
|
|
|
span (nth 2 org-agenda-overriding-arguments)))
|
2011-08-19 10:13:36 +00:00
|
|
|
|
(if (and (integerp arg) (> arg 0))
|
|
|
|
|
(setq span arg arg nil))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(catch 'exit
|
2012-08-30 09:52:16 +00:00
|
|
|
|
(setq org-agenda-buffer-name
|
|
|
|
|
(or org-agenda-buffer-tmp-name
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(cond ((and org-keys (stringp org-match))
|
|
|
|
|
(format "*Org Agenda(%s:%s)*" org-keys org-match))
|
|
|
|
|
(org-keys
|
|
|
|
|
(format "*Org Agenda(%s)*" org-keys))
|
|
|
|
|
(t "*Org Agenda(a)*")))
|
|
|
|
|
org-agenda-buffer-name))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(org-agenda-prepare "Day/Week")
|
|
|
|
|
(setq start-day (or start-day org-agenda-start-day))
|
|
|
|
|
(if (stringp start-day)
|
|
|
|
|
;; Convert to an absolute day number
|
|
|
|
|
(setq start-day (time-to-days (org-read-date nil t start-day))))
|
|
|
|
|
(org-compile-prefix-format 'agenda)
|
|
|
|
|
(org-set-sorting-strategy 'agenda)
|
|
|
|
|
(let* ((span (org-agenda-ndays-to-span
|
|
|
|
|
(or span org-agenda-ndays org-agenda-span)))
|
|
|
|
|
(today (org-today))
|
|
|
|
|
(sd (or start-day today))
|
|
|
|
|
(ndays (org-agenda-span-to-ndays span sd))
|
|
|
|
|
(org-agenda-start-on-weekday
|
|
|
|
|
(if (eq ndays 7)
|
|
|
|
|
org-agenda-start-on-weekday))
|
|
|
|
|
(thefiles (org-agenda-files nil 'ifmode))
|
|
|
|
|
(files thefiles)
|
|
|
|
|
(start (if (or (null org-agenda-start-on-weekday)
|
|
|
|
|
(< ndays 7))
|
|
|
|
|
sd
|
|
|
|
|
(let* ((nt (calendar-day-of-week
|
|
|
|
|
(calendar-gregorian-from-absolute sd)))
|
|
|
|
|
(n1 org-agenda-start-on-weekday)
|
|
|
|
|
(d (- nt n1)))
|
|
|
|
|
(- sd (+ (if (< d 0) 7 0) d)))))
|
|
|
|
|
(day-numbers (list start))
|
|
|
|
|
(day-cnt 0)
|
|
|
|
|
(inhibit-redisplay (not debug-on-error))
|
|
|
|
|
(org-agenda-show-log-scoped org-agenda-show-log)
|
|
|
|
|
s e rtn rtnall file date d start-pos end-pos todayp
|
|
|
|
|
clocktable-start clocktable-end filter)
|
|
|
|
|
(setq org-agenda-redo-command
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(list 'org-agenda-list (list 'quote arg) start-day (list 'quote span) with-hour))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(dotimes (n (1- ndays))
|
|
|
|
|
(push (1+ (car day-numbers)) day-numbers))
|
|
|
|
|
(setq day-numbers (nreverse day-numbers))
|
|
|
|
|
(setq clocktable-start (car day-numbers)
|
|
|
|
|
clocktable-end (1+ (or (org-last day-numbers) 0)))
|
|
|
|
|
(org-set-local 'org-starting-day (car day-numbers))
|
|
|
|
|
(org-set-local 'org-arg-loc arg)
|
|
|
|
|
(org-set-local 'org-agenda-current-span (org-agenda-ndays-to-span span))
|
|
|
|
|
(unless org-agenda-compact-blocks
|
|
|
|
|
(let* ((d1 (car day-numbers))
|
|
|
|
|
(d2 (org-last day-numbers))
|
|
|
|
|
(w1 (org-days-to-iso-week d1))
|
|
|
|
|
(w2 (org-days-to-iso-week d2)))
|
|
|
|
|
(setq s (point))
|
|
|
|
|
(if org-agenda-overriding-header
|
|
|
|
|
(insert (org-add-props (copy-sequence org-agenda-overriding-header)
|
|
|
|
|
nil 'face 'org-agenda-structure) "\n")
|
|
|
|
|
(insert (org-agenda-span-name span)
|
|
|
|
|
"-agenda"
|
|
|
|
|
(if (< (- d2 d1) 350)
|
|
|
|
|
(if (= w1 w2)
|
|
|
|
|
(format " (W%02d)" w1)
|
|
|
|
|
(format " (W%02d-W%02d)" w1 w2))
|
|
|
|
|
"")
|
|
|
|
|
":\n")))
|
|
|
|
|
(add-text-properties s (1- (point)) (list 'face 'org-agenda-structure
|
|
|
|
|
'org-date-line t))
|
|
|
|
|
(org-agenda-mark-header-line s))
|
|
|
|
|
(while (setq d (pop day-numbers))
|
|
|
|
|
(setq date (calendar-gregorian-from-absolute d)
|
|
|
|
|
s (point))
|
|
|
|
|
(if (or (setq todayp (= d today))
|
|
|
|
|
(and (not start-pos) (= d sd)))
|
|
|
|
|
(setq start-pos (point))
|
|
|
|
|
(if (and start-pos (not end-pos))
|
|
|
|
|
(setq end-pos (point))))
|
|
|
|
|
(setq files thefiles
|
|
|
|
|
rtnall nil)
|
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(catch 'nextfile
|
|
|
|
|
(org-check-agenda-file file)
|
|
|
|
|
(let ((org-agenda-entry-types org-agenda-entry-types))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
;; Starred types override non-starred equivalents
|
|
|
|
|
(when (member :deadline* org-agenda-entry-types)
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(setq org-agenda-entry-types
|
|
|
|
|
(delq :deadline org-agenda-entry-types)))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(when (member :scheduled* org-agenda-entry-types)
|
|
|
|
|
(setq org-agenda-entry-types
|
|
|
|
|
(delq :scheduled org-agenda-entry-types)))
|
|
|
|
|
;; Honor with-hour
|
|
|
|
|
(when with-hour
|
|
|
|
|
(when (member :deadline org-agenda-entry-types)
|
|
|
|
|
(setq org-agenda-entry-types
|
|
|
|
|
(delq :deadline org-agenda-entry-types))
|
|
|
|
|
(push :deadline* org-agenda-entry-types))
|
|
|
|
|
(when (member :scheduled org-agenda-entry-types)
|
|
|
|
|
(setq org-agenda-entry-types
|
|
|
|
|
(delq :scheduled org-agenda-entry-types))
|
|
|
|
|
(push :scheduled* org-agenda-entry-types)))
|
|
|
|
|
(unless org-agenda-include-deadlines
|
|
|
|
|
(setq org-agenda-entry-types
|
|
|
|
|
(delq :deadline* (delq :deadline org-agenda-entry-types))))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(cond
|
|
|
|
|
((memq org-agenda-show-log-scoped '(only clockcheck))
|
|
|
|
|
(setq rtn (org-agenda-get-day-entries
|
|
|
|
|
file date :closed)))
|
|
|
|
|
(org-agenda-show-log-scoped
|
|
|
|
|
(setq rtn (apply 'org-agenda-get-day-entries
|
|
|
|
|
file date
|
|
|
|
|
(append '(:closed) org-agenda-entry-types))))
|
|
|
|
|
(t
|
|
|
|
|
(setq rtn (apply 'org-agenda-get-day-entries
|
|
|
|
|
file date
|
|
|
|
|
org-agenda-entry-types)))))
|
|
|
|
|
(setq rtnall (append rtnall rtn)))) ;; all entries
|
|
|
|
|
(if org-agenda-include-diary
|
|
|
|
|
(let ((org-agenda-search-headline-for-time t))
|
|
|
|
|
(require 'diary-lib)
|
|
|
|
|
(setq rtn (org-get-entries-from-diary date))
|
|
|
|
|
(setq rtnall (append rtnall rtn))))
|
|
|
|
|
(if (or rtnall org-agenda-show-all-dates)
|
|
|
|
|
(progn
|
|
|
|
|
(setq day-cnt (1+ day-cnt))
|
|
|
|
|
(insert
|
|
|
|
|
(if (stringp org-agenda-format-date)
|
|
|
|
|
(format-time-string org-agenda-format-date
|
|
|
|
|
(org-time-from-absolute date))
|
|
|
|
|
(funcall org-agenda-format-date date))
|
|
|
|
|
"\n")
|
|
|
|
|
(put-text-property s (1- (point)) 'face
|
|
|
|
|
(org-agenda-get-day-face date))
|
|
|
|
|
(put-text-property s (1- (point)) 'org-date-line t)
|
|
|
|
|
(put-text-property s (1- (point)) 'org-agenda-date-header t)
|
|
|
|
|
(put-text-property s (1- (point)) 'org-day-cnt day-cnt)
|
|
|
|
|
(when todayp
|
|
|
|
|
(put-text-property s (1- (point)) 'org-today t))
|
|
|
|
|
(setq rtnall
|
|
|
|
|
(org-agenda-add-time-grid-maybe rtnall ndays todayp))
|
|
|
|
|
(if rtnall (insert ;; all entries
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(org-agenda-finalize-entries rtnall 'agenda)
|
2012-08-28 11:29:37 +00:00
|
|
|
|
"\n"))
|
|
|
|
|
(put-text-property s (1- (point)) 'day d)
|
|
|
|
|
(put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
|
|
|
|
|
(when (and org-agenda-clockreport-mode clocktable-start)
|
|
|
|
|
(let ((org-agenda-files (org-agenda-files nil 'ifmode))
|
|
|
|
|
;; the above line is to ensure the restricted range!
|
|
|
|
|
(p (copy-sequence org-agenda-clockreport-parameter-plist))
|
|
|
|
|
tbl)
|
|
|
|
|
(setq p (org-plist-delete p :block))
|
|
|
|
|
(setq p (plist-put p :tstart clocktable-start))
|
|
|
|
|
(setq p (plist-put p :tend clocktable-end))
|
|
|
|
|
(setq p (plist-put p :scope 'agenda))
|
|
|
|
|
(when (and (eq org-agenda-clockreport-mode 'with-filter)
|
|
|
|
|
(setq filter (or org-agenda-tag-filter-while-redo
|
|
|
|
|
(get 'org-agenda-tag-filter :preset-filter))))
|
|
|
|
|
(setq p (plist-put p :tags (mapconcat (lambda (x)
|
|
|
|
|
(if (string-match "[<>=]" x)
|
|
|
|
|
""
|
|
|
|
|
x))
|
|
|
|
|
filter ""))))
|
2012-10-02 08:03:15 +00:00
|
|
|
|
(setq tbl (apply 'org-clock-get-clocktable p))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(insert tbl)))
|
|
|
|
|
(goto-char (point-min))
|
2012-08-28 11:36:43 +00:00
|
|
|
|
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(unless (and (pos-visible-in-window-p (point-min))
|
|
|
|
|
(pos-visible-in-window-p (point-max)))
|
|
|
|
|
(goto-char (1- (point-max)))
|
|
|
|
|
(recenter -1)
|
|
|
|
|
(if (not (pos-visible-in-window-p (or start-pos 1)))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (or start-pos 1))
|
|
|
|
|
(recenter 1))))
|
|
|
|
|
(goto-char (or start-pos 1))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
|
`(org-agenda-type agenda
|
|
|
|
|
org-last-args (,arg ,start-day ,span)
|
|
|
|
|
org-redo-cmd ,org-agenda-redo-command
|
2012-10-23 16:41:33 +00:00
|
|
|
|
org-series-cmd ,org-cmd))
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(if (eq org-agenda-show-log-scoped 'clockcheck)
|
|
|
|
|
(org-agenda-show-clocking-issues))
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2012-08-28 11:29:37 +00:00
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
|
(message ""))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-ndays-to-span (n)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
"Return a span symbol for a span of N days, or N if none matches."
|
|
|
|
|
(cond ((symbolp n) n)
|
|
|
|
|
((= n 1) 'day)
|
|
|
|
|
((= n 7) 'week)
|
|
|
|
|
(t n)))
|
|
|
|
|
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(defun org-agenda-span-to-ndays (span &optional start-day)
|
2013-04-08 19:14:51 +00:00
|
|
|
|
"Return ndays from SPAN, possibly starting at START-DAY.
|
|
|
|
|
START-DAY is an absolute time value."
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(cond ((numberp span) span)
|
|
|
|
|
((eq span 'day) 1)
|
|
|
|
|
((eq span 'week) 7)
|
|
|
|
|
((eq span 'month)
|
|
|
|
|
(let ((date (calendar-gregorian-from-absolute start-day)))
|
|
|
|
|
(calendar-last-day-of-month (car date) (caddr date))))
|
|
|
|
|
((eq span 'year)
|
|
|
|
|
(let ((date (calendar-gregorian-from-absolute start-day)))
|
|
|
|
|
(if (calendar-leap-year-p (caddr date)) 366 365)))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-span-name (span)
|
|
|
|
|
"Return a SPAN name."
|
|
|
|
|
(if (null span)
|
|
|
|
|
""
|
|
|
|
|
(if (symbolp span)
|
|
|
|
|
(capitalize (symbol-name span))
|
|
|
|
|
(format "%d days" span))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Agenda word search
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-search-history nil)
|
|
|
|
|
|
|
|
|
|
(defvar org-search-syntax-table nil
|
|
|
|
|
"Special syntax table for org-mode search.
|
|
|
|
|
In this table, we have single quotes not as word constituents, to
|
2008-12-16 14:25:23 +00:00
|
|
|
|
that when \"+Ameli\" is searched as a work, it will also match \"Ameli's\"")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-08-12 22:36:15 +00:00
|
|
|
|
(defvar org-mode-syntax-table) ; From org.el
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-search-syntax-table ()
|
|
|
|
|
(unless org-search-syntax-table
|
|
|
|
|
(setq org-search-syntax-table (copy-syntax-table org-mode-syntax-table))
|
|
|
|
|
(modify-syntax-entry ?' "." org-search-syntax-table)
|
|
|
|
|
(modify-syntax-entry ?` "." org-search-syntax-table))
|
|
|
|
|
org-search-syntax-table)
|
|
|
|
|
|
2010-01-05 11:13:00 +00:00
|
|
|
|
(defvar org-agenda-last-search-view-search-was-boolean nil)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-search-view (&optional todo-only string edit-at)
|
2010-01-05 11:13:00 +00:00
|
|
|
|
"Show all entries that contain a phrase or words or regular expressions.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
With optional prefix argument TODO-ONLY, only consider entries that are
|
|
|
|
|
TODO entries. The argument STRING can be used to pass a default search
|
|
|
|
|
string into this function. If EDIT-AT is non-nil, it means that the
|
|
|
|
|
user should get a chance to edit this string, with cursor at position
|
|
|
|
|
EDIT-AT.
|
|
|
|
|
|
2010-01-04 22:28:23 +00:00
|
|
|
|
The search string can be viewed either as a phrase that should be found as
|
|
|
|
|
is, or it can be broken into a number of snippets, each of which must match
|
|
|
|
|
in a Boolean way to select an entry. The default depends on the variable
|
|
|
|
|
`org-agenda-search-view-always-boolean'.
|
|
|
|
|
Even if this is turned off (the default) you can always switch to
|
2010-07-15 20:26:51 +00:00
|
|
|
|
Boolean search dynamically by preceding the first word with \"+\" or \"-\".
|
2010-01-04 22:28:23 +00:00
|
|
|
|
|
|
|
|
|
The default is a direct search of the whole phrase, where each space in
|
|
|
|
|
the search string can expand to an arbitrary amount of whitespace,
|
|
|
|
|
including newlines.
|
|
|
|
|
|
|
|
|
|
If using a Boolean search, the search string is split on whitespace and
|
2010-01-12 06:54:58 +00:00
|
|
|
|
each snippet is searched separately, with logical AND to select an entry.
|
2010-01-04 22:28:23 +00:00
|
|
|
|
Words prefixed with a minus must *not* occur in the entry. Words without
|
|
|
|
|
a prefix or prefixed with a plus must occur in the entry. Matching is
|
|
|
|
|
case-insensitive. Words are enclosed by word delimiters (i.e. they must
|
|
|
|
|
match whole words, not parts of a word) if
|
|
|
|
|
`org-agenda-search-view-force-full-words' is set (default is nil).
|
|
|
|
|
|
|
|
|
|
Boolean search snippets enclosed by curly braces are interpreted as
|
2010-07-15 20:26:51 +00:00
|
|
|
|
regular expressions that must or (when preceded with \"-\") must not
|
2010-01-12 07:28:44 +00:00
|
|
|
|
match in the entry. Snippets enclosed into double quotes will be taken
|
2010-07-15 20:26:51 +00:00
|
|
|
|
as a whole, to include whitespace.
|
2010-01-04 22:28:23 +00:00
|
|
|
|
|
|
|
|
|
- If the search string starts with an asterisk, search only in headlines.
|
|
|
|
|
- If (possibly after the leading star) the search string starts with an
|
|
|
|
|
exclamation mark, this also means to look at TODO entries only, an effect
|
|
|
|
|
that can also be achieved with a prefix argument.
|
2010-01-12 06:54:58 +00:00
|
|
|
|
- If (possibly after star and exclamation mark) the search string starts
|
2010-01-05 11:13:00 +00:00
|
|
|
|
with a colon, this will mean that the (non-regexp) snippets of the
|
2010-04-01 11:11:54 +00:00
|
|
|
|
Boolean search must match as full words.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
This command searches the agenda files, and in addition the files listed
|
|
|
|
|
in `org-agenda-text-search-extra-files'."
|
|
|
|
|
(interactive "P")
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(if org-agenda-overriding-arguments
|
|
|
|
|
(setq todo-only (car org-agenda-overriding-arguments)
|
|
|
|
|
string (nth 1 org-agenda-overriding-arguments)
|
|
|
|
|
edit-at (nth 2 org-agenda-overriding-arguments)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((props (list 'face nil
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'done-face 'org-agenda-done
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo (format "mouse-2 or RET jump to location")))
|
2010-01-04 22:28:23 +00:00
|
|
|
|
(full-words org-agenda-search-view-force-full-words)
|
2010-07-15 04:40:59 +00:00
|
|
|
|
(org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
|
2013-01-11 16:15:17 +00:00
|
|
|
|
regexp rtn rtnall files file pos inherited-tags
|
2012-09-12 09:41:50 +00:00
|
|
|
|
marker category category-pos level tags c neg re boolean
|
2008-03-22 15:52:18 +00:00
|
|
|
|
ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
|
|
|
|
|
(unless (and (not edit-at)
|
|
|
|
|
(stringp string)
|
|
|
|
|
(string-match "\\S-" string))
|
2010-01-04 22:28:23 +00:00
|
|
|
|
(setq string (read-string
|
|
|
|
|
(if org-agenda-search-view-always-boolean
|
|
|
|
|
"[+-]Word/{Regexp} ...: "
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
"Phrase or [+-]Word/{Regexp} ...: ")
|
2010-01-04 22:28:23 +00:00
|
|
|
|
(cond
|
|
|
|
|
((integerp edit-at) (cons string edit-at))
|
|
|
|
|
(edit-at string))
|
|
|
|
|
'org-agenda-search-history)))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(catch 'exit
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(setq org-agenda-buffer-name
|
|
|
|
|
(if (stringp string)
|
|
|
|
|
(format "*Org Agenda(%s:%s)*"
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(or org-keys (or (and todo-only "S") "s")) string)
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(format "*Org Agenda(%s)*" (or (and todo-only "S") "s")))))
|
|
|
|
|
(org-agenda-prepare "SEARCH")
|
|
|
|
|
(org-compile-prefix-format 'search)
|
|
|
|
|
(org-set-sorting-strategy 'search)
|
|
|
|
|
(setq org-agenda-redo-command
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(list 'org-search-view (if todo-only t nil)
|
|
|
|
|
(list 'if 'current-prefix-arg nil string)))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq org-agenda-query-string string)
|
|
|
|
|
(if (equal (string-to-char string) ?*)
|
|
|
|
|
(setq hdl-only t
|
|
|
|
|
words (substring string 1))
|
|
|
|
|
(setq words string))
|
|
|
|
|
(when (equal (string-to-char words) ?!)
|
|
|
|
|
(setq todo-only t
|
|
|
|
|
words (substring words 1)))
|
|
|
|
|
(when (equal (string-to-char words) ?:)
|
|
|
|
|
(setq full-words t
|
|
|
|
|
words (substring words 1)))
|
|
|
|
|
(if (or org-agenda-search-view-always-boolean
|
|
|
|
|
(member (string-to-char words) '(?- ?+ ?\{)))
|
|
|
|
|
(setq boolean t))
|
|
|
|
|
(setq words (org-split-string words))
|
|
|
|
|
(let (www w)
|
2010-01-04 22:28:23 +00:00
|
|
|
|
(while (setq w (pop words))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(while (and (string-match "\\\\\\'" w) words)
|
|
|
|
|
(setq w (concat (substring w 0 -1) " " (pop words))))
|
|
|
|
|
(push w www))
|
|
|
|
|
(setq words (nreverse www) www nil)
|
|
|
|
|
(while (setq w (pop words))
|
|
|
|
|
(when (and (string-match "\\`[-+]?{" w)
|
|
|
|
|
(not (string-match "}\\'" w)))
|
|
|
|
|
(while (and words (not (string-match "}\\'" (car words))))
|
|
|
|
|
(setq w (concat w " " (pop words))))
|
|
|
|
|
(setq w (concat w " " (pop words))))
|
|
|
|
|
(push w www))
|
|
|
|
|
(setq words (nreverse www)))
|
|
|
|
|
(setq org-agenda-last-search-view-search-was-boolean boolean)
|
|
|
|
|
(when boolean
|
|
|
|
|
(let (wds w)
|
|
|
|
|
(while (setq w (pop words))
|
|
|
|
|
(if (or (equal (substring w 0 1) "\"")
|
|
|
|
|
(and (> (length w) 1)
|
|
|
|
|
(member (substring w 0 1) '("+" "-"))
|
|
|
|
|
(equal (substring w 1 2) "\"")))
|
|
|
|
|
(while (and words (not (equal (substring w -1) "\"")))
|
|
|
|
|
(setq w (concat w " " (pop words)))))
|
|
|
|
|
(and (string-match "\\`\\([-+]?\\)\"" w)
|
|
|
|
|
(setq w (replace-match "\\1" nil nil w)))
|
|
|
|
|
(and (equal (substring w -1) "\"") (setq w (substring w 0 -1)))
|
|
|
|
|
(push w wds))
|
|
|
|
|
(setq words (nreverse wds))))
|
|
|
|
|
(if boolean
|
|
|
|
|
(mapc (lambda (w)
|
|
|
|
|
(setq c (string-to-char w))
|
|
|
|
|
(if (equal c ?-)
|
|
|
|
|
(setq neg t w (substring w 1))
|
|
|
|
|
(if (equal c ?+)
|
|
|
|
|
(setq neg nil w (substring w 1))
|
|
|
|
|
(setq neg nil)))
|
|
|
|
|
(if (string-match "\\`{.*}\\'" w)
|
|
|
|
|
(setq re (substring w 1 -1))
|
|
|
|
|
(if full-words
|
|
|
|
|
(setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))
|
|
|
|
|
(setq re (regexp-quote (downcase w)))))
|
|
|
|
|
(if neg (push re regexps-) (push re regexps+)))
|
|
|
|
|
words)
|
|
|
|
|
(push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+")
|
|
|
|
|
regexps+))
|
|
|
|
|
(setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b)))))
|
|
|
|
|
(if (not regexps+)
|
|
|
|
|
(setq regexp org-outline-regexp-bol)
|
|
|
|
|
(setq regexp (pop regexps+))
|
|
|
|
|
(if hdl-only (setq regexp (concat org-outline-regexp-bol ".*?"
|
|
|
|
|
regexp))))
|
|
|
|
|
(setq files (org-agenda-files nil 'ifmode))
|
|
|
|
|
(when (eq (car org-agenda-text-search-extra-files) 'agenda-archives)
|
|
|
|
|
(pop org-agenda-text-search-extra-files)
|
|
|
|
|
(setq files (org-add-archive-files files)))
|
|
|
|
|
(setq files (append files org-agenda-text-search-extra-files)
|
|
|
|
|
rtnall nil)
|
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(setq ee nil)
|
|
|
|
|
(catch 'nextfile
|
|
|
|
|
(org-check-agenda-file file)
|
|
|
|
|
(setq buffer (if (file-exists-p file)
|
|
|
|
|
(org-get-agenda-file-buffer file)
|
|
|
|
|
(error "No such file %s" file)))
|
|
|
|
|
(if (not buffer)
|
|
|
|
|
;; If file does not exist, make sure an error message is sent
|
|
|
|
|
(setq rtn (list (format "ORG-AGENDA-ERROR: No such org-file %s"
|
|
|
|
|
file))))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(with-syntax-table (org-search-syntax-table)
|
|
|
|
|
(unless (derived-mode-p 'org-mode)
|
|
|
|
|
(error "Agenda file %s is not in `org-mode'" file))
|
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(if org-agenda-restrict
|
|
|
|
|
(narrow-to-region org-agenda-restrict-begin
|
|
|
|
|
org-agenda-restrict-end)
|
|
|
|
|
(widen))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(unless (or (org-at-heading-p)
|
|
|
|
|
(outline-next-heading))
|
|
|
|
|
(throw 'nextfile t))
|
|
|
|
|
(goto-char (max (point-min) (1- (point))))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(org-back-to-heading t)
|
2012-12-24 13:49:04 +00:00
|
|
|
|
(while (and org-agenda-search-view-max-outline-level
|
|
|
|
|
(> (org-reduced-level (org-outline-level))
|
|
|
|
|
org-agenda-search-view-max-outline-level)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(outline-back-to-heading t)))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(skip-chars-forward "* ")
|
|
|
|
|
(setq beg (point-at-bol)
|
|
|
|
|
beg1 (point)
|
2012-12-24 13:49:04 +00:00
|
|
|
|
end (progn
|
|
|
|
|
(outline-next-heading)
|
|
|
|
|
(while (and org-agenda-search-view-max-outline-level
|
|
|
|
|
(> (org-reduced-level (org-outline-level))
|
|
|
|
|
org-agenda-search-view-max-outline-level)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(outline-next-heading)))
|
|
|
|
|
(point)))
|
|
|
|
|
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(catch :skip
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq str (buffer-substring-no-properties
|
|
|
|
|
(point-at-bol)
|
|
|
|
|
(if hdl-only (point-at-eol) end)))
|
|
|
|
|
(mapc (lambda (wr) (when (string-match wr str)
|
|
|
|
|
(goto-char (1- end))
|
|
|
|
|
(throw :skip t)))
|
|
|
|
|
regexps-)
|
|
|
|
|
(mapc (lambda (wr) (unless (string-match wr str)
|
|
|
|
|
(goto-char (1- end))
|
|
|
|
|
(throw :skip t)))
|
|
|
|
|
(if todo-only
|
|
|
|
|
(cons (concat "^\*+[ \t]+" org-not-done-regexp)
|
|
|
|
|
regexps+)
|
|
|
|
|
regexps+))
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(setq marker (org-agenda-new-marker (point))
|
|
|
|
|
category (org-get-category)
|
2012-09-12 16:17:01 +00:00
|
|
|
|
level (make-string (org-reduced-level (org-outline-level)) ? )
|
2012-08-28 13:06:47 +00:00
|
|
|
|
category-pos (get-text-property (point) 'org-category-position)
|
2013-01-11 16:15:17 +00:00
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
2013-01-14 17:04:31 +00:00
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'todo org-agenda-show-inherited-tags))
|
2013-01-11 16:15:17 +00:00
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'todo org-agenda-use-tag-inheritance))))
|
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
txt (org-agenda-format-item
|
|
|
|
|
""
|
|
|
|
|
(buffer-substring-no-properties
|
|
|
|
|
beg1 (point-at-eol))
|
2012-09-23 14:27:25 +00:00
|
|
|
|
level category tags t))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(org-add-props txt props
|
|
|
|
|
'org-marker marker 'org-hd-marker marker
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2012-08-28 13:06:47 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
|
|
|
|
'priority 1000 'org-category category
|
|
|
|
|
'org-category-position category-pos
|
|
|
|
|
'type "search")
|
|
|
|
|
(push txt ee)
|
|
|
|
|
(goto-char (1- end))))))))))
|
|
|
|
|
(setq rtn (nreverse ee))
|
|
|
|
|
(setq rtnall (append rtnall rtn)))
|
|
|
|
|
(if org-agenda-overriding-header
|
|
|
|
|
(insert (org-add-props (copy-sequence org-agenda-overriding-header)
|
|
|
|
|
nil 'face 'org-agenda-structure) "\n")
|
|
|
|
|
(insert "Search words: ")
|
|
|
|
|
(add-text-properties (point-min) (1- (point))
|
|
|
|
|
(list 'face 'org-agenda-structure))
|
|
|
|
|
(setq pos (point))
|
|
|
|
|
(insert string "\n")
|
|
|
|
|
(add-text-properties pos (1- (point)) (list 'face 'org-warning))
|
|
|
|
|
(setq pos (point))
|
|
|
|
|
(unless org-agenda-multi
|
|
|
|
|
(insert "Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, `C-u r' to edit\n")
|
|
|
|
|
(add-text-properties pos (1- (point))
|
|
|
|
|
(list 'face 'org-agenda-structure))))
|
|
|
|
|
(org-agenda-mark-header-line (point-min))
|
|
|
|
|
(when rtnall
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(insert (org-agenda-finalize-entries rtnall 'search) "\n"))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
|
`(org-agenda-type search
|
|
|
|
|
org-last-args (,todo-only ,string ,edit-at)
|
|
|
|
|
org-redo-cmd ,org-agenda-redo-command
|
2012-10-23 16:41:33 +00:00
|
|
|
|
org-series-cmd ,org-cmd))
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq buffer-read-only t))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Agenda TODO list
|
|
|
|
|
|
2012-12-18 17:47:49 +00:00
|
|
|
|
(defun org-agenda-propertize-selected-todo-keywords (keywords)
|
|
|
|
|
"Use `org-todo-keyword-faces' for the selected todo KEYWORDS."
|
|
|
|
|
(concat
|
|
|
|
|
(if (or (equal keywords "ALL") (not keywords))
|
|
|
|
|
(propertize "ALL" 'face 'warning)
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (kw)
|
|
|
|
|
(propertize kw 'face (org-get-todo-face kw)))
|
|
|
|
|
(org-split-string keywords "|")
|
|
|
|
|
"|"))
|
|
|
|
|
"\n"))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-select-this-todo-keyword nil)
|
|
|
|
|
(defvar org-last-arg nil)
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2012-08-28 11:17:29 +00:00
|
|
|
|
(defun org-todo-list (&optional arg)
|
2010-06-22 06:26:24 +00:00
|
|
|
|
"Show all (not done) TODO entries from all agenda file in a single list.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
The prefix arg can be used to select a specific TODO keyword and limit
|
|
|
|
|
the list to these. When using \\[universal-argument], you will be prompted
|
|
|
|
|
for a keyword. A numeric prefix directly selects the Nth keyword in
|
|
|
|
|
`org-todo-keywords-1'."
|
|
|
|
|
(interactive "P")
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(if org-agenda-overriding-arguments
|
|
|
|
|
(setq arg org-agenda-overriding-arguments))
|
2009-12-16 09:44:41 +00:00
|
|
|
|
(if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
|
2010-11-29 19:18:31 +00:00
|
|
|
|
(let* ((today (org-today))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(date (calendar-gregorian-from-absolute today))
|
|
|
|
|
(kwds org-todo-keywords-for-agenda)
|
|
|
|
|
(completion-ignore-case t)
|
|
|
|
|
(org-select-this-todo-keyword
|
|
|
|
|
(if (stringp arg) arg
|
|
|
|
|
(and arg (integerp arg) (> arg 0)
|
|
|
|
|
(nth (1- arg) kwds))))
|
|
|
|
|
rtn rtnall files file pos)
|
|
|
|
|
(when (equal arg '(4))
|
|
|
|
|
(setq org-select-this-todo-keyword
|
2009-08-13 21:23:25 +00:00
|
|
|
|
(org-icompleting-read "Keyword (or KWD1|K2D2|...): "
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(mapcar 'list kwds) nil nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(and (equal 0 arg) (setq org-select-this-todo-keyword nil))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(catch 'exit
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(setq org-agenda-buffer-name
|
|
|
|
|
(if (stringp org-select-this-todo-keyword)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(format "*Org Agenda(%s:%s)*" (or org-keys "t")
|
2012-08-28 13:06:47 +00:00
|
|
|
|
org-select-this-todo-keyword)
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(format "*Org Agenda(%s)*" (or org-keys "t")))))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(org-agenda-prepare "TODO")
|
|
|
|
|
(org-compile-prefix-format 'todo)
|
|
|
|
|
(org-set-sorting-strategy 'todo)
|
|
|
|
|
(setq org-agenda-redo-command
|
2012-09-29 11:46:31 +00:00
|
|
|
|
`(org-todo-list (or (and (numberp current-prefix-arg)
|
|
|
|
|
current-prefix-arg)
|
2012-09-29 11:44:19 +00:00
|
|
|
|
,org-select-this-todo-keyword
|
|
|
|
|
current-prefix-arg ,arg)))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq files (org-agenda-files nil 'ifmode)
|
|
|
|
|
rtnall nil)
|
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(catch 'nextfile
|
|
|
|
|
(org-check-agenda-file file)
|
|
|
|
|
(setq rtn (org-agenda-get-day-entries file date :todo))
|
|
|
|
|
(setq rtnall (append rtnall rtn))))
|
|
|
|
|
(if org-agenda-overriding-header
|
|
|
|
|
(insert (org-add-props (copy-sequence org-agenda-overriding-header)
|
|
|
|
|
nil 'face 'org-agenda-structure) "\n")
|
|
|
|
|
(insert "Global list of TODO items of type: ")
|
|
|
|
|
(add-text-properties (point-min) (1- (point))
|
|
|
|
|
(list 'face 'org-agenda-structure
|
|
|
|
|
'short-heading
|
|
|
|
|
(concat "ToDo: "
|
|
|
|
|
(or org-select-this-todo-keyword "ALL"))))
|
|
|
|
|
(org-agenda-mark-header-line (point-min))
|
2012-12-18 17:47:49 +00:00
|
|
|
|
(insert (org-agenda-propertize-selected-todo-keywords
|
|
|
|
|
org-select-this-todo-keyword))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq pos (point))
|
|
|
|
|
(unless org-agenda-multi
|
|
|
|
|
(insert "Available with `N r': (0)[ALL]")
|
|
|
|
|
(let ((n 0) s)
|
|
|
|
|
(mapc (lambda (x)
|
|
|
|
|
(setq s (format "(%d)%s" (setq n (1+ n)) x))
|
|
|
|
|
(if (> (+ (current-column) (string-width s) 1) (frame-width))
|
|
|
|
|
(insert "\n "))
|
|
|
|
|
(insert " " s))
|
|
|
|
|
kwds))
|
|
|
|
|
(insert "\n"))
|
|
|
|
|
(add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
|
2009-09-15 21:50:20 +00:00
|
|
|
|
(org-agenda-mark-header-line (point-min))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(when rtnall
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(insert (org-agenda-finalize-entries rtnall 'todo) "\n"))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
|
`(org-agenda-type todo
|
|
|
|
|
org-last-args ,arg
|
|
|
|
|
org-redo-cmd ,org-agenda-redo-command
|
2012-10-23 16:41:33 +00:00
|
|
|
|
org-series-cmd ,org-cmd))
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq buffer-read-only t))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Agenda tags match
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-tags-view (&optional todo-only match)
|
|
|
|
|
"Show all headlines for all `org-agenda-files' matching a TAGS criterion.
|
|
|
|
|
The prefix arg TODO-ONLY limits the search to TODO entries."
|
|
|
|
|
(interactive "P")
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(if org-agenda-overriding-arguments
|
|
|
|
|
(setq todo-only (car org-agenda-overriding-arguments)
|
|
|
|
|
match (nth 1 org-agenda-overriding-arguments)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((org-tags-match-list-sublevels
|
2009-06-28 06:45:56 +00:00
|
|
|
|
org-tags-match-list-sublevels)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(completion-ignore-case t)
|
|
|
|
|
rtn rtnall files file pos matcher
|
|
|
|
|
buffer)
|
2009-12-16 09:44:41 +00:00
|
|
|
|
(when (and (stringp match) (not (string-match "\\S-" match)))
|
|
|
|
|
(setq match nil))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(catch 'exit
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(setq org-agenda-buffer-name
|
|
|
|
|
(if (stringp match)
|
|
|
|
|
(format "*Org Agenda(%s:%s)*"
|
2012-08-28 16:26:10 +00:00
|
|
|
|
(or org-keys (or (and todo-only "M") "m")) match)
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(format "*Org Agenda(%s)*" (or (and todo-only "M") "m")))))
|
2013-03-23 17:18:06 +00:00
|
|
|
|
;; Prepare agendas (and `org-tag-alist-for-agenda') before
|
|
|
|
|
;; expanding tags within `org-make-tags-matcher'
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(org-agenda-prepare (concat "TAGS " match))
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(setq matcher (org-make-tags-matcher match)
|
|
|
|
|
match (car matcher) matcher (cdr matcher))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(org-compile-prefix-format 'tags)
|
|
|
|
|
(org-set-sorting-strategy 'tags)
|
|
|
|
|
(setq org-agenda-query-string match)
|
|
|
|
|
(setq org-agenda-redo-command
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(list 'org-tags-view `(quote ,todo-only)
|
|
|
|
|
(list 'if 'current-prefix-arg nil `(quote ,org-agenda-query-string))))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq files (org-agenda-files nil 'ifmode)
|
|
|
|
|
rtnall nil)
|
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(catch 'nextfile
|
|
|
|
|
(org-check-agenda-file file)
|
|
|
|
|
(setq buffer (if (file-exists-p file)
|
|
|
|
|
(org-get-agenda-file-buffer file)
|
|
|
|
|
(error "No such file %s" file)))
|
|
|
|
|
(if (not buffer)
|
|
|
|
|
;; If file does not exist, error message to agenda
|
|
|
|
|
(setq rtn (list
|
|
|
|
|
(format "ORG-AGENDA-ERROR: No such org-file %s" file))
|
|
|
|
|
rtnall (append rtnall rtn))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(unless (derived-mode-p 'org-mode)
|
|
|
|
|
(error "Agenda file %s is not in `org-mode'" file))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(if org-agenda-restrict
|
|
|
|
|
(narrow-to-region org-agenda-restrict-begin
|
|
|
|
|
org-agenda-restrict-end)
|
|
|
|
|
(widen))
|
|
|
|
|
(setq rtn (org-scan-tags 'agenda matcher todo-only))
|
|
|
|
|
(setq rtnall (append rtnall rtn))))))))
|
|
|
|
|
(if org-agenda-overriding-header
|
|
|
|
|
(insert (org-add-props (copy-sequence org-agenda-overriding-header)
|
|
|
|
|
nil 'face 'org-agenda-structure) "\n")
|
|
|
|
|
(insert "Headlines with TAGS match: ")
|
|
|
|
|
(add-text-properties (point-min) (1- (point))
|
|
|
|
|
(list 'face 'org-agenda-structure
|
|
|
|
|
'short-heading
|
|
|
|
|
(concat "Match: " match)))
|
|
|
|
|
(setq pos (point))
|
|
|
|
|
(insert match "\n")
|
|
|
|
|
(add-text-properties pos (1- (point)) (list 'face 'org-warning))
|
|
|
|
|
(setq pos (point))
|
|
|
|
|
(unless org-agenda-multi
|
|
|
|
|
(insert "Press `C-u r' to search again with new search string\n"))
|
|
|
|
|
(add-text-properties pos (1- (point)) (list 'face 'org-agenda-structure)))
|
|
|
|
|
(org-agenda-mark-header-line (point-min))
|
|
|
|
|
(when rtnall
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(insert (org-agenda-finalize-entries rtnall 'tags) "\n"))
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
|
`(org-agenda-type tags
|
|
|
|
|
org-last-args (,todo-only ,match)
|
|
|
|
|
org-redo-cmd ,org-agenda-redo-command
|
2012-10-23 16:41:33 +00:00
|
|
|
|
org-series-cmd ,org-cmd))
|
2012-08-30 04:24:22 +00:00
|
|
|
|
(org-agenda-finalize)
|
2012-08-28 13:06:47 +00:00
|
|
|
|
(setq buffer-read-only t))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Agenda Finding stuck projects
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-skip-regexp nil
|
|
|
|
|
"Regular expression used in skipping subtrees for the agenda.
|
|
|
|
|
This is basically a temporary global variable that can be set and then
|
|
|
|
|
used by user-defined selections using `org-agenda-skip-function'.")
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-overriding-header nil
|
2011-06-03 19:09:46 +00:00
|
|
|
|
"When set during agenda, todo and tags searches it replaces the header.
|
2009-03-03 17:26:41 +00:00
|
|
|
|
This variable should not be set directly, but custom commands can bind it
|
|
|
|
|
in the options section.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-03-19 09:21:21 +00:00
|
|
|
|
(defun org-agenda-skip-entry-when-regexp-matches ()
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Check if the current entry contains match for `org-agenda-skip-regexp'.
|
2009-03-19 09:21:21 +00:00
|
|
|
|
If yes, it returns the end position of this entry, causing agenda commands
|
|
|
|
|
to skip the entry but continuing the search in the subtree. This is a
|
|
|
|
|
function that can be put into `org-agenda-skip-function' for the duration
|
|
|
|
|
of a command."
|
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip end)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-skip-subtree-when-regexp-matches ()
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Check if the current subtree contains match for `org-agenda-skip-regexp'.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
If yes, it returns the end position of this tree, causing agenda commands
|
|
|
|
|
to skip this subtree. This is a function that can be put into
|
|
|
|
|
`org-agenda-skip-function' for the duration of a command."
|
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip end)))
|
|
|
|
|
|
2009-03-19 09:21:21 +00:00
|
|
|
|
(defun org-agenda-skip-entry-when-regexp-matches-in-subtree ()
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Check if the current subtree contains match for `org-agenda-skip-regexp'.
|
2009-03-19 09:21:21 +00:00
|
|
|
|
If yes, it returns the end position of the current entry (NOT the tree),
|
|
|
|
|
causing agenda commands to skip the entry but continuing the search in
|
|
|
|
|
the subtree. This is a function that can be put into
|
|
|
|
|
`org-agenda-skip-function' for the duration of a command. An important
|
|
|
|
|
use of this function is for the stuck project list."
|
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
(entry-end (save-excursion (outline-next-heading) (1- (point))))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip entry-end)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-skip-entry-if (&rest conditions)
|
|
|
|
|
"Skip entry if any of CONDITIONS is true.
|
|
|
|
|
See `org-agenda-skip-if' for details."
|
|
|
|
|
(org-agenda-skip-if nil conditions))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-skip-subtree-if (&rest conditions)
|
|
|
|
|
"Skip entry if any of CONDITIONS is true.
|
|
|
|
|
See `org-agenda-skip-if' for details."
|
|
|
|
|
(org-agenda-skip-if t conditions))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-skip-if (subtree conditions)
|
|
|
|
|
"Checks current entity for CONDITIONS.
|
|
|
|
|
If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only
|
2012-03-16 18:18:41 +00:00
|
|
|
|
the entry (i.e. the text before the next heading) is checked.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
CONDITIONS is a list of symbols, boolean OR is used to combine the results
|
|
|
|
|
from different tests. Valid conditions are:
|
|
|
|
|
|
|
|
|
|
scheduled Check if there is a scheduled cookie
|
|
|
|
|
notscheduled Check if there is no scheduled cookie
|
|
|
|
|
deadline Check if there is a deadline
|
|
|
|
|
notdeadline Check if there is no deadline
|
2009-02-04 14:19:21 +00:00
|
|
|
|
timestamp Check if there is a timestamp (also deadline or scheduled)
|
|
|
|
|
nottimestamp Check if there is no timestamp (also deadline or scheduled)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
regexp Check if regexp matches
|
|
|
|
|
notregexp Check if regexp does not match.
|
2010-03-12 13:44:26 +00:00
|
|
|
|
todo Check if TODO keyword matches
|
|
|
|
|
nottodo Check if TODO keyword does not match
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
The regexp is taken from the conditions list, it must come right after
|
|
|
|
|
the `regexp' or `notregexp' element.
|
|
|
|
|
|
2010-03-12 13:44:26 +00:00
|
|
|
|
`todo' and `nottodo' accept as an argument a list of todo
|
|
|
|
|
keywords, which may include \"*\" to match any todo keyword.
|
|
|
|
|
|
|
|
|
|
(org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
|
|
|
|
|
|
|
|
|
|
would skip all entries with \"TODO\" or \"WAITING\" keywords.
|
|
|
|
|
|
2012-03-16 18:18:41 +00:00
|
|
|
|
Instead of a list, a keyword class may be given. For example:
|
2010-03-12 13:44:26 +00:00
|
|
|
|
|
|
|
|
|
(org-agenda-skip-entry-if 'nottodo 'done)
|
|
|
|
|
|
|
|
|
|
would skip entries that haven't been marked with any of \"DONE\"
|
2012-03-16 18:18:41 +00:00
|
|
|
|
keywords. Possible classes are: `todo', `done', `any'.
|
2010-03-12 13:44:26 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
If any of these conditions is met, this function returns the end point of
|
|
|
|
|
the entity, causing the search to continue from there. This is a function
|
|
|
|
|
that can be put into `org-agenda-skip-function' for the duration of a command."
|
|
|
|
|
(let (beg end m)
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(setq beg (point)
|
|
|
|
|
end (if subtree
|
|
|
|
|
(progn (org-end-of-subtree t) (point))
|
|
|
|
|
(progn (outline-next-heading) (1- (point)))))
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(and
|
|
|
|
|
(or
|
|
|
|
|
(and (memq 'scheduled conditions)
|
|
|
|
|
(re-search-forward org-scheduled-time-regexp end t))
|
|
|
|
|
(and (memq 'notscheduled conditions)
|
|
|
|
|
(not (re-search-forward org-scheduled-time-regexp end t)))
|
|
|
|
|
(and (memq 'deadline conditions)
|
|
|
|
|
(re-search-forward org-deadline-time-regexp end t))
|
|
|
|
|
(and (memq 'notdeadline conditions)
|
|
|
|
|
(not (re-search-forward org-deadline-time-regexp end t)))
|
2009-02-04 14:19:21 +00:00
|
|
|
|
(and (memq 'timestamp conditions)
|
|
|
|
|
(re-search-forward org-ts-regexp end t))
|
|
|
|
|
(and (memq 'nottimestamp conditions)
|
|
|
|
|
(not (re-search-forward org-ts-regexp end t)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(and (setq m (memq 'regexp conditions))
|
|
|
|
|
(stringp (nth 1 m))
|
|
|
|
|
(re-search-forward (nth 1 m) end t))
|
|
|
|
|
(and (setq m (memq 'notregexp conditions))
|
|
|
|
|
(stringp (nth 1 m))
|
2010-03-12 13:44:26 +00:00
|
|
|
|
(not (re-search-forward (nth 1 m) end t)))
|
|
|
|
|
(and (or
|
2012-03-16 18:18:41 +00:00
|
|
|
|
(setq m (memq 'nottodo conditions))
|
2012-01-28 17:26:21 +00:00
|
|
|
|
(setq m (memq 'todo-unblocked conditions))
|
|
|
|
|
(setq m (memq 'nottodo-unblocked conditions))
|
2012-03-16 18:18:41 +00:00
|
|
|
|
(setq m (memq 'todo conditions)))
|
2010-03-12 13:44:26 +00:00
|
|
|
|
(org-agenda-skip-if-todo m end)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
end)))
|
|
|
|
|
|
2010-03-12 13:44:26 +00:00
|
|
|
|
(defun org-agenda-skip-if-todo (args end)
|
|
|
|
|
"Helper function for `org-agenda-skip-if', do not use it directly.
|
2012-01-28 17:26:21 +00:00
|
|
|
|
ARGS is a list with first element either `todo', `nottodo',
|
2012-08-11 17:10:44 +00:00
|
|
|
|
`todo-unblocked' or `nottodo-unblocked'. The remainder is either
|
2012-01-28 17:26:21 +00:00
|
|
|
|
a list of TODO keywords, or a state symbol `todo' or `done' or
|
|
|
|
|
`any'."
|
2010-03-12 13:44:26 +00:00
|
|
|
|
(let ((kw (car args))
|
|
|
|
|
(arg (cadr args))
|
|
|
|
|
todo-wds todo-re)
|
|
|
|
|
(setq todo-wds
|
|
|
|
|
(org-uniquify
|
|
|
|
|
(cond
|
|
|
|
|
((listp arg) ;; list of keywords
|
|
|
|
|
(if (member "*" arg)
|
|
|
|
|
(mapcar 'substring-no-properties org-todo-keywords-1)
|
|
|
|
|
arg))
|
|
|
|
|
((symbolp arg) ;; keyword class name
|
|
|
|
|
(cond
|
|
|
|
|
((eq arg 'todo)
|
|
|
|
|
(org-delete-all org-done-keywords
|
|
|
|
|
(mapcar 'substring-no-properties
|
|
|
|
|
org-todo-keywords-1)))
|
|
|
|
|
((eq arg 'done) org-done-keywords)
|
|
|
|
|
((eq arg 'any)
|
|
|
|
|
(mapcar 'substring-no-properties org-todo-keywords-1)))))))
|
|
|
|
|
(setq todo-re
|
|
|
|
|
(concat "^\\*+[ \t]+\\<\\("
|
|
|
|
|
(mapconcat 'identity todo-wds "\\|")
|
|
|
|
|
"\\)\\>"))
|
2012-01-28 17:26:21 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq kw 'todo) (re-search-forward todo-re end t))
|
|
|
|
|
((eq kw 'nottodo) (not (re-search-forward todo-re end t)))
|
|
|
|
|
((eq kw 'todo-unblocked)
|
|
|
|
|
(catch 'unblocked
|
|
|
|
|
(while (re-search-forward todo-re end t)
|
|
|
|
|
(or (org-entry-blocked-p) (throw 'unblocked t)))
|
|
|
|
|
nil))
|
|
|
|
|
((eq kw 'nottodo-unblocked)
|
|
|
|
|
(catch 'unblocked
|
|
|
|
|
(while (re-search-forward todo-re end t)
|
|
|
|
|
(or (org-entry-blocked-p) (throw 'unblocked nil)))
|
|
|
|
|
t))
|
|
|
|
|
)))
|
2010-03-12 13:44:26 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-agenda-list-stuck-projects (&rest ignore)
|
|
|
|
|
"Create agenda view for projects that are stuck.
|
|
|
|
|
Stuck projects are project that have no next actions. For the definitions
|
|
|
|
|
of what a project is and how to check if it stuck, customize the variable
|
2010-09-03 00:43:22 +00:00
|
|
|
|
`org-stuck-projects'."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
2009-03-19 09:21:21 +00:00
|
|
|
|
(let* ((org-agenda-skip-function
|
|
|
|
|
'org-agenda-skip-entry-when-regexp-matches-in-subtree)
|
2008-04-03 13:27:33 +00:00
|
|
|
|
;; We could have used org-agenda-skip-if here.
|
2009-06-18 21:34:29 +00:00
|
|
|
|
(org-agenda-overriding-header
|
|
|
|
|
(or org-agenda-overriding-header "List of stuck projects: "))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(matcher (nth 0 org-stuck-projects))
|
|
|
|
|
(todo (nth 1 org-stuck-projects))
|
|
|
|
|
(todo-wds (if (member "*" todo)
|
|
|
|
|
(progn
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-buffers (org-agenda-files
|
2008-06-19 22:20:12 +00:00
|
|
|
|
nil 'ifmode))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-delete-all
|
|
|
|
|
org-done-keywords-for-agenda
|
|
|
|
|
(copy-sequence org-todo-keywords-for-agenda)))
|
|
|
|
|
todo))
|
|
|
|
|
(todo-re (concat "^\\*+[ \t]+\\("
|
|
|
|
|
(mapconcat 'identity todo-wds "\\|")
|
|
|
|
|
"\\)\\>"))
|
|
|
|
|
(tags (nth 2 org-stuck-projects))
|
|
|
|
|
(tags-re (if (member "*" tags)
|
2011-10-21 20:36:53 +00:00
|
|
|
|
(concat org-outline-regexp-bol
|
2011-10-22 08:13:11 +00:00
|
|
|
|
(org-re ".*:[[:alnum:]_@#%]+:[ \t]*$"))
|
2009-03-19 09:21:21 +00:00
|
|
|
|
(if tags
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
|
(concat org-outline-regexp-bol
|
|
|
|
|
".*:\\("
|
2009-03-19 09:21:21 +00:00
|
|
|
|
(mapconcat 'identity tags "\\|")
|
2010-08-21 00:30:31 +00:00
|
|
|
|
(org-re "\\):[[:alnum:]_@#%:]*[ \t]*$")))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(gen-re (nth 3 org-stuck-projects))
|
|
|
|
|
(re-list
|
|
|
|
|
(delq nil
|
|
|
|
|
(list
|
|
|
|
|
(if todo todo-re)
|
|
|
|
|
(if tags tags-re)
|
|
|
|
|
(and gen-re (stringp gen-re) (string-match "\\S-" gen-re)
|
|
|
|
|
gen-re)))))
|
|
|
|
|
(setq org-agenda-skip-regexp
|
|
|
|
|
(if re-list
|
|
|
|
|
(mapconcat 'identity re-list "\\|")
|
|
|
|
|
(error "No information how to identify unstuck projects")))
|
|
|
|
|
(org-tags-view nil matcher)
|
|
|
|
|
(with-current-buffer org-agenda-buffer-name
|
|
|
|
|
(setq org-agenda-redo-command
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
`(org-agenda-list-stuck-projects ,current-prefix-arg)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Diary integration
|
|
|
|
|
|
|
|
|
|
(defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param.
|
2012-03-19 20:38:12 +00:00
|
|
|
|
(defvar diary-list-entries-hook)
|
2011-03-01 06:24:14 +00:00
|
|
|
|
(defvar diary-time-regexp)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-get-entries-from-diary (date)
|
|
|
|
|
"Get the (Emacs Calendar) diary entries for DATE."
|
|
|
|
|
(require 'diary-lib)
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(diary-display-hook '(fancy-diary-display))
|
2008-06-17 15:05:23 +00:00
|
|
|
|
(diary-display-function 'fancy-diary-display)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(pop-up-frames nil)
|
2012-03-19 20:38:12 +00:00
|
|
|
|
(diary-list-entries-hook
|
|
|
|
|
(cons 'org-diary-default-entry diary-list-entries-hook))
|
2013-01-10 11:15:24 +00:00
|
|
|
|
(diary-file-name-prefix nil) ; turn this feature off
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(diary-modify-entry-list-string-function 'org-modify-diary-entry-string)
|
|
|
|
|
entries
|
|
|
|
|
(org-disable-agenda-to-diary t))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(funcall (if (fboundp 'diary-list-entries)
|
|
|
|
|
'diary-list-entries 'list-diary-entries)
|
|
|
|
|
date 1)))
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(if (not (get-buffer diary-fancy-buffer))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq entries nil)
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(with-current-buffer diary-fancy-buffer
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq buffer-read-only nil)
|
|
|
|
|
(if (zerop (buffer-size))
|
|
|
|
|
;; No entries
|
|
|
|
|
(setq entries nil)
|
|
|
|
|
;; Omit the date and other unnecessary stuff
|
|
|
|
|
(org-agenda-cleanup-fancy-diary)
|
|
|
|
|
;; Add prefix to each line and extend the text properties
|
|
|
|
|
(if (zerop (buffer-size))
|
|
|
|
|
(setq entries nil)
|
2011-02-12 12:08:14 +00:00
|
|
|
|
(setq entries (buffer-substring (point-min) (- (point-max) 1)))
|
2011-03-10 09:42:57 +00:00
|
|
|
|
(setq entries
|
2011-02-12 12:08:14 +00:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert entries) (goto-char (point-min))
|
|
|
|
|
(while (re-search-forward "\n[ \t]+\\(.+\\)$" nil t)
|
|
|
|
|
(unless (save-match-data (string-match diary-time-regexp (match-string 1)))
|
|
|
|
|
(replace-match (concat "; " (match-string 1)))))
|
|
|
|
|
(buffer-string)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(set-buffer-modified-p nil)
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(kill-buffer diary-fancy-buffer)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when entries
|
|
|
|
|
(setq entries (org-split-string entries "\n"))
|
|
|
|
|
(setq entries
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(setq x (org-agenda-format-item "" x nil "Diary" nil 'time))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; Extend the text properties to the beginning of the line
|
|
|
|
|
(org-add-props x (text-properties-at (1- (length x)) x)
|
2010-01-04 14:35:45 +00:00
|
|
|
|
'type "diary" 'date date 'face 'org-agenda-diary))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
entries)))))
|
|
|
|
|
|
2009-04-02 16:20:47 +00:00
|
|
|
|
(defvar org-agenda-cleanup-fancy-diary-hook nil
|
|
|
|
|
"Hook run when the fancy diary buffer is cleaned up.")
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-cleanup-fancy-diary ()
|
|
|
|
|
"Remove unwanted stuff in buffer created by `fancy-diary-display'.
|
|
|
|
|
This gets rid of the date, the underline under the date, and
|
|
|
|
|
the dummy entry installed by `org-mode' to ensure non-empty diary for each
|
|
|
|
|
date. It also removes lines that contain only whitespace."
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (looking-at ".*?:[ \t]*")
|
|
|
|
|
(progn
|
|
|
|
|
(replace-match "")
|
|
|
|
|
(re-search-forward "\n=+$" nil t)
|
|
|
|
|
(replace-match "")
|
|
|
|
|
(while (re-search-backward "^ +\n?" nil t) (replace-match "")))
|
|
|
|
|
(re-search-forward "\n=+$" nil t)
|
|
|
|
|
(delete-region (point-min) (min (point-max) (1+ (match-end 0)))))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward "^ +\n" nil t)
|
|
|
|
|
(replace-match ""))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (re-search-forward "^Org-mode dummy\n?" nil t)
|
2009-04-02 16:20:47 +00:00
|
|
|
|
(replace-match ""))
|
|
|
|
|
(run-hooks 'org-agenda-cleanup-fancy-diary-hook))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;; Make sure entries from the diary have the right text properties.
|
|
|
|
|
(eval-after-load "diary-lib"
|
|
|
|
|
'(if (boundp 'diary-modify-entry-list-string-function)
|
|
|
|
|
;; We can rely on the hook, nothing to do
|
|
|
|
|
nil
|
2008-12-16 14:25:23 +00:00
|
|
|
|
;; Hook not available, must use advice to make this work
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defadvice add-to-diary-list (before org-mark-diary-entry activate)
|
|
|
|
|
"Make the position visible."
|
|
|
|
|
(if (and org-disable-agenda-to-diary ;; called from org-agenda
|
|
|
|
|
(stringp string)
|
|
|
|
|
buffer-file-name)
|
|
|
|
|
(setq string (org-modify-diary-entry-string string))))))
|
|
|
|
|
|
|
|
|
|
(defun org-modify-diary-entry-string (string)
|
|
|
|
|
"Add text properties to string, allowing org-mode to act on it."
|
|
|
|
|
(org-add-props string nil
|
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo (if buffer-file-name
|
|
|
|
|
(format "mouse-2 or RET jump to diary file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))
|
|
|
|
|
"")
|
|
|
|
|
'org-agenda-diary-link t
|
|
|
|
|
'org-marker (org-agenda-new-marker (point-at-bol))))
|
|
|
|
|
|
|
|
|
|
(defun org-diary-default-entry ()
|
|
|
|
|
"Add a dummy entry to the diary.
|
|
|
|
|
Needed to avoid empty dates which mess up holiday display."
|
|
|
|
|
;; Catch the error if dealing with the new add-to-diary-alist
|
|
|
|
|
(when org-disable-agenda-to-diary
|
|
|
|
|
(condition-case nil
|
2008-04-18 03:34:16 +00:00
|
|
|
|
(org-add-to-diary-list original-date "Org-mode dummy" "")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(error
|
2008-04-18 03:34:16 +00:00
|
|
|
|
(org-add-to-diary-list original-date "Org-mode dummy" "" nil)))))
|
|
|
|
|
|
|
|
|
|
(defun org-add-to-diary-list (&rest args)
|
|
|
|
|
(if (fboundp 'diary-add-to-list)
|
|
|
|
|
(apply 'diary-add-to-list args)
|
|
|
|
|
(apply 'add-to-diary-list args)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-03-29 09:24:06 +00:00
|
|
|
|
(defvar org-diary-last-run-time nil)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-diary (&rest args)
|
2012-08-13 14:30:43 +00:00
|
|
|
|
"Return diary information from org files.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
This function can be used in a \"sexp\" diary entry in the Emacs calendar.
|
|
|
|
|
It accesses org files and extracts information from those files to be
|
|
|
|
|
listed in the diary. The function accepts arguments specifying what
|
2010-03-10 12:52:06 +00:00
|
|
|
|
items should be listed. For a list of arguments allowed here, see the
|
|
|
|
|
variable `org-agenda-entry-types'.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
The call in the diary file should look like this:
|
|
|
|
|
|
|
|
|
|
&%%(org-diary) ~/path/to/some/orgfile.org
|
|
|
|
|
|
|
|
|
|
Use a separate line for each org file to check. Or, if you omit the file name,
|
|
|
|
|
all files listed in `org-agenda-files' will be checked automatically:
|
|
|
|
|
|
|
|
|
|
&%%(org-diary)
|
|
|
|
|
|
2013-03-16 17:56:56 +00:00
|
|
|
|
If you don't give any arguments (as in the example above), the default value
|
|
|
|
|
of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp).
|
2008-03-22 15:52:18 +00:00
|
|
|
|
So the example above may also be written as
|
|
|
|
|
|
|
|
|
|
&%%(org-diary :deadline :timestamp :sexp :scheduled)
|
|
|
|
|
|
|
|
|
|
The function expects the lisp variables `entry' and `date' to be provided
|
|
|
|
|
by the caller, because this is how the calendar works. Don't use this
|
|
|
|
|
function from a program - use `org-agenda-get-day-entries' instead."
|
2009-09-02 12:37:47 +00:00
|
|
|
|
(when (> (- (org-float-time)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
org-agenda-last-marker-time)
|
|
|
|
|
5)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
;; I am not sure if this works with sticky agendas, because the marker
|
|
|
|
|
;; list is then no longer a global variable.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-reset-markers))
|
2012-08-30 08:10:18 +00:00
|
|
|
|
(org-compile-prefix-format 'agenda)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-set-sorting-strategy 'agenda)
|
2013-03-16 17:56:56 +00:00
|
|
|
|
(setq args (or args org-agenda-entry-types))
|
2012-04-02 14:45:47 +00:00
|
|
|
|
(let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
|
|
|
|
|
(list entry)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-files t)))
|
2010-03-29 09:24:06 +00:00
|
|
|
|
(time (org-float-time))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
file rtn results)
|
2010-03-29 09:24:06 +00:00
|
|
|
|
(when (or (not org-diary-last-run-time)
|
|
|
|
|
(> (- time
|
|
|
|
|
org-diary-last-run-time)
|
|
|
|
|
3))
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-buffers files))
|
2010-03-29 09:24:06 +00:00
|
|
|
|
(setq org-diary-last-run-time time)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; If this is called during org-agenda, don't return any entries to
|
|
|
|
|
;; the calendar. Org Agenda will list these entries itself.
|
|
|
|
|
(if org-disable-agenda-to-diary (setq files nil))
|
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(setq rtn (apply 'org-agenda-get-day-entries file date args))
|
|
|
|
|
(setq results (append results rtn)))
|
2013-01-24 14:05:41 +00:00
|
|
|
|
(when results
|
|
|
|
|
(setq results
|
|
|
|
|
(mapcar (lambda (i) (replace-regexp-in-string
|
|
|
|
|
org-bracket-link-regexp "\\3" i)) results))
|
|
|
|
|
(concat (org-agenda-finalize-entries results) "\n"))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Agenda entry finders
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-get-day-entries (file date &rest args)
|
|
|
|
|
"Does the work for `org-diary' and `org-agenda'.
|
|
|
|
|
FILE is the path to a file to be checked for entries. DATE is date like
|
|
|
|
|
the one returned by `calendar-current-date'. ARGS are symbols indicating
|
|
|
|
|
which kind of entries should be extracted. For details about these, see
|
|
|
|
|
the documentation of `org-diary'."
|
2013-03-16 17:56:56 +00:00
|
|
|
|
(setq args (or args org-agenda-entry-types))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((org-startup-folded nil)
|
|
|
|
|
(org-startup-align-all-tables nil)
|
|
|
|
|
(buffer (if (file-exists-p file)
|
|
|
|
|
(org-get-agenda-file-buffer file)
|
|
|
|
|
(error "No such file %s" file)))
|
2009-08-07 21:59:07 +00:00
|
|
|
|
arg results rtn deadline-results)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (not buffer)
|
|
|
|
|
;; If file does not exist, make sure an error message ends up in diary
|
|
|
|
|
(list (format "ORG-AGENDA-ERROR: No such org-file %s" file))
|
|
|
|
|
(with-current-buffer buffer
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(unless (derived-mode-p 'org-mode)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(error "Agenda file %s is not in `org-mode'" file))
|
2012-08-30 07:52:03 +00:00
|
|
|
|
(setq org-agenda-buffer (or org-agenda-buffer buffer))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((case-fold-search nil))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(if org-agenda-restrict
|
|
|
|
|
(narrow-to-region org-agenda-restrict-begin
|
|
|
|
|
org-agenda-restrict-end)
|
|
|
|
|
(widen))
|
|
|
|
|
;; The way we repeatedly append to `results' makes it O(n^2) :-(
|
|
|
|
|
(while (setq arg (pop args))
|
|
|
|
|
(cond
|
|
|
|
|
((and (eq arg :todo)
|
2011-02-04 16:47:03 +00:00
|
|
|
|
(equal date (calendar-gregorian-from-absolute
|
|
|
|
|
(org-today))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq rtn (org-agenda-get-todos))
|
|
|
|
|
(setq results (append results rtn)))
|
|
|
|
|
((eq arg :timestamp)
|
|
|
|
|
(setq rtn (org-agenda-get-blocks))
|
|
|
|
|
(setq results (append results rtn))
|
2012-01-29 12:02:27 +00:00
|
|
|
|
(setq rtn (org-agenda-get-timestamps deadline-results))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq results (append results rtn)))
|
|
|
|
|
((eq arg :sexp)
|
|
|
|
|
(setq rtn (org-agenda-get-sexps))
|
|
|
|
|
(setq results (append results rtn)))
|
|
|
|
|
((eq arg :scheduled)
|
2009-08-07 21:59:07 +00:00
|
|
|
|
(setq rtn (org-agenda-get-scheduled deadline-results))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq results (append results rtn)))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
((eq arg :scheduled*)
|
|
|
|
|
(setq rtn (org-agenda-get-scheduled deadline-results t))
|
|
|
|
|
(setq results (append results rtn)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq arg :closed)
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(setq rtn (org-agenda-get-progress))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq results (append results rtn)))
|
|
|
|
|
((eq arg :deadline)
|
|
|
|
|
(setq rtn (org-agenda-get-deadlines))
|
2009-08-07 21:59:07 +00:00
|
|
|
|
(setq deadline-results (copy-sequence rtn))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(setq results (append results rtn)))
|
|
|
|
|
((eq arg :deadline*)
|
|
|
|
|
(setq rtn (org-agenda-get-deadlines t))
|
|
|
|
|
(setq deadline-results (copy-sequence rtn))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq results (append results rtn))))))))
|
|
|
|
|
results))))
|
|
|
|
|
|
2013-02-05 16:35:51 +00:00
|
|
|
|
(defsubst org-em (x y list)
|
|
|
|
|
"Is X or Y a member of LIST?"
|
|
|
|
|
(or (memq x list) (memq y list)))
|
|
|
|
|
|
2011-10-28 15:26:22 +00:00
|
|
|
|
(defvar org-heading-keyword-regexp-format) ; defined in org.el
|
2013-02-05 16:35:51 +00:00
|
|
|
|
(defvar org-agenda-sorting-strategy-selected nil)
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-get-todos ()
|
|
|
|
|
"Return the TODO information for agenda display."
|
|
|
|
|
(let* ((props (list 'face nil
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'done-face 'org-agenda-done
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
2011-08-24 23:58:29 +00:00
|
|
|
|
(regexp (format org-heading-keyword-regexp-format
|
|
|
|
|
(cond
|
|
|
|
|
((and org-select-this-todo-keyword
|
|
|
|
|
(equal org-select-this-todo-keyword "*"))
|
|
|
|
|
org-todo-regexp)
|
|
|
|
|
(org-select-this-todo-keyword
|
|
|
|
|
(concat "\\("
|
|
|
|
|
(mapconcat 'identity
|
|
|
|
|
(org-split-string
|
|
|
|
|
org-select-this-todo-keyword
|
|
|
|
|
"|")
|
|
|
|
|
"\\|") "\\)"))
|
|
|
|
|
(t org-not-done-regexp))))
|
2013-02-05 14:03:29 +00:00
|
|
|
|
marker priority category category-pos level tags todo-state ts-date ts-date-type
|
2013-04-05 16:17:26 +00:00
|
|
|
|
ee txt beg end inherited-tags todo-state-end-pos)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(save-match-data
|
|
|
|
|
(beginning-of-line)
|
2011-05-08 09:18:58 +00:00
|
|
|
|
(org-agenda-skip)
|
2009-01-28 13:35:07 +00:00
|
|
|
|
(setq beg (point) end (save-excursion (outline-next-heading) (point)))
|
2013-04-05 16:17:26 +00:00
|
|
|
|
(unless (and (setq todo-state (org-get-todo-state))
|
|
|
|
|
(setq todo-state-end-pos (match-end 2)))
|
|
|
|
|
(goto-char end)
|
|
|
|
|
(throw :skip nil))
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (1+ beg))
|
|
|
|
|
(or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
|
|
|
|
|
(throw :skip nil)))
|
2011-08-24 23:58:29 +00:00
|
|
|
|
(goto-char (match-beginning 2))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq marker (org-agenda-new-marker (match-beginning 0))
|
|
|
|
|
category (org-get-category)
|
2013-02-05 14:03:29 +00:00
|
|
|
|
ts-date (let (ts)
|
|
|
|
|
(save-match-data
|
|
|
|
|
(cond ((org-em 'scheduled-up 'scheduled-down
|
|
|
|
|
org-agenda-sorting-strategy-selected)
|
|
|
|
|
(setq ts (org-entry-get (point) "SCHEDULED")
|
|
|
|
|
ts-date-type " scheduled"))
|
|
|
|
|
((org-em 'deadline-up 'deadline-down
|
|
|
|
|
org-agenda-sorting-strategy-selected)
|
|
|
|
|
(setq ts (org-entry-get (point) "DEADLINE")
|
|
|
|
|
ts-date-type " deadline"))
|
|
|
|
|
((org-em 'ts-up 'ts-down
|
|
|
|
|
org-agenda-sorting-strategy-selected)
|
|
|
|
|
(setq ts (org-entry-get (point) "TIMESTAMP")
|
|
|
|
|
ts-date-type " timestamp"))
|
|
|
|
|
((org-em 'tsia-up 'tsia-down
|
|
|
|
|
org-agenda-sorting-strategy-selected)
|
|
|
|
|
(setq ts (org-entry-get (point) "TIMESTAMP_IA")
|
|
|
|
|
ts-date-type " timestamp_ia"))
|
|
|
|
|
((org-em 'timestamp-up 'timestamp-down
|
|
|
|
|
org-agenda-sorting-strategy-selected)
|
|
|
|
|
(setq ts (or (org-entry-get (point) "SCHEDULED")
|
|
|
|
|
(org-entry-get (point) "DEADLINE")
|
|
|
|
|
(org-entry-get (point) "TIMESTAMP")
|
|
|
|
|
(org-entry-get (point) "TIMESTAMP_IA"))
|
|
|
|
|
ts-date-type ""))
|
|
|
|
|
(t (setq ts-date-type "")))
|
2013-02-07 18:40:39 +00:00
|
|
|
|
(when ts (ignore-errors (org-time-string-to-absolute ts)))))
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property (point) 'org-category-position)
|
2011-11-14 07:35:12 +00:00
|
|
|
|
txt (org-trim
|
|
|
|
|
(buffer-substring (match-beginning 2) (match-end 0)))
|
2013-01-11 16:15:17 +00:00
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'todo org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'todo org-agenda-use-tag-inheritance))))
|
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
level (make-string (org-reduced-level (org-outline-level)) ? )
|
2012-09-23 14:27:25 +00:00
|
|
|
|
txt (org-agenda-format-item "" txt level category tags t)
|
2013-04-05 16:17:26 +00:00
|
|
|
|
priority (1+ (org-get-priority txt)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-add-props txt props
|
|
|
|
|
'org-marker marker 'org-hd-marker marker
|
|
|
|
|
'priority priority 'org-category category
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2013-02-05 14:03:29 +00:00
|
|
|
|
'ts-date ts-date
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos
|
2013-02-05 14:03:29 +00:00
|
|
|
|
'type (concat "todo" ts-date-type) 'todo-state todo-state)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(push txt ee)
|
|
|
|
|
(if org-agenda-todo-list-sublevels
|
2013-04-05 16:17:26 +00:00
|
|
|
|
(goto-char todo-state-end-pos)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-end-of-subtree 'invisible))))
|
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
2011-01-18 01:51:42 +00:00
|
|
|
|
(defun org-agenda-todo-custom-ignore-p (time n)
|
2012-09-25 16:30:55 +00:00
|
|
|
|
"Check whether timestamp is farther away than n number of days.
|
2011-01-18 01:51:42 +00:00
|
|
|
|
This function is invoked if `org-agenda-todo-ignore-deadlines',
|
|
|
|
|
`org-agenda-todo-ignore-scheduled' or
|
|
|
|
|
`org-agenda-todo-ignore-timestamp' is set to an integer."
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(let ((days (org-time-stamp-to-now
|
|
|
|
|
time org-agenda-todo-ignore-time-comparison-use-seconds)))
|
2011-01-18 01:51:42 +00:00
|
|
|
|
(if (>= n 0)
|
|
|
|
|
(>= days n)
|
|
|
|
|
(<= days n))))
|
|
|
|
|
|
2010-02-12 23:06:15 +00:00
|
|
|
|
(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
|
|
|
|
|
(&optional end)
|
2010-02-14 21:41:54 +00:00
|
|
|
|
"Do we have a reason to ignore this TODO entry because it has a time stamp?"
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(when (or org-agenda-todo-ignore-with-date
|
|
|
|
|
org-agenda-todo-ignore-scheduled
|
2010-11-25 18:32:56 +00:00
|
|
|
|
org-agenda-todo-ignore-deadlines
|
|
|
|
|
org-agenda-todo-ignore-timestamp)
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(setq end (or end (save-excursion (outline-next-heading) (point))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(or (and org-agenda-todo-ignore-with-date
|
|
|
|
|
(re-search-forward org-ts-regexp end t))
|
|
|
|
|
(and org-agenda-todo-ignore-scheduled
|
2010-02-12 23:06:15 +00:00
|
|
|
|
(re-search-forward org-scheduled-time-regexp end t)
|
|
|
|
|
(cond
|
|
|
|
|
((eq org-agenda-todo-ignore-scheduled 'future)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(> (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2010-02-12 23:06:15 +00:00
|
|
|
|
((eq org-agenda-todo-ignore-scheduled 'past)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(<= (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2011-01-18 01:51:42 +00:00
|
|
|
|
((numberp org-agenda-todo-ignore-scheduled)
|
|
|
|
|
(org-agenda-todo-custom-ignore-p
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-scheduled))
|
2010-02-12 23:06:15 +00:00
|
|
|
|
(t)))
|
2009-01-25 06:39:26 +00:00
|
|
|
|
(and org-agenda-todo-ignore-deadlines
|
|
|
|
|
(re-search-forward org-deadline-time-regexp end t)
|
2010-02-12 23:06:15 +00:00
|
|
|
|
(cond
|
|
|
|
|
((memq org-agenda-todo-ignore-deadlines '(t all)) t)
|
|
|
|
|
((eq org-agenda-todo-ignore-deadlines 'far)
|
|
|
|
|
(not (org-deadline-close (match-string 1))))
|
2010-03-24 12:13:53 +00:00
|
|
|
|
((eq org-agenda-todo-ignore-deadlines 'future)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(> (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2010-03-24 12:13:53 +00:00
|
|
|
|
((eq org-agenda-todo-ignore-deadlines 'past)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(<= (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2011-01-18 01:51:42 +00:00
|
|
|
|
((numberp org-agenda-todo-ignore-deadlines)
|
|
|
|
|
(org-agenda-todo-custom-ignore-p
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-deadlines))
|
2010-11-25 18:32:56 +00:00
|
|
|
|
(t (org-deadline-close (match-string 1)))))
|
|
|
|
|
(and org-agenda-todo-ignore-timestamp
|
|
|
|
|
(let ((buffer (current-buffer))
|
|
|
|
|
(regexp
|
|
|
|
|
(concat
|
|
|
|
|
org-scheduled-time-regexp "\\|" org-deadline-time-regexp))
|
|
|
|
|
(start (point)))
|
|
|
|
|
;; Copy current buffer into a temporary one
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-buffer-substring buffer start end)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; Delete SCHEDULED and DEADLINE items
|
|
|
|
|
(while (re-search-forward regexp end t)
|
|
|
|
|
(delete-region (match-beginning 0) (match-end 0)))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; No search for timestamp left
|
|
|
|
|
(when (re-search-forward org-ts-regexp nil t)
|
|
|
|
|
(cond
|
|
|
|
|
((eq org-agenda-todo-ignore-timestamp 'future)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(> (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2010-11-25 18:32:56 +00:00
|
|
|
|
((eq org-agenda-todo-ignore-timestamp 'past)
|
2012-09-26 10:06:19 +00:00
|
|
|
|
(<= (org-time-stamp-to-now
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-time-comparison-use-seconds) 0))
|
2011-01-18 01:51:42 +00:00
|
|
|
|
((numberp org-agenda-todo-ignore-timestamp)
|
|
|
|
|
(org-agenda-todo-custom-ignore-p
|
|
|
|
|
(match-string 1) org-agenda-todo-ignore-timestamp))
|
2010-11-25 18:32:56 +00:00
|
|
|
|
(t))))))))))
|
2009-01-25 06:39:26 +00:00
|
|
|
|
|
2012-01-29 12:02:27 +00:00
|
|
|
|
(defun org-agenda-get-timestamps (&optional deadline-results)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Return the date stamp information for agenda display."
|
2011-11-18 12:41:47 +00:00
|
|
|
|
(let* ((props (list 'face 'org-agenda-calendar-event
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
|
|
|
|
(d1 (calendar-absolute-from-gregorian date))
|
2012-01-29 12:02:27 +00:00
|
|
|
|
mm
|
|
|
|
|
(deadline-position-alist
|
|
|
|
|
(mapcar (lambda (a) (and (setq mm (get-text-property
|
|
|
|
|
0 'org-hd-marker a))
|
|
|
|
|
(cons (marker-position mm) a)))
|
|
|
|
|
deadline-results))
|
2012-05-08 14:07:52 +00:00
|
|
|
|
(remove-re org-ts-regexp)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(regexp
|
|
|
|
|
(concat
|
2008-04-10 12:48:59 +00:00
|
|
|
|
(if org-agenda-include-inactive-timestamps "[[<]" "<")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(regexp-quote
|
|
|
|
|
(substring
|
|
|
|
|
(format-time-string
|
|
|
|
|
(car org-time-stamp-formats)
|
|
|
|
|
(apply 'encode-time ; DATE bound by calendar
|
|
|
|
|
(list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
|
2008-04-10 12:48:59 +00:00
|
|
|
|
1 11))
|
Support hourly repeat cookies.
* org.el (org-repeat-re)
(org-clone-subtree-with-time-shift, org-auto-repeat-maybe)
(org-deadline, org-schedule, org-matcher-time)
(org-time-stamp, org-read-date, org-read-date-get-relative)
(org-display-custom-time, org-get-wdays)
(org-time-string-to-absolute, org-closest-date)
(org-timestamp-change): Allow to set hourly repeat cookie.
Send an error when an hourly repeat cookie is set and no hour
is specified in the timestamp.
* org.texi (Repeated tasks): Document repeat cookies for
years, months, weeks, days and hours.
* org-agenda.el (org-agenda-get-timestamps): Match hourly
repeat cookies.
* org-icalendar.el (org-print-icalendar-entries): Handle
hourly repeat cookies.
Thanks a lot to Takafumi Arakaki for this idea and for a preliminary
version of this patch.
2012-04-20 14:55:48 +00:00
|
|
|
|
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
|
2008-04-10 12:48:59 +00:00
|
|
|
|
marker hdmarker deadlinep scheduledp clockp closedp inactivep
|
2012-09-12 09:41:50 +00:00
|
|
|
|
donep tmp priority category category-pos level ee txt timestr tags
|
2013-01-11 16:15:17 +00:00
|
|
|
|
b0 b3 e3 head todo-state end-of-match show-all warntime habitp
|
2013-02-05 14:03:29 +00:00
|
|
|
|
inherited-tags ts-date)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
2009-04-22 07:40:40 +00:00
|
|
|
|
(while (setq end-of-match (re-search-forward regexp nil t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq b0 (match-beginning 0)
|
2011-02-02 09:35:56 +00:00
|
|
|
|
b3 (match-beginning 3) e3 (match-end 3)
|
|
|
|
|
todo-state (save-match-data (ignore-errors (org-get-todo-state)))
|
2012-10-03 09:14:06 +00:00
|
|
|
|
habitp (and (functionp 'org-is-habit-p) (save-match-data (org-is-habit-p)))
|
2011-02-02 09:35:56 +00:00
|
|
|
|
show-all (or (eq org-agenda-repeating-timestamp-show-all t)
|
2011-03-10 09:42:57 +00:00
|
|
|
|
(member todo-state
|
2011-02-02 09:35:56 +00:00
|
|
|
|
org-agenda-repeating-timestamp-show-all)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(catch :skip
|
|
|
|
|
(and (org-at-date-range-p) (throw :skip nil))
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(if (and (match-end 1)
|
|
|
|
|
(not (= d1 (org-time-string-to-absolute
|
2011-10-04 12:12:11 +00:00
|
|
|
|
(match-string 1) d1 nil show-all
|
|
|
|
|
(current-buffer) b0))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(throw :skip nil))
|
|
|
|
|
(if (and e3
|
|
|
|
|
(not (org-diary-sexp-entry (buffer-substring b3 e3) "" date)))
|
|
|
|
|
(throw :skip nil))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(setq tmp (buffer-substring (max (point-min)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(- b0 org-ds-keyword-length))
|
|
|
|
|
b0)
|
|
|
|
|
timestr (if b3 "" (buffer-substring b0 (point-at-eol)))
|
2008-04-10 12:48:59 +00:00
|
|
|
|
inactivep (= (char-after b0) ?\[)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
deadlinep (string-match org-deadline-regexp tmp)
|
|
|
|
|
scheduledp (string-match org-scheduled-regexp tmp)
|
2008-04-10 12:48:59 +00:00
|
|
|
|
closedp (and org-agenda-include-inactive-timestamps
|
|
|
|
|
(string-match org-closed-string tmp))
|
|
|
|
|
clockp (and org-agenda-include-inactive-timestamps
|
|
|
|
|
(or (string-match org-clock-string tmp)
|
|
|
|
|
(string-match "]-+\\'" tmp)))
|
2013-01-07 11:50:49 +00:00
|
|
|
|
warntime (get-text-property (point) 'org-appt-warntime)
|
2008-09-18 11:45:49 +00:00
|
|
|
|
donep (member todo-state org-done-keywords))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(if (or scheduledp deadlinep closedp clockp
|
|
|
|
|
(and donep org-agenda-skip-timestamp-if-done))
|
2008-04-10 12:48:59 +00:00
|
|
|
|
(throw :skip t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (string-match ">" timestr)
|
|
|
|
|
;; substring should only run to end of time stamp
|
|
|
|
|
(setq timestr (substring timestr 0 (match-end 0))))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(setq marker (org-agenda-new-marker b0)
|
2011-08-25 13:20:10 +00:00
|
|
|
|
category (org-get-category b0)
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property b0 'org-category-position))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
|
(if (not (re-search-backward org-outline-regexp-bol nil t))
|
2013-01-26 12:29:44 +00:00
|
|
|
|
(throw :skip nil)
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
2012-01-29 12:02:27 +00:00
|
|
|
|
(if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown)
|
|
|
|
|
(assoc (point) deadline-position-alist))
|
|
|
|
|
(throw :skip nil))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(setq hdmarker (org-agenda-new-marker)
|
2013-01-11 16:15:17 +00:00
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'agenda org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'agenda org-agenda-use-tag-inheritance))))
|
2013-01-11 16:19:52 +00:00
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
level (make-string (org-reduced-level (org-outline-level)) ? ))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
|
2011-04-13 17:12:10 +00:00
|
|
|
|
(setq head (or (match-string 1) ""))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(setq txt (org-agenda-format-item
|
2009-12-16 07:53:18 +00:00
|
|
|
|
(if inactivep org-agenda-inactive-leader nil)
|
2012-09-12 09:41:50 +00:00
|
|
|
|
head level category tags timestr
|
2012-10-01 15:53:39 +00:00
|
|
|
|
remove-re habitp)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq priority (org-get-priority txt))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(org-add-props txt props 'priority priority
|
|
|
|
|
'org-marker marker 'org-hd-marker hdmarker
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'org-category category 'date date
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2013-02-07 18:40:39 +00:00
|
|
|
|
'ts-date
|
|
|
|
|
(ignore-errors (org-time-string-to-absolute timestr))
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos
|
2008-09-18 11:45:49 +00:00
|
|
|
|
'todo-state todo-state
|
2012-08-19 19:48:52 +00:00
|
|
|
|
'warntime warntime
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'type "timestamp")
|
|
|
|
|
(push txt ee))
|
2009-04-22 07:40:40 +00:00
|
|
|
|
(if org-agenda-skip-additional-timestamps-same-entry
|
|
|
|
|
(outline-next-heading)
|
|
|
|
|
(goto-char end-of-match))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-get-sexps ()
|
|
|
|
|
"Return the sexp information for agenda display."
|
|
|
|
|
(require 'diary-lib)
|
2011-11-18 12:41:47 +00:00
|
|
|
|
(let* ((props (list 'face 'org-agenda-calendar-sexp
|
|
|
|
|
'mouse-face 'highlight
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
|
|
|
|
(regexp "^&?%%(")
|
2012-09-12 09:41:50 +00:00
|
|
|
|
marker category extra category-pos level ee txt tags entry
|
2013-01-11 16:15:17 +00:00
|
|
|
|
result beg b sexp sexp-entry todo-state warntime inherited-tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq beg (match-beginning 0))
|
|
|
|
|
(goto-char (1- (match-end 0)))
|
|
|
|
|
(setq b (point))
|
|
|
|
|
(forward-sexp 1)
|
|
|
|
|
(setq sexp (buffer-substring b (point)))
|
|
|
|
|
(setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)")
|
|
|
|
|
(org-trim (match-string 1))
|
|
|
|
|
""))
|
|
|
|
|
(setq result (org-diary-sexp-entry sexp sexp-entry date))
|
|
|
|
|
(when result
|
|
|
|
|
(setq marker (org-agenda-new-marker beg)
|
2012-09-12 16:17:01 +00:00
|
|
|
|
level (make-string (org-reduced-level (org-outline-level)) ? )
|
2009-02-16 06:52:41 +00:00
|
|
|
|
category (org-get-category beg)
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property beg 'org-category-position)
|
2013-01-11 16:15:17 +00:00
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'agenda org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'agenda org-agenda-use-tag-inheritance))))
|
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags))
|
2012-08-19 19:48:52 +00:00
|
|
|
|
todo-state (org-get-todo-state)
|
2013-01-07 11:50:49 +00:00
|
|
|
|
warntime (get-text-property (point) 'org-appt-warntime)
|
2012-10-26 12:06:28 +00:00
|
|
|
|
extra nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-10-24 20:01:47 +00:00
|
|
|
|
(dolist (r (if (stringp result)
|
|
|
|
|
(list result)
|
|
|
|
|
result)) ;; we expect a list here
|
2012-01-29 09:51:46 +00:00
|
|
|
|
(when (and org-agenda-diary-sexp-prefix
|
|
|
|
|
(string-match org-agenda-diary-sexp-prefix r))
|
|
|
|
|
(setq extra (match-string 0 r)
|
|
|
|
|
r (replace-match "" nil nil r)))
|
2010-10-24 20:01:47 +00:00
|
|
|
|
(if (string-match "\\S-" r)
|
|
|
|
|
(setq txt r)
|
|
|
|
|
(setq txt "SEXP entry returned empty string"))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(setq txt (org-agenda-format-item extra txt level category tags 'time))
|
|
|
|
|
(org-add-props txt props 'org-marker marker
|
2010-10-24 20:01:47 +00:00
|
|
|
|
'org-category category 'date date 'todo-state todo-state
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos 'tags tags
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2012-08-19 19:48:52 +00:00
|
|
|
|
'type "sexp" 'warntime warntime)
|
2010-10-24 20:01:47 +00:00
|
|
|
|
(push txt ee)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
2011-06-16 09:05:17 +00:00
|
|
|
|
;; Calendar sanity: define some functions that are independent of
|
|
|
|
|
;; `calendar-date-style'.
|
|
|
|
|
;; Normally I would like to use ISO format when calling the diary functions,
|
|
|
|
|
;; but to make sure we still have Emacs 22 compatibility we bind
|
|
|
|
|
;; also `european-calendar-style' and use european format
|
|
|
|
|
(defun org-anniversary (year month day &optional mark)
|
|
|
|
|
"Like `diary-anniversary', but with fixed (ISO) order of arguments."
|
|
|
|
|
(org-no-warnings
|
|
|
|
|
(let ((calendar-date-style 'european) (european-calendar-style t))
|
|
|
|
|
(diary-anniversary day month year mark))))
|
|
|
|
|
(defun org-cyclic (N year month day &optional mark)
|
|
|
|
|
"Like `diary-cyclic', but with fixed (ISO) order of arguments."
|
|
|
|
|
(org-no-warnings
|
|
|
|
|
(let ((calendar-date-style 'european) (european-calendar-style t))
|
|
|
|
|
(diary-cyclic N day month year mark))))
|
|
|
|
|
(defun org-block (Y1 M1 D1 Y2 M2 D2 &optional mark)
|
|
|
|
|
"Like `diary-block', but with fixed (ISO) order of arguments."
|
|
|
|
|
(org-no-warnings
|
|
|
|
|
(let ((calendar-date-style 'european) (european-calendar-style t))
|
|
|
|
|
(diary-block D1 M1 Y1 D2 M2 Y2 mark))))
|
|
|
|
|
(defun org-date (year month day &optional mark)
|
|
|
|
|
"Like `diary-date', but with fixed (ISO) order of arguments."
|
|
|
|
|
(org-no-warnings
|
|
|
|
|
(let ((calendar-date-style 'european) (european-calendar-style t))
|
|
|
|
|
(diary-date day month year mark))))
|
|
|
|
|
|
|
|
|
|
;; Define the` org-class' function
|
|
|
|
|
(defun org-class (y1 m1 d1 y2 m2 d2 dayname &rest skip-weeks)
|
2009-12-28 18:43:04 +00:00
|
|
|
|
"Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS.
|
2011-10-25 14:07:01 +00:00
|
|
|
|
DAYNAME is a number between 0 (Sunday) and 6 (Saturday).
|
|
|
|
|
SKIP-WEEKS is any number of ISO weeks in the block period for which the
|
|
|
|
|
item should be skipped. If any of the SKIP-WEEKS arguments is the symbol
|
|
|
|
|
`holidays', then any date that is known by the Emacs calendar to be a
|
2012-08-30 07:48:11 +00:00
|
|
|
|
holiday will also be skipped. If SKIP-WEEKS arguments are holiday strings,
|
|
|
|
|
then those holidays will be skipped."
|
2011-06-16 09:05:17 +00:00
|
|
|
|
(let* ((date1 (calendar-absolute-from-gregorian (list m1 d1 y1)))
|
|
|
|
|
(date2 (calendar-absolute-from-gregorian (list m2 d2 y2)))
|
2012-08-30 07:48:11 +00:00
|
|
|
|
(d (calendar-absolute-from-gregorian date))
|
|
|
|
|
(h (when skip-weeks (calendar-check-holidays date))))
|
2009-12-28 18:43:04 +00:00
|
|
|
|
(and
|
|
|
|
|
(<= date1 d)
|
|
|
|
|
(<= d date2)
|
|
|
|
|
(= (calendar-day-of-week date) dayname)
|
|
|
|
|
(or (not skip-weeks)
|
|
|
|
|
(progn
|
|
|
|
|
(require 'cal-iso)
|
|
|
|
|
(not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
|
2012-08-30 07:48:11 +00:00
|
|
|
|
(not (or (and h (memq 'holidays skip-weeks))
|
|
|
|
|
(delq nil (mapcar (lambda(g) (member g skip-weeks)) h))))
|
2012-04-02 14:45:47 +00:00
|
|
|
|
entry)))
|
2009-12-28 18:43:04 +00:00
|
|
|
|
|
2011-06-16 09:05:17 +00:00
|
|
|
|
(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
|
|
|
|
|
"Like `org-class', but honor `calendar-date-style'.
|
|
|
|
|
The order of the first 2 times 3 arguments depends on the variable
|
|
|
|
|
`calendar-date-style' or, if that is not defined, on `european-calendar-style'.
|
|
|
|
|
So for American calendars, give this as MONTH DAY YEAR, for European as
|
|
|
|
|
DAY MONTH YEAR, and for ISO as YEAR MONTH DAY.
|
|
|
|
|
DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS
|
|
|
|
|
is any number of ISO weeks in the block period for which the item should
|
|
|
|
|
be skipped.
|
|
|
|
|
|
|
|
|
|
This function is here only for backward compatibility and it is deprecated,
|
|
|
|
|
please use `org-class' instead."
|
2011-07-04 09:00:54 +00:00
|
|
|
|
(let* ((date1 (org-order-calendar-date-args m1 d1 y1))
|
|
|
|
|
(date2 (org-order-calendar-date-args m2 d2 y2)))
|
2011-06-16 09:05:17 +00:00
|
|
|
|
(org-class
|
|
|
|
|
(nth 2 date1) (car date1) (nth 1 date1)
|
|
|
|
|
(nth 2 date2) (car date2) (nth 1 date2)
|
|
|
|
|
dayname skip-weeks)))
|
2011-10-25 14:00:06 +00:00
|
|
|
|
(make-obsolete 'org-diary-class 'org-class "")
|
2011-06-16 09:05:17 +00:00
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list'
|
2008-11-24 11:21:40 +00:00
|
|
|
|
(defalias 'org-get-closed 'org-agenda-get-progress)
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(defun org-agenda-get-progress ()
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Return the logged TODO entries for agenda display."
|
|
|
|
|
(let* ((props (list 'mouse-face 'highlight
|
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
2012-03-09 13:36:03 +00:00
|
|
|
|
(items (if (consp org-agenda-show-log-scoped)
|
|
|
|
|
org-agenda-show-log-scoped
|
|
|
|
|
(if (eq org-agenda-show-log-scoped 'clockcheck)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
'(clock)
|
|
|
|
|
org-agenda-log-mode-items)))
|
2008-12-04 14:33:43 +00:00
|
|
|
|
(parts
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(delq nil
|
|
|
|
|
(list
|
|
|
|
|
(if (memq 'closed items) (concat "\\<" org-closed-string))
|
|
|
|
|
(if (memq 'clock items) (concat "\\<" org-clock-string))
|
2009-02-20 21:55:50 +00:00
|
|
|
|
(if (memq 'state items) "- State \"\\([a-zA-Z0-9]+\\)\".*?"))))
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(parts-re (if parts (mapconcat 'identity parts "\\|")
|
|
|
|
|
(error "`org-agenda-log-mode-items' is empty")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(regexp (concat
|
2008-11-05 16:26:52 +00:00
|
|
|
|
"\\(" parts-re "\\)"
|
|
|
|
|
" *\\["
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(regexp-quote
|
|
|
|
|
(substring
|
|
|
|
|
(format-time-string
|
|
|
|
|
(car org-time-stamp-formats)
|
|
|
|
|
(apply 'encode-time ; DATE bound by calendar
|
|
|
|
|
(list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
|
|
|
|
|
1 11))))
|
2009-05-14 12:24:17 +00:00
|
|
|
|
(org-agenda-search-headline-for-time nil)
|
2012-09-12 09:41:50 +00:00
|
|
|
|
marker hdmarker priority category category-pos level tags closedp
|
2013-01-11 16:15:17 +00:00
|
|
|
|
statep clockp state ee txt extra timestr rest clocked inherited-tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq marker (org-agenda-new-marker (match-beginning 0))
|
|
|
|
|
closedp (equal (match-string 1) org-closed-string)
|
2008-11-05 16:26:52 +00:00
|
|
|
|
statep (equal (string-to-char (match-string 1)) ?-)
|
2009-04-03 08:24:44 +00:00
|
|
|
|
clockp (not (or closedp statep))
|
2008-11-05 16:26:52 +00:00
|
|
|
|
state (and statep (match-string 2))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
category (org-get-category (match-beginning 0))
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property (match-beginning 0) 'org-category-position)
|
2011-08-25 13:20:10 +00:00
|
|
|
|
timestr (buffer-substring (match-beginning 0) (point-at-eol)))
|
2008-06-16 15:49:53 +00:00
|
|
|
|
(when (string-match "\\]" timestr)
|
|
|
|
|
;; substring should only run to end of time stamp
|
|
|
|
|
(setq rest (substring timestr (match-end 0))
|
|
|
|
|
timestr (substring timestr 0 (match-end 0)))
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(if (and (not closedp) (not statep)
|
2011-08-25 13:20:10 +00:00
|
|
|
|
(string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)"
|
|
|
|
|
rest))
|
2008-09-21 05:41:49 +00:00
|
|
|
|
(progn (setq timestr (concat (substring timestr 0 -1)
|
|
|
|
|
"-" (match-string 1 rest) "]"))
|
|
|
|
|
(setq clocked (match-string 2 rest)))
|
|
|
|
|
(setq clocked "-")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
2011-01-26 20:52:12 +00:00
|
|
|
|
(setq extra
|
|
|
|
|
(cond
|
|
|
|
|
((not org-agenda-log-mode-add-notes) nil)
|
|
|
|
|
(statep
|
|
|
|
|
(and (looking-at ".*\\\\\n[ \t]*\\([^-\n \t].*?\\)[ \t]*$")
|
|
|
|
|
(match-string 1)))
|
|
|
|
|
(clockp
|
|
|
|
|
(and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$")
|
|
|
|
|
(match-string 1)))))
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
|
(if (not (re-search-backward org-outline-regexp-bol nil t))
|
2013-01-26 12:29:44 +00:00
|
|
|
|
(throw :skip nil)
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
|
(setq hdmarker (org-agenda-new-marker)
|
2013-01-11 16:15:17 +00:00
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'todo org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'todo org-agenda-use-tag-inheritance))))
|
2013-01-11 16:19:52 +00:00
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
level (make-string (org-reduced-level (org-outline-level)) ? ))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
|
|
|
|
|
(setq txt (match-string 1))
|
|
|
|
|
(when extra
|
|
|
|
|
(if (string-match "\\([ \t]+\\)\\(:[^ \n\t]*?:\\)[ \t]*$" txt)
|
|
|
|
|
(setq txt (concat (substring txt 0 (match-beginning 1))
|
|
|
|
|
" - " extra " " (match-string 2 txt)))
|
|
|
|
|
(setq txt (concat txt " - " extra))))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(setq txt (org-agenda-format-item
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(cond
|
|
|
|
|
(closedp "Closed: ")
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(statep (concat "State: (" state ")"))
|
|
|
|
|
(t (concat "Clocked: (" clocked ")")))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
txt level category tags timestr)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq priority 100000)
|
|
|
|
|
(org-add-props txt props
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'org-marker marker 'org-hd-marker hdmarker 'face 'org-agenda-done
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'priority priority 'org-category category
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'type "closed" 'date date
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'undone-face 'org-warning 'done-face 'org-agenda-done)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(push txt ee))
|
|
|
|
|
(goto-char (point-at-eol))))
|
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(defun org-agenda-show-clocking-issues ()
|
|
|
|
|
"Add overlays, showing issues with clocking.
|
|
|
|
|
See also the user option `org-agenda-clock-consistency-checks'."
|
|
|
|
|
(interactive)
|
2013-01-22 14:53:14 +00:00
|
|
|
|
(let* ((org-time-clocksum-use-effort-durations nil)
|
|
|
|
|
(pl org-agenda-clock-consistency-checks)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(re (concat "^[ \t]*"
|
|
|
|
|
org-clock-string
|
|
|
|
|
"[ \t]+"
|
|
|
|
|
"\\(\\[.*?\\]\\)" ; group 1 is first stamp
|
|
|
|
|
"\\(-\\{1,3\\}\\(\\[.*?\\]\\)\\)?")) ; group 3 is second
|
|
|
|
|
(tlstart 0.)
|
|
|
|
|
(tlend 0.)
|
2011-08-25 13:20:10 +00:00
|
|
|
|
(maxtime (org-hh:mm-string-to-minutes
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(or (plist-get pl :max-duration) "24:00")))
|
2011-08-25 13:20:10 +00:00
|
|
|
|
(mintime (org-hh:mm-string-to-minutes
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(or (plist-get pl :min-duration) 0)))
|
|
|
|
|
(maxgap (org-hh:mm-string-to-minutes
|
|
|
|
|
;; default 30:00 means never complain
|
|
|
|
|
(or (plist-get pl :max-gap) "30:00")))
|
|
|
|
|
(gapok (mapcar 'org-hh:mm-string-to-minutes
|
|
|
|
|
(plist-get pl :gap-ok-around)))
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(def-face (or (plist-get pl :default-face)
|
|
|
|
|
'((:background "DarkRed") (:foreground "white"))))
|
2011-05-11 08:10:24 +00:00
|
|
|
|
issue face m te ts dt ov)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward " Clocked: +(-\\|\\([0-9]+:[0-9]+\\))" nil t)
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(setq issue nil face def-face)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(catch 'next
|
|
|
|
|
(setq m (org-get-at-bol 'org-marker)
|
|
|
|
|
te nil ts nil)
|
|
|
|
|
(unless (and m (markerp m))
|
|
|
|
|
(setq issue "No valid clock line") (throw 'next t))
|
|
|
|
|
(org-with-point-at m
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-at-bol))
|
|
|
|
|
(unless (looking-at re)
|
|
|
|
|
(error "No valid Clock line")
|
|
|
|
|
(throw 'next t))
|
|
|
|
|
(unless (match-end 3)
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(setq issue "No end time"
|
|
|
|
|
face (or (plist-get pl :no-end-time-face) face))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(throw 'next t))
|
|
|
|
|
(setq ts (match-string 1)
|
|
|
|
|
te (match-string 3)
|
|
|
|
|
ts (org-float-time
|
|
|
|
|
(apply 'encode-time (org-parse-time-string ts)))
|
|
|
|
|
te (org-float-time
|
|
|
|
|
(apply 'encode-time (org-parse-time-string te)))
|
|
|
|
|
dt (- te ts))))
|
|
|
|
|
(cond
|
|
|
|
|
((> dt (* 60 maxtime))
|
|
|
|
|
;; a very long clocking chunk
|
|
|
|
|
(setq issue (format "Clocking interval is very long: %s"
|
2012-11-17 14:51:26 +00:00
|
|
|
|
(org-minutes-to-clocksum-string
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(floor (/ (float dt) 60.))))
|
|
|
|
|
face (or (plist-get pl :long-face) face)))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
((< dt (* 60 mintime))
|
|
|
|
|
;; a very short clocking chunk
|
|
|
|
|
(setq issue (format "Clocking interval is very short: %s"
|
2012-11-17 14:51:26 +00:00
|
|
|
|
(org-minutes-to-clocksum-string
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(floor (/ (float dt) 60.))))
|
|
|
|
|
face (or (plist-get pl :short-face) face)))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
((and (> tlend 0) (< ts tlend))
|
|
|
|
|
;; Two clock entries are overlapping
|
2011-04-26 15:22:50 +00:00
|
|
|
|
(setq issue (format "Clocking overlap: %d minutes"
|
|
|
|
|
(/ (- tlend ts) 60))
|
|
|
|
|
face (or (plist-get pl :overlap-face) face)))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
((and (> tlend 0) (> ts (+ tlend (* 60 maxgap))))
|
|
|
|
|
;; There is a gap, lets see if we need to report it
|
|
|
|
|
(unless (org-agenda-check-clock-gap tlend ts gapok)
|
|
|
|
|
(setq issue (format "Clocking gap: %d minutes"
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(/ (- ts tlend) 60))
|
2011-04-26 15:22:50 +00:00
|
|
|
|
face (or (plist-get pl :gap-face) face))))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(t nil)))
|
|
|
|
|
(setq tlend (or te tlend) tlstart (or ts tlstart))
|
|
|
|
|
(when issue
|
|
|
|
|
;; OK, there was some issue, add an overlay to show the issue
|
|
|
|
|
(setq ov (make-overlay (point-at-bol) (point-at-eol)))
|
|
|
|
|
(overlay-put ov 'before-string
|
|
|
|
|
(concat
|
|
|
|
|
(org-add-props
|
|
|
|
|
(format "%-43s" (concat " " issue))
|
|
|
|
|
nil
|
2011-04-26 15:22:50 +00:00
|
|
|
|
'face face)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
"\n"))
|
|
|
|
|
(overlay-put ov 'evaporate t)))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-check-clock-gap (t1 t2 ok-list)
|
|
|
|
|
"Check if gap T1 -> T2 contains one of the OK-LIST time-of-day values."
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(unless ok-list
|
|
|
|
|
;; there are no OK times for gaps...
|
|
|
|
|
(throw 'exit nil))
|
|
|
|
|
(if (> (- (/ t2 36000) (/ t1 36000)) 24)
|
|
|
|
|
;; This is more than 24 hours, so it is OK.
|
|
|
|
|
;; because we have at least one OK time, that must be in the
|
|
|
|
|
;; 24 hour interval.
|
|
|
|
|
(throw 'exit t))
|
|
|
|
|
;; We have a shorter gap.
|
|
|
|
|
;; Now we have to get the minute of the day when these times are
|
|
|
|
|
(let* ((t1dec (decode-time (seconds-to-time t1)))
|
|
|
|
|
(t2dec (decode-time (seconds-to-time t2)))
|
|
|
|
|
;; compute the minute on the day
|
|
|
|
|
(min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
|
|
|
|
|
(min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
|
|
|
|
|
(when (< min2 min1)
|
|
|
|
|
;; if min2 is smaller than min1, this means it is on the next day.
|
|
|
|
|
;; Wrap it to after midnight.
|
|
|
|
|
(setq min2 (+ min2 1440)))
|
|
|
|
|
;; Now check if any of the OK times is in the gap
|
2011-05-11 08:10:24 +00:00
|
|
|
|
(mapc (lambda (x)
|
|
|
|
|
;; Wrap the time to after midnight if necessary
|
|
|
|
|
(if (< x min1) (setq x (+ x 1440)))
|
|
|
|
|
;; Check if in interval
|
|
|
|
|
(and (<= min1 x) (>= min2 x) (throw 'exit t)))
|
|
|
|
|
ok-list)
|
2011-04-19 22:13:31 +00:00
|
|
|
|
;; Nope, this gap is not OK
|
|
|
|
|
nil)))
|
|
|
|
|
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(defun org-agenda-get-deadlines (&optional with-hour)
|
|
|
|
|
"Return the deadline information for agenda display.
|
|
|
|
|
When WITH-HOUR is non-nil, only return deadlines with an hour
|
|
|
|
|
specification like [h]h:mm."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((props (list 'mouse-face 'highlight
|
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(regexp (if with-hour
|
|
|
|
|
org-deadline-time-hour-regexp
|
|
|
|
|
org-deadline-time-regexp))
|
2008-09-13 17:59:23 +00:00
|
|
|
|
(todayp (org-agenda-todayp date)) ; DATE bound by calendar
|
2012-10-28 12:53:29 +00:00
|
|
|
|
(d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
|
2013-02-27 13:29:46 +00:00
|
|
|
|
(dl0 (car org-agenda-deadline-leaders))
|
|
|
|
|
(dl1 (nth 1 org-agenda-deadline-leaders))
|
|
|
|
|
(dl2 (or (nth 2 org-agenda-deadline-leaders) dl1))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
d2 diff dfrac wdays pos pos1 category category-pos level
|
2011-08-25 21:42:07 +00:00
|
|
|
|
tags suppress-prewarning ee txt head face s todo-state
|
2013-02-05 14:03:29 +00:00
|
|
|
|
show-all upcomingp donep timestr warntime inherited-tags ts-date)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq s (match-string 1)
|
2009-04-24 11:31:20 +00:00
|
|
|
|
txt nil
|
2008-03-22 15:52:18 +00:00
|
|
|
|
pos (1- (match-beginning 1))
|
2011-02-02 09:35:56 +00:00
|
|
|
|
todo-state (save-match-data (org-get-todo-state))
|
|
|
|
|
show-all (or (eq org-agenda-repeating-timestamp-show-all t)
|
2011-03-10 09:42:57 +00:00
|
|
|
|
(member todo-state
|
2012-08-11 17:10:44 +00:00
|
|
|
|
org-agenda-repeating-timestamp-show-all))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
d2 (org-time-string-to-absolute
|
2013-02-12 08:02:33 +00:00
|
|
|
|
s d1 'past show-all (current-buffer) pos)
|
2012-10-26 10:47:47 +00:00
|
|
|
|
diff (- d2 d1))
|
|
|
|
|
(setq suppress-prewarning
|
|
|
|
|
(let ((ds (and org-agenda-skip-deadline-prewarning-if-scheduled
|
|
|
|
|
(let ((item (buffer-substring (point-at-bol)
|
|
|
|
|
(point-at-eol))))
|
|
|
|
|
(save-match-data
|
|
|
|
|
(and (string-match
|
|
|
|
|
org-scheduled-time-regexp item)
|
|
|
|
|
(match-string 1 item)))))))
|
2012-10-28 12:53:29 +00:00
|
|
|
|
(cond
|
|
|
|
|
((not ds) nil)
|
|
|
|
|
;; The current item has a scheduled date (in ds), so
|
|
|
|
|
;; evaluate its prewarning lead time.
|
|
|
|
|
((integerp org-agenda-skip-deadline-prewarning-if-scheduled)
|
|
|
|
|
;; Use global prewarning-restart lead time.
|
|
|
|
|
org-agenda-skip-deadline-prewarning-if-scheduled)
|
|
|
|
|
((eq org-agenda-skip-deadline-prewarning-if-scheduled
|
|
|
|
|
'pre-scheduled)
|
|
|
|
|
;; Set prewarning to no earlier than scheduled.
|
|
|
|
|
(min (- d2 (org-time-string-to-absolute
|
|
|
|
|
ds d1 'past show-all (current-buffer) pos))
|
|
|
|
|
org-deadline-warning-days))
|
|
|
|
|
;; Set prewarning to deadline.
|
|
|
|
|
(t 0))))
|
2012-10-26 10:47:47 +00:00
|
|
|
|
(setq wdays (if suppress-prewarning
|
2010-02-17 21:46:02 +00:00
|
|
|
|
(let ((org-deadline-warning-days suppress-prewarning))
|
|
|
|
|
(org-get-wdays s))
|
|
|
|
|
(org-get-wdays s))
|
2011-08-01 08:53:33 +00:00
|
|
|
|
dfrac (- 1 (/ (* 1.0 diff) (max wdays 1)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
upcomingp (and todayp (> diff 0)))
|
|
|
|
|
;; When to show a deadline in the calendar:
|
|
|
|
|
;; If the expiration is within wdays warning time.
|
|
|
|
|
;; Past-due deadlines are only shown on the current date
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(if (and (or (and (<= diff wdays)
|
|
|
|
|
(and todayp (not org-agenda-only-exact-dates)))
|
2009-10-20 18:11:43 +00:00
|
|
|
|
(= diff 0)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
2011-02-02 09:35:56 +00:00
|
|
|
|
;; (setq todo-state (org-get-todo-state))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(setq donep (member todo-state org-done-keywords))
|
|
|
|
|
(if (and donep
|
|
|
|
|
(or org-agenda-skip-deadline-if-done
|
|
|
|
|
(not (= diff 0))))
|
|
|
|
|
(setq txt nil)
|
2011-08-23 15:34:15 +00:00
|
|
|
|
(setq category (org-get-category)
|
2013-01-07 11:50:49 +00:00
|
|
|
|
warntime (get-text-property (point) 'org-appt-warntime)
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property (point) 'org-category-position))
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(if (not (re-search-backward "^\\*+[ \t]+" nil t))
|
2013-01-26 12:29:44 +00:00
|
|
|
|
(throw :skip nil)
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(setq pos1 (match-beginning 0))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
|
2013-01-22 21:27:56 +00:00
|
|
|
|
(setq inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'agenda org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'agenda org-agenda-use-tag-inheritance))))
|
|
|
|
|
tags (org-get-tags-at pos1 (not inherited-tags)))
|
2013-02-06 16:18:03 +00:00
|
|
|
|
(setq head (buffer-substring
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(point)
|
|
|
|
|
(progn (skip-chars-forward "^\r\n")
|
|
|
|
|
(point))))
|
|
|
|
|
(if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
|
|
|
|
|
(setq timestr
|
|
|
|
|
(concat (substring s (match-beginning 1)) " "))
|
|
|
|
|
(setq timestr 'time))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(setq txt (org-agenda-format-item
|
2013-02-27 13:29:46 +00:00
|
|
|
|
(cond ((= diff 0) dl0)
|
|
|
|
|
((> diff 0)
|
|
|
|
|
(if (functionp dl1)
|
|
|
|
|
(funcall dl1 diff date)
|
|
|
|
|
(format dl1 diff)))
|
|
|
|
|
(t
|
|
|
|
|
(if (functionp dl2)
|
|
|
|
|
(funcall dl2 diff date)
|
|
|
|
|
(format dl2 (if (string= dl2 dl1)
|
|
|
|
|
diff (abs diff))))))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
head level category tags
|
2009-04-24 11:31:20 +00:00
|
|
|
|
(if (not (= diff 0)) nil timestr)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when txt
|
2011-08-01 08:53:33 +00:00
|
|
|
|
(setq face (org-agenda-deadline-face dfrac))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-add-props txt props
|
|
|
|
|
'org-marker (org-agenda-new-marker pos)
|
2012-08-19 19:48:52 +00:00
|
|
|
|
'warntime warntime
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2013-02-05 14:03:29 +00:00
|
|
|
|
'ts-date d2
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'org-hd-marker (org-agenda-new-marker pos1)
|
|
|
|
|
'priority (+ (- diff)
|
|
|
|
|
(org-get-priority txt))
|
|
|
|
|
'org-category category
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos
|
2008-09-18 11:45:49 +00:00
|
|
|
|
'todo-state todo-state
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'type (if upcomingp "upcoming-deadline" "deadline")
|
|
|
|
|
'date (if upcomingp date d2)
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'face (if donep 'org-agenda-done face)
|
|
|
|
|
'undone-face face 'done-face 'org-agenda-done)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(push txt ee))))))
|
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
2011-08-01 08:53:33 +00:00
|
|
|
|
(defun org-agenda-deadline-face (fraction)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Return the face to displaying a deadline item.
|
|
|
|
|
FRACTION is what fraction of the head-warning time has passed."
|
|
|
|
|
(let ((faces org-agenda-deadline-faces) f)
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(while (setq f (pop faces))
|
|
|
|
|
(if (>= fraction (car f)) (throw 'exit (cdr f)))))))
|
|
|
|
|
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(defun org-agenda-get-scheduled (&optional deadline-results with-hour)
|
|
|
|
|
"Return the scheduled information for agenda display.
|
|
|
|
|
When WITH-HOUR is non-nil, only return scheduled items with
|
|
|
|
|
an hour specification like [h]h:mm."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((props (list 'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2009-03-21 13:33:52 +00:00
|
|
|
|
'done-face 'org-agenda-done
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(regexp (if with-hour
|
|
|
|
|
org-scheduled-time-hour-regexp
|
|
|
|
|
org-scheduled-time-regexp))
|
2008-09-13 17:59:23 +00:00
|
|
|
|
(todayp (org-agenda-todayp date)) ; DATE bound by calendar
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
|
2009-08-07 21:59:07 +00:00
|
|
|
|
mm
|
|
|
|
|
(deadline-position-alist
|
|
|
|
|
(mapcar (lambda (a) (and (setq mm (get-text-property
|
2012-08-11 17:10:44 +00:00
|
|
|
|
0 'org-hd-marker a))
|
|
|
|
|
(cons (marker-position mm) a)))
|
2009-08-07 21:59:07 +00:00
|
|
|
|
deadline-results))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
d2 diff pos pos1 category category-pos level tags donep
|
2012-05-28 18:55:32 +00:00
|
|
|
|
ee txt head pastschedp todo-state face timestr s habitp show-all
|
2013-02-05 16:35:51 +00:00
|
|
|
|
did-habit-check-p warntime inherited-tags ts-date suppress-delay
|
|
|
|
|
ddays)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq s (match-string 1)
|
2009-04-24 11:31:20 +00:00
|
|
|
|
txt nil
|
2008-03-22 15:52:18 +00:00
|
|
|
|
pos (1- (match-beginning 1))
|
2011-02-02 09:35:56 +00:00
|
|
|
|
todo-state (save-match-data (org-get-todo-state))
|
|
|
|
|
show-all (or (eq org-agenda-repeating-timestamp-show-all t)
|
|
|
|
|
(member todo-state
|
|
|
|
|
org-agenda-repeating-timestamp-show-all))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
d2 (org-time-string-to-absolute
|
2013-02-12 08:02:33 +00:00
|
|
|
|
s d1 'past show-all (current-buffer) pos)
|
2012-08-19 19:48:52 +00:00
|
|
|
|
diff (- d2 d1)
|
2013-01-07 11:50:49 +00:00
|
|
|
|
warntime (get-text-property (point) 'org-appt-warntime))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq pastschedp (and todayp (< diff 0)))
|
2012-05-28 18:55:32 +00:00
|
|
|
|
(setq did-habit-check-p nil)
|
2013-02-05 16:35:51 +00:00
|
|
|
|
(setq suppress-delay
|
|
|
|
|
(let ((ds (and org-agenda-skip-scheduled-delay-if-deadline
|
|
|
|
|
(let ((item (buffer-substring (point-at-bol) (point-at-eol))))
|
|
|
|
|
(save-match-data
|
|
|
|
|
(and (string-match
|
|
|
|
|
org-deadline-time-regexp item)
|
|
|
|
|
(match-string 1 item)))))))
|
|
|
|
|
(cond
|
|
|
|
|
((not ds) nil)
|
|
|
|
|
;; The current item has a deadline date (in ds), so
|
|
|
|
|
;; evaluate its delay time.
|
|
|
|
|
((integerp org-agenda-skip-scheduled-delay-if-deadline)
|
|
|
|
|
;; Use global delay time.
|
|
|
|
|
(- org-agenda-skip-scheduled-delay-if-deadline))
|
|
|
|
|
((eq org-agenda-skip-scheduled-delay-if-deadline
|
|
|
|
|
'post-deadline)
|
|
|
|
|
;; Set delay to no later than deadline.
|
|
|
|
|
(min (- d2 (org-time-string-to-absolute
|
|
|
|
|
ds d1 'past show-all (current-buffer) pos))
|
|
|
|
|
org-scheduled-delay-days))
|
|
|
|
|
(t 0))))
|
|
|
|
|
(setq ddays (if suppress-delay
|
|
|
|
|
(let ((org-scheduled-delay-days suppress-delay))
|
|
|
|
|
(org-get-wdays s t t))
|
|
|
|
|
(org-get-wdays s t)))
|
2013-02-12 08:51:11 +00:00
|
|
|
|
;; Use a delay of 0 when there is a repeater and the delay is
|
|
|
|
|
;; of the form --3d
|
|
|
|
|
(when (and (save-match-data (string-match "--[0-9]+[hdwmy]" s))
|
2013-02-12 16:31:37 +00:00
|
|
|
|
(< (org-time-string-to-absolute s)
|
|
|
|
|
(org-time-string-to-absolute
|
|
|
|
|
s d2 'past nil (current-buffer) pos)))
|
2013-02-12 08:51:11 +00:00
|
|
|
|
(setq ddays 0))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; When to show a scheduled item in the calendar:
|
|
|
|
|
;; If it is on or past the date.
|
2013-02-05 16:35:51 +00:00
|
|
|
|
(when (or (and (> ddays 0) (= diff (- ddays)))
|
|
|
|
|
(and (zerop ddays) (= diff 0))
|
2013-02-12 16:31:37 +00:00
|
|
|
|
(and (< (+ diff ddays) 0)
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(< (abs diff) org-scheduled-past-days)
|
|
|
|
|
(and todayp (not org-agenda-only-exact-dates)))
|
2012-05-28 18:55:32 +00:00
|
|
|
|
;; org-is-habit-p uses org-entry-get, which is expansive
|
|
|
|
|
;; so we go extra mile to only call it once
|
|
|
|
|
(and todayp
|
2012-09-17 16:57:58 +00:00
|
|
|
|
(boundp 'org-habit-show-all-today)
|
2012-05-28 18:55:32 +00:00
|
|
|
|
org-habit-show-all-today
|
|
|
|
|
(setq did-habit-check-p t)
|
|
|
|
|
(setq habitp (and (functionp 'org-is-habit-p)
|
|
|
|
|
(org-is-habit-p)))))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(setq donep (member todo-state org-done-keywords))
|
|
|
|
|
(if (and donep
|
2010-12-13 01:16:55 +00:00
|
|
|
|
(or org-agenda-skip-scheduled-if-done
|
|
|
|
|
(not (= diff 0))
|
|
|
|
|
(and (functionp 'org-is-habit-p)
|
|
|
|
|
(org-is-habit-p))))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(setq txt nil)
|
2012-05-28 18:55:32 +00:00
|
|
|
|
(setq habitp (if did-habit-check-p habitp
|
|
|
|
|
(and (functionp 'org-is-habit-p)
|
|
|
|
|
(org-is-habit-p))))
|
2011-08-23 15:34:15 +00:00
|
|
|
|
(setq category (org-get-category)
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property (point) 'org-category-position))
|
2013-03-12 17:58:18 +00:00
|
|
|
|
(if (and (eq org-agenda-skip-scheduled-if-deadline-is-shown
|
|
|
|
|
'repeated-after-deadline)
|
|
|
|
|
(<= 0 (- d2 (time-to-days (org-get-deadline-time (point))))))
|
|
|
|
|
(throw :skip nil))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(if (not (re-search-backward "^\\*+[ \t]+" nil t))
|
2013-01-26 12:29:44 +00:00
|
|
|
|
(throw :skip nil)
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(setq pos1 (match-beginning 0))
|
|
|
|
|
(if habitp
|
|
|
|
|
(if (or (not org-habit-show-habits)
|
|
|
|
|
(and (not todayp)
|
2012-09-17 16:57:58 +00:00
|
|
|
|
(boundp 'org-habit-show-habits-only-for-today)
|
2009-10-19 08:17:49 +00:00
|
|
|
|
org-habit-show-habits-only-for-today))
|
|
|
|
|
(throw :skip nil))
|
2009-08-07 21:59:07 +00:00
|
|
|
|
(if (and
|
|
|
|
|
(or (eq t org-agenda-skip-scheduled-if-deadline-is-shown)
|
2013-03-12 17:58:18 +00:00
|
|
|
|
(and (eq org-agenda-skip-scheduled-if-deadline-is-shown 'not-today)
|
2009-08-07 21:59:07 +00:00
|
|
|
|
pastschedp))
|
|
|
|
|
(setq mm (assoc pos1 deadline-position-alist)))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(throw :skip nil)))
|
2013-01-11 16:15:17 +00:00
|
|
|
|
(setq inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'agenda org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'agenda org-agenda-use-tag-inheritance))))
|
2013-01-11 16:19:52 +00:00
|
|
|
|
|
2013-01-11 16:15:17 +00:00
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags)))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
|
2013-02-06 16:18:03 +00:00
|
|
|
|
(setq head (buffer-substring
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(point)
|
|
|
|
|
(progn (skip-chars-forward "^\r\n") (point))))
|
|
|
|
|
(if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
|
|
|
|
|
(setq timestr
|
|
|
|
|
(concat (substring s (match-beginning 1)) " "))
|
|
|
|
|
(setq timestr 'time))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(setq txt (org-agenda-format-item
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(if (= diff 0)
|
|
|
|
|
(car org-agenda-scheduled-leaders)
|
|
|
|
|
(format (nth 1 org-agenda-scheduled-leaders)
|
|
|
|
|
(- 1 diff)))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
head level category tags
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(if (not (= diff 0)) nil timestr)
|
2011-03-16 17:26:29 +00:00
|
|
|
|
nil habitp))))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(when txt
|
|
|
|
|
(setq face
|
|
|
|
|
(cond
|
2009-10-20 18:11:43 +00:00
|
|
|
|
((and (not habitp) pastschedp)
|
|
|
|
|
'org-scheduled-previously)
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(todayp 'org-scheduled-today)
|
2009-10-20 19:16:37 +00:00
|
|
|
|
(t 'org-scheduled))
|
|
|
|
|
habitp (and habitp (org-habit-parse-todo)))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(org-add-props txt props
|
|
|
|
|
'undone-face face
|
|
|
|
|
'face (if donep 'org-agenda-done face)
|
|
|
|
|
'org-marker (org-agenda-new-marker pos)
|
|
|
|
|
'org-hd-marker (org-agenda-new-marker pos1)
|
|
|
|
|
'type (if pastschedp "past-scheduled" "scheduled")
|
|
|
|
|
'date (if pastschedp d2 date)
|
2013-02-05 14:03:29 +00:00
|
|
|
|
'ts-date d2
|
2012-08-19 19:48:52 +00:00
|
|
|
|
'warntime warntime
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2009-10-20 19:16:37 +00:00
|
|
|
|
'priority (if habitp
|
|
|
|
|
(org-habit-get-priority habitp)
|
|
|
|
|
(+ 94 (- 5 diff) (org-get-priority txt)))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
'org-category category
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'category-position category-pos
|
2009-10-20 19:16:37 +00:00
|
|
|
|
'org-habit-p habitp
|
2009-10-19 08:17:49 +00:00
|
|
|
|
'todo-state todo-state)
|
|
|
|
|
(push txt ee))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-get-blocks ()
|
|
|
|
|
"Return the date-range information for agenda display."
|
|
|
|
|
(let* ((props (list 'face nil
|
|
|
|
|
'org-not-done-regexp org-not-done-regexp
|
|
|
|
|
'org-todo-regexp org-todo-regexp
|
2008-05-28 21:58:53 +00:00
|
|
|
|
'org-complex-heading-regexp org-complex-heading-regexp
|
2008-03-22 15:52:18 +00:00
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'help-echo
|
|
|
|
|
(format "mouse-2 or RET jump to org file %s"
|
|
|
|
|
(abbreviate-file-name buffer-file-name))))
|
|
|
|
|
(regexp org-tr-regexp)
|
|
|
|
|
(d0 (calendar-absolute-from-gregorian date))
|
2012-08-21 16:01:30 +00:00
|
|
|
|
marker hdmarker ee txt d1 d2 s1 s2 category category-pos
|
2013-01-11 16:19:52 +00:00
|
|
|
|
level todo-state tags pos head donep inherited-tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(catch :skip
|
|
|
|
|
(org-agenda-skip)
|
|
|
|
|
(setq pos (point))
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(let ((start-time (match-string 1))
|
|
|
|
|
(end-time (match-string 2)))
|
|
|
|
|
(setq s1 (match-string 1)
|
|
|
|
|
s2 (match-string 2)
|
2011-10-04 12:12:11 +00:00
|
|
|
|
d1 (time-to-days (org-time-string-to-time s1 (current-buffer) pos))
|
|
|
|
|
d2 (time-to-days (org-time-string-to-time s2 (current-buffer) pos)))
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
|
|
|
|
|
;; Only allow days between the limits, because the normal
|
|
|
|
|
;; date stamps will catch the limits.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq todo-state (org-get-todo-state))
|
|
|
|
|
(setq donep (member todo-state org-done-keywords))
|
|
|
|
|
(if (and donep org-agenda-skip-timestamp-if-done)
|
|
|
|
|
(throw :skip t))
|
|
|
|
|
(setq marker (org-agenda-new-marker (point)))
|
2011-08-23 15:34:15 +00:00
|
|
|
|
(setq category (org-get-category)
|
2012-08-21 16:01:30 +00:00
|
|
|
|
category-pos (get-text-property (point) 'org-category-position))
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
|
(if (not (re-search-backward org-outline-regexp-bol nil t))
|
2013-01-26 12:29:44 +00:00
|
|
|
|
(throw :skip nil)
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
2013-01-11 16:15:17 +00:00
|
|
|
|
(setq hdmarker (org-agenda-new-marker (point))
|
|
|
|
|
inherited-tags
|
|
|
|
|
(or (eq org-agenda-show-inherited-tags 'always)
|
|
|
|
|
(and (listp org-agenda-show-inherited-tags)
|
|
|
|
|
(memq 'agenda org-agenda-show-inherited-tags))
|
|
|
|
|
(and (eq org-agenda-show-inherited-tags t)
|
|
|
|
|
(or (eq org-agenda-use-tag-inheritance t)
|
|
|
|
|
(memq 'agenda org-agenda-use-tag-inheritance))))
|
2013-01-11 16:19:52 +00:00
|
|
|
|
|
2013-01-11 16:15:17 +00:00
|
|
|
|
tags (org-get-tags-at nil (not inherited-tags)))
|
2012-09-12 16:17:01 +00:00
|
|
|
|
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
|
|
|
|
|
(setq head (match-string 1))
|
|
|
|
|
(let ((remove-re
|
|
|
|
|
(if org-agenda-remove-timeranges-from-blocks
|
|
|
|
|
(concat
|
|
|
|
|
"<" (regexp-quote s1) ".*?>"
|
|
|
|
|
"--"
|
|
|
|
|
"<" (regexp-quote s2) ".*?>")
|
|
|
|
|
nil)))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(setq txt (org-agenda-format-item
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(format
|
|
|
|
|
(nth (if (= d1 d2) 0 1)
|
|
|
|
|
org-agenda-timerange-leaders)
|
|
|
|
|
(1+ (- d0 d1)) (1+ (- d2 d1)))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
head level category tags
|
2011-09-30 19:41:35 +00:00
|
|
|
|
(cond ((and (= d1 d0) (= d2 d0))
|
|
|
|
|
(concat "<" start-time ">--<" end-time ">"))
|
|
|
|
|
((= d1 d0)
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(concat "<" start-time ">"))
|
|
|
|
|
((= d2 d0)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
(concat "<" end-time ">")))
|
2012-10-01 15:53:39 +00:00
|
|
|
|
remove-re))))
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(org-add-props txt props
|
|
|
|
|
'org-marker marker 'org-hd-marker hdmarker
|
|
|
|
|
'type "block" 'date date
|
2012-09-12 09:41:50 +00:00
|
|
|
|
'level level
|
2011-01-22 22:08:51 +00:00
|
|
|
|
'todo-state todo-state
|
2011-08-23 15:34:15 +00:00
|
|
|
|
'priority (org-get-priority txt) 'org-category category
|
2012-08-21 16:01:30 +00:00
|
|
|
|
'org-category-position category-pos)
|
2011-01-22 22:08:51 +00:00
|
|
|
|
(push txt ee))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char pos)))
|
|
|
|
|
;; Sort the entries by expiration date.
|
|
|
|
|
(nreverse ee)))
|
|
|
|
|
|
|
|
|
|
;;; Agenda presentation and sorting
|
|
|
|
|
|
|
|
|
|
(defvar org-prefix-has-time nil
|
|
|
|
|
"A flag, set by `org-compile-prefix-format'.
|
|
|
|
|
The flag is set if the currently compiled format contains a `%t'.")
|
|
|
|
|
(defvar org-prefix-has-tag nil
|
|
|
|
|
"A flag, set by `org-compile-prefix-format'.
|
|
|
|
|
The flag is set if the currently compiled format contains a `%T'.")
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(defvar org-prefix-has-effort nil
|
|
|
|
|
"A flag, set by `org-compile-prefix-format'.
|
|
|
|
|
The flag is set if the currently compiled format contains a `%e'.")
|
2013-01-23 23:21:31 +00:00
|
|
|
|
(defvar org-prefix-has-breadcrumbs nil
|
|
|
|
|
"A flag, set by `org-compile-prefix-format'.
|
|
|
|
|
The flag is set if the currently compiled format contains a `%b'.")
|
2009-09-03 22:20:14 +00:00
|
|
|
|
(defvar org-prefix-category-length nil
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Used by `org-compile-prefix-format' to remember the category field width.")
|
2009-10-06 09:59:27 +00:00
|
|
|
|
(defvar org-prefix-category-max-length nil
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Used by `org-compile-prefix-format' to remember the category field width.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-10-29 13:49:32 +00:00
|
|
|
|
(defun org-agenda-get-category-icon (category)
|
|
|
|
|
"Return an image for CATEGORY according to `org-agenda-category-icon-alist'."
|
|
|
|
|
(dolist (entry org-agenda-category-icon-alist)
|
|
|
|
|
(when (org-string-match-p (car entry) category)
|
|
|
|
|
(if (listp (cadr entry))
|
|
|
|
|
(return (cadr entry))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(return (apply 'create-image (cdr entry)))))))
|
2010-10-29 13:49:32 +00:00
|
|
|
|
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(defun org-agenda-format-item (extra txt &optional level category tags dotime
|
2011-03-16 17:26:29 +00:00
|
|
|
|
remove-re habitp)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Format TXT to be inserted into the agenda buffer.
|
2012-09-12 09:41:50 +00:00
|
|
|
|
In particular, add the prefix and corresponding text properties.
|
|
|
|
|
|
|
|
|
|
EXTRA must be a string to replace the `%s' specifier in the prefix format.
|
|
|
|
|
LEVEL may be a string to replace the `%l' specifier.
|
|
|
|
|
CATEGORY (a string, a symbol or nil) may be used to overrule the default
|
2008-03-22 15:52:18 +00:00
|
|
|
|
category taken from local variable or file name. It will replace the `%c'
|
2012-09-12 09:41:50 +00:00
|
|
|
|
specifier in the format.
|
|
|
|
|
DOTIME, when non-nil, indicates that a time-of-day should be extracted from
|
|
|
|
|
TXT for sorting of this entry, and for the `%t' specifier in the format.
|
|
|
|
|
When DOTIME is a string, this string is searched for a time before TXT is.
|
|
|
|
|
TAGS can be the tags of the headline.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
Any match of REMOVE-RE will be removed from TXT."
|
2012-03-01 15:49:23 +00:00
|
|
|
|
;; We keep the org-prefix-* variable values along with a compiled
|
2012-09-12 09:41:50 +00:00
|
|
|
|
;; formatter, so that multiple agendas existing at the same time do
|
2012-03-01 15:49:23 +00:00
|
|
|
|
;; not step on each other toes.
|
|
|
|
|
;;
|
|
|
|
|
;; It was inconvenient to make these variables buffer local in
|
|
|
|
|
;; Agenda buffers, because this function expects to be called with
|
|
|
|
|
;; the buffer where item comes from being current, and not agenda
|
|
|
|
|
;; buffer
|
2012-03-09 15:12:59 +00:00
|
|
|
|
(let* ((bindings (car org-prefix-format-compiled))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(formatter (cadr org-prefix-format-compiled)))
|
|
|
|
|
(loop for (var value) in bindings
|
|
|
|
|
do (set var value))
|
|
|
|
|
(save-match-data
|
|
|
|
|
;; Diary entries sometimes have extra whitespace at the beginning
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(setq txt (org-trim txt))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
;; Fix the tags part in txt
|
|
|
|
|
(setq txt (org-agenda-fix-displayed-tags
|
|
|
|
|
txt tags
|
|
|
|
|
org-agenda-show-inherited-tags
|
|
|
|
|
org-agenda-hide-tags-regexp))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(let* ((category (or category
|
|
|
|
|
(if (stringp org-category)
|
|
|
|
|
org-category
|
|
|
|
|
(and org-category (symbol-name org-category)))
|
|
|
|
|
(if buffer-file-name
|
|
|
|
|
(file-name-sans-extension
|
|
|
|
|
(file-name-nondirectory buffer-file-name))
|
|
|
|
|
"")))
|
|
|
|
|
(category-icon (org-agenda-get-category-icon category))
|
|
|
|
|
(category-icon (if category-icon
|
|
|
|
|
(propertize " " 'display category-icon)
|
|
|
|
|
""))
|
|
|
|
|
;; time, tag, effort are needed for the eval of the prefix format
|
|
|
|
|
(tag (if tags (nth (1- (length tags)) tags) ""))
|
|
|
|
|
time effort neffort
|
|
|
|
|
(ts (if dotime (concat
|
|
|
|
|
(if (stringp dotime) dotime "")
|
|
|
|
|
(and org-agenda-search-headline-for-time txt))))
|
|
|
|
|
(time-of-day (and dotime (org-get-time-of-day ts)))
|
|
|
|
|
stamp plain s0 s1 s2 rtn srp l
|
2013-02-15 14:39:12 +00:00
|
|
|
|
duration thecategory breadcrumbs)
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(and (derived-mode-p 'org-mode) buffer-file-name
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(add-to-list 'org-agenda-contributing-files buffer-file-name))
|
|
|
|
|
(when (and dotime time-of-day)
|
|
|
|
|
;; Extract starting and ending time and move them to prefix
|
|
|
|
|
(when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
|
|
|
|
|
(setq plain (string-match org-plain-time-of-day-regexp ts)))
|
|
|
|
|
(setq s0 (match-string 0 ts)
|
|
|
|
|
srp (and stamp (match-end 3))
|
|
|
|
|
s1 (match-string (if plain 1 2) ts)
|
|
|
|
|
s2 (match-string (if plain 8 (if srp 4 6)) ts))
|
|
|
|
|
|
|
|
|
|
;; If the times are in TXT (not in DOTIMES), and the prefix will list
|
|
|
|
|
;; them, we might want to remove them there to avoid duplication.
|
|
|
|
|
;; The user can turn this off with a variable.
|
|
|
|
|
(if (and org-prefix-has-time
|
|
|
|
|
org-agenda-remove-times-when-in-prefix (or stamp plain)
|
|
|
|
|
(string-match (concat (regexp-quote s0) " *") txt)
|
|
|
|
|
(not (equal ?\] (string-to-char (substring txt (match-end 0)))))
|
|
|
|
|
(if (eq org-agenda-remove-times-when-in-prefix 'beg)
|
|
|
|
|
(= (match-beginning 0) 0)
|
|
|
|
|
t))
|
|
|
|
|
(setq txt (replace-match "" nil nil txt))))
|
|
|
|
|
;; Normalize the time(s) to 24 hour
|
|
|
|
|
(if s1 (setq s1 (org-get-time-of-day s1 'string t)))
|
|
|
|
|
(if s2 (setq s2 (org-get-time-of-day s2 'string t)))
|
|
|
|
|
|
|
|
|
|
;; Try to set s2 if s1 and `org-agenda-default-appointment-duration' are set
|
2013-01-22 14:53:14 +00:00
|
|
|
|
(let (org-time-clocksum-use-effort-durations)
|
|
|
|
|
(when (and s1 (not s2) org-agenda-default-appointment-duration)
|
|
|
|
|
(setq s2
|
|
|
|
|
(org-minutes-to-clocksum-string
|
|
|
|
|
(+ (org-hh:mm-string-to-minutes s1)
|
|
|
|
|
org-agenda-default-appointment-duration)))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
;; Compute the duration
|
|
|
|
|
(when s2
|
|
|
|
|
(setq duration (- (org-hh:mm-string-to-minutes s2)
|
|
|
|
|
(org-hh:mm-string-to-minutes s1)))))
|
|
|
|
|
|
|
|
|
|
(when (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")
|
|
|
|
|
txt)
|
|
|
|
|
;; Tags are in the string
|
|
|
|
|
(if (or (eq org-agenda-remove-tags t)
|
|
|
|
|
(and org-agenda-remove-tags
|
|
|
|
|
org-prefix-has-tag))
|
|
|
|
|
(setq txt (replace-match "" t t txt))
|
|
|
|
|
(setq txt (replace-match
|
|
|
|
|
(concat (make-string (max (- 50 (length txt)) 1) ?\ )
|
|
|
|
|
(match-string 2 txt))
|
|
|
|
|
t t txt))))
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(when (derived-mode-p 'org-mode)
|
2013-03-26 10:54:53 +00:00
|
|
|
|
(setq effort (ignore-errors (get-text-property 0 'org-effort txt))))
|
|
|
|
|
|
|
|
|
|
;; org-agenda-add-time-grid-maybe calls us with *Agenda* as
|
|
|
|
|
;; current buffer, so move this check outside of above
|
|
|
|
|
(if effort
|
|
|
|
|
(setq neffort (org-duration-string-to-minutes effort)
|
|
|
|
|
effort (setq effort (concat "[" effort "]")))
|
|
|
|
|
;; prevent erroring out with %e format when there is no effort
|
|
|
|
|
(setq effort ""))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
(when remove-re
|
|
|
|
|
(while (string-match remove-re txt)
|
|
|
|
|
(setq txt (replace-match "" t t txt))))
|
|
|
|
|
|
|
|
|
|
;; Set org-heading property on `txt' to mark the start of the
|
|
|
|
|
;; heading.
|
|
|
|
|
(add-text-properties 0 (length txt) '(org-heading t) txt)
|
|
|
|
|
|
|
|
|
|
;; Prepare the variables needed in the eval of the compiled format
|
2013-02-19 08:48:11 +00:00
|
|
|
|
(if org-prefix-has-breadcrumbs
|
|
|
|
|
(setq breadcrumbs (org-with-point-at (org-get-at-bol 'org-marker)
|
|
|
|
|
(let ((s (org-display-outline-path nil nil "->" t)))
|
|
|
|
|
(if (eq "" s) "" (concat s "->"))))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(setq time (cond (s2 (concat
|
|
|
|
|
(org-agenda-time-of-day-to-ampm-maybe s1)
|
|
|
|
|
"-" (org-agenda-time-of-day-to-ampm-maybe s2)
|
|
|
|
|
(if org-agenda-timegrid-use-ampm " ")))
|
|
|
|
|
(s1 (concat
|
|
|
|
|
(org-agenda-time-of-day-to-ampm-maybe s1)
|
|
|
|
|
(if org-agenda-timegrid-use-ampm
|
|
|
|
|
"........ "
|
|
|
|
|
"......")))
|
|
|
|
|
(t ""))
|
|
|
|
|
extra (or (and (not habitp) extra) "")
|
|
|
|
|
category (if (symbolp category) (symbol-name category) category)
|
2012-09-26 09:36:04 +00:00
|
|
|
|
thecategory (copy-sequence category)
|
|
|
|
|
level (or level ""))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(if (string-match org-bracket-link-regexp category)
|
|
|
|
|
(progn
|
|
|
|
|
(setq l (if (match-end 3)
|
|
|
|
|
(- (match-end 3) (match-beginning 3))
|
|
|
|
|
(- (match-end 1) (match-beginning 1))))
|
|
|
|
|
(when (< l (or org-prefix-category-length 0))
|
|
|
|
|
(setq category (copy-sequence category))
|
|
|
|
|
(org-add-props category nil
|
|
|
|
|
'extra-space (make-string
|
|
|
|
|
(- org-prefix-category-length l 1) ?\ ))))
|
|
|
|
|
(if (and org-prefix-category-max-length
|
|
|
|
|
(>= (length category) org-prefix-category-max-length))
|
|
|
|
|
(setq category (substring category 0 (1- org-prefix-category-max-length)))))
|
|
|
|
|
;; Evaluate the compiled format
|
|
|
|
|
(setq rtn (concat (eval formatter) txt))
|
|
|
|
|
|
|
|
|
|
;; And finally add the text properties
|
|
|
|
|
(remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn)
|
|
|
|
|
(org-add-props rtn nil
|
|
|
|
|
'org-category (if thecategory (downcase thecategory) category)
|
|
|
|
|
'tags (mapcar 'org-downcase-keep-props tags)
|
|
|
|
|
'org-highest-priority org-highest-priority
|
|
|
|
|
'org-lowest-priority org-lowest-priority
|
|
|
|
|
'time-of-day time-of-day
|
|
|
|
|
'duration duration
|
|
|
|
|
'effort effort
|
|
|
|
|
'effort-minutes neffort
|
2013-01-23 23:21:31 +00:00
|
|
|
|
'breadcrumbs breadcrumbs
|
2012-03-01 15:49:23 +00:00
|
|
|
|
'txt txt
|
2012-09-26 09:36:04 +00:00
|
|
|
|
'level level
|
2012-03-01 15:49:23 +00:00
|
|
|
|
'time time
|
|
|
|
|
'extra extra
|
|
|
|
|
'format org-prefix-format-compiled
|
|
|
|
|
'dotime dotime)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2009-11-20 16:54:51 +00:00
|
|
|
|
(defun org-agenda-fix-displayed-tags (txt tags add-inherited hide-re)
|
|
|
|
|
"Remove tags string from TXT, and add a modified list of tags.
|
|
|
|
|
The modified list may contain inherited tags, and tags matched by
|
|
|
|
|
`org-agenda-hide-tags-regexp' will be removed."
|
|
|
|
|
(when (or add-inherited hide-re)
|
2010-08-21 00:30:31 +00:00
|
|
|
|
(if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$") txt)
|
2009-11-20 16:54:51 +00:00
|
|
|
|
(setq txt (substring txt 0 (match-beginning 0))))
|
2010-01-11 17:43:54 +00:00
|
|
|
|
(setq tags
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar (lambda (tg)
|
|
|
|
|
(if (or (and hide-re (string-match hide-re tg))
|
|
|
|
|
(and (not add-inherited)
|
|
|
|
|
(get-text-property 0 'inherited tg)))
|
|
|
|
|
nil
|
|
|
|
|
tg))
|
|
|
|
|
tags)))
|
2009-11-20 16:54:51 +00:00
|
|
|
|
(when tags
|
|
|
|
|
(let ((have-i (get-text-property 0 'inherited (car tags)))
|
|
|
|
|
i)
|
|
|
|
|
(setq txt (concat txt " :"
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(setq i (get-text-property 0 'inherited x))
|
|
|
|
|
(if (and have-i (not i))
|
|
|
|
|
(progn
|
|
|
|
|
(setq have-i nil)
|
|
|
|
|
(concat ":" x))
|
|
|
|
|
x))
|
|
|
|
|
tags ":")
|
|
|
|
|
(if have-i "::" ":"))))))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
txt)
|
2008-11-27 08:25:50 +00:00
|
|
|
|
|
|
|
|
|
(defun org-downcase-keep-props (s)
|
|
|
|
|
(let ((props (text-properties-at 0 s)))
|
|
|
|
|
(setq s (downcase s))
|
|
|
|
|
(add-text-properties 0 (length s) props s)
|
|
|
|
|
s))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defvar org-agenda-sorting-strategy) ;; because the def is in a let form
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-add-time-grid-maybe (list ndays todayp)
|
2012-09-12 22:43:14 +00:00
|
|
|
|
"Add a time-grid for agenda items which need it.
|
|
|
|
|
|
|
|
|
|
LIST is the list of agenda items formatted by `org-agenda-list'.
|
|
|
|
|
NDAYS is the span of the current agenda view.
|
|
|
|
|
TODAYP is `t' when the current agenda view is on today."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(catch 'exit
|
|
|
|
|
(cond ((not org-agenda-use-time-grid) (throw 'exit list))
|
|
|
|
|
((and todayp (member 'today (car org-agenda-time-grid))))
|
|
|
|
|
((and (= ndays 1) (member 'daily (car org-agenda-time-grid))))
|
|
|
|
|
((member 'weekly (car org-agenda-time-grid)))
|
|
|
|
|
(t (throw 'exit list)))
|
|
|
|
|
(let* ((have (delq nil (mapcar
|
|
|
|
|
(lambda (x) (get-text-property 1 'time-of-day x))
|
|
|
|
|
list)))
|
|
|
|
|
(string (nth 1 org-agenda-time-grid))
|
|
|
|
|
(gridtimes (nth 2 org-agenda-time-grid))
|
|
|
|
|
(req (car org-agenda-time-grid))
|
|
|
|
|
(remove (member 'remove-match req))
|
|
|
|
|
new time)
|
|
|
|
|
(if (and (member 'require-timed req) (not have))
|
|
|
|
|
;; don't show empty grid
|
|
|
|
|
(throw 'exit list))
|
|
|
|
|
(while (setq time (pop gridtimes))
|
|
|
|
|
(unless (and remove (member time have))
|
2010-10-01 16:21:59 +00:00
|
|
|
|
(setq time (replace-regexp-in-string " " "0" (format "%04s" time)))
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(push (org-agenda-format-item
|
2012-09-12 22:43:14 +00:00
|
|
|
|
nil string nil "" nil
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(concat (substring time 0 -2) ":" (substring time -2)))
|
|
|
|
|
new)
|
|
|
|
|
(put-text-property
|
2010-10-01 16:21:59 +00:00
|
|
|
|
2 (length (car new)) 'face 'org-time-grid (car new))))
|
2010-12-13 09:43:37 +00:00
|
|
|
|
(when (and todayp org-agenda-show-current-time-in-grid)
|
2011-10-22 13:08:33 +00:00
|
|
|
|
(push (org-agenda-format-item
|
2012-09-12 22:43:14 +00:00
|
|
|
|
nil org-agenda-current-time-string nil "" nil
|
2010-12-12 08:25:03 +00:00
|
|
|
|
(format-time-string "%H:%M "))
|
|
|
|
|
new)
|
|
|
|
|
(put-text-property
|
|
|
|
|
2 (length (car new)) 'face 'org-agenda-current-time (car new)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (member 'time-up org-agenda-sorting-strategy-selected)
|
|
|
|
|
(append new list)
|
|
|
|
|
(append list new)))))
|
|
|
|
|
|
|
|
|
|
(defun org-compile-prefix-format (key)
|
|
|
|
|
"Compile the prefix format into a Lisp form that can be evaluated.
|
2012-03-01 15:49:23 +00:00
|
|
|
|
The resulting form and associated variable bindings is returned
|
|
|
|
|
and stored in the variable `org-prefix-format-compiled'."
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(setq org-prefix-has-time nil
|
|
|
|
|
org-prefix-has-tag nil
|
2011-08-19 13:16:38 +00:00
|
|
|
|
org-prefix-category-length nil
|
2013-01-23 23:21:31 +00:00
|
|
|
|
org-prefix-has-effort nil
|
|
|
|
|
org-prefix-has-breadcrumbs nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((s (cond
|
|
|
|
|
((stringp org-agenda-prefix-format)
|
|
|
|
|
org-agenda-prefix-format)
|
|
|
|
|
((assq key org-agenda-prefix-format)
|
|
|
|
|
(cdr (assq key org-agenda-prefix-format)))
|
|
|
|
|
(t " %-12:c%?-12t% s")))
|
|
|
|
|
(start 0)
|
|
|
|
|
varform vars var e c f opt)
|
2013-01-23 23:21:31 +00:00
|
|
|
|
(while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+)\\)"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
s start)
|
2010-12-17 22:18:15 +00:00
|
|
|
|
(setq var (or (cdr (assoc (match-string 4 s)
|
2012-09-12 13:56:00 +00:00
|
|
|
|
'(("c" . category) ("t" . time) ("l" . level) ("s" . extra)
|
2013-01-23 23:21:31 +00:00
|
|
|
|
("i" . category-icon) ("T" . tag) ("e" . effort) ("b" . breadcrumbs))))
|
2010-12-17 22:18:15 +00:00
|
|
|
|
'eval)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
c (or (match-string 3 s) "")
|
|
|
|
|
opt (match-beginning 1)
|
|
|
|
|
start (1+ (match-beginning 0)))
|
|
|
|
|
(if (equal var 'time) (setq org-prefix-has-time t))
|
|
|
|
|
(if (equal var 'tag) (setq org-prefix-has-tag t))
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(if (equal var 'effort) (setq org-prefix-has-effort t))
|
2013-02-15 14:39:12 +00:00
|
|
|
|
(if (equal var 'breadcrumbs) (setq org-prefix-has-breadcrumbs t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq f (concat "%" (match-string 2 s) "s"))
|
2009-10-06 09:59:27 +00:00
|
|
|
|
(when (equal var 'category)
|
|
|
|
|
(setq org-prefix-category-length
|
|
|
|
|
(floor (abs (string-to-number (match-string 2 s)))))
|
|
|
|
|
(setq org-prefix-category-max-length
|
|
|
|
|
(let ((x (match-string 2 s)))
|
|
|
|
|
(save-match-data
|
|
|
|
|
(if (string-match "\\.[0-9]+" x)
|
|
|
|
|
(string-to-number (substring (match-string 0 x) 1)))))))
|
2010-12-17 22:18:15 +00:00
|
|
|
|
(if (eq var 'eval)
|
|
|
|
|
(setq varform `(format ,f (org-eval ,(read (match-string 4 s)))))
|
|
|
|
|
(if opt
|
|
|
|
|
(setq varform
|
|
|
|
|
`(if (equal "" ,var)
|
|
|
|
|
""
|
|
|
|
|
(format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
|
|
|
|
|
(setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c (get-text-property 0 'extra-space ,var)))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq s (replace-match "%s" t nil s))
|
|
|
|
|
(push varform vars))
|
|
|
|
|
(setq vars (nreverse vars))
|
2012-08-30 08:10:18 +00:00
|
|
|
|
(with-current-buffer (or org-agenda-buffer (current-buffer))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(setq org-prefix-format-compiled
|
|
|
|
|
(list
|
|
|
|
|
`((org-prefix-has-time ,org-prefix-has-time)
|
2012-04-17 09:25:22 +00:00
|
|
|
|
(org-prefix-has-tag ,org-prefix-has-tag)
|
|
|
|
|
(org-prefix-category-length ,org-prefix-category-length)
|
2013-01-23 23:21:31 +00:00
|
|
|
|
(org-prefix-has-effort ,org-prefix-has-effort)
|
|
|
|
|
(org-prefix-has-breadcrumbs ,org-prefix-has-breadcrumbs))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
`(format ,s ,@vars))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-set-sorting-strategy (key)
|
|
|
|
|
(if (symbolp (car org-agenda-sorting-strategy))
|
|
|
|
|
;; the old format
|
|
|
|
|
(setq org-agenda-sorting-strategy-selected org-agenda-sorting-strategy)
|
|
|
|
|
(setq org-agenda-sorting-strategy-selected
|
|
|
|
|
(or (cdr (assq key org-agenda-sorting-strategy))
|
|
|
|
|
(cdr (assq 'agenda org-agenda-sorting-strategy))
|
|
|
|
|
'(time-up category-keep priority-down)))))
|
|
|
|
|
|
|
|
|
|
(defun org-get-time-of-day (s &optional string mod24)
|
|
|
|
|
"Check string S for a time of day.
|
|
|
|
|
If found, return it as a military time number between 0 and 2400.
|
|
|
|
|
If not found, return nil.
|
|
|
|
|
The optional STRING argument forces conversion into a 5 character wide string
|
|
|
|
|
HH:MM."
|
|
|
|
|
(save-match-data
|
|
|
|
|
(when
|
|
|
|
|
(or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
|
|
|
|
|
(string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(let* ((h (string-to-number (match-string 1 s)))
|
|
|
|
|
(m (if (match-end 3) (string-to-number (match-string 3 s)) 0))
|
|
|
|
|
(ampm (if (match-end 4) (downcase (match-string 4 s))))
|
|
|
|
|
(am-p (equal ampm "am"))
|
|
|
|
|
(h1 (cond ((not ampm) h)
|
|
|
|
|
((= h 12) (if am-p 0 12))
|
|
|
|
|
(t (+ h (if am-p 0 12)))))
|
|
|
|
|
(h2 (if (and string mod24 (not (and (= m 0) (= h1 24))))
|
|
|
|
|
(mod h1 24) h1))
|
|
|
|
|
(t0 (+ (* 100 h2) m))
|
|
|
|
|
(t1 (concat (if (>= h1 24) "+" " ")
|
|
|
|
|
(if (and org-agenda-time-leading-zero
|
|
|
|
|
(< t0 1000)) "0" "")
|
|
|
|
|
(if (< t0 100) "0" "")
|
|
|
|
|
(if (< t0 10) "0" "")
|
|
|
|
|
(int-to-string t0))))
|
|
|
|
|
(if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-08-16 13:28:39 +00:00
|
|
|
|
(defvar org-agenda-before-sorting-filter-function nil
|
|
|
|
|
"Function to be applied to agenda items prior to sorting.
|
|
|
|
|
Prior to sorting also means just before they are inserted into the agenda.
|
|
|
|
|
|
|
|
|
|
To aid sorting, you may revisit the original entries and add more text
|
|
|
|
|
properties which will later be used by the sorting functions.
|
|
|
|
|
|
|
|
|
|
The function should take a string argument, an agenda line.
|
|
|
|
|
It has access to the text properties in that line, which contain among
|
|
|
|
|
other things, the property `org-hd-marker' that points to the entry
|
|
|
|
|
where the line comes from. Note that not all lines going into the agenda
|
|
|
|
|
have this property, only most.
|
|
|
|
|
|
|
|
|
|
The function should return the modified string. It is probably best
|
|
|
|
|
to ONLY change text properties.
|
|
|
|
|
|
|
|
|
|
You can also use this function as a filter, by returning nil for lines
|
|
|
|
|
you don't want to have in the agenda at all. For this application, you
|
|
|
|
|
could bind the variable in the options section of a custom command.")
|
|
|
|
|
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(defun org-agenda-finalize-entries (list &optional type)
|
|
|
|
|
"Sort, limit and concatenate the LIST of agenda items.
|
|
|
|
|
The optional argument TYPE tells the agenda type."
|
|
|
|
|
(let ((max-effort (cond ((listp org-agenda-max-effort)
|
|
|
|
|
(cdr (assoc type org-agenda-max-effort)))
|
|
|
|
|
(t org-agenda-max-effort)))
|
|
|
|
|
(max-todo (cond ((listp org-agenda-max-todos)
|
|
|
|
|
(cdr (assoc type org-agenda-max-todos)))
|
|
|
|
|
(t org-agenda-max-todos)))
|
|
|
|
|
(max-tags (cond ((listp org-agenda-max-tags)
|
|
|
|
|
(cdr (assoc type org-agenda-max-tags)))
|
|
|
|
|
(t org-agenda-max-tags)))
|
|
|
|
|
(max-entries (cond ((listp org-agenda-max-entries)
|
|
|
|
|
(cdr (assoc type org-agenda-max-entries)))
|
|
|
|
|
(t org-agenda-max-entries))) l)
|
2010-08-16 13:28:39 +00:00
|
|
|
|
(when org-agenda-before-sorting-filter-function
|
2013-02-06 16:16:35 +00:00
|
|
|
|
(setq list
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
org-agenda-before-sorting-filter-function list))))
|
|
|
|
|
(setq list (mapcar 'org-agenda-highlight-todo list)
|
2013-04-05 06:36:17 +00:00
|
|
|
|
list (mapcar 'identity (sort list 'org-entries-lessp)))
|
|
|
|
|
(when max-effort
|
|
|
|
|
(setq list (org-agenda-limit-entries
|
|
|
|
|
list 'effort-minutes max-effort 'identity)))
|
|
|
|
|
(when max-todo
|
|
|
|
|
(setq list (org-agenda-limit-entries list 'todo-state max-todo)))
|
|
|
|
|
(when max-tags
|
|
|
|
|
(setq list (org-agenda-limit-entries list 'tags max-tags)))
|
|
|
|
|
(when max-entries
|
|
|
|
|
(setq list (org-agenda-limit-entries list 'org-hd-marker max-entries)))
|
|
|
|
|
(mapconcat 'identity list "\n")))
|
2013-02-06 16:16:35 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-limit-entries (list prop limit &optional fn)
|
|
|
|
|
"Limit the number of agenda entries."
|
2013-04-05 06:36:17 +00:00
|
|
|
|
(let ((include (and limit (< limit 0))))
|
|
|
|
|
(if limit
|
|
|
|
|
(let ((fun (or fn (lambda (p) (if p 1))))
|
|
|
|
|
(lim 0))
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (e)
|
|
|
|
|
(let ((pval (funcall fun (get-text-property 1 prop e))))
|
|
|
|
|
(if pval (setq lim (+ lim pval)))
|
|
|
|
|
(cond ((and pval (<= lim (abs limit))) e)
|
|
|
|
|
((and include (not pval)) e))))
|
|
|
|
|
list)))
|
|
|
|
|
list)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-limit-interactively ()
|
|
|
|
|
"In agenda, interactively limit entries to various maximums."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((max (read-char "Number of [e]ntries [t]odos [T]ags [E]ffort? "))
|
|
|
|
|
(num (string-to-number (read-from-minibuffer "How many? "))))
|
|
|
|
|
(cond ((equal max ?e)
|
|
|
|
|
(let ((org-agenda-max-entries num)) (org-agenda-redo)))
|
|
|
|
|
((equal max ?t)
|
|
|
|
|
(let ((org-agenda-max-todos num)) (org-agenda-redo)))
|
|
|
|
|
((equal max ?T)
|
|
|
|
|
(let ((org-agenda-max-tags num)) (org-agenda-redo)))
|
|
|
|
|
((equal max ?E)
|
|
|
|
|
(let ((org-agenda-max-effort num)) (org-agenda-redo)))))
|
|
|
|
|
(org-agenda-fit-window-to-buffer))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-highlight-todo (x)
|
2008-09-19 10:40:15 +00:00
|
|
|
|
(let ((org-done-keywords org-done-keywords-for-agenda)
|
2009-12-16 14:33:00 +00:00
|
|
|
|
(case-fold-search nil)
|
2011-12-12 16:23:44 +00:00
|
|
|
|
re)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (eq x 'line)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line 1)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(setq re (org-get-at-bol 'org-todo-regexp))
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(goto-char (or (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) (point)))
|
2008-09-19 10:40:15 +00:00
|
|
|
|
(when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
|
2009-06-22 11:46:02 +00:00
|
|
|
|
(add-text-properties (match-beginning 0) (match-end 1)
|
2008-09-19 10:40:15 +00:00
|
|
|
|
(list 'face (org-get-todo-face 1)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((s (buffer-substring (match-beginning 1) (match-end 1))))
|
|
|
|
|
(delete-region (match-beginning 1) (1- (match-end 0)))
|
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
|
(insert (format org-agenda-todo-keyword-format s)))))
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(let ((pl (text-property-any 0 (length x) 'org-heading t x)))
|
2011-03-17 16:07:10 +00:00
|
|
|
|
(setq re (get-text-property 0 'org-todo-regexp x))
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(when (and re
|
2012-03-01 00:45:05 +00:00
|
|
|
|
;; Test `pl' because if there's no heading content,
|
|
|
|
|
;; there's no point matching to highlight. Note
|
|
|
|
|
;; that if we didn't test `pl' first, and there
|
|
|
|
|
;; happened to be no keyword from `org-todo-regexp'
|
|
|
|
|
;; on this heading line, then the `equal' comparison
|
|
|
|
|
;; afterwards would spuriously succeed in the case
|
|
|
|
|
;; where `pl' is nil -- causing an args-out-of-range
|
|
|
|
|
;; error when we try to add text properties to text
|
|
|
|
|
;; that isn't there.
|
|
|
|
|
pl
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
|
2012-03-01 00:45:05 +00:00
|
|
|
|
x pl) pl))
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(add-text-properties
|
|
|
|
|
(or (match-end 1) (match-end 0)) (match-end 0)
|
|
|
|
|
(list 'face (org-get-todo-face (match-string 2 x)))
|
2011-12-12 16:23:44 +00:00
|
|
|
|
x)
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(when (match-end 1)
|
|
|
|
|
(setq x (concat (substring x 0 (match-end 1))
|
|
|
|
|
(format org-agenda-todo-keyword-format
|
|
|
|
|
(match-string 2 x))
|
2011-12-12 16:23:44 +00:00
|
|
|
|
(org-add-props " " (text-properties-at 0 x))
|
|
|
|
|
(substring x (match-end 3)))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
x)))
|
|
|
|
|
|
|
|
|
|
(defsubst org-cmp-priority (a b)
|
|
|
|
|
"Compare the priorities of string A and B."
|
|
|
|
|
(let ((pa (or (get-text-property 1 'priority a) 0))
|
|
|
|
|
(pb (or (get-text-property 1 'priority b) 0)))
|
|
|
|
|
(cond ((> pa pb) +1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((< pa pb) -1))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(defsubst org-cmp-effort (a b)
|
2011-08-16 14:16:43 +00:00
|
|
|
|
"Compare the effort values of string A and B."
|
2008-04-17 16:26:27 +00:00
|
|
|
|
(let* ((def (if org-sort-agenda-noeffort-is-high 32767 -1))
|
|
|
|
|
(ea (or (get-text-property 1 'effort-minutes a) def))
|
|
|
|
|
(eb (or (get-text-property 1 'effort-minutes b) def)))
|
|
|
|
|
(cond ((> ea eb) +1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((< ea eb) -1))))
|
2008-04-17 16:26:27 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defsubst org-cmp-category (a b)
|
|
|
|
|
"Compare the string values of categories of strings A and B."
|
|
|
|
|
(let ((ca (or (get-text-property 1 'org-category a) ""))
|
|
|
|
|
(cb (or (get-text-property 1 'org-category b) "")))
|
|
|
|
|
(cond ((string-lessp ca cb) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((string-lessp cb ca) +1))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-09-18 11:45:49 +00:00
|
|
|
|
(defsubst org-cmp-todo-state (a b)
|
|
|
|
|
"Compare the todo states of strings A and B."
|
2009-02-16 12:45:31 +00:00
|
|
|
|
(let* ((ma (or (get-text-property 1 'org-marker a)
|
|
|
|
|
(get-text-property 1 'org-hd-marker a)))
|
|
|
|
|
(mb (or (get-text-property 1 'org-marker b)
|
|
|
|
|
(get-text-property 1 'org-hd-marker b)))
|
|
|
|
|
(fa (and ma (marker-buffer ma)))
|
|
|
|
|
(fb (and mb (marker-buffer mb)))
|
|
|
|
|
(todo-kwds
|
|
|
|
|
(or (and fa (with-current-buffer fa org-todo-keywords-1))
|
|
|
|
|
(and fb (with-current-buffer fb org-todo-keywords-1))))
|
|
|
|
|
(ta (or (get-text-property 1 'todo-state a) ""))
|
2008-09-18 11:45:49 +00:00
|
|
|
|
(tb (or (get-text-property 1 'todo-state b) ""))
|
2009-02-16 12:45:31 +00:00
|
|
|
|
(la (- (length (member ta todo-kwds))))
|
|
|
|
|
(lb (- (length (member tb todo-kwds))))
|
2008-12-04 14:33:43 +00:00
|
|
|
|
(donepa (member ta org-done-keywords-for-agenda))
|
2008-09-18 11:45:49 +00:00
|
|
|
|
(donepb (member tb org-done-keywords-for-agenda)))
|
|
|
|
|
(cond ((and donepa (not donepb)) -1)
|
|
|
|
|
((and (not donepa) donepb) +1)
|
|
|
|
|
((< la lb) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((< lb la) +1))))
|
2008-09-18 11:45:49 +00:00
|
|
|
|
|
2010-04-30 05:31:43 +00:00
|
|
|
|
(defsubst org-cmp-alpha (a b)
|
|
|
|
|
"Compare the headlines, alphabetically."
|
2011-03-16 17:17:28 +00:00
|
|
|
|
(let* ((pla (text-property-any 0 (length a) 'org-heading t a))
|
|
|
|
|
(plb (text-property-any 0 (length b) 'org-heading t b))
|
2010-04-30 05:31:43 +00:00
|
|
|
|
(ta (and pla (substring a pla)))
|
|
|
|
|
(tb (and plb (substring b plb))))
|
|
|
|
|
(when pla
|
|
|
|
|
(if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp a) "")
|
|
|
|
|
"\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") ta)
|
|
|
|
|
(setq ta (substring ta (match-end 0))))
|
|
|
|
|
(setq ta (downcase ta)))
|
|
|
|
|
(when plb
|
|
|
|
|
(if (string-match (concat "\\`[ \t]*" (or (get-text-property 0 'org-todo-regexp b) "")
|
|
|
|
|
"\\([ \t]*\\[[a-zA-Z0-9]\\]\\)? *") tb)
|
|
|
|
|
(setq tb (substring tb (match-end 0))))
|
|
|
|
|
(setq tb (downcase tb)))
|
|
|
|
|
(cond ((not ta) +1)
|
|
|
|
|
((not tb) -1)
|
|
|
|
|
((string-lessp ta tb) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((string-lessp tb ta) +1))))
|
2010-04-30 05:31:43 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defsubst org-cmp-tag (a b)
|
2008-10-25 10:40:13 +00:00
|
|
|
|
"Compare the string values of the first tags of A and B."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((ta (car (last (get-text-property 1 'tags a))))
|
|
|
|
|
(tb (car (last (get-text-property 1 'tags b)))))
|
|
|
|
|
(cond ((not ta) +1)
|
|
|
|
|
((not tb) -1)
|
|
|
|
|
((string-lessp ta tb) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((string-lessp tb ta) +1))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defsubst org-cmp-time (a b)
|
|
|
|
|
"Compare the time-of-day values of strings A and B."
|
|
|
|
|
(let* ((def (if org-sort-agenda-notime-is-late 9901 -1))
|
|
|
|
|
(ta (or (get-text-property 1 'time-of-day a) def))
|
|
|
|
|
(tb (or (get-text-property 1 'time-of-day b) def)))
|
|
|
|
|
(cond ((< ta tb) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((< tb ta) +1))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2013-02-05 14:03:29 +00:00
|
|
|
|
(defsubst org-cmp-ts (a b &optional type)
|
|
|
|
|
"Compare the timestamps values of entries A and B.
|
|
|
|
|
When TYPE is \"scheduled\", \"deadline\", \"timestamp\"
|
|
|
|
|
or \"timestamp_ia\", compare within each of these type.
|
|
|
|
|
When TYPE is the empty string, compare all timestamps
|
|
|
|
|
without respect of their type."
|
|
|
|
|
(let* ((def (if org-sort-agenda-notime-is-late 9901 -1))
|
|
|
|
|
(ta (or (and (string-match type (get-text-property 1 'type a))
|
|
|
|
|
(get-text-property 1 'ts-date a)) def))
|
|
|
|
|
(tb (or (and (string-match type (get-text-property 1 'type b))
|
|
|
|
|
(get-text-property 1 'ts-date b)) def)))
|
|
|
|
|
(cond ((< ta tb) -1)
|
|
|
|
|
((< tb ta) +1))))
|
|
|
|
|
|
2009-10-19 08:17:49 +00:00
|
|
|
|
(defsubst org-cmp-habit-p (a b)
|
|
|
|
|
"Compare the todo states of strings A and B."
|
|
|
|
|
(let ((ha (get-text-property 1 'org-habit-p a))
|
|
|
|
|
(hb (get-text-property 1 'org-habit-p b)))
|
|
|
|
|
(cond ((and ha (not hb)) -1)
|
Remove useless (t nil) sexps at the end of some (cond ...) constructs
* org.el (org-compute-latex-and-specials-regexp)
(org-paste-subtree, org-sort-entries, org-store-link)
(org-open-at-point, org-file-remote-p, org-add-log-setup)
(org-set-tags-to, org-fast-tag-selection)
(org-diary-sexp-entry): Ditto.
* org-agenda.el (org-agenda-get-blocks, org-cmp-priority)
(org-cmp-effort, org-cmp-todo-state, org-cmp-alpha)
(org-cmp-tag, org-cmp-time): Remove useless (t nil) sexps at
the end of (cond ...) constructs.
* org-mobile.el (org-mobile-create-index-file): Ditto.
* org-lparse.el (org-lparse-format-table-row): Ditto.
* org-list.el (org-sort-list): Ditto.
* org-id.el (org-id-get): Ditto.
* org-html.el (org-export-html-preprocess): Ditto.
* org-exp.el (org-default-export-plist)
(org-table-clean-before-export): Ditto.
(t nil) in (cond (...) (...) (t nil)) has no other meaning that to
remind the developer that the cond sexp returns nil in case no condition
is matched. For several (cond ...) constructs this is obvious from reading
the code. For others, the reminder might be useful and we leave it.
See the discussion about this on emacs-devel:
http://thread.gmane.org/gmane.emacs.devel/152664
2012-08-19 12:42:54 +00:00
|
|
|
|
((and (not ha) hb) +1))))
|
2009-10-19 08:17:49 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-entries-lessp (a b)
|
|
|
|
|
"Predicate for sorting agenda entries."
|
|
|
|
|
;; The following variables will be used when the form is evaluated.
|
|
|
|
|
;; So even though the compiler complains, keep them.
|
2010-04-30 05:49:59 +00:00
|
|
|
|
(let* ((ss org-agenda-sorting-strategy-selected)
|
2013-02-05 14:03:29 +00:00
|
|
|
|
(timestamp-up (and (org-em 'timestamp-up 'timestamp-down ss)
|
|
|
|
|
(org-cmp-ts a b "")))
|
|
|
|
|
(timestamp-down (if timestamp-up (- timestamp-up) nil))
|
|
|
|
|
(scheduled-up (and (org-em 'scheduled-up 'scheduled-down ss)
|
|
|
|
|
(org-cmp-ts a b "scheduled")))
|
|
|
|
|
(scheduled-down (if scheduled-up (- scheduled-up) nil))
|
|
|
|
|
(deadline-up (and (org-em 'deadline-up 'deadline-down ss)
|
|
|
|
|
(org-cmp-ts a b "deadline")))
|
|
|
|
|
(deadline-down (if deadline-up (- deadline-up) nil))
|
|
|
|
|
(tsia-up (and (org-em 'tsia-up 'tsia-down ss)
|
|
|
|
|
(org-cmp-ts a b "iatimestamp_ia")))
|
|
|
|
|
(tsia-down (if tsia-up (- tsia-up) nil))
|
|
|
|
|
(ts-up (and (org-em 'ts-up 'ts-down ss)
|
|
|
|
|
(org-cmp-ts a b "timestamp")))
|
|
|
|
|
(ts-down (if ts-up (- ts-up) nil))
|
2010-04-30 05:49:59 +00:00
|
|
|
|
(time-up (and (org-em 'time-up 'time-down ss)
|
|
|
|
|
(org-cmp-time a b)))
|
|
|
|
|
(time-down (if time-up (- time-up) nil))
|
|
|
|
|
(priority-up (and (org-em 'priority-up 'priority-down ss)
|
|
|
|
|
(org-cmp-priority a b)))
|
|
|
|
|
(priority-down (if priority-up (- priority-up) nil))
|
|
|
|
|
(effort-up (and (org-em 'effort-up 'effort-down ss)
|
|
|
|
|
(org-cmp-effort a b)))
|
|
|
|
|
(effort-down (if effort-up (- effort-up) nil))
|
|
|
|
|
(category-up (and (or (org-em 'category-up 'category-down ss)
|
|
|
|
|
(memq 'category-keep ss))
|
|
|
|
|
(org-cmp-category a b)))
|
|
|
|
|
(category-down (if category-up (- category-up) nil))
|
|
|
|
|
(category-keep (if category-up +1 nil))
|
|
|
|
|
(tag-up (and (org-em 'tag-up 'tag-down ss)
|
|
|
|
|
(org-cmp-tag a b)))
|
|
|
|
|
(tag-down (if tag-up (- tag-up) nil))
|
|
|
|
|
(todo-state-up (and (org-em 'todo-state-up 'todo-state-down ss)
|
|
|
|
|
(org-cmp-todo-state a b)))
|
2009-03-27 16:50:21 +00:00
|
|
|
|
(todo-state-down (if todo-state-up (- todo-state-up) nil))
|
2010-04-30 05:49:59 +00:00
|
|
|
|
(habit-up (and (org-em 'habit-up 'habit-down ss)
|
|
|
|
|
(org-cmp-habit-p a b)))
|
|
|
|
|
(habit-down (if habit-up (- habit-up) nil))
|
|
|
|
|
(alpha-up (and (org-em 'alpha-up 'alpha-down ss)
|
|
|
|
|
(org-cmp-alpha a b)))
|
|
|
|
|
(alpha-down (if alpha-up (- alpha-up) nil))
|
2010-08-08 06:43:07 +00:00
|
|
|
|
(need-user-cmp (org-em 'user-defined-up 'user-defined-down ss))
|
2009-03-27 16:50:21 +00:00
|
|
|
|
user-defined-up user-defined-down)
|
2010-07-19 01:40:57 +00:00
|
|
|
|
(if (and need-user-cmp org-agenda-cmp-user-defined
|
2009-03-27 16:50:21 +00:00
|
|
|
|
(functionp org-agenda-cmp-user-defined))
|
|
|
|
|
(setq user-defined-up
|
|
|
|
|
(funcall org-agenda-cmp-user-defined a b)
|
|
|
|
|
user-defined-down (if user-defined-up (- user-defined-up) nil)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cdr (assoc
|
|
|
|
|
(eval (cons 'or org-agenda-sorting-strategy-selected))
|
|
|
|
|
'((-1 . t) (1 . nil) (nil . nil))))))
|
|
|
|
|
|
|
|
|
|
;;; Agenda restriction lock
|
|
|
|
|
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(defvar org-agenda-restriction-lock-overlay (make-overlay 1 1)
|
2009-11-12 12:39:29 +00:00
|
|
|
|
"Overlay to mark the headline to which agenda commands are restricted.")
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(overlay-put org-agenda-restriction-lock-overlay
|
|
|
|
|
'face 'org-agenda-restriction-lock)
|
|
|
|
|
(overlay-put org-agenda-restriction-lock-overlay
|
|
|
|
|
'help-echo "Agendas are currently limited to this subtree.")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-detach-overlay org-agenda-restriction-lock-overlay)
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-set-restriction-lock (&optional type)
|
|
|
|
|
"Set restriction lock for agenda, to current subtree or file.
|
|
|
|
|
Restriction will be the file if TYPE is `file', or if type is the
|
|
|
|
|
universal prefix '(4), or if the cursor is before the first headline
|
|
|
|
|
in the file. Otherwise, restriction will be to the current subtree."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(and (equal type '(4)) (setq type 'file))
|
|
|
|
|
(setq type (cond
|
|
|
|
|
(type type)
|
|
|
|
|
((org-at-heading-p) 'subtree)
|
|
|
|
|
((condition-case nil (org-back-to-heading t) (error nil))
|
|
|
|
|
'subtree)
|
|
|
|
|
(t 'file)))
|
|
|
|
|
(if (eq type 'subtree)
|
|
|
|
|
(progn
|
|
|
|
|
(setq org-agenda-restrict t)
|
|
|
|
|
(setq org-agenda-overriding-restriction 'subtree)
|
|
|
|
|
(put 'org-agenda-files 'org-restrict
|
|
|
|
|
(list (buffer-file-name (buffer-base-buffer))))
|
|
|
|
|
(org-back-to-heading t)
|
2013-02-16 22:09:57 +00:00
|
|
|
|
(move-overlay org-agenda-restriction-lock-overlay
|
2013-04-05 23:51:29 +00:00
|
|
|
|
(point)
|
|
|
|
|
(if org-agenda-restriction-lock-highlight-subtree
|
|
|
|
|
(save-excursion (org-end-of-subtree t t) (point))
|
|
|
|
|
(point-at-eol)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(move-marker org-agenda-restrict-begin (point))
|
|
|
|
|
(move-marker org-agenda-restrict-end
|
2013-02-19 09:33:07 +00:00
|
|
|
|
(save-excursion (org-end-of-subtree t t)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Locking agenda restriction to subtree"))
|
|
|
|
|
(put 'org-agenda-files 'org-restrict
|
|
|
|
|
(list (buffer-file-name (buffer-base-buffer))))
|
|
|
|
|
(setq org-agenda-restrict nil)
|
|
|
|
|
(setq org-agenda-overriding-restriction 'file)
|
|
|
|
|
(move-marker org-agenda-restrict-begin nil)
|
|
|
|
|
(move-marker org-agenda-restrict-end nil)
|
|
|
|
|
(message "Locking agenda restriction to file"))
|
|
|
|
|
(setq current-prefix-arg nil)
|
|
|
|
|
(org-agenda-maybe-redo))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-remove-restriction-lock (&optional noupdate)
|
|
|
|
|
"Remove the agenda restriction lock."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-detach-overlay org-agenda-restriction-lock-overlay)
|
|
|
|
|
(org-detach-overlay org-speedbar-restriction-lock-overlay)
|
|
|
|
|
(setq org-agenda-overriding-restriction nil)
|
|
|
|
|
(setq org-agenda-restrict nil)
|
|
|
|
|
(put 'org-agenda-files 'org-restrict nil)
|
|
|
|
|
(move-marker org-agenda-restrict-begin nil)
|
|
|
|
|
(move-marker org-agenda-restrict-end nil)
|
|
|
|
|
(setq current-prefix-arg nil)
|
|
|
|
|
(message "Agenda restriction lock removed")
|
|
|
|
|
(or noupdate (org-agenda-maybe-redo)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-maybe-redo ()
|
|
|
|
|
"If there is any window showing the agenda view, update it."
|
|
|
|
|
(let ((w (get-buffer-window org-agenda-buffer-name t))
|
|
|
|
|
(w0 (selected-window)))
|
|
|
|
|
(when w
|
|
|
|
|
(select-window w)
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(select-window w0)
|
|
|
|
|
(if org-agenda-overriding-restriction
|
|
|
|
|
(message "Agenda view shifted to new %s restriction"
|
|
|
|
|
org-agenda-overriding-restriction)
|
|
|
|
|
(message "Agenda restriction lock removed")))))
|
|
|
|
|
|
|
|
|
|
;;; Agenda commands
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-check-type (error &rest types)
|
|
|
|
|
"Check if agenda buffer is of allowed type.
|
2013-01-07 15:12:52 +00:00
|
|
|
|
If ERROR is non-nil, throw an error, otherwise just return nil.
|
|
|
|
|
Allowed types are 'agenda 'timeline 'todo 'tags 'search."
|
2012-08-05 07:16:40 +00:00
|
|
|
|
(if (not org-agenda-type)
|
|
|
|
|
(error "No Org agenda currently displayed")
|
|
|
|
|
(if (memq org-agenda-type types)
|
|
|
|
|
t
|
|
|
|
|
(if error
|
|
|
|
|
(error "Not allowed in %s-type agenda buffers" org-agenda-type)
|
|
|
|
|
nil))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-12-28 16:20:30 +00:00
|
|
|
|
(defun org-agenda-Quit ()
|
|
|
|
|
"Exit the agenda and kill buffers loaded by `org-agenda'.
|
|
|
|
|
Also restore the window configuration."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(if org-agenda-columns-active
|
2008-04-15 12:01:59 +00:00
|
|
|
|
(org-columns-quit)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(let ((buf (current-buffer)))
|
2009-09-22 11:11:29 +00:00
|
|
|
|
(if (eq org-agenda-window-setup 'other-frame)
|
|
|
|
|
(progn
|
|
|
|
|
(org-agenda-reset-markers)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(kill-buffer buf)
|
2009-09-22 11:11:29 +00:00
|
|
|
|
(org-columns-remove-overlays)
|
|
|
|
|
(setq org-agenda-archives-mode nil)
|
|
|
|
|
(delete-frame))
|
|
|
|
|
(and (not (eq org-agenda-window-setup 'current-window))
|
|
|
|
|
(not (one-window-p))
|
|
|
|
|
(delete-window))
|
|
|
|
|
(org-agenda-reset-markers)
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(kill-buffer buf)
|
2009-09-22 11:11:29 +00:00
|
|
|
|
(org-columns-remove-overlays)
|
|
|
|
|
(setq org-agenda-archives-mode nil)))
|
2013-03-16 17:59:52 +00:00
|
|
|
|
(setq org-agenda-buffer nil)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
;; Maybe restore the pre-agenda window configuration.
|
|
|
|
|
(and org-agenda-restore-windows-after-quit
|
|
|
|
|
(not (eq org-agenda-window-setup 'other-frame))
|
2012-08-28 16:29:18 +00:00
|
|
|
|
org-agenda-pre-window-conf
|
|
|
|
|
(set-window-configuration org-agenda-pre-window-conf)
|
|
|
|
|
(setq org-agenda-pre-window-conf nil))))
|
2008-04-24 08:29:47 +00:00
|
|
|
|
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(defun org-agenda-quit ()
|
2012-12-28 16:20:30 +00:00
|
|
|
|
"Exit the agenda and restore the window configuration.
|
|
|
|
|
When `org-agenda-sticky' is non-nil, only bury the agenda."
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(interactive)
|
2012-09-29 09:10:03 +00:00
|
|
|
|
(if (and (eq org-indirect-buffer-display 'other-window)
|
|
|
|
|
org-last-indirect-buffer)
|
2013-01-22 13:14:08 +00:00
|
|
|
|
(let ((org-last-indirect-window
|
|
|
|
|
(get-buffer-window org-last-indirect-buffer)))
|
|
|
|
|
(if org-last-indirect-window
|
|
|
|
|
(delete-window org-last-indirect-window))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(if org-agenda-columns-active
|
|
|
|
|
(org-columns-quit)
|
|
|
|
|
(if org-agenda-sticky
|
|
|
|
|
(let ((buf (current-buffer)))
|
|
|
|
|
(if (eq org-agenda-window-setup 'other-frame)
|
|
|
|
|
(progn
|
|
|
|
|
(delete-frame))
|
|
|
|
|
(and (not (eq org-agenda-window-setup 'current-window))
|
|
|
|
|
(not (one-window-p))
|
|
|
|
|
(delete-window)))
|
|
|
|
|
(with-current-buffer buf
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(bury-buffer)
|
2012-04-21 12:31:37 +00:00
|
|
|
|
;; Maybe restore the pre-agenda window configuration.
|
|
|
|
|
(and org-agenda-restore-windows-after-quit
|
|
|
|
|
(not (eq org-agenda-window-setup 'other-frame))
|
2012-08-28 16:29:18 +00:00
|
|
|
|
org-agenda-pre-window-conf
|
|
|
|
|
(set-window-configuration org-agenda-pre-window-conf)
|
|
|
|
|
(setq org-agenda-pre-window-conf nil))))
|
2012-04-21 12:40:58 +00:00
|
|
|
|
(org-agenda-Quit))))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-exit ()
|
2012-12-28 16:20:30 +00:00
|
|
|
|
"Exit the agenda and restore the window configuration.
|
|
|
|
|
Also kill Org-mode buffers loaded by `org-agenda'. Org-mode
|
|
|
|
|
buffers visited directly by the user will not be touched."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-release-buffers org-agenda-new-buffers)
|
|
|
|
|
(setq org-agenda-new-buffers nil)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(org-agenda-Quit))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(defun org-agenda-kill-all-agenda-buffers ()
|
2012-10-23 16:41:33 +00:00
|
|
|
|
"Kill all buffers in `org-agenda-mode'.
|
2012-12-28 16:20:30 +00:00
|
|
|
|
This is used when toggling sticky agendas.
|
|
|
|
|
You can also explicitly invoke it with `C-c a C-k'."
|
2012-03-09 08:25:20 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let (blist)
|
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
|
(when (with-current-buffer buf (eq major-mode 'org-agenda-mode))
|
|
|
|
|
(push buf blist)))
|
|
|
|
|
(mapc 'kill-buffer blist)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-execute (arg)
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Execute another agenda command, keeping same window.
|
|
|
|
|
So this is just a shortcut for \\<global-map>`\\[org-agenda]', available
|
|
|
|
|
in the agenda."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((org-agenda-window-setup 'current-window))
|
|
|
|
|
(org-agenda arg)))
|
|
|
|
|
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(defun org-agenda-redo (&optional all)
|
|
|
|
|
"Rebuild possibly ALL agenda view(s) in the current buffer."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let* ((p (or (and (looking-at "\\'") (1- (point))) (point)))
|
|
|
|
|
(cpa (unless (eq all t) current-prefix-arg))
|
|
|
|
|
(org-agenda-doing-sticky-redo org-agenda-sticky)
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(org-agenda-sticky nil)
|
|
|
|
|
(org-agenda-buffer-name (or org-agenda-this-buffer-name
|
|
|
|
|
org-agenda-buffer-name))
|
|
|
|
|
(org-agenda-keep-modes t)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(tag-filter org-agenda-tag-filter)
|
|
|
|
|
(tag-preset (get 'org-agenda-tag-filter :preset-filter))
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(top-hl-filter org-agenda-top-headline-filter)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(cat-filter org-agenda-category-filter)
|
|
|
|
|
(cat-preset (get 'org-agenda-category-filter :preset-filter))
|
2013-03-13 22:05:45 +00:00
|
|
|
|
(re-filter org-agenda-regexp-filter)
|
2013-03-19 12:05:36 +00:00
|
|
|
|
(re-preset (get 'org-agenda-regexp-filter :preset-filter))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-tag-filter-while-redo (or tag-filter tag-preset))
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(cols org-agenda-columns-active)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(line (org-current-line))
|
|
|
|
|
(window-line (- line (org-current-line (window-start))))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(lprops (get 'org-agenda-redo-command 'org-lprops))
|
|
|
|
|
(redo-cmd (get-text-property p 'org-redo-cmd))
|
|
|
|
|
(last-args (get-text-property p 'org-last-args))
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(org-agenda-overriding-cmd (get-text-property p 'org-series-cmd))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(org-agenda-overriding-cmd-arguments
|
|
|
|
|
(unless (eq all t)
|
|
|
|
|
(cond ((listp last-args)
|
|
|
|
|
(cons (or cpa (car last-args)) (cdr last-args)))
|
|
|
|
|
((stringp last-args)
|
|
|
|
|
last-args))))
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(series-redo-cmd (get-text-property p 'org-series-redo-cmd)))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(put 'org-agenda-tag-filter :preset-filter nil)
|
|
|
|
|
(put 'org-agenda-category-filter :preset-filter nil)
|
2013-03-19 12:30:11 +00:00
|
|
|
|
(put 'org-agenda-regexp-filter :preset-filter nil)
|
2008-04-15 09:02:10 +00:00
|
|
|
|
(and cols (org-columns-quit))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Rebuilding agenda buffer...")
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(if series-redo-cmd
|
|
|
|
|
(eval series-redo-cmd)
|
2013-04-05 06:36:17 +00:00
|
|
|
|
(org-let lprops redo-cmd))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-undo-list nil
|
2013-03-19 12:30:11 +00:00
|
|
|
|
org-agenda-pending-undo-list nil
|
|
|
|
|
org-agenda-tag-filter tag-filter
|
|
|
|
|
org-agenda-category-filter cat-filter
|
|
|
|
|
org-agenda-regexp-filter re-filter
|
2013-04-05 16:44:11 +00:00
|
|
|
|
org-agenda-top-headline-filter top-hl-filter)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Rebuilding agenda buffer...done")
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(put 'org-agenda-tag-filter :preset-filter tag-preset)
|
|
|
|
|
(put 'org-agenda-category-filter :preset-filter cat-preset)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(put 'org-agenda-regexp-filter :preset-filter re-preset)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(and (or tag-filter tag-preset) (org-agenda-filter-apply tag-filter 'tag))
|
|
|
|
|
(and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter 'category))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(and (or re-filter re-preset) (org-agenda-filter-apply re-filter 'regexp))
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter))
|
2011-06-29 22:25:09 +00:00
|
|
|
|
(and cols (org-called-interactively-p 'any) (org-agenda-columns))
|
2009-08-27 08:24:09 +00:00
|
|
|
|
(org-goto-line line)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(recenter window-line)))
|
|
|
|
|
|
2008-09-17 11:55:59 +00:00
|
|
|
|
(defvar org-global-tags-completion-table nil)
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(defvar org-agenda-filter-form nil)
|
2012-03-19 20:38:12 +00:00
|
|
|
|
(defvar org-agenda-filtered-by-category nil)
|
2012-03-17 15:28:46 +00:00
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defun org-agenda-filter-by-category (strip)
|
|
|
|
|
"Keep only those lines in the agenda buffer that have a specific category.
|
|
|
|
|
The category is that of the current line."
|
2012-04-10 18:23:15 +00:00
|
|
|
|
(interactive "P")
|
2012-08-21 16:12:16 +00:00
|
|
|
|
(if (and org-agenda-filtered-by-category
|
|
|
|
|
org-agenda-category-filter)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-show-all-cat)
|
|
|
|
|
(let ((cat (org-no-properties (get-text-property (point) 'org-category))))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(if (and cat (not (string= "" cat)))
|
|
|
|
|
(org-agenda-filter-apply
|
|
|
|
|
(setq org-agenda-category-filter
|
|
|
|
|
(list (concat (if strip "-" "+") cat)))
|
|
|
|
|
'category)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(error "No category at point")))))
|
|
|
|
|
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(defun org-find-top-headline (&optional pos)
|
|
|
|
|
"Find the topmost parent headline and return it."
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(with-current-buffer (if pos (marker-buffer pos) (current-buffer))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(if pos (goto-char pos))
|
|
|
|
|
;; Skip up to the topmost parent
|
|
|
|
|
(while (ignore-errors (outline-up-heading 1) t))
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(nth 4 (org-heading-components))))))
|
2012-04-16 08:12:56 +00:00
|
|
|
|
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(defvar org-agenda-filtered-by-top-headline nil)
|
|
|
|
|
(defun org-agenda-filter-by-top-headline (strip)
|
|
|
|
|
"Keep only those lines that are descendants from the same top headline.
|
|
|
|
|
The top headline is that of the current line."
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(interactive "P")
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(if org-agenda-filtered-by-top-headline
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(progn
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(setq org-agenda-filtered-by-top-headline nil
|
|
|
|
|
org-agenda-top-headline-filter nil)
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(org-agenda-filter-show-all-cat))
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(let ((cat (org-find-top-headline (org-get-at-bol 'org-hd-marker))))
|
|
|
|
|
(if cat (org-agenda-filter-top-headline-apply cat strip)
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(error "No top-level category at point")))))
|
|
|
|
|
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(defvar org-agenda-regexp-filter nil)
|
|
|
|
|
(defun org-agenda-filter-by-regexp (strip)
|
|
|
|
|
"Filter agenda entries by a regular expression.
|
|
|
|
|
Regexp filters are cumulative.
|
|
|
|
|
With no prefix argument, keep entries matching the regexp.
|
|
|
|
|
With one prefix argument, filter out entries matching the regexp.
|
|
|
|
|
With two prefix arguments, remove the regexp filters."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (not (equal strip '(16)))
|
|
|
|
|
(let ((flt (concat (if (equal strip '(4)) "-" "+")
|
|
|
|
|
(read-from-minibuffer
|
|
|
|
|
(if (equal strip '(4))
|
|
|
|
|
"Filter out entries matching regexp: "
|
|
|
|
|
"Narrow to entries matching regexp: ")))))
|
|
|
|
|
(push flt org-agenda-regexp-filter)
|
|
|
|
|
(org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
|
2013-03-16 18:40:02 +00:00
|
|
|
|
(org-agenda-filter-show-all-re)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(message "Regexp filter removed")))
|
|
|
|
|
|
2013-03-16 18:40:02 +00:00
|
|
|
|
(defun org-agenda-filter-remove-all ()
|
|
|
|
|
"Remove all filters from the current agenda buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(when org-agenda-tag-filter
|
|
|
|
|
(org-agenda-filter-show-all-tag))
|
|
|
|
|
(when org-agenda-category-filter
|
|
|
|
|
(org-agenda-filter-show-all-cat))
|
|
|
|
|
(when org-agenda-regexp-filter
|
|
|
|
|
(org-agenda-filter-show-all-re)))
|
|
|
|
|
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(defun org-agenda-filter-by-tag (strip &optional char narrow)
|
2008-09-05 17:02:14 +00:00
|
|
|
|
"Keep only those lines in the agenda buffer that have a specific tag.
|
|
|
|
|
The tag is selected with its fast selection letter, as configured.
|
2008-10-20 07:38:23 +00:00
|
|
|
|
With prefix argument STRIP, remove all lines that do have the tag.
|
|
|
|
|
A lisp caller can specify CHAR. NARROW means that the new tag should be
|
|
|
|
|
used to narrow the search - the interactive user can also press `-' or `+'
|
|
|
|
|
to switch to narrowing."
|
2008-09-05 17:02:14 +00:00
|
|
|
|
(interactive "P")
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(let* ((alist org-tag-alist-for-agenda)
|
2009-10-19 03:41:26 +00:00
|
|
|
|
(tag-chars (mapconcat
|
2009-11-05 15:08:55 +00:00
|
|
|
|
(lambda (x) (if (and (not (symbolp (car x)))
|
|
|
|
|
(cdr x))
|
|
|
|
|
(char-to-string (cdr x))
|
|
|
|
|
""))
|
2009-10-19 03:41:26 +00:00
|
|
|
|
alist ""))
|
|
|
|
|
(efforts (org-split-string
|
|
|
|
|
(or (cdr (assoc (concat org-effort-property "_ALL")
|
|
|
|
|
org-global-properties))
|
2011-04-09 14:20:46 +00:00
|
|
|
|
"0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00"
|
|
|
|
|
"")))
|
2009-10-19 03:41:26 +00:00
|
|
|
|
(effort-op org-agenda-filter-effort-default-operator)
|
|
|
|
|
(effort-prompt "")
|
|
|
|
|
(inhibit-read-only t)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(current org-agenda-tag-filter)
|
2011-04-14 03:05:25 +00:00
|
|
|
|
maybe-refresh a n tag)
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(unless char
|
2008-12-04 14:33:43 +00:00
|
|
|
|
(message
|
2009-10-19 03:41:26 +00:00
|
|
|
|
"%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: "
|
|
|
|
|
(if narrow "Narrow" "Filter") tag-chars
|
|
|
|
|
(if org-agenda-auto-exclude-function "[RET], " ""))
|
2011-12-31 10:45:54 +00:00
|
|
|
|
(setq char (read-char-exclusive)))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(when (member char '(?+ ?-))
|
2008-10-20 21:01:23 +00:00
|
|
|
|
;; Narrowing down
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(cond ((equal char ?-) (setq strip t narrow t))
|
|
|
|
|
((equal char ?+) (setq strip nil narrow t)))
|
2008-12-04 14:33:43 +00:00
|
|
|
|
(message
|
2008-10-20 21:01:23 +00:00
|
|
|
|
"Narrow by tag [%s ], [TAB], [/]:off, [>=<]:effort: " tag-chars)
|
2011-12-31 10:45:54 +00:00
|
|
|
|
(setq char (read-char-exclusive)))
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(when (member char '(?< ?> ?= ??))
|
2008-10-20 21:01:23 +00:00
|
|
|
|
;; An effort operator
|
|
|
|
|
(setq effort-op (char-to-string char))
|
|
|
|
|
(setq alist nil) ; to make sure it will be interpreted as effort.
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(unless (equal char ??)
|
|
|
|
|
(loop for i from 0 to 9 do
|
|
|
|
|
(setq effort-prompt
|
|
|
|
|
(concat
|
|
|
|
|
effort-prompt " ["
|
|
|
|
|
(if (= i 9) "0" (int-to-string (1+ i)))
|
|
|
|
|
"]" (nth i efforts))))
|
|
|
|
|
(message "Effort%s: %s " effort-op effort-prompt)
|
2011-12-31 10:45:54 +00:00
|
|
|
|
(setq char (read-char-exclusive))
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(when (or (< char ?0) (> char ?9))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(error "Need 1-9,0 to select effort"))))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(when (equal char ?\t)
|
|
|
|
|
(unless (local-variable-p 'org-global-tags-completion-table (current-buffer))
|
|
|
|
|
(org-set-local 'org-global-tags-completion-table
|
|
|
|
|
(org-global-tags-completion-table)))
|
|
|
|
|
(let ((completion-ignore-case t))
|
2009-08-13 21:23:25 +00:00
|
|
|
|
(setq tag (org-icompleting-read
|
2008-10-20 07:38:23 +00:00
|
|
|
|
"Tag: " org-global-tags-completion-table))))
|
|
|
|
|
(cond
|
2009-10-19 03:41:26 +00:00
|
|
|
|
((equal char ?\r)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-show-all-tag)
|
2009-10-19 03:41:26 +00:00
|
|
|
|
(when org-agenda-auto-exclude-function
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(setq org-agenda-tag-filter nil)
|
2009-11-20 22:19:14 +00:00
|
|
|
|
(dolist (tag (org-agenda-get-represented-tags))
|
2009-11-20 22:17:55 +00:00
|
|
|
|
(let ((modifier (funcall org-agenda-auto-exclude-function tag)))
|
2009-10-19 03:41:26 +00:00
|
|
|
|
(if modifier
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(push modifier org-agenda-tag-filter))))
|
|
|
|
|
(if (not (null org-agenda-tag-filter))
|
|
|
|
|
(org-agenda-filter-apply org-agenda-tag-filter 'tag)))
|
2011-04-14 03:05:25 +00:00
|
|
|
|
(setq maybe-refresh t))
|
2009-03-03 14:40:17 +00:00
|
|
|
|
((equal char ?/)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-show-all-tag)
|
|
|
|
|
(when (get 'org-agenda-tag-filter :preset-filter)
|
|
|
|
|
(org-agenda-filter-apply org-agenda-tag-filter 'tag))
|
|
|
|
|
(setq maybe-refresh t))
|
|
|
|
|
((equal char ?. )
|
|
|
|
|
(setq org-agenda-tag-filter
|
|
|
|
|
(mapcar (lambda(tag) (concat "+" tag))
|
|
|
|
|
(org-get-at-bol 'tags)))
|
|
|
|
|
(org-agenda-filter-apply org-agenda-tag-filter 'tag)
|
2011-04-14 03:05:25 +00:00
|
|
|
|
(setq maybe-refresh t))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
((or (equal char ?\ )
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(setq a (rassoc char alist))
|
|
|
|
|
(and (>= char ?0) (<= char ?9)
|
|
|
|
|
(setq n (if (= char ?0) 9 (- char ?0 1))
|
|
|
|
|
tag (concat effort-op (nth n efforts))
|
|
|
|
|
a (cons tag nil)))
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(and (= char ??)
|
|
|
|
|
(setq tag "?eff")
|
|
|
|
|
a (cons tag nil))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(and tag (setq a (cons tag nil))))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-show-all-tag)
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(setq tag (car a))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(setq org-agenda-tag-filter
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(cons (concat (if strip "-" "+") tag)
|
|
|
|
|
(if narrow current nil)))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-apply org-agenda-tag-filter 'tag)
|
2011-04-14 03:05:25 +00:00
|
|
|
|
(setq maybe-refresh t))
|
2011-02-09 07:55:58 +00:00
|
|
|
|
(t (error "Invalid tag selection character %c" char)))
|
2011-07-28 15:22:38 +00:00
|
|
|
|
(when (and maybe-refresh
|
|
|
|
|
(eq org-agenda-clockreport-mode 'with-filter))
|
2011-02-09 07:55:58 +00:00
|
|
|
|
(org-agenda-redo))))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
|
2009-11-20 22:17:55 +00:00
|
|
|
|
(defun org-agenda-get-represented-tags ()
|
|
|
|
|
"Get a list of all tags currently represented in the agenda."
|
|
|
|
|
(let (p tags)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (setq p (next-single-property-change (point) 'tags))
|
|
|
|
|
(goto-char p)
|
|
|
|
|
(mapc (lambda (x) (add-to-list 'tags x))
|
|
|
|
|
(get-text-property (point) 'tags))))
|
|
|
|
|
tags))
|
|
|
|
|
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(defun org-agenda-filter-by-tag-refine (strip &optional char)
|
2011-08-23 15:34:15 +00:00
|
|
|
|
"Refine the current filter. See `org-agenda-filter-by-tag'."
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-filter-by-tag strip char 'refine))
|
|
|
|
|
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(defun org-agenda-filter-make-matcher (filter type)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
"Create the form that tests a line for agenda filter."
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(let (f f1)
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; Tag filter
|
|
|
|
|
((eq type 'tag)
|
|
|
|
|
(setq filter
|
|
|
|
|
(delete-dups
|
|
|
|
|
(append (get 'org-agenda-tag-filter :preset-filter)
|
|
|
|
|
filter)))
|
|
|
|
|
(dolist (x filter)
|
|
|
|
|
(let ((nfilter (org-agenda-filter-expand-tags filter)) nf nf1
|
|
|
|
|
(ffunc
|
|
|
|
|
(lambda (nf0 nf01 fltr notgroup op)
|
|
|
|
|
(dolist (x fltr)
|
|
|
|
|
(if (member x '("-" "+"))
|
|
|
|
|
(setq nf01 (if (equal x "-") 'tags '(not tags)))
|
|
|
|
|
(if (string-match "[<=>?]" x)
|
|
|
|
|
(setq nf01 (org-agenda-filter-effort-form x))
|
|
|
|
|
(setq nf01 (list 'member (downcase (substring x 1))
|
|
|
|
|
'tags)))
|
|
|
|
|
(when (equal (string-to-char x) ?-)
|
|
|
|
|
(setq nf01 (list 'not nf01))
|
|
|
|
|
(when (not notgroup) (setq op 'and))))
|
|
|
|
|
(push nf01 nf0))
|
|
|
|
|
(if notgroup
|
|
|
|
|
(push (cons 'and nf0) f)
|
|
|
|
|
(push (cons (or op 'or) nf0) f)))))
|
|
|
|
|
(if (equal nfilter filter)
|
|
|
|
|
(funcall ffunc f1 f filter t nil)
|
|
|
|
|
(funcall ffunc nf1 nf nfilter nil nil)))))
|
|
|
|
|
;; Category filter
|
|
|
|
|
((eq type 'category)
|
|
|
|
|
(setq filter
|
|
|
|
|
(delete-dups
|
|
|
|
|
(append (get 'org-agenda-category-filter :preset-filter)
|
|
|
|
|
filter)))
|
|
|
|
|
(dolist (x filter)
|
|
|
|
|
(if (equal "-" (substring x 0 1))
|
|
|
|
|
(setq f1 (list 'not (list 'equal (substring x 1) 'cat)))
|
|
|
|
|
(setq f1 (list 'equal (substring x 1) 'cat)))
|
|
|
|
|
(push f1 f)))
|
|
|
|
|
;; Regexp filter
|
|
|
|
|
((eq type 'regexp)
|
|
|
|
|
(setq filter
|
|
|
|
|
(delete-dups
|
|
|
|
|
(append (get 'org-agenda-regexp-filter :preset-filter)
|
|
|
|
|
filter)))
|
|
|
|
|
(dolist (x filter)
|
|
|
|
|
(if (equal "-" (substring x 0 1))
|
|
|
|
|
(setq f1 (list 'not (list 'string-match (substring x 1) 'txt)))
|
|
|
|
|
(setq f1 (list 'string-match (substring x 1) 'txt)))
|
|
|
|
|
(push f1 f))))
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(cons 'and (nreverse f))))
|
2008-09-07 05:49:09 +00:00
|
|
|
|
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(defun org-agenda-filter-effort-form (e)
|
|
|
|
|
"Return the form to compare the effort of the current line with what E says.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
E looks like \"+<2:25\"."
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(let (op)
|
|
|
|
|
(setq e (substring e 1))
|
|
|
|
|
(setq op (string-to-char e) e (substring e 1))
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(setq op (cond ((equal op ?<) '<=)
|
|
|
|
|
((equal op ?>) '>=)
|
|
|
|
|
((equal op ??) op)
|
|
|
|
|
(t '=)))
|
2008-10-20 21:01:23 +00:00
|
|
|
|
(list 'org-agenda-compare-effort (list 'quote op)
|
2011-02-28 16:43:33 +00:00
|
|
|
|
(org-duration-string-to-minutes e))))
|
2008-10-20 21:01:23 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-compare-effort (op value)
|
2008-10-21 05:53:01 +00:00
|
|
|
|
"Compare the effort of the current line with VALUE, using OP.
|
|
|
|
|
If the line does not have an effort defined, return nil."
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let ((eff (org-get-at-bol 'effort-minutes)))
|
2009-03-31 16:22:31 +00:00
|
|
|
|
(if (equal op ??)
|
|
|
|
|
(not eff)
|
|
|
|
|
(funcall op (or eff (if org-sort-agenda-noeffort-is-high 32767 0))
|
|
|
|
|
value))))
|
2008-10-20 21:01:23 +00:00
|
|
|
|
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(defun org-agenda-filter-expand-tags (filter &optional no-operator)
|
|
|
|
|
"Expand group tags in FILTER for the agenda.
|
|
|
|
|
When NO-OPERATOR is non-nil, do not add the + operator to returned tags."
|
|
|
|
|
(if org-group-tags
|
|
|
|
|
(let ((case-fold-search t) rtn)
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda (f)
|
|
|
|
|
(let (f0 dir)
|
|
|
|
|
(if (string-match "^\\([+-]\\)\\(.+\\)" f)
|
|
|
|
|
(setq dir (match-string 1 f) f0 (match-string 2 f))
|
|
|
|
|
(setq dir (if no-operator "" "+") f0 f))
|
|
|
|
|
(setq rtn (append (mapcar (lambda(f1) (concat dir f1))
|
|
|
|
|
(org-tags-expand f0 t t))
|
|
|
|
|
rtn))))
|
|
|
|
|
filter)
|
|
|
|
|
(reverse rtn))
|
|
|
|
|
filter))
|
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defun org-agenda-filter-apply (filter type)
|
2008-10-21 05:53:01 +00:00
|
|
|
|
"Set FILTER as the new agenda filter and apply it."
|
2013-03-02 10:00:30 +00:00
|
|
|
|
;; Deactivate `org-agenda-entry-text-mode' when filtering
|
|
|
|
|
(if org-agenda-entry-text-mode (org-agenda-entry-text-mode))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(let (tags cat txt)
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(setq org-agenda-filter-form
|
|
|
|
|
(org-agenda-filter-make-matcher filter type))
|
2012-04-10 20:25:53 +00:00
|
|
|
|
(if (and (eq type 'category)
|
|
|
|
|
(not (equal (substring (car filter) 0 1) "-")))
|
|
|
|
|
;; Only set `org-agenda-filtered-by-category' to t
|
|
|
|
|
;; when a unique category is used as the filter
|
|
|
|
|
(setq org-agenda-filtered-by-category t))
|
2008-10-21 05:53:01 +00:00
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(if (org-get-at-bol 'org-marker)
|
2008-10-21 05:53:01 +00:00
|
|
|
|
(progn
|
2013-03-23 17:18:06 +00:00
|
|
|
|
(setq tags ; used in eval
|
|
|
|
|
(apply 'append
|
|
|
|
|
(mapcar (lambda (f)
|
|
|
|
|
(org-agenda-filter-expand-tags (list f) t))
|
|
|
|
|
(org-get-at-bol 'tags)))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
cat (get-text-property (point) 'org-category)
|
|
|
|
|
txt (get-text-property (point) 'txt))
|
2008-10-21 05:53:01 +00:00
|
|
|
|
(if (not (eval org-agenda-filter-form))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(org-agenda-filter-hide-line type))
|
2008-10-21 05:53:01 +00:00
|
|
|
|
(beginning-of-line 2))
|
2010-09-20 18:23:03 +00:00
|
|
|
|
(beginning-of-line 2))))
|
|
|
|
|
(if (get-char-property (point) 'invisible)
|
2012-04-10 20:25:53 +00:00
|
|
|
|
(ignore-errors (org-agenda-previous-line)))))
|
2008-10-21 05:53:01 +00:00
|
|
|
|
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(defun org-agenda-filter-top-headline-apply (hl &optional negative)
|
|
|
|
|
"Filter by top headline HL."
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(let* ((pos (org-get-at-bol 'org-hd-marker))
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(tophl (and pos (org-find-top-headline pos))))
|
|
|
|
|
(if (and tophl (funcall (if negative 'identity 'not)
|
|
|
|
|
(string= hl tophl)))
|
2012-04-16 08:12:56 +00:00
|
|
|
|
(org-agenda-filter-hide-line 'category)))
|
|
|
|
|
(beginning-of-line 2)))
|
|
|
|
|
(if (get-char-property (point) 'invisible)
|
|
|
|
|
(org-agenda-previous-line))
|
2013-04-05 16:44:11 +00:00
|
|
|
|
(setq org-agenda-top-headline-filter hl
|
|
|
|
|
org-agenda-filtered-by-top-headline t))
|
2012-04-16 08:12:56 +00:00
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defun org-agenda-filter-hide-line (type)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
"Hide lines with TYPE in the agenda buffer."
|
2008-09-07 05:49:09 +00:00
|
|
|
|
(let (ov)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(setq ov (make-overlay (max (point-min) (1- (point-at-bol)))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(point-at-eol)))
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(overlay-put ov 'invisible t)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(overlay-put ov 'type type)
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays))
|
|
|
|
|
((eq type 'category) (push ov org-agenda-cat-filter-overlays))
|
|
|
|
|
((eq type 'regexp) (push ov org-agenda-re-filter-overlays)))))
|
2008-09-07 05:49:09 +00:00
|
|
|
|
|
2008-10-14 14:50:02 +00:00
|
|
|
|
(defun org-agenda-fix-tags-filter-overlays-at (&optional pos)
|
|
|
|
|
(setq pos (or pos (point)))
|
|
|
|
|
(save-excursion
|
2010-04-20 10:17:06 +00:00
|
|
|
|
(dolist (ov (overlays-at pos))
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(when (and (overlay-get ov 'invisible)
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(eq (overlay-get ov 'type) 'tag))
|
2008-10-14 14:50:02 +00:00
|
|
|
|
(goto-char pos)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(if (< (overlay-start ov) (point-at-eol))
|
|
|
|
|
(move-overlay ov (point-at-eol)
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(overlay-end ov)))))))
|
2008-10-14 14:50:02 +00:00
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defun org-agenda-filter-show-all-tag nil
|
2013-03-11 21:11:38 +00:00
|
|
|
|
"Remove tag filter overlays from the agenda buffer."
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(mapc 'delete-overlay org-agenda-tag-filter-overlays)
|
|
|
|
|
(setq org-agenda-tag-filter-overlays nil
|
|
|
|
|
org-agenda-tag-filter nil
|
|
|
|
|
org-agenda-filter-form nil)
|
|
|
|
|
(org-agenda-set-mode-name))
|
|
|
|
|
|
2013-03-16 18:40:02 +00:00
|
|
|
|
(defun org-agenda-filter-show-all-re nil
|
2013-03-11 21:11:38 +00:00
|
|
|
|
"Remove regexp filter overlays from the agenda buffer."
|
|
|
|
|
(mapc 'delete-overlay org-agenda-re-filter-overlays)
|
|
|
|
|
(setq org-agenda-re-filter-overlays nil
|
|
|
|
|
org-agenda-regexp-filter nil
|
|
|
|
|
org-agenda-filter-form nil)
|
|
|
|
|
(org-agenda-set-mode-name))
|
|
|
|
|
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(defun org-agenda-filter-show-all-cat nil
|
2013-03-11 21:11:38 +00:00
|
|
|
|
"Remove category filter overlays from the agenda buffer."
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(mapc 'delete-overlay org-agenda-cat-filter-overlays)
|
|
|
|
|
(setq org-agenda-cat-filter-overlays nil
|
|
|
|
|
org-agenda-filtered-by-category nil
|
|
|
|
|
org-agenda-category-filter nil
|
|
|
|
|
org-agenda-filter-form nil)
|
2008-10-20 07:38:23 +00:00
|
|
|
|
(org-agenda-set-mode-name))
|
2008-09-05 17:02:14 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-manipulate-query-add ()
|
|
|
|
|
"Manipulate the query by adding a search term with positive selection.
|
2010-01-21 15:15:40 +00:00
|
|
|
|
Positive selection means the term must be matched for selection of an entry."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-manipulate-query ?\[))
|
|
|
|
|
(defun org-agenda-manipulate-query-subtract ()
|
|
|
|
|
"Manipulate the query by adding a search term with negative selection.
|
2010-01-21 15:15:40 +00:00
|
|
|
|
Negative selection means term must not be matched for selection of an entry."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-manipulate-query ?\]))
|
|
|
|
|
(defun org-agenda-manipulate-query-add-re ()
|
|
|
|
|
"Manipulate the query by adding a search regexp with positive selection.
|
2010-01-21 15:15:40 +00:00
|
|
|
|
Positive selection means the regexp must match for selection of an entry."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-manipulate-query ?\{))
|
|
|
|
|
(defun org-agenda-manipulate-query-subtract-re ()
|
|
|
|
|
"Manipulate the query by adding a search regexp with negative selection.
|
2010-01-21 15:15:40 +00:00
|
|
|
|
Negative selection means regexp must not match for selection of an entry."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-manipulate-query ?\}))
|
|
|
|
|
(defun org-agenda-manipulate-query (char)
|
|
|
|
|
(cond
|
2008-04-10 12:48:59 +00:00
|
|
|
|
((memq org-agenda-type '(timeline agenda))
|
2009-08-14 18:47:39 +00:00
|
|
|
|
(let ((org-agenda-include-inactive-timestamps t))
|
|
|
|
|
(org-agenda-redo))
|
|
|
|
|
(message "Display now includes inactive timestamps as well"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq org-agenda-type 'search)
|
|
|
|
|
(org-add-to-string
|
|
|
|
|
'org-agenda-query-string
|
2010-01-05 11:13:00 +00:00
|
|
|
|
(if org-agenda-last-search-view-search-was-boolean
|
|
|
|
|
(cdr (assoc char '((?\[ . " +") (?\] . " -")
|
|
|
|
|
(?\{ . " +{}") (?\} . " -{}"))))
|
|
|
|
|
" "))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-redo-command
|
|
|
|
|
(list 'org-search-view
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(car (get-text-property (min (1- (point-max)) (point))
|
|
|
|
|
'org-last-args))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
org-agenda-query-string
|
|
|
|
|
(+ (length org-agenda-query-string)
|
|
|
|
|
(if (member char '(?\{ ?\})) 0 1))))
|
|
|
|
|
(set-register org-agenda-query-register org-agenda-query-string)
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(let ((org-agenda-overriding-arguments
|
|
|
|
|
(cdr org-agenda-redo-command)))
|
|
|
|
|
(org-agenda-redo)))
|
2008-04-10 12:48:59 +00:00
|
|
|
|
(t (error "Cannot manipulate query for %s-type agenda buffers"
|
2008-03-22 15:52:18 +00:00
|
|
|
|
org-agenda-type))))
|
|
|
|
|
|
|
|
|
|
(defun org-add-to-string (var string)
|
|
|
|
|
(set var (concat (symbol-value var) string)))
|
|
|
|
|
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(defun org-agenda-goto-date (span)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Jump to DATE in agenda."
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let* ((org-read-date-prefer-future
|
|
|
|
|
(eval org-agenda-jump-prefer-future))
|
|
|
|
|
(date (org-read-date))
|
2013-04-08 19:01:08 +00:00
|
|
|
|
(day (time-to-days (org-time-string-to-time date)))
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(org-agenda-sticky-orig org-agenda-sticky)
|
|
|
|
|
(org-agenda-buffer-tmp-name (buffer-name))
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(args (get-text-property (min (1- (point-max)) (point)) 'org-last-args))
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(0-arg (or current-prefix-arg (car args)))
|
|
|
|
|
(2-arg (nth 2 args))
|
2013-04-08 19:08:07 +00:00
|
|
|
|
(with-hour-p (nth 4 org-agenda-redo-command))
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(newcmd (list 'org-agenda-list 0-arg date
|
2013-04-08 19:14:51 +00:00
|
|
|
|
(org-agenda-span-to-ndays
|
|
|
|
|
2-arg (org-time-string-to-absolute date))
|
|
|
|
|
with-hour-p))
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(newargs (cdr newcmd))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
org-agenda-sticky)
|
|
|
|
|
(if (not (org-agenda-check-type t 'agenda))
|
2013-04-08 19:01:08 +00:00
|
|
|
|
(error "Not available in non-agenda views")
|
2012-08-30 11:23:29 +00:00
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
|
`(org-redo-cmd ,newcmd org-last-args ,newargs))
|
|
|
|
|
(org-agenda-redo)
|
2013-04-08 19:01:08 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (or (= (or (get-text-property (point) 'day) 0) day)
|
|
|
|
|
(save-excursion (move-beginning-of-line 2) (eobp))))
|
|
|
|
|
(move-beginning-of-line 2))
|
|
|
|
|
(setq org-agenda-sticky org-agenda-sticky-orig
|
|
|
|
|
org-agenda-this-buffer-is-sticky org-agenda-sticky))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-goto-today ()
|
|
|
|
|
"Go to today."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'timeline 'agenda)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(curspan (nth 2 args))
|
|
|
|
|
(tdpos (text-property-any (point-min) (point-max) 'org-today t)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cond
|
|
|
|
|
(tdpos (goto-char tdpos))
|
|
|
|
|
((eq org-agenda-type 'agenda)
|
2010-12-03 22:37:55 +00:00
|
|
|
|
(let* ((sd (org-agenda-compute-starting-span
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(org-today) (or curspan org-agenda-ndays org-agenda-span)))
|
|
|
|
|
(org-agenda-overriding-arguments args))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(setf (nth 1 org-agenda-overriding-arguments) sd)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-find-same-or-today-or-agenda)))
|
|
|
|
|
(t (error "Cannot find today")))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-find-same-or-today-or-agenda (&optional cnt)
|
|
|
|
|
(goto-char
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(or (and cnt (text-property-any (point-min) (point-max) 'org-day-cnt cnt))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(text-property-any (point-min) (point-max) 'org-today t)
|
|
|
|
|
(text-property-any (point-min) (point-max) 'org-agenda-type 'agenda)
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(and (get-text-property (min (1- (point-max)) (point)) 'org-series)
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(org-agenda-goto-block-beginning))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(point-min))))
|
|
|
|
|
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(defun org-agenda-goto-block-beginning ()
|
|
|
|
|
"Go the agenda block beginning."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (derived-mode-p 'org-agenda-mode))
|
|
|
|
|
(error "Cannot execute this command outside of org-agenda-mode buffers")
|
|
|
|
|
(let (dest)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(unless (looking-at "\\'")
|
|
|
|
|
(forward-char))
|
|
|
|
|
(let* ((prop 'org-agenda-structural-header)
|
|
|
|
|
(p (previous-single-property-change (point) prop))
|
|
|
|
|
(n (next-single-property-change (or (and (looking-at "\\`") 1)
|
|
|
|
|
(1- (point))) prop)))
|
|
|
|
|
(setq dest (cond ((eq n (point-at-eol)) (1- n)) (p (1- p))))))
|
|
|
|
|
(if (not dest)
|
|
|
|
|
(error "Cannot find the beginning of the blog")
|
|
|
|
|
(goto-char dest)
|
|
|
|
|
(move-beginning-of-line 1)))))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-later (arg)
|
2012-10-13 10:52:43 +00:00
|
|
|
|
"Go forward in time by the current span.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
With prefix ARG, go forward that many times the current span."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-check-type t 'agenda)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(span (or (nth 2 args) org-agenda-current-span))
|
|
|
|
|
(sd (or (nth 1 args) (org-get-at-bol 'day) org-starting-day))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(greg (calendar-gregorian-from-absolute sd))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(cnt (org-get-at-bol 'org-day-cnt))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
greg2)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cond
|
2012-08-27 15:52:22 +00:00
|
|
|
|
((numberp span)
|
2012-10-13 10:52:43 +00:00
|
|
|
|
(setq sd (+ (* span arg) sd)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'day)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(setq sd (+ arg sd)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'week)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(setq sd (+ (* 7 arg) sd)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'month)
|
|
|
|
|
(setq greg2 (list (+ (car greg) arg) (nth 1 greg) (nth 2 greg))
|
|
|
|
|
sd (calendar-absolute-from-gregorian greg2))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(setcar greg2 (1+ (car greg2))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'year)
|
|
|
|
|
(setq greg2 (list (car greg) (nth 1 greg) (+ arg (nth 2 greg)))
|
|
|
|
|
sd (calendar-absolute-from-gregorian greg2))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(setcar (nthcdr 2 greg2) (1+ (nth 2 greg2))))
|
|
|
|
|
(t
|
|
|
|
|
(setq sd (+ (* span arg) sd))))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(let ((org-agenda-overriding-cmd
|
|
|
|
|
;; `cmd' may have been set by `org-agenda-run-series' which
|
|
|
|
|
;; uses `org-agenda-overriding-cmd' to decide whether
|
|
|
|
|
;; overriding is allowed for `cmd'
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(get-text-property (min (1- (point-max)) (point)) 'org-series-cmd))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(org-agenda-overriding-arguments
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(list (car args) sd span)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-find-same-or-today-or-agenda cnt))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-earlier (arg)
|
|
|
|
|
"Go backward in time by the current span.
|
|
|
|
|
With prefix ARG, go backward that many times the current span."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-later (- arg)))
|
|
|
|
|
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(defun org-agenda-view-mode-dispatch ()
|
|
|
|
|
"Call one of the view mode commands."
|
|
|
|
|
(interactive)
|
2012-05-05 07:57:30 +00:00
|
|
|
|
(message "View: [d]ay [w]eek [m]onth [y]ear [SPC]reset [q]uit/abort
|
|
|
|
|
time[G]rid [[]inactive [f]ollow [l]og [L]og-all [c]lockcheck
|
|
|
|
|
[a]rch-trees [A]rch-files clock[R]eport include[D]iary [E]ntryText")
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(let ((a (read-char-exclusive)))
|
|
|
|
|
(case a
|
2011-01-18 15:00:39 +00:00
|
|
|
|
(?\ (call-interactively 'org-agenda-reset-view))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(?d (call-interactively 'org-agenda-day-view))
|
|
|
|
|
(?w (call-interactively 'org-agenda-week-view))
|
|
|
|
|
(?m (call-interactively 'org-agenda-month-view))
|
|
|
|
|
(?y (call-interactively 'org-agenda-year-view))
|
|
|
|
|
(?l (call-interactively 'org-agenda-log-mode))
|
2010-01-07 13:57:25 +00:00
|
|
|
|
(?L (org-agenda-log-mode '(4)))
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(?c (org-agenda-log-mode 'clockcheck))
|
2009-08-27 14:08:55 +00:00
|
|
|
|
((?F ?f) (call-interactively 'org-agenda-follow-mode))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
(?a (call-interactively 'org-agenda-archives-mode))
|
2009-06-26 15:22:40 +00:00
|
|
|
|
(?A (org-agenda-archives-mode 'files))
|
2009-08-27 14:08:55 +00:00
|
|
|
|
((?R ?r) (call-interactively 'org-agenda-clockreport-mode))
|
|
|
|
|
((?E ?e) (call-interactively 'org-agenda-entry-text-mode))
|
2009-06-26 15:22:40 +00:00
|
|
|
|
(?G (call-interactively 'org-agenda-toggle-time-grid))
|
|
|
|
|
(?D (call-interactively 'org-agenda-toggle-diary))
|
2010-03-15 01:00:59 +00:00
|
|
|
|
(?\! (call-interactively 'org-agenda-toggle-deadlines))
|
2009-08-18 06:17:15 +00:00
|
|
|
|
(?\[ (let ((org-agenda-include-inactive-timestamps t))
|
|
|
|
|
(org-agenda-check-type t 'timeline 'agenda)
|
|
|
|
|
(org-agenda-redo))
|
|
|
|
|
(message "Display now includes inactive timestamps as well"))
|
2009-06-26 15:22:40 +00:00
|
|
|
|
(?q (message "Abort"))
|
|
|
|
|
(otherwise (error "Invalid key" )))))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
|
2011-01-18 15:00:39 +00:00
|
|
|
|
(defun org-agenda-reset-view ()
|
|
|
|
|
"Switch to default view for agenda."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-change-time-span (or org-agenda-ndays org-agenda-span)))
|
2013-03-08 11:23:10 +00:00
|
|
|
|
(defun org-agenda-day-view (&optional day-of-month)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Switch to daily view for agenda.
|
2013-03-08 11:23:10 +00:00
|
|
|
|
With argument DAY-OF-MONTH, switch to that day of the month."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
2013-03-08 11:23:10 +00:00
|
|
|
|
(org-agenda-change-time-span 'day day-of-month))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-week-view (&optional iso-week)
|
|
|
|
|
"Switch to daily view for agenda.
|
|
|
|
|
With argument ISO-WEEK, switch to the corresponding ISO week.
|
|
|
|
|
If ISO-WEEK has more then 2 digits, only the last two encode the
|
|
|
|
|
week. Any digits before this encode a year. So 200712 means
|
|
|
|
|
week 12 of year 2007. Years in the range 1938-2037 can also be
|
|
|
|
|
written as 2-digit years."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-change-time-span 'week iso-week))
|
|
|
|
|
(defun org-agenda-month-view (&optional month)
|
2008-06-16 14:26:30 +00:00
|
|
|
|
"Switch to monthly view for agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
With argument MONTH, switch to that month."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-change-time-span 'month month))
|
|
|
|
|
(defun org-agenda-year-view (&optional year)
|
2008-06-16 14:26:30 +00:00
|
|
|
|
"Switch to yearly view for agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
With argument YEAR, switch to that year.
|
|
|
|
|
If MONTH has more then 2 digits, only the last two encode the
|
|
|
|
|
month. Any digits before this encode a year. So 200712 means
|
|
|
|
|
December year 2007. Years in the range 1938-2037 can also be
|
|
|
|
|
written as 2-digit years."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(when year
|
|
|
|
|
(setq year (org-small-year-to-year year)))
|
|
|
|
|
(if (y-or-n-p "Are you sure you want to compute the agenda for an entire year? ")
|
|
|
|
|
(org-agenda-change-time-span 'year year)
|
|
|
|
|
(error "Abort")))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-change-time-span (span &optional n)
|
|
|
|
|
"Change the agenda view to SPAN.
|
|
|
|
|
SPAN may be `day', `week', `month', `year'."
|
|
|
|
|
(org-agenda-check-type t 'agenda)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args))
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(curspan (nth 2 args)))
|
|
|
|
|
(if (and (not n) (equal curspan span))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(error "Viewing span is already \"%s\"" span))
|
|
|
|
|
(let* ((sd (or (org-get-at-bol 'day)
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(nth 1 args)
|
2012-08-27 15:52:22 +00:00
|
|
|
|
org-starting-day))
|
|
|
|
|
(sd (org-agenda-compute-starting-span sd span n))
|
|
|
|
|
(org-agenda-overriding-cmd
|
2012-10-23 16:41:33 +00:00
|
|
|
|
(get-text-property (min (1- (point-max)) (point)) 'org-series-cmd))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(org-agenda-overriding-arguments
|
org-agenda.el: Rewrite of the redo/change/append commands
* org-agenda.el (org-agenda-local-vars): Remove
̀org-agenda-last-arguments' from the list of local variables.
(org-agenda-mode-map): `g' does the same than `r' in buffers
with only one agenda view, but its behavior differs when there
are several views. In manually appended agendas (with `A'),
`g' displays only the agenda under the point. With multiple
agenda blocks, `g' reinitializes the view by discarding any
temporary changes (e.g. with ̀f' or `w'), while ̀r' keeps those
temporary changes for the agenda view under the point.
(org-agenda-run-series, org-agenda-redo): Implement the above
changes.
(org-agenda-mark-header-line): Don't set useless properties.
(org-agenda-list, org-todo-only, org-search-view)
(org-todo-list, org-tags-view, org-agenda-list-stuck-projects)
(org-agenda-manipulate-query, org-agenda-goto-today)
(org-agenda-later, org-agenda-change-time-span): Use text
properties for storing the last command and the last arguments
for each agenda block.
(org-unhighlight-once): Delete.
2012-08-29 17:18:05 +00:00
|
|
|
|
(list (car args) sd span)))
|
2012-08-27 15:52:22 +00:00
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-find-same-or-today-or-agenda))
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(message "Switched to %s view" span)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(defun org-agenda-compute-starting-span (sd span &optional n)
|
|
|
|
|
"Compute starting date for agenda.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
SPAN may be `day', `week', `month', `year'. The return value
|
|
|
|
|
is a cons cell with the starting date and the number of days,
|
|
|
|
|
so that the date SD will be in that range."
|
|
|
|
|
(let* ((greg (calendar-gregorian-from-absolute sd))
|
|
|
|
|
(dg (nth 1 greg))
|
|
|
|
|
(mg (car greg))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(yg (nth 2 greg)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq span 'day)
|
|
|
|
|
(when n
|
|
|
|
|
(setq sd (+ (calendar-absolute-from-gregorian
|
|
|
|
|
(list mg 1 yg))
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
n -1))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'week)
|
|
|
|
|
(let* ((nt (calendar-day-of-week
|
|
|
|
|
(calendar-gregorian-from-absolute sd)))
|
|
|
|
|
(d (if org-agenda-start-on-weekday
|
|
|
|
|
(- nt org-agenda-start-on-weekday)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
0))
|
|
|
|
|
y1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq sd (- sd (+ (if (< d 0) 7 0) d)))
|
|
|
|
|
(when n
|
|
|
|
|
(require 'cal-iso)
|
|
|
|
|
(when (> n 99)
|
|
|
|
|
(setq y1 (org-small-year-to-year (/ n 100))
|
|
|
|
|
n (mod n 100)))
|
|
|
|
|
(setq sd
|
|
|
|
|
(calendar-absolute-from-iso
|
|
|
|
|
(list n 1
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(or y1 (nth 2 (calendar-iso-from-absolute sd)))))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'month)
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(let (y1)
|
|
|
|
|
(when (and n (> n 99))
|
|
|
|
|
(setq y1 (org-small-year-to-year (/ n 100))
|
|
|
|
|
n (mod n 100)))
|
|
|
|
|
(setq sd (calendar-absolute-from-gregorian
|
|
|
|
|
(list (or n mg) 1 (or y1 yg))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
((eq span 'year)
|
|
|
|
|
(setq sd (calendar-absolute-from-gregorian
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(list 1 1 (or n yg))))))
|
|
|
|
|
sd))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-next-date-line (&optional arg)
|
|
|
|
|
"Jump to the next line indicating a date in agenda buffer."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
|
|
|
|
(beginning-of-line 1)
|
2008-04-03 13:27:33 +00:00
|
|
|
|
;; This does not work if user makes date format that starts with a blank
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (looking-at "^\\S-") (forward-char 1))
|
|
|
|
|
(if (not (re-search-forward "^\\S-" nil t arg))
|
|
|
|
|
(progn
|
|
|
|
|
(backward-char 1)
|
|
|
|
|
(error "No next date after this line in this buffer")))
|
|
|
|
|
(goto-char (match-beginning 0)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-previous-date-line (&optional arg)
|
|
|
|
|
"Jump to the previous line indicating a date in agenda buffer."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(if (not (re-search-backward "^\\S-" nil t arg))
|
|
|
|
|
(error "No previous date before this line in this buffer")))
|
|
|
|
|
|
|
|
|
|
;; Initialize the highlight
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(defvar org-hl (make-overlay 1 1))
|
|
|
|
|
(overlay-put org-hl 'face 'highlight)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-highlight (begin end &optional buffer)
|
|
|
|
|
"Highlight a region with overlay."
|
2010-04-21 07:03:30 +00:00
|
|
|
|
(move-overlay org-hl begin end (or buffer (current-buffer))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-unhighlight ()
|
|
|
|
|
"Detach overlay INDEX."
|
2010-04-21 07:03:30 +00:00
|
|
|
|
(org-detach-overlay org-hl))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-unhighlight-once ()
|
2008-04-03 13:27:33 +00:00
|
|
|
|
"Remove the highlight from its position, and this function from the hook."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(remove-hook 'pre-command-hook 'org-unhighlight-once)
|
|
|
|
|
(org-unhighlight))
|
|
|
|
|
|
2012-09-29 09:10:03 +00:00
|
|
|
|
(defvar org-agenda-pre-follow-window-conf nil)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-follow-mode ()
|
|
|
|
|
"Toggle follow mode in an agenda buffer."
|
|
|
|
|
(interactive)
|
2012-09-29 09:10:03 +00:00
|
|
|
|
(unless org-agenda-follow-mode
|
|
|
|
|
(setq org-agenda-pre-follow-window-conf
|
|
|
|
|
(current-window-configuration)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq org-agenda-follow-mode (not org-agenda-follow-mode))
|
2012-09-29 09:10:03 +00:00
|
|
|
|
(unless org-agenda-follow-mode
|
|
|
|
|
(set-window-configuration org-agenda-pre-follow-window-conf))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-set-mode-name)
|
2011-09-24 19:21:53 +00:00
|
|
|
|
(org-agenda-do-context-action)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Follow mode is %s"
|
|
|
|
|
(if org-agenda-follow-mode "on" "off")))
|
|
|
|
|
|
2009-08-27 07:56:46 +00:00
|
|
|
|
(defun org-agenda-entry-text-mode (&optional arg)
|
|
|
|
|
"Toggle entry text mode in an agenda buffer."
|
|
|
|
|
(interactive "P")
|
2013-03-02 10:00:30 +00:00
|
|
|
|
(if (or org-agenda-tag-filter
|
|
|
|
|
org-agenda-category-filter
|
2013-04-13 10:28:24 +00:00
|
|
|
|
org-agenda-regexp-filter
|
2013-04-05 16:44:11 +00:00
|
|
|
|
org-agenda-top-headline-filter)
|
2013-03-02 10:00:30 +00:00
|
|
|
|
(user-error "Can't show entry text in filtered views")
|
|
|
|
|
(setq org-agenda-entry-text-mode (or (integerp arg)
|
|
|
|
|
(not org-agenda-entry-text-mode)))
|
|
|
|
|
(org-agenda-entry-text-hide)
|
|
|
|
|
(and org-agenda-entry-text-mode
|
|
|
|
|
(let ((org-agenda-entry-text-maxlines
|
|
|
|
|
(if (integerp arg) arg org-agenda-entry-text-maxlines)))
|
|
|
|
|
(org-agenda-entry-text-show)))
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(message "Entry text mode is %s%s"
|
|
|
|
|
(if org-agenda-entry-text-mode "on" "off")
|
|
|
|
|
(if (not org-agenda-entry-text-mode) ""
|
|
|
|
|
(format " (maximum number of lines is %d)"
|
|
|
|
|
(if (integerp arg) arg org-agenda-entry-text-maxlines))))))
|
2009-08-27 07:56:46 +00:00
|
|
|
|
|
2010-11-01 12:30:44 +00:00
|
|
|
|
(defun org-agenda-clockreport-mode (&optional with-filter)
|
|
|
|
|
"Toggle clocktable mode in an agenda buffer.
|
|
|
|
|
With prefix arg WITH-FILTER, make the clocktable respect the current
|
|
|
|
|
agenda filter."
|
|
|
|
|
(interactive "P")
|
2008-04-04 21:44:48 +00:00
|
|
|
|
(org-agenda-check-type t 'agenda)
|
2010-11-01 12:30:44 +00:00
|
|
|
|
(if with-filter
|
|
|
|
|
(setq org-agenda-clockreport-mode 'with-filter)
|
|
|
|
|
(setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)))
|
2008-04-04 21:44:48 +00:00
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(message "Clocktable mode is %s"
|
|
|
|
|
(if org-agenda-clockreport-mode "on" "off")))
|
|
|
|
|
|
2008-11-09 07:17:33 +00:00
|
|
|
|
(defun org-agenda-log-mode (&optional special)
|
|
|
|
|
"Toggle log mode in an agenda buffer.
|
|
|
|
|
With argument SPECIAL, show all possible log items, not only the ones
|
|
|
|
|
configured in `org-agenda-log-mode-items'.
|
|
|
|
|
With a double `C-u' prefix arg, show *only* log items, nothing else."
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(interactive "P")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
2008-11-05 16:26:52 +00:00
|
|
|
|
(setq org-agenda-show-log
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(cond
|
|
|
|
|
((equal special '(16)) 'only)
|
|
|
|
|
((eq special 'clockcheck)
|
|
|
|
|
(if (eq org-agenda-show-log 'clockcheck)
|
|
|
|
|
nil 'clockcheck))
|
|
|
|
|
(special '(closed clock state))
|
|
|
|
|
(t (not org-agenda-show-log))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(message "Log mode is %s"
|
|
|
|
|
(if org-agenda-show-log "on" "off")))
|
|
|
|
|
|
2008-06-19 22:20:12 +00:00
|
|
|
|
(defun org-agenda-archives-mode (&optional with-files)
|
2009-06-26 05:04:22 +00:00
|
|
|
|
"Toggle inclusion of items in trees marked with :ARCHIVE:.
|
|
|
|
|
When called with a prefix argument, include all archive files as well."
|
2008-06-19 22:20:12 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(setq org-agenda-archives-mode
|
|
|
|
|
(if with-files t (if org-agenda-archives-mode nil 'trees)))
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(message
|
|
|
|
|
"%s"
|
|
|
|
|
(cond
|
|
|
|
|
((eq org-agenda-archives-mode nil)
|
|
|
|
|
"No archives are included")
|
|
|
|
|
((eq org-agenda-archives-mode 'trees)
|
|
|
|
|
(format "Trees with :%s: tag are included" org-archive-tag))
|
|
|
|
|
((eq org-agenda-archives-mode t)
|
|
|
|
|
(format "Trees with :%s: tag and all active archive files are included"
|
|
|
|
|
org-archive-tag)))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-toggle-diary ()
|
|
|
|
|
"Toggle diary inclusion in an agenda buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'agenda)
|
|
|
|
|
(setq org-agenda-include-diary (not org-agenda-include-diary))
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(message "Diary inclusion turned %s"
|
|
|
|
|
(if org-agenda-include-diary "on" "off")))
|
|
|
|
|
|
2010-03-15 01:00:59 +00:00
|
|
|
|
(defun org-agenda-toggle-deadlines ()
|
2010-12-03 15:40:57 +00:00
|
|
|
|
"Toggle inclusion of entries with a deadline in an agenda buffer."
|
2010-03-15 01:00:59 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'agenda)
|
|
|
|
|
(setq org-agenda-include-deadlines (not org-agenda-include-deadlines))
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(message "Deadlines inclusion turned %s"
|
|
|
|
|
(if org-agenda-include-deadlines "on" "off")))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-toggle-time-grid ()
|
|
|
|
|
"Toggle time grid in an agenda buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'agenda)
|
|
|
|
|
(setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
|
|
|
|
|
(org-agenda-redo)
|
|
|
|
|
(org-agenda-set-mode-name)
|
|
|
|
|
(message "Time-grid turned %s"
|
|
|
|
|
(if org-agenda-use-time-grid "on" "off")))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-set-mode-name ()
|
|
|
|
|
"Set the mode name to indicate all the small mode settings."
|
|
|
|
|
(setq mode-name
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(list "Org-Agenda"
|
|
|
|
|
(if (get 'org-agenda-files 'org-restrict) " []" "")
|
|
|
|
|
" "
|
|
|
|
|
'(:eval (org-agenda-span-name org-agenda-current-span))
|
|
|
|
|
(if org-agenda-follow-mode " Follow" "")
|
|
|
|
|
(if org-agenda-entry-text-mode " ETxt" "")
|
|
|
|
|
(if org-agenda-include-diary " Diary" "")
|
|
|
|
|
(if org-agenda-include-deadlines " Ddl" "")
|
|
|
|
|
(if org-agenda-use-time-grid " Grid" "")
|
|
|
|
|
(if (and (boundp 'org-habit-show-habits)
|
|
|
|
|
org-habit-show-habits) " Habit" "")
|
2011-04-19 22:13:31 +00:00
|
|
|
|
(cond
|
|
|
|
|
((consp org-agenda-show-log) " LogAll")
|
|
|
|
|
((eq org-agenda-show-log 'clockcheck) " ClkCk")
|
|
|
|
|
(org-agenda-show-log " Log")
|
|
|
|
|
(t ""))
|
2013-03-11 21:11:38 +00:00
|
|
|
|
(if (or org-agenda-category-filter
|
|
|
|
|
(get 'org-agenda-category-filter :preset-filter))
|
2011-12-31 16:10:44 +00:00
|
|
|
|
'(:eval (org-propertize
|
|
|
|
|
(concat " <"
|
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(append
|
|
|
|
|
(get 'org-agenda-category-filter :preset-filter)
|
|
|
|
|
org-agenda-category-filter)
|
|
|
|
|
"")
|
|
|
|
|
">")
|
|
|
|
|
'face 'org-agenda-filter-category
|
2013-03-11 21:11:38 +00:00
|
|
|
|
'help-echo "Category used in filtering")) "")
|
|
|
|
|
(if (or org-agenda-tag-filter
|
|
|
|
|
(get 'org-agenda-tag-filter :preset-filter))
|
2011-10-29 11:23:20 +00:00
|
|
|
|
'(:eval (org-propertize
|
2011-10-27 21:08:04 +00:00
|
|
|
|
(concat " {"
|
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(append
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(get 'org-agenda-tag-filter :preset-filter)
|
|
|
|
|
org-agenda-tag-filter)
|
2011-10-27 21:08:04 +00:00
|
|
|
|
"")
|
|
|
|
|
"}")
|
|
|
|
|
'face 'org-agenda-filter-tags
|
2013-03-11 21:11:38 +00:00
|
|
|
|
'help-echo "Tags used in filtering")) "")
|
|
|
|
|
(if (or org-agenda-regexp-filter
|
|
|
|
|
(get 'org-agenda-regexp-filter :preset-filter))
|
|
|
|
|
'(:eval (org-propertize
|
|
|
|
|
(concat " ["
|
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(append
|
|
|
|
|
(get 'org-agenda-regexp-filter :preset-filter)
|
|
|
|
|
org-agenda-regexp-filter)
|
|
|
|
|
"")
|
|
|
|
|
"]")
|
|
|
|
|
'face 'org-agenda-filter-regexp
|
|
|
|
|
'help-echo "Regexp used in filtering")) "")
|
org-agenda: rework ndays and span handling
* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.
* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.
* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.
This patch is pretty huge, so I'll give a bit of context about it.
I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.
On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)
So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
I think the name is better choosen. You can set it to a symbol instead of
only a numeric value. That means you can set it to 'month and it will show
you the number of days of the current month in your agenda. Better than
30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
That means if you press 'f', it will shows you really the next
org-agenda-current-span ndays, and not something based on "I think you
want a weekly view".
2010-12-03 16:50:50 +00:00
|
|
|
|
(if org-agenda-archives-mode
|
|
|
|
|
(if (eq org-agenda-archives-mode t)
|
|
|
|
|
" Archives"
|
|
|
|
|
(format " :%s:" org-archive-tag))
|
|
|
|
|
"")
|
|
|
|
|
(if org-agenda-clockreport-mode
|
|
|
|
|
(if (eq org-agenda-clockreport-mode 'with-filter)
|
|
|
|
|
" Clock{}" " Clock")
|
|
|
|
|
"")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(force-mode-line-update))
|
|
|
|
|
|
2013-01-13 08:19:24 +00:00
|
|
|
|
(define-obsolete-function-alias
|
2012-09-27 22:12:53 +00:00
|
|
|
|
'org-agenda-post-command-hook 'org-agenda-update-agenda-type "24.3")
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-update-agenda-type ()
|
|
|
|
|
"Update the agenda type after each command."
|
2008-05-08 13:02:25 +00:00
|
|
|
|
(setq org-agenda-type
|
|
|
|
|
(or (get-text-property (point) 'org-agenda-type)
|
2012-09-27 22:12:53 +00:00
|
|
|
|
(get-text-property (max (point-min) (1- (point))) 'org-agenda-type))))
|
2009-10-20 17:56:11 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-next-line ()
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Move cursor to the next line, and show if follow mode is active."
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(call-interactively 'next-line)
|
2009-11-13 13:48:00 +00:00
|
|
|
|
(org-agenda-do-context-action))
|
|
|
|
|
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(defun org-agenda-previous-line ()
|
|
|
|
|
"Move cursor to the previous line, and show if follow-mode is active."
|
|
|
|
|
(interactive)
|
|
|
|
|
(call-interactively 'previous-line)
|
2009-11-13 13:48:00 +00:00
|
|
|
|
(org-agenda-do-context-action))
|
|
|
|
|
|
2012-08-07 21:11:26 +00:00
|
|
|
|
(defun org-agenda-next-item (n)
|
|
|
|
|
"Move cursor to next agenda item."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(let ((col (current-column)))
|
|
|
|
|
(dotimes (c n)
|
|
|
|
|
(when (next-single-property-change (point-at-eol) 'org-marker)
|
|
|
|
|
(move-end-of-line 1)
|
|
|
|
|
(goto-char (next-single-property-change (point) 'org-marker))))
|
|
|
|
|
(org-move-to-column col))
|
|
|
|
|
(org-agenda-do-context-action))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-previous-item (n)
|
|
|
|
|
"Move cursor to next agenda item."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(dotimes (c n)
|
|
|
|
|
(let ((col (current-column))
|
|
|
|
|
(goto (save-excursion
|
|
|
|
|
(move-end-of-line 0)
|
|
|
|
|
(previous-single-property-change (point) 'org-marker))))
|
|
|
|
|
(if goto (goto-char goto))
|
|
|
|
|
(org-move-to-column col)))
|
|
|
|
|
(org-agenda-do-context-action))
|
|
|
|
|
|
2009-11-13 13:48:00 +00:00
|
|
|
|
(defun org-agenda-do-context-action ()
|
2010-07-15 20:26:51 +00:00
|
|
|
|
"Show outline path and, maybe, follow mode window."
|
2009-11-13 13:48:00 +00:00
|
|
|
|
(let ((m (org-get-at-bol 'org-marker)))
|
2011-10-21 00:56:31 +00:00
|
|
|
|
(when (and (markerp m) (marker-buffer m))
|
|
|
|
|
(and org-agenda-follow-mode
|
|
|
|
|
(if org-agenda-follow-indirect
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(org-agenda-tree-to-indirect-buffer nil)
|
2011-10-21 00:56:31 +00:00
|
|
|
|
(org-agenda-show)))
|
|
|
|
|
(and org-agenda-show-outline-path
|
|
|
|
|
(org-with-point-at m (org-display-outline-path t))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-show-tags ()
|
|
|
|
|
"Show the tags applicable to the current item."
|
|
|
|
|
(interactive)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((tags (org-get-at-bol 'tags)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if tags
|
|
|
|
|
(message "Tags are :%s:"
|
|
|
|
|
(org-no-properties (mapconcat 'identity tags ":")))
|
|
|
|
|
(message "No tags associated with this line"))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-goto (&optional highlight)
|
|
|
|
|
"Go to the Org-mode file which contains the item at point."
|
|
|
|
|
(interactive)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker)))
|
|
|
|
|
(switch-to-buffer-other-window buffer)
|
|
|
|
|
(widen)
|
2010-04-27 10:00:03 +00:00
|
|
|
|
(push-mark)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(goto-char pos)
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(when (derived-mode-p 'org-mode)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
2011-01-01 18:33:35 +00:00
|
|
|
|
(org-flag-heading nil)))) ; show the next heading
|
|
|
|
|
(when (outline-invisible-p)
|
|
|
|
|
(show-entry)) ; display invisible text
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(recenter (/ (window-height) 2))
|
|
|
|
|
(run-hooks 'org-agenda-after-show-hook)
|
|
|
|
|
(and highlight (org-highlight (point-at-bol) (point-at-eol)))))
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-after-show-hook nil
|
|
|
|
|
"Normal hook run after an item has been shown from the agenda.
|
|
|
|
|
Point is in the buffer where the item originated.")
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-kill ()
|
|
|
|
|
"Kill the entry or subtree belonging to the current agenda entry."
|
|
|
|
|
(interactive)
|
|
|
|
|
(or (eq major-mode 'org-agenda-mode) (error "Not in agenda"))
|
2012-08-26 12:53:59 +00:00
|
|
|
|
(let* ((bufname-orig (buffer-name))
|
|
|
|
|
(marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(type (org-get-at-bol 'type))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
dbeg dend (n 0) conf)
|
|
|
|
|
(org-with-remote-undo buffer
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
|
|
|
|
|
(setq dbeg (progn (org-back-to-heading t) (point))
|
|
|
|
|
dend (org-end-of-subtree t t))
|
|
|
|
|
(setq dbeg (point-at-bol)
|
|
|
|
|
dend (min (point-max) (1+ (point-at-eol)))))
|
|
|
|
|
(goto-char dbeg)
|
|
|
|
|
(while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
|
|
|
|
|
(setq conf (or (eq t org-agenda-confirm-kill)
|
|
|
|
|
(and (numberp org-agenda-confirm-kill)
|
|
|
|
|
(> n org-agenda-confirm-kill))))
|
|
|
|
|
(and conf
|
|
|
|
|
(not (y-or-n-p
|
|
|
|
|
(format "Delete entry with %d lines in buffer \"%s\"? "
|
|
|
|
|
n (buffer-name buffer))))
|
|
|
|
|
(error "Abort"))
|
2012-08-26 12:53:59 +00:00
|
|
|
|
(let ((org-agenda-buffer-name bufname-orig))
|
|
|
|
|
(org-remove-subtree-entries-from-agenda buffer dbeg dend))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(with-current-buffer buffer (delete-region dbeg dend))
|
|
|
|
|
(message "Agenda item and source killed"))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar org-archive-default-command) ; defined in org-archive.el
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(defun org-agenda-archive-default ()
|
|
|
|
|
"Archive the entry or subtree belonging to the current agenda entry."
|
|
|
|
|
(interactive)
|
|
|
|
|
(require 'org-archive)
|
|
|
|
|
(org-agenda-archive-with org-archive-default-command))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-archive-default-with-confirmation ()
|
|
|
|
|
"Archive the entry or subtree belonging to the current agenda entry."
|
|
|
|
|
(interactive)
|
|
|
|
|
(require 'org-archive)
|
|
|
|
|
(org-agenda-archive-with org-archive-default-command 'confirm))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-archive ()
|
2008-04-08 10:29:28 +00:00
|
|
|
|
"Archive the entry or subtree belonging to the current agenda entry."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(org-agenda-archive-with 'org-archive-subtree))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-04-10 06:27:56 +00:00
|
|
|
|
(defun org-agenda-archive-to-archive-sibling ()
|
2009-10-30 14:53:00 +00:00
|
|
|
|
"Move the entry to the archive sibling."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-archive-with 'org-archive-to-archive-sibling))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-archive-with (cmd &optional confirm)
|
2008-04-10 06:27:56 +00:00
|
|
|
|
"Move the entry to the archive sibling."
|
2008-04-08 10:29:28 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(or (eq major-mode 'org-agenda-mode) (error "Not in agenda"))
|
2012-08-26 12:53:59 +00:00
|
|
|
|
(let* ((bufname-orig (buffer-name))
|
|
|
|
|
(marker (or (org-get-at-bol 'org-marker)
|
2008-04-08 10:29:28 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker)))
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(if (and confirm
|
|
|
|
|
(not (y-or-n-p "Archive this subtree or entry? ")))
|
|
|
|
|
(error "Abort")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
2012-08-26 12:53:59 +00:00
|
|
|
|
(let ((org-agenda-buffer-name bufname-orig))
|
|
|
|
|
(org-remove-subtree-entries-from-agenda))
|
2009-10-30 14:53:00 +00:00
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(funcall cmd)))
|
2008-04-08 10:29:28 +00:00
|
|
|
|
(error "Archiving works only in Org-mode files"))))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-remove-subtree-entries-from-agenda (&optional buf beg end)
|
|
|
|
|
"Remove all lines in the agenda that correspond to a given subtree.
|
|
|
|
|
The subtree is the one in buffer BUF, starting at BEG and ending at END.
|
|
|
|
|
If this information is not given, the function uses the tree at point."
|
|
|
|
|
(let ((buf (or buf (current-buffer))) m p)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(unless (and beg end)
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(org-end-of-subtree t)
|
|
|
|
|
(setq end (point)))
|
|
|
|
|
(set-buffer (get-buffer org-agenda-buffer-name))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(while (not (bobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(when (and (setq m (org-get-at-bol 'org-marker))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(equal buf (marker-buffer m))
|
|
|
|
|
(setq p (marker-position m))
|
|
|
|
|
(>= p beg)
|
2009-05-23 21:03:00 +00:00
|
|
|
|
(< p end))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(delete-region (point-at-bol) (1+ (point-at-eol)))))
|
|
|
|
|
(beginning-of-line 0))))))
|
|
|
|
|
|
2010-04-25 21:52:51 +00:00
|
|
|
|
(defun org-agenda-refile (&optional goto rfloc no-update)
|
2013-03-08 09:33:19 +00:00
|
|
|
|
"Refile the item at point.
|
|
|
|
|
|
|
|
|
|
When GOTO is 0 or '(64), clear the refile cache.
|
|
|
|
|
When GOTO is '(16), go to the location of the last refiled item.
|
|
|
|
|
RFLOC can be a refile location obtained in a different way.
|
|
|
|
|
When NO-UPDATE is non-nil, don't redo the agenda buffer."
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(interactive "P")
|
2013-03-08 09:33:19 +00:00
|
|
|
|
(cond
|
|
|
|
|
((member goto '(0 (64)))
|
|
|
|
|
(org-refile-cache-clear))
|
|
|
|
|
((equal goto '(16))
|
|
|
|
|
(org-refile-goto-last-stored))
|
|
|
|
|
(t
|
2012-08-26 09:20:02 +00:00
|
|
|
|
(let* ((buffer-orig (buffer-name))
|
|
|
|
|
(marker (or (org-get-at-bol 'org-hd-marker)
|
2009-08-20 19:36:00 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
2010-03-29 12:22:46 +00:00
|
|
|
|
(pos (marker-position marker))
|
|
|
|
|
(rfloc (or rfloc
|
|
|
|
|
(org-refile-get-location
|
2011-03-02 18:46:37 +00:00
|
|
|
|
(if goto "Goto" "Refile to") buffer
|
2010-03-29 12:22:46 +00:00
|
|
|
|
org-refile-allow-creating-parent-nodes))))
|
2009-08-26 14:29:24 +00:00
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char marker)
|
2012-08-26 09:20:02 +00:00
|
|
|
|
(let ((org-agenda-buffer-name buffer-orig))
|
|
|
|
|
(org-remove-subtree-entries-from-agenda))
|
2010-04-25 21:52:51 +00:00
|
|
|
|
(org-refile goto buffer rfloc)))))
|
2013-03-08 09:33:19 +00:00
|
|
|
|
(unless no-update (org-agenda-redo)))))
|
2009-06-22 19:54:42 +00:00
|
|
|
|
|
2009-08-25 20:45:58 +00:00
|
|
|
|
(defun org-agenda-open-link (&optional arg)
|
2012-12-29 08:20:35 +00:00
|
|
|
|
"Open the link(s) in the current entry, if any.
|
|
|
|
|
This looks for a link in the displayed line in the agenda.
|
|
|
|
|
It also looks at the text of the entry itself."
|
2009-08-25 20:45:58 +00:00
|
|
|
|
(interactive "P")
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-hd-marker)
|
|
|
|
|
(org-get-at-bol 'org-marker)))
|
2009-09-03 22:20:14 +00:00
|
|
|
|
(buffer (and marker (marker-buffer marker)))
|
2013-01-16 17:36:29 +00:00
|
|
|
|
(prefix (buffer-substring (point-at-bol) (point-at-eol)))
|
2012-12-29 08:20:35 +00:00
|
|
|
|
(lkall (org-offer-links-in-entry buffer marker arg prefix))
|
2013-01-16 17:36:29 +00:00
|
|
|
|
(lk0 (car lkall))
|
|
|
|
|
(lk (if (stringp lk0) (list lk0) lk0))
|
2012-12-29 08:20:35 +00:00
|
|
|
|
(lkend (cdr lkall))
|
|
|
|
|
trg)
|
2009-11-02 07:07:28 +00:00
|
|
|
|
(cond
|
2013-01-16 17:36:29 +00:00
|
|
|
|
((and buffer lk)
|
|
|
|
|
(mapcar (lambda(l)
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(setq trg (and (string-match org-bracket-link-regexp l)
|
|
|
|
|
(match-string 1 l)))
|
|
|
|
|
(if (or (not trg) (string-match org-any-link-re trg))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char marker)
|
|
|
|
|
(when (search-forward l nil lkend)
|
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
|
(org-open-at-point))))
|
|
|
|
|
;; This is an internal link, widen the buffer
|
|
|
|
|
(switch-to-buffer-other-window buffer)
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char marker)
|
|
|
|
|
(when (search-forward l nil lkend)
|
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
|
(org-open-at-point)))))
|
|
|
|
|
lk))
|
2009-11-02 07:07:28 +00:00
|
|
|
|
((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)"))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)"))))
|
|
|
|
|
(org-open-link-from-string (match-string 1)))
|
2012-12-31 08:11:55 +00:00
|
|
|
|
(t (message "No link to open here")))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-copy-local-variable (var)
|
|
|
|
|
"Get a variable from a referenced buffer and install it here."
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let ((m (org-get-at-bol 'org-marker)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(when (and m (buffer-live-p (marker-buffer m)))
|
|
|
|
|
(org-set-local var (with-current-buffer (marker-buffer m)
|
|
|
|
|
(symbol-value var))))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-switch-to (&optional delete-other-windows)
|
|
|
|
|
"Go to the Org-mode file which contains the item at point."
|
|
|
|
|
(interactive)
|
2009-11-02 07:07:28 +00:00
|
|
|
|
(if (and org-return-follows-link
|
|
|
|
|
(not (org-get-at-bol 'org-marker))
|
|
|
|
|
(org-in-regexp org-bracket-link-regexp))
|
|
|
|
|
(org-open-link-from-string (match-string 0))
|
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker)))
|
2011-07-18 17:25:10 +00:00
|
|
|
|
(org-pop-to-buffer-same-window buffer)
|
2009-11-02 07:07:28 +00:00
|
|
|
|
(and delete-other-windows (delete-other-windows))
|
2012-01-19 15:21:50 +00:00
|
|
|
|
(widen)
|
2009-11-02 07:07:28 +00:00
|
|
|
|
(goto-char pos)
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
|
(when (derived-mode-p 'org-mode)
|
2009-11-02 07:07:28 +00:00
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
2011-01-01 18:33:35 +00:00
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(when (outline-invisible-p)
|
2012-08-10 08:08:58 +00:00
|
|
|
|
(show-entry)) ; display invisible text
|
|
|
|
|
(run-hooks 'org-agenda-after-show-hook)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-goto-mouse (ev)
|
|
|
|
|
"Go to the Org-mode file which contains the item at the mouse click."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(mouse-set-point ev)
|
|
|
|
|
(org-agenda-goto))
|
|
|
|
|
|
2009-02-19 09:40:08 +00:00
|
|
|
|
(defun org-agenda-show (&optional full-entry)
|
|
|
|
|
"Display the Org-mode file which contains the item at point.
|
|
|
|
|
With prefix argument FULL-ENTRY, make the entire entry visible
|
|
|
|
|
if it was hidden in the outline."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((win (selected-window)))
|
|
|
|
|
(if full-entry
|
|
|
|
|
(let ((org-show-entry-below t))
|
|
|
|
|
(org-agenda-goto t))
|
|
|
|
|
(org-agenda-goto t))
|
|
|
|
|
(select-window win)))
|
|
|
|
|
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(defvar org-agenda-show-window nil)
|
2012-03-19 20:38:12 +00:00
|
|
|
|
(defun org-agenda-show-and-scroll-up (&optional arg)
|
2009-10-20 17:56:11 +00:00
|
|
|
|
"Display the Org-mode file which contains the item at point.
|
2012-03-19 20:38:12 +00:00
|
|
|
|
When called repeatedly, scroll the window that is displaying the buffer.
|
|
|
|
|
With a \\[universal-argument] prefix, use `org-show-entry' instead of
|
|
|
|
|
`show-subtree' to display the item, so that drawers and logbooks stay
|
|
|
|
|
folded."
|
|
|
|
|
(interactive "P")
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(let ((win (selected-window)))
|
|
|
|
|
(if (and (window-live-p org-agenda-show-window)
|
|
|
|
|
(eq this-command last-command))
|
|
|
|
|
(progn
|
|
|
|
|
(select-window org-agenda-show-window)
|
|
|
|
|
(ignore-errors (scroll-up)))
|
|
|
|
|
(org-agenda-goto t)
|
2012-03-19 20:38:12 +00:00
|
|
|
|
(if arg (org-show-entry) (show-subtree))
|
2009-10-20 17:56:11 +00:00
|
|
|
|
(setq org-agenda-show-window (selected-window)))
|
|
|
|
|
(select-window win)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-show-scroll-down ()
|
|
|
|
|
"Scroll down the window showing the agenda."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((win (selected-window)))
|
|
|
|
|
(when (window-live-p org-agenda-show-window)
|
|
|
|
|
(select-window org-agenda-show-window)
|
|
|
|
|
(ignore-errors (scroll-down))
|
|
|
|
|
(select-window win))))
|
|
|
|
|
|
2009-02-19 09:40:08 +00:00
|
|
|
|
(defun org-agenda-show-1 (&optional more)
|
2008-12-18 08:22:21 +00:00
|
|
|
|
"Display the Org-mode file which contains the item at point.
|
2009-11-12 12:39:29 +00:00
|
|
|
|
The prefix arg selects the amount of information to display:
|
2009-02-17 20:46:41 +00:00
|
|
|
|
|
|
|
|
|
0 hide the subtree
|
|
|
|
|
1 just show the entry according to defaults.
|
2009-08-31 06:08:22 +00:00
|
|
|
|
2 show the children view
|
|
|
|
|
3 show the subtree view
|
2009-02-17 20:46:41 +00:00
|
|
|
|
4 show the entire subtree and any LOGBOOK drawers
|
|
|
|
|
5 show the entire subtree and any drawers
|
2008-12-18 08:22:21 +00:00
|
|
|
|
With prefix argument FULL-ENTRY, make the entire entry visible
|
|
|
|
|
if it was hidden in the outline."
|
2009-02-17 20:46:41 +00:00
|
|
|
|
(interactive "p")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let ((win (selected-window)))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
(org-agenda-goto t)
|
|
|
|
|
(org-recenter-heading 1)
|
|
|
|
|
(cond
|
|
|
|
|
((= more 0)
|
|
|
|
|
(hide-subtree)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
|
|
|
|
(run-hook-with-args 'org-cycle-hook 'folded))
|
|
|
|
|
(message "Remote: FOLDED"))
|
2011-06-29 22:25:09 +00:00
|
|
|
|
((and (org-called-interactively-p 'any) (= more 1))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
(message "Remote: show with default settings"))
|
|
|
|
|
((= more 2)
|
|
|
|
|
(show-entry)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(show-children)
|
2009-02-17 20:46:41 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(run-hook-with-args 'org-cycle-hook 'children))
|
|
|
|
|
(message "Remote: CHILDREN"))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
((= more 3)
|
|
|
|
|
(show-subtree)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(run-hook-with-args 'org-cycle-hook 'subtree))
|
|
|
|
|
(message "Remote: SUBTREE"))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
((= more 4)
|
|
|
|
|
(let* ((org-drawers (delete "LOGBOOK" (copy-sequence org-drawers)))
|
|
|
|
|
(org-drawer-regexp
|
|
|
|
|
(concat "^[ \t]*:\\("
|
|
|
|
|
(mapconcat 'regexp-quote org-drawers "\\|")
|
|
|
|
|
"\\):[ \t]*$")))
|
|
|
|
|
(show-subtree)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
|
|
|
|
(org-cycle-hide-drawers 'subtree)))
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(message "Remote: SUBTREE AND LOGBOOK"))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
((> more 4)
|
|
|
|
|
(show-subtree)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(message "Remote: SUBTREE AND ALL DRAWERS")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(select-window win)))
|
|
|
|
|
|
2009-02-17 20:46:41 +00:00
|
|
|
|
(defun org-recenter-heading (n)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
|
|
|
|
(recenter n)))
|
|
|
|
|
|
|
|
|
|
(defvar org-agenda-cycle-counter nil)
|
2009-08-31 06:08:22 +00:00
|
|
|
|
(defun org-agenda-cycle-show (&optional n)
|
2009-02-17 20:46:41 +00:00
|
|
|
|
"Show the current entry in another window, with default settings.
|
|
|
|
|
Default settings are taken from `org-show-hierarchy-above' and siblings.
|
2009-08-31 06:08:22 +00:00
|
|
|
|
When use repeatedly in immediate succession, the remote entry will cycle
|
2009-02-17 20:46:41 +00:00
|
|
|
|
through visibility
|
|
|
|
|
|
2009-08-31 06:08:22 +00:00
|
|
|
|
children -> subtree -> folded
|
|
|
|
|
|
|
|
|
|
When called with a numeric prefix arg, that arg will be passed through to
|
|
|
|
|
`org-agenda-show-1'. For the interpretation of that argument, see the
|
|
|
|
|
docstring of `org-agenda-show-1'."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (integerp n)
|
|
|
|
|
(setq org-agenda-cycle-counter n)
|
|
|
|
|
(if (not (eq last-command this-command))
|
|
|
|
|
(setq org-agenda-cycle-counter 1)
|
|
|
|
|
(if (equal org-agenda-cycle-counter 0)
|
|
|
|
|
(setq org-agenda-cycle-counter 2)
|
|
|
|
|
(setq org-agenda-cycle-counter (1+ org-agenda-cycle-counter))
|
|
|
|
|
(if (> org-agenda-cycle-counter 3)
|
|
|
|
|
(setq org-agenda-cycle-counter 0)))))
|
2009-02-19 10:13:15 +00:00
|
|
|
|
(org-agenda-show-1 org-agenda-cycle-counter))
|
2009-02-17 20:46:41 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-recenter (arg)
|
|
|
|
|
"Display the Org-mode file which contains the item at point and recenter."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((win (selected-window)))
|
|
|
|
|
(org-agenda-goto t)
|
|
|
|
|
(recenter arg)
|
|
|
|
|
(select-window win)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-show-mouse (ev)
|
|
|
|
|
"Display the Org-mode file which contains the item at the mouse click."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(mouse-set-point ev)
|
|
|
|
|
(org-agenda-show))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-check-no-diary ()
|
|
|
|
|
"Check if the entry is a diary link and abort if yes."
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(if (org-get-at-bol 'org-agenda-diary-link)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-error ()
|
|
|
|
|
(error "Command not allowed in this line"))
|
|
|
|
|
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(defun org-agenda-tree-to-indirect-buffer (arg)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Show the subtree corresponding to the current entry in an indirect buffer.
|
2012-09-24 15:19:12 +00:00
|
|
|
|
This calls the command `org-tree-to-indirect-buffer' from the original buffer.
|
|
|
|
|
|
|
|
|
|
With a numerical prefix ARG, go up to this level and then take that tree.
|
|
|
|
|
With a negative numeric ARG, go up by this number of levels.
|
2010-07-15 20:26:51 +00:00
|
|
|
|
With a \\[universal-argument] prefix, make a separate frame for this tree (i.e. don't
|
|
|
|
|
use the dedicated frame)."
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if current-prefix-arg
|
|
|
|
|
(org-agenda-do-tree-to-indirect-buffer arg)
|
2012-09-18 14:06:46 +00:00
|
|
|
|
(let ((agenda-buffer (buffer-name))
|
|
|
|
|
(agenda-window (selected-window))
|
2012-03-16 18:05:26 +00:00
|
|
|
|
(indirect-window
|
|
|
|
|
(and org-last-indirect-buffer
|
|
|
|
|
(get-buffer-window org-last-indirect-buffer))))
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(save-window-excursion (org-agenda-do-tree-to-indirect-buffer arg))
|
2012-09-18 14:06:46 +00:00
|
|
|
|
(unless (or (eq org-indirect-buffer-display 'new-frame)
|
|
|
|
|
(eq org-indirect-buffer-display 'dedicated-frame))
|
|
|
|
|
(unwind-protect
|
2012-09-29 09:10:03 +00:00
|
|
|
|
(unless (and indirect-window (window-live-p indirect-window))
|
2012-09-18 14:06:46 +00:00
|
|
|
|
(setq indirect-window (split-window agenda-window)))
|
|
|
|
|
(and indirect-window (select-window indirect-window))
|
|
|
|
|
(switch-to-buffer org-last-indirect-buffer :norecord)
|
|
|
|
|
(fit-window-to-buffer indirect-window)))
|
|
|
|
|
(select-window (get-buffer-window agenda-buffer)))))
|
2011-10-23 18:41:44 +00:00
|
|
|
|
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(defun org-agenda-do-tree-to-indirect-buffer (arg)
|
2011-12-12 16:40:34 +00:00
|
|
|
|
"Same as `org-agenda-tree-to-indirect-buffer' without saving window."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker)))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
2012-09-24 15:19:12 +00:00
|
|
|
|
(funcall 'org-tree-to-indirect-buffer arg)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defvar org-last-heading-marker (make-marker)
|
|
|
|
|
"Marker pointing to the headline that last changed its TODO state
|
|
|
|
|
by a remote command from the agenda.")
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-todo-nextset ()
|
|
|
|
|
"Switch TODO entry to next sequence."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-todo 'nextset))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-todo-previousset ()
|
|
|
|
|
"Switch TODO entry to previous sequence."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-todo 'previousset))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-todo (&optional arg)
|
|
|
|
|
"Cycle TODO state of line at point, also in Org-mode file.
|
|
|
|
|
This changes the line at point, all other lines in the agenda referring to
|
|
|
|
|
the same tree node, and the headline of the tree node in the Org-mode file."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-no-diary)
|
|
|
|
|
(let* ((col (current-column))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(hdmarker (org-get-at-bol 'org-hd-marker))
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(todayp (org-agenda-todayp (org-get-at-bol 'day)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(inhibit-read-only t)
|
Improve feedback when completing repeated tasks from agenda view.
When marking a repeated entry DONE in the daily or weekly agenda, that
task would previously still be shown as TODO, because the repeater
immediately restores the TODO state after moving the time stamp. This
is bad feedback.
This problem was hard to fix. Because the same line may be present in
other lines in the same weekly agenda, we cannot simply update all
lines related to this entry.
What we do now is this: Before the repeater does its work in shifting
the time stamp and resetting the TODO keyword, we take a snapshot of
the headline as it looks then. And then, when we update the agenda
view, we change only the line at the cursor instead of all lines
related to this entry. We also make sure that this is only so if the
cursor is in a daily/weekly agenda, on TODAY's date.
There still remain possible inconsistencies. For example, if you have
a daily repeating task in the weekly agenda, and you move the cursor a
few days into the future and mark it DONE there, the entry will
actually be marked DONE for today, but still show up in today's task
list as TODO. refreshing the agenda will fix the display in such an
unlikely case.
Thanks to Jack ??? for noticing and reporting this issue.
2008-11-03 07:36:30 +00:00
|
|
|
|
org-agenda-headline-snapshot-before-repeat newhead just-one)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
2009-01-30 06:38:02 +00:00
|
|
|
|
(let ((current-prefix-arg arg))
|
|
|
|
|
(call-interactively 'org-todo))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(and (bolp) (forward-char 1))
|
|
|
|
|
(setq newhead (org-get-heading))
|
Improve feedback when completing repeated tasks from agenda view.
When marking a repeated entry DONE in the daily or weekly agenda, that
task would previously still be shown as TODO, because the repeater
immediately restores the TODO state after moving the time stamp. This
is bad feedback.
This problem was hard to fix. Because the same line may be present in
other lines in the same weekly agenda, we cannot simply update all
lines related to this entry.
What we do now is this: Before the repeater does its work in shifting
the time stamp and resetting the TODO keyword, we take a snapshot of
the headline as it looks then. And then, when we update the agenda
view, we change only the line at the cursor instead of all lines
related to this entry. We also make sure that this is only so if the
cursor is in a daily/weekly agenda, on TODAY's date.
There still remain possible inconsistencies. For example, if you have
a daily repeating task in the weekly agenda, and you move the cursor a
few days into the future and mark it DONE there, the entry will
actually be marked DONE for today, but still show up in today's task
list as TODO. refreshing the agenda will fix the display in such an
unlikely case.
Thanks to Jack ??? for noticing and reporting this issue.
2008-11-03 07:36:30 +00:00
|
|
|
|
(when (and (org-bound-and-true-p
|
|
|
|
|
org-agenda-headline-snapshot-before-repeat)
|
|
|
|
|
(not (equal org-agenda-headline-snapshot-before-repeat
|
|
|
|
|
newhead))
|
|
|
|
|
todayp)
|
|
|
|
|
(setq newhead org-agenda-headline-snapshot-before-repeat
|
|
|
|
|
just-one t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
|
|
|
|
(move-marker org-last-heading-marker (point))))
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(save-excursion
|
Improve feedback when completing repeated tasks from agenda view.
When marking a repeated entry DONE in the daily or weekly agenda, that
task would previously still be shown as TODO, because the repeater
immediately restores the TODO state after moving the time stamp. This
is bad feedback.
This problem was hard to fix. Because the same line may be present in
other lines in the same weekly agenda, we cannot simply update all
lines related to this entry.
What we do now is this: Before the repeater does its work in shifting
the time stamp and resetting the TODO keyword, we take a snapshot of
the headline as it looks then. And then, when we update the agenda
view, we change only the line at the cursor instead of all lines
related to this entry. We also make sure that this is only so if the
cursor is in a daily/weekly agenda, on TODAY's date.
There still remain possible inconsistencies. For example, if you have
a daily repeating task in the weekly agenda, and you move the cursor a
few days into the future and mark it DONE there, the entry will
actually be marked DONE for today, but still show up in today's task
list as TODO. refreshing the agenda will fix the display in such an
unlikely case.
Thanks to Jack ??? for noticing and reporting this issue.
2008-11-03 07:36:30 +00:00
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker 'fixface just-one))
|
2008-04-24 14:44:12 +00:00
|
|
|
|
(org-move-to-column col))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2008-03-28 14:42:31 +00:00
|
|
|
|
(defun org-agenda-add-note (&optional arg)
|
|
|
|
|
"Add a time-stamped note to the entry at point."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-28 14:42:31 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(hdmarker (org-get-at-bol 'org-hd-marker))
|
2008-03-28 14:42:31 +00:00
|
|
|
|
(inhibit-read-only t))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(org-add-note))))
|
|
|
|
|
|
2008-12-16 04:50:46 +00:00
|
|
|
|
(defun org-agenda-change-all-lines (newhead hdmarker
|
2008-12-18 08:03:06 +00:00
|
|
|
|
&optional fixface just-this)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Change all lines in the agenda buffer which match HDMARKER.
|
|
|
|
|
The new content of the line will be NEWHEAD (as modified by
|
2011-10-22 13:08:33 +00:00
|
|
|
|
`org-agenda-format-item'). HDMARKER is checked with
|
2008-03-22 15:52:18 +00:00
|
|
|
|
`equal' against all `org-hd-marker' text properties in the file.
|
2008-12-16 14:25:23 +00:00
|
|
|
|
If FIXFACE is non-nil, the face of each item is modified according to
|
2008-12-16 04:50:46 +00:00
|
|
|
|
the new TODO state.
|
|
|
|
|
If JUST-THIS is non-nil, change just the current line, not all.
|
2008-12-16 14:25:23 +00:00
|
|
|
|
If FORCE-TAGS is non nil, the car of it returns the new tags."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((inhibit-read-only t)
|
Improve feedback when completing repeated tasks from agenda view.
When marking a repeated entry DONE in the daily or weekly agenda, that
task would previously still be shown as TODO, because the repeater
immediately restores the TODO state after moving the time stamp. This
is bad feedback.
This problem was hard to fix. Because the same line may be present in
other lines in the same weekly agenda, we cannot simply update all
lines related to this entry.
What we do now is this: Before the repeater does its work in shifting
the time stamp and resetting the TODO keyword, we take a snapshot of
the headline as it looks then. And then, when we update the agenda
view, we change only the line at the cursor instead of all lines
related to this entry. We also make sure that this is only so if the
cursor is in a daily/weekly agenda, on TODAY's date.
There still remain possible inconsistencies. For example, if you have
a daily repeating task in the weekly agenda, and you move the cursor a
few days into the future and mark it DONE there, the entry will
actually be marked DONE for today, but still show up in today's task
list as TODO. refreshing the agenda will fix the display in such an
unlikely case.
Thanks to Jack ??? for noticing and reporting this issue.
2008-11-03 07:36:30 +00:00
|
|
|
|
(line (org-current-line))
|
2012-03-01 15:49:23 +00:00
|
|
|
|
(org-agenda-buffer (current-buffer))
|
2008-12-18 08:03:06 +00:00
|
|
|
|
(thetags (with-current-buffer (marker-buffer hdmarker)
|
|
|
|
|
(save-excursion (save-restriction (widen)
|
|
|
|
|
(goto-char hdmarker)
|
|
|
|
|
(org-get-tags-at)))))
|
2012-09-12 09:41:50 +00:00
|
|
|
|
props m pl undone-face done-face finish new dotime level cat tags)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(while (not finish)
|
|
|
|
|
(setq finish (bobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(when (and (setq m (org-get-at-bol 'org-hd-marker))
|
Improve feedback when completing repeated tasks from agenda view.
When marking a repeated entry DONE in the daily or weekly agenda, that
task would previously still be shown as TODO, because the repeater
immediately restores the TODO state after moving the time stamp. This
is bad feedback.
This problem was hard to fix. Because the same line may be present in
other lines in the same weekly agenda, we cannot simply update all
lines related to this entry.
What we do now is this: Before the repeater does its work in shifting
the time stamp and resetting the TODO keyword, we take a snapshot of
the headline as it looks then. And then, when we update the agenda
view, we change only the line at the cursor instead of all lines
related to this entry. We also make sure that this is only so if the
cursor is in a daily/weekly agenda, on TODAY's date.
There still remain possible inconsistencies. For example, if you have
a daily repeating task in the weekly agenda, and you move the cursor a
few days into the future and mark it DONE there, the entry will
actually be marked DONE for today, but still show up in today's task
list as TODO. refreshing the agenda will fix the display in such an
unlikely case.
Thanks to Jack ??? for noticing and reporting this issue.
2008-11-03 07:36:30 +00:00
|
|
|
|
(or (not just-this) (= (org-current-line) line))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(equal m hdmarker))
|
|
|
|
|
(setq props (text-properties-at (point))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
dotime (org-get-at-bol 'dotime)
|
|
|
|
|
cat (org-get-at-bol 'org-category)
|
2012-09-12 09:41:50 +00:00
|
|
|
|
level (org-get-at-bol 'level)
|
2008-12-18 08:03:06 +00:00
|
|
|
|
tags thetags
|
2011-07-22 17:31:05 +00:00
|
|
|
|
new
|
|
|
|
|
(let ((org-prefix-format-compiled
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(or (get-text-property (min (1- (point-max)) (point)) 'format)
|
2012-03-22 19:02:54 +00:00
|
|
|
|
org-prefix-format-compiled))
|
|
|
|
|
(extra (org-get-at-bol 'extra)))
|
2011-07-22 17:31:05 +00:00
|
|
|
|
(with-current-buffer (marker-buffer hdmarker)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(org-agenda-format-item extra newhead level cat tags dotime)))))
|
2011-03-16 17:17:28 +00:00
|
|
|
|
pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
undone-face (org-get-at-bol 'undone-face)
|
|
|
|
|
done-face (org-get-at-bol 'done-face))
|
2011-03-16 17:26:29 +00:00
|
|
|
|
(beginning-of-line 1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cond
|
|
|
|
|
((equal new "")
|
|
|
|
|
(and (looking-at ".*\n?") (replace-match "")))
|
|
|
|
|
((looking-at ".*")
|
|
|
|
|
(replace-match new t t)
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(add-text-properties (point-at-bol) (point-at-eol) props)
|
|
|
|
|
(when fixface
|
|
|
|
|
(add-text-properties
|
|
|
|
|
(point-at-bol) (point-at-eol)
|
|
|
|
|
(list 'face
|
|
|
|
|
(if org-last-todo-state-is-todo
|
|
|
|
|
undone-face done-face))))
|
|
|
|
|
(org-agenda-highlight-todo 'line)
|
|
|
|
|
(beginning-of-line 1))
|
2012-09-28 13:02:07 +00:00
|
|
|
|
(t (error "Line update did not work")))
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (point-at-bol) (point-at-eol))
|
|
|
|
|
(org-agenda-finalize)))
|
|
|
|
|
(beginning-of-line 0)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-align-tags (&optional line)
|
|
|
|
|
"Align all tags in agenda items to `org-agenda-tags-column'."
|
|
|
|
|
(let ((inhibit-read-only t) l c)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (if line (point-at-bol) (point-min)))
|
2010-08-21 00:30:31 +00:00
|
|
|
|
(while (re-search-forward (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if line (point-at-eol) nil) t)
|
|
|
|
|
(add-text-properties
|
|
|
|
|
(match-beginning 2) (match-end 2)
|
2008-11-08 21:28:11 +00:00
|
|
|
|
(list 'face (delq nil (let ((prop (get-text-property
|
|
|
|
|
(match-beginning 2) 'face)))
|
|
|
|
|
(or (listp prop) (setq prop (list prop)))
|
|
|
|
|
(if (memq 'org-tag prop)
|
|
|
|
|
prop
|
|
|
|
|
(cons 'org-tag prop))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq l (- (match-end 2) (match-beginning 2))
|
|
|
|
|
c (if (< org-agenda-tags-column 0)
|
|
|
|
|
(- (abs org-agenda-tags-column) l)
|
|
|
|
|
org-agenda-tags-column))
|
|
|
|
|
(delete-region (match-beginning 1) (match-end 1))
|
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
|
(insert (org-add-props
|
|
|
|
|
(make-string (max 1 (- c (current-column))) ?\ )
|
2010-02-15 19:23:05 +00:00
|
|
|
|
(plist-put (copy-sequence (text-properties-at (point)))
|
|
|
|
|
'face nil))))
|
2008-12-04 13:24:21 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(org-font-lock-add-tag-faces (point-max)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-priority-up ()
|
|
|
|
|
"Increase the priority of line at point, also in Org-mode file."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-priority 'up))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-priority-down ()
|
|
|
|
|
"Decrease the priority of line at point, also in Org-mode file."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-priority 'down))
|
|
|
|
|
|
2012-12-30 10:30:21 +00:00
|
|
|
|
(defun org-agenda-priority (&optional force-direction)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Set the priority of line at point, also in Org-mode file.
|
|
|
|
|
This changes the line at point, all other lines in the agenda referring to
|
2012-12-30 10:30:21 +00:00
|
|
|
|
the same tree node, and the headline of the tree node in the Org-mode file.
|
|
|
|
|
Called with a universal prefix arg, show the priority instead of setting it."
|
2012-09-28 06:29:38 +00:00
|
|
|
|
(interactive "P")
|
2012-12-30 10:30:21 +00:00
|
|
|
|
(if (equal force-direction '(4))
|
|
|
|
|
(org-show-priority)
|
|
|
|
|
(unless org-enable-priority-commands
|
|
|
|
|
(error "Priority commands are disabled"))
|
|
|
|
|
(org-agenda-check-no-diary)
|
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(hdmarker (org-get-at-bol 'org-hd-marker))
|
|
|
|
|
(buffer (marker-buffer hdmarker))
|
|
|
|
|
(pos (marker-position hdmarker))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
newhead)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(funcall 'org-priority force-direction)
|
|
|
|
|
(end-of-line 1)
|
|
|
|
|
(setq newhead (org-get-heading)))
|
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker)
|
|
|
|
|
(beginning-of-line 1)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;; FIXME: should fix the tags property of the agenda line.
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(defun org-agenda-set-tags (&optional tag onoff)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Set tags for the current headline."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2011-06-29 22:25:09 +00:00
|
|
|
|
(if (and (org-region-active-p) (org-called-interactively-p 'any))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(call-interactively 'org-change-tag-in-region)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer hdmarker))
|
|
|
|
|
(pos (marker-position hdmarker))
|
|
|
|
|
(inhibit-read-only t)
|
2008-12-18 08:03:06 +00:00
|
|
|
|
newhead)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-show-context 'agenda))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(goto-char pos)
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(if tag
|
|
|
|
|
(org-toggle-tag tag onoff)
|
|
|
|
|
(call-interactively 'org-set-tags))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(end-of-line 1)
|
|
|
|
|
(setq newhead (org-get-heading)))
|
2008-12-18 08:03:06 +00:00
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(beginning-of-line 1)))))
|
|
|
|
|
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(defun org-agenda-set-property ()
|
|
|
|
|
"Set a property for the current headline."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer hdmarker))
|
|
|
|
|
(pos (marker-position hdmarker))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
newhead)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-show-context 'agenda))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(call-interactively 'org-set-property)))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-set-effort ()
|
|
|
|
|
"Set the effort property for the current headline."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer hdmarker))
|
|
|
|
|
(pos (marker-position hdmarker))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
newhead)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-show-context 'agenda))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
2011-07-22 17:35:51 +00:00
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
2009-08-29 18:21:15 +00:00
|
|
|
|
(goto-char pos)
|
|
|
|
|
(call-interactively 'org-set-effort)
|
2011-07-22 17:35:51 +00:00
|
|
|
|
(end-of-line 1)
|
|
|
|
|
(setq newhead (org-get-heading)))
|
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker))))
|
2009-08-29 18:21:15 +00:00
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-toggle-archive-tag ()
|
|
|
|
|
"Toggle the archive tag for the current entry."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer hdmarker))
|
|
|
|
|
(pos (marker-position hdmarker))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
newhead)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (outline-next-heading)
|
|
|
|
|
(org-flag-heading nil))) ; show the next heading
|
|
|
|
|
(call-interactively 'org-toggle-archive-tag)
|
|
|
|
|
(end-of-line 1)
|
|
|
|
|
(setq newhead (org-get-heading)))
|
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker)
|
|
|
|
|
(beginning-of-line 1))))
|
|
|
|
|
|
Time stamps: Changing time ranges as a block.
Anupam Sengupta writes:
> I routinely use time ranges (and occasionally time-stamp ranges)
> in my org files to document the scheduled block of time for a
> meeting or activity. As an example, I will mark meetings as:
>
> * A Meeting
> <2009-03-12 Thu 10:00-11:00>
>
> As often happens with meetings, rescheduling needs to be done and
> I use S-<up> or S-<down> on the time-stamp to make the
> modifications. While this works fine, it usually leads to a
> duplication when the *time* part of the time-stamp needs to be
> changed.
>
> For the same example above, if the time-block has now changed to
> 11:00-12:00, then I need to do S-<up> on both the "10:00" and the
> "11:00" string. I.e,
>
>
> * A Meeting
> <2009-03-12 Thu 11:00-11:00>
> ^
> +---------------- After the first S-<up>
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^
> +---------------- After the second S-<up>
>
> Can we have a feature (with a toggle option perhaps) which would
> *move* the block (i.e., both time entries) by the same amount
> when either one is moved in the same direction. I.e., the
> proposal is to have:
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^ ^
> | |
> | +---------- Automatically shifted
> +---------------- After the S-<up>
This is in fact how changing time works in many applications, and
it does make sense here as well. The commits implements this
change.
It also implements a way to change the start time of an entry from
the agenda. The date is normally changed with S-right/left.
Now, if you add a C-u prefix, the hour will be changed. If you
immediately press S-right/left again, hours will continue to be
changed.
A double prefix will do the same for minutes.
2009-03-13 08:26:53 +00:00
|
|
|
|
(defun org-agenda-do-date-later (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(cond
|
|
|
|
|
((or (equal arg '(16))
|
|
|
|
|
(memq last-command
|
|
|
|
|
'(org-agenda-date-later-minutes org-agenda-date-earlier-minutes)))
|
|
|
|
|
(setq this-command 'org-agenda-date-later-minutes)
|
|
|
|
|
(org-agenda-date-later-minutes 1))
|
|
|
|
|
((or (equal arg '(4))
|
|
|
|
|
(memq last-command
|
|
|
|
|
'(org-agenda-date-later-hours org-agenda-date-earlier-hours)))
|
|
|
|
|
(setq this-command 'org-agenda-date-later-hours)
|
|
|
|
|
(org-agenda-date-later-hours 1))
|
|
|
|
|
(t
|
|
|
|
|
(org-agenda-date-later (prefix-numeric-value arg)))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-do-date-earlier (arg)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(cond
|
|
|
|
|
((or (equal arg '(16))
|
|
|
|
|
(memq last-command
|
|
|
|
|
'(org-agenda-date-later-minutes org-agenda-date-earlier-minutes)))
|
|
|
|
|
(setq this-command 'org-agenda-date-earlier-minutes)
|
|
|
|
|
(org-agenda-date-earlier-minutes 1))
|
|
|
|
|
((or (equal arg '(4))
|
|
|
|
|
(memq last-command
|
|
|
|
|
'(org-agenda-date-later-hours org-agenda-date-earlier-hours)))
|
|
|
|
|
(setq this-command 'org-agenda-date-earlier-hours)
|
|
|
|
|
(org-agenda-date-earlier-hours 1))
|
|
|
|
|
(t
|
|
|
|
|
(org-agenda-date-earlier (prefix-numeric-value arg)))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-date-later (arg &optional what)
|
2011-02-13 16:40:08 +00:00
|
|
|
|
"Change the date of this item to ARG day(s) later."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
2011-10-15 21:37:59 +00:00
|
|
|
|
(pos (marker-position marker))
|
|
|
|
|
cdate today)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-with-remote-undo buffer
|
2011-10-15 21:37:59 +00:00
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(if (not (org-at-timestamp-p))
|
|
|
|
|
(error "Cannot find time stamp"))
|
2011-10-21 08:07:02 +00:00
|
|
|
|
(when (and org-agenda-move-date-from-past-immediately-to-today
|
2011-10-22 06:31:18 +00:00
|
|
|
|
(equal arg 1)
|
|
|
|
|
(or (not what) (eq what 'day))
|
2011-10-21 08:07:02 +00:00
|
|
|
|
(not (save-match-data (org-at-date-range-p))))
|
|
|
|
|
(setq cdate (org-parse-time-string (match-string 0) 'nodefault)
|
2011-10-23 20:45:53 +00:00
|
|
|
|
cdate (calendar-absolute-from-gregorian
|
2011-10-21 08:07:02 +00:00
|
|
|
|
(list (nth 4 cdate) (nth 3 cdate) (nth 5 cdate)))
|
|
|
|
|
today (org-today))
|
2011-10-22 06:31:18 +00:00
|
|
|
|
(if (> today cdate)
|
2011-10-21 08:07:02 +00:00
|
|
|
|
;; immediately shift to today
|
|
|
|
|
(setq arg (- today cdate))))
|
|
|
|
|
(org-timestamp-change arg (or what 'day))
|
|
|
|
|
(when (and (org-at-date-range-p)
|
|
|
|
|
(re-search-backward org-tr-regexp-both (point-at-bol)))
|
|
|
|
|
(let ((end org-last-changed-timestamp))
|
|
|
|
|
(org-timestamp-change arg (or what 'day))
|
|
|
|
|
(setq org-last-changed-timestamp
|
|
|
|
|
(concat org-last-changed-timestamp "--" end)))))
|
2011-10-15 21:37:59 +00:00
|
|
|
|
(org-agenda-show-new-time marker org-last-changed-timestamp))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(message "Time stamp changed to %s" org-last-changed-timestamp)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-date-earlier (arg &optional what)
|
2011-02-13 16:40:08 +00:00
|
|
|
|
"Change the date of this item to ARG day(s) earlier."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-date-later (- arg) what))
|
|
|
|
|
|
Time stamps: Changing time ranges as a block.
Anupam Sengupta writes:
> I routinely use time ranges (and occasionally time-stamp ranges)
> in my org files to document the scheduled block of time for a
> meeting or activity. As an example, I will mark meetings as:
>
> * A Meeting
> <2009-03-12 Thu 10:00-11:00>
>
> As often happens with meetings, rescheduling needs to be done and
> I use S-<up> or S-<down> on the time-stamp to make the
> modifications. While this works fine, it usually leads to a
> duplication when the *time* part of the time-stamp needs to be
> changed.
>
> For the same example above, if the time-block has now changed to
> 11:00-12:00, then I need to do S-<up> on both the "10:00" and the
> "11:00" string. I.e,
>
>
> * A Meeting
> <2009-03-12 Thu 11:00-11:00>
> ^
> +---------------- After the first S-<up>
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^
> +---------------- After the second S-<up>
>
> Can we have a feature (with a toggle option perhaps) which would
> *move* the block (i.e., both time entries) by the same amount
> when either one is moved in the same direction. I.e., the
> proposal is to have:
>
> * A Meeting
> <2009-03-12 Thu 11:00-12:00>
> ^ ^
> | |
> | +---------- Automatically shifted
> +---------------- After the S-<up>
This is in fact how changing time works in many applications, and
it does make sense here as well. The commits implements this
change.
It also implements a way to change the start time of an entry from
the agenda. The date is normally changed with S-right/left.
Now, if you add a C-u prefix, the hour will be changed. If you
immediately press S-right/left again, hours will continue to be
changed.
A double prefix will do the same for minutes.
2009-03-13 08:26:53 +00:00
|
|
|
|
(defun org-agenda-date-later-minutes (arg)
|
|
|
|
|
"Change the time of this item, in units of `org-time-stamp-rounding-minutes'."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(setq arg (* arg (cadr org-time-stamp-rounding-minutes)))
|
|
|
|
|
(org-agenda-date-later arg 'minute))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-date-earlier-minutes (arg)
|
|
|
|
|
"Change the time of this item, in units of `org-time-stamp-rounding-minutes'."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(setq arg (* arg (cadr org-time-stamp-rounding-minutes)))
|
|
|
|
|
(org-agenda-date-earlier arg 'minute))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-date-later-hours (arg)
|
|
|
|
|
"Change the time of this item, in hour steps."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-date-later arg 'hour))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-date-earlier-hours (arg)
|
|
|
|
|
"Change the time of this item, in hour steps."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(org-agenda-date-earlier arg 'hour))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-show-new-time (marker stamp &optional prefix)
|
|
|
|
|
"Show new date stamp via text properties."
|
|
|
|
|
;; We use text properties to make this undoable
|
2013-02-11 13:56:38 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(setq stamp (concat prefix " => " stamp " "))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(while (not (bobp))
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(when (equal marker (org-get-at-bol 'org-marker))
|
2008-04-24 14:44:12 +00:00
|
|
|
|
(org-move-to-column (- (window-width) (length stamp)) t)
|
2008-10-14 14:50:02 +00:00
|
|
|
|
(org-agenda-fix-tags-filter-overlays-at (point))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
;; Use `duplicable' property to trigger undo recording
|
|
|
|
|
(let ((ex (make-extent nil nil))
|
|
|
|
|
(gl (make-glyph stamp)))
|
|
|
|
|
(set-glyph-face gl 'secondary-selection)
|
|
|
|
|
(set-extent-properties
|
|
|
|
|
ex (list 'invisible t 'end-glyph gl 'duplicable t))
|
|
|
|
|
(insert-extent ex (1- (point)) (point-at-eol)))
|
|
|
|
|
(add-text-properties
|
|
|
|
|
(1- (point)) (point-at-eol)
|
|
|
|
|
(list 'display (org-add-props stamp nil
|
|
|
|
|
'face 'secondary-selection))))
|
|
|
|
|
(beginning-of-line 1))
|
|
|
|
|
(beginning-of-line 0)))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-date-prompt (arg)
|
|
|
|
|
"Change the date of this item. Date is prompted for, with default today.
|
|
|
|
|
The prefix ARG is passed to the `org-time-stamp' command and can therefore
|
|
|
|
|
be used to request time specification in the time stamp."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker)))
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
2009-12-14 16:06:04 +00:00
|
|
|
|
(if (not (org-at-timestamp-p t))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(error "Cannot find time stamp"))
|
2009-12-14 16:06:04 +00:00
|
|
|
|
(org-time-stamp arg (equal (char-after (match-beginning 0)) ?\[)))
|
2009-09-21 16:55:48 +00:00
|
|
|
|
(org-agenda-show-new-time marker org-last-changed-timestamp))
|
|
|
|
|
(message "Time stamp changed to %s" org-last-changed-timestamp)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-12-13 06:18:56 +00:00
|
|
|
|
(defun org-agenda-schedule (arg &optional time)
|
2010-01-14 16:09:11 +00:00
|
|
|
|
"Schedule the item at point.
|
2011-07-24 15:17:10 +00:00
|
|
|
|
ARG is passed through to `org-schedule'."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(type (marker-insertion-type marker))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker))
|
|
|
|
|
(org-insert-labeled-timestamps-at-point nil)
|
|
|
|
|
ts)
|
|
|
|
|
(set-marker-insertion-type marker t)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
2010-12-13 06:18:56 +00:00
|
|
|
|
(setq ts (org-schedule arg time)))
|
2013-02-11 13:56:38 +00:00
|
|
|
|
(org-agenda-show-new-time marker ts " S"))
|
2012-12-11 15:53:44 +00:00
|
|
|
|
(message "%s" ts)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-12-13 06:18:56 +00:00
|
|
|
|
(defun org-agenda-deadline (arg &optional time)
|
2010-01-14 16:09:11 +00:00
|
|
|
|
"Schedule the item at point.
|
2011-07-24 15:17:10 +00:00
|
|
|
|
ARG is passed through to `org-deadline'."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
|
|
|
|
|
(org-agenda-check-no-diary)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-error)))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(pos (marker-position marker))
|
|
|
|
|
(org-insert-labeled-timestamps-at-point nil)
|
|
|
|
|
ts)
|
|
|
|
|
(org-with-remote-undo buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
2010-12-13 06:18:56 +00:00
|
|
|
|
(setq ts (org-deadline arg time)))
|
2013-02-11 13:56:38 +00:00
|
|
|
|
(org-agenda-show-new-time marker ts " D"))
|
2012-12-11 15:53:44 +00:00
|
|
|
|
(message "%s" ts)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-clock-in (&optional arg)
|
|
|
|
|
"Start the clock on the currently selected item."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(org-agenda-check-no-diary)
|
2008-04-25 17:59:51 +00:00
|
|
|
|
(if (equal arg '(4))
|
|
|
|
|
(org-clock-in arg)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let* ((marker (or (org-get-at-bol 'org-marker)
|
2008-04-25 17:59:51 +00:00
|
|
|
|
(org-agenda-error)))
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(hdmarker (or (org-get-at-bol 'org-hd-marker) marker))
|
2008-06-12 11:59:54 +00:00
|
|
|
|
(pos (marker-position marker))
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(col (current-column))
|
2008-06-12 11:59:54 +00:00
|
|
|
|
newhead)
|
2008-04-25 17:59:51 +00:00
|
|
|
|
(org-with-remote-undo (marker-buffer marker)
|
|
|
|
|
(with-current-buffer (marker-buffer marker)
|
2012-01-19 15:20:07 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(org-show-context 'agenda)
|
|
|
|
|
(org-show-entry)
|
|
|
|
|
(org-cycle-hide-drawers 'children)
|
|
|
|
|
(org-clock-in arg)
|
|
|
|
|
(setq newhead (org-get-heading)))
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(org-agenda-change-all-lines newhead hdmarker))
|
|
|
|
|
(org-move-to-column col))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
2010-08-16 18:46:38 +00:00
|
|
|
|
(defun org-agenda-clock-out ()
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Stop the currently running clock."
|
2010-08-17 16:47:57 +00:00
|
|
|
|
(interactive)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(unless (marker-buffer org-clock-marker)
|
|
|
|
|
(error "No running clock"))
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(let ((marker (make-marker)) (col (current-column)) newhead)
|
2009-06-22 11:46:02 +00:00
|
|
|
|
(org-with-remote-undo (marker-buffer org-clock-marker)
|
|
|
|
|
(with-current-buffer (marker-buffer org-clock-marker)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char org-clock-marker)
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(move-marker marker (point))
|
|
|
|
|
(org-clock-out)
|
|
|
|
|
(setq newhead (org-get-heading))))))
|
|
|
|
|
(org-agenda-change-all-lines newhead marker)
|
2013-02-19 10:04:26 +00:00
|
|
|
|
(move-marker marker nil)
|
|
|
|
|
(org-move-to-column col)
|
|
|
|
|
(org-agenda-unmark-clocking-task)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-clock-cancel (&optional arg)
|
|
|
|
|
"Cancel the currently running clock."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(unless (marker-buffer org-clock-marker)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No running clock"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-with-remote-undo (marker-buffer org-clock-marker)
|
|
|
|
|
(org-clock-cancel)))
|
|
|
|
|
|
2010-08-06 17:28:08 +00:00
|
|
|
|
(defun org-agenda-clock-goto ()
|
2010-08-12 08:27:05 +00:00
|
|
|
|
"Jump to the currently clocked in task within the agenda.
|
|
|
|
|
If the currently clocked in task is not listed in the agenda
|
|
|
|
|
buffer, display it in another window."
|
2010-08-06 17:28:08 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let (pos)
|
|
|
|
|
(mapc (lambda (o)
|
|
|
|
|
(if (eq (overlay-get o 'type) 'org-agenda-clocking)
|
|
|
|
|
(setq pos (overlay-start o))))
|
|
|
|
|
(overlays-in (point-min) (point-max)))
|
2010-08-11 14:10:14 +00:00
|
|
|
|
(cond (pos (goto-char pos))
|
|
|
|
|
;; If the currently clocked entry is not in the agenda
|
|
|
|
|
;; buffer, we visit it in another window:
|
|
|
|
|
(org-clock-current-task
|
|
|
|
|
(org-switch-to-buffer-other-window (org-clock-goto)))
|
|
|
|
|
(t (message "No running clock, use `C-c C-x C-j' to jump to the most recent one")))))
|
2010-08-06 17:28:08 +00:00
|
|
|
|
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(defun org-agenda-diary-entry-in-org-file ()
|
|
|
|
|
"Make a diary entry in the file `org-agenda-diary-file'."
|
2009-11-20 12:56:23 +00:00
|
|
|
|
(let (d1 d2 char (text "") dp1 dp2)
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(if (equal (buffer-name) "*Calendar*")
|
|
|
|
|
(setq d1 (calendar-cursor-to-date t)
|
|
|
|
|
d2 (car calendar-mark-ring))
|
2009-11-20 12:56:23 +00:00
|
|
|
|
(setq dp1 (get-text-property (point-at-bol) 'day))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(unless dp1 (user-error "No date defined in current line"))
|
2009-11-20 12:56:23 +00:00
|
|
|
|
(setq d1 (calendar-gregorian-from-absolute dp1)
|
2009-11-20 11:29:03 +00:00
|
|
|
|
d2 (and (ignore-errors (mark))
|
2009-11-20 08:06:35 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (mark))
|
2009-11-20 12:56:23 +00:00
|
|
|
|
(setq dp2 (get-text-property (point-at-bol) 'day)))
|
|
|
|
|
(calendar-gregorian-from-absolute dp2))))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
|
|
|
|
|
(setq char (read-char-exclusive))
|
|
|
|
|
(cond
|
|
|
|
|
((equal char ?d)
|
|
|
|
|
(setq text (read-string "Day entry: "))
|
2009-11-20 19:35:34 +00:00
|
|
|
|
(org-agenda-add-entry-to-org-agenda-diary-file 'day text d1)
|
|
|
|
|
(and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
((equal char ?a)
|
|
|
|
|
(setq d1 (list (car d1) (nth 1 d1)
|
2009-11-11 15:23:48 +00:00
|
|
|
|
(read-number (format "Reference year [%d]: " (nth 2 d1))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(nth 2 d1))))
|
|
|
|
|
(setq text (read-string "Anniversary (use %d to show years): "))
|
2009-11-20 19:35:34 +00:00
|
|
|
|
(org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1)
|
|
|
|
|
(and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
((equal char ?b)
|
|
|
|
|
(setq text (read-string "Block entry: "))
|
2009-11-10 09:44:25 +00:00
|
|
|
|
(unless (and d1 d2 (not (equal d1 d2)))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No block of days selected"))
|
2009-11-20 19:35:34 +00:00
|
|
|
|
(org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)
|
|
|
|
|
(and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
((equal char ?j)
|
|
|
|
|
(org-switch-to-buffer-other-window
|
|
|
|
|
(find-file-noselect org-agenda-diary-file))
|
2010-01-20 10:43:52 +00:00
|
|
|
|
(require 'org-datetree)
|
2009-11-09 14:24:11 +00:00
|
|
|
|
(org-datetree-find-date-create d1)
|
|
|
|
|
(org-reveal t))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(t (user-error "Invalid selection character `%c'" char)))))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
|
2009-11-19 14:34:43 +00:00
|
|
|
|
(defcustom org-agenda-insert-diary-strategy 'date-tree
|
|
|
|
|
"Where in `org-agenda-diary-file' should new entries be added?
|
|
|
|
|
Valid values:
|
|
|
|
|
|
|
|
|
|
date-tree in the date tree, as child of the date
|
|
|
|
|
top-level as top-level entries at the end of the file."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "in a date tree" date-tree)
|
|
|
|
|
(const :tag "as top level at end of file" top-level)))
|
|
|
|
|
|
2010-03-17 15:54:58 +00:00
|
|
|
|
(defcustom org-agenda-insert-diary-extract-time nil
|
|
|
|
|
"Non-nil means extract any time specification from the diary entry."
|
|
|
|
|
:group 'org-agenda
|
2012-03-19 20:38:12 +00:00
|
|
|
|
:version "24.1"
|
2010-03-17 15:54:58 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2012-05-05 07:07:37 +00:00
|
|
|
|
(defcustom org-agenda-bulk-mark-char ">"
|
|
|
|
|
"A single-character string to be used as the bulk mark."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:version "24.1"
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
|
|
|
|
|
"Add a diary entry with TYPE to `org-agenda-diary-file'.
|
2009-11-12 12:39:29 +00:00
|
|
|
|
If TEXT is not empty, it will become the headline of the new entry, and
|
2009-11-08 15:07:58 +00:00
|
|
|
|
the resulting entry will not be shown. When TEXT is empty, switch to
|
|
|
|
|
`org-agenda-diary-file' and let the user finish the entry there."
|
|
|
|
|
(let ((cw (current-window-configuration)))
|
|
|
|
|
(org-switch-to-buffer-other-window
|
|
|
|
|
(find-file-noselect org-agenda-diary-file))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(cond
|
|
|
|
|
((eq type 'anniversary)
|
|
|
|
|
(or (re-search-forward "^*[ \t]+Anniversaries" nil t)
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(progn
|
|
|
|
|
(or (org-at-heading-p t)
|
|
|
|
|
(progn
|
|
|
|
|
(outline-next-heading)
|
|
|
|
|
(insert "* Anniversaries\n\n")
|
|
|
|
|
(beginning-of-line -1)))))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(outline-next-heading)
|
|
|
|
|
(org-back-over-empty-lines)
|
|
|
|
|
(backward-char 1)
|
|
|
|
|
(insert "\n")
|
2011-06-16 09:05:17 +00:00
|
|
|
|
(insert (format "%%%%(org-anniversary %d %2d %2d) %s"
|
|
|
|
|
(nth 2 d1) (car d1) (nth 1 d1) text)))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
((eq type 'day)
|
2010-03-18 05:36:49 +00:00
|
|
|
|
(let ((org-prefix-has-time t)
|
|
|
|
|
(org-agenda-time-leading-zero t)
|
|
|
|
|
fmt time time2)
|
2010-03-17 15:54:58 +00:00
|
|
|
|
(if org-agenda-insert-diary-extract-time
|
2011-10-22 13:08:33 +00:00
|
|
|
|
;; Use org-agenda-format-item to parse text for a time-range and
|
2010-03-18 05:36:49 +00:00
|
|
|
|
;; remove it. FIXME: This is a hack, we should refactor
|
|
|
|
|
;; that function to make time extraction available separately
|
2012-09-12 09:41:50 +00:00
|
|
|
|
(setq fmt (org-agenda-format-item nil text nil nil nil t)
|
2010-02-03 15:23:41 +00:00
|
|
|
|
time (get-text-property 0 'time fmt)
|
|
|
|
|
time2 (if (> (length time) 0)
|
|
|
|
|
;; split-string removes trailing ...... if
|
|
|
|
|
;; no end time given. First space
|
|
|
|
|
;; separates time from date.
|
|
|
|
|
(concat " " (car (split-string time "\\.")))
|
|
|
|
|
nil)
|
|
|
|
|
text (get-text-property 0 'txt fmt)))
|
|
|
|
|
(if (eq org-agenda-insert-diary-strategy 'top-level)
|
|
|
|
|
(org-agenda-insert-diary-as-top-level text)
|
|
|
|
|
(require 'org-datetree)
|
|
|
|
|
(org-datetree-find-date-create d1)
|
|
|
|
|
(org-agenda-insert-diary-make-new-entry text))
|
|
|
|
|
(org-insert-time-stamp (org-time-from-absolute
|
|
|
|
|
(calendar-absolute-from-gregorian d1))
|
|
|
|
|
nil nil nil nil time2))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(end-of-line 0))
|
|
|
|
|
((eq type 'block)
|
|
|
|
|
(if (> (calendar-absolute-from-gregorian d1)
|
|
|
|
|
(calendar-absolute-from-gregorian d2))
|
|
|
|
|
(setq d1 (prog1 d2 (setq d2 d1))))
|
2009-11-19 14:34:43 +00:00
|
|
|
|
(if (eq org-agenda-insert-diary-strategy 'top-level)
|
|
|
|
|
(org-agenda-insert-diary-as-top-level text)
|
|
|
|
|
(require 'org-datetree)
|
|
|
|
|
(org-datetree-find-date-create d1)
|
|
|
|
|
(org-agenda-insert-diary-make-new-entry text))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(org-insert-time-stamp (org-time-from-absolute
|
|
|
|
|
(calendar-absolute-from-gregorian d1)))
|
|
|
|
|
(insert "--")
|
|
|
|
|
(org-insert-time-stamp (org-time-from-absolute
|
|
|
|
|
(calendar-absolute-from-gregorian d2)))
|
|
|
|
|
(end-of-line 0)))
|
|
|
|
|
(if (string-match "\\S-" text)
|
|
|
|
|
(progn
|
|
|
|
|
(set-window-configuration cw)
|
|
|
|
|
(message "%s entry added to %s"
|
|
|
|
|
(capitalize (symbol-name type))
|
|
|
|
|
(abbreviate-file-name org-agenda-diary-file)))
|
2009-11-10 20:24:42 +00:00
|
|
|
|
(org-reveal t)
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(message "Please finish entry here"))))
|
|
|
|
|
|
2009-11-19 14:34:43 +00:00
|
|
|
|
(defun org-agenda-insert-diary-as-top-level (text)
|
|
|
|
|
"Make new entry as a top-level entry at the end of the file.
|
|
|
|
|
Add TEXT as headline, and position the cursor in the second line so that
|
|
|
|
|
a timestamp can be added there."
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(or (bolp) (insert "\n"))
|
|
|
|
|
(insert "* " text "\n")
|
|
|
|
|
(if org-adapt-indentation (org-indent-to-column 2)))
|
|
|
|
|
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(defun org-agenda-insert-diary-make-new-entry (text)
|
|
|
|
|
"Make new entry as last child of current entry.
|
|
|
|
|
Add TEXT as headline, and position the cursor in the second line so that
|
|
|
|
|
a timestamp can be added there."
|
|
|
|
|
(let ((org-show-following-heading t)
|
|
|
|
|
(org-show-siblings t)
|
|
|
|
|
(org-show-hierarchy-above t)
|
|
|
|
|
(org-show-entry-below t)
|
|
|
|
|
col)
|
|
|
|
|
(outline-next-heading)
|
|
|
|
|
(org-back-over-empty-lines)
|
|
|
|
|
(or (looking-at "[ \t]*$")
|
|
|
|
|
(progn (insert "\n") (backward-char 1)))
|
2010-02-01 13:30:36 +00:00
|
|
|
|
(org-insert-heading nil t)
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(org-do-demote)
|
|
|
|
|
(setq col (current-column))
|
|
|
|
|
(insert text "\n")
|
|
|
|
|
(if org-adapt-indentation (org-indent-to-column col))
|
|
|
|
|
(let ((org-show-following-heading t)
|
|
|
|
|
(org-show-siblings t)
|
|
|
|
|
(org-show-hierarchy-above t)
|
|
|
|
|
(org-show-entry-below t))
|
|
|
|
|
(org-show-context))))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(defun org-agenda-diary-entry ()
|
|
|
|
|
"Make a diary entry, like the `i' command from the calendar.
|
2009-11-08 15:07:58 +00:00
|
|
|
|
All the standard commands work: block, weekly etc.
|
|
|
|
|
When `org-agenda-diary-file' points to a file,
|
|
|
|
|
`org-agenda-diary-entry-in-org-file' is called instead to create
|
|
|
|
|
entries in that Org-mode file."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive)
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(if (not (eq org-agenda-diary-file 'diary-file))
|
|
|
|
|
(org-agenda-diary-entry-in-org-file)
|
|
|
|
|
(require 'diary-lib)
|
|
|
|
|
(let* ((char (progn
|
|
|
|
|
(message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
|
|
|
|
|
(read-char-exclusive)))
|
|
|
|
|
(cmd (cdr (assoc char
|
|
|
|
|
'((?d . insert-diary-entry)
|
|
|
|
|
(?w . insert-weekly-diary-entry)
|
|
|
|
|
(?m . insert-monthly-diary-entry)
|
|
|
|
|
(?y . insert-yearly-diary-entry)
|
|
|
|
|
(?a . insert-anniversary-diary-entry)
|
|
|
|
|
(?b . insert-block-diary-entry)
|
|
|
|
|
(?c . insert-cyclic-diary-entry)))))
|
|
|
|
|
(oldf (symbol-function 'calendar-cursor-to-date))
|
|
|
|
|
;; (buf (get-file-buffer (substitute-in-file-name diary-file)))
|
|
|
|
|
(point (point))
|
|
|
|
|
(mark (or (mark t) (point))))
|
|
|
|
|
(unless cmd
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No command associated with <%c>" char))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(unless (and (get-text-property point 'day)
|
|
|
|
|
(or (not (equal ?b char))
|
|
|
|
|
(get-text-property mark 'day)))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Don't know which date to use for diary entry"))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
;; We implement this by hacking the `calendar-cursor-to-date' function
|
|
|
|
|
;; and the `calendar-mark-ring' variable. Saves a lot of code.
|
|
|
|
|
(let ((calendar-mark-ring
|
|
|
|
|
(list (calendar-gregorian-from-absolute
|
|
|
|
|
(or (get-text-property mark 'day)
|
|
|
|
|
(get-text-property point 'day))))))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(fset 'calendar-cursor-to-date
|
|
|
|
|
(lambda (&optional error dummy)
|
|
|
|
|
(calendar-gregorian-from-absolute
|
|
|
|
|
(get-text-property point 'day))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(call-interactively cmd))
|
2009-11-08 15:07:58 +00:00
|
|
|
|
(fset 'calendar-cursor-to-date oldf))))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-execute-calendar-command (cmd)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
"Execute a calendar command from the agenda with date from cursor."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
|
|
|
|
(require 'diary-lib)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(unless (get-text-property (min (1- (point-max)) (point)) 'day)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Don't know which date to use for the calendar command"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(let* ((oldf (symbol-function 'calendar-cursor-to-date))
|
|
|
|
|
(point (point))
|
|
|
|
|
(date (calendar-gregorian-from-absolute
|
|
|
|
|
(get-text-property point 'day)))
|
2008-04-07 18:54:39 +00:00
|
|
|
|
;; the following 2 vars are needed in the calendar
|
|
|
|
|
(displayed-month (car date))
|
|
|
|
|
(displayed-year (nth 2 date)))
|
2012-08-11 17:10:44 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(fset 'calendar-cursor-to-date
|
|
|
|
|
(lambda (&optional error dummy)
|
|
|
|
|
(calendar-gregorian-from-absolute
|
|
|
|
|
(get-text-property point 'day))))
|
|
|
|
|
(call-interactively cmd))
|
|
|
|
|
(fset 'calendar-cursor-to-date oldf))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-phases-of-moon ()
|
|
|
|
|
"Display the phases of the moon for the 3 months around the cursor date."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-execute-calendar-command 'calendar-phases-of-moon))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-holidays ()
|
|
|
|
|
"Display the holidays for the 3 months around the cursor date."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-execute-calendar-command 'list-calendar-holidays))
|
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar calendar-longitude) ; defined in calendar.el
|
|
|
|
|
(defvar calendar-latitude) ; defined in calendar.el
|
|
|
|
|
(defvar calendar-location-name) ; defined in calendar.el
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-sunrise-sunset (arg)
|
|
|
|
|
"Display sunrise and sunset for the cursor date.
|
|
|
|
|
Latitude and longitude can be specified with the variables
|
|
|
|
|
`calendar-latitude' and `calendar-longitude'. When called with prefix
|
|
|
|
|
argument, latitude and longitude will be prompted for."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(require 'solar)
|
|
|
|
|
(let ((calendar-longitude (if arg nil calendar-longitude))
|
|
|
|
|
(calendar-latitude (if arg nil calendar-latitude))
|
|
|
|
|
(calendar-location-name
|
|
|
|
|
(if arg "the given coordinates" calendar-location-name)))
|
|
|
|
|
(org-agenda-execute-calendar-command 'calendar-sunrise-sunset)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-goto-calendar ()
|
|
|
|
|
"Open the Emacs calendar with the date at the cursor."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(let* ((day (or (get-text-property (min (1- (point-max)) (point)) 'day)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Don't know which date to open in calendar")))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(date (calendar-gregorian-from-absolute day))
|
|
|
|
|
(calendar-move-hook nil)
|
2008-04-07 18:54:39 +00:00
|
|
|
|
(calendar-view-holidays-initially-flag nil)
|
2010-04-18 14:42:23 +00:00
|
|
|
|
(calendar-view-diary-initially-flag nil))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(calendar)
|
|
|
|
|
(calendar-goto-date date)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-calendar-goto-agenda ()
|
|
|
|
|
"Compute the Org-mode agenda for the calendar date displayed at the cursor.
|
|
|
|
|
This is a command that has to be installed in `calendar-mode-map'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-list nil (calendar-absolute-from-gregorian
|
|
|
|
|
(calendar-cursor-to-date))
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-convert-date ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-check-type t 'agenda 'timeline)
|
2012-09-29 06:09:21 +00:00
|
|
|
|
(let ((day (get-text-property (min (1- (point-max)) (point)) 'day))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
date s)
|
|
|
|
|
(unless day
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Don't know which date to convert"))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq date (calendar-gregorian-from-absolute day))
|
|
|
|
|
(setq s (concat
|
|
|
|
|
"Gregorian: " (calendar-date-string date) "\n"
|
|
|
|
|
"ISO: " (calendar-iso-date-string date) "\n"
|
|
|
|
|
"Day of Yr: " (calendar-day-of-year-string date) "\n"
|
|
|
|
|
"Julian: " (calendar-julian-date-string date) "\n"
|
|
|
|
|
"Astron. JD: " (calendar-astro-date-string date)
|
|
|
|
|
" (Julian date number at noon UTC)\n"
|
|
|
|
|
"Hebrew: " (calendar-hebrew-date-string date) " (until sunset)\n"
|
|
|
|
|
"Islamic: " (calendar-islamic-date-string date) " (until sunset)\n"
|
|
|
|
|
"French: " (calendar-french-date-string date) "\n"
|
|
|
|
|
"Baha'i: " (calendar-bahai-date-string date) " (until sunset)\n"
|
|
|
|
|
"Mayan: " (calendar-mayan-date-string date) "\n"
|
|
|
|
|
"Coptic: " (calendar-coptic-date-string date) "\n"
|
|
|
|
|
"Ethiopic: " (calendar-ethiopic-date-string date) "\n"
|
|
|
|
|
"Persian: " (calendar-persian-date-string date) "\n"
|
|
|
|
|
"Chinese: " (calendar-chinese-date-string date) "\n"))
|
|
|
|
|
(with-output-to-temp-buffer "*Dates*"
|
|
|
|
|
(princ s))
|
2008-11-03 12:38:25 +00:00
|
|
|
|
(org-fit-window-to-buffer (get-buffer-window "*Dates*"))))
|
2009-06-22 19:54:42 +00:00
|
|
|
|
|
|
|
|
|
;;; Bulk commands
|
|
|
|
|
|
2009-08-07 05:22:22 +00:00
|
|
|
|
(defun org-agenda-bulk-marked-p ()
|
|
|
|
|
(eq (get-char-property (point-at-bol) 'type)
|
|
|
|
|
'org-marked-entry-overlay))
|
|
|
|
|
|
2010-12-03 22:38:35 +00:00
|
|
|
|
(defun org-agenda-bulk-mark (&optional arg)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
"Mark the entry at point for future bulk action."
|
2010-12-03 22:38:35 +00:00
|
|
|
|
(interactive "p")
|
2012-04-16 07:29:49 +00:00
|
|
|
|
(dotimes (i (or arg 1))
|
2010-12-03 22:38:35 +00:00
|
|
|
|
(unless (org-get-at-bol 'org-agenda-diary-link)
|
|
|
|
|
(let* ((m (org-get-at-bol 'org-hd-marker))
|
|
|
|
|
ov)
|
|
|
|
|
(unless (org-agenda-bulk-marked-p)
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(unless m (user-error "Nothing to mark at point"))
|
2010-12-03 22:38:35 +00:00
|
|
|
|
(push m org-agenda-bulk-marked-entries)
|
|
|
|
|
(setq ov (make-overlay (point-at-bol) (+ 2 (point-at-bol))))
|
2012-05-05 07:07:37 +00:00
|
|
|
|
(org-overlay-display ov (concat org-agenda-bulk-mark-char " ")
|
2010-12-03 22:38:35 +00:00
|
|
|
|
(org-get-todo-face "TODO")
|
|
|
|
|
'evaporate)
|
|
|
|
|
(overlay-put ov 'type 'org-marked-entry-overlay))
|
|
|
|
|
(beginning-of-line 2)
|
|
|
|
|
(while (and (get-char-property (point) 'invisible) (not (eobp)))
|
|
|
|
|
(beginning-of-line 2))
|
|
|
|
|
(message "%d entries marked for bulk action"
|
|
|
|
|
(length org-agenda-bulk-marked-entries))))))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(defun org-agenda-bulk-mark-all ()
|
|
|
|
|
"Mark all entries for future agenda bulk action."
|
|
|
|
|
(interactive)
|
|
|
|
|
(org-agenda-bulk-mark-regexp "."))
|
|
|
|
|
|
2011-02-03 19:03:51 +00:00
|
|
|
|
(defun org-agenda-bulk-mark-regexp (regexp)
|
2012-05-05 07:21:22 +00:00
|
|
|
|
"Mark entries matching REGEXP for future agenda bulk action."
|
2011-02-13 16:40:08 +00:00
|
|
|
|
(interactive "sMark entries matching regexp: ")
|
2012-05-01 08:04:31 +00:00
|
|
|
|
(let ((entries-marked 0))
|
2011-02-13 16:40:08 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(goto-char (next-single-property-change (point) 'txt))
|
|
|
|
|
(while (re-search-forward regexp nil t)
|
|
|
|
|
(when (string-match regexp (get-text-property (point) 'txt))
|
2012-05-01 08:04:31 +00:00
|
|
|
|
(setq entries-marked (1+ entries-marked))
|
2011-02-13 16:40:08 +00:00
|
|
|
|
(call-interactively 'org-agenda-bulk-mark))))
|
2011-03-10 09:42:57 +00:00
|
|
|
|
(if (not entries-marked)
|
2011-02-13 16:40:08 +00:00
|
|
|
|
(message "No entry matching this regexp."))))
|
2011-02-03 19:03:51 +00:00
|
|
|
|
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(defun org-agenda-bulk-unmark (&optional arg)
|
2009-06-26 07:27:08 +00:00
|
|
|
|
"Unmark the entry at point for future bulk action."
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if arg
|
|
|
|
|
(org-agenda-bulk-unmark-all)
|
|
|
|
|
(cond ((org-agenda-bulk-marked-p)
|
|
|
|
|
(org-agenda-bulk-remove-overlays
|
|
|
|
|
(point-at-bol) (+ 2 (point-at-bol)))
|
|
|
|
|
(setq org-agenda-bulk-marked-entries
|
|
|
|
|
(delete (org-get-at-bol 'org-hd-marker)
|
|
|
|
|
org-agenda-bulk-marked-entries))
|
|
|
|
|
(beginning-of-line 2)
|
|
|
|
|
(while (and (get-char-property (point) 'invisible) (not (eobp)))
|
|
|
|
|
(beginning-of-line 2))
|
|
|
|
|
(message "%d entries left marked for bulk action"
|
|
|
|
|
(length org-agenda-bulk-marked-entries)))
|
|
|
|
|
(t (message "No entry to unmark here")))))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
|
2009-08-07 05:22:22 +00:00
|
|
|
|
(defun org-agenda-bulk-toggle ()
|
2012-08-11 17:10:44 +00:00
|
|
|
|
"Toggle marking the entry at point for bulk action."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (org-agenda-bulk-marked-p)
|
|
|
|
|
(org-agenda-bulk-unmark)
|
|
|
|
|
(org-agenda-bulk-mark)))
|
2009-06-26 07:27:08 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-bulk-remove-overlays (&optional beg end)
|
2009-06-22 19:54:42 +00:00
|
|
|
|
"Remove the mark overlays between BEG and END in the agenda buffer.
|
|
|
|
|
BEG and END default to the buffer limits.
|
|
|
|
|
|
|
|
|
|
This only removes the overlays, it does not remove the markers
|
2009-06-26 07:27:08 +00:00
|
|
|
|
from the list in `org-agenda-bulk-marked-entries'."
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(mapc (lambda (ov)
|
2010-04-18 14:37:42 +00:00
|
|
|
|
(and (eq (overlay-get ov 'type) 'org-marked-entry-overlay)
|
|
|
|
|
(delete-overlay ov)))
|
2010-04-20 10:17:06 +00:00
|
|
|
|
(overlays-in (or beg (point-min)) (or end (point-max)))))
|
2009-06-22 19:54:42 +00:00
|
|
|
|
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(defun org-agenda-bulk-unmark-all ()
|
2009-06-22 19:54:42 +00:00
|
|
|
|
"Remove all marks in the agenda buffer.
|
2012-05-05 07:21:22 +00:00
|
|
|
|
This will remove the markers and the overlays."
|
2009-06-22 19:54:42 +00:00
|
|
|
|
(interactive)
|
2012-05-05 07:21:22 +00:00
|
|
|
|
(if (null org-agenda-bulk-marked-entries)
|
|
|
|
|
(message "No entry to unmark")
|
|
|
|
|
(mapc (lambda (m) (move-marker m nil)) org-agenda-bulk-marked-entries)
|
|
|
|
|
(setq org-agenda-bulk-marked-entries nil)
|
|
|
|
|
(org-agenda-bulk-remove-overlays (point-min) (point-max))))
|
2009-06-22 19:54:42 +00:00
|
|
|
|
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(defcustom org-agenda-persistent-marks nil
|
|
|
|
|
"Non-nil means marked items will stay marked after a bulk action.
|
2012-08-20 06:02:36 +00:00
|
|
|
|
You can toggle this interactively by typing `p' when prompted for a
|
|
|
|
|
bulk action."
|
2012-04-24 16:09:39 +00:00
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:version "24.1"
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2010-01-14 16:09:11 +00:00
|
|
|
|
(defun org-agenda-bulk-action (&optional arg)
|
|
|
|
|
"Execute an remote-editing action on all marked entries.
|
|
|
|
|
The prefix arg is passed through to the command if possible."
|
|
|
|
|
(interactive "P")
|
2011-04-13 07:57:49 +00:00
|
|
|
|
;; Make sure we have markers, and only valid ones
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(unless org-agenda-bulk-marked-entries (user-error "No entries are marked"))
|
2011-04-13 07:57:49 +00:00
|
|
|
|
(mapc
|
|
|
|
|
(lambda (m)
|
|
|
|
|
(unless (and (markerp m)
|
|
|
|
|
(marker-buffer m)
|
|
|
|
|
(buffer-live-p (marker-buffer m))
|
|
|
|
|
(marker-position m))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Marker %s for bulk command is invalid" m)))
|
2011-04-16 16:05:51 +00:00
|
|
|
|
org-agenda-bulk-marked-entries)
|
2011-04-13 07:57:49 +00:00
|
|
|
|
|
|
|
|
|
;; Prompt for the bulk command
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(let* ((msg (if org-agenda-persistent-marks "Bulk (persistent): " "Bulk: ")))
|
2012-09-02 09:21:13 +00:00
|
|
|
|
(message (concat msg "[$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [d]eadline [r]efile "
|
|
|
|
|
"[S]catter [f]unction "
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(when org-agenda-bulk-custom-functions
|
|
|
|
|
(concat " Custom: ["
|
|
|
|
|
(mapconcat (lambda(f) (char-to-string (car f)))
|
|
|
|
|
org-agenda-bulk-custom-functions "")
|
|
|
|
|
"]"))))
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(let* ((action (read-char-exclusive))
|
|
|
|
|
(org-log-refile (if org-log-refile 'time nil))
|
|
|
|
|
(entries (reverse org-agenda-bulk-marked-entries))
|
2012-09-02 09:24:16 +00:00
|
|
|
|
(org-overriding-default-time
|
|
|
|
|
(if (get-text-property (point) 'org-agenda-date-header)
|
|
|
|
|
(org-get-cursor-date)))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
redo-at-end
|
|
|
|
|
cmd rfloc state e tag pos (cnt 0) (cntskip 0))
|
|
|
|
|
(cond
|
|
|
|
|
((equal action ?p)
|
|
|
|
|
(let ((org-agenda-persistent-marks
|
|
|
|
|
(not org-agenda-persistent-marks)))
|
|
|
|
|
(org-agenda-bulk-action)
|
|
|
|
|
(throw 'exit nil)))
|
|
|
|
|
|
|
|
|
|
((equal action ?$)
|
|
|
|
|
(setq cmd '(org-agenda-archive)))
|
|
|
|
|
|
|
|
|
|
((equal action ?A)
|
|
|
|
|
(setq cmd '(org-agenda-archive-to-archive-sibling)))
|
|
|
|
|
|
|
|
|
|
((member action '(?r ?w))
|
|
|
|
|
(setq rfloc (org-refile-get-location
|
|
|
|
|
"Refile to"
|
2012-09-02 10:02:13 +00:00
|
|
|
|
(marker-buffer (car entries))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
org-refile-allow-creating-parent-nodes))
|
|
|
|
|
(if (nth 3 rfloc)
|
|
|
|
|
(setcar (nthcdr 3 rfloc)
|
|
|
|
|
(move-marker (make-marker) (nth 3 rfloc)
|
|
|
|
|
(or (get-file-buffer (nth 1 rfloc))
|
|
|
|
|
(find-buffer-visiting (nth 1 rfloc))
|
|
|
|
|
(error "This should not happen")))))
|
|
|
|
|
|
|
|
|
|
(setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t)
|
|
|
|
|
redo-at-end t))
|
|
|
|
|
|
|
|
|
|
((equal action ?t)
|
|
|
|
|
(setq state (org-icompleting-read
|
|
|
|
|
"Todo state: "
|
|
|
|
|
(with-current-buffer (marker-buffer (car entries))
|
|
|
|
|
(mapcar 'list org-todo-keywords-1))))
|
|
|
|
|
(setq cmd `(let ((org-inhibit-blocking t)
|
|
|
|
|
(org-inhibit-logging 'note))
|
|
|
|
|
(org-agenda-todo ,state))))
|
|
|
|
|
|
|
|
|
|
((memq action '(?- ?+))
|
|
|
|
|
(setq tag (org-icompleting-read
|
|
|
|
|
(format "Tag to %s: " (if (eq action ?+) "add" "remove"))
|
|
|
|
|
(with-current-buffer (marker-buffer (car entries))
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar (lambda (x)
|
|
|
|
|
(if (stringp (car x)) x)) org-tag-alist)))))
|
|
|
|
|
(setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off))))
|
|
|
|
|
|
|
|
|
|
((memq action '(?s ?d))
|
2012-09-12 23:21:26 +00:00
|
|
|
|
(let* ((time
|
2012-09-12 07:48:21 +00:00
|
|
|
|
(unless arg
|
2012-09-12 23:21:26 +00:00
|
|
|
|
(org-read-date
|
|
|
|
|
nil nil nil
|
|
|
|
|
(if (eq action ?s) "(Re)Schedule to" "(Re)Set Deadline to")
|
|
|
|
|
org-overriding-default-time)))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline)))
|
2012-09-12 23:21:26 +00:00
|
|
|
|
(setq cmd `(eval '(,c1 arg ,time)))))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
|
|
|
|
|
((equal action ?S)
|
|
|
|
|
(if (not (org-agenda-check-type nil 'agenda 'timeline 'todo))
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "Can't scatter tasks in \"%s\" agenda view" org-agenda-type)
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(let ((days (read-number
|
|
|
|
|
(format "Scatter tasks across how many %sdays: "
|
|
|
|
|
(if arg "week" "")) 7)))
|
|
|
|
|
(setq cmd
|
|
|
|
|
`(let ((distance (1+ (random ,days))))
|
|
|
|
|
(if arg
|
|
|
|
|
(let ((dist distance)
|
|
|
|
|
(day-of-week
|
|
|
|
|
(calendar-day-of-week
|
|
|
|
|
(calendar-gregorian-from-absolute (org-today)))))
|
|
|
|
|
(dotimes (i (1+ dist))
|
|
|
|
|
(while (member day-of-week org-agenda-weekend-days)
|
|
|
|
|
(incf distance)
|
|
|
|
|
(incf day-of-week)
|
|
|
|
|
(if (= day-of-week 7)
|
|
|
|
|
(setq day-of-week 0)))
|
|
|
|
|
(incf day-of-week)
|
|
|
|
|
(if (= day-of-week 7)
|
|
|
|
|
(setq day-of-week 0)))))
|
|
|
|
|
;; silently fail when try to replan a sexp entry
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(let* ((date (calendar-gregorian-from-absolute
|
|
|
|
|
(+ (org-today) distance)))
|
|
|
|
|
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date)
|
|
|
|
|
(nth 2 date))))
|
|
|
|
|
(org-agenda-schedule nil time))
|
|
|
|
|
(error nil)))))))
|
|
|
|
|
|
|
|
|
|
((assoc action org-agenda-bulk-custom-functions)
|
|
|
|
|
(setq cmd (list (cadr (assoc action org-agenda-bulk-custom-functions)))
|
|
|
|
|
redo-at-end t))
|
|
|
|
|
|
|
|
|
|
((equal action ?f)
|
|
|
|
|
(setq cmd (list (intern
|
|
|
|
|
(org-icompleting-read "Function: "
|
|
|
|
|
obarray 'fboundp t nil nil)))))
|
|
|
|
|
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(t (user-error "Invalid bulk action")))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
|
|
|
|
|
;; Sort the markers, to make sure that parents are handled before children
|
|
|
|
|
(setq entries (sort entries
|
|
|
|
|
(lambda (a b)
|
|
|
|
|
(cond
|
|
|
|
|
((equal (marker-buffer a) (marker-buffer b))
|
|
|
|
|
(< (marker-position a) (marker-position b)))
|
|
|
|
|
(t
|
|
|
|
|
(string< (buffer-name (marker-buffer a))
|
|
|
|
|
(buffer-name (marker-buffer b))))))))
|
|
|
|
|
|
|
|
|
|
;; Now loop over all markers and apply cmd
|
|
|
|
|
(while (setq e (pop entries))
|
|
|
|
|
(setq pos (text-property-any (point-min) (point-max) 'org-hd-marker e))
|
|
|
|
|
(if (not pos)
|
|
|
|
|
(progn (message "Skipping removed entry at %s" e)
|
|
|
|
|
(setq cntskip (1+ cntskip)))
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(let (org-loop-over-headlines-in-active-region)
|
|
|
|
|
(eval cmd))
|
|
|
|
|
(setq cnt (1+ cnt))))
|
|
|
|
|
(when redo-at-end (org-agenda-redo))
|
2012-09-02 09:26:27 +00:00
|
|
|
|
(unless org-agenda-persistent-marks
|
|
|
|
|
(org-agenda-bulk-unmark-all))
|
2012-04-24 16:09:39 +00:00
|
|
|
|
(message "Acted on %d entries%s%s"
|
|
|
|
|
cnt
|
|
|
|
|
(if (= cntskip 0)
|
|
|
|
|
""
|
|
|
|
|
(format ", skipped %d (disappeared before their turn)"
|
|
|
|
|
cntskip))
|
|
|
|
|
(if (not org-agenda-persistent-marks)
|
|
|
|
|
"" " (kept marked)"))))))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
|
2012-12-12 14:21:10 +00:00
|
|
|
|
(defun org-agenda-capture (&optional with-time)
|
|
|
|
|
"Call `org-capture' with the date at point.
|
|
|
|
|
With a `C-1' prefix, use the HH:MM value at point (if any) or the
|
|
|
|
|
current HH:MM time."
|
|
|
|
|
(interactive "P")
|
2012-09-02 10:52:38 +00:00
|
|
|
|
(if (not (eq major-mode 'org-agenda-mode))
|
2012-12-12 14:21:10 +00:00
|
|
|
|
(user-error "You cannot do this outside of agenda buffers")
|
2012-09-02 10:52:38 +00:00
|
|
|
|
(let ((org-overriding-default-time
|
2012-12-12 14:21:10 +00:00
|
|
|
|
(org-get-cursor-date (equal with-time 1))))
|
2012-09-02 10:52:38 +00:00
|
|
|
|
(call-interactively 'org-capture))))
|
|
|
|
|
|
2009-09-15 21:55:17 +00:00
|
|
|
|
;;; Flagging notes
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-show-the-flagging-note ()
|
|
|
|
|
"Display the flagging note in the other window.
|
|
|
|
|
When called a second time in direct sequence, offer to remove the FLAGGING
|
|
|
|
|
tag and (if present) the flagging note."
|
|
|
|
|
(interactive)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(let ((hdmarker (org-get-at-bol 'org-hd-marker))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(win (selected-window))
|
|
|
|
|
note heading newhead)
|
|
|
|
|
(unless hdmarker
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No linked entry at point"))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(if (and (eq this-command last-command)
|
|
|
|
|
(y-or-n-p "Unflag and remove any flagging note? "))
|
|
|
|
|
(progn
|
|
|
|
|
(org-agenda-remove-flag hdmarker)
|
|
|
|
|
(let ((win (get-buffer-window "*Flagging Note*")))
|
|
|
|
|
(and win (delete-window win)))
|
2012-01-10 10:56:15 +00:00
|
|
|
|
(message "Entry unflagged"))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(setq note (org-entry-get hdmarker "THEFLAGGINGNOTE"))
|
|
|
|
|
(unless note
|
2013-04-10 12:38:27 +00:00
|
|
|
|
(user-error "No flagging note"))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(org-kill-new note)
|
|
|
|
|
(org-switch-to-buffer-other-window "*Flagging Note*")
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert note)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward "\\\\n" nil t)
|
|
|
|
|
(replace-match "\n" t t))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(select-window win)
|
|
|
|
|
(message "Flagging note pushed to kill ring. Press [?] again to remove tag and note"))))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-remove-flag (marker)
|
2009-11-12 12:39:29 +00:00
|
|
|
|
"Remove the FLAGGED tag and any flagging note in the entry."
|
2009-09-15 21:55:17 +00:00
|
|
|
|
(let (newhead)
|
|
|
|
|
(org-with-point-at marker
|
|
|
|
|
(org-toggle-tag "FLAGGED" 'off)
|
|
|
|
|
(org-entry-delete nil "THEFLAGGINGNOTE")
|
|
|
|
|
(setq newhead (org-get-heading)))
|
|
|
|
|
(org-agenda-change-all-lines newhead marker)
|
2012-01-10 10:56:15 +00:00
|
|
|
|
(message "Entry unflagged")))
|
2009-09-15 21:55:17 +00:00
|
|
|
|
|
|
|
|
|
(defun org-agenda-get-any-marker (&optional pos)
|
2009-09-25 08:48:59 +00:00
|
|
|
|
(or (get-text-property (or pos (point-at-bol)) 'org-hd-marker)
|
|
|
|
|
(get-text-property (or pos (point-at-bol)) 'org-marker)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Appointment reminders
|
|
|
|
|
|
2012-08-30 04:39:35 +00:00
|
|
|
|
(defvar appt-time-msg-list) ; defined in appt.el
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2011-10-23 21:21:34 +00:00
|
|
|
|
(defun org-agenda-to-appt (&optional refresh filter &rest args)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
"Activate appointments found in `org-agenda-files'.
|
|
|
|
|
With a \\[universal-argument] prefix, refresh the list of
|
2008-12-16 14:25:23 +00:00
|
|
|
|
appointments.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
|
|
If FILTER is t, interactively prompt the user for a regular
|
|
|
|
|
expression, and filter out entries that don't match it.
|
|
|
|
|
|
|
|
|
|
If FILTER is a string, use this string as a regular expression
|
|
|
|
|
for filtering entries out.
|
|
|
|
|
|
2011-10-23 21:21:34 +00:00
|
|
|
|
If FILTER is a function, filter out entries against which
|
|
|
|
|
calling the function returns nil. This function takes one
|
|
|
|
|
argument: an entry from `org-agenda-get-day-entries'.
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
FILTER can also be an alist with the car of each cell being
|
|
|
|
|
either 'headline or 'category. For example:
|
|
|
|
|
|
|
|
|
|
'((headline \"IMPORTANT\")
|
|
|
|
|
(category \"Work\"))
|
|
|
|
|
|
|
|
|
|
will only add headlines containing IMPORTANT or headlines
|
2011-10-23 21:21:34 +00:00
|
|
|
|
belonging to the \"Work\" category.
|
|
|
|
|
|
|
|
|
|
ARGS are symbols indicating what kind of entries to consider.
|
2013-03-11 16:27:33 +00:00
|
|
|
|
By default `org-agenda-to-appt' will use :deadline*, :scheduled*
|
|
|
|
|
\(i.e., deadlines and scheduled items with a hh:mm specification)
|
2011-10-23 21:21:34 +00:00
|
|
|
|
and :timestamp entries. See the docstring of `org-diary' for
|
2012-08-01 14:05:47 +00:00
|
|
|
|
details and examples.
|
|
|
|
|
|
2013-02-20 15:30:48 +00:00
|
|
|
|
If an entry has a APPT_WARNTIME property, its value will be used
|
2012-08-01 14:05:47 +00:00
|
|
|
|
to override `appt-message-warning-time'."
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if refresh (setq appt-time-msg-list nil))
|
|
|
|
|
(if (eq filter t)
|
|
|
|
|
(setq filter (read-from-minibuffer "Regexp filter: ")))
|
|
|
|
|
(let* ((cnt 0) ; count added events
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(scope (or args '(:deadline* :scheduled* :timestamp)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(org-agenda-new-buffers nil)
|
|
|
|
|
(org-deadline-warning-days 0)
|
2010-11-29 19:18:31 +00:00
|
|
|
|
;; Do not use `org-today' here because appt only takes
|
2010-11-12 15:34:24 +00:00
|
|
|
|
;; time and without date as argument, so it may pass wrong
|
|
|
|
|
;; information otherwise
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(today (org-date-to-gregorian
|
|
|
|
|
(time-to-days (current-time))))
|
2009-05-21 16:47:33 +00:00
|
|
|
|
(org-agenda-restrict nil)
|
2012-04-16 22:52:39 +00:00
|
|
|
|
(files (org-agenda-files 'unrestricted)) entries file
|
|
|
|
|
(org-agenda-buffer nil))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; Get all entries which may contain an appt
|
2012-08-28 11:11:12 +00:00
|
|
|
|
(org-agenda-prepare-buffers files)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(while (setq file (pop files))
|
|
|
|
|
(setq entries
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(delq nil
|
2011-10-23 21:21:34 +00:00
|
|
|
|
(append entries
|
2011-12-31 16:10:44 +00:00
|
|
|
|
(apply 'org-agenda-get-day-entries
|
2011-10-23 21:21:34 +00:00
|
|
|
|
file today scope)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; Map thru entries and find if we should filter them out
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda(x)
|
2013-03-11 16:27:33 +00:00
|
|
|
|
(let* ((evt (org-trim
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
org-bracket-link-regexp "\\3"
|
|
|
|
|
(or (get-text-property 1 'txt x) ""))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(cat (get-text-property 1 'org-category x))
|
|
|
|
|
(tod (get-text-property 1 'time-of-day x))
|
|
|
|
|
(ok (or (null filter)
|
|
|
|
|
(and (stringp filter) (string-match filter evt))
|
2011-10-23 21:21:34 +00:00
|
|
|
|
(and (functionp filter) (funcall filter x))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(and (listp filter)
|
2011-10-24 18:52:45 +00:00
|
|
|
|
(let ((cat-filter (cadr (assoc 'category filter)))
|
|
|
|
|
(evt-filter (cadr (assoc 'headline filter))))
|
|
|
|
|
(or (and (stringp cat-filter)
|
|
|
|
|
(string-match cat-filter cat))
|
|
|
|
|
(and (stringp evt-filter)
|
2012-08-01 14:05:47 +00:00
|
|
|
|
(string-match evt-filter evt)))))))
|
2012-08-19 19:48:52 +00:00
|
|
|
|
(wrn (get-text-property 1 'warntime x)))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
;; FIXME: Shall we remove text-properties for the appt text?
|
|
|
|
|
;; (setq evt (set-text-properties 0 (length evt) nil evt))
|
|
|
|
|
(when (and ok tod)
|
2008-09-22 06:40:32 +00:00
|
|
|
|
(setq tod (concat "00" (number-to-string tod))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
tod (when (string-match
|
2008-09-22 06:40:32 +00:00
|
|
|
|
"\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)\\'" tod)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(concat (match-string 1 tod) ":"
|
|
|
|
|
(match-string 2 tod))))
|
2012-08-01 14:05:47 +00:00
|
|
|
|
(if (version< emacs-version "23.3")
|
|
|
|
|
(appt-add tod evt)
|
|
|
|
|
(appt-add tod evt wrn))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(setq cnt (1+ cnt))))) entries)
|
|
|
|
|
(org-release-buffers org-agenda-new-buffers)
|
|
|
|
|
(if (eq cnt 0)
|
|
|
|
|
(message "No event to add")
|
|
|
|
|
(message "Added %d event%s for today" cnt (if (> cnt 1) "s" "")))))
|
|
|
|
|
|
2008-09-13 17:59:23 +00:00
|
|
|
|
(defun org-agenda-todayp (date)
|
|
|
|
|
"Does DATE mean today, when considering `org-extend-today-until'?"
|
2010-11-29 19:18:31 +00:00
|
|
|
|
(let ((today (org-today))
|
2010-11-12 15:34:24 +00:00
|
|
|
|
(date (if (and date (listp date)) (calendar-absolute-from-gregorian date)
|
|
|
|
|
date)))
|
|
|
|
|
(eq date today)))
|
2008-09-13 17:59:23 +00:00
|
|
|
|
|
2011-08-15 07:39:52 +00:00
|
|
|
|
(defun org-agenda-todo-yesterday (&optional arg)
|
2012-07-30 08:08:15 +00:00
|
|
|
|
"Like `org-agenda-todo' but the time of change will be 23:59 of yesterday."
|
2011-08-15 07:39:52 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let* ((hour (third (decode-time
|
|
|
|
|
(org-current-time))))
|
|
|
|
|
(org-extend-today-until (1+ hour)))
|
|
|
|
|
(org-agenda-todo arg)))
|
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
|
(provide 'org-agenda)
|
|
|
|
|
|
2008-04-29 05:15:41 +00:00
|
|
|
|
;;; org-agenda.el ends here
|