Mercurial > emacs
comparison lisp/org/org.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 | 131bccfc4f5d |
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 |
93 | 93 |
94 ;;;; Customization variables | 94 ;;;; Customization variables |
95 | 95 |
96 ;;; Version | 96 ;;; Version |
97 | 97 |
98 (defconst org-version "6.31a" | 98 (defconst org-version "6.33" |
99 "The version number of the file org.el.") | 99 "The version number of the file org.el.") |
100 | 100 |
101 (defun org-version (&optional here) | 101 (defun org-version (&optional here) |
102 "Show the org-mode version in the echo area. | 102 "Show the org-mode version in the echo area. |
103 With prefix arg HERE, insert it at point." | 103 With prefix arg HERE, insert it at point." |
104 (interactive "P") | 104 (interactive "P") |
105 (let* ((version org-version) | 105 (let* ((origin default-directory) |
106 (version org-version) | |
106 (git-version) | 107 (git-version) |
107 (dir (concat (file-name-directory (locate-library "org")) "../" ))) | 108 (dir (concat (file-name-directory (locate-library "org")) "../" ))) |
108 (if (and (file-exists-p (expand-file-name ".git" dir)) | 109 (when (and (file-exists-p (expand-file-name ".git" dir)) |
109 (executable-find "git")) | 110 (executable-find "git")) |
110 (let ((pwd (substring (pwd) 10))) | 111 (unwind-protect |
111 (cd dir) | 112 (progn |
112 (if (eql 0 (shell-command "git describe --abbrev=4 HEAD")) | 113 (cd dir) |
114 (when (eql 0 (shell-command "git describe --abbrev=4 HEAD")) | |
113 (with-current-buffer "*Shell Command Output*" | 115 (with-current-buffer "*Shell Command Output*" |
114 (goto-char (point-min)) | 116 (goto-char (point-min)) |
115 (re-search-forward "[^\n]+") | 117 (setq git-version (buffer-substring (point) (point-at-eol)))) |
116 (setq git-version (match-string 0)) | 118 (subst-char-in-string ?- ?. git-version t) |
117 (subst-char-in-string ?- ?. git-version t) | 119 (when (string-match "\\S-" |
118 (shell-command "git diff-index --name-only HEAD --") | 120 (shell-command-to-string |
119 (unless (eql 1 (point-max)) | 121 "git diff-index --name-only HEAD --")) |
120 (setq git-version (concat git-version ".dirty"))) | 122 (setq git-version (concat git-version ".dirty"))) |
121 (setq version (concat version " (" git-version ")"))) | 123 (setq version (concat version " (" git-version ")")))) |
122 (cd pwd)))) | 124 (cd origin))) |
123 (setq version (format "Org-mode version %s" version)) | 125 (setq version (format "Org-mode version %s" version)) |
124 (if here (insert version)) | 126 (if here (insert version)) |
125 (message version) | 127 (message version))) |
126 version)) | |
127 | 128 |
128 ;;; Compatibility constants | 129 ;;; Compatibility constants |
129 | 130 |
130 ;;; The custom variables | 131 ;;; The custom variables |
131 | 132 |
133 "Outline-based notes management and organizer." | 134 "Outline-based notes management and organizer." |
134 :tag "Org" | 135 :tag "Org" |
135 :group 'outlines | 136 :group 'outlines |
136 :group 'hypermedia | 137 :group 'hypermedia |
137 :group 'calendar) | 138 :group 'calendar) |
139 | |
140 (defcustom org-mode-hook nil | |
141 "Mode hook for Org-mode, run after the mode was turned on." | |
142 :group 'org | |
143 :type 'hook) | |
138 | 144 |
139 (defcustom org-load-hook nil | 145 (defcustom org-load-hook nil |
140 "Hook that is run after org.el has been loaded." | 146 "Hook that is run after org.el has been loaded." |
141 :group 'org | 147 :group 'org |
142 :type 'hook) | 148 :type 'hook) |
185 (const :tag " crypt: Encryption of subtrees" org-crypt) | 191 (const :tag " crypt: Encryption of subtrees" org-crypt) |
186 (const :tag " gnus: Links to GNUS folders/messages" org-gnus) | 192 (const :tag " gnus: Links to GNUS folders/messages" org-gnus) |
187 (const :tag " id: Global IDs for identifying entries" org-id) | 193 (const :tag " id: Global IDs for identifying entries" org-id) |
188 (const :tag " info: Links to Info nodes" org-info) | 194 (const :tag " info: Links to Info nodes" org-info) |
189 (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo) | 195 (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo) |
196 (const :tag " habit: Track your consistency with habits" org-habit) | |
190 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask) | 197 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask) |
191 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc) | 198 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc) |
192 (const :tag " mac-message: Links to messages in Apple Mail" org-mac-message) | 199 (const :tag " mac-message: Links to messages in Apple Mail" org-mac-message) |
193 (const :tag " mew Links to Mew folders/messages" org-mew) | 200 (const :tag " mew Links to Mew folders/messages" org-mew) |
194 (const :tag " mhe: Links to MHE folders/messages" org-mhe) | 201 (const :tag " mhe: Links to MHE folders/messages" org-mhe) |
195 (const :tag " protocol: Intercept calls from emacsclient" org-protocol) | 202 (const :tag " protocol: Intercept calls from emacsclient" org-protocol) |
196 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail) | 203 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail) |
197 (const :tag " vm: Links to VM folders/messages" org-vm) | 204 (const :tag " vm: Links to VM folders/messages" org-vm) |
198 (const :tag " wl: Links to Wanderlust folders/messages" org-wl) | 205 (const :tag " wl: Links to Wanderlust folders/messages" org-wl) |
199 (const :tag " w3m: Special cut/paste from w3m to Org." org-w3m) | 206 (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m) |
200 (const :tag " mouse: Additional mouse support" org-mouse) | 207 (const :tag " mouse: Additional mouse support" org-mouse) |
201 | 208 |
202 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) | 209 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) |
203 (const :tag "C annotation-helper: Call Remember directly from Browser\n\t\t\t(OBSOLETE, use org-protocol)" org-annotation-helper) | 210 (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark) |
204 (const :tag "C bookmark: Org links to bookmarks" org-bookmark) | |
205 (const :tag "C browser-url: Store link, directly from Browser\n\t\t\t(OBSOLETE, use org-protocol)" org-browser-url) | |
206 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist) | 211 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist) |
207 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose) | 212 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose) |
208 (const :tag "C collector: Collect properties into tables" org-collector) | 213 (const :tag "C collector: Collect properties into tables" org-collector) |
209 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend) | 214 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend) |
210 (const :tag "C elisp-symbol: Org links to emacs-lisp symbols" org-elisp-symbol) | 215 (const :tag "C elisp-symbol: Org-mode links to emacs-lisp symbols" org-elisp-symbol) |
211 (const :tag "C eval: Include command output as text" org-eval) | 216 (const :tag "C eval: Include command output as text" org-eval) |
212 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light) | 217 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light) |
213 (const :tag "C expiry: Expiry mechanism for Org entries" org-expiry) | 218 (const :tag "C expiry: Expiry mechanism for Org-mode entries" org-expiry) |
214 (const :tag "C exp-bibtex: Export citations using BibTeX" org-exp-bibtex) | 219 (const :tag "C exp-bibtex: Export citations using BibTeX" org-exp-bibtex) |
220 (const :tag "C git-link: Provide org links to specific file version" org-git-link) | |
215 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query) | 221 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query) |
216 | 222 |
217 (const :tag "C invoice Help manage client invoices in OrgMode" org-invoice) | 223 (const :tag "C invoice: Help manage client invoices in Org-mode" org-invoice) |
218 | 224 |
219 (const :tag "C jira Add a jira:ticket protocol to Org" org-jira) | 225 (const :tag "C jira: Add a jira:ticket protocol to Org-mode" org-jira) |
220 (const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix) | 226 (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn) |
227 (const :tag "C mairix: Hook mairix search into Org-mode for different MUAs" org-mairix) | |
221 (const :tag "C mac-iCal Imports events from iCal.app to the Emacs diary" org-mac-iCal) | 228 (const :tag "C mac-iCal Imports events from iCal.app to the Emacs diary" org-mac-iCal) |
222 (const :tag "C man: Support for links to manpages in Org-mode" org-man) | 229 (const :tag "C man: Support for links to manpages in Org-mode" org-man) |
223 (const :tag "C mtags: Support for muse-like tags" org-mtags) | 230 (const :tag "C mtags: Support for muse-like tags" org-mtags) |
224 (const :tag "C panel: Simple routines for us with bad memory" org-panel) | 231 (const :tag "C panel: Simple routines for us with bad memory" org-panel) |
225 (const :tag "C R: Computation using the R language" org-R) | 232 (const :tag "C R: Computation using the R language" org-R) |
226 (const :tag "C registry: A registry for Org links" org-registry) | 233 (const :tag "C registry: A registry for Org-mode links" org-registry) |
227 (const :tag "C org2rem: Convert org appointments into reminders" org2rem) | 234 (const :tag "C org2rem: Convert org appointments into reminders" org2rem) |
228 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) | 235 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) |
229 (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks) | 236 (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks) |
230 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) | 237 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) |
231 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) | 238 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) |
232 (const :tag "C track: Keep up with Org development" org-track) | 239 (const :tag "C track: Keep up with Org-mode development" org-track) |
233 (repeat :tag "External packages" :inline t (symbol :tag "Package")))) | 240 (repeat :tag "External packages" :inline t (symbol :tag "Package")))) |
234 | 241 |
235 (defcustom org-support-shift-select nil | 242 (defcustom org-support-shift-select nil |
236 "Non-nil means, make shift-cursor commands select text when possible. | 243 "Non-nil means, make shift-cursor commands select text when possible. |
237 | 244 |
471 \\[org-toggle-fixed-width-section]." | 478 \\[org-toggle-fixed-width-section]." |
472 :group 'org-keywords | 479 :group 'org-keywords |
473 :type 'string) | 480 :type 'string) |
474 | 481 |
475 (defconst org-repeat-re | 482 (defconst org-repeat-re |
476 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*\\([.+]?\\+[0-9]+[dwmy]\\)" | 483 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)" |
477 "Regular expression for specifying repeated events. | 484 "Regular expression for specifying repeated events. |
478 After a match, group 1 contains the repeat expression.") | 485 After a match, group 1 contains the repeat expression.") |
479 | 486 |
480 (defgroup org-structure nil | 487 (defgroup org-structure nil |
481 "Options concerning the general structure of Org-mode files." | 488 "Options concerning the general structure of Org-mode files." |
584 (const :tag "In current window" current-window) | 591 (const :tag "In current window" current-window) |
585 (const :tag "In current frame, other window" other-window) | 592 (const :tag "In current frame, other window" other-window) |
586 (const :tag "Each time a new frame" new-frame) | 593 (const :tag "Each time a new frame" new-frame) |
587 (const :tag "One dedicated frame" dedicated-frame))) | 594 (const :tag "One dedicated frame" dedicated-frame))) |
588 | 595 |
596 (defcustom org-use-speed-commands nil | |
597 "Non-nil means, activate single letter commands at beginning of a headline." | |
598 :group 'org-structure | |
599 :type 'boolean) | |
600 | |
601 (defcustom org-speed-commands-user nil | |
602 "Alist of additional speed commands. | |
603 This list will be checked before `org-speed-commands-default' | |
604 when the variable `org-use-speed-commands' is non-nil | |
605 and when the cursor is at the beginning of a headline. | |
606 The car if each entry is a string with a single letter, which must | |
607 be assigned to `self-insert-command' in the global map. | |
608 The cdr is either a command to be called interactively, a function | |
609 to be called, or a form to be evaluated." | |
610 :group 'org-structure | |
611 :type '(repeat | |
612 (cons | |
613 (string "Command letter") | |
614 (choice | |
615 (function) | |
616 (sexp))))) | |
617 | |
589 (defgroup org-cycle nil | 618 (defgroup org-cycle nil |
590 "Options concerning visibility cycling in Org-mode." | 619 "Options concerning visibility cycling in Org-mode." |
591 :tag "Org Cycle" | 620 :tag "Org Cycle" |
592 :group 'org-structure) | 621 :group 'org-structure) |
593 | 622 |
645 must not be a headline - it may be empty or some other text. When used in | 674 must not be a headline - it may be empty or some other text. When used in |
646 this way, `org-cycle-hook' is disables temporarily, to make sure the | 675 this way, `org-cycle-hook' is disables temporarily, to make sure the |
647 cursor stays at the beginning of the buffer. | 676 cursor stays at the beginning of the buffer. |
648 When this option is nil, don't do anything special at the beginning | 677 When this option is nil, don't do anything special at the beginning |
649 of the buffer." | 678 of the buffer." |
679 :group 'org-cycle | |
680 :type 'boolean) | |
681 | |
682 (defcustom org-cycle-level-after-item/entry-creation t | |
683 "Non-nil means, cycle entry level or item indentation in new empty entries. | |
684 | |
685 When the cursor is at the end of an empty headline, i.e with only stars | |
686 and maybe a TODO keyword, TAB will then switch the entry to become a child, | |
687 and then all possible anchestor states, before returning to the original state. | |
688 This makes data entry extremely fast: M-RET to create a new headline, | |
689 on TAB to make it a child, two or more tabs to make it a (grand-)uncle. | |
690 | |
691 When the cursor is at the end of an empty plain list item, one TAB will | |
692 make it a subitem, two or more tabs will back up to make this an item | |
693 higher up in the item hierarchy." | |
650 :group 'org-cycle | 694 :group 'org-cycle |
651 :type 'boolean) | 695 :type 'boolean) |
652 | 696 |
653 (defcustom org-cycle-emulate-tab t | 697 (defcustom org-cycle-emulate-tab t |
654 "Where should `org-cycle' emulate TAB. | 698 "Where should `org-cycle' emulate TAB. |
969 (const :tag "on" t) | 1013 (const :tag "on" t) |
970 (const :tag "on, optimized" optimized))) | 1014 (const :tag "on, optimized" optimized))) |
971 | 1015 |
972 (defcustom org-self-insert-cluster-for-undo t | 1016 (defcustom org-self-insert-cluster-for-undo t |
973 "Non-nil means cluster self-insert commands for undo when possible. | 1017 "Non-nil means cluster self-insert commands for undo when possible. |
974 If this is set, then, like in the Emacs command loop, 20 consequtive | 1018 If this is set, then, like in the Emacs command loop, 20 consecutive |
975 characters will be undone together. | 1019 characters will be undone together. |
976 This is configurable, because there is some impact on typing performance." | 1020 This is configurable, because there is some impact on typing performance." |
977 :group 'org-table | 1021 :group 'org-table |
978 :type 'boolean) | 1022 :type 'boolean) |
979 | 1023 |
1288 (defcustom org-open-non-existing-files nil | 1332 (defcustom org-open-non-existing-files nil |
1289 "Non-nil means, `org-open-file' will open non-existing files. | 1333 "Non-nil means, `org-open-file' will open non-existing files. |
1290 When nil, an error will be generated. | 1334 When nil, an error will be generated. |
1291 This variable applies only to external applications because they | 1335 This variable applies only to external applications because they |
1292 might choke on non-existing files. If the link is to a file that | 1336 might choke on non-existing files. If the link is to a file that |
1293 will be openend in Emacs, the variable is ignored." | 1337 will be opened in Emacs, the variable is ignored." |
1294 :group 'org-link-follow | 1338 :group 'org-link-follow |
1295 :type 'boolean) | 1339 :type 'boolean) |
1296 | 1340 |
1297 (defcustom org-open-directory-means-index-dot-org nil | 1341 (defcustom org-open-directory-means-index-dot-org nil |
1298 "Non-nil means, a link to a directory really means to index.org. | 1342 "Non-nil means, a link to a directory really means to index.org. |
1386 See `org-file-apps'.") | 1430 See `org-file-apps'.") |
1387 | 1431 |
1388 (defcustom org-file-apps | 1432 (defcustom org-file-apps |
1389 '( | 1433 '( |
1390 (auto-mode . emacs) | 1434 (auto-mode . emacs) |
1435 ("\\.mm\\'" . default) | |
1391 ("\\.x?html?\\'" . default) | 1436 ("\\.x?html?\\'" . default) |
1392 ("\\.pdf\\'" . default) | 1437 ("\\.pdf\\'" . default) |
1393 ) | 1438 ) |
1394 "External applications for opening `file:path' items in a document. | 1439 "External applications for opening `file:path' items in a document. |
1395 Org-mode uses system defaults for different file types, but | 1440 Org-mode uses system defaults for different file types, but |
1903 | 1948 |
1904 Possible values are: | 1949 Possible values are: |
1905 | 1950 |
1906 nil Don't add anything, just change the keyword | 1951 nil Don't add anything, just change the keyword |
1907 time Add a time stamp to the task | 1952 time Add a time stamp to the task |
1908 note Prompt a closing note and add it with template `org-log-note-headings' | 1953 note Prompt for a note and add it with template `org-log-note-headings' |
1909 | 1954 |
1910 This option can also be set with on a per-file-basis with | 1955 This option can also be set with on a per-file-basis with |
1911 | 1956 |
1912 #+STARTUP: nologdone | 1957 #+STARTUP: nologdone |
1913 #+STARTUP: logdone | 1958 #+STARTUP: logdone |
1918 :group 'org-todo | 1963 :group 'org-todo |
1919 :group 'org-progress | 1964 :group 'org-progress |
1920 :type '(choice | 1965 :type '(choice |
1921 (const :tag "No logging" nil) | 1966 (const :tag "No logging" nil) |
1922 (const :tag "Record CLOSED timestamp" time) | 1967 (const :tag "Record CLOSED timestamp" time) |
1923 (const :tag "Record CLOSED timestamp with closing note." note))) | 1968 (const :tag "Record CLOSED timestamp with note." note))) |
1924 | 1969 |
1925 ;; Normalize old uses of org-log-done. | 1970 ;; Normalize old uses of org-log-done. |
1926 (cond | 1971 (cond |
1927 ((eq org-log-done t) (setq org-log-done 'time)) | 1972 ((eq org-log-done t) (setq org-log-done 'time)) |
1928 ((and (listp org-log-done) (memq 'done org-log-done)) | 1973 ((and (listp org-log-done) (memq 'done org-log-done)) |
1929 (setq org-log-done 'note))) | 1974 (setq org-log-done 'note))) |
1930 | 1975 |
1976 (defcustom org-log-reschedule nil | |
1977 "Information to record when the scheduling date of a tasks is modified. | |
1978 | |
1979 Possible values are: | |
1980 | |
1981 nil Don't add anything, just change the date | |
1982 time Add a time stamp to the task | |
1983 note Prompt for a note and add it with template `org-log-note-headings' | |
1984 | |
1985 This option can also be set with on a per-file-basis with | |
1986 | |
1987 #+STARTUP: nologreschedule | |
1988 #+STARTUP: logreschedule | |
1989 #+STARTUP: lognotereschedule" | |
1990 :group 'org-todo | |
1991 :group 'org-progress | |
1992 :type '(choice | |
1993 (const :tag "No logging" nil) | |
1994 (const :tag "Record timestamp" time) | |
1995 (const :tag "Record timestamp with note." note))) | |
1996 | |
1997 (defcustom org-log-redeadline nil | |
1998 "Information to record when the deadline date of a tasks is modified. | |
1999 | |
2000 Possible values are: | |
2001 | |
2002 nil Don't add anything, just change the date | |
2003 time Add a time stamp to the task | |
2004 note Prompt for a note and add it with template `org-log-note-headings' | |
2005 | |
2006 This option can also be set with on a per-file-basis with | |
2007 | |
2008 #+STARTUP: nologredeadline | |
2009 #+STARTUP: logredeadline | |
2010 #+STARTUP: lognoteredeadline | |
2011 | |
2012 You can have local logging settings for a subtree by setting the LOGGING | |
2013 property to one or more of these keywords." | |
2014 :group 'org-todo | |
2015 :group 'org-progress | |
2016 :type '(choice | |
2017 (const :tag "No logging" nil) | |
2018 (const :tag "Record timestamp" time) | |
2019 (const :tag "Record timestamp with note." note))) | |
2020 | |
1931 (defcustom org-log-note-clock-out nil | 2021 (defcustom org-log-note-clock-out nil |
1932 "Non-nil means, record a note when clocking out of an item. | 2022 "Non-nil means, record a note when clocking out of an item. |
1933 This can also be configured on a per-file basis by adding one of | 2023 This can also be configured on a per-file basis by adding one of |
1934 the following lines anywhere in the buffer: | 2024 the following lines anywhere in the buffer: |
1935 | 2025 |
1947 | 2037 |
1948 (defcustom org-log-note-headings | 2038 (defcustom org-log-note-headings |
1949 '((done . "CLOSING NOTE %t") | 2039 '((done . "CLOSING NOTE %t") |
1950 (state . "State %-12s from %-12S %t") | 2040 (state . "State %-12s from %-12S %t") |
1951 (note . "Note taken on %t") | 2041 (note . "Note taken on %t") |
2042 (reschedule . "Rescheduled from %S on %t") | |
2043 (redeadline . "New deadline from %S on %t") | |
1952 (clock-out . "")) | 2044 (clock-out . "")) |
1953 "Headings for notes added to entries. | 2045 "Headings for notes added to entries. |
1954 The value is an alist, with the car being a symbol indicating the note | 2046 The value is an alist, with the car being a symbol indicating the note |
1955 context, and the cdr is the heading to be used. The heading may also be the | 2047 context, and the cdr is the heading to be used. The heading may also be the |
1956 empty string. | 2048 empty string. |
1965 (cons (const :tag "Heading when closing an item" done) string) | 2057 (cons (const :tag "Heading when closing an item" done) string) |
1966 (cons (const :tag | 2058 (cons (const :tag |
1967 "Heading when changing todo state (todo sequence only)" | 2059 "Heading when changing todo state (todo sequence only)" |
1968 state) string) | 2060 state) string) |
1969 (cons (const :tag "Heading when just taking a note" note) string) | 2061 (cons (const :tag "Heading when just taking a note" note) string) |
1970 (cons (const :tag "Heading when clocking out" clock-out) string))) | 2062 (cons (const :tag "Heading when clocking out" clock-out) string) |
2063 (cons (const :tag "Heading when rescheduling" reschedule) string) | |
2064 (cons (const :tag "Heading when changing deadline" redeadline) string))) | |
1971 | 2065 |
1972 (unless (assq 'note org-log-note-headings) | 2066 (unless (assq 'note org-log-note-headings) |
1973 (push '(note . "%t") org-log-note-headings)) | 2067 (push '(note . "%t") org-log-note-headings)) |
1974 | 2068 |
1975 (defcustom org-log-into-drawer nil | 2069 (defcustom org-log-into-drawer nil |
2171 "The format string used when creating CLOCKSUM lines, or when | 2265 "The format string used when creating CLOCKSUM lines, or when |
2172 org-mode generates a time duration." | 2266 org-mode generates a time duration." |
2173 :group 'org-time | 2267 :group 'org-time |
2174 :type 'string) | 2268 :type 'string) |
2175 | 2269 |
2270 (defcustom org-time-clocksum-use-fractional nil | |
2271 "If non-nil, \\[org-clock-display] uses fractional times. | |
2272 org-mode generates a time duration." | |
2273 :group 'org-time | |
2274 :type 'boolean) | |
2275 | |
2276 (defcustom org-time-clocksum-fractional-format "%.2f" | |
2277 "The format string used when creating CLOCKSUM lines, or when | |
2278 org-mode generates a time duration." | |
2279 :group 'org-time | |
2280 :type 'string) | |
2281 | |
2176 (defcustom org-deadline-warning-days 14 | 2282 (defcustom org-deadline-warning-days 14 |
2177 "No. of days before expiration during which a deadline becomes active. | 2283 "No. of days before expiration during which a deadline becomes active. |
2178 This variable governs the display in sparse trees and in the agenda. | 2284 This variable governs the display in sparse trees and in the agenda. |
2179 When 0 or negative, it means use this number (the absolute value of it) | 2285 When 0 or negative, it means use this number (the absolute value of it) |
2180 even if a deadline has a different individual lead time specified. | 2286 even if a deadline has a different individual lead time specified. |
2185 :type 'integer) | 2291 :type 'integer) |
2186 | 2292 |
2187 (defcustom org-read-date-prefer-future t | 2293 (defcustom org-read-date-prefer-future t |
2188 "Non-nil means, assume future for incomplete date input from user. | 2294 "Non-nil means, assume future for incomplete date input from user. |
2189 This affects the following situations: | 2295 This affects the following situations: |
2190 1. The user gives a day, but no month. | 2296 1. The user gives a month but not a year. |
2297 For example, if it is april and you enter \"feb 2\", this will be read | |
2298 as feb 2, *next* year. \"May 5\", however, will be this year. | |
2299 2. The user gives a day, but no month. | |
2191 For example, if today is the 15th, and you enter \"3\", Org-mode will | 2300 For example, if today is the 15th, and you enter \"3\", Org-mode will |
2192 read this as the third of *next* month. However, if you enter \"17\", | 2301 read this as the third of *next* month. However, if you enter \"17\", |
2193 it will be considered as *this* month. | 2302 it will be considered as *this* month. |
2194 2. The user gives a month but not a year. | 2303 |
2195 For example, if it is april and you enter \"feb 2\", this will be read | 2304 If you set this variable to the symbol `time', then also the following |
2196 as feb 2, *next* year. \"May 5\", however, will be this year. | 2305 will work: |
2197 | 2306 |
2198 Currently this does not work for ISO week specifications. | 2307 3. If the user gives a time, but no day. If the time is before now, |
2199 | 2308 to will be interpreted as tomorrow. |
2200 When this option is nil, the current month and year will always be used | 2309 |
2201 as defaults." | 2310 Currently none of this works for ISO week specifications. |
2311 | |
2312 When this option is nil, the current day, month and year will always be | |
2313 used as defaults." | |
2202 :group 'org-time | 2314 :group 'org-time |
2203 :type 'boolean) | 2315 :type '(choice |
2316 (const :tag "Never" nil) | |
2317 (const :tag "Check month and day" t) | |
2318 (const :tag "Check month, day, and time" time))) | |
2204 | 2319 |
2205 (defcustom org-read-date-display-live t | 2320 (defcustom org-read-date-display-live t |
2206 "Non-nil means, display current interpretation of date prompt live. | 2321 "Non-nil means, display current interpretation of date prompt live. |
2207 This display will be in an overlay, in the minibuffer." | 2322 This display will be in an overlay, in the minibuffer." |
2208 :group 'org-time | 2323 :group 'org-time |
2270 :group 'org-tags | 2385 :group 'org-tags |
2271 :type '(repeat | 2386 :type '(repeat |
2272 (choice | 2387 (choice |
2273 (cons (string :tag "Tag name") | 2388 (cons (string :tag "Tag name") |
2274 (character :tag "Access char")) | 2389 (character :tag "Access char")) |
2275 (const :tag "Start radio group" (:startgroup)) | 2390 (list :tag "Start radio group" |
2276 (const :tag "End radio group" (:endgroup)) | 2391 (const :startgroup) |
2392 (option (string :tag "Group description"))) | |
2393 (list :tag "End radio group" | |
2394 (const :endgroup) | |
2395 (option (string :tag "Group description"))) | |
2277 (const :tag "New line" (:newline))))) | 2396 (const :tag "New line" (:newline))))) |
2278 | 2397 |
2279 (defcustom org-tag-persistent-alist nil | 2398 (defcustom org-tag-persistent-alist nil |
2280 "List of tags that will always appear in all Org-mode files. | 2399 "List of tags that will always appear in all Org-mode files. |
2281 This is in addition to any in buffer settings or customizations | 2400 This is in addition to any in buffer settings or customizations |
2298 | 2417 |
2299 (defvar org-file-tags nil | 2418 (defvar org-file-tags nil |
2300 "List of tags that can be inherited by all entries in the file. | 2419 "List of tags that can be inherited by all entries in the file. |
2301 The tags will be inherited if the variable `org-use-tag-inheritance' | 2420 The tags will be inherited if the variable `org-use-tag-inheritance' |
2302 says they should be. | 2421 says they should be. |
2303 This variable is populated from #+TAG lines.") | 2422 This variable is populated from #+FILETAGS lines.") |
2304 | 2423 |
2305 (defcustom org-use-fast-tag-selection 'auto | 2424 (defcustom org-use-fast-tag-selection 'auto |
2306 "Non-nil means, use fast tag selection scheme. | 2425 "Non-nil means, use fast tag selection scheme. |
2307 This is a special interface to select and deselect tags with single keys. | 2426 This is a special interface to select and deselect tags with single keys. |
2308 When nil, fast selection is never used. | 2427 When nil, fast selection is never used. |
2638 The command `org-agenda-action' will be bound to this key. The | 2757 The command `org-agenda-action' will be bound to this key. The |
2639 default is the character `k' because we use the same key in the agenda." | 2758 default is the character `k' because we use the same key in the agenda." |
2640 :group 'org-agenda | 2759 :group 'org-agenda |
2641 :type 'sexp) | 2760 :type 'sexp) |
2642 | 2761 |
2762 (defcustom org-calendar-insert-diary-entry-key [?i] | |
2763 "The key to be installed in `calendar-mode-map' for adding diary entries. | |
2764 This option is irrelevant until `org-agenda-diary-file' has been configured | |
2765 to point to an Org-mode file. When that is the case, the command | |
2766 `org-agenda-diary-entry' will be bound to the key given here, by default | |
2767 `i'. In the calendar, `i' normally adds entries to `diary-file'. So | |
2768 if you want to continue doing this, you need to change this to a different | |
2769 key." | |
2770 :group 'org-agenda | |
2771 :type 'sexp) | |
2772 | |
2773 (defcustom org-agenda-diary-file 'diary-file | |
2774 "File to which to add new entries with the `i' key in agenda and calendar. | |
2775 When this is the symbol `diary-file', the functionality in the Emacs | |
2776 calendar will be used to add entries to the `diary-file'. But when this | |
2777 points to a file, `org-agenda-diary-entry' will be used instead." | |
2778 :group 'org-agenda | |
2779 :type '(choice | |
2780 (const :tag "The standard Emacs diary file" diary-file) | |
2781 (file :tag "Special Org file diary entries"))) | |
2782 | |
2643 (eval-after-load "calendar" | 2783 (eval-after-load "calendar" |
2644 '(progn | 2784 '(progn |
2645 (org-defkey calendar-mode-map org-calendar-to-agenda-key | 2785 (org-defkey calendar-mode-map org-calendar-to-agenda-key |
2646 'org-calendar-goto-agenda) | 2786 'org-calendar-goto-agenda) |
2647 (org-defkey calendar-mode-map org-calendar-agenda-action-key | 2787 (org-defkey calendar-mode-map org-calendar-agenda-action-key |
2648 'org-agenda-action))) | 2788 'org-agenda-action) |
2789 (add-hook 'calendar-mode-hook | |
2790 (lambda () | |
2791 (unless (eq org-agenda-diary-file 'diary-file) | |
2792 (define-key calendar-mode-map | |
2793 org-calendar-insert-diary-entry-key | |
2794 'org-agenda-diary-entry)))))) | |
2649 | 2795 |
2650 (defgroup org-latex nil | 2796 (defgroup org-latex nil |
2651 "Options for embedding LaTeX code into Org-mode." | 2797 "Options for embedding LaTeX code into Org-mode." |
2652 :tag "Org LaTeX" | 2798 :tag "Org LaTeX" |
2653 :group 'org) | 2799 :group 'org) |
2747 :type 'boolean) | 2893 :type 'boolean) |
2748 | 2894 |
2749 (defcustom org-fontify-whole-heading-line nil | 2895 (defcustom org-fontify-whole-heading-line nil |
2750 "Non-nil means fontify the whole line for headings. | 2896 "Non-nil means fontify the whole line for headings. |
2751 This is useful when setting a background color for the | 2897 This is useful when setting a background color for the |
2752 org-leve-* faces." | 2898 org-level-* faces." |
2753 :group 'org-font-lock | 2899 :group 'org-font-lock |
2754 :type 'boolean) | 2900 :type 'boolean) |
2755 | 2901 |
2756 (defcustom org-highlight-latex-fragments-and-specials nil | 2902 (defcustom org-highlight-latex-fragments-and-specials nil |
2757 "Non-nil means, fontify what is treated specially by the exporters." | 2903 "Non-nil means, fontify what is treated specially by the exporters." |
2903 (defcustom org-completion-use-iswitchb nil | 3049 (defcustom org-completion-use-iswitchb nil |
2904 "Non-nil means, use iswitchb completion wherever possible. | 3050 "Non-nil means, use iswitchb completion wherever possible. |
2905 Note that `iswitchb-mode' must be active for this variable to be relevant. | 3051 Note that `iswitchb-mode' must be active for this variable to be relevant. |
2906 If you decide to turn this variable on, you might well want to turn off | 3052 If you decide to turn this variable on, you might well want to turn off |
2907 `org-outline-path-complete-in-steps'. | 3053 `org-outline-path-complete-in-steps'. |
2908 Note that thi variable has only an effect if `org-completion-use-ido' is nil." | 3054 Note that this variable has only an effect if `org-completion-use-ido' is nil." |
2909 :group 'org-completion | 3055 :group 'org-completion |
2910 :type 'boolean) | 3056 :type 'boolean) |
2911 | 3057 |
2912 (defcustom org-completion-fallback-command 'hippie-expand | 3058 (defcustom org-completion-fallback-command 'hippie-expand |
2913 "The expansion command called by \\[org-complete] in normal context. | 3059 "The expansion command called by \\[org-complete] in normal context. |
2914 Normal means, no org-mode-specific context." | 3060 Normal means, no org-mode-specific context." |
2915 :group 'org-completion | 3061 :group 'org-completion |
2916 :type 'function) | 3062 :type 'function) |
2917 | 3063 |
2918 ;;; Functions and variables from ther packages | 3064 ;;; Functions and variables from their packages |
2919 ;; Declared here to avoid compiler warnings | 3065 ;; Declared here to avoid compiler warnings |
2920 | 3066 |
2921 ;; XEmacs only | 3067 ;; XEmacs only |
2922 (defvar outline-mode-menu-heading) | 3068 (defvar outline-mode-menu-heading) |
2923 (defvar outline-mode-menu-show) | 3069 (defvar outline-mode-menu-show) |
2957 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item | 3103 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item |
2958 "org-agenda" (&optional end)) | 3104 "org-agenda" (&optional end)) |
2959 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) | 3105 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) |
2960 (declare-function org-indent-mode "org-indent" (&optional arg)) | 3106 (declare-function org-indent-mode "org-indent" (&optional arg)) |
2961 (declare-function parse-time-string "parse-time" (string)) | 3107 (declare-function parse-time-string "parse-time" (string)) |
3108 (declare-function org-attach-reveal "org-attach" (&optional if-exists)) | |
2962 (defvar remember-data-file) | 3109 (defvar remember-data-file) |
2963 (defvar texmathp-why) | 3110 (defvar texmathp-why) |
2964 (declare-function speedbar-line-directory "speedbar" (&optional depth)) | 3111 (declare-function speedbar-line-directory "speedbar" (&optional depth)) |
2965 (declare-function table--at-cell-p "table" (position &optional object at-column)) | 3112 (declare-function table--at-cell-p "table" (position &optional object at-column)) |
2966 | 3113 |
3129 | 3276 |
3130 | 3277 |
3131 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" | 3278 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" |
3132 (beg end)) | 3279 (beg end)) |
3133 (declare-function org-clock-update-mode-line "org-clock" ()) | 3280 (declare-function org-clock-update-mode-line "org-clock" ()) |
3281 (declare-function org-resolve-clocks "org-clock" | |
3282 (&optional also-non-dangling-p prompt last-valid)) | |
3134 (defvar org-clock-start-time) | 3283 (defvar org-clock-start-time) |
3135 (defvar org-clock-marker (make-marker) | 3284 (defvar org-clock-marker (make-marker) |
3136 "Marker recording the last clock-in.") | 3285 "Marker recording the last clock-in.") |
3137 (defvar org-clock-hd-marker (make-marker) | 3286 (defvar org-clock-hd-marker (make-marker) |
3138 "Marker recording the last clock-in, but the headline position.") | 3287 "Marker recording the last clock-in, but the headline position.") |
3288 (defvar org-clock-heading "" | |
3289 "The heading of the current clock entry.") | |
3139 (defun org-clock-is-active () | 3290 (defun org-clock-is-active () |
3140 "Return non-nil if clock is currently running. | 3291 "Return non-nil if clock is currently running. |
3141 The return value is actually the clock marker." | 3292 The return value is actually the clock marker." |
3142 (marker-buffer org-clock-marker)) | 3293 (marker-buffer org-clock-marker)) |
3143 | 3294 |
3146 "org-clock" | 3297 "org-clock" |
3147 '(org-clock-in org-clock-out org-clock-cancel | 3298 '(org-clock-in org-clock-out org-clock-cancel |
3148 org-clock-goto org-clock-sum org-clock-display | 3299 org-clock-goto org-clock-sum org-clock-display |
3149 org-clock-remove-overlays org-clock-report | 3300 org-clock-remove-overlays org-clock-report |
3150 org-clocktable-shift org-dblock-write:clocktable | 3301 org-clocktable-shift org-dblock-write:clocktable |
3151 org-get-clocktable))) | 3302 org-get-clocktable org-resolve-clocks))) |
3152 | 3303 |
3153 (defun org-clock-update-time-maybe () | 3304 (defun org-clock-update-time-maybe () |
3154 "If this is a CLOCK line, update it and return t. | 3305 "If this is a CLOCK line, update it and return t. |
3155 Otherwise, return nil." | 3306 Otherwise, return nil." |
3156 (interactive) | 3307 (interactive) |
3226 '(org-feed-update org-feed-update-all org-feed-goto-inbox))) | 3377 '(org-feed-update org-feed-update-all org-feed-goto-inbox))) |
3227 | 3378 |
3228 | 3379 |
3229 ;; Autoload org-indent.el | 3380 ;; Autoload org-indent.el |
3230 | 3381 |
3382 ;; Define the variable already here, to make sure we have it. | |
3383 (defvar org-indent-mode nil | |
3384 "Non-nil if Org-Indent mode is enabled. | |
3385 Use the command `org-indent-mode' to change this variable.") | |
3386 | |
3231 (eval-and-compile | 3387 (eval-and-compile |
3232 (org-autoload | 3388 (org-autoload |
3233 "org-indent" | 3389 "org-indent" |
3234 '(org-indent-mode))) | 3390 '(org-indent-mode))) |
3235 | 3391 |
3278 | 3434 |
3279 \"~/org/archive.org::\" | 3435 \"~/org/archive.org::\" |
3280 Archive in file ~/org/archive.org (absolute path), as top-level trees. | 3436 Archive in file ~/org/archive.org (absolute path), as top-level trees. |
3281 | 3437 |
3282 \"~/org/archive.org::From %s\" | 3438 \"~/org/archive.org::From %s\" |
3283 Archive in file ~/org/archive.org (absolute path), und headlines | 3439 Archive in file ~/org/archive.org (absolute path), under headlines |
3284 \"From FILENAME\" where file name is the current file name. | 3440 \"From FILENAME\" where file name is the current file name. |
3285 | 3441 |
3286 \"basement::** Finished Tasks\" | 3442 \"basement::** Finished Tasks\" |
3287 Archive in file ./basement (relative path), as level 3 trees | 3443 Archive in file ./basement (relative path), as level 3 trees |
3288 below the level 2 heading \"** Finished Tasks\". | 3444 below the level 2 heading \"** Finished Tasks\". |
3315 Instead, use the key `v' to cycle the archives-mode in the agenda." | 3471 Instead, use the key `v' to cycle the archives-mode in the agenda." |
3316 :group 'org-archive | 3472 :group 'org-archive |
3317 :group 'org-agenda-skip | 3473 :group 'org-agenda-skip |
3318 :type 'boolean) | 3474 :type 'boolean) |
3319 | 3475 |
3320 (defcustom org-columns-skip-arrchived-trees t | 3476 (defcustom org-columns-skip-archived-trees t |
3321 "Non-nil means, irgnore archived trees when creating column view." | 3477 "Non-nil means, ignore archived trees when creating column view." |
3322 :group 'org-archive | 3478 :group 'org-archive |
3323 :group 'org-properties | 3479 :group 'org-properties |
3324 :type 'boolean) | 3480 :type 'boolean) |
3325 | 3481 |
3326 (defcustom org-cycle-open-archived-trees nil | 3482 (defcustom org-cycle-open-archived-trees nil |
3365 "Re-hide all archived subtrees after a visibility state change." | 3521 "Re-hide all archived subtrees after a visibility state change." |
3366 (save-excursion | 3522 (save-excursion |
3367 (let* ((re (concat ":" org-archive-tag ":"))) | 3523 (let* ((re (concat ":" org-archive-tag ":"))) |
3368 (goto-char beg) | 3524 (goto-char beg) |
3369 (while (re-search-forward re end t) | 3525 (while (re-search-forward re end t) |
3370 (and (org-on-heading-p) (hide-subtree)) | 3526 (and (org-on-heading-p) (org-flag-subtree t)) |
3371 (org-end-of-subtree t))))) | 3527 (org-end-of-subtree t))))) |
3528 | |
3529 (defun org-flag-subtree (flag) | |
3530 (save-excursion | |
3531 (org-back-to-heading t) | |
3532 (outline-end-of-heading) | |
3533 (outline-flag-region (point) | |
3534 (progn (org-end-of-subtree t) (point)) | |
3535 flag))) | |
3372 | 3536 |
3373 (defalias 'org-advertized-archive-subtree 'org-archive-subtree) | 3537 (defalias 'org-advertized-archive-subtree 'org-archive-subtree) |
3374 | 3538 |
3375 (eval-and-compile | 3539 (eval-and-compile |
3376 (org-autoload "org-archive" | 3540 (org-autoload "org-archive" |
3511 "\\(--?" | 3675 "\\(--?" |
3512 "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") | 3676 "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") |
3513 "Regular expression to match a timestamp time or time range. | 3677 "Regular expression to match a timestamp time or time range. |
3514 After a match, the following groups carry important information: | 3678 After a match, the following groups carry important information: |
3515 0 the full match | 3679 0 the full match |
3516 1 date plus weekday, for backreferencing to make sure both times on same day | 3680 1 date plus weekday, for back referencing to make sure both times are on the same day |
3517 2 the first time, range or not | 3681 2 the first time, range or not |
3518 4 the second time, if it is a range.") | 3682 4 the second time, if it is a range.") |
3519 | 3683 |
3520 (defconst org-startup-options | 3684 (defconst org-startup-options |
3521 '(("fold" org-startup-folded t) | 3685 '(("fold" org-startup-folded t) |
3539 ("lognoteclock-out" org-log-note-clock-out t) | 3703 ("lognoteclock-out" org-log-note-clock-out t) |
3540 ("nolognoteclock-out" org-log-note-clock-out nil) | 3704 ("nolognoteclock-out" org-log-note-clock-out nil) |
3541 ("logrepeat" org-log-repeat state) | 3705 ("logrepeat" org-log-repeat state) |
3542 ("lognoterepeat" org-log-repeat note) | 3706 ("lognoterepeat" org-log-repeat note) |
3543 ("nologrepeat" org-log-repeat nil) | 3707 ("nologrepeat" org-log-repeat nil) |
3708 ("logreschedule" org-log-reschedule time) | |
3709 ("lognotereschedule" org-log-reschedule note) | |
3710 ("nologreschedule" org-log-reschedule nil) | |
3711 ("logredeadline" org-log-redeadline time) | |
3712 ("lognoteredeadline" org-log-redeadline note) | |
3713 ("nologredeadline" org-log-redeadline nil) | |
3544 ("fninline" org-footnote-define-inline t) | 3714 ("fninline" org-footnote-define-inline t) |
3545 ("nofninline" org-footnote-define-inline nil) | 3715 ("nofninline" org-footnote-define-inline nil) |
3546 ("fnlocal" org-footnote-section nil) | 3716 ("fnlocal" org-footnote-section nil) |
3547 ("fnauto" org-footnote-auto-label t) | 3717 ("fnauto" org-footnote-auto-label t) |
3548 ("fnprompt" org-footnote-auto-label nil) | 3718 ("fnprompt" org-footnote-auto-label nil) |
3925 ;; Defined somewhere in this file, but used before definition. | 4095 ;; Defined somewhere in this file, but used before definition. |
3926 (defvar org-html-entities) | 4096 (defvar org-html-entities) |
3927 (defvar org-struct-menu) | 4097 (defvar org-struct-menu) |
3928 (defvar org-org-menu) | 4098 (defvar org-org-menu) |
3929 (defvar org-tbl-menu) | 4099 (defvar org-tbl-menu) |
3930 (defvar org-agenda-keymap) | |
3931 | 4100 |
3932 ;;;; Define the Org-mode | 4101 ;;;; Define the Org-mode |
3933 | 4102 |
3934 (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) | 4103 (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) |
3935 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22.")) | 4104 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or upgrade to newer allout, for example by switching to Emacs 22.")) |
3943 `org-table-align' sets it back to nil.") | 4112 `org-table-align' sets it back to nil.") |
3944 (defun org-before-change-function (beg end) | 4113 (defun org-before-change-function (beg end) |
3945 "Every change indicates that a table might need an update." | 4114 "Every change indicates that a table might need an update." |
3946 (setq org-table-may-need-update t)) | 4115 (setq org-table-may-need-update t)) |
3947 (defvar org-mode-map) | 4116 (defvar org-mode-map) |
3948 (defvar org-mode-hook nil | |
3949 "Mode hook for Org-mode, run after the mode was turned on.") | |
3950 (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | 4117 (defvar org-inhibit-startup nil) ; Dynamically-scoped param. |
3951 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. | 4118 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. |
3952 (defvar org-inhibit-logging nil) ; Dynamically-scoped param. | 4119 (defvar org-inhibit-logging nil) ; Dynamically-scoped param. |
3953 (defvar org-inhibit-blocking nil) ; Dynamically-scoped param. | 4120 (defvar org-inhibit-blocking nil) ; Dynamically-scoped param. |
3954 (defvar org-table-buffer-is-an nil) | 4121 (defvar org-table-buffer-is-an nil) |
4082 (set-buffer-modified-p bmp))) | 4249 (set-buffer-modified-p bmp))) |
4083 (when org-startup-indented | 4250 (when org-startup-indented |
4084 (require 'org-indent) | 4251 (require 'org-indent) |
4085 (org-indent-mode 1)) | 4252 (org-indent-mode 1)) |
4086 (org-set-startup-visibility))) | 4253 (org-set-startup-visibility))) |
4254 | |
4255 (when (fboundp 'abbrev-table-put) | |
4256 (abbrev-table-put org-mode-abbrev-table | |
4257 :parents (list text-mode-abbrev-table))) | |
4087 | 4258 |
4088 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) | 4259 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) |
4089 | 4260 |
4090 (defun org-current-time () | 4261 (defun org-current-time () |
4091 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'." | 4262 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'." |
4647 'keymap org-mouse-map)) | 4818 'keymap org-mouse-map)) |
4648 (org-rear-nonsticky-at (match-end 1)) | 4819 (org-rear-nonsticky-at (match-end 1)) |
4649 t))) | 4820 t))) |
4650 | 4821 |
4651 (defun org-outline-level () | 4822 (defun org-outline-level () |
4823 "Compute the outline level of the heading at point. | |
4824 This function assumes that the cursor is at the beginning of a line matched | |
4825 by outline-regexp. Otherwise it returns garbage. | |
4826 If this is called at a normal headline, the level is the number of stars. | |
4827 Use `org-reduced-level' to remove the effect of `org-odd-levels'. | |
4828 For plain list items, if they are matched by `outline-regexp', this returns | |
4829 1000 plus the line indentation." | |
4652 (save-excursion | 4830 (save-excursion |
4653 (looking-at outline-regexp) | 4831 (looking-at outline-regexp) |
4654 (if (match-beginning 1) | 4832 (if (match-beginning 1) |
4655 (+ (org-get-string-indentation (match-string 1)) 1000) | 4833 (+ (org-get-string-indentation (match-string 1)) 1000) |
4656 (1- (- (match-end 0) (match-beginning 0)))))) | 4834 (1- (- (match-end 0) (match-beginning 0)))))) |
4822 (font-lock-default-unfontify-region beg end) | 5000 (font-lock-default-unfontify-region beg end) |
4823 (let* ((buffer-undo-list t) | 5001 (let* ((buffer-undo-list t) |
4824 (inhibit-read-only t) (inhibit-point-motion-hooks t) | 5002 (inhibit-read-only t) (inhibit-point-motion-hooks t) |
4825 (inhibit-modification-hooks t) | 5003 (inhibit-modification-hooks t) |
4826 deactivate-mark buffer-file-name buffer-file-truename) | 5004 deactivate-mark buffer-file-name buffer-file-truename) |
4827 (remove-text-properties beg end | 5005 (remove-text-properties |
4828 '(mouse-face t keymap t org-linked-text t | 5006 beg end |
4829 invisible t intangible t | 5007 (if org-indent-mode |
4830 line-prefix t wrap-prefix t | 5008 ;; also remove line-prefix and wrap-prefix properties |
4831 org-no-flyspell t)))) | 5009 '(mouse-face t keymap t org-linked-text t |
5010 invisible t intangible t | |
5011 line-prefix t wrap-prefix t | |
5012 org-no-flyspell t) | |
5013 '(mouse-face t keymap t org-linked-text t | |
5014 invisible t intangible t | |
5015 org-no-flyspell t))))) | |
4832 | 5016 |
4833 ;;;; Visibility cycling, including org-goto and indirect buffer | 5017 ;;;; Visibility cycling, including org-goto and indirect buffer |
4834 | 5018 |
4835 ;;; Cycling | 5019 ;;; Cycling |
4836 | 5020 |
4845 | 5029 |
4846 (defun org-cycle (&optional arg) | 5030 (defun org-cycle (&optional arg) |
4847 "TAB-action and visibility cycling for Org-mode. | 5031 "TAB-action and visibility cycling for Org-mode. |
4848 | 5032 |
4849 This is the command invoked in Org-mode by the TAB key. Its main purpose | 5033 This is the command invoked in Org-mode by the TAB key. Its main purpose |
4850 is outine visibility cycling, but it also invokes other actions | 5034 is outline visibility cycling, but it also invokes other actions |
4851 in special contexts. | 5035 in special contexts. |
4852 | 5036 |
4853 - When this function is called with a prefix argument, rotate the entire | 5037 - When this function is called with a prefix argument, rotate the entire |
4854 buffer through 3 states (global cycling) | 5038 buffer through 3 states (global cycling) |
4855 1. OVERVIEW: Show only top-level headlines. | 5039 1. OVERVIEW: Show only top-level headlines. |
4883 - Special case: if point is at the beginning of the buffer and there is | 5067 - Special case: if point is at the beginning of the buffer and there is |
4884 no headline in line 1, this function will act as if called with prefix arg. | 5068 no headline in line 1, this function will act as if called with prefix arg. |
4885 But only if also the variable `org-cycle-global-at-bob' is t." | 5069 But only if also the variable `org-cycle-global-at-bob' is t." |
4886 (interactive "P") | 5070 (interactive "P") |
4887 (org-load-modules-maybe) | 5071 (org-load-modules-maybe) |
4888 (unless (run-hook-with-args-until-success 'org-tab-first-hook) | 5072 (unless (or (run-hook-with-args-until-success 'org-tab-first-hook) |
5073 (and org-cycle-level-after-item/entry-creation | |
5074 (or (org-cycle-level) | |
5075 (org-cycle-item-indentation)))) | |
4889 (let* ((limit-level | 5076 (let* ((limit-level |
4890 (or org-cycle-max-level | 5077 (or org-cycle-max-level |
4891 (and (boundp 'org-inlinetask-min-level) | 5078 (and (boundp 'org-inlinetask-min-level) |
4892 org-inlinetask-min-level | 5079 org-inlinetask-min-level |
4893 (1- org-inlinetask-min-level)))) | 5080 (1- org-inlinetask-min-level)))) |
4969 'org-tab-after-check-for-cycling-hook)) | 5156 'org-tab-after-check-for-cycling-hook)) |
4970 | 5157 |
4971 ((org-try-structure-completion)) | 5158 ((org-try-structure-completion)) |
4972 | 5159 |
4973 ((org-try-cdlatex-tab)) | 5160 ((org-try-cdlatex-tab)) |
5161 | |
5162 ((run-hook-with-args-until-success | |
5163 'org-tab-before-tab-emulation-hook)) | |
4974 | 5164 |
4975 ((and (eq org-cycle-emulate-tab 'exc-hl-bol) | 5165 ((and (eq org-cycle-emulate-tab 'exc-hl-bol) |
4976 (or (not (bolp)) | 5166 (or (not (bolp)) |
4977 (not (looking-at outline-regexp)))) | 5167 (not (looking-at outline-regexp)))) |
4978 (call-interactively (global-key-binding "\t"))) | 5168 (call-interactively (global-key-binding "\t"))) |
5316 "Move to the parent and re-show empty lines before visible headlines." | 5506 "Move to the parent and re-show empty lines before visible headlines." |
5317 (save-excursion | 5507 (save-excursion |
5318 (let ((context (if (org-up-heading-safe) 'children 'overview))) | 5508 (let ((context (if (org-up-heading-safe) 'children 'overview))) |
5319 (org-cycle-show-empty-lines context)))) | 5509 (org-cycle-show-empty-lines context)))) |
5320 | 5510 |
5511 (defun org-files-list () | |
5512 "Return `org-agenda-files' list, plus all open org-mode files. | |
5513 This is useful for operations that need to scan all of a user's | |
5514 open and agenda-wise Org files." | |
5515 (let ((files (mapcar 'expand-file-name (org-agenda-files)))) | |
5516 (dolist (buf (buffer-list)) | |
5517 (with-current-buffer buf | |
5518 (if (and (eq major-mode 'org-mode) (buffer-file-name)) | |
5519 (let ((file (expand-file-name (buffer-file-name)))) | |
5520 (unless (member file files) | |
5521 (push file files)))))) | |
5522 files)) | |
5523 | |
5524 (defsubst org-entry-beginning-position () | |
5525 "Return the beginning position of the current entry." | |
5526 (save-excursion (outline-back-to-heading t) (point))) | |
5527 | |
5528 (defsubst org-entry-end-position () | |
5529 "Return the end position of the current entry." | |
5530 (save-excursion (outline-next-heading) (point))) | |
5531 | |
5321 (defun org-cycle-hide-drawers (state) | 5532 (defun org-cycle-hide-drawers (state) |
5322 "Re-hide all drawers after a visibility state change." | 5533 "Re-hide all drawers after a visibility state change." |
5323 (when (and (org-mode-p) | 5534 (when (and (org-mode-p) |
5324 (not (memq state '(overview folded contents)))) | 5535 (not (memq state '(overview folded contents)))) |
5325 (save-excursion | 5536 (save-excursion |
5364 | 5575 |
5365 "^[ \t]*#\\+begin_\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_\\1[ \t]*$" | 5576 "^[ \t]*#\\+begin_\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_\\1[ \t]*$" |
5366 "Regular expression for hiding blocks.") | 5577 "Regular expression for hiding blocks.") |
5367 | 5578 |
5368 (defvar org-hide-block-overlays nil | 5579 (defvar org-hide-block-overlays nil |
5369 "Overays hiding blocks.") | 5580 "Overlays hiding blocks.") |
5370 (make-variable-buffer-local 'org-hide-block-overlays) | 5581 (make-variable-buffer-local 'org-hide-block-overlays) |
5371 | 5582 |
5372 (defun org-block-map (function &optional start end) | 5583 (defun org-block-map (function &optional start end) |
5373 "Call func at the head of all source blocks in the current | 5584 "Call func at the head of all source blocks in the current |
5374 buffer. Optional arguments START and END can be used to limit | 5585 buffer. Optional arguments START and END can be used to limit |
5495 RET=jump to location [Q]uit and return to previous location | 5706 RET=jump to location [Q]uit and return to previous location |
5496 \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") | 5707 \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") |
5497 | 5708 |
5498 (defvar org-goto-start-pos) ; dynamically scoped parameter | 5709 (defvar org-goto-start-pos) ; dynamically scoped parameter |
5499 | 5710 |
5500 ;; FIXME: Docstring doe not mention both interfaces | 5711 ;; FIXME: Docstring does not mention both interfaces |
5501 (defun org-goto (&optional alternative-interface) | 5712 (defun org-goto (&optional alternative-interface) |
5502 "Look up a different location in the current file, keeping current visibility. | 5713 "Look up a different location in the current file, keeping current visibility. |
5503 | 5714 |
5504 When you want look-up or go to a different location in a document, the | 5715 When you want look-up or go to a different location in a document, the |
5505 fastest way is often to fold the entire buffer and then dive into the tree. | 5716 fastest way is often to fold the entire buffer and then dive into the tree. |
5986 (or (equal pos (match-end 1)) (equal pos (match-end 2)))) | 6197 (or (equal pos (match-end 1)) (equal pos (match-end 2)))) |
5987 (cond ((eobp) (insert " ")) | 6198 (cond ((eobp) (insert " ")) |
5988 ((eolp) (insert " ")) | 6199 ((eolp) (insert " ")) |
5989 ((equal (char-after) ?\ ) (forward-char 1)))))) | 6200 ((equal (char-after) ?\ ) (forward-char 1)))))) |
5990 | 6201 |
6202 (defun org-current-level () | |
6203 "Return the level of the current entry, or nil if before the first headline. | |
6204 The level is the number of stars at the beginning of the headline." | |
6205 (save-excursion | |
6206 (condition-case nil | |
6207 (progn | |
6208 (org-back-to-heading t) | |
6209 (funcall outline-level)) | |
6210 (error nil)))) | |
6211 | |
5991 (defun org-reduced-level (l) | 6212 (defun org-reduced-level (l) |
5992 "Compute the effective level of a heading. | 6213 "Compute the effective level of a heading. |
5993 This takes into account the setting of `org-odd-levels-only'." | 6214 This takes into account the setting of `org-odd-levels-only'." |
5994 (if org-odd-levels-only (1+ (floor (/ l 2))) l)) | 6215 (if org-odd-levels-only (1+ (floor (/ l 2))) l)) |
5995 | 6216 |
6037 (replace-match down-head nil t) | 6258 (replace-match down-head nil t) |
6038 ;; Fixup tag positioning | 6259 ;; Fixup tag positioning |
6039 (and org-auto-align-tags (org-set-tags nil t)) | 6260 (and org-auto-align-tags (org-set-tags nil t)) |
6040 (if org-adapt-indentation (org-fixup-indentation diff)) | 6261 (if org-adapt-indentation (org-fixup-indentation diff)) |
6041 (run-hooks 'org-after-demote-entry-hook))) | 6262 (run-hooks 'org-after-demote-entry-hook))) |
6263 | |
6264 (defvar org-tab-ind-state nil) | |
6265 | |
6266 (defun org-cycle-level () | |
6267 (let ((org-adapt-indentation nil)) | |
6268 (when (and (looking-at "[ \t]*$") | |
6269 (looking-back | |
6270 (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp "\\)?[ \t]*"))) | |
6271 (setq this-command 'org-cycle-level) | |
6272 (if (eq last-command 'org-cycle-level) | |
6273 (condition-case nil | |
6274 (progn (org-do-promote) | |
6275 (if (equal org-tab-ind-state (org-current-level)) | |
6276 (org-do-promote))) | |
6277 (error | |
6278 (progn | |
6279 (save-excursion | |
6280 (beginning-of-line 1) | |
6281 (and (looking-at "\\*+") | |
6282 (replace-match | |
6283 (make-string org-tab-ind-state ?*)))) | |
6284 (setq this-command 'org-cycle)))) | |
6285 (setq org-tab-ind-state (- (match-end 1) (match-beginning 1))) | |
6286 (org-do-demote)) | |
6287 t))) | |
6042 | 6288 |
6043 (defun org-map-tree (fun) | 6289 (defun org-map-tree (fun) |
6044 "Call FUN for every heading underneath the current one." | 6290 "Call FUN for every heading underneath the current one." |
6045 (org-back-to-heading) | 6291 (org-back-to-heading) |
6046 (let ((level (funcall outline-level))) | 6292 (let ((level (funcall outline-level))) |
6487 (if (eq shift-what 'week) (setq shift-n (* 7 shift-n) shift-what 'day)) | 6733 (if (eq shift-what 'week) (setq shift-n (* 7 shift-n) shift-what 'day)) |
6488 (setq nmin 1 nmax n) | 6734 (setq nmin 1 nmax n) |
6489 (org-back-to-heading t) | 6735 (org-back-to-heading t) |
6490 (setq beg (point)) | 6736 (setq beg (point)) |
6491 (org-end-of-subtree t t) | 6737 (org-end-of-subtree t t) |
6738 (or (bolp) (insert "\n")) | |
6492 (setq end (point)) | 6739 (setq end (point)) |
6493 (setq template (buffer-substring beg end)) | 6740 (setq template (buffer-substring beg end)) |
6494 (when (and doshift | 6741 (when (and doshift |
6495 (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) | 6742 (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) |
6496 (delete-region beg end) | 6743 (delete-region beg end) |
6563 | 6810 |
6564 n Numerically, by converting the beginning of the entry/item to a number. | 6811 n Numerically, by converting the beginning of the entry/item to a number. |
6565 a Alphabetically, ignoring the TODO keyword and the priority, if any. | 6812 a Alphabetically, ignoring the TODO keyword and the priority, if any. |
6566 t By date/time, either the first active time stamp in the entry, or, if | 6813 t By date/time, either the first active time stamp in the entry, or, if |
6567 none exist, by the first inactive one. | 6814 none exist, by the first inactive one. |
6568 In items, only the first line will be chekced. | 6815 In items, only the first line will be checked. |
6569 s By the scheduled date/time. | 6816 s By the scheduled date/time. |
6570 d By deadline date/time. | 6817 d By deadline date/time. |
6571 c By creation time, which is assumed to be the first inactive time stamp | 6818 c By creation time, which is assumed to be the first inactive time stamp |
6572 at the beginning of a line. | 6819 at the beginning of a line. |
6573 p By priority according to the cookie. | 6820 p By priority according to the cookie. |
7760 (lambda () | 8007 (lambda () |
7761 (setq iswitchb-temp-buflist choices)))) | 8008 (setq iswitchb-temp-buflist choices)))) |
7762 (iswitchb-read-buffer prompt))) | 8009 (iswitchb-read-buffer prompt))) |
7763 | 8010 |
7764 (defun org-icompleting-read (&rest args) | 8011 (defun org-icompleting-read (&rest args) |
7765 "Completing-read using `ido-mode' or `iswitchb' speedups if available" | 8012 "Completing-read using `ido-mode' or `iswitchb' speedups if available." |
7766 (if (and org-completion-use-ido | 8013 (org-without-partial-completion |
7767 (fboundp 'ido-completing-read) | 8014 (if (and org-completion-use-ido |
7768 (boundp 'ido-mode) ido-mode | 8015 (fboundp 'ido-completing-read) |
7769 (listp (second args))) | 8016 (boundp 'ido-mode) ido-mode |
7770 (let ((ido-enter-matching-directory nil)) | 8017 (listp (second args))) |
7771 (apply 'ido-completing-read (concat (car args)) | 8018 (let ((ido-enter-matching-directory nil)) |
7772 (if (consp (car (nth 1 args))) | 8019 (apply 'ido-completing-read (concat (car args)) |
7773 (mapcar (lambda (x) (car x)) (nth 1 args)) | 8020 (if (consp (car (nth 1 args))) |
7774 (nth 1 args)) | 8021 (mapcar (lambda (x) (car x)) (nth 1 args)) |
7775 (cddr args))) | 8022 (nth 1 args)) |
7776 (if (and org-completion-use-iswitchb | 8023 (cddr args))) |
7777 (boundp 'iswitchb-mode) iswitchb-mode | 8024 (if (and org-completion-use-iswitchb |
7778 (listp (second args))) | 8025 (boundp 'iswitchb-mode) iswitchb-mode |
7779 (apply 'org-iswitchb-completing-read (concat (car args)) | 8026 (listp (second args))) |
7780 (mapcar (lambda (x) (car x)) (nth 1 args)) | 8027 (apply 'org-iswitchb-completing-read (concat (car args)) |
7781 (cddr args)) | 8028 (if (consp (car (nth 1 args))) |
7782 (apply 'completing-read args)))) | 8029 (mapcar (lambda (x) (car x)) (nth 1 args)) |
8030 (nth 1 args)) | |
8031 (cddr args)) | |
8032 (apply 'completing-read args))))) | |
7783 | 8033 |
7784 (defun org-extract-attributes (s) | 8034 (defun org-extract-attributes (s) |
7785 "Extract the attributes cookie from a string and set as text property." | 8035 "Extract the attributes cookie from a string and set as text property." |
7786 (let (a attr (start 0) key value) | 8036 (let (a attr (start 0) key value) |
7787 (save-match-data | 8037 (save-match-data |
7879 (setq path (substring path 1))) | 8129 (setq path (substring path 1))) |
7880 ((and (equal type "lisp") (string-match "^/" path)) | 8130 ((and (equal type "lisp") (string-match "^/" path)) |
7881 ;; Planner has a slash, we do not. | 8131 ;; Planner has a slash, we do not. |
7882 (setq type "elisp" path (substring path 1))) | 8132 (setq type "elisp" path (substring path 1))) |
7883 ((string-match "^//\\(.?*\\)/\\(<.*>\\)$" path) | 8133 ((string-match "^//\\(.?*\\)/\\(<.*>\\)$" path) |
7884 ;; A typical message link. Planner has the id after the fina slash, | 8134 ;; A typical message link. Planner has the id after the final slash, |
7885 ;; we separate it with a hash mark | 8135 ;; we separate it with a hash mark |
7886 (setq path (concat (match-string 1 path) "#" | 8136 (setq path (concat (match-string 1 path) "#" |
7887 (org-remove-angle-brackets (match-string 2 path))))) | 8137 (org-remove-angle-brackets (match-string 2 path))))) |
7888 ) | 8138 ) |
7889 (cons type path)) | 8139 (cons type path)) |
7947 (not (org-in-regexp | 8197 (not (org-in-regexp |
7948 (concat org-plain-link-re "\\|" | 8198 (concat org-plain-link-re "\\|" |
7949 org-bracket-link-regexp "\\|" | 8199 org-bracket-link-regexp "\\|" |
7950 org-angle-link-re "\\|" | 8200 org-angle-link-re "\\|" |
7951 "[ \t]:[^ \t\n]+:[ \t]*$")))) | 8201 "[ \t]:[^ \t\n]+:[ \t]*$")))) |
7952 (org-offer-links-in-entry in-emacs)) | 8202 (or (org-offer-links-in-entry in-emacs) |
8203 (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) | |
7953 ((org-at-timestamp-p t) (org-follow-timestamp-link)) | 8204 ((org-at-timestamp-p t) (org-follow-timestamp-link)) |
7954 ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) | 8205 ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) |
7955 (org-footnote-action)) | 8206 (org-footnote-action)) |
7956 (t | 8207 (t |
7957 (let (type path link line search (pos (point))) | 8208 (let (type path link line search (pos (point))) |
8108 (browse-url-at-point))))))) | 8359 (browse-url-at-point))))))) |
8109 (move-marker org-open-link-marker nil) | 8360 (move-marker org-open-link-marker nil) |
8110 (run-hook-with-args 'org-follow-link-hook)) | 8361 (run-hook-with-args 'org-follow-link-hook)) |
8111 | 8362 |
8112 (defun org-offer-links-in-entry (&optional nth zero) | 8363 (defun org-offer-links-in-entry (&optional nth zero) |
8113 "Offer links in the curren entry and follow the selected link. | 8364 "Offer links in the current entry and follow the selected link. |
8114 If there is only one link, follow it immediately as well. | 8365 If there is only one link, follow it immediately as well. |
8115 If NTH is an integer, immediately pick the NTH link found. | 8366 If NTH is an integer, immediately pick the NTH link found. |
8116 If ZERO is a string, check also this string for a link, and if | 8367 If ZERO is a string, check also this string for a link, and if |
8117 there is one, offer it as link number zero." | 8368 there is one, offer it as link number zero." |
8118 (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|" | 8369 (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|" |
8130 (while (re-search-forward re end t) | 8381 (while (re-search-forward re end t) |
8131 (push (match-string 0) links)) | 8382 (push (match-string 0) links)) |
8132 (setq links (org-uniquify (reverse links)))) | 8383 (setq links (org-uniquify (reverse links)))) |
8133 | 8384 |
8134 (cond | 8385 (cond |
8135 ((null links) (error "No links")) | 8386 ((null links) |
8387 (message "No links")) | |
8136 ((equal (length links) 1) | 8388 ((equal (length links) 1) |
8137 (setq link (car links))) | 8389 (setq link (car links))) |
8138 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) | 8390 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) |
8139 (setq link (nth (if have-zero nth (1- nth)) links))) | 8391 (setq link (nth (if have-zero nth (1- nth)) links))) |
8140 (t ; we have to select a link | 8392 (t ; we have to select a link |
8160 (setq nth (- c ?0)) | 8412 (setq nth (- c ?0)) |
8161 (if have-zero (setq nth (1+ nth))) | 8413 (if have-zero (setq nth (1+ nth))) |
8162 (unless (and (integerp nth) (>= (length links) nth)) | 8414 (unless (and (integerp nth) (>= (length links) nth)) |
8163 (error "Invalid link selection")) | 8415 (error "Invalid link selection")) |
8164 (setq link (nth (1- nth) links)))) | 8416 (setq link (nth (1- nth) links)))) |
8165 (org-open-link-from-string link in-emacs (current-buffer)))) | 8417 (if link |
8418 (progn (org-open-link-from-string link in-emacs (current-buffer)) t) | |
8419 nil))) | |
8166 | 8420 |
8167 ;;;; Time estimates | 8421 ;;;; Time estimates |
8168 | 8422 |
8169 (defun org-get-effort (&optional pom) | 8423 (defun org-get-effort (&optional pom) |
8170 "Get the effort estimate for the current entry." | 8424 "Get the effort estimate for the current entry." |
8672 (cdr desc))) | 8926 (cdr desc))) |
8673 "\\}[ \t]"))) | 8927 "\\}[ \t]"))) |
8674 (t (error "Bad refiling target description %s" desc))) | 8928 (t (error "Bad refiling target description %s" desc))) |
8675 (while (setq f (pop files)) | 8929 (while (setq f (pop files)) |
8676 (with-current-buffer | 8930 (with-current-buffer |
8677 (if (bufferp f) f (org-get-agenda-file-buffer f)) | 8931 (if (bufferp f) f (org-get-agenda-file-buffer f)) |
8678 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) | 8932 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) |
8679 (setq f (expand-file-name f)) | 8933 (setq f (expand-file-name f)) |
8680 (if (eq org-refile-use-outline-path 'file) | 8934 (if (eq org-refile-use-outline-path 'file) |
8681 (push (list (file-name-nondirectory f) f nil nil) targets)) | 8935 (push (list (file-name-nondirectory f) f nil nil) targets)) |
8682 (save-excursion | 8936 (save-excursion |
8768 | 9022 |
8769 With prefix arg GOTO, the command will only visit the target location, | 9023 With prefix arg GOTO, the command will only visit the target location, |
8770 not actually move anything. | 9024 not actually move anything. |
8771 With a double prefix `C-u C-u', go to the location where the last refiling | 9025 With a double prefix `C-u C-u', go to the location where the last refiling |
8772 operation has put the subtree. | 9026 operation has put the subtree. |
9027 With a prefix argument of `2', refile to the running clock. | |
8773 | 9028 |
8774 RFLOC can be a refile location obtained in a different way. | 9029 RFLOC can be a refile location obtained in a different way. |
8775 | 9030 |
8776 See also `org-refile-use-outline-path' and `org-completion-use-ido'" | 9031 See also `org-refile-use-outline-path' and `org-completion-use-ido'" |
8777 (interactive "P") | 9032 (interactive "P") |
8789 (unless (org-kill-is-subtree-p | 9044 (unless (org-kill-is-subtree-p |
8790 (buffer-substring region-start region-end)) | 9045 (buffer-substring region-start region-end)) |
8791 (error "The region is not a (sequence of) subtree(s)"))) | 9046 (error "The region is not a (sequence of) subtree(s)"))) |
8792 (if (equal goto '(16)) | 9047 (if (equal goto '(16)) |
8793 (org-refile-goto-last-stored) | 9048 (org-refile-goto-last-stored) |
8794 (when (setq it (or rfloc | 9049 (when (or |
8795 (save-excursion | 9050 (and (equal goto 2) |
8796 (org-refile-get-location | 9051 org-clock-hd-marker (marker-buffer org-clock-hd-marker) |
8797 (if goto "Goto: " "Refile to: ") default-buffer | 9052 (prog1 |
8798 org-refile-allow-creating-parent-nodes)))) | 9053 (setq it (list (or org-clock-heading "running clock") |
9054 (buffer-file-name | |
9055 (marker-buffer org-clock-hd-marker)) | |
9056 "" | |
9057 (marker-position org-clock-hd-marker))) | |
9058 (setq goto nil))) | |
9059 (setq it (or rfloc | |
9060 (save-excursion | |
9061 (org-refile-get-location | |
9062 (if goto "Goto: " "Refile to: ") default-buffer | |
9063 org-refile-allow-creating-parent-nodes))))) | |
8799 (setq file (nth 1 it) | 9064 (setq file (nth 1 it) |
8800 re (nth 2 it) | 9065 re (nth 2 it) |
8801 pos (nth 3 it)) | 9066 pos (nth 3 it)) |
8802 (if (and (not goto) | 9067 (if (and (not goto) |
8803 pos | 9068 pos |
8821 (progn | 9086 (progn |
8822 (org-kill-new (buffer-substring region-start region-end)) | 9087 (org-kill-new (buffer-substring region-start region-end)) |
8823 (org-save-markers-in-region region-start region-end)) | 9088 (org-save-markers-in-region region-start region-end)) |
8824 (org-copy-subtree 1 nil t)) | 9089 (org-copy-subtree 1 nil t)) |
8825 (with-current-buffer (setq nbuf (or (find-buffer-visiting file) | 9090 (with-current-buffer (setq nbuf (or (find-buffer-visiting file) |
8826 (find-file-noselect file))) | 9091 (find-file-noselect file))) |
8827 (setq reversed (org-notes-order-reversed-p)) | 9092 (setq reversed (org-notes-order-reversed-p)) |
8828 (save-excursion | 9093 (save-excursion |
8829 (save-restriction | 9094 (save-restriction |
8830 (widen) | 9095 (widen) |
8831 (if pos | 9096 (if pos |
8990 (if pos (goto-char pos)) | 9255 (if pos (goto-char pos)) |
8991 pos)) | 9256 pos)) |
8992 | 9257 |
8993 (defconst org-dblock-start-re | 9258 (defconst org-dblock-start-re |
8994 "^[ \t]*#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" | 9259 "^[ \t]*#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" |
8995 "Matches the startline of a dynamic block, with parameters.") | 9260 "Matches the start line of a dynamic block, with parameters.") |
8996 | 9261 |
8997 (defconst org-dblock-end-re "^[ \t]*#\\+END\\([: \t\r\n]\\|$\\)" | 9262 (defconst org-dblock-end-re "^[ \t]*#\\+END\\([: \t\r\n]\\|$\\)" |
8998 "Matches the end of a dynamic block.") | 9263 "Matches the end of a dynamic block.") |
8999 | 9264 |
9000 (defun org-create-dblock (plist) | 9265 (defun org-create-dblock (plist) |
9127 "BEGIN_VERSE" "END_VERSE" | 9392 "BEGIN_VERSE" "END_VERSE" |
9128 "BEGIN_CENTER" "END_CENTER" | 9393 "BEGIN_CENTER" "END_CENTER" |
9129 "BEGIN_SRC" "END_SRC" | 9394 "BEGIN_SRC" "END_SRC" |
9130 "CATEGORY" "COLUMNS" | 9395 "CATEGORY" "COLUMNS" |
9131 "CAPTION" "LABEL" | 9396 "CAPTION" "LABEL" |
9397 "SETUPFILE" | |
9132 "BIND" | 9398 "BIND" |
9133 "MACRO")) | 9399 "MACRO")) |
9134 | 9400 |
9135 (defcustom org-structure-template-alist | 9401 (defcustom org-structure-template-alist |
9136 '( | 9402 '( |
9410 DONE are present, add TODO at the beginning of the heading. | 9676 DONE are present, add TODO at the beginning of the heading. |
9411 | 9677 |
9412 With C-u prefix arg, use completion to determine the new state. | 9678 With C-u prefix arg, use completion to determine the new state. |
9413 With numeric prefix arg, switch to that state. | 9679 With numeric prefix arg, switch to that state. |
9414 With a double C-u prefix, switch to the next set of TODO keywords (nextset). | 9680 With a double C-u prefix, switch to the next set of TODO keywords (nextset). |
9415 With a tripple C-u prefix, circumvent any state blocking. | 9681 With a triple C-u prefix, circumvent any state blocking. |
9416 | 9682 |
9417 For calling through lisp, arg is also interpreted in the following way: | 9683 For calling through lisp, arg is also interpreted in the following way: |
9418 'none -> empty state | 9684 'none -> empty state |
9419 \"\"(empty string) -> switch to empty state | 9685 \"\"(empty string) -> switch to empty state |
9420 'done -> switch to DONE | 9686 'done -> switch to DONE |
9432 (or org-inhibit-blocking | 9698 (or org-inhibit-blocking |
9433 (org-entry-get nil "NOBLOCKING"))) | 9699 (org-entry-get nil "NOBLOCKING"))) |
9434 (setq org-blocker-hook nil)) | 9700 (setq org-blocker-hook nil)) |
9435 (save-excursion | 9701 (save-excursion |
9436 (catch 'exit | 9702 (catch 'exit |
9437 (org-back-to-heading) | 9703 (org-back-to-heading t) |
9438 (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) | 9704 (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) |
9439 (or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)")) | 9705 (or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)")) |
9440 (looking-at " *")) | 9706 (looking-at " *")) |
9441 (let* ((match-data (match-data)) | 9707 (let* ((match-data (match-data)) |
9442 (startpos (point-at-bol)) | 9708 (startpos (point-at-bol)) |
9498 ((eq arg 'previousset) | 9764 ((eq arg 'previousset) |
9499 (let ((org-todo-heads (reverse org-todo-heads))) | 9765 (let ((org-todo-heads (reverse org-todo-heads))) |
9500 (or (car (cdr (member head org-todo-heads))) | 9766 (or (car (cdr (member head org-todo-heads))) |
9501 (car org-todo-heads)))) | 9767 (car org-todo-heads)))) |
9502 ((car (member arg org-todo-keywords-1))) | 9768 ((car (member arg org-todo-keywords-1))) |
9769 ((stringp arg) | |
9770 (error "State `%s' not valid in this file" arg)) | |
9503 ((nth (1- (prefix-numeric-value arg)) | 9771 ((nth (1- (prefix-numeric-value arg)) |
9504 org-todo-keywords-1)))) | 9772 org-todo-keywords-1)))) |
9505 ((null member) (or head (car org-todo-keywords-1))) | 9773 ((null member) (or head (car org-todo-keywords-1))) |
9506 ((equal this final-done-word) nil) ;; -> make empty | 9774 ((equal this final-done-word) nil) ;; -> make empty |
9507 ((null tail) nil) ;; -> first entry | 9775 ((null tail) nil) ;; -> first entry |
9625 ;; do not block | 9893 ;; do not block |
9626 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) | 9894 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) |
9627 (member (plist-get change-plist :from) | 9895 (member (plist-get change-plist :from) |
9628 (cons 'done org-done-keywords)) | 9896 (cons 'done org-done-keywords)) |
9629 (member (plist-get change-plist :to) | 9897 (member (plist-get change-plist :to) |
9630 (cons 'todo org-not-done-keywords))) | 9898 (cons 'todo org-not-done-keywords)) |
9899 (not (plist-get change-plist :to))) | |
9631 (throw 'dont-block t)) | 9900 (throw 'dont-block t)) |
9632 ;; If this task has children, and any are undone, it's blocked | 9901 ;; If this task has children, and any are undone, it's blocked |
9633 (save-excursion | 9902 (save-excursion |
9634 (org-back-to-heading t) | 9903 (org-back-to-heading t) |
9635 (let ((this-level (funcall outline-level))) | 9904 (let ((this-level (funcall outline-level))) |
9707 | 9976 |
9708 (defvar org-blocked-by-checkboxes) ; dynamically scoped | 9977 (defvar org-blocked-by-checkboxes) ; dynamically scoped |
9709 (defun org-block-todo-from-checkboxes (change-plist) | 9978 (defun org-block-todo-from-checkboxes (change-plist) |
9710 "Block turning an entry into a TODO, using checkboxes. | 9979 "Block turning an entry into a TODO, using checkboxes. |
9711 This checks whether the current task should be blocked from state | 9980 This checks whether the current task should be blocked from state |
9712 changes because there are uncheckd boxes in this entry." | 9981 changes because there are unchecked boxes in this entry." |
9713 (catch 'dont-block | 9982 (catch 'dont-block |
9714 ;; If this is not a todo state change, or if this entry is already DONE, | 9983 ;; If this is not a todo state change, or if this entry is already DONE, |
9715 ;; do not block | 9984 ;; do not block |
9716 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) | 9985 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) |
9717 (member (plist-get change-plist :from) | 9986 (member (plist-get change-plist :from) |
9718 (cons 'done org-done-keywords)) | 9987 (cons 'done org-done-keywords)) |
9719 (member (plist-get change-plist :to) | 9988 (member (plist-get change-plist :to) |
9720 (cons 'todo org-not-done-keywords))) | 9989 (cons 'todo org-not-done-keywords)) |
9990 (not (plist-get change-plist :to))) | |
9721 (throw 'dont-block t)) | 9991 (throw 'dont-block t)) |
9722 ;; If this task has checkboxes that are not checked, it's blocked | 9992 ;; If this task has checkboxes that are not checked, it's blocked |
9723 (save-excursion | 9993 (save-excursion |
9724 (org-back-to-heading t) | 9994 (org-back-to-heading t) |
9725 (let ((beg (point)) end) | 9995 (let ((beg (point)) end) |
9794 (setq ltoggle (funcall outline-level)) | 10064 (setq ltoggle (funcall outline-level)) |
9795 (error "This should not happen")) | 10065 (error "This should not happen")) |
9796 (while (and (setq level (org-up-heading-safe)) | 10066 (while (and (setq level (org-up-heading-safe)) |
9797 (or recursive first) | 10067 (or recursive first) |
9798 (>= (point) lim)) | 10068 (>= (point) lim)) |
9799 (setq first nil) | 10069 (setq first nil cookie-present nil) |
9800 (unless (and level | 10070 (unless (and level |
9801 (not (string-match | 10071 (not (string-match |
9802 "\\<checkbox\\>" | 10072 "\\<checkbox\\>" |
9803 (downcase | 10073 (downcase |
9804 (or (org-entry-get | 10074 (or (org-entry-get |
9829 (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all))) | 10099 (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all))) |
9830 (format "[%d/%d]" cnt-done cnt-all)) | 10100 (format "[%d/%d]" cnt-done cnt-all)) |
9831 ndel (- (match-end 0) (match-beginning 0))) | 10101 ndel (- (match-end 0) (match-beginning 0))) |
9832 (goto-char (match-beginning 0)) | 10102 (goto-char (match-beginning 0)) |
9833 (insert new) | 10103 (insert new) |
9834 (delete-region (point) (+ (point) ndel)))) | 10104 (delete-region (point) (+ (point) ndel))) |
9835 (when cookie-present | 10105 (when cookie-present |
9836 (run-hook-with-args 'org-after-todo-statistics-hook | 10106 (run-hook-with-args 'org-after-todo-statistics-hook |
9837 cnt-done (- cnt-all cnt-done))))) | 10107 cnt-done (- cnt-all cnt-done)))))) |
9838 (run-hooks 'org-todo-statistics-hook))) | 10108 (run-hooks 'org-todo-statistics-hook))) |
9839 | 10109 |
9840 (defvar org-after-todo-statistics-hook nil | 10110 (defvar org-after-todo-statistics-hook nil |
9841 "Hook that is called after a TODO statistics cookie has been updated. | 10111 "Hook that is called after a TODO statistics cookie has been updated. |
9842 Each function is called with two arguments: the number of not-done entries | 10112 Each function is called with two arguments: the number of not-done entries |
9853 (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\")))) | 10123 (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\")))) |
9854 ") | 10124 ") |
9855 | 10125 |
9856 (defvar org-todo-statistics-hook nil | 10126 (defvar org-todo-statistics-hook nil |
9857 "Hook that is run whenever Org thinks TODO statistics should be updated. | 10127 "Hook that is run whenever Org thinks TODO statistics should be updated. |
9858 This hook runs even if there is no statisics cookie present, in which case | 10128 This hook runs even if there is no statistics cookie present, in which case |
9859 `org-after-todo-statistics-hook' would not run.") | 10129 `org-after-todo-statistics-hook' would not run.") |
9860 | 10130 |
9861 (defun org-todo-trigger-tag-changes (state) | 10131 (defun org-todo-trigger-tag-changes (state) |
9862 "Apply the changes defined in `org-todo-state-tags-triggers'." | 10132 "Apply the changes defined in `org-todo-state-tags-triggers'." |
9863 (let ((l org-todo-state-tags-triggers) | 10133 (let ((l org-todo-state-tags-triggers) |
10002 (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) | 10272 (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) |
10003 (>= (match-end 0) pos) | 10273 (>= (match-end 0) pos) |
10004 (throw 'exit t))) | 10274 (throw 'exit t))) |
10005 nil))) | 10275 nil))) |
10006 | 10276 |
10007 (defun org-get-repeat () | 10277 (defun org-get-repeat (&optional tagline) |
10008 "Check if there is a deadline/schedule with repeater in this entry." | 10278 "Check if there is a deadline/schedule with repeater in this entry." |
10009 (save-match-data | 10279 (save-match-data |
10010 (save-excursion | 10280 (save-excursion |
10011 (org-back-to-heading t) | 10281 (org-back-to-heading t) |
10012 (if (re-search-forward | 10282 (and (re-search-forward (if tagline |
10013 org-repeat-re (save-excursion (outline-next-heading) (point)) t) | 10283 (concat tagline "\\s-*" org-repeat-re) |
10014 (match-string 1))))) | 10284 org-repeat-re) |
10285 (org-entry-end-position) t) | |
10286 (match-string-no-properties 1))))) | |
10015 | 10287 |
10016 (defvar org-last-changed-timestamp) | 10288 (defvar org-last-changed-timestamp) |
10017 (defvar org-last-inserted-timestamp) | 10289 (defvar org-last-inserted-timestamp) |
10018 (defvar org-log-post-message) | 10290 (defvar org-log-post-message) |
10019 (defvar org-log-note-purpose) | 10291 (defvar org-log-note-purpose) |
10122 "Insert the \"DEADLINE:\" string with a timestamp to make a deadline. | 10394 "Insert the \"DEADLINE:\" string with a timestamp to make a deadline. |
10123 With argument REMOVE, remove any deadline from the item. | 10395 With argument REMOVE, remove any deadline from the item. |
10124 When TIME is set, it should be an internal time specification, and the | 10396 When TIME is set, it should be an internal time specification, and the |
10125 scheduling will use the corresponding date." | 10397 scheduling will use the corresponding date." |
10126 (interactive "P") | 10398 (interactive "P") |
10127 (if remove | 10399 (let ((old-date (org-entry-get nil "DEADLINE"))) |
10128 (progn | 10400 (if remove |
10129 (org-remove-timestamp-with-keyword org-deadline-string) | 10401 (progn |
10130 (message "Item no longer has a deadline.")) | 10402 (org-remove-timestamp-with-keyword org-deadline-string) |
10131 (if (org-get-repeat) | 10403 (message "Item no longer has a deadline.")) |
10132 (error "Cannot change deadline on task with repeater, please do that by hand") | 10404 (if (org-get-repeat) |
10133 (org-add-planning-info 'deadline time 'closed) | 10405 (error "Cannot change deadline on task with repeater, please do that by hand") |
10134 (message "Deadline on %s" org-last-inserted-timestamp)))) | 10406 (org-add-planning-info 'deadline time 'closed) |
10135 | 10407 (when (and old-date org-log-redeadline |
10408 (not (equal old-date | |
10409 (substring org-last-inserted-timestamp 1 -1)))) | |
10410 (org-add-log-setup 'redeadline nil old-date 'findpos | |
10411 org-log-redeadline)) | |
10412 (message "Deadline on %s" org-last-inserted-timestamp))))) | |
10413 | |
10136 (defun org-schedule (&optional remove time) | 10414 (defun org-schedule (&optional remove time) |
10137 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. | 10415 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. |
10138 With argument REMOVE, remove any scheduling date from the item. | 10416 With argument REMOVE, remove any scheduling date from the item. |
10139 When TIME is set, it should be an internal time specification, and the | 10417 When TIME is set, it should be an internal time specification, and the |
10140 scheduling will use the corresponding date." | 10418 scheduling will use the corresponding date." |
10141 (interactive "P") | 10419 (interactive "P") |
10142 (if remove | 10420 (let ((old-date (org-entry-get nil "SCHEDULED"))) |
10143 (progn | 10421 (if remove |
10144 (org-remove-timestamp-with-keyword org-scheduled-string) | 10422 (progn |
10145 (message "Item is no longer scheduled.")) | 10423 (org-remove-timestamp-with-keyword org-scheduled-string) |
10146 (if (org-get-repeat) | 10424 (message "Item is no longer scheduled.")) |
10147 (error "Cannot reschedule task with repeater, please do that by hand") | 10425 (if (org-get-repeat) |
10148 (org-add-planning-info 'scheduled time 'closed) | 10426 (error "Cannot reschedule task with repeater, please do that by hand") |
10149 (message "Scheduled to %s" org-last-inserted-timestamp)))) | 10427 (org-add-planning-info 'scheduled time 'closed) |
10428 (when (and old-date org-log-reschedule | |
10429 (not (equal old-date | |
10430 (substring org-last-inserted-timestamp 1 -1)))) | |
10431 (org-add-log-setup 'reschedule nil old-date 'findpos | |
10432 org-log-reschedule)) | |
10433 (message "Scheduled to %s" org-last-inserted-timestamp))))) | |
10150 | 10434 |
10151 (defun org-get-scheduled-time (pom &optional inherit) | 10435 (defun org-get-scheduled-time (pom &optional inherit) |
10152 "Get the scheduled time as a time tuple, of a format suitable | 10436 "Get the scheduled time as a time tuple, of a format suitable |
10153 for calling org-schedule with, or if there is no scheduling, | 10437 for calling org-schedule with, or if there is no scheduling, |
10154 returns nil." | 10438 returns nil." |
10156 (when time | 10440 (when time |
10157 (apply 'encode-time (org-parse-time-string time))))) | 10441 (apply 'encode-time (org-parse-time-string time))))) |
10158 | 10442 |
10159 (defun org-get-deadline-time (pom &optional inherit) | 10443 (defun org-get-deadline-time (pom &optional inherit) |
10160 "Get the deadine as a time tuple, of a format suitable for | 10444 "Get the deadine as a time tuple, of a format suitable for |
10161 calling org-deadlin with, or if there is no scheduling, returns | 10445 calling org-deadline with, or if there is no scheduling, returns |
10162 nil." | 10446 nil." |
10163 (let ((time (org-entry-get pom "DEADLINE" inherit))) | 10447 (let ((time (org-entry-get pom "DEADLINE" inherit))) |
10164 (when time | 10448 (when time |
10165 (apply 'encode-time (org-parse-time-string time))))) | 10449 (apply 'encode-time (org-parse-time-string time))))) |
10166 | 10450 |
10256 (replace-match "") | 10540 (replace-match "") |
10257 (if (looking-at "--+<[^>]+>") (replace-match "")) | 10541 (if (looking-at "--+<[^>]+>") (replace-match "")) |
10258 (skip-chars-backward " ") | 10542 (skip-chars-backward " ") |
10259 (if (looking-at " +") (replace-match "")))) | 10543 (if (looking-at " +") (replace-match "")))) |
10260 (goto-char (point-max)) | 10544 (goto-char (point-max)) |
10545 (and org-adapt-indentation (bolp) (org-indent-to-column col)) | |
10261 (when what | 10546 (when what |
10262 (insert | 10547 (insert |
10263 (if (not (or (bolp) (eq (char-before) ?\ ))) " " "") | 10548 (if (not (or (bolp) (eq (char-before) ?\ ))) " " "") |
10264 (cond ((eq what 'scheduled) org-scheduled-string) | 10549 (cond ((eq what 'scheduled) org-scheduled-string) |
10265 ((eq what 'deadline) org-deadline-string) | 10550 ((eq what 'deadline) org-deadline-string) |
10385 ((eq org-log-note-purpose 'done) "closed todo item") | 10670 ((eq org-log-note-purpose 'done) "closed todo item") |
10386 ((eq org-log-note-purpose 'state) | 10671 ((eq org-log-note-purpose 'state) |
10387 (format "state change from \"%s\" to \"%s\"" | 10672 (format "state change from \"%s\" to \"%s\"" |
10388 (or org-log-note-previous-state "") | 10673 (or org-log-note-previous-state "") |
10389 (or org-log-note-state ""))) | 10674 (or org-log-note-state ""))) |
10675 ((eq org-log-note-purpose 'reschedule) | |
10676 "rescheduling") | |
10677 ((eq org-log-note-purpose 'redeadline) | |
10678 "changing deadline") | |
10390 ((eq org-log-note-purpose 'note) | 10679 ((eq org-log-note-purpose 'note) |
10391 "this entry") | 10680 "this entry") |
10392 (t (error "This should not happen"))))) | 10681 (t (error "This should not happen"))))) |
10393 (if org-log-note-extra (insert org-log-note-extra)) | 10682 (if org-log-note-extra (insert org-log-note-extra)) |
10394 (org-set-local 'org-finish-function 'org-store-log-note))) | 10683 (org-set-local 'org-finish-function 'org-store-log-note))) |
10450 (goto-char org-log-note-return-to)) | 10739 (goto-char org-log-note-return-to)) |
10451 (move-marker org-log-note-return-to nil) | 10740 (move-marker org-log-note-return-to nil) |
10452 (and org-log-post-message (message "%s" org-log-post-message))) | 10741 (and org-log-post-message (message "%s" org-log-post-message))) |
10453 | 10742 |
10454 (defun org-remove-empty-drawer-at (drawer pos) | 10743 (defun org-remove-empty-drawer-at (drawer pos) |
10455 "Remove an emptyr DARWER drawer at position POS. | 10744 "Remove an empty drawer DRAWER at position POS. |
10456 POS may also be a marker." | 10745 POS may also be a marker." |
10457 (with-current-buffer (if (markerp pos) (marker-buffer pos) (current-buffer)) | 10746 (with-current-buffer (if (markerp pos) (marker-buffer pos) (current-buffer)) |
10458 (save-excursion | 10747 (save-excursion |
10459 (save-restriction | 10748 (save-restriction |
10460 (widen) | 10749 (widen) |
10470 | 10759 |
10471 t Show entries with a specific TODO keyword. | 10760 t Show entries with a specific TODO keyword. |
10472 m Show entries selected by a tags/property match. | 10761 m Show entries selected by a tags/property match. |
10473 p Enter a property name and its value (both with completion on existing | 10762 p Enter a property name and its value (both with completion on existing |
10474 names/values) and show entries with that property. | 10763 names/values) and show entries with that property. |
10475 r Show entries matching a regular expression. | 10764 / Show entries matching a regular expression (`r' can be used as well) |
10476 d Show deadlines due within `org-deadline-warning-days'. | 10765 d Show deadlines due within `org-deadline-warning-days'. |
10477 b Show deadlines and scheduled items before a date. | 10766 b Show deadlines and scheduled items before a date. |
10478 a Show deadlines and scheduled items after a date." | 10767 a Show deadlines and scheduled items after a date." |
10479 (interactive "P") | 10768 (interactive "P") |
10480 (let (ans kwd value) | 10769 (let (ans kwd value) |
10654 (if (looking-at org-priority-regexp) | 10943 (if (looking-at org-priority-regexp) |
10655 (setq current (string-to-char (match-string 2)) | 10944 (setq current (string-to-char (match-string 2)) |
10656 have t) | 10945 have t) |
10657 (setq current org-default-priority)) | 10946 (setq current org-default-priority)) |
10658 (cond | 10947 (cond |
10948 ((eq action 'remove) | |
10949 (setq remove t new ?\ )) | |
10659 ((or (eq action 'set) | 10950 ((or (eq action 'set) |
10660 (if (featurep 'xemacs) (characterp action) (integerp action))) | 10951 (if (featurep 'xemacs) (characterp action) (integerp action))) |
10661 (if (not (eq action 'set)) | 10952 (if (not (eq action 'set)) |
10662 (setq new action) | 10953 (setq new action) |
10663 (message "Priority %c-%c, SPC to remove: " | 10954 (message "Priority %c-%c, SPC to remove: " |
10715 ;;;; Tags | 11006 ;;;; Tags |
10716 | 11007 |
10717 (defvar org-agenda-archives-mode) | 11008 (defvar org-agenda-archives-mode) |
10718 (defvar org-map-continue-from nil | 11009 (defvar org-map-continue-from nil |
10719 "Position from where mapping should continue. | 11010 "Position from where mapping should continue. |
10720 Can be set byt the action argument to `org-scan-tag's and `org-map-entries'.") | 11011 Can be set by the action argument to `org-scan-tag's and `org-map-entries'.") |
10721 | 11012 |
10722 (defvar org-scanner-tags nil | 11013 (defvar org-scanner-tags nil |
10723 "The current tag list while the tags scanner is running.") | 11014 "The current tag list while the tags scanner is running.") |
10724 (defvar org-trust-scanner-tags nil | 11015 (defvar org-trust-scanner-tags nil |
10725 "Should `org-get-tags-at' use the tags fro the scanner. | 11016 "Should `org-get-tags-at' use the tags fro the scanner. |
10752 'done-face 'org-agenda-done | 11043 'done-face 'org-agenda-done |
10753 'undone-face 'default | 11044 'undone-face 'default |
10754 'mouse-face 'highlight | 11045 'mouse-face 'highlight |
10755 'org-not-done-regexp org-not-done-regexp | 11046 'org-not-done-regexp org-not-done-regexp |
10756 'org-todo-regexp org-todo-regexp | 11047 'org-todo-regexp org-todo-regexp |
10757 'keymap org-agenda-keymap | |
10758 'help-echo | 11048 'help-echo |
10759 (format "mouse-2 or RET jump to org file %s" | 11049 (format "mouse-2 or RET jump to org file %s" |
10760 (abbreviate-file-name | 11050 (abbreviate-file-name |
10761 (or (buffer-file-name (buffer-base-buffer)) | 11051 (or (buffer-file-name (buffer-base-buffer)) |
10762 (buffer-name (buffer-base-buffer))))))) | 11052 (buffer-name (buffer-base-buffer))))))) |
11495 (org-fast-tag-show-exit exit-after-next) | 11785 (org-fast-tag-show-exit exit-after-next) |
11496 (org-set-current-tags-overlay current ov-prefix) | 11786 (org-set-current-tags-overlay current ov-prefix) |
11497 (setq tbl fulltable char ?a cnt 0) | 11787 (setq tbl fulltable char ?a cnt 0) |
11498 (while (setq e (pop tbl)) | 11788 (while (setq e (pop tbl)) |
11499 (cond | 11789 (cond |
11500 ((equal e '(:startgroup)) | 11790 ((equal (car e) :startgroup) |
11501 (push '() groups) (setq ingroup t) | 11791 (push '() groups) (setq ingroup t) |
11502 (when (not (= cnt 0)) | 11792 (when (not (= cnt 0)) |
11503 (setq cnt 0) | 11793 (setq cnt 0) |
11504 (insert "\n")) | 11794 (insert "\n")) |
11505 (insert "{ ")) | 11795 (insert (if (cdr e) (format "%s: " (cdr e)) "") "{ ")) |
11506 ((equal e '(:endgroup)) | 11796 ((equal (car e) :endgroup) |
11507 (setq ingroup nil cnt 0) | 11797 (setq ingroup nil cnt 0) |
11508 (insert "}\n")) | 11798 (insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n")) |
11509 ((equal e '(:newline)) | 11799 ((equal e '(:newline)) |
11510 (when (not (= cnt 0)) | 11800 (when (not (= cnt 0)) |
11511 (setq cnt 0) | 11801 (setq cnt 0) |
11512 (insert "\n") | 11802 (insert "\n") |
11513 (setq e (car tbl)) | 11803 (setq e (car tbl)) |
11548 (goto-char (point-min)) | 11838 (goto-char (point-min)) |
11549 (if (not expert) (org-fit-window-to-buffer)) | 11839 (if (not expert) (org-fit-window-to-buffer)) |
11550 (setq rtn | 11840 (setq rtn |
11551 (catch 'exit | 11841 (catch 'exit |
11552 (while t | 11842 (while t |
11553 (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free%s%s" | 11843 (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free [!] %sgroups%s" |
11554 (if groups " [!] no groups" " [!]groups") | 11844 (if (not groups) "no " "") |
11555 (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) | 11845 (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) |
11556 (setq c (let ((inhibit-quit t)) (read-char-exclusive))) | 11846 (setq c (let ((inhibit-quit t)) (read-char-exclusive))) |
11557 (cond | 11847 (cond |
11558 ((= c ?\r) (throw 'exit t)) | 11848 ((= c ?\r) (throw 'exit t)) |
11559 ((= c ?!) | 11849 ((= c ?!) |
11654 (while (re-search-forward | 11944 (while (re-search-forward |
11655 (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) | 11945 (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) |
11656 (when (equal (char-after (point-at-bol 0)) ?*) | 11946 (when (equal (char-after (point-at-bol 0)) ?*) |
11657 (mapc (lambda (x) (add-to-list 'tags x)) | 11947 (mapc (lambda (x) (add-to-list 'tags x)) |
11658 (org-split-string (org-match-string-no-properties 1) ":"))))) | 11948 (org-split-string (org-match-string-no-properties 1) ":"))))) |
11949 (mapc (lambda (s) (add-to-list 'tags s)) org-file-tags) | |
11659 (mapcar 'list tags))) | 11950 (mapcar 'list tags))) |
11660 | 11951 |
11661 ;;;; The mapping API | 11952 ;;;; The mapping API |
11662 | 11953 |
11663 ;;;###autoload | 11954 ;;;###autoload |
11786 '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID" | 12077 '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID" |
11787 "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" | 12078 "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" |
11788 "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" | 12079 "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" |
11789 "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" | 12080 "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" |
11790 "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" | 12081 "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" |
11791 "CLOCK_MODELINE_TOTAL") | 12082 "CLOCK_MODELINE_TOTAL" "STYLE") |
11792 "Some properties that are used by Org-mode for various purposes. | 12083 "Some properties that are used by Org-mode for various purposes. |
11793 Being in this list makes sure that they are offered for completion.") | 12084 Being in this list makes sure that they are offered for completion.") |
11794 | 12085 |
11795 (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$" | 12086 (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$" |
11796 "Regular expression matching the first line of a property drawer.") | 12087 "Regular expression matching the first line of a property drawer.") |
11841 (let* ((completion-ignore-case t) | 12132 (let* ((completion-ignore-case t) |
11842 (prop org-effort-property) | 12133 (prop org-effort-property) |
11843 (cur (org-entry-get nil prop)) | 12134 (cur (org-entry-get nil prop)) |
11844 (allowed (org-property-get-allowed-values nil prop 'table)) | 12135 (allowed (org-property-get-allowed-values nil prop 'table)) |
11845 (existing (mapcar 'list (org-property-values prop))) | 12136 (existing (mapcar 'list (org-property-values prop))) |
12137 rpl | |
11846 (val (cond | 12138 (val (cond |
11847 ((stringp value) value) | 12139 ((stringp value) value) |
11848 ((and allowed (integerp value)) | 12140 ((and allowed (integerp value)) |
11849 (or (car (nth (1- value) allowed)) | 12141 (or (car (nth (1- value) allowed)) |
11850 (car (org-last allowed)))) | 12142 (car (org-last allowed)))) |
11851 (allowed | 12143 (allowed |
11852 (org-completing-read "Value: " allowed nil 'req-match)) | 12144 (message "Select 1-9,0, [RET%s]: %s" |
12145 (if cur (concat "=" cur) "") | |
12146 (mapconcat 'car allowed " ")) | |
12147 (setq rpl (read-char-exclusive)) | |
12148 (if (equal rpl ?\r) | |
12149 cur | |
12150 (setq rpl (- rpl ?0)) | |
12151 (if (equal rpl 0) (setq rpl 10)) | |
12152 (if (and (> rpl 0) (<= rpl (length allowed))) | |
12153 (car (nth (1- rpl) allowed)) | |
12154 (org-completing-read "Value: " allowed nil)))) | |
11853 (t | 12155 (t |
11854 (let (org-completion-use-ido org-completion-use-iswitchb) | 12156 (let (org-completion-use-ido org-completion-use-iswitchb) |
11855 (org-completing-read | 12157 (org-completing-read |
11856 (concat "Value " (if (and cur (string-match "\\S-" cur)) | 12158 (concat "Value " (if (and cur (string-match "\\S-" cur)) |
11857 (concat "[" cur "]") "") | 12159 (concat "[" cur "]") "") |
12697 (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) | 12999 (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) |
12698 | 13000 |
12699 (defvar def) | 13001 (defvar def) |
12700 (defvar defdecode) | 13002 (defvar defdecode) |
12701 (defvar with-time) | 13003 (defvar with-time) |
13004 (defvar org-read-date-analyze-futurep nil) | |
12702 (defun org-read-date-display () | 13005 (defun org-read-date-display () |
12703 "Display the current date prompt interpretation in the minibuffer." | 13006 "Display the current date prompt interpretation in the minibuffer." |
12704 (when org-read-date-display-live | 13007 (when org-read-date-display-live |
12705 (when org-read-date-overlay | 13008 (when org-read-date-overlay |
12706 (org-delete-overlay org-read-date-overlay)) | 13009 (org-delete-overlay org-read-date-overlay)) |
12726 (when (and org-end-time-was-given | 13029 (when (and org-end-time-was-given |
12727 (string-match org-plain-time-of-day-regexp txt)) | 13030 (string-match org-plain-time-of-day-regexp txt)) |
12728 (setq txt (concat (substring txt 0 (match-end 0)) "-" | 13031 (setq txt (concat (substring txt 0 (match-end 0)) "-" |
12729 org-end-time-was-given | 13032 org-end-time-was-given |
12730 (substring txt (match-end 0))))) | 13033 (substring txt (match-end 0))))) |
13034 (when org-read-date-analyze-futurep | |
13035 (setq txt (concat txt " (=>F)"))) | |
12731 (setq org-read-date-overlay | 13036 (setq org-read-date-overlay |
12732 (org-make-overlay (1- (point-at-eol)) (point-at-eol))) | 13037 (org-make-overlay (1- (point-at-eol)) (point-at-eol))) |
12733 (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) | 13038 (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) |
12734 | 13039 |
12735 (defun org-read-date-analyze (ans def defdecode) | 13040 (defun org-read-date-analyze (ans def defdecode) |
12736 "Analyse the combined answer of the date prompt." | 13041 "Analyse the combined answer of the date prompt." |
12737 ;; FIXME: cleanup and comment | 13042 ;; FIXME: cleanup and comment |
12738 (let (delta deltan deltaw deltadef year month day | 13043 (let (delta deltan deltaw deltadef year month day |
12739 hour minute second wday pm h2 m2 tl wday1 | 13044 hour minute second wday pm h2 m2 tl wday1 |
12740 iso-year iso-weekday iso-week iso-year iso-date) | 13045 iso-year iso-weekday iso-week iso-year iso-date futurep) |
12741 | 13046 (setq org-read-date-analyze-futurep nil) |
12742 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) | 13047 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) |
12743 (setq ans "+0")) | 13048 (setq ans "+0")) |
12744 | 13049 |
12745 (when (setq delta (org-read-date-get-relative ans (current-time) def)) | 13050 (when (setq delta (org-read-date-get-relative ans (current-time) def)) |
12746 (setq ans (replace-match "" t t ans) | 13051 (setq ans (replace-match "" t t ans) |
12809 (setq tl (parse-time-string ans) | 13114 (setq tl (parse-time-string ans) |
12810 day (or (nth 3 tl) (nth 3 defdecode)) | 13115 day (or (nth 3 tl) (nth 3 defdecode)) |
12811 month (or (nth 4 tl) | 13116 month (or (nth 4 tl) |
12812 (if (and org-read-date-prefer-future | 13117 (if (and org-read-date-prefer-future |
12813 (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) | 13118 (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) |
12814 (1+ (nth 4 defdecode)) | 13119 (prog1 (1+ (nth 4 defdecode)) (setq futurep t)) |
12815 (nth 4 defdecode))) | 13120 (nth 4 defdecode))) |
12816 year (or (nth 5 tl) | 13121 year (or (nth 5 tl) |
12817 (if (and org-read-date-prefer-future | 13122 (if (and org-read-date-prefer-future |
12818 (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) | 13123 (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) |
12819 (1+ (nth 5 defdecode)) | 13124 (prog1 (1+ (nth 5 defdecode)) (setq futurep t)) |
12820 (nth 5 defdecode))) | 13125 (nth 5 defdecode))) |
12821 hour (or (nth 2 tl) (nth 2 defdecode)) | 13126 hour (or (nth 2 tl) (nth 2 defdecode)) |
12822 minute (or (nth 1 tl) (nth 1 defdecode)) | 13127 minute (or (nth 1 tl) (nth 1 defdecode)) |
12823 second (or (nth 0 tl) 0) | 13128 second (or (nth 0 tl) 0) |
12824 wday (nth 6 tl)) | 13129 wday (nth 6 tl)) |
12825 | 13130 |
13131 (when (and (eq org-read-date-prefer-future 'time) | |
13132 (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl)) | |
13133 (equal day (nth 3 defdecode)) | |
13134 (equal month (nth 4 defdecode)) | |
13135 (equal year (nth 5 defdecode)) | |
13136 (nth 2 tl) | |
13137 (or (< (nth 2 tl) (nth 2 defdecode)) | |
13138 (and (= (nth 2 tl) (nth 2 defdecode)) | |
13139 (nth 1 tl) | |
13140 (< (nth 1 tl) (nth 1 defdecode))))) | |
13141 (setq day (1+ day) | |
13142 futurep t)) | |
13143 | |
12826 ;; Special date definitions below | 13144 ;; Special date definitions below |
12827 (cond | 13145 (cond |
12828 (iso-week | 13146 (iso-week |
12829 ;; There was an iso week | 13147 ;; There was an iso week |
13148 (setq futurep nil) | |
12830 (setq year (or iso-year year) | 13149 (setq year (or iso-year year) |
12831 day (or iso-weekday wday 1) | 13150 day (or iso-weekday wday 1) |
12832 wday nil ; to make sure that the trigger below does not match | 13151 wday nil ; to make sure that the trigger below does not match |
12833 iso-date (calendar-gregorian-from-absolute | 13152 iso-date (calendar-gregorian-from-absolute |
12834 (calendar-absolute-from-iso | 13153 (calendar-absolute-from-iso |
12844 ; (list iso-week day year))))) | 13163 ; (list iso-week day year))))) |
12845 (setq month (car iso-date) | 13164 (setq month (car iso-date) |
12846 year (nth 2 iso-date) | 13165 year (nth 2 iso-date) |
12847 day (nth 1 iso-date))) | 13166 day (nth 1 iso-date))) |
12848 (deltan | 13167 (deltan |
13168 (setq futurep nil) | |
12849 (unless deltadef | 13169 (unless deltadef |
12850 (let ((now (decode-time (current-time)))) | 13170 (let ((now (decode-time (current-time)))) |
12851 (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) | 13171 (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) |
12852 (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) | 13172 (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) |
12853 ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) | 13173 ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) |
12854 ((equal deltaw "m") (setq month (+ month deltan))) | 13174 ((equal deltaw "m") (setq month (+ month deltan))) |
12855 ((equal deltaw "y") (setq year (+ year deltan))))) | 13175 ((equal deltaw "y") (setq year (+ year deltan))))) |
12856 ((and wday (not (nth 3 tl))) | 13176 ((and wday (not (nth 3 tl))) |
13177 (setq futurep nil) | |
12857 ;; Weekday was given, but no day, so pick that day in the week | 13178 ;; Weekday was given, but no day, so pick that day in the week |
12858 ;; on or after the derived date. | 13179 ;; on or after the derived date. |
12859 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year)))) | 13180 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year)))) |
12860 (unless (equal wday wday1) | 13181 (unless (equal wday wday1) |
12861 (setq day (+ day (% (- wday wday1 -7) 7)))))) | 13182 (setq day (+ day (% (- wday wday1 -7) 7)))))) |
12862 (if (and (boundp 'org-time-was-given) | 13183 (if (and (boundp 'org-time-was-given) |
12863 (nth 2 tl)) | 13184 (nth 2 tl)) |
12864 (setq org-time-was-given t)) | 13185 (setq org-time-was-given t)) |
12865 (if (< year 100) (setq year (+ 2000 year))) | 13186 (if (< year 100) (setq year (+ 2000 year))) |
12866 (if (< year 1970) (setq year (nth 5 defdecode))) ; not representable | 13187 (if (< year 1970) (setq year (nth 5 defdecode))) ; not representable |
13188 (setq org-read-date-analyze-futurep futurep) | |
12867 (list second minute hour day month year))) | 13189 (list second minute hour day month year))) |
12868 | 13190 |
12869 (defvar parse-time-weekdays) | 13191 (defvar parse-time-weekdays) |
12870 | 13192 |
12871 (defun org-read-date-get-relative (s today default) | 13193 (defun org-read-date-get-relative (s today default) |
12980 "Overlay modified time stamp format over timestamp between BEG and END." | 13302 "Overlay modified time stamp format over timestamp between BEG and END." |
12981 (let* ((ts (buffer-substring beg end)) | 13303 (let* ((ts (buffer-substring beg end)) |
12982 t1 w1 with-hm tf time str w2 (off 0)) | 13304 t1 w1 with-hm tf time str w2 (off 0)) |
12983 (save-match-data | 13305 (save-match-data |
12984 (setq t1 (org-parse-time-string ts t)) | 13306 (setq t1 (org-parse-time-string ts t)) |
12985 (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[dwmy]\\)?\\'" ts) | 13307 (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)?\\'" ts) |
12986 (setq off (- (match-end 0) (match-beginning 0))))) | 13308 (setq off (- (match-end 0) (match-beginning 0))))) |
12987 (setq end (- end off)) | 13309 (setq end (- end off)) |
12988 (setq w1 (- end beg) | 13310 (setq w1 (- end beg) |
12989 with-hm (and (nth 1 t1) (nth 2 t1)) | 13311 with-hm (and (nth 1 t1) (nth 2 t1)) |
12990 tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats) | 13312 tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats) |
13492 (setq org-ts-what (or what org-ts-what) | 13814 (setq org-ts-what (or what org-ts-what) |
13493 inactive (= (char-after (match-beginning 0)) ?\[) | 13815 inactive (= (char-after (match-beginning 0)) ?\[) |
13494 ts (match-string 0)) | 13816 ts (match-string 0)) |
13495 (replace-match "") | 13817 (replace-match "") |
13496 (if (string-match | 13818 (if (string-match |
13497 "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[dwmy]\\)*\\)[]>]" | 13819 "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)*\\)[]>]" |
13498 ts) | 13820 ts) |
13499 (setq extra (match-string 1 ts))) | 13821 (setq extra (match-string 1 ts))) |
13500 (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) | 13822 (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) |
13501 (setq with-hm t)) | 13823 (setq with-hm t)) |
13502 (setq time0 (org-parse-time-string ts)) | 13824 (setq time0 (org-parse-time-string ts)) |
13635 (setq m (- m (* 60 h))) | 13957 (setq m (- m (* 60 h))) |
13636 (format org-time-clocksum-format h m))) | 13958 (format org-time-clocksum-format h m))) |
13637 | 13959 |
13638 (defun org-hh:mm-string-to-minutes (s) | 13960 (defun org-hh:mm-string-to-minutes (s) |
13639 "Convert a string H:MM to a number of minutes. | 13961 "Convert a string H:MM to a number of minutes. |
13640 If the string is just a number, interprete it as minutes. | 13962 If the string is just a number, interpret it as minutes. |
13641 In fact, the first hh:mm or number in the string will be taken, | 13963 In fact, the first hh:mm or number in the string will be taken, |
13642 there can be extra stuff in the string. | 13964 there can be extra stuff in the string. |
13643 If no number is found, the return value is 0." | 13965 If no number is found, the return value is 0." |
13644 (cond | 13966 (cond |
13645 ((string-match "\\([0-9]+\\):\\([0-9]+\\)" s) | 13967 ((string-match "\\([0-9]+\\):\\([0-9]+\\)" s) |
14396 (org-defkey org-mode-map "\C-xns" 'org-narrow-to-subtree)) | 14718 (org-defkey org-mode-map "\C-xns" 'org-narrow-to-subtree)) |
14397 (org-defkey org-mode-map "\C-c\C-f" 'org-forward-same-level) | 14719 (org-defkey org-mode-map "\C-c\C-f" 'org-forward-same-level) |
14398 (org-defkey org-mode-map "\C-c\C-b" 'org-backward-same-level) | 14720 (org-defkey org-mode-map "\C-c\C-b" 'org-backward-same-level) |
14399 (org-defkey org-mode-map "\C-c$" 'org-archive-subtree) | 14721 (org-defkey org-mode-map "\C-c$" 'org-archive-subtree) |
14400 (org-defkey org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree) | 14722 (org-defkey org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree) |
14401 (org-defkey org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag) | 14723 (org-defkey org-mode-map "\C-c\C-x\C-a" 'org-archive-subtree-default) |
14402 (org-defkey org-mode-map "\C-c\C-xa" 'org-toggle-archive-tag) | 14724 (org-defkey org-mode-map "\C-c\C-xa" 'org-toggle-archive-tag) |
14403 (org-defkey org-mode-map "\C-c\C-xA" 'org-archive-to-archive-sibling) | 14725 (org-defkey org-mode-map "\C-c\C-xA" 'org-archive-to-archive-sibling) |
14404 (org-defkey org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer) | 14726 (org-defkey org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer) |
14405 (org-defkey org-mode-map "\C-c\C-j" 'org-goto) | 14727 (org-defkey org-mode-map "\C-c\C-j" 'org-goto) |
14406 (org-defkey org-mode-map "\C-c\C-t" 'org-todo) | 14728 (org-defkey org-mode-map "\C-c\C-t" 'org-todo) |
14503 | 14825 |
14504 (when (featurep 'xemacs) | 14826 (when (featurep 'xemacs) |
14505 (org-defkey org-mode-map 'button3 'popup-mode-menu)) | 14827 (org-defkey org-mode-map 'button3 'popup-mode-menu)) |
14506 | 14828 |
14507 | 14829 |
14830 (defconst org-speed-commands-default | |
14831 '( | |
14832 ("n" . outline-next-visible-heading) | |
14833 ("p" . outline-previous-visible-heading) | |
14834 ("f" . org-forward-same-level) | |
14835 ("b" . org-backward-same-level) | |
14836 ("u" . outline-up-heading) | |
14837 | |
14838 ("c" . org-cycle) | |
14839 ("C" . org-shifttab) | |
14840 ("U" . org-shiftmetaup) | |
14841 ("D" . org-shiftmetadown) | |
14842 ("r" . org-metaright) | |
14843 ("l" . org-metaleft) | |
14844 ("R" . org-shiftmetaright) | |
14845 ("L" . org-shiftmetaleft) | |
14846 ("i" . (progn (forward-char 1) (call-interactively | |
14847 'org-insert-heading-respect-content))) | |
14848 | |
14849 ("a" . org-agenda) | |
14850 ("/" . org-sparse-tree) | |
14851 (";" . org-set-tags-command) | |
14852 ("I" . org-clock-in) | |
14853 ("O" . org-clock-out) | |
14854 ("o" . org-open-at-point) | |
14855 ("t" . org-todo) | |
14856 ("j" . org-goto) | |
14857 ("g" . (org-refile t)) | |
14858 ("e" . org-set-effort) | |
14859 ("0" . (org-priority ?\ )) | |
14860 ("1" . (org-priority ?A)) | |
14861 ("2" . (org-priority ?B)) | |
14862 ("3" . (org-priority ?C)) | |
14863 ("." . outline-mark-subtree) | |
14864 ("^" . org-sort) | |
14865 ("w" . org-refile) | |
14866 ("a" . org-archive-subtree-default-with-confirmation) | |
14867 ("/" . org-sparse-tree) | |
14868 ("?" . org-speed-command-help) | |
14869 ) | |
14870 "The default speed commands.") | |
14871 | |
14872 (defun org-print-speed-command (e) | |
14873 (princ (car e)) | |
14874 (princ " ") | |
14875 (if (symbolp (cdr e)) | |
14876 (princ (symbol-name (cdr e))) | |
14877 (prin1 (cdr e))) | |
14878 (princ "\n")) | |
14879 | |
14880 (defun org-speed-command-help () | |
14881 "Show the available speed commands." | |
14882 (interactive) | |
14883 (if (not org-use-speed-commands) | |
14884 (error "Speed commands are not activated, customize `org-use-speed-commands'.") | |
14885 (with-output-to-temp-buffer "*Help*" | |
14886 (princ "Speed commands\n==============\n") | |
14887 (mapc 'org-print-speed-command org-speed-commands-user) | |
14888 (princ "\n") | |
14889 (mapc 'org-print-speed-command org-speed-commands-default)))) | |
14890 | |
14508 (defvar org-self-insert-command-undo-counter 0) | 14891 (defvar org-self-insert-command-undo-counter 0) |
14509 | 14892 |
14510 (defvar org-table-auto-blank-field) ; defined in org-table.el | 14893 (defvar org-table-auto-blank-field) ; defined in org-table.el |
14894 (defvar org-speed-command nil) | |
14511 (defun org-self-insert-command (N) | 14895 (defun org-self-insert-command (N) |
14512 "Like `self-insert-command', use overwrite-mode for whitespace in tables. | 14896 "Like `self-insert-command', use overwrite-mode for whitespace in tables. |
14513 If the cursor is in a table looking at whitespace, the whitespace is | 14897 If the cursor is in a table looking at whitespace, the whitespace is |
14514 overwritten, and the table is not marked as requiring realignment." | 14898 overwritten, and the table is not marked as requiring realignment." |
14515 (interactive "p") | 14899 (interactive "p") |
14516 (if (and | 14900 (cond |
14517 (org-table-p) | 14901 ((and org-use-speed-commands |
14518 (progn | 14902 (bolp) |
14519 ;; check if we blank the field, and if that triggers align | 14903 (looking-at outline-regexp) |
14520 (and (featurep 'org-table) org-table-auto-blank-field | 14904 (setq |
14521 (member last-command | 14905 org-speed-command |
14522 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c yas/expand)) | 14906 (or (cdr (assoc (this-command-keys) org-speed-commands-user)) |
14523 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |")) | 14907 (cdr (assoc (this-command-keys) org-speed-commands-default))))) |
14524 ;; got extra space, this field does not determine column width | 14908 (cond |
14525 (let (org-table-may-need-update) (org-table-blank-field)) | 14909 ((commandp org-speed-command) |
14910 (setq this-command org-speed-command) | |
14911 (call-interactively org-speed-command)) | |
14912 ((functionp org-speed-command) | |
14913 (funcall org-speed-command)) | |
14914 ((and org-speed-command (listp org-speed-command)) | |
14915 (eval org-speed-command)) | |
14916 (t (let (org-use-speed-commands) | |
14917 (call-interactively 'org-self-insert-command))))) | |
14918 ((and | |
14919 (org-table-p) | |
14920 (progn | |
14921 ;; check if we blank the field, and if that triggers align | |
14922 (and (featurep 'org-table) org-table-auto-blank-field | |
14923 (member last-command | |
14924 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c yas/expand)) | |
14925 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |")) | |
14926 ;; got extra space, this field does not determine column width | |
14927 (let (org-table-may-need-update) (org-table-blank-field)) | |
14526 ;; no extra space, this field may determine column width | 14928 ;; no extra space, this field may determine column width |
14527 (org-table-blank-field))) | 14929 (org-table-blank-field))) |
14528 t) | 14930 t) |
14529 (eq N 1) | 14931 (eq N 1) |
14530 (looking-at "[^|\n]* |")) | 14932 (looking-at "[^|\n]* |")) |
14531 (let (org-table-may-need-update) | 14933 (let (org-table-may-need-update) |
14532 (goto-char (1- (match-end 0))) | 14934 (goto-char (1- (match-end 0))) |
14533 (delete-backward-char 1) | 14935 (delete-backward-char 1) |
14534 (goto-char (match-beginning 0)) | 14936 (goto-char (match-beginning 0)) |
14535 (self-insert-command N)) | 14937 (self-insert-command N))) |
14938 (t | |
14536 (setq org-table-may-need-update t) | 14939 (setq org-table-may-need-update t) |
14537 (self-insert-command N) | 14940 (self-insert-command N) |
14538 (org-fix-tags-on-the-fly) | 14941 (org-fix-tags-on-the-fly) |
14539 (if org-self-insert-cluster-for-undo | 14942 (if org-self-insert-cluster-for-undo |
14540 (if (not (eq last-command 'org-self-insert-command)) | 14943 (if (not (eq last-command 'org-self-insert-command)) |
14544 (and (> org-self-insert-command-undo-counter 0) | 14947 (and (> org-self-insert-command-undo-counter 0) |
14545 buffer-undo-list | 14948 buffer-undo-list |
14546 (not (cadr buffer-undo-list)) ; remove nil entry | 14949 (not (cadr buffer-undo-list)) ; remove nil entry |
14547 (setcdr buffer-undo-list (cddr buffer-undo-list))) | 14950 (setcdr buffer-undo-list (cddr buffer-undo-list))) |
14548 (setq org-self-insert-command-undo-counter | 14951 (setq org-self-insert-command-undo-counter |
14549 (1+ org-self-insert-command-undo-counter))))))) | 14952 (1+ org-self-insert-command-undo-counter)))))))) |
14550 | 14953 |
14551 (defun org-fix-tags-on-the-fly () | 14954 (defun org-fix-tags-on-the-fly () |
14552 (when (and (equal (char-after (point-at-bol)) ?*) | 14955 (when (and (equal (char-after (point-at-bol)) ?*) |
14553 (org-on-heading-p)) | 14956 (org-on-heading-p)) |
14554 (org-align-tags-here org-tags-column))) | 14957 (org-align-tags-here org-tags-column))) |
14673 "Hook for functions to attach themselves to TAB. | 15076 "Hook for functions to attach themselves to TAB. |
14674 See `org-ctrl-c-ctrl-c-hook' for more information. | 15077 See `org-ctrl-c-ctrl-c-hook' for more information. |
14675 This hook runs after it has been established that not table field motion and | 15078 This hook runs after it has been established that not table field motion and |
14676 not visibility should be done because of current context. This is probably | 15079 not visibility should be done because of current context. This is probably |
14677 the place where a package like yasnippets can hook in.") | 15080 the place where a package like yasnippets can hook in.") |
15081 | |
15082 (defvar org-tab-before-tab-emulation-hook nil | |
15083 "Hook for functions to attach themselves to TAB. | |
15084 See `org-ctrl-c-ctrl-c-hook' for more information. | |
15085 This hook runs after every other options for TAB have been exhausted, but | |
15086 before indentation and \t insertion takes place.") | |
14678 | 15087 |
14679 (defvar org-metaleft-hook nil | 15088 (defvar org-metaleft-hook nil |
14680 "Hook for functions attaching themselves to `M-left'. | 15089 "Hook for functions attaching themselves to `M-left'. |
14681 See `org-ctrl-c-ctrl-c-hook' for more information.") | 15090 See `org-ctrl-c-ctrl-c-hook' for more information.") |
14682 (defvar org-metaright-hook nil | 15091 (defvar org-metaright-hook nil |
15441 ["Edit Source Example" org-edit-special t] | 15850 ["Edit Source Example" org-edit-special t] |
15442 "--" | 15851 "--" |
15443 ["Footnote new/jump" org-footnote-action t] | 15852 ["Footnote new/jump" org-footnote-action t] |
15444 ["Footnote extra" (org-footnote-action t) :active t :keys "C-u C-c C-x f"]) | 15853 ["Footnote extra" (org-footnote-action t) :active t :keys "C-u C-c C-x f"]) |
15445 ("Archive" | 15854 ("Archive" |
15855 ["Archive (default method)" org-archive-subtree-default t] | |
15856 "--" | |
15857 ["Move Subtree to Archive file" org-advertized-archive-subtree t] | |
15446 ["Toggle ARCHIVE tag" org-toggle-archive-tag t] | 15858 ["Toggle ARCHIVE tag" org-toggle-archive-tag t] |
15447 ; ["Check and Tag Children" (org-toggle-archive-tag (4)) | 15859 ["Move subtree to Archive sibling" org-archive-to-archive-sibling t] |
15448 ; :active t :keys "C-u C-c C-x C-a"] | |
15449 ["Sparse trees open ARCHIVE trees" | |
15450 (setq org-sparse-tree-open-archived-trees | |
15451 (not org-sparse-tree-open-archived-trees)) | |
15452 :style toggle :selected org-sparse-tree-open-archived-trees] | |
15453 ["Cycling opens ARCHIVE trees" | |
15454 (setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees)) | |
15455 :style toggle :selected org-cycle-open-archived-trees] | |
15456 "--" | |
15457 ["Move subtree to archive sibling" org-archive-to-archive-sibling t] | |
15458 ["Move Subtree to Archive" org-advertized-archive-subtree t] | |
15459 ; ["Check and Move Children" (org-archive-subtree '(4)) | |
15460 ; :active t :keys "C-u C-c C-x C-s"] | |
15461 ) | 15860 ) |
15462 "--" | 15861 "--" |
15463 ("Hyperlinks" | 15862 ("Hyperlinks" |
15464 ["Store Link (Global)" org-store-link t] | 15863 ["Store Link (Global)" org-store-link t] |
15465 ["Find existing link to here" org-occur-link-in-agenda-files t] | 15864 ["Find existing link to here" org-occur-link-in-agenda-files t] |
15793 | 16192 |
15794 (defun org-in-commented-line () | 16193 (defun org-in-commented-line () |
15795 "Is point in a line starting with `#'?" | 16194 "Is point in a line starting with `#'?" |
15796 (equal (char-after (point-at-bol)) ?#)) | 16195 (equal (char-after (point-at-bol)) ?#)) |
15797 | 16196 |
16197 (defun org-in-verbatim-emphasis () | |
16198 (save-match-data | |
16199 (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~"))))) | |
16200 | |
15798 (defun org-goto-marker-or-bmk (marker &optional bookmark) | 16201 (defun org-goto-marker-or-bmk (marker &optional bookmark) |
15799 "Go to MARKER, widen if necessary. When marker is not live, try BOOKMARK." | 16202 "Go to MARKER, widen if necessary. When marker is not live, try BOOKMARK." |
15800 (if (and marker (marker-buffer marker) | 16203 (if (and marker (marker-buffer marker) |
15801 (buffer-live-p (marker-buffer marker))) | 16204 (buffer-live-p (marker-buffer marker))) |
15802 (progn | 16205 (progn |
15910 (goto-char (point-min)) | 16313 (goto-char (point-min)) |
15911 (while (re-search-forward re nil t) | 16314 (while (re-search-forward re nil t) |
15912 (replace-match "") | 16315 (replace-match "") |
15913 (end-of-line 1)) | 16316 (end-of-line 1)) |
15914 min))) | 16317 min))) |
16318 | |
16319 (defun org-fill-template (template alist) | |
16320 "Find each %key of ALIST in TEMPLATE and replace it." | |
16321 (let (entry key value) | |
16322 (setq alist (sort (copy-sequence alist) | |
16323 (lambda (a b) (< (length (car a)) (length (car b)))))) | |
16324 (while (setq entry (pop alist)) | |
16325 (setq template | |
16326 (replace-regexp-in-string | |
16327 (concat "%" (regexp-quote (car entry))) | |
16328 (cdr entry) template t t))) | |
16329 template)) | |
15915 | 16330 |
15916 (defun org-base-buffer (buffer) | 16331 (defun org-base-buffer (buffer) |
15917 "Return the base buffer of BUFFER, if it has one. Else return the buffer." | 16332 "Return the base buffer of BUFFER, if it has one. Else return the buffer." |
15918 (if (not buffer) | 16333 (if (not buffer) |
15919 buffer | 16334 buffer |
16039 (looking-at org-todo-line-tags-regexp)) | 16454 (looking-at org-todo-line-tags-regexp)) |
16040 (push (org-point-in-group p 1 :headline-stars) clist) | 16455 (push (org-point-in-group p 1 :headline-stars) clist) |
16041 (push (org-point-in-group p 2 :todo-keyword) clist) | 16456 (push (org-point-in-group p 2 :todo-keyword) clist) |
16042 (push (org-point-in-group p 4 :tags) clist)) | 16457 (push (org-point-in-group p 4 :tags) clist)) |
16043 (goto-char p) | 16458 (goto-char p) |
16044 (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1)) | 16459 (skip-chars-backward "^[\n\r \t") (or (bobp) (backward-char 1)) |
16045 (if (looking-at "\\[#[A-Z0-9]\\]") | 16460 (if (looking-at "\\[#[A-Z0-9]\\]") |
16046 (push (org-point-in-group p 0 :priority) clist))) | 16461 (push (org-point-in-group p 0 :priority) clist))) |
16047 | 16462 |
16048 ((org-at-item-p) | 16463 ((org-at-item-p) |
16049 (push (org-point-in-group p 2 :item-bullet) clist) | 16464 (push (org-point-in-group p 2 :item-bullet) clist) |
16420 (save-excursion (org-indent-line-to column))) | 16835 (save-excursion (org-indent-line-to column))) |
16421 (setq column (current-column)) | 16836 (setq column (current-column)) |
16422 (beginning-of-line 1) | 16837 (beginning-of-line 1) |
16423 (if (looking-at | 16838 (if (looking-at |
16424 "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)") | 16839 "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)") |
16425 (replace-match (concat "\\1" (format org-property-format | 16840 (replace-match (concat (match-string 1) |
16426 (match-string 2) (match-string 3))) | 16841 (format org-property-format |
16427 t nil)) | 16842 (match-string 2) (match-string 3))) |
16843 t t)) | |
16428 (org-move-to-column column))) | 16844 (org-move-to-column column))) |
16429 | 16845 |
16430 (defun org-set-autofill-regexps () | 16846 (defun org-set-autofill-regexps () |
16431 (interactive) | 16847 (interactive) |
16432 ;; In the paragraph separator we include headlines, because filling | 16848 ;; In the paragraph separator we include headlines, because filling |
16558 "Use reftex-citation to insert a citation into the buffer. | 16974 "Use reftex-citation to insert a citation into the buffer. |
16559 This looks for a line like | 16975 This looks for a line like |
16560 | 16976 |
16561 #+BIBLIOGRAPHY: foo plain option:-d | 16977 #+BIBLIOGRAPHY: foo plain option:-d |
16562 | 16978 |
16563 and derives from it that foo.bib is the bbliography file relevant | 16979 and derives from it that foo.bib is the bibliography file relevant |
16564 for this document. It then installs the necessary environment for RefTeX | 16980 for this document. It then installs the necessary environment for RefTeX |
16565 to work in this buffer and calls `reftex-citation' to insert a citation | 16981 to work in this buffer and calls `reftex-citation' to insert a citation |
16566 into the buffer. | 16982 into the buffer. |
16567 | 16983 |
16568 Export of such citations to both LaTeX and HTML is handled by the contributed | 16984 Export of such citations to both LaTeX and HTML is handled by the contributed |
17160 (defun org-link-display-format (link) | 17576 (defun org-link-display-format (link) |
17161 "Replace a link with either the description, or the link target | 17577 "Replace a link with either the description, or the link target |
17162 if no description is present" | 17578 if no description is present" |
17163 (save-match-data | 17579 (save-match-data |
17164 (if (string-match org-bracket-link-analytic-regexp link) | 17580 (if (string-match org-bracket-link-analytic-regexp link) |
17165 (replace-match (or (match-string 5 link) | 17581 (replace-match (if (match-end 5) |
17166 (concat (match-string 1 link) | 17582 (match-string 5 link) |
17167 (match-string 3 link))) | 17583 (concat (match-string 1 link) |
17168 nil nil link) | 17584 (match-string 3 link))) |
17585 nil t link) | |
17169 link))) | 17586 link))) |
17170 | 17587 |
17171 ;; Speedbar support | 17588 ;; Speedbar support |
17172 | 17589 |
17173 (defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1) | 17590 (defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1) |
17186 (let (p m tp np dir txt) | 17603 (let (p m tp np dir txt) |
17187 (cond | 17604 (cond |
17188 ((setq p (text-property-any (point-at-bol) (point-at-eol) | 17605 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
17189 'org-imenu t)) | 17606 'org-imenu t)) |
17190 (setq m (get-text-property p 'org-imenu-marker)) | 17607 (setq m (get-text-property p 'org-imenu-marker)) |
17191 (save-excursion | 17608 (with-current-buffer (marker-buffer m) |
17192 ;; FIXME: Shouldn't set-buffer be done before save-restriction? --Stef | 17609 (goto-char m) |
17193 (save-restriction | 17610 (org-agenda-set-restriction-lock 'subtree))) |
17194 (set-buffer (marker-buffer m)) | |
17195 (goto-char m) | |
17196 (org-agenda-set-restriction-lock 'subtree)))) | |
17197 ((setq p (text-property-any (point-at-bol) (point-at-eol) | 17611 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
17198 'speedbar-function 'speedbar-find-file)) | 17612 'speedbar-function 'speedbar-find-file)) |
17199 (setq tp (previous-single-property-change | 17613 (setq tp (previous-single-property-change |
17200 (1+ p) 'speedbar-function) | 17614 (1+ p) 'speedbar-function) |
17201 np (next-single-property-change | 17615 np (next-single-property-change |
17202 tp 'speedbar-function) | 17616 tp 'speedbar-function) |
17203 dir (speedbar-line-directory) | 17617 dir (speedbar-line-directory) |
17204 txt (buffer-substring-no-properties (or tp (point-min)) | 17618 txt (buffer-substring-no-properties (or tp (point-min)) |
17205 (or np (point-max)))) | 17619 (or np (point-max)))) |
17206 (save-excursion | 17620 (with-current-buffer (find-file-noselect |
17207 ;; FIXME: Shouldn't set-buffer be done before save-restriction? --Stef | 17621 (let ((default-directory dir)) |
17208 (save-restriction | 17622 (expand-file-name txt))) |
17209 (set-buffer (find-file-noselect | 17623 (unless (org-mode-p) |
17210 (let ((default-directory dir)) | 17624 (error "Cannot restrict to non-Org-mode file")) |
17211 (expand-file-name txt)))) | 17625 (org-agenda-set-restriction-lock 'file))) |
17212 (unless (org-mode-p) | |
17213 (error "Cannot restrict to non-Org-mode file")) | |
17214 (org-agenda-set-restriction-lock 'file)))) | |
17215 (t (error "Don't know how to restrict Org-mode's agenda"))) | 17626 (t (error "Don't know how to restrict Org-mode's agenda"))) |
17216 (org-move-overlay org-speedbar-restriction-lock-overlay | 17627 (org-move-overlay org-speedbar-restriction-lock-overlay |
17217 (point-at-bol) (point-at-eol)) | 17628 (point-at-bol) (point-at-eol)) |
17218 (setq current-prefix-arg nil) | 17629 (setq current-prefix-arg nil) |
17219 (org-agenda-maybe-redo))) | 17630 (org-agenda-maybe-redo))) |
17242 (and (org-bound-and-true-p flyspell-mode) | 17653 (and (org-bound-and-true-p flyspell-mode) |
17243 (fboundp 'flyspell-delete-region-overlays) | 17654 (fboundp 'flyspell-delete-region-overlays) |
17244 (flyspell-delete-region-overlays beg end)) | 17655 (flyspell-delete-region-overlays beg end)) |
17245 (add-text-properties beg end '(org-no-flyspell t))) | 17656 (add-text-properties beg end '(org-no-flyspell t))) |
17246 | 17657 |
17247 ;; Make `bookmark-jump' show the jump location if it was hidden. | 17658 ;; Make `bookmark-jump' shows the jump location if it was hidden. |
17248 (eval-after-load "bookmark" | 17659 (eval-after-load "bookmark" |
17249 '(if (boundp 'bookmark-after-jump-hook) | 17660 '(if (boundp 'bookmark-after-jump-hook) |
17250 ;; We can use the hook | 17661 ;; We can use the hook |
17251 (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) | 17662 (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) |
17252 ;; Hook not available, use advice | 17663 ;; Hook not available, use advice |
17253 (defadvice bookmark-jump (after org-make-visible activate) | 17664 (defadvice bookmark-jump (after org-make-visible activate) |
17254 "Make the position visible." | 17665 "Make the position visible." |
17255 (org-bookmark-jump-unhide)))) | 17666 (org-bookmark-jump-unhide)))) |
17256 | 17667 |
17257 ;; Make sure saveplace show the location if it was hidden | 17668 ;; Make sure saveplace shows the location if it was hidden |
17258 (eval-after-load "saveplace" | 17669 (eval-after-load "saveplace" |
17259 '(defadvice save-place-find-file-hook (after org-make-visible activate) | 17670 '(defadvice save-place-find-file-hook (after org-make-visible activate) |
17260 "Make the position visible." | 17671 "Make the position visible." |
17261 (org-bookmark-jump-unhide))) | 17672 (org-bookmark-jump-unhide))) |
17673 | |
17674 ;; Make sure ecb shows the location if it was hidden | |
17675 (eval-after-load "ecb" | |
17676 '(defadvice ecb-method-clicked (after esf/org-show-context activate) | |
17677 "Make hierarchy visible when jumping into location from ECB tree buffer." | |
17678 (if (eq major-mode 'org-mode) | |
17679 (org-show-context)))) | |
17262 | 17680 |
17263 (defun org-bookmark-jump-unhide () | 17681 (defun org-bookmark-jump-unhide () |
17264 "Unhide the current position, to show the bookmark location." | 17682 "Unhide the current position, to show the bookmark location." |
17265 (and (org-mode-p) | 17683 (and (org-mode-p) |
17266 (or (org-invisible-p) | 17684 (or (org-invisible-p) |
17302 (run-hooks 'org-load-hook) | 17720 (run-hooks 'org-load-hook) |
17303 | 17721 |
17304 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 17722 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
17305 | 17723 |
17306 ;;; org.el ends here | 17724 ;;; org.el ends here |
17725 |