Mercurial > emacs
comparison lisp/org/org-agenda.el @ 105973:b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-clone-subtree-with-time-shift): Make it work at the
end of the buffer.
* org-mobile.el (org-mobile-write-checksums): Specify coding
system.
(org-mobile-timestamp-buffer): Keep local variable/mode line at
beginning of buffer.
* org-latex.el (org-latex-entities-regexp): Fix typo in regexp.
* org.el (org-block-todo-from-children-or-siblings-or-parent)
(org-block-todo-from-checkboxes): Do not block changes to a nil
TODO state.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-habit.el (org-habit-parse-todo): Indicate which habit is
wrongly set up in the error messages.
* org-colview.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
* org-colview-xemacs.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-format-drawer-function): New variable.
(org-export-format-drawer): New function.
(org-export-preprocess-string): Pass the backend as a parameter to
`org-export-remove-or-extract-drawers'.
(org-export-remove-or-extract-drawers): New parameter BACKEND.
* org-protocol.el (org-protocol-char-to-string): New defsubst.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file): Add error
message when no block is selected.
* org-latex.el (org-export-latex-links): Check for protectedness
in the last matched character, not after the match.
* org-datetree.el (org-datetree-find-date-create): Respect
restriction when KEEP-RESTRICTION is set.
(org-datetree-file-entry-under): New function.
(org-datetree-cleanup): New command.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-src.el (org-edit-src-code): New optional argument context
allows calling functions to avoid altering the saved window
configuration.
(org-edit-src-exit): Do not restore window configuration when this
function is used in the context of saving the edit buffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-out, org-clock-cancel): Revert to
instances to switching to with-current-buffer, because these seem
to cause problems - no idea why.
* org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
Require diary-lib for (diary-date-display-form).
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-log-reschedule, org-log-redeadline): New options.
(org-log-note-headings): Add templates for rescheduling and
deadline changing.
(org-startup-options): Add in-buffer settings for logging changing
schedule and deadline time stamps.
(org-deadline, org-schedule): Check for existing date and arrange
for logging if the user requests it.
(org-add-log-note): Prepare proper note buffers for rescheduling
and deadline changes.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file)
(org-agenda-add-entry-to-org-agenda-diary-file)
(org-agenda-insert-diary-make-new-entry): New functions.
(org-agenda-diary-entry): Call
`org-agenda-diary-entry-in-org-file' when appropriate.
* org.el (org-calendar-insert-diary-entry-key): New option.
(org-agenda-diary-file): New option.
("calendar"): Install our insertion function in the calendar.
* org-remember.el (org-datetree): Require.
(org-remember-templates): Add new positioning option.
(org-remember-reference-date): New variable.
(org-remember-apply-template): Store the reference date in a local
variable.
(org-remember-handler): Implement date tree positioning of entries.
* org-datetree.el: New file.
* org-latex.el (org-export-latex-preprocess): Protect targets in
verbatim emphasis.
* org-html.el (org-export-as-html): Protect targets in verbatim
emphasis.
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-show-notification): Handle messages that
contain a percent character.
* org-remember.el (org-remember-apply-template): Turn of partial
completion.
* org-mobile.el (org-mobile-before-process-capture-hook): New hook.
(org-mobile-pull): Run `org-mobile-before-process-capture-hook'.
* org.el (org-indent-mode): Define variable already in org.el.
(org-unfontify-region): Remove line-prefix and wrap-prefix
properties only if org-indent-mode is active.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Save match data
around call to verify function.
(org-print-icalendar-entries): Add a call to the verification
function.
* org.el (org-speedbar-set-agenda-restriction): Remove unnecessary
save-restrivtion' form.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp.el (org-export-format-source-code-or-example): restrict
scope of preserve-indentp to the let binding.
(org-src): require org-src, since org-src-preserve-indentation is used.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-timer.el (org-timer-set-timer): Set variables
org-timer-timer[123] correctly.
* org-mobile.el (org-mobile-files-alist): Make it work when
`agenda-archives' is included in
`org-agenda-text-search-extra-files'.
(org-mobile-push): Restore agenda after mobile push.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Another fix to the
way the amount of idle time is presented in the minibuffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Use
org-icalendar-verify-function only if non-nil.
* org.el (org-refile): Refile to clock only if the prefix arg is
2.
(org-sparse-tree): Fix docstring to be in line with prompt.
(org-update-parent-todo-statistics): Call
`org-after-todo-statistics-hook' on each level.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-apply-template): Make sure the
buffer exists.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-tab-ind-state): New variable.
(org-cycle-level): New function.
(org-cycle-level-after-item/entry-creation): New option.
(org-flag-subtree): New function.
(org-hide-archived-subtrees): Call `org-flag-subtree'.
(org-set-effort): Indexed access.
* org-list.el (org-cycle-item-indentation): New function.
* org.el (org-refile): Make prefix argument 2 refile to current
clock.
(org-priority): Interpret action `remove' as call to remove the
priority cookie.
* org-remember.el (org-remember-apply-template): Don't depend on
buffer name being like file name.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-play-sound): Expand file in
org-clock-sound, to allow ~ for home.
* org-remember.el (org-remember-handler): Set
text-before-node-creation even if this already looks like a node,
because the string might be needed on non-org-mode target files.
* org-agenda.el (org-agenda-open-link): Make this work in agenda
clocktables.
(org-agenda-switch-to): Follow a link at point if
org-return-follows-link' is set and there is nothing else to do in
this line.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview-xemacs.el: Add in changes from org-colview.el
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp-blocks.el: Modify split separator regexp to avoid empty
strings.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-columns-new): Make this work with the new
operators.
(org-columns-store-format): Make this work with the new operators.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-preserve-indentation): Document that this
variable is also used during export.
* org-exp.el (org-export-format-source-code-or-example): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
* org-exp-blocks.el (org-export-blocks-preprocess): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-mode-map): Define the new archiving keys.
(org-speed-commands-default): Define an archiving key in the speed
command map.
(org-org-menu): Improve the menu structure concerning archiving.
* org-archive.el (org-archive-subtree-default-with-confirmation):
New command.
* org-agenda.el (org-agenda-mode-map): Define the new archiving keys.
(org-agenda-menu): Add the new archiving commands to the menu.
(org-agenda-archive-default)
(org-agenda-archive-default-with-confirmation): New commands.
(org-agenda-archive, org-agenda-archive-to-archive-sibling): Just
call `org-agenda-archive-with'.
(org-agenda-archive-with): New function.
* org-table.el (org-table-convert-region): Inert spaces around "|"
to avoid line beginnings like "|-1" which will be mistaken as
hlines.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-offer-links-in-entry): Return nil if there are no
links, t if a link has been selected.
(org-open-at-point): Open attachment directory when called in the
headline and there are no links in the entry body.
(org-speed-commands-default): Add "o" for open-at-point as a speed
command.
* org-attach.el (org-attach-reveal): Optional prefix arg
IF-EXISTS, which avoids creating the attachment directory if it
does not yet exist.
* org-agenda.el (org-agenda, org-run-agenda-series): Evaluate
MATCH.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el ("abbrev"): Work with abbrev tables only after they have
been loaded.
* org-list.el (org-list-send-list): Fix bug related to match
data.
* org-latex.el (org-export-latex-fontify): Apply verbatim
emphasis.
(org-export-latex-make-header): Insert \obeylines if line breaks
should be preserved.
* org-exp.el (org-export-protect-verbatim): Add an
`org-verbatim-emph' property to such text.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.
(org-print-icalendar-entries): Skip entries where the timestamp is
not a deadline and not scheduled, if the user requests that.
* org-latex.el (org-export-latex-quotation-marks): Allow a bracket
before an opening quote.
* org-archive.el (org-archive-subtree): Keep archive after
archiving something.
* org-id.el (org-id-update-id-locations): Add archive files if
that is required by `org-id-extra-files'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-window-setup): New option.
(org-src-switch-to-buffer): New function.
(org-edit-src-exit): Add optional argument CONTEXT and use it to
restore window configuration.
(org-edit-src-code, org-edit-src-continue, org-edit-src-exit):
Call `org-src-switch-to-buffer'.
* org.el (org-default-properties): Add STYLE property.
(org-files-list): Use the function call to get the files.
(org-additional-option-like-keywords): Add SETUPFILE to completion
list.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-table.el (org-table-convert-region): Correctly interpret
quoting in csv import.
* org.el (org-icompleting-read): Make iswitchb completion work
with lists and tables.
* org-agenda.el (org-agenda-add-entry-text): Never add entry text
while pushing the mobile agenda.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el
(org-clock-auto-clock-resolution): Now takes three values: nil, t
and `when-no-clock-is-running'.
(org-clock-in): Use `org-clock-auto-clock-resolution' to determine
whether or not to resolve Org buffers on clock in.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-format-time-period): Function to format
times in fractional days for display.
(org-columns-display-here): Add support for showing a calculated
value in place of the property.
(org-columns): Set `org-columns-time' to the current time so time
difference calculations will work.
(org-columns-time): Use to store the current time when column view
is displayed, so all time differences will use the same reference
point.
(org-columns-compile-map): There is now an extra position in each
entry specifying the function to use to calculate the displayed
value for the non-calculated properties in the column,
(org-columns-compute-all): Set `org-columns-time' to the current
time so time difference calculations will work.
(org-columns-compute): Handle column operators where the values
used are calculated from the underlying property.
(org-columns-number-to-string): Handle the 'age' column format
(org-columns-string-to-number): Correct the function name (was
org-column...). Add support for the 'age' column format.
(org-columns-compile-format): Support the additional parameter in
org-columns-compile-map.
2009-11-13 Bastien Guerry <bzg@altern.org>
* org.el (org-mode-hook): Turn `org-mode-hook' into a customizable
variable.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-has-been-used): New variable.
(org-clock-in): Set `org-clock-has-been-used'.
(org-clock-save): Save only if clock data has been used or created
during this session.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-persist): New value, to store only the
clock history.
(org-clock-save): Don't save the clock if only the history should
be stored.
(org-clock-load): Turn off John Wiegley's auto resolving mechanism
when restoring a saved clock.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-clock-display, org-clock-put-overlay): Use
`org-time-clock-use-fractional'.
* org.el (org-time-clocksum-use-fractional)
(org-time-clocksum-fractional-format): Two new customizable
variables which allow the user to select fractional times (1.25
instead of 1:25) in the `org-clock-display' report.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-ascii.el (org-export-ascii-table-keep-all-vertical-lines):
New option.
* org.el (org-tag-alist): Fix customization type.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-update-checksum-for-capture-file):
Make sure the regexp search can fail without throwing an error.
(org-mobile-apply): Save the inbox buffer after removing
successfully applied changes.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Fix to the way idle
time is reported after the user comes back (but before they
resolve time).
* org.el (org-get-repeat): Change so that this function can be
called with either `org-scheduled-string' or
`org-deadline-string'.
* org-clock.el (org-clock-auto-clock-resolution): Renamed
`org-clock-disable-clock-resolution', since negatives don't sound
good in customization variables.
(org-clock-in): Don't use the auto-resolution logic if the user is
clocking into a different task while an active clock is running.
This then allows the default behavior of clocking out of the open
task and then into the new task.
* org.el (org-modules): Made this variable more consistent, since
it was referring to Org, OrgMode and Org-mode, whereas the docs
for the variable always refer to Org-mode.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-repeat-re): The changed org-repeat-re no longer
matched simple +2d type repeaters. Fix it so it does.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-preprocess): Protect the vspace
macro in the VERSE environment.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-habit.el (org-habit-get-priority): A new function that
determines the relative priority of a habit, based on how long
past its scheduled date it is, and how near the deadline is.
* org-agenda.el (org-agenda-get-scheduled): Set habit priority
using `org-habit-get-priority'.
* org-habit.el (org-habit-build-graph): Start displaying colors
from the first scheduled date, if that date is earlier than the
first completion date.
* org-habit.el: Changed all "color" variables to faces, and made
them appropriate for light and dark backgrounds.
* org-habit.el (org-habit-duration-to-days): Made this function
more general.
(org-habit-parse-todo): Parse the new ".+N/N" style repeater.
* org-agenda.el (org-agenda-get-deadlines): Removed all mention of
habits, since they don't use DEADLINE anymore.
* org.el (org-repeat-re, org-display-custom-time)
(org-timestamp-change): Extended to support the new ".+N/N"
syntax, used for habits.
* org-clock.el (org-clock-resolve-clock): Fixed an incorrect
variable reference.
* org-agenda.el (org-agenda-set-mode-name): Show Habit in the
modeline when habits are being displayed (if that module is being
loaded).
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-clock.el (org-x11-idle-seconds): Add a method to get the X11
idle time using the xscreensaver extension.
(org-user-idle-seconds): Use X11 idle time if available.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-next-line): New command.
(org-agenda-previous-line): New commands.
(org-agenda-show-and-scroll-up, org-agenda-show-scroll-down): New
commands.
(org-agenda-follow-mode): Do the follow immediately if the mode is
turned on here.
(previous-line, next-line): Replace keys with the corresponding
org functions.
(org-agenda-mode-map): Bind backspace and delete to the scrolling
command.
* org.el (org-icompleting-read): Turn off partial completion mode
for the duration of this completion round.
* org-latex.el (org-export-latex-fontify-headline): Protect TeX
macros in author lines and similar stuff.
* org.el (org-file-tags): Fix docstring.
(org-get-buffer-tags): Add the #+FILETAGS tags.
("ecb"): Maks ecb show context after jumping into an Org file.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-finalize-agenda): Draw habit consistency
graphs after everything else in the buffer has been setup.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-apply): Count success and failure.
* org.el (org-indent-line-function): Fix regexp replace problem.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-disable-clock-resolution): New
customization variable that disable automatic clock resolution on
clock in.
(org-clock-in): If `org-clock-disable-clock-resolution' is set, do
not automatically resolve anything. This is does not affect
idle-time resolution, however, if `org-clock-idle-time' is set.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-habit.el: New file, which implements code to build a "habit
consistency graph".
* org-agenda.el (org-agenda-get-deadlines)
(org-agenda-get-scheduled): Display consistency graphs when
outputting habits into the agenda. The graphs are always relative
to the current time.
(org-format-agenda-item): Added new parameter `habitp', which
indicates whether we are formatting a habit or not. Do not
display "extra" leading information if habitp is true.
* org.el (org-repeat-re): Improved regexp to include .+ and ++
leaders for repeat strings.
(org-get-repeat): Now takes a string parameter `tagline', so the
caller can obtain the SCHEDULED repeat, or the DEADLINE repeat.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-agenda-auto-exclude-function): New
customization variable for allowing the user to create an "auto
exclusion" filter for doing context-aware auto tag filtering.
(org-agenda-filter-by-tag): Changes to support the use of
`org-agenda-auto-exclude-function'. See the new manual addition,.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org.el (org-files-list): Don't attempt to return a file name for
Org buffers which have no associated file.
* org-agenda.el (org-agenda-do-action): Fixed a typo.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-locate-entry): Interpret files
relative to org-directory.
(org-mobile-inbox-for-pull): Document the best location for this
file.
(org-mobile-check-setup): Verify `org-directory'.
(org-mobile-create-index-file): Sort the files to be listed in
index.org.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-fast-tag-selection): Add a way to display a
description for a tag group. This is done by adding a string to
either the startgroup or endgroup cell.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-resolve, org-resolve-clocks)
(org-emacs-idle-seconds): Use `org-float-time' instead of
`time-to-seconds'
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-sorting-strategy): Fix customization
type.
* org.el (org-pre-cycle-hook): Document that `empty' can also be
the value of ARG when doing local cycling.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-resolve-clock): If keeping or
subtracting time results in a clock out at a time in the past, and
if the resolution occurred due to idleness or invoking `M-x
org-resolve-clocks', remember that past moment in time. On the
next clock in, the user will be prompted to see if they want to
back-date their new clock to then.
(org-clock-resolve): Do not jump the user to the location of a
dangling clock if the resolution is occuring due to an idle
timeout. In that case there is typically only one dangling clock,
the active one, and there is no value gained by shuffling their
windows around to show it to them. Being prompted to resolve an
idle clock should be as inobtrusive as possible.
(org-resolve-clocks-if-idle): New function that resolves only the
currently active clock if the user has exceeded the time returned
by `org-user-idle-seconds', based on the value of
`org-clock-idle-time'.
(org-clock-in): If, after resolving clocks,
(org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
* org-clock.el (org-clock-resolve-clock): New function that
resolves a clock to a specific time, closing or resuming as need
be, and possibly even starting a new clock.
(org-clock-resolve): New function used by `org-resolve-clocks'
that sets up for the call to `org-clock-resolve-clock'. It
determines the time to resolve to based on a single-character
selection from the user to either keep time, subtract away time or
cancel the clock.
(org-resolve-clocks): New user command which resolves dangling
clocks -- that is, open but not active -- anywhere in the file
list returned by `org-files-list'.
(org-clock-in): Automatically resolve dangling clocks whenever a
user clocks in.
(org-clock-cancel): If the user cancels the solely clock in a
LOGBOOK, remove the empty drawer.
* org-clock.el (org-clock-idle-time): New user customizable option
for detecting whether the user has left a clock idle. Note: it is
only used in this commit to test whether it's worthwhile to check
OS X to get the Mac user's current idle time. If the Emacs idle
time is less than the value, the user hasn't been away long enough
to be worth checking (a more expensive test than just getting
Emacs idle time).
(org-user-idle-seconds, org-mac-idle-seconds)
(org-emacs-idle-seconds): This three functions, in conjunction
with the user customization variable `org-clock-idle-time', return
the number of seconds (as a floating point) that the user has been
away from their Emacs (or, if running on OS X, their computer).
* org-clock.el (org-find-open-clocks): New function that returns a
list of all open clocks in the given FILE. Note that each clock
it returns is a cons cell of the format (MARKER . START-TIME).
This "clock" value is used by several of the new clock module
utility functions.
(org-is-active-clock): New inline function which tests whether the
given clock value is the same as the currently active clock.
Returns non-nil if this is the case.
(org-with-clock-position): New macro that evaluates FORMS with
point in the buffer and at the position of the given clock.
Changes to the current clock are global.
(org-with-clock): New macro that evaluates FORMS with point in the
buffer and at the position of the given clock. However, changes
to the current clock are local and have no effect on the user's
active clock. This allows, for example, far any clock to be
cancelled without cancelling the active clock.
(org-clock-clock-in): New inline function that switches the active
clock to the given clock. If either the argument RESUME, or the
global `org-clock-in-resume', are non-nil, it will resume a clock
that was previously left open.
(org-clock-clock-out): New inline function that clocks out the
given clock value without affecting the currently active clock.
(org-clock-clock-cancel): New inline function that cancels the
given clock value without affecting the currently active clock.
* org-clock.el (org-clock-in): Before creating
`org-clock-mode-line-timer', check to make sure an older timer is
not currently running.
(org-clock-out): Accept new third parameter `at-time', which
permits a clock to be clocked out at a specific time. Note that
no attempt is made to verify that the clock out time is later than
the clock in time.
* org.el (org-files-list): New utility function for returning a
list of all open org-mode buffers, plus all files used to build
the agenda buffer. Note that not all the files will necessarily
be visited by a buffer at time of call.
(org-entry-beginning-position): Like the function
`line-beginning-position', this inline function returns the
beginning position of the current heading/entry.
(org-entry-end-position): Like the function `line-end-position',
this inline function returns the end position of the current
heading/entry.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-list): Mark the all-todo items line as
a header line.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-inlinetask-remove-END-maybe): Declare function.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-filter-make-matcher): Allow to filter
entries that have no tags.
(org-agenda-search-view): New customize group.
(org-agenda-search-view-search-words-only): New option.
(org-search-view): Implement substring search.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-outline-level): Add doc string.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-export): Re-introduce
variable.
(org-inlinetask-export-handler): Only export inline task if the
user option calls for it.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-handle-export-tags): Remove inlinetask
END if present.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-tables): Don't format in
protected regions.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-edit-src-code)
(org-edit-src-find-region-and-lang, org-edit-src-exit): Handle
macro editing.
* org-agenda.el (org-prefix-category-max-length): New variable.
(org-format-agenda-item): Use `org-prefix-category-max-length'.
(org-compile-prefix-format): Set `org-prefix-category-max-length'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-create-index-file): Improve the
listing of tags and todo keywords.
* org-latex.el (org-export-latex-format-image): New function.
(org-export-latex-links): Use `org-export-latex-format-image'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-get-current-indentation)
(org-inlinetask-remove-terminator): New functions.
(org-inlinetask-export-handler): Terminate the description list.
* org-exp.el (org-export-select-backend-specific-text): Remove the
region markers.
* org-inlinetask.el (org-inlinetask-export-handler): fix bug for
tasks without content.
* org-clock.el: Make sure the clock-in target position does not
move to a different node by widening the buffer.
* org-html.el (org-export-html-format-image): Wrap image into
figure div only when there is a caption.
* org-archive.el (org-archive-mark-done): Change default value to
nil.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-context): Call `bobp', not `eobp'.
* org-clock.el (org-clock-cancel): Remove quotes from marker
variables.
* org.el (org-read-date-prefer-future): New allowed value `time'.
(org-read-date-analyze): Shift day to tomorrow depending on time
entered and value of `org-read-date-prefer-future'.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 13 Nov 2009 08:37:55 +0000 |
parents | 2a8a3a69c1c7 |
children | 053192c3df59 |
comparison
equal
deleted
inserted
replaced
105972:371db60eff06 | 105973:b7d8222914b4 |
---|---|
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Carsten Dominik <carsten at orgmode dot org> | 6 ;; Author: Carsten Dominik <carsten at orgmode dot org> |
7 ;; Keywords: outlines, hypermedia, calendar, wp | 7 ;; Keywords: outlines, hypermedia, calendar, wp |
8 ;; Homepage: http://orgmode.org | 8 ;; Homepage: http://orgmode.org |
9 ;; Version: 6.31a | 9 ;; Version: 6.33 |
10 ;; | 10 ;; |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 ;; | 12 ;; |
13 ;; GNU Emacs is free software: you can redistribute it and/or modify | 13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | 14 ;; it under the terms of the GNU General Public License as published by |
50 (declare-function calendar-iso-date-string "cal-iso" (&optional date)) | 50 (declare-function calendar-iso-date-string "cal-iso" (&optional date)) |
51 (declare-function calendar-iso-from-absolute "cal-iso" (date)) | 51 (declare-function calendar-iso-from-absolute "cal-iso" (date)) |
52 (declare-function calendar-julian-date-string "cal-julian" (&optional date)) | 52 (declare-function calendar-julian-date-string "cal-julian" (&optional date)) |
53 (declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) | 53 (declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) |
54 (declare-function calendar-persian-date-string "cal-persia" (&optional date)) | 54 (declare-function calendar-persian-date-string "cal-persia" (&optional date)) |
55 (declare-function org-datetree-find-date-create "org-datetree" (date)) | |
55 (declare-function org-columns-quit "org-colview" ()) | 56 (declare-function org-columns-quit "org-colview" ()) |
57 (declare-function diary-date-display-form "diary-lib" (&optional type)) | |
58 (declare-function org-mobile-write-agenda-for-mobile "org-mobile" (file)) | |
59 (declare-function org-habit-insert-consistency-graphs | |
60 "org-habit" (&optional line)) | |
61 (declare-function org-is-habit-p "org-habit" (&optional pom)) | |
62 (declare-function org-habit-parse-todo "org-habit" (&optional pom)) | |
63 (declare-function org-habit-get-priority "org-habit" (habit)) | |
56 (defvar calendar-mode-map) | 64 (defvar calendar-mode-map) |
57 (defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el | 65 (defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el |
66 (defvar org-habit-show-habits) | |
67 (defvar org-habit-show-habits-only-for-today) | |
58 | 68 |
59 ;; Defined somewhere in this file, but used before definition. | 69 ;; Defined somewhere in this file, but used before definition. |
60 (defvar org-agenda-buffer-name) | 70 (defvar org-agenda-buffer-name) |
61 (defvar org-agenda-overriding-header) | 71 (defvar org-agenda-overriding-header) |
62 (defvar org-agenda-title-append nil) | 72 (defvar org-agenda-title-append nil) |
198 (const category-keep) (const category-up) (const category-down) | 208 (const category-keep) (const category-up) (const category-down) |
199 (const tag-down) (const tag-up) | 209 (const tag-down) (const tag-up) |
200 (const priority-up) (const priority-down) | 210 (const priority-up) (const priority-down) |
201 (const todo-state-up) (const todo-state-down) | 211 (const todo-state-up) (const todo-state-down) |
202 (const effort-up) (const effort-down) | 212 (const effort-up) (const effort-down) |
213 (const habit-up) (const habit-down) | |
203 (const user-defined-up) (const user-defined-down)) | 214 (const user-defined-up) (const user-defined-down)) |
204 "Sorting choices.") | 215 "Sorting choices.") |
205 | 216 |
206 (defconst org-agenda-custom-commands-local-options | 217 (defconst org-agenda-custom-commands-local-options |
207 `(repeat :tag "Local settings for this command. Remember to quote values" | 218 `(repeat :tag "Local settings for this command. Remember to quote values" |
479 :group 'org-agenda) | 490 :group 'org-agenda) |
480 (defgroup org-agenda-match-view nil | 491 (defgroup org-agenda-match-view nil |
481 "Options concerning the general tags/property/todo match agenda view." | 492 "Options concerning the general tags/property/todo match agenda view." |
482 :tag "Org Agenda Match View" | 493 :tag "Org Agenda Match View" |
483 :group 'org-agenda) | 494 :group 'org-agenda) |
495 (defgroup org-agenda-search-view nil | |
496 "Options concerning the general tags/property/todo match agenda view." | |
497 :tag "Org Agenda Match View" | |
498 :group 'org-agenda) | |
484 | 499 |
485 (defvar org-agenda-archives-mode nil | 500 (defvar org-agenda-archives-mode nil |
486 "Non-nil means, the agenda will include archived items. | 501 "Non-nil means, the agenda will include archived items. |
487 If this is the symbol `trees', trees in the selected agenda scope | 502 If this is the symbol `trees', trees in the selected agenda scope |
488 that are marked with the ARCHIVE tag will be included anyway. When this is | 503 that are marked with the ARCHIVE tag will be included anyway. When this is |
605 This causes some overhead during agenda construction, but if you | 620 This causes some overhead during agenda construction, but if you |
606 have turned on `org-enforce-todo-dependencies', | 621 have turned on `org-enforce-todo-dependencies', |
607 `org-enforce-todo-checkbox-dependencies', or any other blocking | 622 `org-enforce-todo-checkbox-dependencies', or any other blocking |
608 mechanism, this will create useful feedback in the agenda. | 623 mechanism, this will create useful feedback in the agenda. |
609 | 624 |
610 Instead ot t, this variable can also have the value `invisible'. | 625 Instead of t, this variable can also have the value `invisible'. |
611 Then blocked tasks will be invisible and only become visible when | 626 Then blocked tasks will be invisible and only become visible when |
612 they become unblocked. An exemption to this behavior is when a task is | 627 they become unblocked. An exemption to this behavior is when a task is |
613 blocked because of unchecked checkboxes below it. Since checkboxes do | 628 blocked because of unchecked checkboxes below it. Since checkboxes do |
614 not show up in the agenda views, making this task invisible you remove any | 629 not show up in the agenda views, making this task invisible you remove any |
615 trace from agenda views that there is something to do. Therefore, a task | 630 trace from agenda views that there is something to do. Therefore, a task |
618 :group 'org-agenda-daily/weekly | 633 :group 'org-agenda-daily/weekly |
619 :group 'org-agenda-todo-list | 634 :group 'org-agenda-todo-list |
620 :type '(choice | 635 :type '(choice |
621 (const :tag "Do not dim" nil) | 636 (const :tag "Do not dim" nil) |
622 (const :tag "Dim to a grey face" t) | 637 (const :tag "Dim to a grey face" t) |
623 (const :tag "Make invisibe" invisible))) | 638 (const :tag "Make invisible" invisible))) |
624 | 639 |
625 (defcustom org-timeline-show-empty-dates 3 | 640 (defcustom org-timeline-show-empty-dates 3 |
626 "Non-nil means, `org-timeline' also shows dates without an entry. | 641 "Non-nil means, `org-timeline' also shows dates without an entry. |
627 When nil, only the days which actually have entries are shown. | 642 When nil, only the days which actually have entries are shown. |
628 When t, all days between the first and the last date are shown. | 643 When t, all days between the first and the last date are shown. |
660 "The initial value of entry-text-mode in a newly created agenda window." | 675 "The initial value of entry-text-mode in a newly created agenda window." |
661 :group 'org-agenda-startup | 676 :group 'org-agenda-startup |
662 :type 'boolean) | 677 :type 'boolean) |
663 | 678 |
664 (defcustom org-agenda-entry-text-maxlines 5 | 679 (defcustom org-agenda-entry-text-maxlines 5 |
665 "Number of text lines to be added when `E' is presed in the agenda. | 680 "Number of text lines to be added when `E' is pressed in the agenda. |
666 | 681 |
667 Note that this variable only used during agenda display. Add add entry text | 682 Note that this variable only used during agenda display. Add add entry text |
668 when exporting the agenda, configure the variable | 683 when exporting the agenda, configure the variable |
669 `org-agenda-add-entry-ext-maxlines'." | 684 `org-agenda-add-entry-ext-maxlines'." |
670 :group 'org-agenda | 685 :group 'org-agenda |
868 be overwritten to make sure the content accurately reflects the | 883 be overwritten to make sure the content accurately reflects the |
869 current display in the agenda." | 884 current display in the agenda." |
870 :group 'org-agenda-daily/weekly | 885 :group 'org-agenda-daily/weekly |
871 :type 'plist) | 886 :type 'plist) |
872 | 887 |
888 (defcustom org-agenda-search-view-search-words-only nil | |
889 "Non-nil means, the search string is interpreted as individual words | |
890 The search then looks for each word separately in each entry and | |
891 selects entries that have matches for all words. | |
892 When nil, matching as loose words will only take place if the first | |
893 word is preceded by + or -. If that is not the case, the search | |
894 string will just be matched as a substring in the entry, but with | |
895 each space character allowing for any whitespace, including newlines." | |
896 :group 'org-agenda-search-view | |
897 :type 'boolean) | |
873 | 898 |
874 (defgroup org-agenda-time-grid nil | 899 (defgroup org-agenda-time-grid nil |
875 "Options concerning the time grid in the Org-mode Agenda." | 900 "Options concerning the time grid in the Org-mode Agenda." |
876 :tag "Org Agenda Time Grid" | 901 :tag "Org Agenda Time Grid" |
877 :group 'org-agenda) | 902 :group 'org-agenda) |
933 "Options concerning sorting in the Org-mode Agenda." | 958 "Options concerning sorting in the Org-mode Agenda." |
934 :tag "Org Agenda Sorting" | 959 :tag "Org Agenda Sorting" |
935 :group 'org-agenda) | 960 :group 'org-agenda) |
936 | 961 |
937 (defcustom org-agenda-sorting-strategy | 962 (defcustom org-agenda-sorting-strategy |
938 '((agenda time-up priority-down category-keep) | 963 '((agenda habit-down time-up priority-down category-keep) |
939 (todo priority-down category-keep) | 964 (todo priority-down category-keep) |
940 (tags priority-down category-keep) | 965 (tags priority-down category-keep) |
941 (search category-keep)) | 966 (search category-keep)) |
942 "Sorting structure for the agenda items of a single day. | 967 "Sorting structure for the agenda items of a single day. |
943 This is a list of symbols which will be used in sequence to determine | 968 This is a list of symbols which will be used in sequence to determine |
944 if an entry should be listed before another entry. The following | 969 if an entry should be listed before another entry. The following |
945 symbols are recognized: | 970 symbols are recognized: |
958 todo-state-down Sort by todo state, tasks that are done first. | 983 todo-state-down Sort by todo state, tasks that are done first. |
959 effort-up Sort numerically by estimated effort, high effort last. | 984 effort-up Sort numerically by estimated effort, high effort last. |
960 effort-down Sort numerically by estimated effort, high effort first. | 985 effort-down Sort numerically by estimated effort, high effort first. |
961 user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. | 986 user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. |
962 user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. | 987 user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. |
988 habit-up Put entries that are habits first | |
989 habit-down Put entries that are habits last | |
963 | 990 |
964 The different possibilities will be tried in sequence, and testing stops | 991 The different possibilities will be tried in sequence, and testing stops |
965 if one comparison returns a \"not-equal\". For example, the default | 992 if one comparison returns a \"not-equal\". For example, the default |
966 '(time-up category-keep priority-down) | 993 '(time-up category-keep priority-down) |
967 means: Pull out all entries having a specified time of day and sort them, | 994 means: Pull out all entries having a specified time of day and sort them, |
974 Leaving out `category-keep' would mean that items will be sorted across | 1001 Leaving out `category-keep' would mean that items will be sorted across |
975 categories by priority. | 1002 categories by priority. |
976 | 1003 |
977 Instead of a single list, this can also be a set of list for specific | 1004 Instead of a single list, this can also be a set of list for specific |
978 contents, with a context symbol in the car of the list, any of | 1005 contents, with a context symbol in the car of the list, any of |
979 `agenda', `todo', `tags' for the corresponding agenda views. | 1006 `agenda', `todo', `tags', `search' for the corresponding agenda views. |
980 | 1007 |
981 Custom commands can bind this variable in the options section." | 1008 Custom commands can bind this variable in the options section." |
982 :group 'org-agenda-sorting | 1009 :group 'org-agenda-sorting |
983 :type `(choice | 1010 :type `(choice |
984 (repeat :tag "General" ,org-sorting-choice) | 1011 (repeat :tag "General" ,org-sorting-choice) |
986 (cons (const :tag "Strategy for Weekly/Daily agenda" agenda) | 1013 (cons (const :tag "Strategy for Weekly/Daily agenda" agenda) |
987 (repeat ,org-sorting-choice)) | 1014 (repeat ,org-sorting-choice)) |
988 (cons (const :tag "Strategy for TODO lists" todo) | 1015 (cons (const :tag "Strategy for TODO lists" todo) |
989 (repeat ,org-sorting-choice)) | 1016 (repeat ,org-sorting-choice)) |
990 (cons (const :tag "Strategy for Tags matches" tags) | 1017 (cons (const :tag "Strategy for Tags matches" tags) |
1018 (repeat ,org-sorting-choice)) | |
1019 (cons (const :tag "Strategy for search matches" search) | |
991 (repeat ,org-sorting-choice))))) | 1020 (repeat ,org-sorting-choice))))) |
992 | 1021 |
993 (defcustom org-agenda-cmp-user-defined nil | 1022 (defcustom org-agenda-cmp-user-defined nil |
994 "A function to define the comparison `user-defined'. | 1023 "A function to define the comparison `user-defined'. |
995 This function must receive two arguments, agenda entry a and b. | 1024 This function must receive two arguments, agenda entry a and b. |
1058 | 1087 |
1059 If there is punctuation or whitespace character just before the final | 1088 If there is punctuation or whitespace character just before the final |
1060 format letter, this character will be appended to the field value if | 1089 format letter, this character will be appended to the field value if |
1061 the value is not empty. For example, the format \"%-12:c\" leads to | 1090 the value is not empty. For example, the format \"%-12:c\" leads to |
1062 \"Diary: \" if the category is \"Diary\". If the category were be | 1091 \"Diary: \" if the category is \"Diary\". If the category were be |
1063 empty, no additional colon would be interted. | 1092 empty, no additional colon would be inserted. |
1064 | 1093 |
1065 The default value of this option is \" %-12:c%?-12t% s\", meaning: | 1094 The default value of this option is \" %-12:c%?-12t% s\", meaning: |
1066 - Indent the line with two space characters | 1095 - Indent the line with two space characters |
1067 - Give the category in a 12 chars wide field, padded with whitespace on | 1096 - Give the category in a 12 chars wide field, padded with whitespace on |
1068 the right (because of `-'). Append a colon if there is a category | 1097 the right (because of `-'). Append a colon if there is a category |
1257 is not set, an appointment without end time will not contribute to the time | 1286 is not set, an appointment without end time will not contribute to the time |
1258 estimate." | 1287 estimate." |
1259 :group 'org-agenda-column-view | 1288 :group 'org-agenda-column-view |
1260 :type 'boolean) | 1289 :type 'boolean) |
1261 | 1290 |
1291 (defcustom org-agenda-auto-exclude-function nil | |
1292 "A function called with a tag to decide if it is filtered on '/ RET'. | |
1293 The sole argument to the function, which is called once for each | |
1294 possible tag, is a string giving the name of the tag. The | |
1295 function should return either nil if the tag should be included | |
1296 as normal, or \"-<TAG>\" to exclude the tag." | |
1297 :group 'org-agenda | |
1298 :type 'function) | |
1299 | |
1262 (eval-when-compile | 1300 (eval-when-compile |
1263 (require 'cl)) | 1301 (require 'cl)) |
1264 (require 'org) | 1302 (require 'org) |
1265 | 1303 |
1266 (defun org-add-agenda-custom-command (entry) | 1304 (defun org-add-agenda-custom-command (entry) |
1274 | 1312 |
1275 ;;; Define the Org-agenda-mode | 1313 ;;; Define the Org-agenda-mode |
1276 | 1314 |
1277 (defvar org-agenda-mode-map (make-sparse-keymap) | 1315 (defvar org-agenda-mode-map (make-sparse-keymap) |
1278 "Keymap for `org-agenda-mode'.") | 1316 "Keymap for `org-agenda-mode'.") |
1317 (if (fboundp 'defvaralias) | |
1318 (defvaralias 'org-agenda-keymap 'org-agenda-mode-map)) | |
1279 | 1319 |
1280 (defvar org-agenda-menu) ; defined later in this file. | 1320 (defvar org-agenda-menu) ; defined later in this file. |
1281 (defvar org-agenda-restrict) ; defined later in this file. | 1321 (defvar org-agenda-restrict) ; defined later in this file. |
1282 (defvar org-agenda-follow-mode nil) | 1322 (defvar org-agenda-follow-mode nil) |
1283 (defvar org-agenda-entry-text-mode nil) | 1323 (defvar org-agenda-entry-text-mode nil) |
1351 (org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark) | 1391 (org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark) |
1352 (org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark) | 1392 (org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark) |
1353 (org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-remove-all-marks) | 1393 (org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-remove-all-marks) |
1354 (org-defkey org-agenda-mode-map "B" 'org-agenda-bulk-action) | 1394 (org-defkey org-agenda-mode-map "B" 'org-agenda-bulk-action) |
1355 (org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload) | 1395 (org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload) |
1356 (org-defkey org-agenda-mode-map "\C-c$" 'org-agenda-archive) | 1396 (org-defkey org-agenda-mode-map "\C-c\C-x\C-a" 'org-agenda-archive-default) |
1397 (org-defkey org-agenda-mode-map "\C-c\C-xa" 'org-agenda-toggle-archive-tag) | |
1398 (org-defkey org-agenda-mode-map "\C-c\C-xA" 'org-agenda-archive-to-archive-sibling) | |
1357 (org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive) | 1399 (org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive) |
1400 (org-defkey org-agenda-mode-map "\C-c$" 'org-agenda-archive) | |
1358 (org-defkey org-agenda-mode-map "$" 'org-agenda-archive) | 1401 (org-defkey org-agenda-mode-map "$" 'org-agenda-archive) |
1359 (org-defkey org-agenda-mode-map "A" 'org-agenda-archive-to-archive-sibling) | |
1360 (org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link) | 1402 (org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link) |
1361 (org-defkey org-agenda-mode-map " " 'org-agenda-show) | 1403 (org-defkey org-agenda-mode-map " " 'org-agenda-show-and-scroll-up) |
1404 (org-defkey org-agenda-mode-map [backspace] 'org-agenda-show-scroll-down) | |
1405 (org-defkey org-agenda-mode-map "\d" 'org-agenda-show-scroll-down) | |
1362 (org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset) | 1406 (org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset) |
1363 (org-defkey org-agenda-mode-map [(control shift left)] 'org-agenda-todo-previousset) | 1407 (org-defkey org-agenda-mode-map [(control shift left)] 'org-agenda-todo-previousset) |
1364 (org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer) | 1408 (org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer) |
1365 (org-defkey org-agenda-mode-map "o" 'delete-other-windows) | 1409 (org-defkey org-agenda-mode-map "o" 'delete-other-windows) |
1366 (org-defkey org-agenda-mode-map "L" 'org-agenda-recenter) | 1410 (org-defkey org-agenda-mode-map "L" 'org-agenda-recenter) |
1367 (org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) | 1411 (org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) |
1368 (org-defkey org-agenda-mode-map "t" 'org-agenda-todo) | 1412 (org-defkey org-agenda-mode-map "t" 'org-agenda-todo) |
1369 (org-defkey org-agenda-mode-map "a" 'org-agenda-toggle-archive-tag) | 1413 (org-defkey org-agenda-mode-map "a" 'org-agenda-archive-default-with-confirmation) |
1370 (org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags) | 1414 (org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags) |
1371 (org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags) | 1415 (org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags) |
1372 (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) | 1416 (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) |
1373 (org-defkey org-agenda-mode-map "j" 'org-agenda-goto-date) | 1417 (org-defkey org-agenda-mode-map "j" 'org-agenda-goto-date) |
1374 (org-defkey org-agenda-mode-map "d" 'org-agenda-day-view) | 1418 (org-defkey org-agenda-mode-map "d" 'org-agenda-day-view) |
1409 (org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda) | 1453 (org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda) |
1410 (org-defkey org-agenda-mode-map "\C-x\C-s" 'org-save-all-org-buffers) | 1454 (org-defkey org-agenda-mode-map "\C-x\C-s" 'org-save-all-org-buffers) |
1411 (org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) | 1455 (org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) |
1412 (org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) | 1456 (org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) |
1413 (org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) | 1457 (org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) |
1414 (org-defkey org-agenda-mode-map "n" 'next-line) | 1458 (org-defkey org-agenda-mode-map "n" 'org-agenda-next-line) |
1415 (org-defkey org-agenda-mode-map "p" 'previous-line) | 1459 (org-defkey org-agenda-mode-map "p" 'org-agenda-previous-line) |
1460 (substitute-key-definition 'next-line 'org-agenda-next-line | |
1461 org-agenda-mode-map global-map) | |
1462 (substitute-key-definition 'previous-line 'org-agenda-previous-line | |
1463 org-agenda-mode-map global-map) | |
1416 (org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach) | 1464 (org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach) |
1417 (org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line) | 1465 (org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line) |
1418 (org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line) | 1466 (org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line) |
1419 (org-defkey org-agenda-mode-map "," 'org-agenda-priority) | 1467 (org-defkey org-agenda-mode-map "," 'org-agenda-priority) |
1420 (org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority) | 1468 (org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority) |
1453 (org-defkey org-agenda-mode-map ";" 'org-timer-set-timer) | 1501 (org-defkey org-agenda-mode-map ";" 'org-timer-set-timer) |
1454 (define-key org-agenda-mode-map "?" 'org-agenda-show-the-flagging-note) | 1502 (define-key org-agenda-mode-map "?" 'org-agenda-show-the-flagging-note) |
1455 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull) | 1503 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull) |
1456 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push) | 1504 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push) |
1457 | 1505 |
1458 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) | 1506 (org-defkey org-agenda-mode-map |
1459 "Local keymap for agenda entries from Org-mode.") | |
1460 | |
1461 (org-defkey org-agenda-keymap | |
1462 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) | 1507 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) |
1463 (org-defkey org-agenda-keymap | 1508 (org-defkey org-agenda-mode-map |
1464 (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) | 1509 (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) |
1465 (when org-agenda-mouse-1-follows-link | 1510 (when org-agenda-mouse-1-follows-link |
1466 (org-defkey org-agenda-keymap [follow-link] 'mouse-face)) | 1511 (org-defkey org-agenda-mode-map [follow-link] 'mouse-face)) |
1467 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" | 1512 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" |
1468 '("Agenda" | 1513 '("Agenda" |
1469 ("Agenda Files") | 1514 ("Agenda Files") |
1470 "--" | 1515 "--" |
1471 ("Agenda Dates" | 1516 ("Agenda Dates" |
1533 ["Cycle TODO" org-agenda-todo t] | 1578 ["Cycle TODO" org-agenda-todo t] |
1534 ["Next TODO set" org-agenda-todo-nextset t] | 1579 ["Next TODO set" org-agenda-todo-nextset t] |
1535 ["Previous TODO set" org-agenda-todo-previousset t] | 1580 ["Previous TODO set" org-agenda-todo-previousset t] |
1536 ["Add note" org-agenda-add-note t]) | 1581 ["Add note" org-agenda-add-note t]) |
1537 ("Archive/Refile/Delete" | 1582 ("Archive/Refile/Delete" |
1583 ["Archive default" org-agenda-archive-default t] | |
1584 ["Archive default" org-agenda-archive-default-with-confirmation t] | |
1538 ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t] | 1585 ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t] |
1539 ["Move to archive sibling" org-agenda-archive-to-archive-sibling t] | 1586 ["Move to archive sibling" org-agenda-archive-to-archive-sibling t] |
1540 ["Archive subtree" org-agenda-archive t] | 1587 ["Archive subtree" org-agenda-archive t] |
1541 "--" | 1588 "--" |
1542 ["Refile" org-agenda-refile t] | 1589 ["Refile" org-agenda-refile t] |
1682 a condition (the user is prompted for the condition). | 1729 a condition (the user is prompted for the condition). |
1683 M Like `m', but select only TODO entries, no ordinary headlines. | 1730 M Like `m', but select only TODO entries, no ordinary headlines. |
1684 L Create a timeline for the current buffer. | 1731 L Create a timeline for the current buffer. |
1685 e Export views to associated files. | 1732 e Export views to associated files. |
1686 s Search entries for keywords. | 1733 s Search entries for keywords. |
1687 / Multi occur accros all agenda files and also files listed | 1734 / Multi occur across all agenda files and also files listed |
1688 in `org-agenda-text-search-extra-files'. | 1735 in `org-agenda-text-search-extra-files'. |
1689 < Restrict agenda commands to buffer, subtree, or region. | 1736 < Restrict agenda commands to buffer, subtree, or region. |
1690 Press several times to get the desired effect. | 1737 Press several times to get the desired effect. |
1691 > Remove a previous restriction. | 1738 > Remove a previous restriction. |
1692 # List \"stuck\" projects. | 1739 # List \"stuck\" projects. |
1725 (buf (current-buffer)) | 1772 (buf (current-buffer)) |
1726 (bfn (buffer-file-name (buffer-base-buffer))) | 1773 (bfn (buffer-file-name (buffer-base-buffer))) |
1727 entry key type match lprops ans) | 1774 entry key type match lprops ans) |
1728 ;; Turn off restriction unless there is an overriding one, | 1775 ;; Turn off restriction unless there is an overriding one, |
1729 (unless org-agenda-overriding-restriction | 1776 (unless org-agenda-overriding-restriction |
1730 (unless (org-bound-and-true-p org-agenda-keep-restriced-file-list) | 1777 (unless (org-bound-and-true-p org-agenda-keep-restricted-file-list) |
1731 ;; There is a request to keep the file list in place | 1778 ;; There is a request to keep the file list in place |
1732 (put 'org-agenda-files 'org-restrict nil)) | 1779 (put 'org-agenda-files 'org-restrict nil)) |
1733 (setq org-agenda-restrict nil) | 1780 (setq org-agenda-restrict nil) |
1734 (move-marker org-agenda-restrict-begin nil) | 1781 (move-marker org-agenda-restrict-begin nil) |
1735 (move-marker org-agenda-restrict-end nil)) | 1782 (move-marker org-agenda-restrict-end nil)) |
1739 (setq org-agenda-last-dispatch-buffer (current-buffer)) | 1786 (setq org-agenda-last-dispatch-buffer (current-buffer)) |
1740 (unless keys | 1787 (unless keys |
1741 (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) | 1788 (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) |
1742 keys (car ans) | 1789 keys (car ans) |
1743 restriction (cdr ans))) | 1790 restriction (cdr ans))) |
1744 ;; Estabish the restriction, if any | 1791 ;; Establish the restriction, if any |
1745 (when (and (not org-agenda-overriding-restriction) restriction) | 1792 (when (and (not org-agenda-overriding-restriction) restriction) |
1746 (put 'org-agenda-files 'org-restrict (list bfn)) | 1793 (put 'org-agenda-files 'org-restrict (list bfn)) |
1747 (cond | 1794 (cond |
1748 ((eq restriction 'region) | 1795 ((eq restriction 'region) |
1749 (setq org-agenda-restrict t) | 1796 (setq org-agenda-restrict t) |
1761 ;; For example the todo list should not need it (but does...) | 1808 ;; For example the todo list should not need it (but does...) |
1762 (cond | 1809 (cond |
1763 ((setq entry (assoc keys org-agenda-custom-commands)) | 1810 ((setq entry (assoc keys org-agenda-custom-commands)) |
1764 (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) | 1811 (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) |
1765 (progn | 1812 (progn |
1766 (setq type (nth 2 entry) match (nth 3 entry) lprops (nth 4 entry)) | 1813 (setq type (nth 2 entry) match (eval (nth 3 entry)) |
1814 lprops (nth 4 entry)) | |
1767 (put 'org-agenda-redo-command 'org-lprops lprops) | 1815 (put 'org-agenda-redo-command 'org-lprops lprops) |
1768 (cond | 1816 (cond |
1769 ((eq type 'agenda) | 1817 ((eq type 'agenda) |
1770 (org-let lprops '(org-agenda-list current-prefix-arg))) | 1818 (org-let lprops '(org-agenda-list current-prefix-arg))) |
1771 ((eq type 'alltodo) | 1819 ((eq type 'alltodo) |
2004 (cmds (car series)) | 2052 (cmds (car series)) |
2005 (gprops (nth 1 series)) | 2053 (gprops (nth 1 series)) |
2006 match ;; The byte compiler incorrectly complains about this. Keep it! | 2054 match ;; The byte compiler incorrectly complains about this. Keep it! |
2007 cmd type lprops) | 2055 cmd type lprops) |
2008 (while (setq cmd (pop cmds)) | 2056 (while (setq cmd (pop cmds)) |
2009 (setq type (car cmd) match (nth 1 cmd) lprops (nth 2 cmd)) | 2057 (setq type (car cmd) match (eval (nth 1 cmd)) lprops (nth 2 cmd)) |
2010 (cond | 2058 (cond |
2011 ((eq type 'agenda) | 2059 ((eq type 'agenda) |
2012 (org-let2 gprops lprops | 2060 (org-let2 gprops lprops |
2013 '(call-interactively 'org-agenda-list))) | 2061 '(call-interactively 'org-agenda-list))) |
2014 ((eq type 'alltodo) | 2062 ((eq type 'alltodo) |
2055 (list 'org-tags-view nil cmd-key))) | 2103 (list 'org-tags-view nil cmd-key))) |
2056 (eval (list 'let (nreverse pars) (list 'org-agenda nil cmd-key)))) | 2104 (eval (list 'let (nreverse pars) (list 'org-agenda nil cmd-key)))) |
2057 (set-buffer org-agenda-buffer-name) | 2105 (set-buffer org-agenda-buffer-name) |
2058 (princ (org-encode-for-stdout (buffer-string))))) | 2106 (princ (org-encode-for-stdout (buffer-string))))) |
2059 | 2107 |
2108 ;(defun org-encode-for-stdout (string) | |
2109 ; (if (fboundp 'encode-coding-string) | |
2110 ; (encode-coding-string string buffer-file-coding-system) | |
2111 ; string)) | |
2112 | |
2060 (defun org-encode-for-stdout (string) | 2113 (defun org-encode-for-stdout (string) |
2061 (if (fboundp 'encode-coding-string) | 2114 string) |
2062 (encode-coding-string string buffer-file-coding-system) | |
2063 string)) | |
2064 | 2115 |
2065 (defvar org-agenda-info nil) | 2116 (defvar org-agenda-info nil) |
2066 | 2117 |
2067 ;;;###autoload | 2118 ;;;###autoload |
2068 (defmacro org-batch-agenda-csv (cmd-key &rest parameters) | 2119 (defmacro org-batch-agenda-csv (cmd-key &rest parameters) |
2210 'org-agenda-structural-header t) | 2261 'org-agenda-structural-header t) |
2211 (when org-agenda-title-append | 2262 (when org-agenda-title-append |
2212 (put-text-property (point-at-bol) (point-at-eol) | 2263 (put-text-property (point-at-bol) (point-at-eol) |
2213 'org-agenda-title-append org-agenda-title-append)))) | 2264 'org-agenda-title-append org-agenda-title-append)))) |
2214 | 2265 |
2215 | 2266 (defvar org-mobile-creating-agendas) |
2216 (defun org-write-agenda (file &optional open nosettings) | 2267 (defun org-write-agenda (file &optional open nosettings) |
2217 "Write the current buffer (an agenda view) as a file. | 2268 "Write the current buffer (an agenda view) as a file. |
2218 Depending on the extension of the file name, plain text (.txt), | 2269 Depending on the extension of the file name, plain text (.txt), |
2219 HTML (.html or .htm) or Postscript (.ps) is produced. | 2270 HTML (.html or .htm) or Postscript (.ps) is produced. |
2220 If the extension is .ics, run icalendar export over all files used | 2271 If the extension is .ics, run icalendar export over all files used |
2221 to construct the agenda and limit the export to entries listed in the | 2272 to construct the agenda and limit the export to entries listed in the |
2222 agenda now. | 2273 agenda now. |
2223 With prefic argument OPEN, open the new file immediately. | 2274 With prefix argument OPEN, open the new file immediately. |
2224 If NOSETTINGS is given, do not scope the settings of | 2275 If NOSETTINGS is given, do not scope the settings of |
2225 `org-agenda-exporter-settings' into the export commands. This is used when | 2276 `org-agenda-exporter-settings' into the export commands. This is used when |
2226 the settings have already been scoped and we do not wish to overrule other, | 2277 the settings have already been scoped and we do not wish to overrule other, |
2227 higher priority settings." | 2278 higher priority settings." |
2228 (interactive "FWrite agenda to file: \nP") | 2279 (interactive "FWrite agenda to file: \nP") |
2233 ((string-match "\\.ps\\'" file) (require 'ps-print))) | 2284 ((string-match "\\.ps\\'" file) (require 'ps-print))) |
2234 (org-let (if nosettings nil org-agenda-exporter-settings) | 2285 (org-let (if nosettings nil org-agenda-exporter-settings) |
2235 '(save-excursion | 2286 '(save-excursion |
2236 (save-window-excursion | 2287 (save-window-excursion |
2237 (org-agenda-mark-filtered-text) | 2288 (org-agenda-mark-filtered-text) |
2238 (let ((bs (copy-sequence (buffer-string))) beg app) | 2289 (let ((bs (copy-sequence (buffer-string))) beg) |
2239 (org-agenda-unmark-filtered-text) | 2290 (org-agenda-unmark-filtered-text) |
2240 (with-temp-buffer | 2291 (with-temp-buffer |
2241 (insert bs) | 2292 (insert bs) |
2242 (org-agenda-remove-marked-text 'org-filtered) | 2293 (org-agenda-remove-marked-text 'org-filtered) |
2243 (while (setq beg (text-property-any (point-min) (point-max) | 2294 (while (setq beg (text-property-any (point-min) (point-max) |
2245 (delete-region | 2296 (delete-region |
2246 beg (or (next-single-property-change beg 'org-filtered) | 2297 beg (or (next-single-property-change beg 'org-filtered) |
2247 (point-max)))) | 2298 (point-max)))) |
2248 (run-hooks 'org-agenda-before-write-hook) | 2299 (run-hooks 'org-agenda-before-write-hook) |
2249 (cond | 2300 (cond |
2301 ((org-bound-and-true-p org-mobile-creating-agendas) | |
2302 (org-mobile-write-agenda-for-mobile file)) | |
2250 ((string-match "\\.html?\\'" file) | 2303 ((string-match "\\.html?\\'" file) |
2251 (set-buffer (htmlize-buffer (current-buffer))) | 2304 (set-buffer (htmlize-buffer (current-buffer))) |
2252 | 2305 |
2253 (when (and org-agenda-export-html-style | 2306 (when (and org-agenda-export-html-style |
2254 (string-match "<style>" org-agenda-export-html-style)) | 2307 (string-match "<style>" org-agenda-export-html-style)) |
2273 (call-process "ps2pdf" nil nil nil | 2326 (call-process "ps2pdf" nil nil nil |
2274 (expand-file-name | 2327 (expand-file-name |
2275 (concat (file-name-sans-extension file) ".ps")) | 2328 (concat (file-name-sans-extension file) ".ps")) |
2276 (expand-file-name file)) | 2329 (expand-file-name file)) |
2277 (message "PDF written to %s" file)) | 2330 (message "PDF written to %s" file)) |
2278 ((string-match "\\.org\\'" file) | |
2279 (let ((all (buffer-string)) in-date id pl prefix line) | |
2280 (with-temp-file file | |
2281 (org-mode) | |
2282 (insert all) | |
2283 (goto-char (point-min)) | |
2284 (while (not (eobp)) | |
2285 (cond | |
2286 ((looking-at "[ \t]*$")) ; keep empty lines | |
2287 ((looking-at "=+$") | |
2288 ;; remove underlining | |
2289 (delete-region (point) (point-at-eol))) | |
2290 ((get-text-property (point) 'org-agenda-structural-header) | |
2291 (setq in-date nil) | |
2292 (setq app (get-text-property (point) | |
2293 'org-agenda-title-append)) | |
2294 (setq short (get-text-property (point) | |
2295 'short-heading)) | |
2296 (when (and short (looking-at ".+")) | |
2297 (replace-match short) | |
2298 (beginning-of-line 1)) | |
2299 (when app | |
2300 (end-of-line 1) | |
2301 (insert app) | |
2302 (beginning-of-line 1)) | |
2303 (insert "* ")) | |
2304 ((get-text-property (point) 'org-agenda-date-header) | |
2305 (setq in-date t) | |
2306 (insert "** ")) | |
2307 ((setq m (or (get-text-property (point) 'org-hd-marker) | |
2308 (get-text-property (point) 'org-marker))) | |
2309 (if (setq pl (get-text-property (point) 'prefix-length)) | |
2310 (progn | |
2311 (setq prefix (org-trim (buffer-substring | |
2312 (point) (+ (point) pl))) | |
2313 line (org-trim (buffer-substring | |
2314 (+ (point) pl) | |
2315 (point-at-eol)))) | |
2316 (delete-region (point-at-bol) (point-at-eol)) | |
2317 (insert line "<break>" prefix) | |
2318 (beginning-of-line 1)) | |
2319 (and (looking-at "[ \t]+") (replace-match ""))) | |
2320 (insert (if in-date "*** " "** ")) | |
2321 (end-of-line 1) | |
2322 (insert "\n") | |
2323 (insert (org-agenda-get-some-entry-text | |
2324 m 10 " " 'planning) | |
2325 "\n") | |
2326 (when (setq id | |
2327 (if (org-bound-and-true-p | |
2328 org-mobile-force-id-on-agenda-items) | |
2329 (org-id-get m 'create) | |
2330 (org-entry-get m "ID"))) | |
2331 (insert " :PROPERTIES:\n :ORIGINAL_ID: " id | |
2332 "\n :END:\n")))) | |
2333 (beginning-of-line 2))) | |
2334 (message "Agenda written to Org file %s" file))) | |
2335 ((string-match "\\.ics\\'" file) | 2331 ((string-match "\\.ics\\'" file) |
2336 (require 'org-icalendar) | 2332 (require 'org-icalendar) |
2337 (let ((org-agenda-marker-table | 2333 (let ((org-agenda-marker-table |
2338 (org-create-marker-find-array | 2334 (org-create-marker-find-array |
2339 (org-agenda-collect-markers))) | 2335 (org-agenda-collect-markers))) |
2384 (defun org-agenda-add-entry-text () | 2380 (defun org-agenda-add-entry-text () |
2385 "Add entry text to agenda lines. | 2381 "Add entry text to agenda lines. |
2386 This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the | 2382 This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the |
2387 entry text following headings shown in the agenda. | 2383 entry text following headings shown in the agenda. |
2388 Drawers will be excluded, also the line with scheduling/deadline info." | 2384 Drawers will be excluded, also the line with scheduling/deadline info." |
2389 (when (> org-agenda-add-entry-text-maxlines 0) | 2385 (when (and (> org-agenda-add-entry-text-maxlines 0) |
2386 (not (org-bound-and-true-p org-mobile-creating-agendas))) | |
2390 (let (m txt) | 2387 (let (m txt) |
2391 (goto-char (point-min)) | 2388 (goto-char (point-min)) |
2392 (while (not (eobp)) | 2389 (while (not (eobp)) |
2393 (if (not (setq m (org-get-at-bol 'org-hd-marker))) | 2390 (if (not (setq m (org-get-at-bol 'org-hd-marker))) |
2394 (beginning-of-line 2) | 2391 (beginning-of-line 2) |
2400 (defun org-agenda-get-some-entry-text (marker n-lines &optional indent | 2397 (defun org-agenda-get-some-entry-text (marker n-lines &optional indent |
2401 &rest keep) | 2398 &rest keep) |
2402 "Extract entry text from MARKER, at most N-LINES lines. | 2399 "Extract entry text from MARKER, at most N-LINES lines. |
2403 This will ignore drawers etc, just get the text. | 2400 This will ignore drawers etc, just get the text. |
2404 If INDENT is given, prefix every line with this string. If KEEP is | 2401 If INDENT is given, prefix every line with this string. If KEEP is |
2405 given, it is a list of symbols, defining stuff that hould not be | 2402 given, it is a list of symbols, defining stuff that should not be |
2406 removed from the entry content. Currently only `planning' is allowed here." | 2403 removed from the entry content. Currently only `planning' is allowed here." |
2407 (let (txt drawer-re kwd-time-re ind) | 2404 (let (txt drawer-re kwd-time-re ind) |
2408 (save-excursion | 2405 (save-excursion |
2409 (with-current-buffer (marker-buffer marker) | 2406 (with-current-buffer (marker-buffer marker) |
2410 (if (not (org-mode-p)) | 2407 (if (not (org-mode-p)) |
2624 (org-agenda-dim-blocked-tasks)) | 2621 (org-agenda-dim-blocked-tasks)) |
2625 (org-agenda-mark-clocking-task) | 2622 (org-agenda-mark-clocking-task) |
2626 (when org-agenda-entry-text-mode | 2623 (when org-agenda-entry-text-mode |
2627 (org-agenda-entry-text-hide) | 2624 (org-agenda-entry-text-hide) |
2628 (org-agenda-entry-text-show)) | 2625 (org-agenda-entry-text-show)) |
2626 (if (functionp 'org-habit-insert-consistency-graphs) | |
2627 (org-habit-insert-consistency-graphs)) | |
2629 (run-hooks 'org-finalize-agenda-hook) | 2628 (run-hooks 'org-finalize-agenda-hook) |
2630 (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) | 2629 (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) |
2631 (when (get 'org-agenda-filter :preset-filter) | 2630 (when (get 'org-agenda-filter :preset-filter) |
2632 (org-agenda-filter-apply org-agenda-filter)) | 2631 (org-agenda-filter-apply org-agenda-filter)) |
2633 ))) | 2632 ))) |
2781 org-agenda-markers)) | 2780 org-agenda-markers)) |
2782 | 2781 |
2783 ;;; Entry text mode | 2782 ;;; Entry text mode |
2784 | 2783 |
2785 (defun org-agenda-entry-text-show-here () | 2784 (defun org-agenda-entry-text-show-here () |
2786 "Add some text from te entry as context to the current line." | 2785 "Add some text from the entry as context to the current line." |
2787 (let (m txt o) | 2786 (let (m txt o) |
2788 (setq m (org-get-at-bol 'org-hd-marker)) | 2787 (setq m (org-get-at-bol 'org-hd-marker)) |
2789 (unless (marker-buffer m) | 2788 (unless (marker-buffer m) |
2790 (error "No marker points to an entry here")) | 2789 (error "No marker points to an entry here")) |
2791 (setq txt (concat "\n" (org-no-properties | 2790 (setq txt (concat "\n" (org-no-properties |
3052 (when rtnall | 3051 (when rtnall |
3053 (insert "All currently open TODO items:\n") | 3052 (insert "All currently open TODO items:\n") |
3054 (add-text-properties (point-min) (1- (point)) | 3053 (add-text-properties (point-min) (1- (point)) |
3055 (list 'face 'org-agenda-structure | 3054 (list 'face 'org-agenda-structure |
3056 'short-heading "All TODO items")) | 3055 'short-heading "All TODO items")) |
3056 (org-agenda-mark-header-line (point-min)) | |
3057 (insert (org-finalize-agenda-entries rtnall) "\n"))) | 3057 (insert (org-finalize-agenda-entries rtnall) "\n"))) |
3058 (unless org-agenda-compact-blocks | 3058 (unless org-agenda-compact-blocks |
3059 (let* ((d1 (car day-numbers)) | 3059 (let* ((d1 (car day-numbers)) |
3060 (d2 (org-last day-numbers)) | 3060 (d2 (org-last day-numbers)) |
3061 (w1 (org-days-to-iso-week d1)) | 3061 (w1 (org-days-to-iso-week d1)) |
3191 string into this function. If EDIT-AT is non-nil, it means that the | 3191 string into this function. If EDIT-AT is non-nil, it means that the |
3192 user should get a chance to edit this string, with cursor at position | 3192 user should get a chance to edit this string, with cursor at position |
3193 EDIT-AT. | 3193 EDIT-AT. |
3194 | 3194 |
3195 The search string is broken into \"words\" by splitting at whitespace. | 3195 The search string is broken into \"words\" by splitting at whitespace. |
3196 The individual words are then interpreted as a boolean expression with | 3196 Depending on the variable `org-agenda-search-view-search-words-only' |
3197 logical AND. Words prefixed with a minus must not occur in the entry. | 3197 and on whether the first character in the search string is \"+\" or \"-\", |
3198 Words without a prefix or prefixed with a plus must occur in the entry. | 3198 The string is then interpreted either as a substring with variable amounts |
3199 Matching is case-insensitive and the words are enclosed by word delimiters. | 3199 of whitespace, or as a list or individual words that should be matched. |
3200 | |
3201 The default is a substring match, where each space in the search string | |
3202 can expand to an arbitrary amount of whitespace, including newlines. | |
3203 | |
3204 If matching individual words, these words are then interpreted as a | |
3205 boolean expression with logical AND. Words prefixed with a minus must | |
3206 not occur in the entry. Words without a prefix or prefixed with a plus | |
3207 must occur in the entry. Matching is case-insensitive and the words | |
3208 are enclosed by word delimiters. | |
3200 | 3209 |
3201 Words enclosed by curly braces are interpreted as regular expressions | 3210 Words enclosed by curly braces are interpreted as regular expressions |
3202 that must or must not match in the entry. | 3211 that must or must not match in the entry. |
3203 | 3212 |
3204 If the search string starts with an asterisk, search only in headlines. | 3213 If the search string starts with an asterisk, search only in headlines. |
3216 'done-face 'org-agenda-done | 3225 'done-face 'org-agenda-done |
3217 'org-not-done-regexp org-not-done-regexp | 3226 'org-not-done-regexp org-not-done-regexp |
3218 'org-todo-regexp org-todo-regexp | 3227 'org-todo-regexp org-todo-regexp |
3219 'org-complex-heading-regexp org-complex-heading-regexp | 3228 'org-complex-heading-regexp org-complex-heading-regexp |
3220 'mouse-face 'highlight | 3229 'mouse-face 'highlight |
3221 'keymap org-agenda-keymap | |
3222 'help-echo (format "mouse-2 or RET jump to location"))) | 3230 'help-echo (format "mouse-2 or RET jump to location"))) |
3223 regexp rtn rtnall files file pos | 3231 regexp rtn rtnall files file pos |
3224 marker category tags c neg re | 3232 marker category tags c neg re as-words |
3225 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) | 3233 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) |
3226 (unless (and (not edit-at) | 3234 (unless (and (not edit-at) |
3227 (stringp string) | 3235 (stringp string) |
3228 (string-match "\\S-" string)) | 3236 (string-match "\\S-" string)) |
3229 (setq string (read-string "[+-]Word/{Regexp} ...: " | 3237 (setq string (read-string "[+-]Word/{Regexp} ...: " |
3242 words (substring string 1)) | 3250 words (substring string 1)) |
3243 (setq words string)) | 3251 (setq words string)) |
3244 (when (equal (string-to-char words) ?!) | 3252 (when (equal (string-to-char words) ?!) |
3245 (setq todo-only t | 3253 (setq todo-only t |
3246 words (substring words 1))) | 3254 words (substring words 1))) |
3255 (if (or org-agenda-search-view-search-words-only | |
3256 (member (string-to-char string) '(?- ?+))) | |
3257 (setq as-words t)) | |
3247 (setq words (org-split-string words)) | 3258 (setq words (org-split-string words)) |
3248 (mapc (lambda (w) | 3259 (if as-words |
3249 (setq c (string-to-char w)) | 3260 (mapc (lambda (w) |
3250 (if (equal c ?-) | 3261 (setq c (string-to-char w)) |
3251 (setq neg t w (substring w 1)) | 3262 (if (equal c ?-) |
3252 (if (equal c ?+) | 3263 (setq neg t w (substring w 1)) |
3253 (setq neg nil w (substring w 1)) | 3264 (if (equal c ?+) |
3254 (setq neg nil))) | 3265 (setq neg nil w (substring w 1)) |
3255 (if (string-match "\\`{.*}\\'" w) | 3266 (setq neg nil))) |
3256 (setq re (substring w 1 -1)) | 3267 (if (string-match "\\`{.*}\\'" w) |
3257 (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) | 3268 (setq re (substring w 1 -1)) |
3258 (if neg (push re regexps-) (push re regexps+))) | 3269 (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) |
3259 words) | 3270 (if neg (push re regexps-) (push re regexps+))) |
3271 words) | |
3272 (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") | |
3273 regexps+)) | |
3260 (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) | 3274 (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) |
3261 (if (not regexps+) | 3275 (if (not regexps+) |
3262 (setq regexp (concat "^" org-outline-regexp)) | 3276 (setq regexp (concat "^" org-outline-regexp)) |
3263 (setq regexp (pop regexps+)) | 3277 (setq regexp (pop regexps+)) |
3264 (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?" | 3278 (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?" |
3758 | 3772 |
3759 (defun org-modify-diary-entry-string (string) | 3773 (defun org-modify-diary-entry-string (string) |
3760 "Add text properties to string, allowing org-mode to act on it." | 3774 "Add text properties to string, allowing org-mode to act on it." |
3761 (org-add-props string nil | 3775 (org-add-props string nil |
3762 'mouse-face 'highlight | 3776 'mouse-face 'highlight |
3763 'keymap org-agenda-keymap | |
3764 'help-echo (if buffer-file-name | 3777 'help-echo (if buffer-file-name |
3765 (format "mouse-2 or RET jump to diary file %s" | 3778 (format "mouse-2 or RET jump to diary file %s" |
3766 (abbreviate-file-name buffer-file-name)) | 3779 (abbreviate-file-name buffer-file-name)) |
3767 "") | 3780 "") |
3768 'org-agenda-diary-link t | 3781 'org-agenda-diary-link t |
3911 'done-face 'org-agenda-done | 3924 'done-face 'org-agenda-done |
3912 'org-not-done-regexp org-not-done-regexp | 3925 'org-not-done-regexp org-not-done-regexp |
3913 'org-todo-regexp org-todo-regexp | 3926 'org-todo-regexp org-todo-regexp |
3914 'org-complex-heading-regexp org-complex-heading-regexp | 3927 'org-complex-heading-regexp org-complex-heading-regexp |
3915 'mouse-face 'highlight | 3928 'mouse-face 'highlight |
3916 'keymap org-agenda-keymap | |
3917 'help-echo | 3929 'help-echo |
3918 (format "mouse-2 or RET jump to org file %s" | 3930 (format "mouse-2 or RET jump to org file %s" |
3919 (abbreviate-file-name buffer-file-name)))) | 3931 (abbreviate-file-name buffer-file-name)))) |
3920 (regexp (concat "^\\*+[ \t]+\\(" | 3932 (regexp (concat "^\\*+[ \t]+\\(" |
3921 (if org-select-this-todo-keyword | 3933 (if org-select-this-todo-keyword |
3982 (let* ((props (list 'face nil | 3994 (let* ((props (list 'face nil |
3983 'org-not-done-regexp org-not-done-regexp | 3995 'org-not-done-regexp org-not-done-regexp |
3984 'org-todo-regexp org-todo-regexp | 3996 'org-todo-regexp org-todo-regexp |
3985 'org-complex-heading-regexp org-complex-heading-regexp | 3997 'org-complex-heading-regexp org-complex-heading-regexp |
3986 'mouse-face 'highlight | 3998 'mouse-face 'highlight |
3987 'keymap org-agenda-keymap | |
3988 'help-echo | 3999 'help-echo |
3989 (format "mouse-2 or RET jump to org file %s" | 4000 (format "mouse-2 or RET jump to org file %s" |
3990 (abbreviate-file-name buffer-file-name)))) | 4001 (abbreviate-file-name buffer-file-name)))) |
3991 (d1 (calendar-absolute-from-gregorian date)) | 4002 (d1 (calendar-absolute-from-gregorian date)) |
3992 (remove-re | 4003 (remove-re |
4076 (defun org-agenda-get-sexps () | 4087 (defun org-agenda-get-sexps () |
4077 "Return the sexp information for agenda display." | 4088 "Return the sexp information for agenda display." |
4078 (require 'diary-lib) | 4089 (require 'diary-lib) |
4079 (let* ((props (list 'face nil | 4090 (let* ((props (list 'face nil |
4080 'mouse-face 'highlight | 4091 'mouse-face 'highlight |
4081 'keymap org-agenda-keymap | |
4082 'help-echo | 4092 'help-echo |
4083 (format "mouse-2 or RET jump to org file %s" | 4093 (format "mouse-2 or RET jump to org file %s" |
4084 (abbreviate-file-name buffer-file-name)))) | 4094 (abbreviate-file-name buffer-file-name)))) |
4085 (regexp "^&?%%(") | 4095 (regexp "^&?%%(") |
4086 marker category ee txt tags entry result beg b sexp sexp-entry | 4096 marker category ee txt tags entry result beg b sexp sexp-entry |
4121 "Return the logged TODO entries for agenda display." | 4131 "Return the logged TODO entries for agenda display." |
4122 (let* ((props (list 'mouse-face 'highlight | 4132 (let* ((props (list 'mouse-face 'highlight |
4123 'org-not-done-regexp org-not-done-regexp | 4133 'org-not-done-regexp org-not-done-regexp |
4124 'org-todo-regexp org-todo-regexp | 4134 'org-todo-regexp org-todo-regexp |
4125 'org-complex-heading-regexp org-complex-heading-regexp | 4135 'org-complex-heading-regexp org-complex-heading-regexp |
4126 'keymap org-agenda-keymap | |
4127 'help-echo | 4136 'help-echo |
4128 (format "mouse-2 or RET jump to org file %s" | 4137 (format "mouse-2 or RET jump to org file %s" |
4129 (abbreviate-file-name buffer-file-name)))) | 4138 (abbreviate-file-name buffer-file-name)))) |
4130 (items (if (consp org-agenda-show-log) | 4139 (items (if (consp org-agenda-show-log) |
4131 org-agenda-show-log | 4140 org-agenda-show-log |
4215 "Return the deadline information for agenda display." | 4224 "Return the deadline information for agenda display." |
4216 (let* ((props (list 'mouse-face 'highlight | 4225 (let* ((props (list 'mouse-face 'highlight |
4217 'org-not-done-regexp org-not-done-regexp | 4226 'org-not-done-regexp org-not-done-regexp |
4218 'org-todo-regexp org-todo-regexp | 4227 'org-todo-regexp org-todo-regexp |
4219 'org-complex-heading-regexp org-complex-heading-regexp | 4228 'org-complex-heading-regexp org-complex-heading-regexp |
4220 'keymap org-agenda-keymap | |
4221 'help-echo | 4229 'help-echo |
4222 (format "mouse-2 or RET jump to org file %s" | 4230 (format "mouse-2 or RET jump to org file %s" |
4223 (abbreviate-file-name buffer-file-name)))) | 4231 (abbreviate-file-name buffer-file-name)))) |
4224 (regexp org-deadline-time-regexp) | 4232 (regexp org-deadline-time-regexp) |
4225 (todayp (org-agenda-todayp date)) ; DATE bound by calendar | 4233 (todayp (org-agenda-todayp date)) ; DATE bound by calendar |
4241 dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) | 4249 dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) |
4242 upcomingp (and todayp (> diff 0))) | 4250 upcomingp (and todayp (> diff 0))) |
4243 ;; When to show a deadline in the calendar: | 4251 ;; When to show a deadline in the calendar: |
4244 ;; If the expiration is within wdays warning time. | 4252 ;; If the expiration is within wdays warning time. |
4245 ;; Past-due deadlines are only shown on the current date | 4253 ;; Past-due deadlines are only shown on the current date |
4246 (if (or (and (<= diff wdays) | 4254 (if (and (or (and (<= diff wdays) |
4247 (and todayp (not org-agenda-only-exact-dates))) | 4255 (and todayp (not org-agenda-only-exact-dates))) |
4248 (= diff 0)) | 4256 (= diff 0))) |
4249 (save-excursion | 4257 (save-excursion |
4250 (setq todo-state (org-get-todo-state)) | 4258 (setq todo-state (org-get-todo-state)) |
4251 (setq donep (member todo-state org-done-keywords)) | 4259 (setq donep (member todo-state org-done-keywords)) |
4252 (if (and donep | 4260 (if (and donep |
4253 (or org-agenda-skip-deadline-if-done | 4261 (or org-agenda-skip-deadline-if-done |
4309 (let* ((props (list 'org-not-done-regexp org-not-done-regexp | 4317 (let* ((props (list 'org-not-done-regexp org-not-done-regexp |
4310 'org-todo-regexp org-todo-regexp | 4318 'org-todo-regexp org-todo-regexp |
4311 'org-complex-heading-regexp org-complex-heading-regexp | 4319 'org-complex-heading-regexp org-complex-heading-regexp |
4312 'done-face 'org-agenda-done | 4320 'done-face 'org-agenda-done |
4313 'mouse-face 'highlight | 4321 'mouse-face 'highlight |
4314 'keymap org-agenda-keymap | |
4315 'help-echo | 4322 'help-echo |
4316 (format "mouse-2 or RET jump to org file %s" | 4323 (format "mouse-2 or RET jump to org file %s" |
4317 (abbreviate-file-name buffer-file-name)))) | 4324 (abbreviate-file-name buffer-file-name)))) |
4318 (regexp org-scheduled-time-regexp) | 4325 (regexp org-scheduled-time-regexp) |
4319 (todayp (org-agenda-todayp date)) ; DATE bound by calendar | 4326 (todayp (org-agenda-todayp date)) ; DATE bound by calendar |
4320 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 4327 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
4321 mm | 4328 mm |
4322 (deadline-position-alist | 4329 (deadline-position-alist |
4323 (mapcar (lambda (a) (and (setq mm (get-text-property | 4330 (mapcar (lambda (a) (and (setq mm (get-text-property |
4324 0 'org-hd-marker a)) | 4331 0 'org-hd-marker a)) |
4325 (cons (marker-position mm) a))) | 4332 (cons (marker-position mm) a))) |
4326 deadline-results)) | 4333 deadline-results)) |
4327 d2 diff pos pos1 category tags donep | 4334 d2 diff pos pos1 category tags donep |
4328 ee txt head pastschedp todo-state face timestr s) | 4335 ee txt head pastschedp todo-state face timestr s habitp) |
4329 (goto-char (point-min)) | 4336 (goto-char (point-min)) |
4330 (while (re-search-forward regexp nil t) | 4337 (while (re-search-forward regexp nil t) |
4331 (catch :skip | 4338 (catch :skip |
4332 (org-agenda-skip) | 4339 (org-agenda-skip) |
4333 (setq s (match-string 1) | 4340 (setq s (match-string 1) |
4338 org-agenda-repeating-timestamp-show-all) | 4345 org-agenda-repeating-timestamp-show-all) |
4339 diff (- d2 d1)) | 4346 diff (- d2 d1)) |
4340 (setq pastschedp (and todayp (< diff 0))) | 4347 (setq pastschedp (and todayp (< diff 0))) |
4341 ;; When to show a scheduled item in the calendar: | 4348 ;; When to show a scheduled item in the calendar: |
4342 ;; If it is on or past the date. | 4349 ;; If it is on or past the date. |
4343 (if (or (and (< diff 0) | 4350 (when (or (and (< diff 0) |
4344 (< (abs diff) org-scheduled-past-days) | 4351 (< (abs diff) org-scheduled-past-days) |
4345 (and todayp (not org-agenda-only-exact-dates))) | 4352 (and todayp (not org-agenda-only-exact-dates))) |
4346 (= diff 0)) | 4353 (= diff 0)) |
4347 (save-excursion | 4354 (save-excursion |
4348 (setq todo-state (org-get-todo-state)) | 4355 (setq todo-state (org-get-todo-state)) |
4349 (setq donep (member todo-state org-done-keywords)) | 4356 (setq donep (member todo-state org-done-keywords)) |
4350 (if (and donep | 4357 (setq habitp (and (functionp 'org-is-habit-p) |
4351 (or org-agenda-skip-scheduled-if-done | 4358 (org-is-habit-p))) |
4352 (not (= diff 0)))) | 4359 (if (and donep |
4353 (setq txt nil) | 4360 (or habitp org-agenda-skip-scheduled-if-done |
4354 (setq category (org-get-category)) | 4361 (not (= diff 0)))) |
4355 (if (not (re-search-backward "^\\*+[ \t]+" nil t)) | 4362 (setq txt nil) |
4356 (setq txt org-agenda-no-heading-message) | 4363 (setq category (org-get-category)) |
4357 (goto-char (match-end 0)) | 4364 (if (not (re-search-backward "^\\*+[ \t]+" nil t)) |
4358 (setq pos1 (match-beginning 0)) | 4365 (setq txt org-agenda-no-heading-message) |
4366 (goto-char (match-end 0)) | |
4367 (setq pos1 (match-beginning 0)) | |
4368 (if habitp | |
4369 (if (or (not org-habit-show-habits) | |
4370 (and (not todayp) | |
4371 org-habit-show-habits-only-for-today)) | |
4372 (throw :skip nil)) | |
4359 (if (and | 4373 (if (and |
4360 (or (eq t org-agenda-skip-scheduled-if-deadline-is-shown) | 4374 (or (eq t org-agenda-skip-scheduled-if-deadline-is-shown) |
4361 (and org-agenda-skip-scheduled-if-deadline-is-shown | 4375 (and org-agenda-skip-scheduled-if-deadline-is-shown |
4362 pastschedp)) | 4376 pastschedp)) |
4363 (setq mm (assoc pos1 deadline-position-alist))) | 4377 (setq mm (assoc pos1 deadline-position-alist))) |
4364 (throw :skip nil)) | 4378 (throw :skip nil))) |
4365 (setq tags (org-get-tags-at)) | 4379 (setq tags (org-get-tags-at)) |
4366 (setq head (buffer-substring-no-properties | 4380 (setq head (buffer-substring-no-properties |
4367 (point) | 4381 (point) |
4368 (progn (skip-chars-forward "^\r\n") (point)))) | 4382 (progn (skip-chars-forward "^\r\n") (point)))) |
4369 (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) | 4383 (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) |
4370 (setq timestr | 4384 (setq timestr |
4371 (concat (substring s (match-beginning 1)) " ")) | 4385 (concat (substring s (match-beginning 1)) " ")) |
4372 (setq timestr 'time)) | 4386 (setq timestr 'time)) |
4373 (setq txt (org-format-agenda-item | 4387 (setq txt (org-format-agenda-item |
4374 (if (= diff 0) | 4388 (if (= diff 0) |
4375 (car org-agenda-scheduled-leaders) | 4389 (car org-agenda-scheduled-leaders) |
4376 (format (nth 1 org-agenda-scheduled-leaders) | 4390 (format (nth 1 org-agenda-scheduled-leaders) |
4377 (- 1 diff))) | 4391 (- 1 diff))) |
4378 head category tags | 4392 head category tags |
4379 (if (not (= diff 0)) nil timestr))))) | 4393 (if (not (= diff 0)) nil timestr) |
4380 (when txt | 4394 nil nil habitp)))) |
4381 (setq face | 4395 (when txt |
4382 (cond | 4396 (setq face |
4383 (pastschedp 'org-scheduled-previously) | 4397 (cond |
4384 (todayp 'org-scheduled-today) | 4398 ((and (not habitp) pastschedp) |
4385 (t 'org-scheduled))) | 4399 'org-scheduled-previously) |
4386 (org-add-props txt props | 4400 (todayp 'org-scheduled-today) |
4387 'undone-face face | 4401 (t 'org-scheduled)) |
4388 'face (if donep 'org-agenda-done face) | 4402 habitp (and habitp (org-habit-parse-todo))) |
4389 'org-marker (org-agenda-new-marker pos) | 4403 (org-add-props txt props |
4390 'org-hd-marker (org-agenda-new-marker pos1) | 4404 'undone-face face |
4391 'type (if pastschedp "past-scheduled" "scheduled") | 4405 'face (if donep 'org-agenda-done face) |
4392 'date (if pastschedp d2 date) | 4406 'org-marker (org-agenda-new-marker pos) |
4393 'priority (+ 94 (- 5 diff) (org-get-priority txt)) | 4407 'org-hd-marker (org-agenda-new-marker pos1) |
4394 'org-category category | 4408 'type (if pastschedp "past-scheduled" "scheduled") |
4395 'todo-state todo-state) | 4409 'date (if pastschedp d2 date) |
4396 (push txt ee)))))) | 4410 'priority (if habitp |
4411 (org-habit-get-priority habitp) | |
4412 (+ 94 (- 5 diff) (org-get-priority txt))) | |
4413 'org-category category | |
4414 'org-habit-p habitp | |
4415 'todo-state todo-state) | |
4416 (push txt ee)))))) | |
4397 (nreverse ee))) | 4417 (nreverse ee))) |
4398 | 4418 |
4399 (defun org-agenda-get-blocks () | 4419 (defun org-agenda-get-blocks () |
4400 "Return the date-range information for agenda display." | 4420 "Return the date-range information for agenda display." |
4401 (let* ((props (list 'face nil | 4421 (let* ((props (list 'face nil |
4402 'org-not-done-regexp org-not-done-regexp | 4422 'org-not-done-regexp org-not-done-regexp |
4403 'org-todo-regexp org-todo-regexp | 4423 'org-todo-regexp org-todo-regexp |
4404 'org-complex-heading-regexp org-complex-heading-regexp | 4424 'org-complex-heading-regexp org-complex-heading-regexp |
4405 'mouse-face 'highlight | 4425 'mouse-face 'highlight |
4406 'keymap org-agenda-keymap | |
4407 'help-echo | 4426 'help-echo |
4408 (format "mouse-2 or RET jump to org file %s" | 4427 (format "mouse-2 or RET jump to org file %s" |
4409 (abbreviate-file-name buffer-file-name)))) | 4428 (abbreviate-file-name buffer-file-name)))) |
4410 (regexp org-tr-regexp) | 4429 (regexp org-tr-regexp) |
4411 (d0 (calendar-absolute-from-gregorian date)) | 4430 (d0 (calendar-absolute-from-gregorian date)) |
4466 (defvar org-prefix-has-effort nil | 4485 (defvar org-prefix-has-effort nil |
4467 "A flag, set by `org-compile-prefix-format'. | 4486 "A flag, set by `org-compile-prefix-format'. |
4468 The flag is set if the currently compiled format contains a `%e'.") | 4487 The flag is set if the currently compiled format contains a `%e'.") |
4469 (defvar org-prefix-category-length nil | 4488 (defvar org-prefix-category-length nil |
4470 "Used by `org-compile-prefix-format' to remember the category field widh.") | 4489 "Used by `org-compile-prefix-format' to remember the category field widh.") |
4490 (defvar org-prefix-category-max-length nil | |
4491 "Used by `org-compile-prefix-format' to remember the category field widh.") | |
4471 | 4492 |
4472 (defun org-format-agenda-item (extra txt &optional category tags dotime | 4493 (defun org-format-agenda-item (extra txt &optional category tags dotime |
4473 noprefix remove-re) | 4494 noprefix remove-re habitp) |
4474 "Format TXT to be inserted into the agenda buffer. | 4495 "Format TXT to be inserted into the agenda buffer. |
4475 In particular, it adds the prefix and corresponding text properties. EXTRA | 4496 In particular, it adds the prefix and corresponding text properties. EXTRA |
4476 must be a string and replaces the `%s' specifier in the prefix format. | 4497 must be a string and replaces the `%s' specifier in the prefix format. |
4477 CATEGORY (string, symbol or nil) may be used to overrule the default | 4498 CATEGORY (string, symbol or nil) may be used to overrule the default |
4478 category taken from local variable or file name. It will replace the `%c' | 4499 category taken from local variable or file name. It will replace the `%c' |
4501 (ts (if dotime (concat | 4522 (ts (if dotime (concat |
4502 (if (stringp dotime) dotime "") | 4523 (if (stringp dotime) dotime "") |
4503 (and org-agenda-search-headline-for-time txt)))) | 4524 (and org-agenda-search-headline-for-time txt)))) |
4504 (time-of-day (and dotime (org-get-time-of-day ts))) | 4525 (time-of-day (and dotime (org-get-time-of-day ts))) |
4505 stamp plain s0 s1 s2 t1 t2 rtn srp l | 4526 stamp plain s0 s1 s2 t1 t2 rtn srp l |
4506 duration) | 4527 duration thecategory) |
4507 (and (org-mode-p) buffer-file-name | 4528 (and (org-mode-p) buffer-file-name |
4508 (add-to-list 'org-agenda-contributing-files buffer-file-name)) | 4529 (add-to-list 'org-agenda-contributing-files buffer-file-name)) |
4509 (when (and dotime time-of-day) | 4530 (when (and dotime time-of-day) |
4510 ;; Extract starting and ending time and move them to prefix | 4531 ;; Extract starting and ending time and move them to prefix |
4511 (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts)) | 4532 (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts)) |
4581 (setq rtn txt) | 4602 (setq rtn txt) |
4582 ;; Prepare the variables needed in the eval of the compiled format | 4603 ;; Prepare the variables needed in the eval of the compiled format |
4583 (setq time (cond (s2 (concat s1 "-" s2)) | 4604 (setq time (cond (s2 (concat s1 "-" s2)) |
4584 (s1 (concat s1 "......")) | 4605 (s1 (concat s1 "......")) |
4585 (t "")) | 4606 (t "")) |
4586 extra (or extra "") | 4607 extra (or (and (not habitp) extra) "") |
4587 category (if (symbolp category) (symbol-name category) category)) | 4608 category (if (symbolp category) (symbol-name category) category) |
4588 (when (string-match org-bracket-link-regexp category) | 4609 thecategory (copy-sequence category)) |
4589 (setq l (if (match-end 3) | 4610 (if (string-match org-bracket-link-regexp category) |
4590 (- (match-end 3) (match-beginning 3)) | 4611 (progn |
4591 (- (match-end 1) (match-beginning 1)))) | 4612 (setq l (if (match-end 3) |
4592 (when (< l (or org-prefix-category-length 0)) | 4613 (- (match-end 3) (match-beginning 3)) |
4593 (setq category (copy-sequence category)) | 4614 (- (match-end 1) (match-beginning 1)))) |
4594 (org-add-props category nil | 4615 (when (< l (or org-prefix-category-length 0)) |
4595 'extra-space (make-string | 4616 (setq category (copy-sequence category)) |
4596 (- org-prefix-category-length l 1) ?\ )))) | 4617 (org-add-props category nil |
4618 'extra-space (make-string | |
4619 (- org-prefix-category-length l 1) ?\ )))) | |
4620 (if (and org-prefix-category-max-length | |
4621 (>= (length category) org-prefix-category-max-length)) | |
4622 (setq category (substring category 0 (1- org-prefix-category-max-length))))) | |
4597 ;; Evaluate the compiled format | 4623 ;; Evaluate the compiled format |
4598 (setq rtn (concat (eval org-prefix-format-compiled) txt))) | 4624 (setq rtn (concat (eval org-prefix-format-compiled) txt))) |
4599 | 4625 |
4600 ;; And finally add the text properties | 4626 ;; And finally add the text properties |
4601 (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) | 4627 (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) |
4602 (org-add-props rtn nil | 4628 (org-add-props rtn nil |
4603 'org-category (downcase category) | 4629 'org-category (if thecategory (downcase thecategory) category) |
4604 'tags (mapcar 'org-downcase-keep-props tags) | 4630 'tags (mapcar 'org-downcase-keep-props tags) |
4605 'org-highest-priority org-highest-priority | 4631 'org-highest-priority org-highest-priority |
4606 'org-lowest-priority org-lowest-priority | 4632 'org-lowest-priority org-lowest-priority |
4607 'prefix-length (- (length rtn) (length txt)) | 4633 'prefix-length (- (length rtn) (length txt)) |
4608 'time-of-day time-of-day | 4634 'time-of-day time-of-day |
4699 opt (match-beginning 1) | 4725 opt (match-beginning 1) |
4700 start (1+ (match-beginning 0))) | 4726 start (1+ (match-beginning 0))) |
4701 (if (equal var 'time) (setq org-prefix-has-time t)) | 4727 (if (equal var 'time) (setq org-prefix-has-time t)) |
4702 (if (equal var 'tag) (setq org-prefix-has-tag t)) | 4728 (if (equal var 'tag) (setq org-prefix-has-tag t)) |
4703 (if (equal var 'effort) (setq org-prefix-has-effort t)) | 4729 (if (equal var 'effort) (setq org-prefix-has-effort t)) |
4704 (if (equal var 'category) | |
4705 (setq org-prefix-category-length | |
4706 (abs (string-to-number (match-string 2 s))))) | |
4707 (setq f (concat "%" (match-string 2 s) "s")) | 4730 (setq f (concat "%" (match-string 2 s) "s")) |
4731 (when (equal var 'category) | |
4732 (setq org-prefix-category-length | |
4733 (floor (abs (string-to-number (match-string 2 s))))) | |
4734 (setq org-prefix-category-max-length | |
4735 (let ((x (match-string 2 s))) | |
4736 (save-match-data | |
4737 (if (string-match "\\.[0-9]+" x) | |
4738 (string-to-number (substring (match-string 0 x) 1))))))) | |
4708 (if opt | 4739 (if opt |
4709 (setq varform | 4740 (setq varform |
4710 `(if (equal "" ,var) | 4741 `(if (equal "" ,var) |
4711 "" | 4742 "" |
4712 (format ,f (if (equal "" ,var) "" (concat ,var ,c))))) | 4743 (format ,f (if (equal "" ,var) "" (concat ,var ,c))))) |
4854 (tb (or (get-text-property 1 'time-of-day b) def))) | 4885 (tb (or (get-text-property 1 'time-of-day b) def))) |
4855 (cond ((< ta tb) -1) | 4886 (cond ((< ta tb) -1) |
4856 ((< tb ta) +1) | 4887 ((< tb ta) +1) |
4857 (t nil)))) | 4888 (t nil)))) |
4858 | 4889 |
4890 (defsubst org-cmp-habit-p (a b) | |
4891 "Compare the todo states of strings A and B." | |
4892 (let ((ha (get-text-property 1 'org-habit-p a)) | |
4893 (hb (get-text-property 1 'org-habit-p b))) | |
4894 (cond ((and ha (not hb)) -1) | |
4895 ((and (not ha) hb) +1) | |
4896 (t nil)))) | |
4897 | |
4859 (defun org-entries-lessp (a b) | 4898 (defun org-entries-lessp (a b) |
4860 "Predicate for sorting agenda entries." | 4899 "Predicate for sorting agenda entries." |
4861 ;; The following variables will be used when the form is evaluated. | 4900 ;; The following variables will be used when the form is evaluated. |
4862 ;; So even though the compiler complains, keep them. | 4901 ;; So even though the compiler complains, keep them. |
4863 (let* ((time-up (org-cmp-time a b)) | 4902 (let* ((time-up (org-cmp-time a b)) |
4871 (category-keep (if category-up +1 nil)) | 4910 (category-keep (if category-up +1 nil)) |
4872 (tag-up (org-cmp-tag a b)) | 4911 (tag-up (org-cmp-tag a b)) |
4873 (tag-down (if tag-up (- tag-up) nil)) | 4912 (tag-down (if tag-up (- tag-up) nil)) |
4874 (todo-state-up (org-cmp-todo-state a b)) | 4913 (todo-state-up (org-cmp-todo-state a b)) |
4875 (todo-state-down (if todo-state-up (- todo-state-up) nil)) | 4914 (todo-state-down (if todo-state-up (- todo-state-up) nil)) |
4915 (habit-up (org-cmp-habit-p a b)) | |
4916 (habit-down (if habit-up (- habit-up) nil)) | |
4876 user-defined-up user-defined-down) | 4917 user-defined-up user-defined-down) |
4877 (if (and org-agenda-cmp-user-defined | 4918 (if (and org-agenda-cmp-user-defined |
4878 (functionp org-agenda-cmp-user-defined)) | 4919 (functionp org-agenda-cmp-user-defined)) |
4879 (setq user-defined-up | 4920 (setq user-defined-up |
4880 (funcall org-agenda-cmp-user-defined a b) | 4921 (funcall org-agenda-cmp-user-defined a b) |
4884 '((-1 . t) (1 . nil) (nil . nil)))))) | 4925 '((-1 . t) (1 . nil) (nil . nil)))))) |
4885 | 4926 |
4886 ;;; Agenda restriction lock | 4927 ;;; Agenda restriction lock |
4887 | 4928 |
4888 (defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1) | 4929 (defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1) |
4889 "Overlay to mark the headline to which arenda commands are restricted.") | 4930 "Overlay to mark the headline to which agenda commands are restricted.") |
4890 (org-overlay-put org-agenda-restriction-lock-overlay | 4931 (org-overlay-put org-agenda-restriction-lock-overlay |
4891 'face 'org-agenda-restriction-lock) | 4932 'face 'org-agenda-restriction-lock) |
4892 (org-overlay-put org-agenda-restriction-lock-overlay | 4933 (org-overlay-put org-agenda-restriction-lock-overlay |
4893 'help-echo "Agendas are currently limited to this subtree.") | 4934 'help-echo "Agendas are currently limited to this subtree.") |
4894 (org-detach-overlay org-agenda-restriction-lock-overlay) | 4935 (org-detach-overlay org-agenda-restriction-lock-overlay) |
5042 A lisp caller can specify CHAR. NARROW means that the new tag should be | 5083 A lisp caller can specify CHAR. NARROW means that the new tag should be |
5043 used to narrow the search - the interactive user can also press `-' or `+' | 5084 used to narrow the search - the interactive user can also press `-' or `+' |
5044 to switch to narrowing." | 5085 to switch to narrowing." |
5045 (interactive "P") | 5086 (interactive "P") |
5046 (let* ((alist org-tag-alist-for-agenda) | 5087 (let* ((alist org-tag-alist-for-agenda) |
5047 (tag-chars (mapconcat | 5088 (tag-chars (mapconcat |
5048 (lambda (x) (if (cdr x) (char-to-string (cdr x)) "")) | 5089 (lambda (x) (if (and (not (symbolp (car x))) |
5049 alist "")) | 5090 (cdr x)) |
5050 (efforts (org-split-string | 5091 (char-to-string (cdr x)) |
5051 (or (cdr (assoc (concat org-effort-property "_ALL") | 5092 "")) |
5052 org-global-properties)) | 5093 alist "")) |
5053 "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00" ""))) | 5094 (efforts (org-split-string |
5054 (effort-op org-agenda-filter-effort-default-operator) | 5095 (or (cdr (assoc (concat org-effort-property "_ALL") |
5055 (effort-prompt "") | 5096 org-global-properties)) |
5056 (inhibit-read-only t) | 5097 "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00" ""))) |
5057 (current org-agenda-filter) | 5098 (effort-op org-agenda-filter-effort-default-operator) |
5058 char a n tag) | 5099 (effort-prompt "") |
5100 (inhibit-read-only t) | |
5101 (current org-agenda-filter) | |
5102 char a n tag) | |
5059 (unless char | 5103 (unless char |
5060 (message | 5104 (message |
5061 "%s by tag [%s ], [TAB], [/]:off, [+-]:narrow, [>=<?]:effort: " | 5105 "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: " |
5062 (if narrow "Narrow" "Filter") tag-chars) | 5106 (if narrow "Narrow" "Filter") tag-chars |
5107 (if org-agenda-auto-exclude-function "[RET], " "")) | |
5063 (setq char (read-char))) | 5108 (setq char (read-char))) |
5064 (when (member char '(?+ ?-)) | 5109 (when (member char '(?+ ?-)) |
5065 ;; Narrowing down | 5110 ;; Narrowing down |
5066 (cond ((equal char ?-) (setq strip t narrow t)) | 5111 (cond ((equal char ?-) (setq strip t narrow t)) |
5067 ((equal char ?+) (setq strip nil narrow t))) | 5112 ((equal char ?+) (setq strip nil narrow t))) |
5089 (org-global-tags-completion-table))) | 5134 (org-global-tags-completion-table))) |
5090 (let ((completion-ignore-case t)) | 5135 (let ((completion-ignore-case t)) |
5091 (setq tag (org-icompleting-read | 5136 (setq tag (org-icompleting-read |
5092 "Tag: " org-global-tags-completion-table)))) | 5137 "Tag: " org-global-tags-completion-table)))) |
5093 (cond | 5138 (cond |
5139 ((equal char ?\r) | |
5140 (org-agenda-filter-by-tag-show-all) | |
5141 (when org-agenda-auto-exclude-function | |
5142 (setq org-agenda-filter '()) | |
5143 (dolist (tag org-tag-alist-for-agenda) | |
5144 (let ((modifier (funcall org-agenda-auto-exclude-function | |
5145 (car tag)))) | |
5146 (if modifier | |
5147 (push modifier org-agenda-filter)))) | |
5148 (if (not (null org-agenda-filter)) | |
5149 (org-agenda-filter-apply org-agenda-filter)))) | |
5094 ((equal char ?/) | 5150 ((equal char ?/) |
5095 (org-agenda-filter-by-tag-show-all) | 5151 (org-agenda-filter-by-tag-show-all) |
5096 (when (get 'org-agenda-filter :preset-filter) | 5152 (when (get 'org-agenda-filter :preset-filter) |
5097 (org-agenda-filter-apply org-agenda-filter))) | 5153 (org-agenda-filter-apply org-agenda-filter))) |
5098 ((or (equal char ?\ ) | 5154 ((or (equal char ?\ ) |
5122 "Create the form that tests a line for the agenda filter." | 5178 "Create the form that tests a line for the agenda filter." |
5123 (let (f f1) | 5179 (let (f f1) |
5124 (dolist (x (append (get 'org-agenda-filter :preset-filter) | 5180 (dolist (x (append (get 'org-agenda-filter :preset-filter) |
5125 org-agenda-filter)) | 5181 org-agenda-filter)) |
5126 (if (member x '("-" "+")) | 5182 (if (member x '("-" "+")) |
5127 (setq f1 '(not tags)) | 5183 (setq f1 (if (equal x "-") 'tags '(not tags))) |
5128 (if (string-match "[<=>?]" x) | 5184 (if (string-match "[<=>?]" x) |
5129 (setq f1 (org-agenda-filter-effort-form x)) | 5185 (setq f1 (org-agenda-filter-effort-form x)) |
5130 (setq f1 (list 'member (downcase (substring x 1)) 'tags))) | 5186 (setq f1 (list 'member (downcase (substring x 1)) 'tags))) |
5131 (if (equal (string-to-char x) ?-) | 5187 (if (equal (string-to-char x) ?-) |
5132 (setq f1 (list 'not f1)))) | 5188 (setq f1 (list 'not f1)))) |
5487 (defun org-agenda-follow-mode () | 5543 (defun org-agenda-follow-mode () |
5488 "Toggle follow mode in an agenda buffer." | 5544 "Toggle follow mode in an agenda buffer." |
5489 (interactive) | 5545 (interactive) |
5490 (setq org-agenda-follow-mode (not org-agenda-follow-mode)) | 5546 (setq org-agenda-follow-mode (not org-agenda-follow-mode)) |
5491 (org-agenda-set-mode-name) | 5547 (org-agenda-set-mode-name) |
5548 (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | |
5549 (org-agenda-show)) | |
5492 (message "Follow mode is %s" | 5550 (message "Follow mode is %s" |
5493 (if org-agenda-follow-mode "on" "off"))) | 5551 (if org-agenda-follow-mode "on" "off"))) |
5494 | 5552 |
5495 (defun org-agenda-entry-text-mode (&optional arg) | 5553 (defun org-agenda-entry-text-mode (&optional arg) |
5496 "Toggle entry text mode in an agenda buffer." | 5554 "Toggle entry text mode in an agenda buffer." |
5582 (if (equal org-agenda-ndays 7) " Week" "") | 5640 (if (equal org-agenda-ndays 7) " Week" "") |
5583 (if org-agenda-follow-mode " Follow" "") | 5641 (if org-agenda-follow-mode " Follow" "") |
5584 (if org-agenda-entry-text-mode " ETxt" "") | 5642 (if org-agenda-entry-text-mode " ETxt" "") |
5585 (if org-agenda-include-diary " Diary" "") | 5643 (if org-agenda-include-diary " Diary" "") |
5586 (if org-agenda-use-time-grid " Grid" "") | 5644 (if org-agenda-use-time-grid " Grid" "") |
5645 (if (and (boundp 'org-habit-show-habits) | |
5646 org-habit-show-habits) " Habit" "") | |
5587 (if (consp org-agenda-show-log) " LogAll" | 5647 (if (consp org-agenda-show-log) " LogAll" |
5588 (if org-agenda-show-log " Log" "")) | 5648 (if org-agenda-show-log " Log" "")) |
5589 (if (or org-agenda-filter (get 'org-agenda-filter | 5649 (if (or org-agenda-filter (get 'org-agenda-filter |
5590 :preset-filter)) | 5650 :preset-filter)) |
5591 (concat " {" (mapconcat | 5651 (concat " {" (mapconcat |
5592 'identity | 5652 'identity |
5593 (append (get 'org-agenda-filter | 5653 (append (get 'org-agenda-filter |
5604 | 5664 |
5605 (defun org-agenda-post-command-hook () | 5665 (defun org-agenda-post-command-hook () |
5606 (setq org-agenda-type | 5666 (setq org-agenda-type |
5607 (or (get-text-property (point) 'org-agenda-type) | 5667 (or (get-text-property (point) 'org-agenda-type) |
5608 (get-text-property (max (point-min) (1- (point))) | 5668 (get-text-property (max (point-min) (1- (point))) |
5609 'org-agenda-type))) | 5669 'org-agenda-type)))) |
5610 (if (and org-agenda-follow-mode | 5670 |
5611 (org-get-at-bol 'org-marker)) | 5671 (defun org-agenda-next-line () |
5672 "Move cursor to the next line, and show if follow-mode is active." | |
5673 (interactive) | |
5674 (call-interactively 'next-line) | |
5675 (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | |
5676 (org-agenda-show))) | |
5677 (defun org-agenda-previous-line () | |
5678 "Move cursor to the previous line, and show if follow-mode is active." | |
5679 | |
5680 (interactive) | |
5681 (call-interactively 'previous-line) | |
5682 (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | |
5612 (org-agenda-show))) | 5683 (org-agenda-show))) |
5613 | 5684 |
5614 (defun org-agenda-show-priority () | 5685 (defun org-agenda-show-priority () |
5615 "Show the priority of the current item. | 5686 "Show the priority of the current item. |
5616 This priority is composed of the main priority given with the [#A] cookies, | 5687 This priority is composed of the main priority given with the [#A] cookies, |
5682 (error "Abort")) | 5753 (error "Abort")) |
5683 (org-remove-subtree-entries-from-agenda buffer dbeg dend) | 5754 (org-remove-subtree-entries-from-agenda buffer dbeg dend) |
5684 (with-current-buffer buffer (delete-region dbeg dend)) | 5755 (with-current-buffer buffer (delete-region dbeg dend)) |
5685 (message "Agenda item and source killed")))) | 5756 (message "Agenda item and source killed")))) |
5686 | 5757 |
5758 (defvar org-archive-default-command) | |
5759 (defun org-agenda-archive-default () | |
5760 "Archive the entry or subtree belonging to the current agenda entry." | |
5761 (interactive) | |
5762 (require 'org-archive) | |
5763 (org-agenda-archive-with org-archive-default-command)) | |
5764 | |
5765 (defun org-agenda-archive-default-with-confirmation () | |
5766 "Archive the entry or subtree belonging to the current agenda entry." | |
5767 (interactive) | |
5768 (require 'org-archive) | |
5769 (org-agenda-archive-with org-archive-default-command 'confirm)) | |
5770 | |
5687 (defun org-agenda-archive () | 5771 (defun org-agenda-archive () |
5688 "Archive the entry or subtree belonging to the current agenda entry." | 5772 "Archive the entry or subtree belonging to the current agenda entry." |
5689 (interactive) | 5773 (interactive) |
5690 (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) | 5774 (org-agenda-archive-with 'org-archive-subtree)) |
5691 (let* ((marker (or (org-get-at-bol 'org-marker) | |
5692 (org-agenda-error))) | |
5693 (buffer (marker-buffer marker)) | |
5694 (pos (marker-position marker))) | |
5695 (org-with-remote-undo buffer | |
5696 (with-current-buffer buffer | |
5697 (if (org-mode-p) | |
5698 (save-excursion | |
5699 (goto-char pos) | |
5700 (org-remove-subtree-entries-from-agenda) | |
5701 (org-back-to-heading t) | |
5702 (org-archive-subtree)) | |
5703 (error "Archiving works only in Org-mode files")))))) | |
5704 | 5775 |
5705 (defun org-agenda-archive-to-archive-sibling () | 5776 (defun org-agenda-archive-to-archive-sibling () |
5777 "Move the entry to the archive sibling." | |
5778 (interactive) | |
5779 (org-agenda-archive-with 'org-archive-to-archive-sibling)) | |
5780 | |
5781 (defun org-agenda-archive-with (cmd &optional confirm) | |
5706 "Move the entry to the archive sibling." | 5782 "Move the entry to the archive sibling." |
5707 (interactive) | 5783 (interactive) |
5708 (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) | 5784 (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) |
5709 (let* ((marker (or (org-get-at-bol 'org-marker) | 5785 (let* ((marker (or (org-get-at-bol 'org-marker) |
5710 (org-agenda-error))) | 5786 (org-agenda-error))) |
5711 (buffer (marker-buffer marker)) | 5787 (buffer (marker-buffer marker)) |
5712 (pos (marker-position marker))) | 5788 (pos (marker-position marker))) |
5713 (org-with-remote-undo buffer | 5789 (org-with-remote-undo buffer |
5714 (with-current-buffer buffer | 5790 (with-current-buffer buffer |
5715 (if (org-mode-p) | 5791 (if (org-mode-p) |
5716 (save-excursion | 5792 (if (and confirm |
5717 (goto-char pos) | 5793 (not (y-or-n-p "Archive this subtree or entry? "))) |
5718 (org-remove-subtree-entries-from-agenda) | 5794 (error "Abort") |
5719 (org-back-to-heading t) | 5795 (save-excursion |
5720 (org-archive-to-archive-sibling)) | 5796 (goto-char pos) |
5797 (org-remove-subtree-entries-from-agenda) | |
5798 (org-back-to-heading t) | |
5799 (funcall cmd))) | |
5721 (error "Archiving works only in Org-mode files")))))) | 5800 (error "Archiving works only in Org-mode files")))))) |
5722 | 5801 |
5723 (defun org-remove-subtree-entries-from-agenda (&optional buf beg end) | 5802 (defun org-remove-subtree-entries-from-agenda (&optional buf beg end) |
5724 "Remove all lines in the agenda that correspond to a given subtree. | 5803 "Remove all lines in the agenda that correspond to a given subtree. |
5725 The subtree is the one in buffer BUF, starting at BEG and ending at END. | 5804 The subtree is the one in buffer BUF, starting at BEG and ending at END. |
5766 (org-remove-subtree-entries-from-agenda) | 5845 (org-remove-subtree-entries-from-agenda) |
5767 (org-refile goto buffer rfloc))))))) | 5846 (org-refile goto buffer rfloc))))))) |
5768 | 5847 |
5769 (defun org-agenda-open-link (&optional arg) | 5848 (defun org-agenda-open-link (&optional arg) |
5770 "Follow the link in the current line, if any. | 5849 "Follow the link in the current line, if any. |
5771 This looks for a link in the displayed lin in the agenda. It also looks | 5850 This looks for a link in the displayed line in the agenda. It also looks |
5772 at the text of the entry itself." | 5851 at the text of the entry itself." |
5773 (interactive "P") | 5852 (interactive "P") |
5774 (let* ((marker (or (org-get-at-bol 'org-hd-marker) | 5853 (let* ((marker (or (org-get-at-bol 'org-hd-marker) |
5775 (org-get-at-bol 'org-marker))) | 5854 (org-get-at-bol 'org-marker))) |
5776 (buffer (and marker (marker-buffer marker))) | 5855 (buffer (and marker (marker-buffer marker))) |
5777 (prefix (buffer-substring | 5856 (prefix (buffer-substring |
5778 (point-at-bol) | 5857 (point-at-bol) |
5779 (+ (point-at-bol) | 5858 (+ (point-at-bol) |
5780 (org-get-at-bol 'prefix-length))))) | 5859 (or (org-get-at-bol 'prefix-length) 0))))) |
5781 (unless buffer (error "Don't know where to look for links")) | 5860 (cond |
5782 (with-current-buffer buffer | 5861 (buffer |
5783 (save-excursion | 5862 (with-current-buffer buffer |
5784 (save-restriction | 5863 (save-excursion |
5785 (widen) | 5864 (save-restriction |
5786 (goto-char marker) | 5865 (widen) |
5787 (org-offer-links-in-entry arg prefix)))))) | 5866 (goto-char marker) |
5867 (org-offer-links-in-entry arg prefix))))) | |
5868 ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)")) | |
5869 (save-excursion | |
5870 (beginning-of-line 1) | |
5871 (looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)")))) | |
5872 (org-open-link-from-string (match-string 1))) | |
5873 (t (error "No link to open here"))))) | |
5788 | 5874 |
5789 (defun org-agenda-copy-local-variable (var) | 5875 (defun org-agenda-copy-local-variable (var) |
5790 "Get a variable from a referenced buffer and install it here." | 5876 "Get a variable from a referenced buffer and install it here." |
5791 (let ((m (org-get-at-bol 'org-marker))) | 5877 (let ((m (org-get-at-bol 'org-marker))) |
5792 (when (and m (buffer-live-p (marker-buffer m))) | 5878 (when (and m (buffer-live-p (marker-buffer m))) |
5794 (symbol-value var)))))) | 5880 (symbol-value var)))))) |
5795 | 5881 |
5796 (defun org-agenda-switch-to (&optional delete-other-windows) | 5882 (defun org-agenda-switch-to (&optional delete-other-windows) |
5797 "Go to the Org-mode file which contains the item at point." | 5883 "Go to the Org-mode file which contains the item at point." |
5798 (interactive) | 5884 (interactive) |
5799 (let* ((marker (or (org-get-at-bol 'org-marker) | 5885 (if (and org-return-follows-link |
5800 (org-agenda-error))) | 5886 (not (org-get-at-bol 'org-marker)) |
5801 (buffer (marker-buffer marker)) | 5887 (org-in-regexp org-bracket-link-regexp)) |
5802 (pos (marker-position marker))) | 5888 (org-open-link-from-string (match-string 0)) |
5803 (switch-to-buffer buffer) | 5889 (let* ((marker (or (org-get-at-bol 'org-marker) |
5804 (and delete-other-windows (delete-other-windows)) | 5890 (org-agenda-error))) |
5805 (widen) | 5891 (buffer (marker-buffer marker)) |
5806 (goto-char pos) | 5892 (pos (marker-position marker))) |
5807 (when (org-mode-p) | 5893 (switch-to-buffer buffer) |
5808 (org-show-context 'agenda) | 5894 (and delete-other-windows (delete-other-windows)) |
5809 (save-excursion | 5895 (widen) |
5810 (and (outline-next-heading) | 5896 (goto-char pos) |
5811 (org-flag-heading nil)))))) ; show the next heading | 5897 (when (org-mode-p) |
5898 (org-show-context 'agenda) | |
5899 (save-excursion | |
5900 (and (outline-next-heading) | |
5901 (org-flag-heading nil))))))) ; show the next heading | |
5812 | 5902 |
5813 (defun org-agenda-goto-mouse (ev) | 5903 (defun org-agenda-goto-mouse (ev) |
5814 "Go to the Org-mode file which contains the item at the mouse click." | 5904 "Go to the Org-mode file which contains the item at the mouse click." |
5815 (interactive "e") | 5905 (interactive "e") |
5816 (mouse-set-point ev) | 5906 (mouse-set-point ev) |
5826 (let ((org-show-entry-below t)) | 5916 (let ((org-show-entry-below t)) |
5827 (org-agenda-goto t)) | 5917 (org-agenda-goto t)) |
5828 (org-agenda-goto t)) | 5918 (org-agenda-goto t)) |
5829 (select-window win))) | 5919 (select-window win))) |
5830 | 5920 |
5921 (defvar org-agenda-show-window nil) | |
5922 (defun org-agenda-show-and-scroll-up () | |
5923 "Display the Org-mode file which contains the item at point. | |
5924 When called repeatedly, scroll the window that is displaying the buffer." | |
5925 (interactive) | |
5926 (let ((win (selected-window))) | |
5927 (if (and (window-live-p org-agenda-show-window) | |
5928 (eq this-command last-command)) | |
5929 (progn | |
5930 (select-window org-agenda-show-window) | |
5931 (ignore-errors (scroll-up))) | |
5932 (org-agenda-goto t) | |
5933 (show-subtree) | |
5934 (setq org-agenda-show-window (selected-window))) | |
5935 (select-window win))) | |
5936 | |
5937 (defun org-agenda-show-scroll-down () | |
5938 "Scroll down the window showing the agenda." | |
5939 (interactive) | |
5940 (let ((win (selected-window))) | |
5941 (when (window-live-p org-agenda-show-window) | |
5942 (select-window org-agenda-show-window) | |
5943 (ignore-errors (scroll-down)) | |
5944 (select-window win)))) | |
5945 | |
5831 (defun org-agenda-show-1 (&optional more) | 5946 (defun org-agenda-show-1 (&optional more) |
5832 "Display the Org-mode file which contains the item at point. | 5947 "Display the Org-mode file which contains the item at point. |
5833 The prefix arg causes further revieling: | 5948 The prefix arg selects the amount of information to display: |
5834 | 5949 |
5835 0 hide the subtree | 5950 0 hide the subtree |
5836 1 just show the entry according to defaults. | 5951 1 just show the entry according to defaults. |
5837 2 show the children view | 5952 2 show the children view |
5838 3 show the subtree view | 5953 3 show the subtree view |
6471 "Evaluate FORM at the entry pointed to by `org-agenda-action-marker'." | 6586 "Evaluate FORM at the entry pointed to by `org-agenda-action-marker'." |
6472 (let ((org-overriding-default-time (org-get-cursor-date))) | 6587 (let ((org-overriding-default-time (org-get-cursor-date))) |
6473 (if current-buffer | 6588 (if current-buffer |
6474 (eval form) | 6589 (eval form) |
6475 (if (not (marker-buffer org-agenda-action-marker)) | 6590 (if (not (marker-buffer org-agenda-action-marker)) |
6476 (error "No entry has bee selected for agenda action") | 6591 (error "No entry has been selected for agenda action") |
6477 (with-current-buffer (marker-buffer org-agenda-action-marker) | 6592 (with-current-buffer (marker-buffer org-agenda-action-marker) |
6478 (save-excursion | 6593 (save-excursion |
6479 (save-restriction | 6594 (save-restriction |
6480 (widen) | 6595 (widen) |
6481 (goto-char org-agenda-action-marker) | 6596 (goto-char org-agenda-action-marker) |
6529 (unless (marker-buffer org-clock-marker) | 6644 (unless (marker-buffer org-clock-marker) |
6530 (error "No running clock")) | 6645 (error "No running clock")) |
6531 (org-with-remote-undo (marker-buffer org-clock-marker) | 6646 (org-with-remote-undo (marker-buffer org-clock-marker) |
6532 (org-clock-cancel))) | 6647 (org-clock-cancel))) |
6533 | 6648 |
6649 (defun org-agenda-diary-entry-in-org-file () | |
6650 "Make a diary entry in the file `org-agenda-diary-file'." | |
6651 (let (d1 d2 char (text "")) | |
6652 (if (equal (buffer-name) "*Calendar*") | |
6653 (setq d1 (calendar-cursor-to-date t) | |
6654 d2 (car calendar-mark-ring)) | |
6655 (setq d1 (calendar-gregorian-from-absolute | |
6656 (get-text-property (point) 'day)) | |
6657 d2 (and (mark) (get-text-property (mark) 'day) | |
6658 (calendar-gregorian-from-absolute | |
6659 (get-text-property (mark) 'day))))) | |
6660 (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") | |
6661 (setq char (read-char-exclusive)) | |
6662 (cond | |
6663 ((equal char ?d) | |
6664 (setq text (read-string "Day entry: ")) | |
6665 (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1)) | |
6666 ((equal char ?a) | |
6667 (setq d1 (list (car d1) (nth 1 d1) | |
6668 (read-number (format "Reference year [%d]: " (nth 2 d1)) | |
6669 (nth 2 d1)))) | |
6670 (setq text (read-string "Anniversary (use %d to show years): ")) | |
6671 (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1)) | |
6672 ((equal char ?b) | |
6673 (setq text (read-string "Block entry: ")) | |
6674 (unless (and d1 d2 (not (equal d1 d2))) | |
6675 (error "No block of days selected")) | |
6676 (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)) | |
6677 ((equal char ?j) | |
6678 (org-switch-to-buffer-other-window | |
6679 (find-file-noselect org-agenda-diary-file)) | |
6680 (org-datetree-find-date-create d1) | |
6681 (org-reveal t)) | |
6682 (t (error "Invalid selection character `%c'" char))))) | |
6683 | |
6684 (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) | |
6685 "Add a diary entry with TYPE to `org-agenda-diary-file'. | |
6686 If TEXT is not empty, it will become the headline of the new entry, and | |
6687 the resulting entry will not be shown. When TEXT is empty, switch to | |
6688 `org-agenda-diary-file' and let the user finish the entry there." | |
6689 (let ((cw (current-window-configuration))) | |
6690 (org-switch-to-buffer-other-window | |
6691 (find-file-noselect org-agenda-diary-file)) | |
6692 (widen) | |
6693 (goto-char (point-min)) | |
6694 (cond | |
6695 ((eq type 'anniversary) | |
6696 (or (re-search-forward "^*[ \t]+Anniversaries" nil t) | |
6697 (progn | |
6698 (or (org-on-heading-p t) | |
6699 (progn | |
6700 (outline-next-heading) | |
6701 (insert "* Anniversaries\n\n") | |
6702 (beginning-of-line -1))))) | |
6703 (outline-next-heading) | |
6704 (org-back-over-empty-lines) | |
6705 (backward-char 1) | |
6706 (insert "\n") | |
6707 (require 'diary-lib) | |
6708 (let ((calendar-date-display-form | |
6709 (if (if (boundp 'calendar-date-style) | |
6710 (eq calendar-date-style 'european) | |
6711 european-calendar-style) ; Emacs 22 | |
6712 '(day " " month " " year) | |
6713 '(month " " day " " year)))) | |
6714 | |
6715 (insert (format "%%%%(diary-anniversary %s) %s" | |
6716 (calendar-date-string d1 nil t) text)))) | |
6717 ((eq type 'day) | |
6718 (require 'org-datetree) | |
6719 (org-datetree-find-date-create d1) | |
6720 (org-agenda-insert-diary-make-new-entry text) | |
6721 (org-insert-time-stamp (org-time-from-absolute | |
6722 (calendar-absolute-from-gregorian d1))) | |
6723 (end-of-line 0)) | |
6724 ((eq type 'block) | |
6725 (if (> (calendar-absolute-from-gregorian d1) | |
6726 (calendar-absolute-from-gregorian d2)) | |
6727 (setq d1 (prog1 d2 (setq d2 d1)))) | |
6728 (require 'org-datetree) | |
6729 (org-datetree-find-date-create d1) | |
6730 (org-agenda-insert-diary-make-new-entry text) | |
6731 (org-insert-time-stamp (org-time-from-absolute | |
6732 (calendar-absolute-from-gregorian d1))) | |
6733 (insert "--") | |
6734 (org-insert-time-stamp (org-time-from-absolute | |
6735 (calendar-absolute-from-gregorian d2))) | |
6736 (end-of-line 0))) | |
6737 (if (string-match "\\S-" text) | |
6738 (progn | |
6739 (set-window-configuration cw) | |
6740 (message "%s entry added to %s" | |
6741 (capitalize (symbol-name type)) | |
6742 (abbreviate-file-name org-agenda-diary-file))) | |
6743 (org-reveal t) | |
6744 (message "Please finish entry here")))) | |
6745 | |
6746 (defun org-agenda-insert-diary-make-new-entry (text) | |
6747 "Make new entry as last child of current entry. | |
6748 Add TEXT as headline, and position the cursor in the second line so that | |
6749 a timestamp can be added there." | |
6750 (let ((org-show-following-heading t) | |
6751 (org-show-siblings t) | |
6752 (org-show-hierarchy-above t) | |
6753 (org-show-entry-below t) | |
6754 col) | |
6755 (outline-next-heading) | |
6756 (org-back-over-empty-lines) | |
6757 (or (looking-at "[ \t]*$") | |
6758 (progn (insert "\n") (backward-char 1))) | |
6759 (org-insert-heading) | |
6760 (org-do-demote) | |
6761 (setq col (current-column)) | |
6762 (insert text "\n") | |
6763 (if org-adapt-indentation (org-indent-to-column col)) | |
6764 (let ((org-show-following-heading t) | |
6765 (org-show-siblings t) | |
6766 (org-show-hierarchy-above t) | |
6767 (org-show-entry-below t)) | |
6768 (org-show-context)))) | |
6769 | |
6534 (defun org-agenda-diary-entry () | 6770 (defun org-agenda-diary-entry () |
6535 "Make a diary entry, like the `i' command from the calendar. | 6771 "Make a diary entry, like the `i' command from the calendar. |
6536 All the standard commands work: block, weekly etc." | 6772 All the standard commands work: block, weekly etc. |
6773 When `org-agenda-diary-file' points to a file, | |
6774 `org-agenda-diary-entry-in-org-file' is called instead to create | |
6775 entries in that Org-mode file." | |
6537 (interactive) | 6776 (interactive) |
6538 (org-agenda-check-type t 'agenda 'timeline) | 6777 (org-agenda-check-type t 'agenda 'timeline) |
6539 (require 'diary-lib) | 6778 (if (not (eq org-agenda-diary-file 'diary-file)) |
6540 (let* ((char (progn | 6779 (org-agenda-diary-entry-in-org-file) |
6541 (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") | 6780 (require 'diary-lib) |
6542 (read-char-exclusive))) | 6781 (let* ((char (progn |
6543 (cmd (cdr (assoc char | 6782 (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") |
6544 '((?d . insert-diary-entry) | 6783 (read-char-exclusive))) |
6545 (?w . insert-weekly-diary-entry) | 6784 (cmd (cdr (assoc char |
6546 (?m . insert-monthly-diary-entry) | 6785 '((?d . insert-diary-entry) |
6547 (?y . insert-yearly-diary-entry) | 6786 (?w . insert-weekly-diary-entry) |
6548 (?a . insert-anniversary-diary-entry) | 6787 (?m . insert-monthly-diary-entry) |
6549 (?b . insert-block-diary-entry) | 6788 (?y . insert-yearly-diary-entry) |
6550 (?c . insert-cyclic-diary-entry))))) | 6789 (?a . insert-anniversary-diary-entry) |
6551 (oldf (symbol-function 'calendar-cursor-to-date)) | 6790 (?b . insert-block-diary-entry) |
6552 ; (buf (get-file-buffer (substitute-in-file-name diary-file))) | 6791 (?c . insert-cyclic-diary-entry))))) |
6553 (point (point)) | 6792 (oldf (symbol-function 'calendar-cursor-to-date)) |
6554 (mark (or (mark t) (point)))) | 6793 ;; (buf (get-file-buffer (substitute-in-file-name diary-file))) |
6555 (unless cmd | 6794 (point (point)) |
6556 (error "No command associated with <%c>" char)) | 6795 (mark (or (mark t) (point)))) |
6557 (unless (and (get-text-property point 'day) | 6796 (unless cmd |
6558 (or (not (equal ?b char)) | 6797 (error "No command associated with <%c>" char)) |
6559 (get-text-property mark 'day))) | 6798 (unless (and (get-text-property point 'day) |
6560 (error "Don't know which date to use for diary entry")) | 6799 (or (not (equal ?b char)) |
6561 ;; We implement this by hacking the `calendar-cursor-to-date' function | 6800 (get-text-property mark 'day))) |
6562 ;; and the `calendar-mark-ring' variable. Saves a lot of code. | 6801 (error "Don't know which date to use for diary entry")) |
6563 (let ((calendar-mark-ring | 6802 ;; We implement this by hacking the `calendar-cursor-to-date' function |
6564 (list (calendar-gregorian-from-absolute | 6803 ;; and the `calendar-mark-ring' variable. Saves a lot of code. |
6565 (or (get-text-property mark 'day) | 6804 (let ((calendar-mark-ring |
6566 (get-text-property point 'day)))))) | 6805 (list (calendar-gregorian-from-absolute |
6567 (unwind-protect | 6806 (or (get-text-property mark 'day) |
6568 (progn | 6807 (get-text-property point 'day)))))) |
6569 (fset 'calendar-cursor-to-date | 6808 (unwind-protect |
6570 (lambda (&optional error dummy) | 6809 (progn |
6571 (calendar-gregorian-from-absolute | 6810 (fset 'calendar-cursor-to-date |
6572 (get-text-property point 'day)))) | 6811 (lambda (&optional error dummy) |
6812 (calendar-gregorian-from-absolute | |
6813 (get-text-property point 'day)))) | |
6573 (call-interactively cmd)) | 6814 (call-interactively cmd)) |
6574 (fset 'calendar-cursor-to-date oldf))))) | 6815 (fset 'calendar-cursor-to-date oldf)))))) |
6575 | 6816 |
6576 (defun org-agenda-execute-calendar-command (cmd) | 6817 (defun org-agenda-execute-calendar-command (cmd) |
6577 "Execute a calendar command from the agenda, with the date associated to | 6818 "Execute a calendar command from the agenda, with the date associated to |
6578 the cursor position." | 6819 the cursor position." |
6579 (org-agenda-check-type t 'agenda 'timeline) | 6820 (org-agenda-check-type t 'agenda 'timeline) |
6868 (goto-char (point-min)) | 7109 (goto-char (point-min)) |
6869 (select-window win) | 7110 (select-window win) |
6870 (message "Flagging note pushed to kill ring. Press [?] again to remove tag and note")))) | 7111 (message "Flagging note pushed to kill ring. Press [?] again to remove tag and note")))) |
6871 | 7112 |
6872 (defun org-agenda-remove-flag (marker) | 7113 (defun org-agenda-remove-flag (marker) |
6873 "Remove the FLAGGED tag and any flaging note in the entry." | 7114 "Remove the FLAGGED tag and any flagging note in the entry." |
6874 (let (newhead) | 7115 (let (newhead) |
6875 (org-with-point-at marker | 7116 (org-with-point-at marker |
6876 (org-toggle-tag "FLAGGED" 'off) | 7117 (org-toggle-tag "FLAGGED" 'off) |
6877 (org-entry-delete nil "THEFLAGGINGNOTE") | 7118 (org-entry-delete nil "THEFLAGGINGNOTE") |
6878 (setq newhead (org-get-heading))) | 7119 (setq newhead (org-get-heading))) |