diff options
| author | Carsten Dominik | 2009-11-13 08:39:29 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2009-11-13 08:39:29 +0000 |
| commit | 8bfe682a6f3ffbab914af9037379cb1515720c28 (patch) | |
| tree | 9a59360c3d66ac14b24073d3e77d364e82a06000 | |
| parent | bf89fd7bb5bcb3e87e16158eddb85400754948e9 (diff) | |
| download | emacs-8bfe682a6f3ffbab914af9037379cb1515720c28.tar.gz emacs-8bfe682a6f3ffbab914af9037379cb1515720c28.zip | |
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'.
51 files changed, 5732 insertions, 1393 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 267623af4da..a50cd36d4c0 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,53 @@ | |||
| 1 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 2 | |||
| 3 | * org.texi: Removed @Ie, @ie, @Eg, @eg macros. | ||
| 4 | |||
| 5 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 6 | |||
| 7 | * org.texi (Column attributes): Add the new age summary operators. | ||
| 8 | Also, mention the fact you can only use one summary operator per | ||
| 9 | property. | ||
| 10 | |||
| 11 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 12 | |||
| 13 | * org.texi (Tracking your habits): Added a new section in the | ||
| 14 | manual about how to track habits. | ||
| 15 | (Resolving idle time): Added a section on how idle and | ||
| 16 | dangling clocks are resolved. | ||
| 17 | |||
| 18 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 19 | |||
| 20 | * org.texi (Agenda commands): Document the new `i' command. | ||
| 21 | (Inserting deadline/schedule): Document logging changes | ||
| 22 | of scheduling and deadline times stamps. | ||
| 23 | (In-buffer settings): Document the in-buffer keywords for logging | ||
| 24 | changes of scheduling and deadline times stamps. | ||
| 25 | (Structure editing, Plain lists): Document indentation | ||
| 26 | cycling in empty entries with TAB. | ||
| 27 | (Archiving): Document the default archiving command. | ||
| 28 | (Moving subtrees): Document the new keys for archiving. | ||
| 29 | (Internal archiving): Fix incorrect key. | ||
| 30 | (Agenda commands): Document the TODO set switching commands. | ||
| 31 | (Agenda commands): Document the new archiving keys. | ||
| 32 | (Clocking work time): Better description on how to save | ||
| 33 | and restore a clock. | ||
| 34 | (Resolving idle time): Mention the x11idle program to get true | ||
| 35 | idleness also under X11. | ||
| 36 | (Resolving idle time): Use @kbd instead of @key for normal | ||
| 37 | letters, because this is how he rest of the manual does this. | ||
| 38 | (Pushing to MobileOrg): Mention that `org-directory' | ||
| 39 | should be set. | ||
| 40 | (Agenda commands): Document that SPC is a filter for | ||
| 41 | any tag. | ||
| 42 | (Search view): Renamed from "Keyword search". | ||
| 43 | (Capure): New chapter. | ||
| 44 | (Markup): New chapter. | ||
| 45 | (Links in HTML export, Images in HTML export): Extend | ||
| 46 | the section titles. | ||
| 47 | (Images in HTML export): Document the align option. | ||
| 48 | (Text areas in HTML export): Extend the section title. | ||
| 49 | (Images in LaTeX export): Explain image placement in LaTeX. | ||
| 50 | |||
| 1 | 2009-11-10 Glenn Morris <rgm@gnu.org> | 51 | 2009-11-10 Glenn Morris <rgm@gnu.org> |
| 2 | 52 | ||
| 3 | * sc.texi (Hints to MUA Authors): MUA should do any decoding. | 53 | * sc.texi (Hints to MUA Authors): MUA should do any decoding. |
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index ef82bd2076f..6a4e5d72353 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog | |||
| @@ -1,3 +1,776 @@ | |||
| 1 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 2 | |||
| 3 | * org.el (org-clone-subtree-with-time-shift): Make it work at the | ||
| 4 | end of the buffer. | ||
| 5 | |||
| 6 | * org-mobile.el (org-mobile-write-checksums): Specify coding | ||
| 7 | system. | ||
| 8 | (org-mobile-timestamp-buffer): Keep local variable/mode line at | ||
| 9 | beginning of buffer. | ||
| 10 | |||
| 11 | * org-latex.el (org-latex-entities-regexp): Fix typo in regexp. | ||
| 12 | |||
| 13 | * org.el (org-block-todo-from-children-or-siblings-or-parent) | ||
| 14 | (org-block-todo-from-checkboxes): Do not block changes to a nil | ||
| 15 | TODO state. | ||
| 16 | |||
| 17 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 18 | |||
| 19 | * org-habit.el (org-habit-parse-todo): Indicate which habit is | ||
| 20 | wrongly set up in the error messages. | ||
| 21 | |||
| 22 | * org-colview.el (org-columns-display-here): Don't try to | ||
| 23 | calculate values if the underlying property is not set. | ||
| 24 | (org-columns-string-to-number): Convert age strings back into | ||
| 25 | fractional days. | ||
| 26 | (org-agenda-colview-summarize): Handle extended summary types | ||
| 27 | properly. | ||
| 28 | |||
| 29 | * org-colview-xemacs.el (org-columns-display-here): Don't try to | ||
| 30 | calculate values if the underlying property is not set. | ||
| 31 | (org-columns-string-to-number): Convert age strings back into | ||
| 32 | fractional days. | ||
| 33 | (org-agenda-colview-summarize): Handle extended summary types | ||
| 34 | properly. | ||
| 35 | |||
| 36 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 37 | |||
| 38 | * org-exp.el (org-export-format-drawer-function): New variable. | ||
| 39 | (org-export-format-drawer): New function. | ||
| 40 | (org-export-preprocess-string): Pass the backend as a parameter to | ||
| 41 | `org-export-remove-or-extract-drawers'. | ||
| 42 | (org-export-remove-or-extract-drawers): New parameter BACKEND. | ||
| 43 | |||
| 44 | * org-protocol.el (org-protocol-char-to-string): New defsubst. | ||
| 45 | |||
| 46 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 47 | |||
| 48 | * org-agenda.el (org-agenda-diary-entry-in-org-file): Add error | ||
| 49 | message when no block is selected. | ||
| 50 | |||
| 51 | * org-latex.el (org-export-latex-links): Check for protectedness | ||
| 52 | in the last matched character, not after the match. | ||
| 53 | |||
| 54 | * org-datetree.el (org-datetree-find-date-create): Respect | ||
| 55 | restriction when KEEP-RESTRICTION is set. | ||
| 56 | (org-datetree-file-entry-under): New function. | ||
| 57 | (org-datetree-cleanup): New command. | ||
| 58 | |||
| 59 | 2009-11-13 Dan Davison <davison@stats.ox.ac.uk> | ||
| 60 | |||
| 61 | * org-src.el (org-edit-src-code): New optional argument context | ||
| 62 | allows calling functions to avoid altering the saved window | ||
| 63 | configuration. | ||
| 64 | (org-edit-src-exit): Do not restore window configuration when this | ||
| 65 | function is used in the context of saving the edit buffer. | ||
| 66 | |||
| 67 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 68 | |||
| 69 | * org-clock.el (org-clock-out, org-clock-cancel): Revert to | ||
| 70 | instances to switching to with-current-buffer, because these seem | ||
| 71 | to cause problems - no idea why. | ||
| 72 | |||
| 73 | * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): | ||
| 74 | Require diary-lib for (diary-date-display-form). | ||
| 75 | |||
| 76 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 77 | |||
| 78 | * org.el (org-log-reschedule, org-log-redeadline): New options. | ||
| 79 | (org-log-note-headings): Add templates for rescheduling and | ||
| 80 | deadline changing. | ||
| 81 | (org-startup-options): Add in-buffer settings for logging changing | ||
| 82 | schedule and deadline time stamps. | ||
| 83 | (org-deadline, org-schedule): Check for existing date and arrange | ||
| 84 | for logging if the user requests it. | ||
| 85 | (org-add-log-note): Prepare proper note buffers for rescheduling | ||
| 86 | and deadline changes. | ||
| 87 | |||
| 88 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 89 | |||
| 90 | * org-agenda.el (org-agenda-diary-entry-in-org-file) | ||
| 91 | (org-agenda-add-entry-to-org-agenda-diary-file) | ||
| 92 | (org-agenda-insert-diary-make-new-entry): New functions. | ||
| 93 | (org-agenda-diary-entry): Call | ||
| 94 | `org-agenda-diary-entry-in-org-file' when appropriate. | ||
| 95 | |||
| 96 | * org.el (org-calendar-insert-diary-entry-key): New option. | ||
| 97 | (org-agenda-diary-file): New option. | ||
| 98 | ("calendar"): Install our insertion function in the calendar. | ||
| 99 | |||
| 100 | * org-remember.el (org-datetree): Require. | ||
| 101 | (org-remember-templates): Add new positioning option. | ||
| 102 | (org-remember-reference-date): New variable. | ||
| 103 | (org-remember-apply-template): Store the reference date in a local | ||
| 104 | variable. | ||
| 105 | (org-remember-handler): Implement date tree positioning of entries. | ||
| 106 | |||
| 107 | * org-datetree.el: New file. | ||
| 108 | |||
| 109 | * org-latex.el (org-export-latex-preprocess): Protect targets in | ||
| 110 | verbatim emphasis. | ||
| 111 | |||
| 112 | * org-html.el (org-export-as-html): Protect targets in verbatim | ||
| 113 | emphasis. | ||
| 114 | |||
| 115 | * org-docbook.el (org-export-as-docbook): Protect targets in | ||
| 116 | verbatim emphasis. | ||
| 117 | |||
| 118 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 119 | |||
| 120 | * org-clock.el (org-show-notification): Handle messages that | ||
| 121 | contain a percent character. | ||
| 122 | |||
| 123 | * org-remember.el (org-remember-apply-template): Turn of partial | ||
| 124 | completion. | ||
| 125 | |||
| 126 | * org-mobile.el (org-mobile-before-process-capture-hook): New hook. | ||
| 127 | (org-mobile-pull): Run `org-mobile-before-process-capture-hook'. | ||
| 128 | |||
| 129 | * org.el (org-indent-mode): Define variable already in org.el. | ||
| 130 | (org-unfontify-region): Remove line-prefix and wrap-prefix | ||
| 131 | properties only if org-indent-mode is active. | ||
| 132 | |||
| 133 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 134 | |||
| 135 | * org-icalendar.el (org-print-icalendar-entries): Save match data | ||
| 136 | around call to verify function. | ||
| 137 | (org-print-icalendar-entries): Add a call to the verification | ||
| 138 | function. | ||
| 139 | |||
| 140 | * org.el (org-speedbar-set-agenda-restriction): Remove unnecessary | ||
| 141 | save-restrivtion' form. | ||
| 142 | |||
| 143 | 2009-11-13 Dan Davison <davison@stats.ox.ac.uk> | ||
| 144 | |||
| 145 | * org-exp.el (org-export-format-source-code-or-example): restrict | ||
| 146 | scope of preserve-indentp to the let binding. | ||
| 147 | (org-src): require org-src, since org-src-preserve-indentation is used. | ||
| 148 | |||
| 149 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 150 | |||
| 151 | * org-timer.el (org-timer-set-timer): Set variables | ||
| 152 | org-timer-timer[123] correctly. | ||
| 153 | |||
| 154 | |||
| 155 | * org-mobile.el (org-mobile-files-alist): Make it work when | ||
| 156 | `agenda-archives' is included in | ||
| 157 | `org-agenda-text-search-extra-files'. | ||
| 158 | (org-mobile-push): Restore agenda after mobile push. | ||
| 159 | |||
| 160 | 2009-11-13 John Wiegley <jwiegley@gmail.com> | ||
| 161 | |||
| 162 | * org-clock.el (org-resolve-clocks-if-idle): Another fix to the | ||
| 163 | way the amount of idle time is presented in the minibuffer. | ||
| 164 | |||
| 165 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 166 | |||
| 167 | * org-icalendar.el (org-print-icalendar-entries): Use | ||
| 168 | org-icalendar-verify-function only if non-nil. | ||
| 169 | |||
| 170 | * org.el (org-refile): Refile to clock only if the prefix arg is | ||
| 171 | 2. | ||
| 172 | (org-sparse-tree): Fix docstring to be in line with prompt. | ||
| 173 | (org-update-parent-todo-statistics): Call | ||
| 174 | `org-after-todo-statistics-hook' on each level. | ||
| 175 | |||
| 176 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 177 | |||
| 178 | * org-remember.el (org-remember-apply-template): Make sure the | ||
| 179 | buffer exists. | ||
| 180 | |||
| 181 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 182 | |||
| 183 | * org.el (org-tab-ind-state): New variable. | ||
| 184 | (org-cycle-level): New function. | ||
| 185 | (org-cycle-level-after-item/entry-creation): New option. | ||
| 186 | (org-flag-subtree): New function. | ||
| 187 | (org-hide-archived-subtrees): Call `org-flag-subtree'. | ||
| 188 | (org-set-effort): Indexed access. | ||
| 189 | |||
| 190 | * org-list.el (org-cycle-item-indentation): New function. | ||
| 191 | |||
| 192 | * org.el (org-refile): Make prefix argument 2 refile to current | ||
| 193 | clock. | ||
| 194 | (org-priority): Interpret action `remove' as call to remove the | ||
| 195 | priority cookie. | ||
| 196 | |||
| 197 | * org-remember.el (org-remember-apply-template): Don't depend on | ||
| 198 | buffer name being like file name. | ||
| 199 | |||
| 200 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 201 | |||
| 202 | * org-clock.el (org-clock-play-sound): Expand file in | ||
| 203 | org-clock-sound, to allow ~ for home. | ||
| 204 | |||
| 205 | * org-remember.el (org-remember-handler): Set | ||
| 206 | text-before-node-creation even if this already looks like a node, | ||
| 207 | because the string might be needed on non-org-mode target files. | ||
| 208 | |||
| 209 | * org-agenda.el (org-agenda-open-link): Make this work in agenda | ||
| 210 | clocktables. | ||
| 211 | (org-agenda-switch-to): Follow a link at point if | ||
| 212 | org-return-follows-link' is set and there is nothing else to do in | ||
| 213 | this line. | ||
| 214 | |||
| 215 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 216 | |||
| 217 | * org-colview-xemacs.el: Add in changes from org-colview.el | ||
| 218 | |||
| 219 | 2009-11-13 Dan Davison <davison@stats.ox.ac.uk> | ||
| 220 | |||
| 221 | * org-exp-blocks.el: Modify split separator regexp to avoid empty | ||
| 222 | strings. | ||
| 223 | |||
| 224 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 225 | |||
| 226 | * org-colview.el (org-columns-new): Make this work with the new | ||
| 227 | operators. | ||
| 228 | (org-columns-store-format): Make this work with the new operators. | ||
| 229 | |||
| 230 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 231 | |||
| 232 | * org-src.el (org-src-preserve-indentation): Document that this | ||
| 233 | variable is also used during export. | ||
| 234 | |||
| 235 | * org-exp.el (org-export-format-source-code-or-example): Preserve | ||
| 236 | indentation if a block has a -i option, or if | ||
| 237 | `org-src-preserve-indentation' is set. | ||
| 238 | |||
| 239 | * org-exp-blocks.el (org-export-blocks-preprocess): Preserve | ||
| 240 | indentation if a block has a -i option, or if | ||
| 241 | `org-src-preserve-indentation' is set. | ||
| 242 | |||
| 243 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 244 | |||
| 245 | * org.el (org-mode-map): Define the new archiving keys. | ||
| 246 | (org-speed-commands-default): Define an archiving key in the speed | ||
| 247 | command map. | ||
| 248 | (org-org-menu): Improve the menu structure concerning archiving. | ||
| 249 | |||
| 250 | * org-archive.el (org-archive-subtree-default-with-confirmation): | ||
| 251 | New command. | ||
| 252 | |||
| 253 | * org-agenda.el (org-agenda-mode-map): Define the new archiving keys. | ||
| 254 | (org-agenda-menu): Add the new archiving commands to the menu. | ||
| 255 | (org-agenda-archive-default) | ||
| 256 | (org-agenda-archive-default-with-confirmation): New commands. | ||
| 257 | (org-agenda-archive, org-agenda-archive-to-archive-sibling): Just | ||
| 258 | call `org-agenda-archive-with'. | ||
| 259 | (org-agenda-archive-with): New function. | ||
| 260 | |||
| 261 | * org-table.el (org-table-convert-region): Inert spaces around "|" | ||
| 262 | to avoid line beginnings like "|-1" which will be mistaken as | ||
| 263 | hlines. | ||
| 264 | |||
| 265 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 266 | |||
| 267 | * org.el (org-offer-links-in-entry): Return nil if there are no | ||
| 268 | links, t if a link has been selected. | ||
| 269 | (org-open-at-point): Open attachment directory when called in the | ||
| 270 | headline and there are no links in the entry body. | ||
| 271 | (org-speed-commands-default): Add "o" for open-at-point as a speed | ||
| 272 | command. | ||
| 273 | |||
| 274 | * org-attach.el (org-attach-reveal): Optional prefix arg | ||
| 275 | IF-EXISTS, which avoids creating the attachment directory if it | ||
| 276 | does not yet exist. | ||
| 277 | |||
| 278 | * org-agenda.el (org-agenda, org-run-agenda-series): Evaluate | ||
| 279 | MATCH. | ||
| 280 | |||
| 281 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 282 | |||
| 283 | * org.el ("abbrev"): Work with abbrev tables only after they have | ||
| 284 | been loaded. | ||
| 285 | |||
| 286 | * org-list.el (org-list-send-list): Fix bug related to match | ||
| 287 | data. | ||
| 288 | |||
| 289 | * org-latex.el (org-export-latex-fontify): Apply verbatim | ||
| 290 | emphasis. | ||
| 291 | (org-export-latex-make-header): Insert \obeylines if line breaks | ||
| 292 | should be preserved. | ||
| 293 | |||
| 294 | * org-exp.el (org-export-protect-verbatim): Add an | ||
| 295 | `org-verbatim-emph' property to such text. | ||
| 296 | |||
| 297 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 298 | |||
| 299 | * org-icalendar.el (org-icalendar-use-plain-timestamp): New option. | ||
| 300 | (org-print-icalendar-entries): Skip entries where the timestamp is | ||
| 301 | not a deadline and not scheduled, if the user requests that. | ||
| 302 | |||
| 303 | * org-latex.el (org-export-latex-quotation-marks): Allow a bracket | ||
| 304 | before an opening quote. | ||
| 305 | |||
| 306 | * org-archive.el (org-archive-subtree): Keep archive after | ||
| 307 | archiving something. | ||
| 308 | |||
| 309 | * org-id.el (org-id-update-id-locations): Add archive files if | ||
| 310 | that is required by `org-id-extra-files'. | ||
| 311 | |||
| 312 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 313 | |||
| 314 | * org-src.el (org-src-window-setup): New option. | ||
| 315 | (org-src-switch-to-buffer): New function. | ||
| 316 | (org-edit-src-exit): Add optional argument CONTEXT and use it to | ||
| 317 | restore window configuration. | ||
| 318 | (org-edit-src-code, org-edit-src-continue, org-edit-src-exit): | ||
| 319 | Call `org-src-switch-to-buffer'. | ||
| 320 | |||
| 321 | * org.el (org-default-properties): Add STYLE property. | ||
| 322 | (org-files-list): Use the function call to get the files. | ||
| 323 | (org-additional-option-like-keywords): Add SETUPFILE to completion | ||
| 324 | list. | ||
| 325 | |||
| 326 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 327 | |||
| 328 | * org-table.el (org-table-convert-region): Correctly interpret | ||
| 329 | quoting in csv import. | ||
| 330 | |||
| 331 | * org.el (org-icompleting-read): Make iswitchb completion work | ||
| 332 | with lists and tables. | ||
| 333 | |||
| 334 | * org-agenda.el (org-agenda-add-entry-text): Never add entry text | ||
| 335 | while pushing the mobile agenda. | ||
| 336 | |||
| 337 | 2009-11-13 John Wiegley <jwiegley@gmail.com> | ||
| 338 | |||
| 339 | * org-clock.el | ||
| 340 | (org-clock-auto-clock-resolution): Now takes three values: nil, t | ||
| 341 | and `when-no-clock-is-running'. | ||
| 342 | (org-clock-in): Use `org-clock-auto-clock-resolution' to determine | ||
| 343 | whether or not to resolve Org buffers on clock in. | ||
| 344 | |||
| 345 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 346 | |||
| 347 | * org-colview.el (org-format-time-period): Function to format | ||
| 348 | times in fractional days for display. | ||
| 349 | (org-columns-display-here): Add support for showing a calculated | ||
| 350 | value in place of the property. | ||
| 351 | (org-columns): Set `org-columns-time' to the current time so time | ||
| 352 | difference calculations will work. | ||
| 353 | (org-columns-time): Use to store the current time when column view | ||
| 354 | is displayed, so all time differences will use the same reference | ||
| 355 | point. | ||
| 356 | (org-columns-compile-map): There is now an extra position in each | ||
| 357 | entry specifying the function to use to calculate the displayed | ||
| 358 | value for the non-calculated properties in the column, | ||
| 359 | (org-columns-compute-all): Set `org-columns-time' to the current | ||
| 360 | time so time difference calculations will work. | ||
| 361 | (org-columns-compute): Handle column operators where the values | ||
| 362 | used are calculated from the underlying property. | ||
| 363 | (org-columns-number-to-string): Handle the 'age' column format | ||
| 364 | (org-columns-string-to-number): Correct the function name (was | ||
| 365 | org-column...). Add support for the 'age' column format. | ||
| 366 | (org-columns-compile-format): Support the additional parameter in | ||
| 367 | org-columns-compile-map. | ||
| 368 | |||
| 369 | 2009-11-13 Bastien Guerry <bzg@altern.org> | ||
| 370 | |||
| 371 | * org.el (org-mode-hook): Turn `org-mode-hook' into a customizable | ||
| 372 | variable. | ||
| 373 | |||
| 374 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 375 | |||
| 376 | * org-clock.el (org-clock-has-been-used): New variable. | ||
| 377 | (org-clock-in): Set `org-clock-has-been-used'. | ||
| 378 | (org-clock-save): Save only if clock data has been used or created | ||
| 379 | during this session. | ||
| 380 | |||
| 381 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 382 | |||
| 383 | * org-clock.el (org-clock-persist): New value, to store only the | ||
| 384 | clock history. | ||
| 385 | (org-clock-save): Don't save the clock if only the history should | ||
| 386 | be stored. | ||
| 387 | (org-clock-load): Turn off John Wiegley's auto resolving mechanism | ||
| 388 | when restoring a saved clock. | ||
| 389 | |||
| 390 | 2009-11-13 John Wiegley <jwiegley@gmail.com> | ||
| 391 | |||
| 392 | * org-clock.el (org-clock-display, org-clock-put-overlay): Use | ||
| 393 | `org-time-clock-use-fractional'. | ||
| 394 | |||
| 395 | * org.el (org-time-clocksum-use-fractional) | ||
| 396 | (org-time-clocksum-fractional-format): Two new customizable | ||
| 397 | variables which allow the user to select fractional times (1.25 | ||
| 398 | instead of 1:25) in the `org-clock-display' report. | ||
| 399 | |||
| 400 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 401 | |||
| 402 | * org-ascii.el (org-export-ascii-table-keep-all-vertical-lines): | ||
| 403 | New option. | ||
| 404 | |||
| 405 | * org.el (org-tag-alist): Fix customization type. | ||
| 406 | |||
| 407 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 408 | |||
| 409 | * org-mobile.el (org-mobile-update-checksum-for-capture-file): | ||
| 410 | Make sure the regexp search can fail without throwing an error. | ||
| 411 | (org-mobile-apply): Save the inbox buffer after removing | ||
| 412 | successfully applied changes. | ||
| 413 | |||
| 414 | 2009-11-13 John Wiegley <jwiegley@gmail.com> | ||
| 415 | |||
| 416 | * org-clock.el (org-resolve-clocks-if-idle): Fix to the way idle | ||
| 417 | time is reported after the user comes back (but before they | ||
| 418 | resolve time). | ||
| 419 | |||
| 420 | * org.el (org-get-repeat): Change so that this function can be | ||
| 421 | called with either `org-scheduled-string' or | ||
| 422 | `org-deadline-string'. | ||
| 423 | |||
| 424 | * org-clock.el (org-clock-auto-clock-resolution): Renamed | ||
| 425 | `org-clock-disable-clock-resolution', since negatives don't sound | ||
| 426 | good in customization variables. | ||
| 427 | (org-clock-in): Don't use the auto-resolution logic if the user is | ||
| 428 | clocking into a different task while an active clock is running. | ||
| 429 | This then allows the default behavior of clocking out of the open | ||
| 430 | task and then into the new task. | ||
| 431 | |||
| 432 | * org.el (org-modules): Made this variable more consistent, since | ||
| 433 | it was referring to Org, OrgMode and Org-mode, whereas the docs | ||
| 434 | for the variable always refer to Org-mode. | ||
| 435 | |||
| 436 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 437 | |||
| 438 | * org.el (org-repeat-re): The changed org-repeat-re no longer | ||
| 439 | matched simple +2d type repeaters. Fix it so it does. | ||
| 440 | |||
| 441 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 442 | |||
| 443 | * org-latex.el (org-export-latex-preprocess): Protect the vspace | ||
| 444 | macro in the VERSE environment. | ||
| 445 | |||
| 446 | 2009-11-13 John Wiegley <jwiegley@gmail.com> | ||
| 447 | |||
| 448 | * org-habit.el (org-habit-get-priority): A new function that | ||
| 449 | determines the relative priority of a habit, based on how long | ||
| 450 | past its scheduled date it is, and how near the deadline is. | ||
| 451 | |||
| 452 | * org-agenda.el (org-agenda-get-scheduled): Set habit priority | ||
| 453 | using `org-habit-get-priority'. | ||
| 454 | |||
| 455 | * org-habit.el (org-habit-build-graph): Start displaying colors | ||
| 456 | from the first scheduled date, if that date is earlier than the | ||
| 457 | first completion date. | ||
| 458 | |||
| 459 | * org-habit.el: Changed all "color" variables to faces, and made | ||
| 460 | them appropriate for light and dark backgrounds. | ||
| 461 | |||
| 462 | * org-habit.el (org-habit-duration-to-days): Made this function | ||
| 463 | more general. | ||
| 464 | (org-habit-parse-todo): Parse the new ".+N/N" style repeater. | ||
| 465 | |||
| 466 | * org-agenda.el (org-agenda-get-deadlines): Removed all mention of | ||
| 467 | habits, since they don't use DEADLINE anymore. | ||
| 468 | |||
| 469 | * org.el (org-repeat-re, org-display-custom-time) | ||
| 470 | (org-timestamp-change): Extended to support the new ".+N/N" | ||
| 471 | syntax, used for habits. | ||
| 472 | |||
| 473 | * org-clock.el (org-clock-resolve-clock): Fixed an incorrect | ||
| 474 | variable reference. | ||
| 475 | |||
| 476 | * org-agenda.el (org-agenda-set-mode-name): Show Habit in the | ||
| 477 | modeline when habits are being displayed (if that module is being | ||
| 478 | loaded). | ||
| 479 | |||
| 480 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 481 | |||
| 482 | * org-clock.el (org-x11-idle-seconds): Add a method to get the X11 | ||
| 483 | idle time using the xscreensaver extension. | ||
| 484 | (org-user-idle-seconds): Use X11 idle time if available. | ||
| 485 | |||
| 486 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 487 | |||
| 488 | * org-agenda.el (org-agenda-next-line): New command. | ||
| 489 | (org-agenda-previous-line): New commands. | ||
| 490 | (org-agenda-show-and-scroll-up, org-agenda-show-scroll-down): New | ||
| 491 | commands. | ||
| 492 | (org-agenda-follow-mode): Do the follow immediately if the mode is | ||
| 493 | turned on here. | ||
| 494 | (previous-line, next-line): Replace keys with the corresponding | ||
| 495 | org functions. | ||
| 496 | (org-agenda-mode-map): Bind backspace and delete to the scrolling | ||
| 497 | command. | ||
| 498 | |||
| 499 | * org.el (org-icompleting-read): Turn off partial completion mode | ||
| 500 | for the duration of this completion round. | ||
| 501 | |||
| 502 | * org-latex.el (org-export-latex-fontify-headline): Protect TeX | ||
| 503 | macros in author lines and similar stuff. | ||
| 504 | |||
| 505 | * org.el (org-file-tags): Fix docstring. | ||
| 506 | (org-get-buffer-tags): Add the #+FILETAGS tags. | ||
| 507 | ("ecb"): Maks ecb show context after jumping into an Org file. | ||
| 508 | |||
| 509 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 510 | |||
| 511 | * org-agenda.el (org-finalize-agenda): Draw habit consistency | ||
| 512 | graphs after everything else in the buffer has been setup. | ||
| 513 | |||
| 514 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 515 | |||
| 516 | * org-mobile.el (org-mobile-apply): Count success and failure. | ||
| 517 | |||
| 518 | * org.el (org-indent-line-function): Fix regexp replace problem. | ||
| 519 | |||
| 520 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 521 | |||
| 522 | * org-clock.el (org-clock-disable-clock-resolution): New | ||
| 523 | customization variable that disable automatic clock resolution on | ||
| 524 | clock in. | ||
| 525 | (org-clock-in): If `org-clock-disable-clock-resolution' is set, do | ||
| 526 | not automatically resolve anything. This is does not affect | ||
| 527 | idle-time resolution, however, if `org-clock-idle-time' is set. | ||
| 528 | |||
| 529 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 530 | |||
| 531 | * org-habit.el: New file, which implements code to build a "habit | ||
| 532 | consistency graph". | ||
| 533 | |||
| 534 | * org-agenda.el (org-agenda-get-deadlines) | ||
| 535 | (org-agenda-get-scheduled): Display consistency graphs when | ||
| 536 | outputting habits into the agenda. The graphs are always relative | ||
| 537 | to the current time. | ||
| 538 | (org-format-agenda-item): Added new parameter `habitp', which | ||
| 539 | indicates whether we are formatting a habit or not. Do not | ||
| 540 | display "extra" leading information if habitp is true. | ||
| 541 | |||
| 542 | * org.el (org-repeat-re): Improved regexp to include .+ and ++ | ||
| 543 | leaders for repeat strings. | ||
| 544 | (org-get-repeat): Now takes a string parameter `tagline', so the | ||
| 545 | caller can obtain the SCHEDULED repeat, or the DEADLINE repeat. | ||
| 546 | |||
| 547 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 548 | |||
| 549 | * org-agenda.el (org-agenda-auto-exclude-function): New | ||
| 550 | customization variable for allowing the user to create an "auto | ||
| 551 | exclusion" filter for doing context-aware auto tag filtering. | ||
| 552 | (org-agenda-filter-by-tag): Changes to support the use of | ||
| 553 | `org-agenda-auto-exclude-function'. See the new manual addition,. | ||
| 554 | |||
| 555 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 556 | |||
| 557 | * org.el (org-files-list): Don't attempt to return a file name for | ||
| 558 | Org buffers which have no associated file. | ||
| 559 | |||
| 560 | * org-agenda.el (org-agenda-do-action): Fixed a typo. | ||
| 561 | |||
| 562 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 563 | |||
| 564 | * org-mobile.el (org-mobile-locate-entry): Interpret files | ||
| 565 | relative to org-directory. | ||
| 566 | (org-mobile-inbox-for-pull): Document the best location for this | ||
| 567 | file. | ||
| 568 | (org-mobile-check-setup): Verify `org-directory'. | ||
| 569 | (org-mobile-create-index-file): Sort the files to be listed in | ||
| 570 | index.org. | ||
| 571 | |||
| 572 | 2009-11-13 James TD Smith <ahktenzero@mohorovi.cc> | ||
| 573 | |||
| 574 | * org.el (org-fast-tag-selection): Add a way to display a | ||
| 575 | description for a tag group. This is done by adding a string to | ||
| 576 | either the startgroup or endgroup cell. | ||
| 577 | |||
| 578 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 579 | |||
| 580 | * org-clock.el (org-clock-resolve, org-resolve-clocks) | ||
| 581 | (org-emacs-idle-seconds): Use `org-float-time' instead of | ||
| 582 | `time-to-seconds' | ||
| 583 | |||
| 584 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 585 | |||
| 586 | * org-agenda.el (org-agenda-sorting-strategy): Fix customization | ||
| 587 | type. | ||
| 588 | |||
| 589 | * org.el (org-pre-cycle-hook): Document that `empty' can also be | ||
| 590 | the value of ARG when doing local cycling. | ||
| 591 | |||
| 592 | 2009-11-13 John Wiegley <johnw@newartisans.com> | ||
| 593 | |||
| 594 | * org-clock.el (org-clock-resolve-clock): If keeping or | ||
| 595 | subtracting time results in a clock out at a time in the past, and | ||
| 596 | if the resolution occurred due to idleness or invoking `M-x | ||
| 597 | org-resolve-clocks', remember that past moment in time. On the | ||
| 598 | next clock in, the user will be prompted to see if they want to | ||
| 599 | back-date their new clock to then. | ||
| 600 | (org-clock-resolve): Do not jump the user to the location of a | ||
| 601 | dangling clock if the resolution is occuring due to an idle | ||
| 602 | timeout. In that case there is typically only one dangling clock, | ||
| 603 | the active one, and there is no value gained by shuffling their | ||
| 604 | windows around to show it to them. Being prompted to resolve an | ||
| 605 | idle clock should be as inobtrusive as possible. | ||
| 606 | (org-resolve-clocks-if-idle): New function that resolves only the | ||
| 607 | currently active clock if the user has exceeded the time returned | ||
| 608 | by `org-user-idle-seconds', based on the value of | ||
| 609 | `org-clock-idle-time'. | ||
| 610 | (org-clock-in): If, after resolving clocks, | ||
| 611 | (org-clock-out): Cancel the `org-clock-idle-timer' on clock out. | ||
| 612 | |||
| 613 | * org-clock.el (org-clock-resolve-clock): New function that | ||
| 614 | resolves a clock to a specific time, closing or resuming as need | ||
| 615 | be, and possibly even starting a new clock. | ||
| 616 | (org-clock-resolve): New function used by `org-resolve-clocks' | ||
| 617 | that sets up for the call to `org-clock-resolve-clock'. It | ||
| 618 | determines the time to resolve to based on a single-character | ||
| 619 | selection from the user to either keep time, subtract away time or | ||
| 620 | cancel the clock. | ||
| 621 | (org-resolve-clocks): New user command which resolves dangling | ||
| 622 | clocks -- that is, open but not active -- anywhere in the file | ||
| 623 | list returned by `org-files-list'. | ||
| 624 | (org-clock-in): Automatically resolve dangling clocks whenever a | ||
| 625 | user clocks in. | ||
| 626 | (org-clock-cancel): If the user cancels the solely clock in a | ||
| 627 | LOGBOOK, remove the empty drawer. | ||
| 628 | |||
| 629 | * org-clock.el (org-clock-idle-time): New user customizable option | ||
| 630 | for detecting whether the user has left a clock idle. Note: it is | ||
| 631 | only used in this commit to test whether it's worthwhile to check | ||
| 632 | OS X to get the Mac user's current idle time. If the Emacs idle | ||
| 633 | time is less than the value, the user hasn't been away long enough | ||
| 634 | to be worth checking (a more expensive test than just getting | ||
| 635 | Emacs idle time). | ||
| 636 | (org-user-idle-seconds, org-mac-idle-seconds) | ||
| 637 | (org-emacs-idle-seconds): This three functions, in conjunction | ||
| 638 | with the user customization variable `org-clock-idle-time', return | ||
| 639 | the number of seconds (as a floating point) that the user has been | ||
| 640 | away from their Emacs (or, if running on OS X, their computer). | ||
| 641 | |||
| 642 | * org-clock.el (org-find-open-clocks): New function that returns a | ||
| 643 | list of all open clocks in the given FILE. Note that each clock | ||
| 644 | it returns is a cons cell of the format (MARKER . START-TIME). | ||
| 645 | This "clock" value is used by several of the new clock module | ||
| 646 | utility functions. | ||
| 647 | (org-is-active-clock): New inline function which tests whether the | ||
| 648 | given clock value is the same as the currently active clock. | ||
| 649 | Returns non-nil if this is the case. | ||
| 650 | (org-with-clock-position): New macro that evaluates FORMS with | ||
| 651 | point in the buffer and at the position of the given clock. | ||
| 652 | Changes to the current clock are global. | ||
| 653 | (org-with-clock): New macro that evaluates FORMS with point in the | ||
| 654 | buffer and at the position of the given clock. However, changes | ||
| 655 | to the current clock are local and have no effect on the user's | ||
| 656 | active clock. This allows, for example, far any clock to be | ||
| 657 | cancelled without cancelling the active clock. | ||
| 658 | (org-clock-clock-in): New inline function that switches the active | ||
| 659 | clock to the given clock. If either the argument RESUME, or the | ||
| 660 | global `org-clock-in-resume', are non-nil, it will resume a clock | ||
| 661 | that was previously left open. | ||
| 662 | (org-clock-clock-out): New inline function that clocks out the | ||
| 663 | given clock value without affecting the currently active clock. | ||
| 664 | (org-clock-clock-cancel): New inline function that cancels the | ||
| 665 | given clock value without affecting the currently active clock. | ||
| 666 | |||
| 667 | * org-clock.el (org-clock-in): Before creating | ||
| 668 | `org-clock-mode-line-timer', check to make sure an older timer is | ||
| 669 | not currently running. | ||
| 670 | (org-clock-out): Accept new third parameter `at-time', which | ||
| 671 | permits a clock to be clocked out at a specific time. Note that | ||
| 672 | no attempt is made to verify that the clock out time is later than | ||
| 673 | the clock in time. | ||
| 674 | |||
| 675 | * org.el (org-files-list): New utility function for returning a | ||
| 676 | list of all open org-mode buffers, plus all files used to build | ||
| 677 | the agenda buffer. Note that not all the files will necessarily | ||
| 678 | be visited by a buffer at time of call. | ||
| 679 | (org-entry-beginning-position): Like the function | ||
| 680 | `line-beginning-position', this inline function returns the | ||
| 681 | beginning position of the current heading/entry. | ||
| 682 | (org-entry-end-position): Like the function `line-end-position', | ||
| 683 | this inline function returns the end position of the current | ||
| 684 | heading/entry. | ||
| 685 | |||
| 686 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 687 | |||
| 688 | * org-agenda.el (org-agenda-list): Mark the all-todo items line as | ||
| 689 | a header line. | ||
| 690 | |||
| 691 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 692 | |||
| 693 | * org-exp.el (org-inlinetask-remove-END-maybe): Declare function. | ||
| 694 | |||
| 695 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 696 | |||
| 697 | * org-agenda.el (org-agenda-filter-make-matcher): Allow to filter | ||
| 698 | entries that have no tags. | ||
| 699 | (org-agenda-search-view): New customize group. | ||
| 700 | (org-agenda-search-view-search-words-only): New option. | ||
| 701 | (org-search-view): Implement substring search. | ||
| 702 | |||
| 703 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 704 | |||
| 705 | * org.el (org-outline-level): Add doc string. | ||
| 706 | |||
| 707 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 708 | |||
| 709 | * org-inlinetask.el (org-inlinetask-export): Re-introduce | ||
| 710 | variable. | ||
| 711 | (org-inlinetask-export-handler): Only export inline task if the | ||
| 712 | user option calls for it. | ||
| 713 | |||
| 714 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 715 | |||
| 716 | * org-exp.el (org-export-handle-export-tags): Remove inlinetask | ||
| 717 | END if present. | ||
| 718 | |||
| 719 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 720 | |||
| 721 | * org-latex.el (org-export-latex-tables): Don't format in | ||
| 722 | protected regions. | ||
| 723 | |||
| 724 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 725 | |||
| 726 | * org-src.el (org-edit-src-code) | ||
| 727 | (org-edit-src-find-region-and-lang, org-edit-src-exit): Handle | ||
| 728 | macro editing. | ||
| 729 | |||
| 730 | * org-agenda.el (org-prefix-category-max-length): New variable. | ||
| 731 | (org-format-agenda-item): Use `org-prefix-category-max-length'. | ||
| 732 | (org-compile-prefix-format): Set `org-prefix-category-max-length'. | ||
| 733 | |||
| 734 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 735 | |||
| 736 | * org-mobile.el (org-mobile-create-index-file): Improve the | ||
| 737 | listing of tags and todo keywords. | ||
| 738 | |||
| 739 | * org-latex.el (org-export-latex-format-image): New function. | ||
| 740 | (org-export-latex-links): Use `org-export-latex-format-image'. | ||
| 741 | |||
| 742 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 743 | |||
| 744 | * org-inlinetask.el (org-inlinetask-get-current-indentation) | ||
| 745 | (org-inlinetask-remove-terminator): New functions. | ||
| 746 | (org-inlinetask-export-handler): Terminate the description list. | ||
| 747 | |||
| 748 | * org-exp.el (org-export-select-backend-specific-text): Remove the | ||
| 749 | region markers. | ||
| 750 | |||
| 751 | * org-inlinetask.el (org-inlinetask-export-handler): fix bug for | ||
| 752 | tasks without content. | ||
| 753 | |||
| 754 | * org-clock.el: Make sure the clock-in target position does not | ||
| 755 | move to a different node by widening the buffer. | ||
| 756 | |||
| 757 | * org-html.el (org-export-html-format-image): Wrap image into | ||
| 758 | figure div only when there is a caption. | ||
| 759 | |||
| 760 | * org-archive.el (org-archive-mark-done): Change default value to | ||
| 761 | nil. | ||
| 762 | |||
| 763 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | ||
| 764 | |||
| 765 | * org.el (org-context): Call `bobp', not `eobp'. | ||
| 766 | |||
| 767 | * org-clock.el (org-clock-cancel): Remove quotes from marker | ||
| 768 | variables. | ||
| 769 | |||
| 770 | * org.el (org-read-date-prefer-future): New allowed value `time'. | ||
| 771 | (org-read-date-analyze): Shift day to tomorrow depending on time | ||
| 772 | entered and value of `org-read-date-prefer-future'. | ||
| 773 | |||
| 1 | 2009-11-05 Stefan Monnier <monnier@iro.umontreal.ca> | 774 | 2009-11-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 775 | ||
| 3 | * org.el (org-version, org-get-refile-targets, org-refile) | 776 | * org.el (org-version, org-get-refile-targets, org-refile) |
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index d7d5b8778e9..544e933f5d9 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -52,9 +52,19 @@ | |||
| 52 | (declare-function calendar-julian-date-string "cal-julian" (&optional date)) | 52 | (declare-function calendar-julian-date-string "cal-julian" (&optional date)) |
| 53 | (declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) | 53 | (declare-function calendar-mayan-date-string "cal-mayan" (&optional date)) |
| 54 | (declare-function calendar-persian-date-string "cal-persia" (&optional date)) | 54 | (declare-function calendar-persian-date-string "cal-persia" (&optional date)) |
| 55 | (declare-function org-datetree-find-date-create "org-datetree" (date)) | ||
| 55 | (declare-function org-columns-quit "org-colview" ()) | 56 | (declare-function org-columns-quit "org-colview" ()) |
| 57 | (declare-function diary-date-display-form "diary-lib" (&optional type)) | ||
| 58 | (declare-function org-mobile-write-agenda-for-mobile "org-mobile" (file)) | ||
| 59 | (declare-function org-habit-insert-consistency-graphs | ||
| 60 | "org-habit" (&optional line)) | ||
| 61 | (declare-function org-is-habit-p "org-habit" (&optional pom)) | ||
| 62 | (declare-function org-habit-parse-todo "org-habit" (&optional pom)) | ||
| 63 | (declare-function org-habit-get-priority "org-habit" (habit)) | ||
| 56 | (defvar calendar-mode-map) | 64 | (defvar calendar-mode-map) |
| 57 | (defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el | 65 | (defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el |
| 66 | (defvar org-habit-show-habits) | ||
| 67 | (defvar org-habit-show-habits-only-for-today) | ||
| 58 | 68 | ||
| 59 | ;; Defined somewhere in this file, but used before definition. | 69 | ;; Defined somewhere in this file, but used before definition. |
| 60 | (defvar org-agenda-buffer-name) | 70 | (defvar org-agenda-buffer-name) |
| @@ -200,6 +210,7 @@ you can \"misuse\" it to also add other text to the header. However, | |||
| 200 | (const priority-up) (const priority-down) | 210 | (const priority-up) (const priority-down) |
| 201 | (const todo-state-up) (const todo-state-down) | 211 | (const todo-state-up) (const todo-state-down) |
| 202 | (const effort-up) (const effort-down) | 212 | (const effort-up) (const effort-down) |
| 213 | (const habit-up) (const habit-down) | ||
| 203 | (const user-defined-up) (const user-defined-down)) | 214 | (const user-defined-up) (const user-defined-down)) |
| 204 | "Sorting choices.") | 215 | "Sorting choices.") |
| 205 | 216 | ||
| @@ -481,6 +492,10 @@ this one will be used." | |||
| 481 | "Options concerning the general tags/property/todo match agenda view." | 492 | "Options concerning the general tags/property/todo match agenda view." |
| 482 | :tag "Org Agenda Match View" | 493 | :tag "Org Agenda Match View" |
| 483 | :group 'org-agenda) | 494 | :group 'org-agenda) |
| 495 | (defgroup org-agenda-search-view nil | ||
| 496 | "Options concerning the general tags/property/todo match agenda view." | ||
| 497 | :tag "Org Agenda Match View" | ||
| 498 | :group 'org-agenda) | ||
| 484 | 499 | ||
| 485 | (defvar org-agenda-archives-mode nil | 500 | (defvar org-agenda-archives-mode nil |
| 486 | "Non-nil means, the agenda will include archived items. | 501 | "Non-nil means, the agenda will include archived items. |
| @@ -607,7 +622,7 @@ have turned on `org-enforce-todo-dependencies', | |||
| 607 | `org-enforce-todo-checkbox-dependencies', or any other blocking | 622 | `org-enforce-todo-checkbox-dependencies', or any other blocking |
| 608 | mechanism, this will create useful feedback in the agenda. | 623 | mechanism, this will create useful feedback in the agenda. |
| 609 | 624 | ||
| 610 | Instead ot t, this variable can also have the value `invisible'. | 625 | Instead of t, this variable can also have the value `invisible'. |
| 611 | Then blocked tasks will be invisible and only become visible when | 626 | Then blocked tasks will be invisible and only become visible when |
| 612 | they become unblocked. An exemption to this behavior is when a task is | 627 | they become unblocked. An exemption to this behavior is when a task is |
| 613 | blocked because of unchecked checkboxes below it. Since checkboxes do | 628 | blocked because of unchecked checkboxes below it. Since checkboxes do |
| @@ -620,7 +635,7 @@ will only be dimmed." | |||
| 620 | :type '(choice | 635 | :type '(choice |
| 621 | (const :tag "Do not dim" nil) | 636 | (const :tag "Do not dim" nil) |
| 622 | (const :tag "Dim to a grey face" t) | 637 | (const :tag "Dim to a grey face" t) |
| 623 | (const :tag "Make invisibe" invisible))) | 638 | (const :tag "Make invisible" invisible))) |
| 624 | 639 | ||
| 625 | (defcustom org-timeline-show-empty-dates 3 | 640 | (defcustom org-timeline-show-empty-dates 3 |
| 626 | "Non-nil means, `org-timeline' also shows dates without an entry. | 641 | "Non-nil means, `org-timeline' also shows dates without an entry. |
| @@ -662,7 +677,7 @@ Needs to be set before org.el is loaded." | |||
| 662 | :type 'boolean) | 677 | :type 'boolean) |
| 663 | 678 | ||
| 664 | (defcustom org-agenda-entry-text-maxlines 5 | 679 | (defcustom org-agenda-entry-text-maxlines 5 |
| 665 | "Number of text lines to be added when `E' is presed in the agenda. | 680 | "Number of text lines to be added when `E' is pressed in the agenda. |
| 666 | 681 | ||
| 667 | Note that this variable only used during agenda display. Add add entry text | 682 | Note that this variable only used during agenda display. Add add entry text |
| 668 | when exporting the agenda, configure the variable | 683 | when exporting the agenda, configure the variable |
| @@ -870,6 +885,16 @@ current display in the agenda." | |||
| 870 | :group 'org-agenda-daily/weekly | 885 | :group 'org-agenda-daily/weekly |
| 871 | :type 'plist) | 886 | :type 'plist) |
| 872 | 887 | ||
| 888 | (defcustom org-agenda-search-view-search-words-only nil | ||
| 889 | "Non-nil means, the search string is interpreted as individual words | ||
| 890 | The search then looks for each word separately in each entry and | ||
| 891 | selects entries that have matches for all words. | ||
| 892 | When nil, matching as loose words will only take place if the first | ||
| 893 | word is preceded by + or -. If that is not the case, the search | ||
| 894 | string will just be matched as a substring in the entry, but with | ||
| 895 | each space character allowing for any whitespace, including newlines." | ||
| 896 | :group 'org-agenda-search-view | ||
| 897 | :type 'boolean) | ||
| 873 | 898 | ||
| 874 | (defgroup org-agenda-time-grid nil | 899 | (defgroup org-agenda-time-grid nil |
| 875 | "Options concerning the time grid in the Org-mode Agenda." | 900 | "Options concerning the time grid in the Org-mode Agenda." |
| @@ -935,9 +960,9 @@ a grid line." | |||
| 935 | :group 'org-agenda) | 960 | :group 'org-agenda) |
| 936 | 961 | ||
| 937 | (defcustom org-agenda-sorting-strategy | 962 | (defcustom org-agenda-sorting-strategy |
| 938 | '((agenda time-up priority-down category-keep) | 963 | '((agenda habit-down time-up priority-down category-keep) |
| 939 | (todo priority-down category-keep) | 964 | (todo priority-down category-keep) |
| 940 | (tags priority-down category-keep) | 965 | (tags priority-down category-keep) |
| 941 | (search category-keep)) | 966 | (search category-keep)) |
| 942 | "Sorting structure for the agenda items of a single day. | 967 | "Sorting structure for the agenda items of a single day. |
| 943 | This is a list of symbols which will be used in sequence to determine | 968 | This is a list of symbols which will be used in sequence to determine |
| @@ -960,6 +985,8 @@ effort-up Sort numerically by estimated effort, high effort last. | |||
| 960 | effort-down Sort numerically by estimated effort, high effort first. | 985 | effort-down Sort numerically by estimated effort, high effort first. |
| 961 | user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. | 986 | user-defined-up Sort according to `org-agenda-cmp-user-defined', high last. |
| 962 | user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. | 987 | user-defined-down Sort according to `org-agenda-cmp-user-defined', high first. |
| 988 | habit-up Put entries that are habits first | ||
| 989 | habit-down Put entries that are habits last | ||
| 963 | 990 | ||
| 964 | The different possibilities will be tried in sequence, and testing stops | 991 | The different possibilities will be tried in sequence, and testing stops |
| 965 | if one comparison returns a \"not-equal\". For example, the default | 992 | if one comparison returns a \"not-equal\". For example, the default |
| @@ -976,7 +1003,7 @@ categories by priority. | |||
| 976 | 1003 | ||
| 977 | Instead of a single list, this can also be a set of list for specific | 1004 | Instead of a single list, this can also be a set of list for specific |
| 978 | contents, with a context symbol in the car of the list, any of | 1005 | contents, with a context symbol in the car of the list, any of |
| 979 | `agenda', `todo', `tags' for the corresponding agenda views. | 1006 | `agenda', `todo', `tags', `search' for the corresponding agenda views. |
| 980 | 1007 | ||
| 981 | Custom commands can bind this variable in the options section." | 1008 | Custom commands can bind this variable in the options section." |
| 982 | :group 'org-agenda-sorting | 1009 | :group 'org-agenda-sorting |
| @@ -988,6 +1015,8 @@ Custom commands can bind this variable in the options section." | |||
| 988 | (cons (const :tag "Strategy for TODO lists" todo) | 1015 | (cons (const :tag "Strategy for TODO lists" todo) |
| 989 | (repeat ,org-sorting-choice)) | 1016 | (repeat ,org-sorting-choice)) |
| 990 | (cons (const :tag "Strategy for Tags matches" tags) | 1017 | (cons (const :tag "Strategy for Tags matches" tags) |
| 1018 | (repeat ,org-sorting-choice)) | ||
| 1019 | (cons (const :tag "Strategy for search matches" search) | ||
| 991 | (repeat ,org-sorting-choice))))) | 1020 | (repeat ,org-sorting-choice))))) |
| 992 | 1021 | ||
| 993 | (defcustom org-agenda-cmp-user-defined nil | 1022 | (defcustom org-agenda-cmp-user-defined nil |
| @@ -1060,7 +1089,7 @@ If there is punctuation or whitespace character just before the final | |||
| 1060 | format letter, this character will be appended to the field value if | 1089 | format letter, this character will be appended to the field value if |
| 1061 | the value is not empty. For example, the format \"%-12:c\" leads to | 1090 | the value is not empty. For example, the format \"%-12:c\" leads to |
| 1062 | \"Diary: \" if the category is \"Diary\". If the category were be | 1091 | \"Diary: \" if the category is \"Diary\". If the category were be |
| 1063 | empty, no additional colon would be interted. | 1092 | empty, no additional colon would be inserted. |
| 1064 | 1093 | ||
| 1065 | The default value of this option is \" %-12:c%?-12t% s\", meaning: | 1094 | The default value of this option is \" %-12:c%?-12t% s\", meaning: |
| 1066 | - Indent the line with two space characters | 1095 | - Indent the line with two space characters |
| @@ -1259,6 +1288,15 @@ estimate." | |||
| 1259 | :group 'org-agenda-column-view | 1288 | :group 'org-agenda-column-view |
| 1260 | :type 'boolean) | 1289 | :type 'boolean) |
| 1261 | 1290 | ||
| 1291 | (defcustom org-agenda-auto-exclude-function nil | ||
| 1292 | "A function called with a tag to decide if it is filtered on '/ RET'. | ||
| 1293 | The sole argument to the function, which is called once for each | ||
| 1294 | possible tag, is a string giving the name of the tag. The | ||
| 1295 | function should return either nil if the tag should be included | ||
| 1296 | as normal, or \"-<TAG>\" to exclude the tag." | ||
| 1297 | :group 'org-agenda | ||
| 1298 | :type 'function) | ||
| 1299 | |||
| 1262 | (eval-when-compile | 1300 | (eval-when-compile |
| 1263 | (require 'cl)) | 1301 | (require 'cl)) |
| 1264 | (require 'org) | 1302 | (require 'org) |
| @@ -1276,6 +1314,8 @@ works you probably want to add it to `org-agenda-custom-commands' for good." | |||
| 1276 | 1314 | ||
| 1277 | (defvar org-agenda-mode-map (make-sparse-keymap) | 1315 | (defvar org-agenda-mode-map (make-sparse-keymap) |
| 1278 | "Keymap for `org-agenda-mode'.") | 1316 | "Keymap for `org-agenda-mode'.") |
| 1317 | (if (fboundp 'defvaralias) | ||
| 1318 | (defvaralias 'org-agenda-keymap 'org-agenda-mode-map)) | ||
| 1279 | 1319 | ||
| 1280 | (defvar org-agenda-menu) ; defined later in this file. | 1320 | (defvar org-agenda-menu) ; defined later in this file. |
| 1281 | (defvar org-agenda-restrict) ; defined later in this file. | 1321 | (defvar org-agenda-restrict) ; defined later in this file. |
| @@ -1353,12 +1393,16 @@ The following commands are available: | |||
| 1353 | (org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-remove-all-marks) | 1393 | (org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-remove-all-marks) |
| 1354 | (org-defkey org-agenda-mode-map "B" 'org-agenda-bulk-action) | 1394 | (org-defkey org-agenda-mode-map "B" 'org-agenda-bulk-action) |
| 1355 | (org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload) | 1395 | (org-defkey org-agenda-mode-map "\C-c\C-x!" 'org-reload) |
| 1356 | (org-defkey org-agenda-mode-map "\C-c$" 'org-agenda-archive) | 1396 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-a" 'org-agenda-archive-default) |
| 1397 | (org-defkey org-agenda-mode-map "\C-c\C-xa" 'org-agenda-toggle-archive-tag) | ||
| 1398 | (org-defkey org-agenda-mode-map "\C-c\C-xA" 'org-agenda-archive-to-archive-sibling) | ||
| 1357 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive) | 1399 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-s" 'org-agenda-archive) |
| 1400 | (org-defkey org-agenda-mode-map "\C-c$" 'org-agenda-archive) | ||
| 1358 | (org-defkey org-agenda-mode-map "$" 'org-agenda-archive) | 1401 | (org-defkey org-agenda-mode-map "$" 'org-agenda-archive) |
| 1359 | (org-defkey org-agenda-mode-map "A" 'org-agenda-archive-to-archive-sibling) | ||
| 1360 | (org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link) | 1402 | (org-defkey org-agenda-mode-map "\C-c\C-o" 'org-agenda-open-link) |
| 1361 | (org-defkey org-agenda-mode-map " " 'org-agenda-show) | 1403 | (org-defkey org-agenda-mode-map " " 'org-agenda-show-and-scroll-up) |
| 1404 | (org-defkey org-agenda-mode-map [backspace] 'org-agenda-show-scroll-down) | ||
| 1405 | (org-defkey org-agenda-mode-map "\d" 'org-agenda-show-scroll-down) | ||
| 1362 | (org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset) | 1406 | (org-defkey org-agenda-mode-map [(control shift right)] 'org-agenda-todo-nextset) |
| 1363 | (org-defkey org-agenda-mode-map [(control shift left)] 'org-agenda-todo-previousset) | 1407 | (org-defkey org-agenda-mode-map [(control shift left)] 'org-agenda-todo-previousset) |
| 1364 | (org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer) | 1408 | (org-defkey org-agenda-mode-map "\C-c\C-xb" 'org-agenda-tree-to-indirect-buffer) |
| @@ -1366,7 +1410,7 @@ The following commands are available: | |||
| 1366 | (org-defkey org-agenda-mode-map "L" 'org-agenda-recenter) | 1410 | (org-defkey org-agenda-mode-map "L" 'org-agenda-recenter) |
| 1367 | (org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) | 1411 | (org-defkey org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) |
| 1368 | (org-defkey org-agenda-mode-map "t" 'org-agenda-todo) | 1412 | (org-defkey org-agenda-mode-map "t" 'org-agenda-todo) |
| 1369 | (org-defkey org-agenda-mode-map "a" 'org-agenda-toggle-archive-tag) | 1413 | (org-defkey org-agenda-mode-map "a" 'org-agenda-archive-default-with-confirmation) |
| 1370 | (org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags) | 1414 | (org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags) |
| 1371 | (org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags) | 1415 | (org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags) |
| 1372 | (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) | 1416 | (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) |
| @@ -1411,8 +1455,12 @@ The following commands are available: | |||
| 1411 | (org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) | 1455 | (org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) |
| 1412 | (org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) | 1456 | (org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) |
| 1413 | (org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) | 1457 | (org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) |
| 1414 | (org-defkey org-agenda-mode-map "n" 'next-line) | 1458 | (org-defkey org-agenda-mode-map "n" 'org-agenda-next-line) |
| 1415 | (org-defkey org-agenda-mode-map "p" 'previous-line) | 1459 | (org-defkey org-agenda-mode-map "p" 'org-agenda-previous-line) |
| 1460 | (substitute-key-definition 'next-line 'org-agenda-next-line | ||
| 1461 | org-agenda-mode-map global-map) | ||
| 1462 | (substitute-key-definition 'previous-line 'org-agenda-previous-line | ||
| 1463 | org-agenda-mode-map global-map) | ||
| 1416 | (org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach) | 1464 | (org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach) |
| 1417 | (org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line) | 1465 | (org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line) |
| 1418 | (org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line) | 1466 | (org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line) |
| @@ -1455,15 +1503,12 @@ The following commands are available: | |||
| 1455 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull) | 1503 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg" 'org-mobile-pull) |
| 1456 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push) | 1504 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp" 'org-mobile-push) |
| 1457 | 1505 | ||
| 1458 | (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) | 1506 | (org-defkey org-agenda-mode-map |
| 1459 | "Local keymap for agenda entries from Org-mode.") | ||
| 1460 | |||
| 1461 | (org-defkey org-agenda-keymap | ||
| 1462 | (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) | 1507 | (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) |
| 1463 | (org-defkey org-agenda-keymap | 1508 | (org-defkey org-agenda-mode-map |
| 1464 | (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) | 1509 | (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) |
| 1465 | (when org-agenda-mouse-1-follows-link | 1510 | (when org-agenda-mouse-1-follows-link |
| 1466 | (org-defkey org-agenda-keymap [follow-link] 'mouse-face)) | 1511 | (org-defkey org-agenda-mode-map [follow-link] 'mouse-face)) |
| 1467 | (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" | 1512 | (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" |
| 1468 | '("Agenda" | 1513 | '("Agenda" |
| 1469 | ("Agenda Files") | 1514 | ("Agenda Files") |
| @@ -1535,6 +1580,8 @@ The following commands are available: | |||
| 1535 | ["Previous TODO set" org-agenda-todo-previousset t] | 1580 | ["Previous TODO set" org-agenda-todo-previousset t] |
| 1536 | ["Add note" org-agenda-add-note t]) | 1581 | ["Add note" org-agenda-add-note t]) |
| 1537 | ("Archive/Refile/Delete" | 1582 | ("Archive/Refile/Delete" |
| 1583 | ["Archive default" org-agenda-archive-default t] | ||
| 1584 | ["Archive default" org-agenda-archive-default-with-confirmation t] | ||
| 1538 | ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t] | 1585 | ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t] |
| 1539 | ["Move to archive sibling" org-agenda-archive-to-archive-sibling t] | 1586 | ["Move to archive sibling" org-agenda-archive-to-archive-sibling t] |
| 1540 | ["Archive subtree" org-agenda-archive t] | 1587 | ["Archive subtree" org-agenda-archive t] |
| @@ -1684,7 +1731,7 @@ M Like `m', but select only TODO entries, no ordinary headlines. | |||
| 1684 | L Create a timeline for the current buffer. | 1731 | L Create a timeline for the current buffer. |
| 1685 | e Export views to associated files. | 1732 | e Export views to associated files. |
| 1686 | s Search entries for keywords. | 1733 | s Search entries for keywords. |
| 1687 | / Multi occur accros all agenda files and also files listed | 1734 | / Multi occur across all agenda files and also files listed |
| 1688 | in `org-agenda-text-search-extra-files'. | 1735 | in `org-agenda-text-search-extra-files'. |
| 1689 | < Restrict agenda commands to buffer, subtree, or region. | 1736 | < Restrict agenda commands to buffer, subtree, or region. |
| 1690 | Press several times to get the desired effect. | 1737 | Press several times to get the desired effect. |
| @@ -1727,7 +1774,7 @@ Pressing `<' twice means to restrict to the current subtree or region | |||
| 1727 | entry key type match lprops ans) | 1774 | entry key type match lprops ans) |
| 1728 | ;; Turn off restriction unless there is an overriding one, | 1775 | ;; Turn off restriction unless there is an overriding one, |
| 1729 | (unless org-agenda-overriding-restriction | 1776 | (unless org-agenda-overriding-restriction |
| 1730 | (unless (org-bound-and-true-p org-agenda-keep-restriced-file-list) | 1777 | (unless (org-bound-and-true-p org-agenda-keep-restricted-file-list) |
| 1731 | ;; There is a request to keep the file list in place | 1778 | ;; There is a request to keep the file list in place |
| 1732 | (put 'org-agenda-files 'org-restrict nil)) | 1779 | (put 'org-agenda-files 'org-restrict nil)) |
| 1733 | (setq org-agenda-restrict nil) | 1780 | (setq org-agenda-restrict nil) |
| @@ -1741,7 +1788,7 @@ Pressing `<' twice means to restrict to the current subtree or region | |||
| 1741 | (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) | 1788 | (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) |
| 1742 | keys (car ans) | 1789 | keys (car ans) |
| 1743 | restriction (cdr ans))) | 1790 | restriction (cdr ans))) |
| 1744 | ;; Estabish the restriction, if any | 1791 | ;; Establish the restriction, if any |
| 1745 | (when (and (not org-agenda-overriding-restriction) restriction) | 1792 | (when (and (not org-agenda-overriding-restriction) restriction) |
| 1746 | (put 'org-agenda-files 'org-restrict (list bfn)) | 1793 | (put 'org-agenda-files 'org-restrict (list bfn)) |
| 1747 | (cond | 1794 | (cond |
| @@ -1763,7 +1810,8 @@ Pressing `<' twice means to restrict to the current subtree or region | |||
| 1763 | ((setq entry (assoc keys org-agenda-custom-commands)) | 1810 | ((setq entry (assoc keys org-agenda-custom-commands)) |
| 1764 | (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) | 1811 | (if (or (symbolp (nth 2 entry)) (functionp (nth 2 entry))) |
| 1765 | (progn | 1812 | (progn |
| 1766 | (setq type (nth 2 entry) match (nth 3 entry) lprops (nth 4 entry)) | 1813 | (setq type (nth 2 entry) match (eval (nth 3 entry)) |
| 1814 | lprops (nth 4 entry)) | ||
| 1767 | (put 'org-agenda-redo-command 'org-lprops lprops) | 1815 | (put 'org-agenda-redo-command 'org-lprops lprops) |
| 1768 | (cond | 1816 | (cond |
| 1769 | ((eq type 'agenda) | 1817 | ((eq type 'agenda) |
| @@ -2006,7 +2054,7 @@ s Search for keywords C Configure custom agenda commands | |||
| 2006 | match ;; The byte compiler incorrectly complains about this. Keep it! | 2054 | match ;; The byte compiler incorrectly complains about this. Keep it! |
| 2007 | cmd type lprops) | 2055 | cmd type lprops) |
| 2008 | (while (setq cmd (pop cmds)) | 2056 | (while (setq cmd (pop cmds)) |
| 2009 | (setq type (car cmd) match (nth 1 cmd) lprops (nth 2 cmd)) | 2057 | (setq type (car cmd) match (eval (nth 1 cmd)) lprops (nth 2 cmd)) |
| 2010 | (cond | 2058 | (cond |
| 2011 | ((eq type 'agenda) | 2059 | ((eq type 'agenda) |
| 2012 | (org-let2 gprops lprops | 2060 | (org-let2 gprops lprops |
| @@ -2057,10 +2105,13 @@ before running the agenda command." | |||
| 2057 | (set-buffer org-agenda-buffer-name) | 2105 | (set-buffer org-agenda-buffer-name) |
| 2058 | (princ (org-encode-for-stdout (buffer-string))))) | 2106 | (princ (org-encode-for-stdout (buffer-string))))) |
| 2059 | 2107 | ||
| 2108 | ;(defun org-encode-for-stdout (string) | ||
| 2109 | ; (if (fboundp 'encode-coding-string) | ||
| 2110 | ; (encode-coding-string string buffer-file-coding-system) | ||
| 2111 | ; string)) | ||
| 2112 | |||
| 2060 | (defun org-encode-for-stdout (string) | 2113 | (defun org-encode-for-stdout (string) |
| 2061 | (if (fboundp 'encode-coding-string) | 2114 | string) |
| 2062 | (encode-coding-string string buffer-file-coding-system) | ||
| 2063 | string)) | ||
| 2064 | 2115 | ||
| 2065 | (defvar org-agenda-info nil) | 2116 | (defvar org-agenda-info nil) |
| 2066 | 2117 | ||
| @@ -2212,7 +2263,7 @@ so the export commands can easily use it." | |||
| 2212 | (put-text-property (point-at-bol) (point-at-eol) | 2263 | (put-text-property (point-at-bol) (point-at-eol) |
| 2213 | 'org-agenda-title-append org-agenda-title-append)))) | 2264 | 'org-agenda-title-append org-agenda-title-append)))) |
| 2214 | 2265 | ||
| 2215 | 2266 | (defvar org-mobile-creating-agendas) | |
| 2216 | (defun org-write-agenda (file &optional open nosettings) | 2267 | (defun org-write-agenda (file &optional open nosettings) |
| 2217 | "Write the current buffer (an agenda view) as a file. | 2268 | "Write the current buffer (an agenda view) as a file. |
| 2218 | Depending on the extension of the file name, plain text (.txt), | 2269 | Depending on the extension of the file name, plain text (.txt), |
| @@ -2220,7 +2271,7 @@ HTML (.html or .htm) or Postscript (.ps) is produced. | |||
| 2220 | If the extension is .ics, run icalendar export over all files used | 2271 | If the extension is .ics, run icalendar export over all files used |
| 2221 | to construct the agenda and limit the export to entries listed in the | 2272 | to construct the agenda and limit the export to entries listed in the |
| 2222 | agenda now. | 2273 | agenda now. |
| 2223 | With prefic argument OPEN, open the new file immediately. | 2274 | With prefix argument OPEN, open the new file immediately. |
| 2224 | If NOSETTINGS is given, do not scope the settings of | 2275 | If NOSETTINGS is given, do not scope the settings of |
| 2225 | `org-agenda-exporter-settings' into the export commands. This is used when | 2276 | `org-agenda-exporter-settings' into the export commands. This is used when |
| 2226 | the settings have already been scoped and we do not wish to overrule other, | 2277 | the settings have already been scoped and we do not wish to overrule other, |
| @@ -2235,7 +2286,7 @@ higher priority settings." | |||
| 2235 | '(save-excursion | 2286 | '(save-excursion |
| 2236 | (save-window-excursion | 2287 | (save-window-excursion |
| 2237 | (org-agenda-mark-filtered-text) | 2288 | (org-agenda-mark-filtered-text) |
| 2238 | (let ((bs (copy-sequence (buffer-string))) beg app) | 2289 | (let ((bs (copy-sequence (buffer-string))) beg) |
| 2239 | (org-agenda-unmark-filtered-text) | 2290 | (org-agenda-unmark-filtered-text) |
| 2240 | (with-temp-buffer | 2291 | (with-temp-buffer |
| 2241 | (insert bs) | 2292 | (insert bs) |
| @@ -2247,6 +2298,8 @@ higher priority settings." | |||
| 2247 | (point-max)))) | 2298 | (point-max)))) |
| 2248 | (run-hooks 'org-agenda-before-write-hook) | 2299 | (run-hooks 'org-agenda-before-write-hook) |
| 2249 | (cond | 2300 | (cond |
| 2301 | ((org-bound-and-true-p org-mobile-creating-agendas) | ||
| 2302 | (org-mobile-write-agenda-for-mobile file)) | ||
| 2250 | ((string-match "\\.html?\\'" file) | 2303 | ((string-match "\\.html?\\'" file) |
| 2251 | (set-buffer (htmlize-buffer (current-buffer))) | 2304 | (set-buffer (htmlize-buffer (current-buffer))) |
| 2252 | 2305 | ||
| @@ -2275,63 +2328,6 @@ higher priority settings." | |||
| 2275 | (concat (file-name-sans-extension file) ".ps")) | 2328 | (concat (file-name-sans-extension file) ".ps")) |
| 2276 | (expand-file-name file)) | 2329 | (expand-file-name file)) |
| 2277 | (message "PDF written to %s" file)) | 2330 | (message "PDF written to %s" file)) |
| 2278 | ((string-match "\\.org\\'" file) | ||
| 2279 | (let ((all (buffer-string)) in-date id pl prefix line) | ||
| 2280 | (with-temp-file file | ||
| 2281 | (org-mode) | ||
| 2282 | (insert all) | ||
| 2283 | (goto-char (point-min)) | ||
| 2284 | (while (not (eobp)) | ||
| 2285 | (cond | ||
| 2286 | ((looking-at "[ \t]*$")) ; keep empty lines | ||
| 2287 | ((looking-at "=+$") | ||
| 2288 | ;; remove underlining | ||
| 2289 | (delete-region (point) (point-at-eol))) | ||
| 2290 | ((get-text-property (point) 'org-agenda-structural-header) | ||
| 2291 | (setq in-date nil) | ||
| 2292 | (setq app (get-text-property (point) | ||
| 2293 | 'org-agenda-title-append)) | ||
| 2294 | (setq short (get-text-property (point) | ||
| 2295 | 'short-heading)) | ||
| 2296 | (when (and short (looking-at ".+")) | ||
| 2297 | (replace-match short) | ||
| 2298 | (beginning-of-line 1)) | ||
| 2299 | (when app | ||
| 2300 | (end-of-line 1) | ||
| 2301 | (insert app) | ||
| 2302 | (beginning-of-line 1)) | ||
| 2303 | (insert "* ")) | ||
| 2304 | ((get-text-property (point) 'org-agenda-date-header) | ||
| 2305 | (setq in-date t) | ||
| 2306 | (insert "** ")) | ||
| 2307 | ((setq m (or (get-text-property (point) 'org-hd-marker) | ||
| 2308 | (get-text-property (point) 'org-marker))) | ||
| 2309 | (if (setq pl (get-text-property (point) 'prefix-length)) | ||
| 2310 | (progn | ||
| 2311 | (setq prefix (org-trim (buffer-substring | ||
| 2312 | (point) (+ (point) pl))) | ||
| 2313 | line (org-trim (buffer-substring | ||
| 2314 | (+ (point) pl) | ||
| 2315 | (point-at-eol)))) | ||
| 2316 | (delete-region (point-at-bol) (point-at-eol)) | ||
| 2317 | (insert line "<break>" prefix) | ||
| 2318 | (beginning-of-line 1)) | ||
| 2319 | (and (looking-at "[ \t]+") (replace-match ""))) | ||
| 2320 | (insert (if in-date "*** " "** ")) | ||
| 2321 | (end-of-line 1) | ||
| 2322 | (insert "\n") | ||
| 2323 | (insert (org-agenda-get-some-entry-text | ||
| 2324 | m 10 " " 'planning) | ||
| 2325 | "\n") | ||
| 2326 | (when (setq id | ||
| 2327 | (if (org-bound-and-true-p | ||
| 2328 | org-mobile-force-id-on-agenda-items) | ||
| 2329 | (org-id-get m 'create) | ||
| 2330 | (org-entry-get m "ID"))) | ||
| 2331 | (insert " :PROPERTIES:\n :ORIGINAL_ID: " id | ||
| 2332 | "\n :END:\n")))) | ||
| 2333 | (beginning-of-line 2))) | ||
| 2334 | (message "Agenda written to Org file %s" file))) | ||
| 2335 | ((string-match "\\.ics\\'" file) | 2331 | ((string-match "\\.ics\\'" file) |
| 2336 | (require 'org-icalendar) | 2332 | (require 'org-icalendar) |
| 2337 | (let ((org-agenda-marker-table | 2333 | (let ((org-agenda-marker-table |
| @@ -2386,7 +2382,8 @@ VALUE defaults to t." | |||
| 2386 | This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the | 2382 | This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the |
| 2387 | entry text following headings shown in the agenda. | 2383 | entry text following headings shown in the agenda. |
| 2388 | Drawers will be excluded, also the line with scheduling/deadline info." | 2384 | Drawers will be excluded, also the line with scheduling/deadline info." |
| 2389 | (when (> org-agenda-add-entry-text-maxlines 0) | 2385 | (when (and (> org-agenda-add-entry-text-maxlines 0) |
| 2386 | (not (org-bound-and-true-p org-mobile-creating-agendas))) | ||
| 2390 | (let (m txt) | 2387 | (let (m txt) |
| 2391 | (goto-char (point-min)) | 2388 | (goto-char (point-min)) |
| 2392 | (while (not (eobp)) | 2389 | (while (not (eobp)) |
| @@ -2402,7 +2399,7 @@ Drawers will be excluded, also the line with scheduling/deadline info." | |||
| 2402 | "Extract entry text from MARKER, at most N-LINES lines. | 2399 | "Extract entry text from MARKER, at most N-LINES lines. |
| 2403 | This will ignore drawers etc, just get the text. | 2400 | This will ignore drawers etc, just get the text. |
| 2404 | If INDENT is given, prefix every line with this string. If KEEP is | 2401 | If INDENT is given, prefix every line with this string. If KEEP is |
| 2405 | given, it is a list of symbols, defining stuff that hould not be | 2402 | given, it is a list of symbols, defining stuff that should not be |
| 2406 | removed from the entry content. Currently only `planning' is allowed here." | 2403 | removed from the entry content. Currently only `planning' is allowed here." |
| 2407 | (let (txt drawer-re kwd-time-re ind) | 2404 | (let (txt drawer-re kwd-time-re ind) |
| 2408 | (save-excursion | 2405 | (save-excursion |
| @@ -2626,6 +2623,8 @@ bind it in the options section.") | |||
| 2626 | (when org-agenda-entry-text-mode | 2623 | (when org-agenda-entry-text-mode |
| 2627 | (org-agenda-entry-text-hide) | 2624 | (org-agenda-entry-text-hide) |
| 2628 | (org-agenda-entry-text-show)) | 2625 | (org-agenda-entry-text-show)) |
| 2626 | (if (functionp 'org-habit-insert-consistency-graphs) | ||
| 2627 | (org-habit-insert-consistency-graphs)) | ||
| 2629 | (run-hooks 'org-finalize-agenda-hook) | 2628 | (run-hooks 'org-finalize-agenda-hook) |
| 2630 | (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) | 2629 | (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) |
| 2631 | (when (get 'org-agenda-filter :preset-filter) | 2630 | (when (get 'org-agenda-filter :preset-filter) |
| @@ -2783,7 +2782,7 @@ no longer in use." | |||
| 2783 | ;;; Entry text mode | 2782 | ;;; Entry text mode |
| 2784 | 2783 | ||
| 2785 | (defun org-agenda-entry-text-show-here () | 2784 | (defun org-agenda-entry-text-show-here () |
| 2786 | "Add some text from te entry as context to the current line." | 2785 | "Add some text from the entry as context to the current line." |
| 2787 | (let (m txt o) | 2786 | (let (m txt o) |
| 2788 | (setq m (org-get-at-bol 'org-hd-marker)) | 2787 | (setq m (org-get-at-bol 'org-hd-marker)) |
| 2789 | (unless (marker-buffer m) | 2788 | (unless (marker-buffer m) |
| @@ -3054,6 +3053,7 @@ given in `org-agenda-start-on-weekday'." | |||
| 3054 | (add-text-properties (point-min) (1- (point)) | 3053 | (add-text-properties (point-min) (1- (point)) |
| 3055 | (list 'face 'org-agenda-structure | 3054 | (list 'face 'org-agenda-structure |
| 3056 | 'short-heading "All TODO items")) | 3055 | 'short-heading "All TODO items")) |
| 3056 | (org-agenda-mark-header-line (point-min)) | ||
| 3057 | (insert (org-finalize-agenda-entries rtnall) "\n"))) | 3057 | (insert (org-finalize-agenda-entries rtnall) "\n"))) |
| 3058 | (unless org-agenda-compact-blocks | 3058 | (unless org-agenda-compact-blocks |
| 3059 | (let* ((d1 (car day-numbers)) | 3059 | (let* ((d1 (car day-numbers)) |
| @@ -3193,10 +3193,19 @@ user should get a chance to edit this string, with cursor at position | |||
| 3193 | EDIT-AT. | 3193 | EDIT-AT. |
| 3194 | 3194 | ||
| 3195 | The search string is broken into \"words\" by splitting at whitespace. | 3195 | The search string is broken into \"words\" by splitting at whitespace. |
| 3196 | The individual words are then interpreted as a boolean expression with | 3196 | Depending on the variable `org-agenda-search-view-search-words-only' |
| 3197 | logical AND. Words prefixed with a minus must not occur in the entry. | 3197 | and on whether the first character in the search string is \"+\" or \"-\", |
| 3198 | Words without a prefix or prefixed with a plus must occur in the entry. | 3198 | The string is then interpreted either as a substring with variable amounts |
| 3199 | Matching is case-insensitive and the words are enclosed by word delimiters. | 3199 | of whitespace, or as a list or individual words that should be matched. |
| 3200 | |||
| 3201 | The default is a substring match, where each space in the search string | ||
| 3202 | can expand to an arbitrary amount of whitespace, including newlines. | ||
| 3203 | |||
| 3204 | If matching individual words, these words are then interpreted as a | ||
| 3205 | boolean expression with logical AND. Words prefixed with a minus must | ||
| 3206 | not occur in the entry. Words without a prefix or prefixed with a plus | ||
| 3207 | must occur in the entry. Matching is case-insensitive and the words | ||
| 3208 | are enclosed by word delimiters. | ||
| 3200 | 3209 | ||
| 3201 | Words enclosed by curly braces are interpreted as regular expressions | 3210 | Words enclosed by curly braces are interpreted as regular expressions |
| 3202 | that must or must not match in the entry. | 3211 | that must or must not match in the entry. |
| @@ -3218,10 +3227,9 @@ in `org-agenda-text-search-extra-files'." | |||
| 3218 | 'org-todo-regexp org-todo-regexp | 3227 | 'org-todo-regexp org-todo-regexp |
| 3219 | 'org-complex-heading-regexp org-complex-heading-regexp | 3228 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 3220 | 'mouse-face 'highlight | 3229 | 'mouse-face 'highlight |
| 3221 | 'keymap org-agenda-keymap | ||
| 3222 | 'help-echo (format "mouse-2 or RET jump to location"))) | 3230 | 'help-echo (format "mouse-2 or RET jump to location"))) |
| 3223 | regexp rtn rtnall files file pos | 3231 | regexp rtn rtnall files file pos |
| 3224 | marker category tags c neg re | 3232 | marker category tags c neg re as-words |
| 3225 | ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) | 3233 | ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) |
| 3226 | (unless (and (not edit-at) | 3234 | (unless (and (not edit-at) |
| 3227 | (stringp string) | 3235 | (stringp string) |
| @@ -3244,19 +3252,25 @@ in `org-agenda-text-search-extra-files'." | |||
| 3244 | (when (equal (string-to-char words) ?!) | 3252 | (when (equal (string-to-char words) ?!) |
| 3245 | (setq todo-only t | 3253 | (setq todo-only t |
| 3246 | words (substring words 1))) | 3254 | words (substring words 1))) |
| 3255 | (if (or org-agenda-search-view-search-words-only | ||
| 3256 | (member (string-to-char string) '(?- ?+))) | ||
| 3257 | (setq as-words t)) | ||
| 3247 | (setq words (org-split-string words)) | 3258 | (setq words (org-split-string words)) |
| 3248 | (mapc (lambda (w) | 3259 | (if as-words |
| 3249 | (setq c (string-to-char w)) | 3260 | (mapc (lambda (w) |
| 3250 | (if (equal c ?-) | 3261 | (setq c (string-to-char w)) |
| 3251 | (setq neg t w (substring w 1)) | 3262 | (if (equal c ?-) |
| 3252 | (if (equal c ?+) | 3263 | (setq neg t w (substring w 1)) |
| 3253 | (setq neg nil w (substring w 1)) | 3264 | (if (equal c ?+) |
| 3254 | (setq neg nil))) | 3265 | (setq neg nil w (substring w 1)) |
| 3255 | (if (string-match "\\`{.*}\\'" w) | 3266 | (setq neg nil))) |
| 3256 | (setq re (substring w 1 -1)) | 3267 | (if (string-match "\\`{.*}\\'" w) |
| 3257 | (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) | 3268 | (setq re (substring w 1 -1)) |
| 3258 | (if neg (push re regexps-) (push re regexps+))) | 3269 | (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) |
| 3259 | words) | 3270 | (if neg (push re regexps-) (push re regexps+))) |
| 3271 | words) | ||
| 3272 | (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") | ||
| 3273 | regexps+)) | ||
| 3260 | (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) | 3274 | (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b))))) |
| 3261 | (if (not regexps+) | 3275 | (if (not regexps+) |
| 3262 | (setq regexp (concat "^" org-outline-regexp)) | 3276 | (setq regexp (concat "^" org-outline-regexp)) |
| @@ -3760,7 +3774,6 @@ date. It also removes lines that contain only whitespace." | |||
| 3760 | "Add text properties to string, allowing org-mode to act on it." | 3774 | "Add text properties to string, allowing org-mode to act on it." |
| 3761 | (org-add-props string nil | 3775 | (org-add-props string nil |
| 3762 | 'mouse-face 'highlight | 3776 | 'mouse-face 'highlight |
| 3763 | 'keymap org-agenda-keymap | ||
| 3764 | 'help-echo (if buffer-file-name | 3777 | 'help-echo (if buffer-file-name |
| 3765 | (format "mouse-2 or RET jump to diary file %s" | 3778 | (format "mouse-2 or RET jump to diary file %s" |
| 3766 | (abbreviate-file-name buffer-file-name)) | 3779 | (abbreviate-file-name buffer-file-name)) |
| @@ -3913,7 +3926,6 @@ the documentation of `org-diary'." | |||
| 3913 | 'org-todo-regexp org-todo-regexp | 3926 | 'org-todo-regexp org-todo-regexp |
| 3914 | 'org-complex-heading-regexp org-complex-heading-regexp | 3927 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 3915 | 'mouse-face 'highlight | 3928 | 'mouse-face 'highlight |
| 3916 | 'keymap org-agenda-keymap | ||
| 3917 | 'help-echo | 3929 | 'help-echo |
| 3918 | (format "mouse-2 or RET jump to org file %s" | 3930 | (format "mouse-2 or RET jump to org file %s" |
| 3919 | (abbreviate-file-name buffer-file-name)))) | 3931 | (abbreviate-file-name buffer-file-name)))) |
| @@ -3984,7 +3996,6 @@ the documentation of `org-diary'." | |||
| 3984 | 'org-todo-regexp org-todo-regexp | 3996 | 'org-todo-regexp org-todo-regexp |
| 3985 | 'org-complex-heading-regexp org-complex-heading-regexp | 3997 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 3986 | 'mouse-face 'highlight | 3998 | 'mouse-face 'highlight |
| 3987 | 'keymap org-agenda-keymap | ||
| 3988 | 'help-echo | 3999 | 'help-echo |
| 3989 | (format "mouse-2 or RET jump to org file %s" | 4000 | (format "mouse-2 or RET jump to org file %s" |
| 3990 | (abbreviate-file-name buffer-file-name)))) | 4001 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4078,7 +4089,6 @@ the documentation of `org-diary'." | |||
| 4078 | (require 'diary-lib) | 4089 | (require 'diary-lib) |
| 4079 | (let* ((props (list 'face nil | 4090 | (let* ((props (list 'face nil |
| 4080 | 'mouse-face 'highlight | 4091 | 'mouse-face 'highlight |
| 4081 | 'keymap org-agenda-keymap | ||
| 4082 | 'help-echo | 4092 | 'help-echo |
| 4083 | (format "mouse-2 or RET jump to org file %s" | 4093 | (format "mouse-2 or RET jump to org file %s" |
| 4084 | (abbreviate-file-name buffer-file-name)))) | 4094 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4123,7 +4133,6 @@ the documentation of `org-diary'." | |||
| 4123 | 'org-not-done-regexp org-not-done-regexp | 4133 | 'org-not-done-regexp org-not-done-regexp |
| 4124 | 'org-todo-regexp org-todo-regexp | 4134 | 'org-todo-regexp org-todo-regexp |
| 4125 | 'org-complex-heading-regexp org-complex-heading-regexp | 4135 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 4126 | 'keymap org-agenda-keymap | ||
| 4127 | 'help-echo | 4136 | 'help-echo |
| 4128 | (format "mouse-2 or RET jump to org file %s" | 4137 | (format "mouse-2 or RET jump to org file %s" |
| 4129 | (abbreviate-file-name buffer-file-name)))) | 4138 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4217,7 +4226,6 @@ the documentation of `org-diary'." | |||
| 4217 | 'org-not-done-regexp org-not-done-regexp | 4226 | 'org-not-done-regexp org-not-done-regexp |
| 4218 | 'org-todo-regexp org-todo-regexp | 4227 | 'org-todo-regexp org-todo-regexp |
| 4219 | 'org-complex-heading-regexp org-complex-heading-regexp | 4228 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 4220 | 'keymap org-agenda-keymap | ||
| 4221 | 'help-echo | 4229 | 'help-echo |
| 4222 | (format "mouse-2 or RET jump to org file %s" | 4230 | (format "mouse-2 or RET jump to org file %s" |
| 4223 | (abbreviate-file-name buffer-file-name)))) | 4231 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4243,9 +4251,9 @@ the documentation of `org-diary'." | |||
| 4243 | ;; When to show a deadline in the calendar: | 4251 | ;; When to show a deadline in the calendar: |
| 4244 | ;; If the expiration is within wdays warning time. | 4252 | ;; If the expiration is within wdays warning time. |
| 4245 | ;; Past-due deadlines are only shown on the current date | 4253 | ;; Past-due deadlines are only shown on the current date |
| 4246 | (if (or (and (<= diff wdays) | 4254 | (if (and (or (and (<= diff wdays) |
| 4247 | (and todayp (not org-agenda-only-exact-dates))) | 4255 | (and todayp (not org-agenda-only-exact-dates))) |
| 4248 | (= diff 0)) | 4256 | (= diff 0))) |
| 4249 | (save-excursion | 4257 | (save-excursion |
| 4250 | (setq todo-state (org-get-todo-state)) | 4258 | (setq todo-state (org-get-todo-state)) |
| 4251 | (setq donep (member todo-state org-done-keywords)) | 4259 | (setq donep (member todo-state org-done-keywords)) |
| @@ -4311,7 +4319,6 @@ FRACTION is what fraction of the head-warning time has passed." | |||
| 4311 | 'org-complex-heading-regexp org-complex-heading-regexp | 4319 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 4312 | 'done-face 'org-agenda-done | 4320 | 'done-face 'org-agenda-done |
| 4313 | 'mouse-face 'highlight | 4321 | 'mouse-face 'highlight |
| 4314 | 'keymap org-agenda-keymap | ||
| 4315 | 'help-echo | 4322 | 'help-echo |
| 4316 | (format "mouse-2 or RET jump to org file %s" | 4323 | (format "mouse-2 or RET jump to org file %s" |
| 4317 | (abbreviate-file-name buffer-file-name)))) | 4324 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4321,11 +4328,11 @@ FRACTION is what fraction of the head-warning time has passed." | |||
| 4321 | mm | 4328 | mm |
| 4322 | (deadline-position-alist | 4329 | (deadline-position-alist |
| 4323 | (mapcar (lambda (a) (and (setq mm (get-text-property | 4330 | (mapcar (lambda (a) (and (setq mm (get-text-property |
| 4324 | 0 'org-hd-marker a)) | 4331 | 0 'org-hd-marker a)) |
| 4325 | (cons (marker-position mm) a))) | 4332 | (cons (marker-position mm) a))) |
| 4326 | deadline-results)) | 4333 | deadline-results)) |
| 4327 | d2 diff pos pos1 category tags donep | 4334 | d2 diff pos pos1 category tags donep |
| 4328 | ee txt head pastschedp todo-state face timestr s) | 4335 | ee txt head pastschedp todo-state face timestr s habitp) |
| 4329 | (goto-char (point-min)) | 4336 | (goto-char (point-min)) |
| 4330 | (while (re-search-forward regexp nil t) | 4337 | (while (re-search-forward regexp nil t) |
| 4331 | (catch :skip | 4338 | (catch :skip |
| @@ -4340,60 +4347,73 @@ FRACTION is what fraction of the head-warning time has passed." | |||
| 4340 | (setq pastschedp (and todayp (< diff 0))) | 4347 | (setq pastschedp (and todayp (< diff 0))) |
| 4341 | ;; When to show a scheduled item in the calendar: | 4348 | ;; When to show a scheduled item in the calendar: |
| 4342 | ;; If it is on or past the date. | 4349 | ;; If it is on or past the date. |
| 4343 | (if (or (and (< diff 0) | 4350 | (when (or (and (< diff 0) |
| 4344 | (< (abs diff) org-scheduled-past-days) | 4351 | (< (abs diff) org-scheduled-past-days) |
| 4345 | (and todayp (not org-agenda-only-exact-dates))) | 4352 | (and todayp (not org-agenda-only-exact-dates))) |
| 4346 | (= diff 0)) | 4353 | (= diff 0)) |
| 4347 | (save-excursion | 4354 | (save-excursion |
| 4348 | (setq todo-state (org-get-todo-state)) | 4355 | (setq todo-state (org-get-todo-state)) |
| 4349 | (setq donep (member todo-state org-done-keywords)) | 4356 | (setq donep (member todo-state org-done-keywords)) |
| 4350 | (if (and donep | 4357 | (setq habitp (and (functionp 'org-is-habit-p) |
| 4351 | (or org-agenda-skip-scheduled-if-done | 4358 | (org-is-habit-p))) |
| 4352 | (not (= diff 0)))) | 4359 | (if (and donep |
| 4353 | (setq txt nil) | 4360 | (or habitp org-agenda-skip-scheduled-if-done |
| 4354 | (setq category (org-get-category)) | 4361 | (not (= diff 0)))) |
| 4355 | (if (not (re-search-backward "^\\*+[ \t]+" nil t)) | 4362 | (setq txt nil) |
| 4356 | (setq txt org-agenda-no-heading-message) | 4363 | (setq category (org-get-category)) |
| 4357 | (goto-char (match-end 0)) | 4364 | (if (not (re-search-backward "^\\*+[ \t]+" nil t)) |
| 4358 | (setq pos1 (match-beginning 0)) | 4365 | (setq txt org-agenda-no-heading-message) |
| 4366 | (goto-char (match-end 0)) | ||
| 4367 | (setq pos1 (match-beginning 0)) | ||
| 4368 | (if habitp | ||
| 4369 | (if (or (not org-habit-show-habits) | ||
| 4370 | (and (not todayp) | ||
| 4371 | org-habit-show-habits-only-for-today)) | ||
| 4372 | (throw :skip nil)) | ||
| 4359 | (if (and | 4373 | (if (and |
| 4360 | (or (eq t org-agenda-skip-scheduled-if-deadline-is-shown) | 4374 | (or (eq t org-agenda-skip-scheduled-if-deadline-is-shown) |
| 4361 | (and org-agenda-skip-scheduled-if-deadline-is-shown | 4375 | (and org-agenda-skip-scheduled-if-deadline-is-shown |
| 4362 | pastschedp)) | 4376 | pastschedp)) |
| 4363 | (setq mm (assoc pos1 deadline-position-alist))) | 4377 | (setq mm (assoc pos1 deadline-position-alist))) |
| 4364 | (throw :skip nil)) | 4378 | (throw :skip nil))) |
| 4365 | (setq tags (org-get-tags-at)) | 4379 | (setq tags (org-get-tags-at)) |
| 4366 | (setq head (buffer-substring-no-properties | 4380 | (setq head (buffer-substring-no-properties |
| 4367 | (point) | 4381 | (point) |
| 4368 | (progn (skip-chars-forward "^\r\n") (point)))) | 4382 | (progn (skip-chars-forward "^\r\n") (point)))) |
| 4369 | (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) | 4383 | (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) |
| 4370 | (setq timestr | 4384 | (setq timestr |
| 4371 | (concat (substring s (match-beginning 1)) " ")) | 4385 | (concat (substring s (match-beginning 1)) " ")) |
| 4372 | (setq timestr 'time)) | 4386 | (setq timestr 'time)) |
| 4373 | (setq txt (org-format-agenda-item | 4387 | (setq txt (org-format-agenda-item |
| 4374 | (if (= diff 0) | 4388 | (if (= diff 0) |
| 4375 | (car org-agenda-scheduled-leaders) | 4389 | (car org-agenda-scheduled-leaders) |
| 4376 | (format (nth 1 org-agenda-scheduled-leaders) | 4390 | (format (nth 1 org-agenda-scheduled-leaders) |
| 4377 | (- 1 diff))) | 4391 | (- 1 diff))) |
| 4378 | head category tags | 4392 | head category tags |
| 4379 | (if (not (= diff 0)) nil timestr))))) | 4393 | (if (not (= diff 0)) nil timestr) |
| 4380 | (when txt | 4394 | nil nil habitp)))) |
| 4381 | (setq face | 4395 | (when txt |
| 4382 | (cond | 4396 | (setq face |
| 4383 | (pastschedp 'org-scheduled-previously) | 4397 | (cond |
| 4384 | (todayp 'org-scheduled-today) | 4398 | ((and (not habitp) pastschedp) |
| 4385 | (t 'org-scheduled))) | 4399 | 'org-scheduled-previously) |
| 4386 | (org-add-props txt props | 4400 | (todayp 'org-scheduled-today) |
| 4387 | 'undone-face face | 4401 | (t 'org-scheduled)) |
| 4388 | 'face (if donep 'org-agenda-done face) | 4402 | habitp (and habitp (org-habit-parse-todo))) |
| 4389 | 'org-marker (org-agenda-new-marker pos) | 4403 | (org-add-props txt props |
| 4390 | 'org-hd-marker (org-agenda-new-marker pos1) | 4404 | 'undone-face face |
| 4391 | 'type (if pastschedp "past-scheduled" "scheduled") | 4405 | 'face (if donep 'org-agenda-done face) |
| 4392 | 'date (if pastschedp d2 date) | 4406 | 'org-marker (org-agenda-new-marker pos) |
| 4393 | 'priority (+ 94 (- 5 diff) (org-get-priority txt)) | 4407 | 'org-hd-marker (org-agenda-new-marker pos1) |
| 4394 | 'org-category category | 4408 | 'type (if pastschedp "past-scheduled" "scheduled") |
| 4395 | 'todo-state todo-state) | 4409 | 'date (if pastschedp d2 date) |
| 4396 | (push txt ee)))))) | 4410 | 'priority (if habitp |
| 4411 | (org-habit-get-priority habitp) | ||
| 4412 | (+ 94 (- 5 diff) (org-get-priority txt))) | ||
| 4413 | 'org-category category | ||
| 4414 | 'org-habit-p habitp | ||
| 4415 | 'todo-state todo-state) | ||
| 4416 | (push txt ee)))))) | ||
| 4397 | (nreverse ee))) | 4417 | (nreverse ee))) |
| 4398 | 4418 | ||
| 4399 | (defun org-agenda-get-blocks () | 4419 | (defun org-agenda-get-blocks () |
| @@ -4403,7 +4423,6 @@ FRACTION is what fraction of the head-warning time has passed." | |||
| 4403 | 'org-todo-regexp org-todo-regexp | 4423 | 'org-todo-regexp org-todo-regexp |
| 4404 | 'org-complex-heading-regexp org-complex-heading-regexp | 4424 | 'org-complex-heading-regexp org-complex-heading-regexp |
| 4405 | 'mouse-face 'highlight | 4425 | 'mouse-face 'highlight |
| 4406 | 'keymap org-agenda-keymap | ||
| 4407 | 'help-echo | 4426 | 'help-echo |
| 4408 | (format "mouse-2 or RET jump to org file %s" | 4427 | (format "mouse-2 or RET jump to org file %s" |
| 4409 | (abbreviate-file-name buffer-file-name)))) | 4428 | (abbreviate-file-name buffer-file-name)))) |
| @@ -4468,9 +4487,11 @@ The flag is set if the currently compiled format contains a `%T'.") | |||
| 4468 | The flag is set if the currently compiled format contains a `%e'.") | 4487 | The flag is set if the currently compiled format contains a `%e'.") |
| 4469 | (defvar org-prefix-category-length nil | 4488 | (defvar org-prefix-category-length nil |
| 4470 | "Used by `org-compile-prefix-format' to remember the category field widh.") | 4489 | "Used by `org-compile-prefix-format' to remember the category field widh.") |
| 4490 | (defvar org-prefix-category-max-length nil | ||
| 4491 | "Used by `org-compile-prefix-format' to remember the category field widh.") | ||
| 4471 | 4492 | ||
| 4472 | (defun org-format-agenda-item (extra txt &optional category tags dotime | 4493 | (defun org-format-agenda-item (extra txt &optional category tags dotime |
| 4473 | noprefix remove-re) | 4494 | noprefix remove-re habitp) |
| 4474 | "Format TXT to be inserted into the agenda buffer. | 4495 | "Format TXT to be inserted into the agenda buffer. |
| 4475 | In particular, it adds the prefix and corresponding text properties. EXTRA | 4496 | In particular, it adds the prefix and corresponding text properties. EXTRA |
| 4476 | must be a string and replaces the `%s' specifier in the prefix format. | 4497 | must be a string and replaces the `%s' specifier in the prefix format. |
| @@ -4503,7 +4524,7 @@ Any match of REMOVE-RE will be removed from TXT." | |||
| 4503 | (and org-agenda-search-headline-for-time txt)))) | 4524 | (and org-agenda-search-headline-for-time txt)))) |
| 4504 | (time-of-day (and dotime (org-get-time-of-day ts))) | 4525 | (time-of-day (and dotime (org-get-time-of-day ts))) |
| 4505 | stamp plain s0 s1 s2 t1 t2 rtn srp l | 4526 | stamp plain s0 s1 s2 t1 t2 rtn srp l |
| 4506 | duration) | 4527 | duration thecategory) |
| 4507 | (and (org-mode-p) buffer-file-name | 4528 | (and (org-mode-p) buffer-file-name |
| 4508 | (add-to-list 'org-agenda-contributing-files buffer-file-name)) | 4529 | (add-to-list 'org-agenda-contributing-files buffer-file-name)) |
| 4509 | (when (and dotime time-of-day) | 4530 | (when (and dotime time-of-day) |
| @@ -4583,24 +4604,29 @@ Any match of REMOVE-RE will be removed from TXT." | |||
| 4583 | (setq time (cond (s2 (concat s1 "-" s2)) | 4604 | (setq time (cond (s2 (concat s1 "-" s2)) |
| 4584 | (s1 (concat s1 "......")) | 4605 | (s1 (concat s1 "......")) |
| 4585 | (t "")) | 4606 | (t "")) |
| 4586 | extra (or extra "") | 4607 | extra (or (and (not habitp) extra) "") |
| 4587 | category (if (symbolp category) (symbol-name category) category)) | 4608 | category (if (symbolp category) (symbol-name category) category) |
| 4588 | (when (string-match org-bracket-link-regexp category) | 4609 | thecategory (copy-sequence category)) |
| 4589 | (setq l (if (match-end 3) | 4610 | (if (string-match org-bracket-link-regexp category) |
| 4590 | (- (match-end 3) (match-beginning 3)) | 4611 | (progn |
| 4591 | (- (match-end 1) (match-beginning 1)))) | 4612 | (setq l (if (match-end 3) |
| 4592 | (when (< l (or org-prefix-category-length 0)) | 4613 | (- (match-end 3) (match-beginning 3)) |
| 4593 | (setq category (copy-sequence category)) | 4614 | (- (match-end 1) (match-beginning 1)))) |
| 4594 | (org-add-props category nil | 4615 | (when (< l (or org-prefix-category-length 0)) |
| 4595 | 'extra-space (make-string | 4616 | (setq category (copy-sequence category)) |
| 4596 | (- org-prefix-category-length l 1) ?\ )))) | 4617 | (org-add-props category nil |
| 4618 | 'extra-space (make-string | ||
| 4619 | (- org-prefix-category-length l 1) ?\ )))) | ||
| 4620 | (if (and org-prefix-category-max-length | ||
| 4621 | (>= (length category) org-prefix-category-max-length)) | ||
| 4622 | (setq category (substring category 0 (1- org-prefix-category-max-length))))) | ||
| 4597 | ;; Evaluate the compiled format | 4623 | ;; Evaluate the compiled format |
| 4598 | (setq rtn (concat (eval org-prefix-format-compiled) txt))) | 4624 | (setq rtn (concat (eval org-prefix-format-compiled) txt))) |
| 4599 | 4625 | ||
| 4600 | ;; And finally add the text properties | 4626 | ;; And finally add the text properties |
| 4601 | (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) | 4627 | (remove-text-properties 0 (length rtn) '(line-prefix t wrap-prefix t) rtn) |
| 4602 | (org-add-props rtn nil | 4628 | (org-add-props rtn nil |
| 4603 | 'org-category (downcase category) | 4629 | 'org-category (if thecategory (downcase thecategory) category) |
| 4604 | 'tags (mapcar 'org-downcase-keep-props tags) | 4630 | 'tags (mapcar 'org-downcase-keep-props tags) |
| 4605 | 'org-highest-priority org-highest-priority | 4631 | 'org-highest-priority org-highest-priority |
| 4606 | 'org-lowest-priority org-lowest-priority | 4632 | 'org-lowest-priority org-lowest-priority |
| @@ -4701,10 +4727,15 @@ The resulting form is returned and stored in the variable | |||
| 4701 | (if (equal var 'time) (setq org-prefix-has-time t)) | 4727 | (if (equal var 'time) (setq org-prefix-has-time t)) |
| 4702 | (if (equal var 'tag) (setq org-prefix-has-tag t)) | 4728 | (if (equal var 'tag) (setq org-prefix-has-tag t)) |
| 4703 | (if (equal var 'effort) (setq org-prefix-has-effort t)) | 4729 | (if (equal var 'effort) (setq org-prefix-has-effort t)) |
| 4704 | (if (equal var 'category) | ||
| 4705 | (setq org-prefix-category-length | ||
| 4706 | (abs (string-to-number (match-string 2 s))))) | ||
| 4707 | (setq f (concat "%" (match-string 2 s) "s")) | 4730 | (setq f (concat "%" (match-string 2 s) "s")) |
| 4731 | (when (equal var 'category) | ||
| 4732 | (setq org-prefix-category-length | ||
| 4733 | (floor (abs (string-to-number (match-string 2 s))))) | ||
| 4734 | (setq org-prefix-category-max-length | ||
| 4735 | (let ((x (match-string 2 s))) | ||
| 4736 | (save-match-data | ||
| 4737 | (if (string-match "\\.[0-9]+" x) | ||
| 4738 | (string-to-number (substring (match-string 0 x) 1))))))) | ||
| 4708 | (if opt | 4739 | (if opt |
| 4709 | (setq varform | 4740 | (setq varform |
| 4710 | `(if (equal "" ,var) | 4741 | `(if (equal "" ,var) |
| @@ -4856,6 +4887,14 @@ HH:MM." | |||
| 4856 | ((< tb ta) +1) | 4887 | ((< tb ta) +1) |
| 4857 | (t nil)))) | 4888 | (t nil)))) |
| 4858 | 4889 | ||
| 4890 | (defsubst org-cmp-habit-p (a b) | ||
| 4891 | "Compare the todo states of strings A and B." | ||
| 4892 | (let ((ha (get-text-property 1 'org-habit-p a)) | ||
| 4893 | (hb (get-text-property 1 'org-habit-p b))) | ||
| 4894 | (cond ((and ha (not hb)) -1) | ||
| 4895 | ((and (not ha) hb) +1) | ||
| 4896 | (t nil)))) | ||
| 4897 | |||
| 4859 | (defun org-entries-lessp (a b) | 4898 | (defun org-entries-lessp (a b) |
| 4860 | "Predicate for sorting agenda entries." | 4899 | "Predicate for sorting agenda entries." |
| 4861 | ;; The following variables will be used when the form is evaluated. | 4900 | ;; The following variables will be used when the form is evaluated. |
| @@ -4873,6 +4912,8 @@ HH:MM." | |||
| 4873 | (tag-down (if tag-up (- tag-up) nil)) | 4912 | (tag-down (if tag-up (- tag-up) nil)) |
| 4874 | (todo-state-up (org-cmp-todo-state a b)) | 4913 | (todo-state-up (org-cmp-todo-state a b)) |
| 4875 | (todo-state-down (if todo-state-up (- todo-state-up) nil)) | 4914 | (todo-state-down (if todo-state-up (- todo-state-up) nil)) |
| 4915 | (habit-up (org-cmp-habit-p a b)) | ||
| 4916 | (habit-down (if habit-up (- habit-up) nil)) | ||
| 4876 | user-defined-up user-defined-down) | 4917 | user-defined-up user-defined-down) |
| 4877 | (if (and org-agenda-cmp-user-defined | 4918 | (if (and org-agenda-cmp-user-defined |
| 4878 | (functionp org-agenda-cmp-user-defined)) | 4919 | (functionp org-agenda-cmp-user-defined)) |
| @@ -4886,7 +4927,7 @@ HH:MM." | |||
| 4886 | ;;; Agenda restriction lock | 4927 | ;;; Agenda restriction lock |
| 4887 | 4928 | ||
| 4888 | (defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1) | 4929 | (defvar org-agenda-restriction-lock-overlay (org-make-overlay 1 1) |
| 4889 | "Overlay to mark the headline to which arenda commands are restricted.") | 4930 | "Overlay to mark the headline to which agenda commands are restricted.") |
| 4890 | (org-overlay-put org-agenda-restriction-lock-overlay | 4931 | (org-overlay-put org-agenda-restriction-lock-overlay |
| 4891 | 'face 'org-agenda-restriction-lock) | 4932 | 'face 'org-agenda-restriction-lock) |
| 4892 | (org-overlay-put org-agenda-restriction-lock-overlay | 4933 | (org-overlay-put org-agenda-restriction-lock-overlay |
| @@ -5044,22 +5085,26 @@ used to narrow the search - the interactive user can also press `-' or `+' | |||
| 5044 | to switch to narrowing." | 5085 | to switch to narrowing." |
| 5045 | (interactive "P") | 5086 | (interactive "P") |
| 5046 | (let* ((alist org-tag-alist-for-agenda) | 5087 | (let* ((alist org-tag-alist-for-agenda) |
| 5047 | (tag-chars (mapconcat | 5088 | (tag-chars (mapconcat |
| 5048 | (lambda (x) (if (cdr x) (char-to-string (cdr x)) "")) | 5089 | (lambda (x) (if (and (not (symbolp (car x))) |
| 5049 | alist "")) | 5090 | (cdr x)) |
| 5050 | (efforts (org-split-string | 5091 | (char-to-string (cdr x)) |
| 5051 | (or (cdr (assoc (concat org-effort-property "_ALL") | 5092 | "")) |
| 5052 | org-global-properties)) | 5093 | alist "")) |
| 5053 | "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00" ""))) | 5094 | (efforts (org-split-string |
| 5054 | (effort-op org-agenda-filter-effort-default-operator) | 5095 | (or (cdr (assoc (concat org-effort-property "_ALL") |
| 5055 | (effort-prompt "") | 5096 | org-global-properties)) |
| 5056 | (inhibit-read-only t) | 5097 | "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00" ""))) |
| 5057 | (current org-agenda-filter) | 5098 | (effort-op org-agenda-filter-effort-default-operator) |
| 5058 | char a n tag) | 5099 | (effort-prompt "") |
| 5100 | (inhibit-read-only t) | ||
| 5101 | (current org-agenda-filter) | ||
| 5102 | char a n tag) | ||
| 5059 | (unless char | 5103 | (unless char |
| 5060 | (message | 5104 | (message |
| 5061 | "%s by tag [%s ], [TAB], [/]:off, [+-]:narrow, [>=<?]:effort: " | 5105 | "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: " |
| 5062 | (if narrow "Narrow" "Filter") tag-chars) | 5106 | (if narrow "Narrow" "Filter") tag-chars |
| 5107 | (if org-agenda-auto-exclude-function "[RET], " "")) | ||
| 5063 | (setq char (read-char))) | 5108 | (setq char (read-char))) |
| 5064 | (when (member char '(?+ ?-)) | 5109 | (when (member char '(?+ ?-)) |
| 5065 | ;; Narrowing down | 5110 | ;; Narrowing down |
| @@ -5091,6 +5136,17 @@ to switch to narrowing." | |||
| 5091 | (setq tag (org-icompleting-read | 5136 | (setq tag (org-icompleting-read |
| 5092 | "Tag: " org-global-tags-completion-table)))) | 5137 | "Tag: " org-global-tags-completion-table)))) |
| 5093 | (cond | 5138 | (cond |
| 5139 | ((equal char ?\r) | ||
| 5140 | (org-agenda-filter-by-tag-show-all) | ||
| 5141 | (when org-agenda-auto-exclude-function | ||
| 5142 | (setq org-agenda-filter '()) | ||
| 5143 | (dolist (tag org-tag-alist-for-agenda) | ||
| 5144 | (let ((modifier (funcall org-agenda-auto-exclude-function | ||
| 5145 | (car tag)))) | ||
| 5146 | (if modifier | ||
| 5147 | (push modifier org-agenda-filter)))) | ||
| 5148 | (if (not (null org-agenda-filter)) | ||
| 5149 | (org-agenda-filter-apply org-agenda-filter)))) | ||
| 5094 | ((equal char ?/) | 5150 | ((equal char ?/) |
| 5095 | (org-agenda-filter-by-tag-show-all) | 5151 | (org-agenda-filter-by-tag-show-all) |
| 5096 | (when (get 'org-agenda-filter :preset-filter) | 5152 | (when (get 'org-agenda-filter :preset-filter) |
| @@ -5124,7 +5180,7 @@ to switch to narrowing." | |||
| 5124 | (dolist (x (append (get 'org-agenda-filter :preset-filter) | 5180 | (dolist (x (append (get 'org-agenda-filter :preset-filter) |
| 5125 | org-agenda-filter)) | 5181 | org-agenda-filter)) |
| 5126 | (if (member x '("-" "+")) | 5182 | (if (member x '("-" "+")) |
| 5127 | (setq f1 '(not tags)) | 5183 | (setq f1 (if (equal x "-") 'tags '(not tags))) |
| 5128 | (if (string-match "[<=>?]" x) | 5184 | (if (string-match "[<=>?]" x) |
| 5129 | (setq f1 (org-agenda-filter-effort-form x)) | 5185 | (setq f1 (org-agenda-filter-effort-form x)) |
| 5130 | (setq f1 (list 'member (downcase (substring x 1)) 'tags))) | 5186 | (setq f1 (list 'member (downcase (substring x 1)) 'tags))) |
| @@ -5489,6 +5545,8 @@ so that the date SD will be in that range." | |||
| 5489 | (interactive) | 5545 | (interactive) |
| 5490 | (setq org-agenda-follow-mode (not org-agenda-follow-mode)) | 5546 | (setq org-agenda-follow-mode (not org-agenda-follow-mode)) |
| 5491 | (org-agenda-set-mode-name) | 5547 | (org-agenda-set-mode-name) |
| 5548 | (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | ||
| 5549 | (org-agenda-show)) | ||
| 5492 | (message "Follow mode is %s" | 5550 | (message "Follow mode is %s" |
| 5493 | (if org-agenda-follow-mode "on" "off"))) | 5551 | (if org-agenda-follow-mode "on" "off"))) |
| 5494 | 5552 | ||
| @@ -5584,8 +5642,10 @@ When called with a prefix argument, include all archive files as well." | |||
| 5584 | (if org-agenda-entry-text-mode " ETxt" "") | 5642 | (if org-agenda-entry-text-mode " ETxt" "") |
| 5585 | (if org-agenda-include-diary " Diary" "") | 5643 | (if org-agenda-include-diary " Diary" "") |
| 5586 | (if org-agenda-use-time-grid " Grid" "") | 5644 | (if org-agenda-use-time-grid " Grid" "") |
| 5645 | (if (and (boundp 'org-habit-show-habits) | ||
| 5646 | org-habit-show-habits) " Habit" "") | ||
| 5587 | (if (consp org-agenda-show-log) " LogAll" | 5647 | (if (consp org-agenda-show-log) " LogAll" |
| 5588 | (if org-agenda-show-log " Log" "")) | 5648 | (if org-agenda-show-log " Log" "")) |
| 5589 | (if (or org-agenda-filter (get 'org-agenda-filter | 5649 | (if (or org-agenda-filter (get 'org-agenda-filter |
| 5590 | :preset-filter)) | 5650 | :preset-filter)) |
| 5591 | (concat " {" (mapconcat | 5651 | (concat " {" (mapconcat |
| @@ -5606,9 +5666,20 @@ When called with a prefix argument, include all archive files as well." | |||
| 5606 | (setq org-agenda-type | 5666 | (setq org-agenda-type |
| 5607 | (or (get-text-property (point) 'org-agenda-type) | 5667 | (or (get-text-property (point) 'org-agenda-type) |
| 5608 | (get-text-property (max (point-min) (1- (point))) | 5668 | (get-text-property (max (point-min) (1- (point))) |
| 5609 | 'org-agenda-type))) | 5669 | 'org-agenda-type)))) |
| 5610 | (if (and org-agenda-follow-mode | 5670 | |
| 5611 | (org-get-at-bol 'org-marker)) | 5671 | (defun org-agenda-next-line () |
| 5672 | "Move cursor to the next line, and show if follow-mode is active." | ||
| 5673 | (interactive) | ||
| 5674 | (call-interactively 'next-line) | ||
| 5675 | (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | ||
| 5676 | (org-agenda-show))) | ||
| 5677 | (defun org-agenda-previous-line () | ||
| 5678 | "Move cursor to the previous line, and show if follow-mode is active." | ||
| 5679 | |||
| 5680 | (interactive) | ||
| 5681 | (call-interactively 'previous-line) | ||
| 5682 | (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker)) | ||
| 5612 | (org-agenda-show))) | 5683 | (org-agenda-show))) |
| 5613 | 5684 | ||
| 5614 | (defun org-agenda-show-priority () | 5685 | (defun org-agenda-show-priority () |
| @@ -5684,27 +5755,32 @@ Point is in the buffer where the item originated.") | |||
| 5684 | (with-current-buffer buffer (delete-region dbeg dend)) | 5755 | (with-current-buffer buffer (delete-region dbeg dend)) |
| 5685 | (message "Agenda item and source killed")))) | 5756 | (message "Agenda item and source killed")))) |
| 5686 | 5757 | ||
| 5758 | (defvar org-archive-default-command) | ||
| 5759 | (defun org-agenda-archive-default () | ||
| 5760 | "Archive the entry or subtree belonging to the current agenda entry." | ||
| 5761 | (interactive) | ||
| 5762 | (require 'org-archive) | ||
| 5763 | (org-agenda-archive-with org-archive-default-command)) | ||
| 5764 | |||
| 5765 | (defun org-agenda-archive-default-with-confirmation () | ||
| 5766 | "Archive the entry or subtree belonging to the current agenda entry." | ||
| 5767 | (interactive) | ||
| 5768 | (require 'org-archive) | ||
| 5769 | (org-agenda-archive-with org-archive-default-command 'confirm)) | ||
| 5770 | |||
| 5687 | (defun org-agenda-archive () | 5771 | (defun org-agenda-archive () |
| 5688 | "Archive the entry or subtree belonging to the current agenda entry." | 5772 | "Archive the entry or subtree belonging to the current agenda entry." |
| 5689 | (interactive) | 5773 | (interactive) |
| 5690 | (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) | 5774 | (org-agenda-archive-with 'org-archive-subtree)) |
| 5691 | (let* ((marker (or (org-get-at-bol 'org-marker) | ||
| 5692 | (org-agenda-error))) | ||
| 5693 | (buffer (marker-buffer marker)) | ||
| 5694 | (pos (marker-position marker))) | ||
| 5695 | (org-with-remote-undo buffer | ||
| 5696 | (with-current-buffer buffer | ||
| 5697 | (if (org-mode-p) | ||
| 5698 | (save-excursion | ||
| 5699 | (goto-char pos) | ||
| 5700 | (org-remove-subtree-entries-from-agenda) | ||
| 5701 | (org-back-to-heading t) | ||
| 5702 | (org-archive-subtree)) | ||
| 5703 | (error "Archiving works only in Org-mode files")))))) | ||
| 5704 | 5775 | ||
| 5705 | (defun org-agenda-archive-to-archive-sibling () | 5776 | (defun org-agenda-archive-to-archive-sibling () |
| 5706 | "Move the entry to the archive sibling." | 5777 | "Move the entry to the archive sibling." |
| 5707 | (interactive) | 5778 | (interactive) |
| 5779 | (org-agenda-archive-with 'org-archive-to-archive-sibling)) | ||
| 5780 | |||
| 5781 | (defun org-agenda-archive-with (cmd &optional confirm) | ||
| 5782 | "Move the entry to the archive sibling." | ||
| 5783 | (interactive) | ||
| 5708 | (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) | 5784 | (or (eq major-mode 'org-agenda-mode) (error "Not in agenda")) |
| 5709 | (let* ((marker (or (org-get-at-bol 'org-marker) | 5785 | (let* ((marker (or (org-get-at-bol 'org-marker) |
| 5710 | (org-agenda-error))) | 5786 | (org-agenda-error))) |
| @@ -5713,11 +5789,14 @@ Point is in the buffer where the item originated.") | |||
| 5713 | (org-with-remote-undo buffer | 5789 | (org-with-remote-undo buffer |
| 5714 | (with-current-buffer buffer | 5790 | (with-current-buffer buffer |
| 5715 | (if (org-mode-p) | 5791 | (if (org-mode-p) |
| 5716 | (save-excursion | 5792 | (if (and confirm |
| 5717 | (goto-char pos) | 5793 | (not (y-or-n-p "Archive this subtree or entry? "))) |
| 5718 | (org-remove-subtree-entries-from-agenda) | 5794 | (error "Abort") |
| 5719 | (org-back-to-heading t) | 5795 | (save-excursion |
| 5720 | (org-archive-to-archive-sibling)) | 5796 | (goto-char pos) |
| 5797 | (org-remove-subtree-entries-from-agenda) | ||
| 5798 | (org-back-to-heading t) | ||
| 5799 | (funcall cmd))) | ||
| 5721 | (error "Archiving works only in Org-mode files")))))) | 5800 | (error "Archiving works only in Org-mode files")))))) |
| 5722 | 5801 | ||
| 5723 | (defun org-remove-subtree-entries-from-agenda (&optional buf beg end) | 5802 | (defun org-remove-subtree-entries-from-agenda (&optional buf beg end) |
| @@ -5768,7 +5847,7 @@ If this information is not given, the function uses the tree at point." | |||
| 5768 | 5847 | ||
| 5769 | (defun org-agenda-open-link (&optional arg) | 5848 | (defun org-agenda-open-link (&optional arg) |
| 5770 | "Follow the link in the current line, if any. | 5849 | "Follow the link in the current line, if any. |
| 5771 | This looks for a link in the displayed lin in the agenda. It also looks | 5850 | This looks for a link in the displayed line in the agenda. It also looks |
| 5772 | at the text of the entry itself." | 5851 | at the text of the entry itself." |
| 5773 | (interactive "P") | 5852 | (interactive "P") |
| 5774 | (let* ((marker (or (org-get-at-bol 'org-hd-marker) | 5853 | (let* ((marker (or (org-get-at-bol 'org-hd-marker) |
| @@ -5777,14 +5856,21 @@ at the text of the entry itself." | |||
| 5777 | (prefix (buffer-substring | 5856 | (prefix (buffer-substring |
| 5778 | (point-at-bol) | 5857 | (point-at-bol) |
| 5779 | (+ (point-at-bol) | 5858 | (+ (point-at-bol) |
| 5780 | (org-get-at-bol 'prefix-length))))) | 5859 | (or (org-get-at-bol 'prefix-length) 0))))) |
| 5781 | (unless buffer (error "Don't know where to look for links")) | 5860 | (cond |
| 5782 | (with-current-buffer buffer | 5861 | (buffer |
| 5783 | (save-excursion | 5862 | (with-current-buffer buffer |
| 5784 | (save-restriction | 5863 | (save-excursion |
| 5785 | (widen) | 5864 | (save-restriction |
| 5786 | (goto-char marker) | 5865 | (widen) |
| 5787 | (org-offer-links-in-entry arg prefix)))))) | 5866 | (goto-char marker) |
| 5867 | (org-offer-links-in-entry arg prefix))))) | ||
| 5868 | ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)")) | ||
| 5869 | (save-excursion | ||
| 5870 | (beginning-of-line 1) | ||
| 5871 | (looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)")))) | ||
| 5872 | (org-open-link-from-string (match-string 1))) | ||
| 5873 | (t (error "No link to open here"))))) | ||
| 5788 | 5874 | ||
| 5789 | (defun org-agenda-copy-local-variable (var) | 5875 | (defun org-agenda-copy-local-variable (var) |
| 5790 | "Get a variable from a referenced buffer and install it here." | 5876 | "Get a variable from a referenced buffer and install it here." |
| @@ -5796,19 +5882,23 @@ at the text of the entry itself." | |||
| 5796 | (defun org-agenda-switch-to (&optional delete-other-windows) | 5882 | (defun org-agenda-switch-to (&optional delete-other-windows) |
| 5797 | "Go to the Org-mode file which contains the item at point." | 5883 | "Go to the Org-mode file which contains the item at point." |
| 5798 | (interactive) | 5884 | (interactive) |
| 5799 | (let* ((marker (or (org-get-at-bol 'org-marker) | 5885 | (if (and org-return-follows-link |
| 5800 | (org-agenda-error))) | 5886 | (not (org-get-at-bol 'org-marker)) |
| 5801 | (buffer (marker-buffer marker)) | 5887 | (org-in-regexp org-bracket-link-regexp)) |
| 5802 | (pos (marker-position marker))) | 5888 | (org-open-link-from-string (match-string 0)) |
| 5803 | (switch-to-buffer buffer) | 5889 | (let* ((marker (or (org-get-at-bol 'org-marker) |
| 5804 | (and delete-other-windows (delete-other-windows)) | 5890 | (org-agenda-error))) |
| 5805 | (widen) | 5891 | (buffer (marker-buffer marker)) |
| 5806 | (goto-char pos) | 5892 | (pos (marker-position marker))) |
| 5807 | (when (org-mode-p) | 5893 | (switch-to-buffer buffer) |
| 5808 | (org-show-context 'agenda) | 5894 | (and delete-other-windows (delete-other-windows)) |
| 5809 | (save-excursion | 5895 | (widen) |
| 5810 | (and (outline-next-heading) | 5896 | (goto-char pos) |
| 5811 | (org-flag-heading nil)))))) ; show the next heading | 5897 | (when (org-mode-p) |
| 5898 | (org-show-context 'agenda) | ||
| 5899 | (save-excursion | ||
| 5900 | (and (outline-next-heading) | ||
| 5901 | (org-flag-heading nil))))))) ; show the next heading | ||
| 5812 | 5902 | ||
| 5813 | (defun org-agenda-goto-mouse (ev) | 5903 | (defun org-agenda-goto-mouse (ev) |
| 5814 | "Go to the Org-mode file which contains the item at the mouse click." | 5904 | "Go to the Org-mode file which contains the item at the mouse click." |
| @@ -5828,9 +5918,34 @@ if it was hidden in the outline." | |||
| 5828 | (org-agenda-goto t)) | 5918 | (org-agenda-goto t)) |
| 5829 | (select-window win))) | 5919 | (select-window win))) |
| 5830 | 5920 | ||
| 5921 | (defvar org-agenda-show-window nil) | ||
| 5922 | (defun org-agenda-show-and-scroll-up () | ||
| 5923 | "Display the Org-mode file which contains the item at point. | ||
| 5924 | When called repeatedly, scroll the window that is displaying the buffer." | ||
| 5925 | (interactive) | ||
| 5926 | (let ((win (selected-window))) | ||
| 5927 | (if (and (window-live-p org-agenda-show-window) | ||
| 5928 | (eq this-command last-command)) | ||
| 5929 | (progn | ||
| 5930 | (select-window org-agenda-show-window) | ||
| 5931 | (ignore-errors (scroll-up))) | ||
| 5932 | (org-agenda-goto t) | ||
| 5933 | (show-subtree) | ||
| 5934 | (setq org-agenda-show-window (selected-window))) | ||
| 5935 | (select-window win))) | ||
| 5936 | |||
| 5937 | (defun org-agenda-show-scroll-down () | ||
| 5938 | "Scroll down the window showing the agenda." | ||
| 5939 | (interactive) | ||
| 5940 | (let ((win (selected-window))) | ||
| 5941 | (when (window-live-p org-agenda-show-window) | ||
| 5942 | (select-window org-agenda-show-window) | ||
| 5943 | (ignore-errors (scroll-down)) | ||
| 5944 | (select-window win)))) | ||
| 5945 | |||
| 5831 | (defun org-agenda-show-1 (&optional more) | 5946 | (defun org-agenda-show-1 (&optional more) |
| 5832 | "Display the Org-mode file which contains the item at point. | 5947 | "Display the Org-mode file which contains the item at point. |
| 5833 | The prefix arg causes further revieling: | 5948 | The prefix arg selects the amount of information to display: |
| 5834 | 5949 | ||
| 5835 | 0 hide the subtree | 5950 | 0 hide the subtree |
| 5836 | 1 just show the entry according to defaults. | 5951 | 1 just show the entry according to defaults. |
| @@ -6473,7 +6588,7 @@ The cursor may be at a date in the calendar, or in the Org agenda." | |||
| 6473 | (if current-buffer | 6588 | (if current-buffer |
| 6474 | (eval form) | 6589 | (eval form) |
| 6475 | (if (not (marker-buffer org-agenda-action-marker)) | 6590 | (if (not (marker-buffer org-agenda-action-marker)) |
| 6476 | (error "No entry has bee selected for agenda action") | 6591 | (error "No entry has been selected for agenda action") |
| 6477 | (with-current-buffer (marker-buffer org-agenda-action-marker) | 6592 | (with-current-buffer (marker-buffer org-agenda-action-marker) |
| 6478 | (save-excursion | 6593 | (save-excursion |
| 6479 | (save-restriction | 6594 | (save-restriction |
| @@ -6531,47 +6646,173 @@ The cursor may be at a date in the calendar, or in the Org agenda." | |||
| 6531 | (org-with-remote-undo (marker-buffer org-clock-marker) | 6646 | (org-with-remote-undo (marker-buffer org-clock-marker) |
| 6532 | (org-clock-cancel))) | 6647 | (org-clock-cancel))) |
| 6533 | 6648 | ||
| 6649 | (defun org-agenda-diary-entry-in-org-file () | ||
| 6650 | "Make a diary entry in the file `org-agenda-diary-file'." | ||
| 6651 | (let (d1 d2 char (text "")) | ||
| 6652 | (if (equal (buffer-name) "*Calendar*") | ||
| 6653 | (setq d1 (calendar-cursor-to-date t) | ||
| 6654 | d2 (car calendar-mark-ring)) | ||
| 6655 | (setq d1 (calendar-gregorian-from-absolute | ||
| 6656 | (get-text-property (point) 'day)) | ||
| 6657 | d2 (and (mark) (get-text-property (mark) 'day) | ||
| 6658 | (calendar-gregorian-from-absolute | ||
| 6659 | (get-text-property (mark) 'day))))) | ||
| 6660 | (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") | ||
| 6661 | (setq char (read-char-exclusive)) | ||
| 6662 | (cond | ||
| 6663 | ((equal char ?d) | ||
| 6664 | (setq text (read-string "Day entry: ")) | ||
| 6665 | (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1)) | ||
| 6666 | ((equal char ?a) | ||
| 6667 | (setq d1 (list (car d1) (nth 1 d1) | ||
| 6668 | (read-number (format "Reference year [%d]: " (nth 2 d1)) | ||
| 6669 | (nth 2 d1)))) | ||
| 6670 | (setq text (read-string "Anniversary (use %d to show years): ")) | ||
| 6671 | (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1)) | ||
| 6672 | ((equal char ?b) | ||
| 6673 | (setq text (read-string "Block entry: ")) | ||
| 6674 | (unless (and d1 d2 (not (equal d1 d2))) | ||
| 6675 | (error "No block of days selected")) | ||
| 6676 | (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)) | ||
| 6677 | ((equal char ?j) | ||
| 6678 | (org-switch-to-buffer-other-window | ||
| 6679 | (find-file-noselect org-agenda-diary-file)) | ||
| 6680 | (org-datetree-find-date-create d1) | ||
| 6681 | (org-reveal t)) | ||
| 6682 | (t (error "Invalid selection character `%c'" char))))) | ||
| 6683 | |||
| 6684 | (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) | ||
| 6685 | "Add a diary entry with TYPE to `org-agenda-diary-file'. | ||
| 6686 | If TEXT is not empty, it will become the headline of the new entry, and | ||
| 6687 | the resulting entry will not be shown. When TEXT is empty, switch to | ||
| 6688 | `org-agenda-diary-file' and let the user finish the entry there." | ||
| 6689 | (let ((cw (current-window-configuration))) | ||
| 6690 | (org-switch-to-buffer-other-window | ||
| 6691 | (find-file-noselect org-agenda-diary-file)) | ||
| 6692 | (widen) | ||
| 6693 | (goto-char (point-min)) | ||
| 6694 | (cond | ||
| 6695 | ((eq type 'anniversary) | ||
| 6696 | (or (re-search-forward "^*[ \t]+Anniversaries" nil t) | ||
| 6697 | (progn | ||
| 6698 | (or (org-on-heading-p t) | ||
| 6699 | (progn | ||
| 6700 | (outline-next-heading) | ||
| 6701 | (insert "* Anniversaries\n\n") | ||
| 6702 | (beginning-of-line -1))))) | ||
| 6703 | (outline-next-heading) | ||
| 6704 | (org-back-over-empty-lines) | ||
| 6705 | (backward-char 1) | ||
| 6706 | (insert "\n") | ||
| 6707 | (require 'diary-lib) | ||
| 6708 | (let ((calendar-date-display-form | ||
| 6709 | (if (if (boundp 'calendar-date-style) | ||
| 6710 | (eq calendar-date-style 'european) | ||
| 6711 | european-calendar-style) ; Emacs 22 | ||
| 6712 | '(day " " month " " year) | ||
| 6713 | '(month " " day " " year)))) | ||
| 6714 | |||
| 6715 | (insert (format "%%%%(diary-anniversary %s) %s" | ||
| 6716 | (calendar-date-string d1 nil t) text)))) | ||
| 6717 | ((eq type 'day) | ||
| 6718 | (require 'org-datetree) | ||
| 6719 | (org-datetree-find-date-create d1) | ||
| 6720 | (org-agenda-insert-diary-make-new-entry text) | ||
| 6721 | (org-insert-time-stamp (org-time-from-absolute | ||
| 6722 | (calendar-absolute-from-gregorian d1))) | ||
| 6723 | (end-of-line 0)) | ||
| 6724 | ((eq type 'block) | ||
| 6725 | (if (> (calendar-absolute-from-gregorian d1) | ||
| 6726 | (calendar-absolute-from-gregorian d2)) | ||
| 6727 | (setq d1 (prog1 d2 (setq d2 d1)))) | ||
| 6728 | (require 'org-datetree) | ||
| 6729 | (org-datetree-find-date-create d1) | ||
| 6730 | (org-agenda-insert-diary-make-new-entry text) | ||
| 6731 | (org-insert-time-stamp (org-time-from-absolute | ||
| 6732 | (calendar-absolute-from-gregorian d1))) | ||
| 6733 | (insert "--") | ||
| 6734 | (org-insert-time-stamp (org-time-from-absolute | ||
| 6735 | (calendar-absolute-from-gregorian d2))) | ||
| 6736 | (end-of-line 0))) | ||
| 6737 | (if (string-match "\\S-" text) | ||
| 6738 | (progn | ||
| 6739 | (set-window-configuration cw) | ||
| 6740 | (message "%s entry added to %s" | ||
| 6741 | (capitalize (symbol-name type)) | ||
| 6742 | (abbreviate-file-name org-agenda-diary-file))) | ||
| 6743 | (org-reveal t) | ||
| 6744 | (message "Please finish entry here")))) | ||
| 6745 | |||
| 6746 | (defun org-agenda-insert-diary-make-new-entry (text) | ||
| 6747 | "Make new entry as last child of current entry. | ||
| 6748 | Add TEXT as headline, and position the cursor in the second line so that | ||
| 6749 | a timestamp can be added there." | ||
| 6750 | (let ((org-show-following-heading t) | ||
| 6751 | (org-show-siblings t) | ||
| 6752 | (org-show-hierarchy-above t) | ||
| 6753 | (org-show-entry-below t) | ||
| 6754 | col) | ||
| 6755 | (outline-next-heading) | ||
| 6756 | (org-back-over-empty-lines) | ||
| 6757 | (or (looking-at "[ \t]*$") | ||
| 6758 | (progn (insert "\n") (backward-char 1))) | ||
| 6759 | (org-insert-heading) | ||
| 6760 | (org-do-demote) | ||
| 6761 | (setq col (current-column)) | ||
| 6762 | (insert text "\n") | ||
| 6763 | (if org-adapt-indentation (org-indent-to-column col)) | ||
| 6764 | (let ((org-show-following-heading t) | ||
| 6765 | (org-show-siblings t) | ||
| 6766 | (org-show-hierarchy-above t) | ||
| 6767 | (org-show-entry-below t)) | ||
| 6768 | (org-show-context)))) | ||
| 6769 | |||
| 6534 | (defun org-agenda-diary-entry () | 6770 | (defun org-agenda-diary-entry () |
| 6535 | "Make a diary entry, like the `i' command from the calendar. | 6771 | "Make a diary entry, like the `i' command from the calendar. |
| 6536 | All the standard commands work: block, weekly etc." | 6772 | All the standard commands work: block, weekly etc. |
| 6773 | When `org-agenda-diary-file' points to a file, | ||
| 6774 | `org-agenda-diary-entry-in-org-file' is called instead to create | ||
| 6775 | entries in that Org-mode file." | ||
| 6537 | (interactive) | 6776 | (interactive) |
| 6538 | (org-agenda-check-type t 'agenda 'timeline) | 6777 | (org-agenda-check-type t 'agenda 'timeline) |
| 6539 | (require 'diary-lib) | 6778 | (if (not (eq org-agenda-diary-file 'diary-file)) |
| 6540 | (let* ((char (progn | 6779 | (org-agenda-diary-entry-in-org-file) |
| 6541 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") | 6780 | (require 'diary-lib) |
| 6542 | (read-char-exclusive))) | 6781 | (let* ((char (progn |
| 6543 | (cmd (cdr (assoc char | 6782 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") |
| 6544 | '((?d . insert-diary-entry) | 6783 | (read-char-exclusive))) |
| 6545 | (?w . insert-weekly-diary-entry) | 6784 | (cmd (cdr (assoc char |
| 6546 | (?m . insert-monthly-diary-entry) | 6785 | '((?d . insert-diary-entry) |
| 6547 | (?y . insert-yearly-diary-entry) | 6786 | (?w . insert-weekly-diary-entry) |
| 6548 | (?a . insert-anniversary-diary-entry) | 6787 | (?m . insert-monthly-diary-entry) |
| 6549 | (?b . insert-block-diary-entry) | 6788 | (?y . insert-yearly-diary-entry) |
| 6550 | (?c . insert-cyclic-diary-entry))))) | 6789 | (?a . insert-anniversary-diary-entry) |
| 6551 | (oldf (symbol-function 'calendar-cursor-to-date)) | 6790 | (?b . insert-block-diary-entry) |
| 6552 | ; (buf (get-file-buffer (substitute-in-file-name diary-file))) | 6791 | (?c . insert-cyclic-diary-entry))))) |
| 6553 | (point (point)) | 6792 | (oldf (symbol-function 'calendar-cursor-to-date)) |
| 6554 | (mark (or (mark t) (point)))) | 6793 | ;; (buf (get-file-buffer (substitute-in-file-name diary-file))) |
| 6555 | (unless cmd | 6794 | (point (point)) |
| 6556 | (error "No command associated with <%c>" char)) | 6795 | (mark (or (mark t) (point)))) |
| 6557 | (unless (and (get-text-property point 'day) | 6796 | (unless cmd |
| 6558 | (or (not (equal ?b char)) | 6797 | (error "No command associated with <%c>" char)) |
| 6559 | (get-text-property mark 'day))) | 6798 | (unless (and (get-text-property point 'day) |
| 6560 | (error "Don't know which date to use for diary entry")) | 6799 | (or (not (equal ?b char)) |
| 6561 | ;; We implement this by hacking the `calendar-cursor-to-date' function | 6800 | (get-text-property mark 'day))) |
| 6562 | ;; and the `calendar-mark-ring' variable. Saves a lot of code. | 6801 | (error "Don't know which date to use for diary entry")) |
| 6563 | (let ((calendar-mark-ring | 6802 | ;; We implement this by hacking the `calendar-cursor-to-date' function |
| 6564 | (list (calendar-gregorian-from-absolute | 6803 | ;; and the `calendar-mark-ring' variable. Saves a lot of code. |
| 6565 | (or (get-text-property mark 'day) | 6804 | (let ((calendar-mark-ring |
| 6566 | (get-text-property point 'day)))))) | 6805 | (list (calendar-gregorian-from-absolute |
| 6567 | (unwind-protect | 6806 | (or (get-text-property mark 'day) |
| 6568 | (progn | 6807 | (get-text-property point 'day)))))) |
| 6569 | (fset 'calendar-cursor-to-date | 6808 | (unwind-protect |
| 6570 | (lambda (&optional error dummy) | 6809 | (progn |
| 6571 | (calendar-gregorian-from-absolute | 6810 | (fset 'calendar-cursor-to-date |
| 6572 | (get-text-property point 'day)))) | 6811 | (lambda (&optional error dummy) |
| 6812 | (calendar-gregorian-from-absolute | ||
| 6813 | (get-text-property point 'day)))) | ||
| 6573 | (call-interactively cmd)) | 6814 | (call-interactively cmd)) |
| 6574 | (fset 'calendar-cursor-to-date oldf))))) | 6815 | (fset 'calendar-cursor-to-date oldf)))))) |
| 6575 | 6816 | ||
| 6576 | (defun org-agenda-execute-calendar-command (cmd) | 6817 | (defun org-agenda-execute-calendar-command (cmd) |
| 6577 | "Execute a calendar command from the agenda, with the date associated to | 6818 | "Execute a calendar command from the agenda, with the date associated to |
| @@ -6870,7 +7111,7 @@ tag and (if present) the flagging note." | |||
| 6870 | (message "Flagging note pushed to kill ring. Press [?] again to remove tag and note")))) | 7111 | (message "Flagging note pushed to kill ring. Press [?] again to remove tag and note")))) |
| 6871 | 7112 | ||
| 6872 | (defun org-agenda-remove-flag (marker) | 7113 | (defun org-agenda-remove-flag (marker) |
| 6873 | "Remove the FLAGGED tag and any flaging note in the entry." | 7114 | "Remove the FLAGGED tag and any flagging note in the entry." |
| 6874 | (let (newhead) | 7115 | (let (newhead) |
| 6875 | (org-with-point-at marker | 7116 | (org-with-point-at marker |
| 6876 | (org-toggle-tag "FLAGGED" 'off) | 7117 | (org-toggle-tag "FLAGGED" 'off) |
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index 88bc82f158d..3cc438c8535 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -35,8 +35,7 @@ | |||
| 35 | (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) | 35 | (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) |
| 36 | 36 | ||
| 37 | (defcustom org-archive-default-command 'org-archive-subtree | 37 | (defcustom org-archive-default-command 'org-archive-subtree |
| 38 | "The default archiving command. | 38 | "The default archiving command." |
| 39 | Currently this is only used by org-mobile.el." | ||
| 40 | :group 'org-archive | 39 | :group 'org-archive |
| 41 | :type '(choice | 40 | :type '(choice |
| 42 | (const org-archive-subtree) | 41 | (const org-archive-subtree) |
| @@ -50,7 +49,7 @@ See `org-archive-to-archive-sibling' for more information." | |||
| 50 | :group 'org-archive | 49 | :group 'org-archive |
| 51 | :type 'string) | 50 | :type 'string) |
| 52 | 51 | ||
| 53 | (defcustom org-archive-mark-done t | 52 | (defcustom org-archive-mark-done nil |
| 54 | "Non-nil means, mark entries as DONE when they are moved to the archive file. | 53 | "Non-nil means, mark entries as DONE when they are moved to the archive file. |
| 55 | This can be a string to set the keyword to use. When t, Org-mode will | 54 | This can be a string to set the keyword to use. When t, Org-mode will |
| 56 | use the first keyword in its list that means done." | 55 | use the first keyword in its list that means done." |
| @@ -304,12 +303,7 @@ this heading." | |||
| 304 | 303 | ||
| 305 | ;; Save and kill the buffer, if it is not the same buffer. | 304 | ;; Save and kill the buffer, if it is not the same buffer. |
| 306 | (when (not (eq this-buffer buffer)) | 305 | (when (not (eq this-buffer buffer)) |
| 307 | (save-buffer) | 306 | (save-buffer)) |
| 308 | ;; Check if it is OK to kill the buffer | ||
| 309 | (unless | ||
| 310 | (or visiting | ||
| 311 | (equal (marker-buffer org-clock-marker) (current-buffer))) | ||
| 312 | (kill-buffer buffer))) | ||
| 313 | )) | 307 | )) |
| 314 | ;; Here we are back in the original buffer. Everything seems to have | 308 | ;; Here we are back in the original buffer. Everything seems to have |
| 315 | ;; worked. So now cut the tree and finish up. | 309 | ;; worked. So now cut the tree and finish up. |
| @@ -447,7 +441,15 @@ the children that do not contain any open TODO items." | |||
| 447 | "Archive the current subtree with the default command. | 441 | "Archive the current subtree with the default command. |
| 448 | This command is set with the variable `org-archive-default-command'." | 442 | This command is set with the variable `org-archive-default-command'." |
| 449 | (interactive) | 443 | (interactive) |
| 450 | (call-interactively 'org-archive-default-command)) | 444 | (call-interactively org-archive-default-command)) |
| 445 | |||
| 446 | (defun org-archive-subtree-default-with-confirmation () | ||
| 447 | "Archive the current subtree with the default command. | ||
| 448 | This command is set with the variable `org-archive-default-command'." | ||
| 449 | (interactive) | ||
| 450 | (if (y-or-n-p "Archive this subtree or entry? ") | ||
| 451 | (call-interactively org-archive-default-command) | ||
| 452 | (error "Abort"))) | ||
| 451 | 453 | ||
| 452 | (provide 'org-archive) | 454 | (provide 'org-archive) |
| 453 | 455 | ||
diff --git a/lisp/org/org-ascii.el b/lisp/org/org-ascii.el index f66f441d010..c4a2cedf2c7 100644 --- a/lisp/org/org-ascii.el +++ b/lisp/org/org-ascii.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -58,6 +58,13 @@ in this way, it will be wrapped." | |||
| 58 | :group 'org-export-ascii | 58 | :group 'org-export-ascii |
| 59 | :type 'boolean) | 59 | :type 'boolean) |
| 60 | 60 | ||
| 61 | (defcustom org-export-ascii-table-keep-all-vertical-lines nil | ||
| 62 | "Non-nil means, keep all vertical lines in ASCII tables. | ||
| 63 | When nil, vertical lines will be removed except for those needed | ||
| 64 | for column grouping." | ||
| 65 | :group 'org-export-ascii | ||
| 66 | :type 'boolean) | ||
| 67 | |||
| 61 | ;;; Hooks | 68 | ;;; Hooks |
| 62 | 69 | ||
| 63 | (defvar org-export-ascii-final-hook nil | 70 | (defvar org-export-ascii-final-hook nil |
| @@ -120,7 +127,7 @@ in a window. A non-interactive call will only return the buffer." | |||
| 120 | (setq buffer "*Org ASCII Export*")) | 127 | (setq buffer "*Org ASCII Export*")) |
| 121 | (let ((transient-mark-mode t) (zmacs-regions t) | 128 | (let ((transient-mark-mode t) (zmacs-regions t) |
| 122 | ext-plist rtn) | 129 | ext-plist rtn) |
| 123 | (setq ext-plist (plist-put ext-plist :ignore-subree-p t)) | 130 | (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) |
| 124 | (goto-char end) | 131 | (goto-char end) |
| 125 | (set-mark (point)) ;; to activate the region | 132 | (set-mark (point)) ;; to activate the region |
| 126 | (goto-char beg) | 133 | (goto-char beg) |
| @@ -157,7 +164,7 @@ publishing directory." | |||
| 157 | (rbeg (and region-p (region-beginning))) | 164 | (rbeg (and region-p (region-beginning))) |
| 158 | (rend (and region-p (region-end))) | 165 | (rend (and region-p (region-end))) |
| 159 | (subtree-p | 166 | (subtree-p |
| 160 | (if (plist-get opt-plist :ignore-subree-p) | 167 | (if (plist-get opt-plist :ignore-subtree-p) |
| 161 | nil | 168 | nil |
| 162 | (when region-p | 169 | (when region-p |
| 163 | (save-excursion | 170 | (save-excursion |
| @@ -585,18 +592,20 @@ publishing directory." | |||
| 585 | ;; column and the special lines | 592 | ;; column and the special lines |
| 586 | (setq lines (org-table-clean-before-export lines))) | 593 | (setq lines (org-table-clean-before-export lines))) |
| 587 | ;; Get rid of the vertical lines except for grouping | 594 | ;; Get rid of the vertical lines except for grouping |
| 588 | (let ((vl (org-colgroup-info-to-vline-list org-table-colgroup-info)) | 595 | (if org-export-ascii-table-keep-all-vertical-lines |
| 589 | rtn line vl1 start) | 596 | lines |
| 590 | (while (setq line (pop lines)) | 597 | (let ((vl (org-colgroup-info-to-vline-list org-table-colgroup-info)) |
| 591 | (if (string-match org-table-hline-regexp line) | 598 | rtn line vl1 start) |
| 592 | (and (string-match "|\\(.*\\)|" line) | 599 | (while (setq line (pop lines)) |
| 593 | (setq line (replace-match " \\1" t nil line))) | 600 | (if (string-match org-table-hline-regexp line) |
| 594 | (setq start 0 vl1 vl) | 601 | (and (string-match "|\\(.*\\)|" line) |
| 595 | (while (string-match "|" line start) | 602 | (setq line (replace-match " \\1" t nil line))) |
| 596 | (setq start (match-end 0)) | 603 | (setq start 0 vl1 vl) |
| 597 | (or (pop vl1) (setq line (replace-match " " t t line))))) | 604 | (while (string-match "|" line start) |
| 598 | (push line rtn)) | 605 | (setq start (match-end 0)) |
| 599 | (nreverse rtn)))) | 606 | (or (pop vl1) (setq line (replace-match " " t t line))))) |
| 607 | (push line rtn)) | ||
| 608 | (nreverse rtn))))) | ||
| 600 | 609 | ||
| 601 | (defun org-colgroup-info-to-vline-list (info) | 610 | (defun org-colgroup-info-to-vline-list (info) |
| 602 | (let (vl new last) | 611 | (let (vl new last) |
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index a51a097fd31..12c91330310 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Keywords: org data task | 6 | ;; Keywords: org data task |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -209,7 +209,7 @@ the directory and (if necessary) the corresponding ID will be created." | |||
| 209 | attach-dir)))) | 209 | attach-dir)))) |
| 210 | 210 | ||
| 211 | (defun org-attach-check-absolute-path (dir) | 211 | (defun org-attach-check-absolute-path (dir) |
| 212 | "Check if we have enough information to root the atachment directory. | 212 | "Check if we have enough information to root the attachment directory. |
| 213 | When DIR is given, check also if it is already absolute. Otherwise, | 213 | When DIR is given, check also if it is already absolute. Otherwise, |
| 214 | assume that it will be relative, and check if `org-attach-directory' is | 214 | assume that it will be relative, and check if `org-attach-directory' is |
| 215 | absolute, or if at least the current buffer has a file name. | 215 | absolute, or if at least the current buffer has a file name. |
| @@ -365,11 +365,11 @@ This ignores files starting with a \".\", and files ending in \"~\"." | |||
| 365 | (mapcar (lambda (x) (if (string-match "^\\." x) nil x)) | 365 | (mapcar (lambda (x) (if (string-match "^\\." x) nil x)) |
| 366 | (directory-files dir nil "[^~]\\'")))) | 366 | (directory-files dir nil "[^~]\\'")))) |
| 367 | 367 | ||
| 368 | (defun org-attach-reveal () | 368 | (defun org-attach-reveal (&optional if-exists) |
| 369 | "Show the attachment directory of the current task in dired." | 369 | "Show the attachment directory of the current task in dired." |
| 370 | (interactive) | 370 | (interactive "P") |
| 371 | (let ((attach-dir (org-attach-dir t))) | 371 | (let ((attach-dir (org-attach-dir (not if-exists)))) |
| 372 | (org-open-file attach-dir))) | 372 | (and attach-dir (org-open-file attach-dir)))) |
| 373 | 373 | ||
| 374 | (defun org-attach-reveal-in-emacs () | 374 | (defun org-attach-reveal-in-emacs () |
| 375 | "Show the attachment directory of the current task. | 375 | "Show the attachment directory of the current task. |
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index 47d1eed6fd7..6d9a7788a5f 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Thomas Baumann <thomas dot baumann at ch dot tum dot de> | 7 | ;; Thomas Baumann <thomas dot baumann at ch dot tum dot de> |
| 8 | ;; Keywords: outlines, hypermedia, calendar, wp | 8 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 9 | ;; Homepage: http://orgmode.org | 9 | ;; Homepage: http://orgmode.org |
| 10 | ;; Version: 6.31a | 10 | ;; Version: 6.33 |
| 11 | ;; | 11 | ;; |
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | ;; | 13 | ;; |
| @@ -64,7 +64,7 @@ | |||
| 64 | ;; | 64 | ;; |
| 65 | ;; - an identifier for a class of anniversaries (eg. birthday or | 65 | ;; - an identifier for a class of anniversaries (eg. birthday or |
| 66 | ;; wedding) from `org-bbdb-anniversary-format-alist' which then | 66 | ;; wedding) from `org-bbdb-anniversary-format-alist' which then |
| 67 | ;; defines the format tring for this class | 67 | ;; defines the format string for this class |
| 68 | ;; - the (format) string displayed in the diary. | 68 | ;; - the (format) string displayed in the diary. |
| 69 | ;; | 69 | ;; |
| 70 | ;; You can enter multiple anniversaries for a single BBDB record by | 70 | ;; You can enter multiple anniversaries for a single BBDB record by |
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 3b34e7dd8c8..44299e5e038 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Bastien Guerry <bzg at altern dot org> | 5 | ;; Author: Bastien Guerry <bzg at altern dot org> |
| 6 | ;; Carsten Dominik <carsten dot dominik at gmail dot com> | 6 | ;; Carsten Dominik <carsten dot dominik at gmail dot com> |
| 7 | ;; Keywords: org, wp, remember | 7 | ;; Keywords: org, wp, remember |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -78,7 +78,7 @@ | |||
| 78 | ;; | 78 | ;; |
| 79 | ;; Creating better remember template information was inspired by a request | 79 | ;; Creating better remember template information was inspired by a request |
| 80 | ;; of Austin Frank: http://article.gmane.org/gmane.emacs.orgmode/4112 | 80 | ;; of Austin Frank: http://article.gmane.org/gmane.emacs.orgmode/4112 |
| 81 | ;; and then imlemented by Bastien Guerry. | 81 | ;; and then implemented by Bastien Guerry. |
| 82 | ;; | 82 | ;; |
| 83 | ;; Org-mode loads this module by default - if this is not what you want, | 83 | ;; Org-mode loads this module by default - if this is not what you want, |
| 84 | ;; configure the variable `org-modules'. | 84 | ;; configure the variable `org-modules'. |
| @@ -189,8 +189,8 @@ | |||
| 189 | ;; Restore the window configuration because we just use the web link | 189 | ;; Restore the window configuration because we just use the web link |
| 190 | (set-window-configuration org-window-config-before-follow-link) | 190 | (set-window-configuration org-window-config-before-follow-link) |
| 191 | (with-current-buffer b | 191 | (with-current-buffer b |
| 192 | (goto-char p) | 192 | (goto-char p) |
| 193 | (bibtex-url))) | 193 | (bibtex-url))) |
| 194 | (recenter 0)) ; Move entry start to beginning of window | 194 | (recenter 0)) ; Move entry start to beginning of window |
| 195 | ;; return t to indicate that the search is done. | 195 | ;; return t to indicate that the search is done. |
| 196 | t)) | 196 | t)) |
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 6cd39b1ea7d..ddb0424ef4b 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -142,6 +142,7 @@ All this depends on running `org-clock-persistence-insinuate' in .emacs" | |||
| 142 | :group 'org-clock | 142 | :group 'org-clock |
| 143 | :type '(choice | 143 | :type '(choice |
| 144 | (const :tag "Just the running clock" clock) | 144 | (const :tag "Just the running clock" clock) |
| 145 | (const :tag "Just the history" history) | ||
| 145 | (const :tag "Clock and history" t) | 146 | (const :tag "Clock and history" t) |
| 146 | (const :tag "No persistence" nil))) | 147 | (const :tag "No persistence" nil))) |
| 147 | 148 | ||
| @@ -180,10 +181,10 @@ This can be overruled locally using the CLOCK_MODELINE_TOTAL property. | |||
| 180 | Allowed values are: | 181 | Allowed values are: |
| 181 | 182 | ||
| 182 | current Only the time in the current instance of the clock | 183 | current Only the time in the current instance of the clock |
| 183 | today All time clocked inot this task today | 184 | today All time clocked into this task today |
| 184 | repeat All time clocked into this task since last repeat | 185 | repeat All time clocked into this task since last repeat |
| 185 | all All time ever recorded for this task | 186 | all All time ever recorded for this task |
| 186 | auto Automtically, either `all', or `repeat' for repeating tasks" | 187 | auto Automatically, either `all', or `repeat' for repeating tasks" |
| 187 | :group 'org-clock | 188 | :group 'org-clock |
| 188 | :type '(choice | 189 | :type '(choice |
| 189 | (const :tag "Current clock" current) | 190 | (const :tag "Current clock" current) |
| @@ -206,6 +207,20 @@ string as argument." | |||
| 206 | :group 'org-clock | 207 | :group 'org-clock |
| 207 | :type 'plist) | 208 | :type 'plist) |
| 208 | 209 | ||
| 210 | (defcustom org-clock-idle-time nil | ||
| 211 | "When non-nil, resolve open clocks if the user is idle more than X minutes." | ||
| 212 | :group 'org-clock | ||
| 213 | :type '(choice | ||
| 214 | (const :tag "Never" nil) | ||
| 215 | (integer :tag "After N minutes"))) | ||
| 216 | |||
| 217 | (defcustom org-clock-auto-clock-resolution 'when-no-clock-is-running | ||
| 218 | "When to automatically resolve open clocks found in Org buffers." | ||
| 219 | :group 'org-clock | ||
| 220 | :type '(choice | ||
| 221 | (const :tag "Never" nil) | ||
| 222 | (const :tag "Always" t) | ||
| 223 | (const :tag "When no clock is running" when-no-clock-is-running))) | ||
| 209 | 224 | ||
| 210 | (defvar org-clock-in-prepare-hook nil | 225 | (defvar org-clock-in-prepare-hook nil |
| 211 | "Hook run when preparing the clock. | 226 | "Hook run when preparing the clock. |
| @@ -221,6 +236,8 @@ to add an effort property.") | |||
| 221 | "Hook run when cancelling the current clock.") | 236 | "Hook run when cancelling the current clock.") |
| 222 | (defvar org-clock-goto-hook nil | 237 | (defvar org-clock-goto-hook nil |
| 223 | "Hook run when selecting the currently clocked-in entry.") | 238 | "Hook run when selecting the currently clocked-in entry.") |
| 239 | (defvar org-clock-has-been-used nil | ||
| 240 | "Has the clock been used during the current Emacs session?") | ||
| 224 | 241 | ||
| 225 | ;;; The clock for measuring work time. | 242 | ;;; The clock for measuring work time. |
| 226 | 243 | ||
| @@ -228,10 +245,14 @@ to add an effort property.") | |||
| 228 | (put 'org-mode-line-string 'risky-local-variable t) | 245 | (put 'org-mode-line-string 'risky-local-variable t) |
| 229 | 246 | ||
| 230 | (defvar org-clock-mode-line-timer nil) | 247 | (defvar org-clock-mode-line-timer nil) |
| 231 | (defvar org-clock-heading "") | 248 | (defvar org-clock-idle-timer nil) |
| 249 | (defvar org-clock-heading) ; defined in org.el | ||
| 232 | (defvar org-clock-heading-for-remember "") | 250 | (defvar org-clock-heading-for-remember "") |
| 233 | (defvar org-clock-start-time "") | 251 | (defvar org-clock-start-time "") |
| 234 | 252 | ||
| 253 | (defvar org-clock-left-over-time nil | ||
| 254 | "If non-nil, user cancelled a clock; this is when leftover time started.") | ||
| 255 | |||
| 235 | (defvar org-clock-effort "" | 256 | (defvar org-clock-effort "" |
| 236 | "Effort estimate of the currently clocking task") | 257 | "Effort estimate of the currently clocking task") |
| 237 | 258 | ||
| @@ -402,8 +423,8 @@ previous clocking intervals." | |||
| 402 | 423 | ||
| 403 | (defun org-clock-modify-effort-estimate (&optional value) | 424 | (defun org-clock-modify-effort-estimate (&optional value) |
| 404 | "Add to or set the effort estimate of the item currently being clocked. | 425 | "Add to or set the effort estimate of the item currently being clocked. |
| 405 | VALUE can be a number of minutes, or a string with forat hh:mm or mm. | 426 | VALUE can be a number of minutes, or a string with format hh:mm or mm. |
| 406 | WHen the strig starts with a + or a - sign, the current value of the effort | 427 | When the string starts with a + or a - sign, the current value of the effort |
| 407 | property will be changed by that amount. | 428 | property will be changed by that amount. |
| 408 | This will update the \"Effort\" property of currently clocked item, and | 429 | This will update the \"Effort\" property of currently clocked item, and |
| 409 | the mode line." | 430 | the mode line." |
| @@ -470,7 +491,7 @@ use libnotify if available, or fall back on a message." | |||
| 470 | "notify-send" notification)) | 491 | "notify-send" notification)) |
| 471 | ;; Maybe the handler will send a message, so only use message as | 492 | ;; Maybe the handler will send a message, so only use message as |
| 472 | ;; a fall back option | 493 | ;; a fall back option |
| 473 | (t (message notification)))) | 494 | (t (message "%s" notification)))) |
| 474 | 495 | ||
| 475 | (defun org-clock-play-sound () | 496 | (defun org-clock-play-sound () |
| 476 | "Play sound as configured by `org-clock-sound'. | 497 | "Play sound as configured by `org-clock-sound'. |
| @@ -479,13 +500,14 @@ Use alsa's aplay tool if available." | |||
| 479 | ((not org-clock-sound)) | 500 | ((not org-clock-sound)) |
| 480 | ((eq org-clock-sound t) (beep t) (beep t)) | 501 | ((eq org-clock-sound t) (beep t) (beep t)) |
| 481 | ((stringp org-clock-sound) | 502 | ((stringp org-clock-sound) |
| 482 | (if (file-exists-p org-clock-sound) | 503 | (let ((file (expand-file-name org-clock-sound))) |
| 483 | (if (org-program-exists "aplay") | 504 | (if (file-exists-p file) |
| 484 | (start-process "org-clock-play-notification" nil | 505 | (if (org-program-exists "aplay") |
| 485 | "aplay" org-clock-sound) | 506 | (start-process "org-clock-play-notification" nil |
| 486 | (condition-case nil | 507 | "aplay" file) |
| 487 | (play-sound-file org-clock-sound) | 508 | (condition-case nil |
| 488 | (error (beep t) (beep t)))))))) | 509 | (play-sound-file file) |
| 510 | (error (beep t) (beep t))))))))) | ||
| 489 | 511 | ||
| 490 | (defun org-program-exists (program-name) | 512 | (defun org-program-exists (program-name) |
| 491 | "Checks whenever we can locate program and launch it." | 513 | "Checks whenever we can locate program and launch it." |
| @@ -495,6 +517,303 @@ Use alsa's aplay tool if available." | |||
| 495 | (defvar org-clock-mode-line-entry nil | 517 | (defvar org-clock-mode-line-entry nil |
| 496 | "Information for the modeline about the running clock.") | 518 | "Information for the modeline about the running clock.") |
| 497 | 519 | ||
| 520 | (defun org-find-open-clocks (file) | ||
| 521 | "Search through the given file and find all open clocks." | ||
| 522 | (let ((buf (or (get-file-buffer file) | ||
| 523 | (find-file-noselect file))) | ||
| 524 | clocks) | ||
| 525 | (with-current-buffer buf | ||
| 526 | (save-excursion | ||
| 527 | (goto-char (point-min)) | ||
| 528 | (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t) | ||
| 529 | (push (cons (copy-marker (1- (match-end 1)) t) | ||
| 530 | (org-time-string-to-time (match-string 1))) clocks)))) | ||
| 531 | clocks)) | ||
| 532 | |||
| 533 | (defsubst org-is-active-clock (clock) | ||
| 534 | "Return t if CLOCK is the currently active clock." | ||
| 535 | (and (org-clock-is-active) | ||
| 536 | (= org-clock-marker (car clock)))) | ||
| 537 | |||
| 538 | (defmacro org-with-clock-position (clock &rest forms) | ||
| 539 | "Evaluate FORMS with CLOCK as the current active clock." | ||
| 540 | `(with-current-buffer (marker-buffer (car ,clock)) | ||
| 541 | (save-excursion | ||
| 542 | (save-restriction | ||
| 543 | (widen) | ||
| 544 | (goto-char (car ,clock)) | ||
| 545 | (beginning-of-line) | ||
| 546 | ,@forms)))) | ||
| 547 | |||
| 548 | (put 'org-with-clock-position 'lisp-indent-function 1) | ||
| 549 | |||
| 550 | (defmacro org-with-clock (clock &rest forms) | ||
| 551 | "Evaluate FORMS with CLOCK as the current active clock. | ||
| 552 | This macro also protects the current active clock from being altered." | ||
| 553 | `(org-with-clock-position ,clock | ||
| 554 | (let ((org-clock-start-time (cdr ,clock)) | ||
| 555 | (org-clock-total-time) | ||
| 556 | (org-clock-history) | ||
| 557 | (org-clock-effort) | ||
| 558 | (org-clock-marker (car ,clock)) | ||
| 559 | (org-clock-hd-marker (save-excursion | ||
| 560 | (outline-back-to-heading t) | ||
| 561 | (point-marker)))) | ||
| 562 | ,@forms))) | ||
| 563 | |||
| 564 | (put 'org-with-clock 'lisp-indent-function 1) | ||
| 565 | |||
| 566 | (defsubst org-clock-clock-in (clock &optional resume) | ||
| 567 | "Clock in to the clock located by CLOCK. | ||
| 568 | If necessary, clock-out of the currently active clock." | ||
| 569 | (org-with-clock-position clock | ||
| 570 | (let ((org-clock-in-resume (or resume org-clock-in-resume))) | ||
| 571 | (org-clock-in)))) | ||
| 572 | |||
| 573 | (defsubst org-clock-clock-out (clock &optional fail-quietly at-time) | ||
| 574 | "Clock out of the clock located by CLOCK." | ||
| 575 | (let ((temp (copy-marker (car clock) | ||
| 576 | (marker-insertion-type (car clock))))) | ||
| 577 | (if (org-is-active-clock clock) | ||
| 578 | (org-clock-out fail-quietly at-time) | ||
| 579 | (org-with-clock clock | ||
| 580 | (org-clock-out fail-quietly at-time))) | ||
| 581 | (setcar clock temp))) | ||
| 582 | |||
| 583 | (defsubst org-clock-clock-cancel (clock) | ||
| 584 | "Cancel the clock located by CLOCK." | ||
| 585 | (let ((temp (copy-marker (car clock) | ||
| 586 | (marker-insertion-type (car clock))))) | ||
| 587 | (if (org-is-active-clock clock) | ||
| 588 | (org-clock-cancel) | ||
| 589 | (org-with-clock clock | ||
| 590 | (org-clock-cancel))) | ||
| 591 | (setcar clock temp))) | ||
| 592 | |||
| 593 | (defvar org-clock-clocking-in nil) | ||
| 594 | (defvar org-clock-resolving-clocks nil) | ||
| 595 | (defvar org-clock-resolving-clocks-due-to-idleness nil) | ||
| 596 | |||
| 597 | (defun org-clock-resolve-clock (clock resolve-to &optional close-p | ||
| 598 | restart-p fail-quietly) | ||
| 599 | "Resolve `CLOCK' given the time `RESOLVE-TO', and the present. | ||
| 600 | `CLOCK' is a cons cell of the form (MARKER START-TIME). | ||
| 601 | This routine can do one of many things: | ||
| 602 | |||
| 603 | if `RESOLVE-TO' is nil | ||
| 604 | if `CLOSE-P' is non-nil, give an error | ||
| 605 | if this clock is the active clock, cancel it | ||
| 606 | else delete the clock line (as if it never happened) | ||
| 607 | if `RESTART-P' is non-nil, start a new clock | ||
| 608 | |||
| 609 | else if `RESOLVE-TO' is the symbol `now' | ||
| 610 | if `RESTART-P' is non-nil, give an error | ||
| 611 | if `CLOSE-P' is non-nil, clock out the entry and | ||
| 612 | if this clock is the active clock, stop it | ||
| 613 | else if this clock is the active clock, do nothing | ||
| 614 | else if there is no active clock, resume this clock | ||
| 615 | else ask to cancel the active clock, and if so, | ||
| 616 | resume this clock after cancelling it | ||
| 617 | |||
| 618 | else if `RESOLVE-TO' is some date in the future | ||
| 619 | give an error about `RESOLVE-TO' being invalid | ||
| 620 | |||
| 621 | else if `RESOLVE-TO' is some date in the past | ||
| 622 | if `RESTART-P' is non-nil, give an error | ||
| 623 | if `CLOSE-P' is non-nil, enter a closing time and | ||
| 624 | if this clock is the active clock, stop it | ||
| 625 | else if this clock is the active clock, enter a | ||
| 626 | closing time, stop the current clock, then | ||
| 627 | start a new clock for the same item | ||
| 628 | else just enter a closing time for this clock | ||
| 629 | and then start a new clock for the same item" | ||
| 630 | (let ((org-clock-resolving-clocks t)) | ||
| 631 | (cond | ||
| 632 | ((null resolve-to) | ||
| 633 | (org-clock-clock-cancel clock) | ||
| 634 | (if (and restart-p (not org-clock-clocking-in)) | ||
| 635 | (org-clock-clock-in clock))) | ||
| 636 | |||
| 637 | ((eq resolve-to 'now) | ||
| 638 | (if restart-p | ||
| 639 | (error "RESTART-P is not valid here")) | ||
| 640 | (if (or close-p org-clock-clocking-in) | ||
| 641 | (org-clock-clock-out clock fail-quietly) | ||
| 642 | (unless (org-is-active-clock clock) | ||
| 643 | (org-clock-clock-in clock t)))) | ||
| 644 | |||
| 645 | ((not (time-less-p resolve-to (current-time))) | ||
| 646 | (error "RESOLVE-TO must refer to a time in the past")) | ||
| 647 | |||
| 648 | (t | ||
| 649 | (if restart-p | ||
| 650 | (error "RESTART-P is not valid here")) | ||
| 651 | (org-clock-clock-out clock fail-quietly resolve-to) | ||
| 652 | (unless org-clock-clocking-in | ||
| 653 | (if close-p | ||
| 654 | (setq org-clock-left-over-time resolve-to) | ||
| 655 | (org-clock-clock-in clock))))))) | ||
| 656 | |||
| 657 | (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) | ||
| 658 | "Resolve an open org-mode clock. | ||
| 659 | An open clock was found, with `dangling' possibly being non-nil. | ||
| 660 | If this function was invoked with a prefix argument, non-dangling | ||
| 661 | open clocks are ignored. The given clock requires some sort of | ||
| 662 | user intervention to resolve it, either because a clock was left | ||
| 663 | dangling or due to an idle timeout. The clock resolution can | ||
| 664 | either be: | ||
| 665 | |||
| 666 | (a) deleted, the user doesn't care about the clock | ||
| 667 | (b) restarted from the current time (if no other clock is open) | ||
| 668 | (c) closed, giving the clock X minutes | ||
| 669 | (d) closed and then restarted | ||
| 670 | (e) resumed, as if the user had never left | ||
| 671 | |||
| 672 | The format of clock is (CONS MARKER START-TIME), where MARKER | ||
| 673 | identifies the buffer and position the clock is open at (and | ||
| 674 | thus, the heading it's under), and START-TIME is when the clock | ||
| 675 | was started." | ||
| 676 | (assert clock) | ||
| 677 | (let* ((ch | ||
| 678 | (save-window-excursion | ||
| 679 | (save-excursion | ||
| 680 | (unless org-clock-resolving-clocks-due-to-idleness | ||
| 681 | (org-with-clock clock | ||
| 682 | (org-clock-goto)) | ||
| 683 | (with-current-buffer (marker-buffer (car clock)) | ||
| 684 | (goto-char (car clock)) | ||
| 685 | (if org-clock-into-drawer | ||
| 686 | (ignore-errors | ||
| 687 | (outline-flag-region (save-excursion | ||
| 688 | (outline-back-to-heading t) | ||
| 689 | (search-forward ":LOGBOOK:") | ||
| 690 | (goto-char (match-beginning 0))) | ||
| 691 | (save-excursion | ||
| 692 | (outline-back-to-heading t) | ||
| 693 | (search-forward ":LOGBOOK:") | ||
| 694 | (search-forward ":END:") | ||
| 695 | (goto-char (match-end 0))) | ||
| 696 | nil))))) | ||
| 697 | (let (char-pressed) | ||
| 698 | (while (null char-pressed) | ||
| 699 | (setq char-pressed | ||
| 700 | (read-char (concat (funcall prompt-fn clock) | ||
| 701 | " [(kK)eep (sS)ubtract (C)ancel]? ") | ||
| 702 | nil 45))) | ||
| 703 | char-pressed)))) | ||
| 704 | (default (floor (/ (org-float-time | ||
| 705 | (time-subtract (current-time) last-valid)) 60))) | ||
| 706 | (keep (and (memq ch '(?k ?K)) | ||
| 707 | (read-number "Keep how many minutes? " default))) | ||
| 708 | (subtractp (memq ch '(?s ?S))) | ||
| 709 | (barely-started-p (< (- (org-float-time last-valid) | ||
| 710 | (org-float-time (cdr clock))) 45)) | ||
| 711 | (start-over (and subtractp barely-started-p))) | ||
| 712 | (if (or (null ch) | ||
| 713 | (not (memq ch '(?k ?K ?s ?S ?C)))) | ||
| 714 | (message "") | ||
| 715 | (org-clock-resolve-clock | ||
| 716 | clock (cond | ||
| 717 | ((or (eq ch ?C) | ||
| 718 | ;; If the time on the clock was less than a minute before | ||
| 719 | ;; the user went away, and they've ask to subtract all the | ||
| 720 | ;; time... | ||
| 721 | start-over) | ||
| 722 | nil) | ||
| 723 | (subtractp | ||
| 724 | last-valid) | ||
| 725 | ((= keep default) | ||
| 726 | 'now) | ||
| 727 | (t | ||
| 728 | (time-add last-valid (seconds-to-time (* 60 keep))))) | ||
| 729 | (memq ch '(?K ?S)) | ||
| 730 | (and start-over | ||
| 731 | (not (memq ch '(?K ?S ?C)))) | ||
| 732 | fail-quietly)))) | ||
| 733 | |||
| 734 | (defun org-resolve-clocks (&optional also-non-dangling-p prompt-fn last-valid) | ||
| 735 | "Resolve all currently open org-mode clocks. | ||
| 736 | If `also-non-dangling-p' is non-nil, also ask to resolve | ||
| 737 | non-dangling (i.e., currently open and valid) clocks." | ||
| 738 | (interactive "P") | ||
| 739 | (unless org-clock-resolving-clocks | ||
| 740 | (let ((org-clock-resolving-clocks t)) | ||
| 741 | (dolist (file (org-files-list)) | ||
| 742 | (let ((clocks (org-find-open-clocks file))) | ||
| 743 | (dolist (clock clocks) | ||
| 744 | (let ((dangling (or (not (org-clock-is-active)) | ||
| 745 | (/= (car clock) org-clock-marker)))) | ||
| 746 | (unless (and (not dangling) (not also-non-dangling-p)) | ||
| 747 | (org-clock-resolve | ||
| 748 | clock | ||
| 749 | (or prompt-fn | ||
| 750 | (function | ||
| 751 | (lambda (clock) | ||
| 752 | (format | ||
| 753 | "Dangling clock started %d mins ago" | ||
| 754 | (floor | ||
| 755 | (/ (- (org-float-time (current-time)) | ||
| 756 | (org-float-time (cdr clock))) 60)))))) | ||
| 757 | (or last-valid | ||
| 758 | (cdr clock))))))))))) | ||
| 759 | |||
| 760 | (defun org-emacs-idle-seconds () | ||
| 761 | "Return the current Emacs idle time in seconds, or nil if not idle." | ||
| 762 | (let ((idle-time (current-idle-time))) | ||
| 763 | (if idle-time | ||
| 764 | (org-float-time idle-time) | ||
| 765 | 0))) | ||
| 766 | |||
| 767 | (defun org-mac-idle-seconds () | ||
| 768 | "Return the current Mac idle time in seconds" | ||
| 769 | (string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'"))) | ||
| 770 | |||
| 771 | (defun org-x11-idle-seconds () | ||
| 772 | "Return the current X11 idle time in seconds" | ||
| 773 | (/ (string-to-number (shell-command-to-string "x11idle")) 1000)) | ||
| 774 | |||
| 775 | (defun org-user-idle-seconds () | ||
| 776 | "Return the number of seconds the user has been idle for. | ||
| 777 | This routine returns a floating point number." | ||
| 778 | (if (or (eq system-type 'darwin) (eq window-system 'x)) | ||
| 779 | (let ((emacs-idle (org-emacs-idle-seconds))) | ||
| 780 | ;; If Emacs has been idle for longer than the user's | ||
| 781 | ;; `org-clock-idle-time' value, check whether the whole system has | ||
| 782 | ;; really been idle for that long. | ||
| 783 | (if (> emacs-idle (* 60 org-clock-idle-time)) | ||
| 784 | (min emacs-idle (if (eq system-type 'darwin) | ||
| 785 | (org-mac-idle-seconds) | ||
| 786 | (org-x11-idle-seconds))) | ||
| 787 | emacs-idle)) | ||
| 788 | (org-emacs-idle-seconds))) | ||
| 789 | |||
| 790 | (defvar org-clock-user-idle-seconds) | ||
| 791 | |||
| 792 | (defun org-resolve-clocks-if-idle () | ||
| 793 | "Resolve all currently open org-mode clocks. | ||
| 794 | This is performed after `org-clock-idle-time' minutes, to check | ||
| 795 | if the user really wants to stay clocked in after being idle for | ||
| 796 | so long." | ||
| 797 | (when (and org-clock-idle-time (not org-clock-resolving-clocks) | ||
| 798 | org-clock-marker) | ||
| 799 | (let ((org-clock-user-idle-seconds (org-user-idle-seconds)) | ||
| 800 | (org-clock-user-idle-start | ||
| 801 | (time-subtract (current-time) | ||
| 802 | (seconds-to-time org-clock-user-idle-seconds))) | ||
| 803 | (org-clock-resolving-clocks-due-to-idleness t)) | ||
| 804 | (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) | ||
| 805 | (org-clock-resolve | ||
| 806 | (cons org-clock-marker | ||
| 807 | org-clock-start-time) | ||
| 808 | (function | ||
| 809 | (lambda (clock) | ||
| 810 | (format "Clocked in & idle for %.1f mins" | ||
| 811 | (/ (org-float-time | ||
| 812 | (time-subtract (current-time) | ||
| 813 | org-clock-user-idle-start)) | ||
| 814 | 60.0)))) | ||
| 815 | org-clock-user-idle-start))))) | ||
| 816 | |||
| 498 | (defun org-clock-in (&optional select) | 817 | (defun org-clock-in (&optional select) |
| 499 | "Start the clock on the current item. | 818 | "Start the clock on the current item. |
| 500 | If necessary, clock-out of the currently active clock. | 819 | If necessary, clock-out of the currently active clock. |
| @@ -505,8 +824,19 @@ the clocking selection, associated with the letter `d'." | |||
| 505 | (interactive "P") | 824 | (interactive "P") |
| 506 | (setq org-clock-notification-was-shown nil) | 825 | (setq org-clock-notification-was-shown nil) |
| 507 | (catch 'abort | 826 | (catch 'abort |
| 508 | (let ((interrupting (marker-buffer org-clock-marker)) | 827 | (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) |
| 509 | ts selected-task target-pos (msg-extra "")) | 828 | (marker-buffer org-clock-marker))) |
| 829 | ts selected-task target-pos (msg-extra "") | ||
| 830 | (left-over (and (not org-clock-resolving-clocks) | ||
| 831 | org-clock-left-over-time))) | ||
| 832 | (when (and org-clock-auto-clock-resolution | ||
| 833 | (or (not interrupting) | ||
| 834 | (eq t org-clock-auto-clock-resolution)) | ||
| 835 | (not org-clock-clocking-in) | ||
| 836 | (not org-clock-resolving-clocks)) | ||
| 837 | (setq org-clock-left-over-time nil) | ||
| 838 | (let ((org-clock-clocking-in t)) | ||
| 839 | (org-resolve-clocks))) ; check if any clocks are dangling | ||
| 510 | (when (equal select '(4)) | 840 | (when (equal select '(4)) |
| 511 | (setq selected-task (org-clock-select-task "Clock-in on task: ")) | 841 | (setq selected-task (org-clock-select-task "Clock-in on task: ")) |
| 512 | (if selected-task | 842 | (if selected-task |
| @@ -519,12 +849,16 @@ the clocking selection, associated with the letter `d'." | |||
| 519 | (marker-position org-clock-marker) | 849 | (marker-position org-clock-marker) |
| 520 | (marker-buffer org-clock-marker)) | 850 | (marker-buffer org-clock-marker)) |
| 521 | (org-clock-out t)) | 851 | (org-clock-out t)) |
| 522 | 852 | ||
| 523 | (when (equal select '(16)) | 853 | (when (equal select '(16)) |
| 524 | ;; Mark as default clocking task | 854 | ;; Mark as default clocking task |
| 525 | (org-clock-mark-default-task)) | 855 | (org-clock-mark-default-task)) |
| 526 | 856 | ||
| 527 | (setq target-pos (point)) ;; we want to clock in at this location | 857 | ;; Clock in at which position? |
| 858 | (setq target-pos | ||
| 859 | (if (and (eobp) (not (org-on-heading-p))) | ||
| 860 | (point-at-bol 0) | ||
| 861 | (point))) | ||
| 528 | (run-hooks 'org-clock-in-prepare-hook) | 862 | (run-hooks 'org-clock-in-prepare-hook) |
| 529 | (save-excursion | 863 | (save-excursion |
| 530 | (when (and selected-task (marker-buffer selected-task)) | 864 | (when (and selected-task (marker-buffer selected-task)) |
| @@ -600,20 +934,37 @@ the clocking selection, associated with the letter `d'." | |||
| 600 | (setq org-clock-effort (org-get-effort)) | 934 | (setq org-clock-effort (org-get-effort)) |
| 601 | (setq org-clock-total-time (org-clock-sum-current-item | 935 | (setq org-clock-total-time (org-clock-sum-current-item |
| 602 | (org-clock-get-sum-start))) | 936 | (org-clock-get-sum-start))) |
| 603 | (setq org-clock-start-time (current-time)) | 937 | (setq org-clock-start-time |
| 938 | (or (and left-over | ||
| 939 | (y-or-n-p | ||
| 940 | (format | ||
| 941 | "You stopped another clock %d mins ago; start this one from then? " | ||
| 942 | (/ (- (org-float-time (current-time)) | ||
| 943 | (org-float-time left-over)) 60))) | ||
| 944 | left-over) | ||
| 945 | (current-time))) | ||
| 604 | (setq ts (org-insert-time-stamp org-clock-start-time | 946 | (setq ts (org-insert-time-stamp org-clock-start-time |
| 605 | 'with-hm 'inactive)))) | 947 | 'with-hm 'inactive)))) |
| 606 | (move-marker org-clock-marker (point) (buffer-base-buffer)) | 948 | (move-marker org-clock-marker (point) (buffer-base-buffer)) |
| 607 | (move-marker org-clock-hd-marker | 949 | (move-marker org-clock-hd-marker |
| 608 | (save-excursion (org-back-to-heading t) (point)) | 950 | (save-excursion (org-back-to-heading t) (point)) |
| 609 | (buffer-base-buffer)) | 951 | (buffer-base-buffer)) |
| 952 | (setq org-clock-has-been-used t) | ||
| 610 | (or global-mode-string (setq global-mode-string '(""))) | 953 | (or global-mode-string (setq global-mode-string '(""))) |
| 611 | (or (memq 'org-mode-line-string global-mode-string) | 954 | (or (memq 'org-mode-line-string global-mode-string) |
| 612 | (setq global-mode-string | 955 | (setq global-mode-string |
| 613 | (append global-mode-string '(org-mode-line-string)))) | 956 | (append global-mode-string '(org-mode-line-string)))) |
| 614 | (org-clock-update-mode-line) | 957 | (org-clock-update-mode-line) |
| 958 | (when org-clock-mode-line-timer | ||
| 959 | (cancel-timer org-clock-mode-line-timer) | ||
| 960 | (setq org-clock-mode-line-timer nil)) | ||
| 615 | (setq org-clock-mode-line-timer | 961 | (setq org-clock-mode-line-timer |
| 616 | (run-with-timer 60 60 'org-clock-update-mode-line)) | 962 | (run-with-timer 60 60 'org-clock-update-mode-line)) |
| 963 | (when org-clock-idle-timer | ||
| 964 | (cancel-timer org-clock-idle-timer) | ||
| 965 | (setq org-clock-idle-timer nil)) | ||
| 966 | (setq org-clock-idle-timer | ||
| 967 | (run-with-timer 60 60 'org-resolve-clocks-if-idle)) | ||
| 617 | (message "Clock starts at %s - %s" ts msg-extra) | 968 | (message "Clock starts at %s - %s" ts msg-extra) |
| 618 | (run-hooks 'org-clock-in-hook))))))) | 969 | (run-hooks 'org-clock-in-hook))))))) |
| 619 | 970 | ||
| @@ -744,7 +1095,7 @@ line and position cursor in that line." | |||
| 744 | (and (re-search-forward org-property-end-re nil t) | 1095 | (and (re-search-forward org-property-end-re nil t) |
| 745 | (goto-char (match-beginning 0)))))))) | 1096 | (goto-char (match-beginning 0)))))))) |
| 746 | 1097 | ||
| 747 | (defun org-clock-out (&optional fail-quietly) | 1098 | (defun org-clock-out (&optional fail-quietly at-time) |
| 748 | "Stop the currently running clock. | 1099 | "Stop the currently running clock. |
| 749 | If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | 1100 | If there is no running clock, throw an error, unless FAIL-QUIETLY is set." |
| 750 | (interactive) | 1101 | (interactive) |
| @@ -752,7 +1103,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | |||
| 752 | (if (not (marker-buffer org-clock-marker)) | 1103 | (if (not (marker-buffer org-clock-marker)) |
| 753 | (if fail-quietly (throw 'exit t) (error "No active clock"))) | 1104 | (if fail-quietly (throw 'exit t) (error "No active clock"))) |
| 754 | (let (ts te s h m remove) | 1105 | (let (ts te s h m remove) |
| 755 | (with-current-buffer (marker-buffer org-clock-marker) | 1106 | (save-excursion |
| 1107 | (set-buffer (marker-buffer org-clock-marker)) | ||
| 756 | (save-restriction | 1108 | (save-restriction |
| 757 | (widen) | 1109 | (widen) |
| 758 | (goto-char org-clock-marker) | 1110 | (goto-char org-clock-marker) |
| @@ -764,7 +1116,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | |||
| 764 | (goto-char (match-end 0)) | 1116 | (goto-char (match-end 0)) |
| 765 | (delete-region (point) (point-at-eol)) | 1117 | (delete-region (point) (point-at-eol)) |
| 766 | (insert "--") | 1118 | (insert "--") |
| 767 | (setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive)) | 1119 | (setq te (org-insert-time-stamp (or at-time (current-time)) |
| 1120 | 'with-hm 'inactive)) | ||
| 768 | (setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te))) | 1121 | (setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te))) |
| 769 | (org-float-time (apply 'encode-time (org-parse-time-string ts)))) | 1122 | (org-float-time (apply 'encode-time (org-parse-time-string ts)))) |
| 770 | h (floor (/ s 3600)) | 1123 | h (floor (/ s 3600)) |
| @@ -786,6 +1139,9 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | |||
| 786 | (when org-clock-mode-line-timer | 1139 | (when org-clock-mode-line-timer |
| 787 | (cancel-timer org-clock-mode-line-timer) | 1140 | (cancel-timer org-clock-mode-line-timer) |
| 788 | (setq org-clock-mode-line-timer nil)) | 1141 | (setq org-clock-mode-line-timer nil)) |
| 1142 | (when org-clock-idle-timer | ||
| 1143 | (cancel-timer org-clock-idle-timer) | ||
| 1144 | (setq org-clock-idle-timer nil)) | ||
| 789 | (setq global-mode-string | 1145 | (setq global-mode-string |
| 790 | (delq 'org-mode-line-string global-mode-string)) | 1146 | (delq 'org-mode-line-string global-mode-string)) |
| 791 | (when org-clock-out-switch-to-state | 1147 | (when org-clock-out-switch-to-state |
| @@ -813,11 +1169,14 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | |||
| 813 | (interactive) | 1169 | (interactive) |
| 814 | (if (not (marker-buffer org-clock-marker)) | 1170 | (if (not (marker-buffer org-clock-marker)) |
| 815 | (error "No active clock")) | 1171 | (error "No active clock")) |
| 816 | (with-current-buffer (marker-buffer org-clock-marker) | 1172 | (save-excursion |
| 1173 | (set-buffer (marker-buffer org-clock-marker)) | ||
| 817 | (goto-char org-clock-marker) | 1174 | (goto-char org-clock-marker) |
| 818 | (delete-region (1- (point-at-bol)) (point-at-eol))) | 1175 | (delete-region (1- (point-at-bol)) (point-at-eol)) |
| 819 | (move-marker 'org-clock-marker nil) | 1176 | ;; Just in case, remove any empty LOGBOOK left over |
| 820 | (move-marker 'org-clock-hd-marker nil) | 1177 | (org-remove-empty-drawer-at "LOGBOOK" (point))) |
| 1178 | (move-marker org-clock-marker nil) | ||
| 1179 | (move-marker org-clock-hd-marker nil) | ||
| 821 | (setq global-mode-string | 1180 | (setq global-mode-string |
| 822 | (delq 'org-mode-line-string global-mode-string)) | 1181 | (delq 'org-mode-line-string global-mode-string)) |
| 823 | (force-mode-line-update) | 1182 | (force-mode-line-update) |
| @@ -940,7 +1299,12 @@ in the echo area." | |||
| 940 | (when org-remove-highlights-with-change | 1299 | (when org-remove-highlights-with-change |
| 941 | (org-add-hook 'before-change-functions 'org-clock-remove-overlays | 1300 | (org-add-hook 'before-change-functions 'org-clock-remove-overlays |
| 942 | nil 'local)))) | 1301 | nil 'local)))) |
| 943 | (message (concat "Total file time: " org-time-clocksum-format " (%d hours and %d minutes)") h m h m))) | 1302 | (if org-time-clocksum-use-fractional |
| 1303 | (message (concat "Total file time: " org-time-clocksum-fractional-format | ||
| 1304 | " (%d hours and %d minutes)") | ||
| 1305 | (/ (+ (* h 60.0) m) 60.0) h m) | ||
| 1306 | (message (concat "Total file time: " org-time-clocksum-format | ||
| 1307 | " (%d hours and %d minutes)") h m h m)))) | ||
| 944 | 1308 | ||
| 945 | (defvar org-clock-overlays nil) | 1309 | (defvar org-clock-overlays nil) |
| 946 | (make-variable-buffer-local 'org-clock-overlays) | 1310 | (make-variable-buffer-local 'org-clock-overlays) |
| @@ -952,7 +1316,9 @@ This creates a new overlay and stores it in `org-clock-overlays', so that it | |||
| 952 | will be easy to remove." | 1316 | will be easy to remove." |
| 953 | (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) | 1317 | (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) |
| 954 | (l (if level (org-get-valid-level level 0) 0)) | 1318 | (l (if level (org-get-valid-level level 0) 0)) |
| 955 | (fmt (concat "%s " org-time-clocksum-format "%s")) | 1319 | (fmt (concat "%s " (if org-time-clocksum-use-fractional |
| 1320 | org-time-clocksum-fractional-format | ||
| 1321 | org-time-clocksum-format) "%s")) | ||
| 956 | (off 0) | 1322 | (off 0) |
| 957 | ov tx) | 1323 | ov tx) |
| 958 | (org-move-to-column c) | 1324 | (org-move-to-column c) |
| @@ -961,9 +1327,14 @@ will be easy to remove." | |||
| 961 | (setq ov (org-make-overlay (1- (point)) (point-at-eol)) | 1327 | (setq ov (org-make-overlay (1- (point)) (point-at-eol)) |
| 962 | tx (concat (buffer-substring (1- (point)) (point)) | 1328 | tx (concat (buffer-substring (1- (point)) (point)) |
| 963 | (make-string (+ off (max 0 (- c (current-column)))) ?.) | 1329 | (make-string (+ off (max 0 (- c (current-column)))) ?.) |
| 964 | (org-add-props (format fmt | 1330 | (org-add-props (if org-time-clocksum-use-fractional |
| 965 | (make-string l ?*) h m | 1331 | (format fmt |
| 966 | (make-string (- 16 l) ?\ )) | 1332 | (make-string l ?*) |
| 1333 | (/ (+ (* h 60.0) m) 60.0) | ||
| 1334 | (make-string (- 16 l) ?\ )) | ||
| 1335 | (format fmt | ||
| 1336 | (make-string l ?*) h m | ||
| 1337 | (make-string (- 16 l) ?\ ))) | ||
| 967 | (list 'face 'org-clock-overlay)) | 1338 | (list 'face 'org-clock-overlay)) |
| 968 | "")) | 1339 | "")) |
| 969 | (if (not (featurep 'xemacs)) | 1340 | (if (not (featurep 'xemacs)) |
| @@ -1462,11 +1833,17 @@ This function is made for clock tables." | |||
| 1462 | tot)))) | 1833 | tot)))) |
| 1463 | 0)))) | 1834 | 0)))) |
| 1464 | 1835 | ||
| 1836 | (defvar org-clock-loaded nil | ||
| 1837 | "Was the clock file loaded?") | ||
| 1838 | |||
| 1465 | (defun org-clock-save () | 1839 | (defun org-clock-save () |
| 1466 | "Persist various clock-related data to disk. | 1840 | "Persist various clock-related data to disk. |
| 1467 | The details of what will be saved are regulated by the variable | 1841 | The details of what will be saved are regulated by the variable |
| 1468 | `org-clock-persist'." | 1842 | `org-clock-persist'." |
| 1469 | (when org-clock-persist | 1843 | (when (and org-clock-persist |
| 1844 | (or org-clock-loaded | ||
| 1845 | org-clock-has-been-used | ||
| 1846 | (not (file-exists-p org-clock-persist-file)))) | ||
| 1470 | (let (b) | 1847 | (let (b) |
| 1471 | (with-current-buffer (find-file (expand-file-name org-clock-persist-file)) | 1848 | (with-current-buffer (find-file (expand-file-name org-clock-persist-file)) |
| 1472 | (progn | 1849 | (progn |
| @@ -1475,7 +1852,8 @@ The details of what will be saved are regulated by the variable | |||
| 1475 | (insert (format ";; org-persist.el - %s at %s\n" | 1852 | (insert (format ";; org-persist.el - %s at %s\n" |
| 1476 | system-name (format-time-string | 1853 | system-name (format-time-string |
| 1477 | (cdr org-time-stamp-formats)))) | 1854 | (cdr org-time-stamp-formats)))) |
| 1478 | (if (and (setq b (marker-buffer org-clock-marker)) | 1855 | (if (and (memq org-clock-persist '(t clock)) |
| 1856 | (setq b (marker-buffer org-clock-marker)) | ||
| 1479 | (setq b (or (buffer-base-buffer b) b)) | 1857 | (setq b (or (buffer-base-buffer b) b)) |
| 1480 | (buffer-live-p b) | 1858 | (buffer-live-p b) |
| 1481 | (buffer-file-name b) | 1859 | (buffer-file-name b) |
| @@ -1489,7 +1867,8 @@ The details of what will be saved are regulated by the variable | |||
| 1489 | "))\n")) | 1867 | "))\n")) |
| 1490 | ;; Store clocked task history. Tasks are stored reversed to make | 1868 | ;; Store clocked task history. Tasks are stored reversed to make |
| 1491 | ;; reading simpler | 1869 | ;; reading simpler |
| 1492 | (when (and org-clock-history (eq org-clock-persist t)) | 1870 | (when (and (memq org-clock-persist '(t history)) |
| 1871 | org-clock-history) | ||
| 1493 | (insert | 1872 | (insert |
| 1494 | "(setq stored-clock-history '(" | 1873 | "(setq stored-clock-history '(" |
| 1495 | (mapconcat | 1874 | (mapconcat |
| @@ -1505,9 +1884,6 @@ The details of what will be saved are regulated by the variable | |||
| 1505 | (save-buffer) | 1884 | (save-buffer) |
| 1506 | (kill-buffer (current-buffer))))))) | 1885 | (kill-buffer (current-buffer))))))) |
| 1507 | 1886 | ||
| 1508 | (defvar org-clock-loaded nil | ||
| 1509 | "Was the clock file loaded?") | ||
| 1510 | |||
| 1511 | (defun org-clock-load () | 1887 | (defun org-clock-load () |
| 1512 | "Load clock-related data from disk, maybe resuming a stored clock." | 1888 | "Load clock-related data from disk, maybe resuming a stored clock." |
| 1513 | (when (and org-clock-persist (not org-clock-loaded)) | 1889 | (when (and org-clock-persist (not org-clock-loaded)) |
| @@ -1545,9 +1921,10 @@ The details of what will be saved are regulated by the variable | |||
| 1545 | (when (file-exists-p (car resume-clock)) | 1921 | (when (file-exists-p (car resume-clock)) |
| 1546 | (with-current-buffer (find-file (car resume-clock)) | 1922 | (with-current-buffer (find-file (car resume-clock)) |
| 1547 | (goto-char (cdr resume-clock)) | 1923 | (goto-char (cdr resume-clock)) |
| 1548 | (org-clock-in) | 1924 | (let ((org-clock-auto-clock-resolution nil)) |
| 1549 | (if (org-invisible-p) | 1925 | (org-clock-in) |
| 1550 | (org-show-context))))))))) | 1926 | (if (org-invisible-p) |
| 1927 | (org-show-context)))))))))) | ||
| 1551 | 1928 | ||
| 1552 | ;;;###autoload | 1929 | ;;;###autoload |
| 1553 | (defun org-clock-persistence-insinuate () | 1930 | (defun org-clock-persistence-insinuate () |
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 3dbb9140d0e..dfe006b805c 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -34,6 +34,7 @@ | |||
| 34 | (require 'org) | 34 | (require 'org) |
| 35 | 35 | ||
| 36 | (declare-function org-agenda-redo "org-agenda" ()) | 36 | (declare-function org-agenda-redo "org-agenda" ()) |
| 37 | (declare-function org-agenda-show "org-agenda" (&optional full-entry)) | ||
| 37 | 38 | ||
| 38 | ;;; Column View | 39 | ;;; Column View |
| 39 | 40 | ||
| @@ -91,14 +92,22 @@ This is the compiled version of the format.") | |||
| 91 | (beginning-of-line 2) | 92 | (beginning-of-line 2) |
| 92 | (while (and (org-invisible-p2) (not (eobp))) | 93 | (while (and (org-invisible-p2) (not (eobp))) |
| 93 | (beginning-of-line 2)) | 94 | (beginning-of-line 2)) |
| 94 | (move-to-column col)))) | 95 | (move-to-column col) |
| 96 | (if (and (eq major-mode 'org-agenda-mode) | ||
| 97 | (org-bound-and-true-p org-agenda-follow-mode) | ||
| 98 | (org-get-at-bol 'org-marker)) | ||
| 99 | (org-agenda-show))))) | ||
| 95 | (org-defkey org-columns-map [up] | 100 | (org-defkey org-columns-map [up] |
| 96 | (lambda () (interactive) | 101 | (lambda () (interactive) |
| 97 | (let ((col (current-column))) | 102 | (let ((col (current-column))) |
| 98 | (beginning-of-line 0) | 103 | (beginning-of-line 0) |
| 99 | (while (and (org-invisible-p2) (not (bobp))) | 104 | (while (and (org-invisible-p2) (not (bobp))) |
| 100 | (beginning-of-line 0)) | 105 | (beginning-of-line 0)) |
| 101 | (move-to-column col)))) | 106 | (move-to-column col) |
| 107 | (if (and (eq major-mode 'org-agenda-mode) | ||
| 108 | (org-bound-and-true-p org-agenda-follow-mode) | ||
| 109 | (org-get-at-bol 'org-marker)) | ||
| 110 | (org-agenda-show))))) | ||
| 102 | (org-defkey org-columns-map [(shift right)] 'org-columns-next-allowed-value) | 111 | (org-defkey org-columns-map [(shift right)] 'org-columns-next-allowed-value) |
| 103 | (org-defkey org-columns-map "n" 'org-columns-next-allowed-value) | 112 | (org-defkey org-columns-map "n" 'org-columns-next-allowed-value) |
| 104 | (org-defkey org-columns-map [(shift left)] 'org-columns-previous-allowed-value) | 113 | (org-defkey org-columns-map [(shift left)] 'org-columns-previous-allowed-value) |
| @@ -111,8 +120,8 @@ This is the compiled version of the format.") | |||
| 111 | (org-defkey org-columns-map [(shift meta left)] 'org-columns-delete) | 120 | (org-defkey org-columns-map [(shift meta left)] 'org-columns-delete) |
| 112 | (dotimes (i 10) | 121 | (dotimes (i 10) |
| 113 | (org-defkey org-columns-map (number-to-string i) | 122 | (org-defkey org-columns-map (number-to-string i) |
| 114 | `(lambda () (interactive) | 123 | `(lambda () (interactive) |
| 115 | (org-columns-next-allowed-value nil ,i)))) | 124 | (org-columns-next-allowed-value nil ,i)))) |
| 116 | 125 | ||
| 117 | (easy-menu-define org-columns-menu org-columns-map "Org Column Menu" | 126 | (easy-menu-define org-columns-menu org-columns-map "Org Column Menu" |
| 118 | '("Column" | 127 | '("Column" |
| @@ -165,7 +174,7 @@ This is the compiled version of the format.") | |||
| 165 | (face1 (list color 'org-agenda-column-dateline ref-face)) | 174 | (face1 (list color 'org-agenda-column-dateline ref-face)) |
| 166 | (pl (or (get-text-property (point-at-bol) 'prefix-length) 0)) | 175 | (pl (or (get-text-property (point-at-bol) 'prefix-length) 0)) |
| 167 | (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp)) | 176 | (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp)) |
| 168 | pom property ass width f string ov column val modval s2 title) | 177 | pom property ass width f string ov column val modval s2 title calc) |
| 169 | ;; Check if the entry is in another buffer. | 178 | ;; Check if the entry is in another buffer. |
| 170 | (unless props | 179 | (unless props |
| 171 | (if (eq major-mode 'org-agenda-mode) | 180 | (if (eq major-mode 'org-agenda-mode) |
| @@ -189,19 +198,26 @@ This is the compiled version of the format.") | |||
| 189 | (nth 2 column) | 198 | (nth 2 column) |
| 190 | (length property)) | 199 | (length property)) |
| 191 | f (format "%%-%d.%ds | " width width) | 200 | f (format "%%-%d.%ds | " width width) |
| 201 | calc (nth 7 column) | ||
| 192 | val (or (cdr ass) "") | 202 | val (or (cdr ass) "") |
| 193 | modval (or (and org-columns-modify-value-for-display-function | 203 | modval (cond ((and org-columns-modify-value-for-display-function |
| 194 | (functionp | 204 | (functionp |
| 195 | org-columns-modify-value-for-display-function) | 205 | org-columns-modify-value-for-display-function)) |
| 196 | (funcall | 206 | (funcall org-columns-modify-value-for-display-function |
| 197 | org-columns-modify-value-for-display-function | 207 | title val)) |
| 198 | title val)) | 208 | ((equal property "ITEM") |
| 199 | (if (equal property "ITEM") | 209 | (if (org-mode-p) |
| 200 | (if (org-mode-p) | 210 | (org-columns-cleanup-item |
| 201 | (org-columns-cleanup-item | 211 | val org-columns-current-fmt-compiled) |
| 202 | val org-columns-current-fmt-compiled) | 212 | (org-agenda-columns-cleanup-item |
| 203 | (org-agenda-columns-cleanup-item | 213 | val pl cphr org-columns-current-fmt-compiled))) |
| 204 | val pl cphr org-columns-current-fmt-compiled))))) | 214 | ((and calc (functionp calc) |
| 215 | (not (string= val "")) | ||
| 216 | (not (get-text-property 0 'org-computed val))) | ||
| 217 | (org-columns-number-to-string | ||
| 218 | (funcall calc (org-columns-string-to-number | ||
| 219 | val (nth 4 column))) | ||
| 220 | (nth 4 column))))) | ||
| 205 | (setq s2 (org-columns-add-ellipses (or modval val) width)) | 221 | (setq s2 (org-columns-add-ellipses (or modval val) width)) |
| 206 | (setq string (format f s2)) | 222 | (setq string (format f s2)) |
| 207 | ;; Create the overlay | 223 | ;; Create the overlay |
| @@ -220,18 +236,18 @@ This is the compiled version of the format.") | |||
| 220 | (save-excursion | 236 | (save-excursion |
| 221 | (goto-char beg) | 237 | (goto-char beg) |
| 222 | (org-unmodified (insert " ")))))) ;; FIXME: add props and remove later? | 238 | (org-unmodified (insert " ")))))) ;; FIXME: add props and remove later? |
| 223 | ;; Make the rest of the line disappear. | 239 | ;; Make the rest of the line disappear. |
| 224 | (org-unmodified | 240 | (org-unmodified |
| 225 | (setq ov (org-columns-new-overlay beg (point-at-eol))) | 241 | (setq ov (org-columns-new-overlay beg (point-at-eol))) |
| 226 | (org-overlay-put ov 'invisible t) | 242 | (org-overlay-put ov 'invisible t) |
| 227 | (org-overlay-put ov 'keymap org-columns-map) | 243 | (org-overlay-put ov 'keymap org-columns-map) |
| 228 | (org-overlay-put ov 'intangible t) | 244 | (org-overlay-put ov 'intangible t) |
| 229 | (push ov org-columns-overlays) | 245 | (push ov org-columns-overlays) |
| 230 | (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) | 246 | (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) |
| 231 | (org-overlay-put ov 'keymap org-columns-map) | 247 | (org-overlay-put ov 'keymap org-columns-map) |
| 232 | (push ov org-columns-overlays) | 248 | (push ov org-columns-overlays) |
| 233 | (let ((inhibit-read-only t)) | 249 | (let ((inhibit-read-only t)) |
| 234 | (put-text-property (max (point-min) (1- (point-at-bol))) | 250 | (put-text-property (max (point-min) (1- (point-at-bol))) |
| 235 | (min (point-max) (1+ (point-at-eol))) | 251 | (min (point-max) (1+ (point-at-eol))) |
| 236 | 'read-only "Type `e' to edit property"))))) | 252 | 'read-only "Type `e' to edit property"))))) |
| 237 | 253 | ||
| @@ -257,6 +273,7 @@ for the duration of the command.") | |||
| 257 | 273 | ||
| 258 | (defvar header-line-format) | 274 | (defvar header-line-format) |
| 259 | (defvar org-columns-previous-hscroll 0) | 275 | (defvar org-columns-previous-hscroll 0) |
| 276 | |||
| 260 | (defun org-columns-display-here-title () | 277 | (defun org-columns-display-here-title () |
| 261 | "Overlay the newline before the current line with the table title." | 278 | "Overlay the newline before the current line with the table title." |
| 262 | (interactive) | 279 | (interactive) |
| @@ -347,6 +364,7 @@ for the duration of the command.") | |||
| 347 | s) | 364 | s) |
| 348 | 365 | ||
| 349 | (defvar org-agenda-columns-remove-prefix-from-item) | 366 | (defvar org-agenda-columns-remove-prefix-from-item) |
| 367 | |||
| 350 | (defun org-agenda-columns-cleanup-item (item pl cphr fmt) | 368 | (defun org-agenda-columns-cleanup-item (item pl cphr fmt) |
| 351 | "Cleanup the time property for agenda column view. | 369 | "Cleanup the time property for agenda column view. |
| 352 | See also the variable `org-agenda-columns-remove-prefix-from-item'." | 370 | See also the variable `org-agenda-columns-remove-prefix-from-item'." |
| @@ -366,6 +384,7 @@ See also the variable `org-agenda-columns-remove-prefix-from-item'." | |||
| 366 | (message "Value is: %s" (or value "")))) | 384 | (message "Value is: %s" (or value "")))) |
| 367 | 385 | ||
| 368 | (defvar org-agenda-columns-active) ;; defined in org-agenda.el | 386 | (defvar org-agenda-columns-active) ;; defined in org-agenda.el |
| 387 | |||
| 369 | (defun org-columns-quit () | 388 | (defun org-columns-quit () |
| 370 | "Remove the column overlays and in this way exit column editing." | 389 | "Remove the column overlays and in this way exit column editing." |
| 371 | (interactive) | 390 | (interactive) |
| @@ -417,6 +436,7 @@ Where possible, use the standard interface for changing this line." | |||
| 417 | (<= (overlay-start x) eol) | 436 | (<= (overlay-start x) eol) |
| 418 | x)) | 437 | x)) |
| 419 | org-columns-overlays))) | 438 | org-columns-overlays))) |
| 439 | (org-columns-time (time-to-number-of-days (current-time))) | ||
| 420 | nval eval allowed) | 440 | nval eval allowed) |
| 421 | (cond | 441 | (cond |
| 422 | ((equal key "CLOCKSUM") | 442 | ((equal key "CLOCKSUM") |
| @@ -661,7 +681,8 @@ around it." | |||
| 661 | (org-verify-version 'columns) | 681 | (org-verify-version 'columns) |
| 662 | (org-columns-remove-overlays) | 682 | (org-columns-remove-overlays) |
| 663 | (move-marker org-columns-begin-marker (point)) | 683 | (move-marker org-columns-begin-marker (point)) |
| 664 | (let (beg end fmt cache maxwidths) | 684 | (let ((org-columns-time (time-to-number-of-days (current-time))) |
| 685 | beg end fmt cache maxwidths) | ||
| 665 | (setq fmt (org-columns-get-format-and-top-level)) | 686 | (setq fmt (org-columns-get-format-and-top-level)) |
| 666 | (save-excursion | 687 | (save-excursion |
| 667 | (goto-char org-columns-top-level-marker) | 688 | (goto-char org-columns-top-level-marker) |
| @@ -678,7 +699,7 @@ around it." | |||
| 678 | (narrow-to-region beg end) | 699 | (narrow-to-region beg end) |
| 679 | (org-clock-sum)))) | 700 | (org-clock-sum)))) |
| 680 | (while (re-search-forward (concat "^" outline-regexp) end t) | 701 | (while (re-search-forward (concat "^" outline-regexp) end t) |
| 681 | (if (and org-columns-skip-arrchived-trees | 702 | (if (and org-columns-skip-archived-trees |
| 682 | (looking-at (concat ".*:" org-archive-tag ":"))) | 703 | (looking-at (concat ".*:" org-archive-tag ":"))) |
| 683 | (org-end-of-subtree t) | 704 | (org-end-of-subtree t) |
| 684 | (push (cons (org-current-line) (org-entry-properties)) cache))) | 705 | (push (cons (org-current-line) (org-entry-properties)) cache))) |
| @@ -698,23 +719,43 @@ around it." | |||
| 698 | (org-columns-display-here (cdr x))) | 719 | (org-columns-display-here (cdr x))) |
| 699 | cache))))) | 720 | cache))))) |
| 700 | 721 | ||
| 722 | (eval-when-compile (defvar org-columns-time)) | ||
| 723 | |||
| 701 | (defvar org-columns-compile-map | 724 | (defvar org-columns-compile-map |
| 702 | '(("none" none +) | 725 | '(("none" none +) |
| 703 | (":" add_times +) | 726 | (":" add_times +) |
| 704 | ("+" add_numbers +) | 727 | ("+" add_numbers +) |
| 705 | ("$" currency +) | 728 | ("$" currency +) |
| 706 | ("X" checkbox +) | 729 | ("X" checkbox +) |
| 707 | ("X/" checkbox-n-of-m +) | 730 | ("X/" checkbox-n-of-m +) |
| 708 | ("X%" checkbox-percent +) | 731 | ("X%" checkbox-percent +) |
| 709 | ("max" max_numbers max) | 732 | ("max" max_numbers max) |
| 710 | ("min" min_numbers min) | 733 | ("min" min_numbers min) |
| 711 | ("mean" mean_numbers (lambda (&rest x) (/ (apply '+ x) (float (length x))))) | 734 | ("mean" mean_numbers |
| 712 | (":max" max_times max) | 735 | (lambda (&rest x) (/ (apply '+ x) (float (length x))))) |
| 713 | (":min" min_times min) | 736 | (":max" max_times max) |
| 714 | (":mean" mean_times (lambda (&rest x) (/ (apply '+ x) (float (length x)))))) | 737 | (":min" min_times min) |
| 715 | "Operator <-> format,function map. | 738 | (":mean" mean_times |
| 739 | (lambda (&rest x) (/ (apply '+ x) (float (length x))))) | ||
| 740 | ("@min" min_age min (lambda (x) (- org-columns-time x))) | ||
| 741 | ("@max" max_age max (lambda (x) (- org-columns-time x))) | ||
| 742 | ("@mean" mean_age | ||
| 743 | (lambda (&rest x) (/ (apply '+ x) (float (length x)))) | ||
| 744 | (lambda (x) (- org-columns-time x)))) | ||
| 745 | "Operator <-> format,function,calc map. | ||
| 716 | Used to compile/uncompile columns format and completing read in | 746 | Used to compile/uncompile columns format and completing read in |
| 717 | interactive function org-columns-new.") | 747 | interactive function org-columns-new. |
| 748 | |||
| 749 | operator string used in #+COLUMNS definition describing the | ||
| 750 | summary type | ||
| 751 | format symbol describing summary type selected interactively in | ||
| 752 | org-columns-new and internally in | ||
| 753 | org-columns-number-to-string and | ||
| 754 | org-columns-string-to-number | ||
| 755 | function called with a list of values as argument to calculate | ||
| 756 | the summary value | ||
| 757 | calc function called on every element before summarizing. This is | ||
| 758 | optional and should only be specified if needed") | ||
| 718 | 759 | ||
| 719 | (defun org-columns-new (&optional prop title width op fmt fun &rest rest) | 760 | (defun org-columns-new (&optional prop title width op fmt fun &rest rest) |
| 720 | "Insert a new column, to the left of the current column." | 761 | "Insert a new column, to the left of the current column." |
| @@ -735,7 +776,7 @@ interactive function org-columns-new.") | |||
| 735 | org-columns-compile-map) | 776 | org-columns-compile-map) |
| 736 | nil t)) | 777 | nil t)) |
| 737 | (setq fmt (intern fmt) | 778 | (setq fmt (intern fmt) |
| 738 | fun (cadr (assoc fmt (mapcar 'cdr org-columns-compile-map)))) | 779 | fun (cdr (assoc fmt (mapcar 'cdr org-columns-compile-map)))) |
| 739 | (if (eq fmt 'none) (setq fmt nil)) | 780 | (if (eq fmt 'none) (setq fmt nil)) |
| 740 | (if editp | 781 | (if editp |
| 741 | (progn | 782 | (progn |
| @@ -743,7 +784,8 @@ interactive function org-columns-new.") | |||
| 743 | (setcdr editp (list title width nil fmt nil fun))) | 784 | (setcdr editp (list title width nil fmt nil fun))) |
| 744 | (setq cell (nthcdr (1- (current-column)) | 785 | (setq cell (nthcdr (1- (current-column)) |
| 745 | org-columns-current-fmt-compiled)) | 786 | org-columns-current-fmt-compiled)) |
| 746 | (setcdr cell (cons (list prop title width nil fmt nil fun) | 787 | (setcdr cell (cons (list prop title width nil fmt nil |
| 788 | (car fun) (cadr fun)) | ||
| 747 | (cdr cell)))) | 789 | (cdr cell)))) |
| 748 | (org-columns-store-format) | 790 | (org-columns-store-format) |
| 749 | (org-columns-redo))) | 791 | (org-columns-redo))) |
| @@ -860,7 +902,9 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 860 | "Compute all columns that have operators defined." | 902 | "Compute all columns that have operators defined." |
| 861 | (org-unmodified | 903 | (org-unmodified |
| 862 | (remove-text-properties (point-min) (point-max) '(org-summaries t))) | 904 | (remove-text-properties (point-min) (point-max) '(org-summaries t))) |
| 863 | (let ((columns org-columns-current-fmt-compiled) col) | 905 | (let ((columns org-columns-current-fmt-compiled) |
| 906 | (org-columns-time (time-to-number-of-days (current-time))) | ||
| 907 | col) | ||
| 864 | (while (setq col (pop columns)) | 908 | (while (setq col (pop columns)) |
| 865 | (when (nth 3 col) | 909 | (when (nth 3 col) |
| 866 | (save-excursion | 910 | (save-excursion |
| @@ -895,6 +939,7 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 895 | (format (nth 4 ass)) | 939 | (format (nth 4 ass)) |
| 896 | (printf (nth 5 ass)) | 940 | (printf (nth 5 ass)) |
| 897 | (fun (nth 6 ass)) | 941 | (fun (nth 6 ass)) |
| 942 | (calc (or (nth 7 ass) 'identity)) | ||
| 898 | (beg org-columns-top-level-marker) | 943 | (beg org-columns-top-level-marker) |
| 899 | last-level val valflag flag end sumpos sum-alist sum str str1 useval) | 944 | last-level val valflag flag end sumpos sum-alist sum str str1 useval) |
| 900 | (save-excursion | 945 | (save-excursion |
| @@ -927,10 +972,12 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 927 | (list 'org-summaries sum-alist)))) | 972 | (list 'org-summaries sum-alist)))) |
| 928 | (when (and val (not (equal val (if flag str val)))) | 973 | (when (and val (not (equal val (if flag str val)))) |
| 929 | (org-entry-put nil property (if flag str val))) | 974 | (org-entry-put nil property (if flag str val))) |
| 930 | ;; add current to current level accumulator | 975 | ;; add current to current level accumulator |
| 931 | (when (or flag valflag) | 976 | (when (or flag valflag) |
| 932 | (push (if flag sum | 977 | (push (if flag |
| 933 | (org-column-string-to-number (if flag str val) format)) | 978 | sum |
| 979 | (funcall calc (org-columns-string-to-number | ||
| 980 | (if flag str val) format))) | ||
| 934 | (aref lvals level)) | 981 | (aref lvals level)) |
| 935 | (aset lflag level t)) | 982 | (aset lflag level t)) |
| 936 | ;; clear accumulators for deeper levels | 983 | ;; clear accumulators for deeper levels |
| @@ -940,8 +987,8 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 940 | ((>= level last-level) | 987 | ((>= level last-level) |
| 941 | ;; add what we have here to the accumulator for this level | 988 | ;; add what we have here to the accumulator for this level |
| 942 | (when valflag | 989 | (when valflag |
| 943 | (push (org-column-string-to-number val format) | 990 | (push (funcall calc (org-columns-string-to-number val format)) |
| 944 | (aref lvals level)) | 991 | (aref lvals level)) |
| 945 | (aset lflag level t))) | 992 | (aset lflag level t))) |
| 946 | (t (error "This should not happen"))))))) | 993 | (t (error "This should not happen"))))))) |
| 947 | 994 | ||
| @@ -967,7 +1014,6 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 967 | (if (eq major-mode 'org-agenda-mode) | 1014 | (if (eq major-mode 'org-agenda-mode) |
| 968 | (error "This command is only allowed in Org-mode buffers"))) | 1015 | (error "This command is only allowed in Org-mode buffers"))) |
| 969 | 1016 | ||
| 970 | |||
| 971 | (defun org-string-to-number (s) | 1017 | (defun org-string-to-number (s) |
| 972 | "Convert string to number, and interpret hh:mm:ss." | 1018 | "Convert string to number, and interpret hh:mm:ss." |
| 973 | (if (not (string-match ":" s)) | 1019 | (if (not (string-match ":" s)) |
| @@ -994,6 +1040,8 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 994 | (printf (format printf n)) | 1040 | (printf (format printf n)) |
| 995 | ((eq fmt 'currency) | 1041 | ((eq fmt 'currency) |
| 996 | (format "%.2f" n)) | 1042 | (format "%.2f" n)) |
| 1043 | ((memq fmt '(min_age max_age mean_age)) | ||
| 1044 | (org-format-time-period n)) | ||
| 997 | (t (number-to-string n)))) | 1045 | (t (number-to-string n)))) |
| 998 | 1046 | ||
| 999 | (defun org-nofm-to-completion (n m &optional percent) | 1047 | (defun org-nofm-to-completion (n m &optional percent) |
| @@ -1001,21 +1049,33 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 1001 | (format "[%d/%d]" n m) | 1049 | (format "[%d/%d]" n m) |
| 1002 | (format "[%d%%]"(floor (+ 0.5 (* 100. (/ (* 1.0 n) m))))))) | 1050 | (format "[%d%%]"(floor (+ 0.5 (* 100. (/ (* 1.0 n) m))))))) |
| 1003 | 1051 | ||
| 1004 | (defun org-column-string-to-number (s fmt) | 1052 | (defun org-columns-string-to-number (s fmt) |
| 1005 | "Convert a column value to a number that can be used for column computing." | 1053 | "Convert a column value to a number that can be used for column computing." |
| 1006 | (cond | 1054 | (if s |
| 1007 | ((string-match ":" s) | 1055 | (cond |
| 1008 | (let ((l (nreverse (org-split-string s ":"))) (sum 0.0)) | 1056 | ((memq fmt '(min_age max_age mean_age)) |
| 1009 | (while l | 1057 | (cond ((string= s "") org-columns-time) |
| 1010 | (setq sum (+ (string-to-number (pop l)) (/ sum 60)))) | 1058 | ((string-match |
| 1011 | sum)) | 1059 | "\\([0-9]+\\)d \\([0-9]+\\)h \\([0-9]+\\)m \\([0-9]+\\)s" |
| 1012 | ((memq fmt '(checkbox checkbox-n-of-m checkbox-percent)) | 1060 | s) |
| 1013 | (if (equal s "[X]") 1. 0.000001)) | 1061 | (+ (* 60 (+ (* 60 (+ (* 24 (string-to-number (match-string 1 s))) |
| 1014 | (t (string-to-number s)))) | 1062 | (string-to-number (match-string 2 s)))) |
| 1063 | (string-to-number (match-string 3 s)))) | ||
| 1064 | (string-to-number (match-string 4 s)))) | ||
| 1065 | (t (time-to-number-of-days (apply 'encode-time | ||
| 1066 | (org-parse-time-string s t)))))) | ||
| 1067 | ((string-match ":" s) | ||
| 1068 | (let ((l (nreverse (org-split-string s ":"))) (sum 0.0)) | ||
| 1069 | (while l | ||
| 1070 | (setq sum (+ (string-to-number (pop l)) (/ sum 60)))) | ||
| 1071 | sum)) | ||
| 1072 | ((memq fmt '(checkbox checkbox-n-of-m checkbox-percent)) | ||
| 1073 | (if (equal s "[X]") 1. 0.000001)) | ||
| 1074 | (t (string-to-number s))))) | ||
| 1015 | 1075 | ||
| 1016 | (defun org-columns-uncompile-format (cfmt) | 1076 | (defun org-columns-uncompile-format (cfmt) |
| 1017 | "Turn the compiled columns format back into a string representation." | 1077 | "Turn the compiled columns format back into a string representation." |
| 1018 | (let ((rtn "") e s prop title op op-match width fmt printf fun) | 1078 | (let ((rtn "") e s prop title op op-match width fmt printf fun calc) |
| 1019 | (while (setq e (pop cfmt)) | 1079 | (while (setq e (pop cfmt)) |
| 1020 | (setq prop (car e) | 1080 | (setq prop (car e) |
| 1021 | title (nth 1 e) | 1081 | title (nth 1 e) |
| @@ -1023,8 +1083,9 @@ Don't set this, this is meant for dynamic scoping.") | |||
| 1023 | op (nth 3 e) | 1083 | op (nth 3 e) |
| 1024 | fmt (nth 4 e) | 1084 | fmt (nth 4 e) |
| 1025 | printf (nth 5 e) | 1085 | printf (nth 5 e) |
| 1026 | fun (nth 6 e)) | 1086 | fun (nth 6 e) |
| 1027 | (when (setq op-match (rassoc (list fmt fun) org-columns-compile-map)) | 1087 | calc (nth 7 e)) |
| 1088 | (when (setq op-match (rassoc (list fmt fun calc) org-columns-compile-map)) | ||
| 1028 | (setq op (car op-match))) | 1089 | (setq op (car op-match))) |
| 1029 | (if (and op printf) (setq op (concat op ";" printf))) | 1090 | (if (and op printf) (setq op (concat op ";" printf))) |
| 1030 | (if (equal title prop) (setq title nil)) | 1091 | (if (equal title prop) (setq title nil)) |
| @@ -1045,8 +1106,10 @@ width the column width in characters, can be nil for automatic | |||
| 1045 | operator the operator if any | 1106 | operator the operator if any |
| 1046 | format the output format for computed results, derived from operator | 1107 | format the output format for computed results, derived from operator |
| 1047 | printf a printf format for computed values | 1108 | printf a printf format for computed values |
| 1048 | fun the lisp function to compute values, derived from operator" | 1109 | fun the lisp function to compute summary values, derived from operator |
| 1049 | (let ((start 0) width prop title op op-match f printf fun) | 1110 | calc function to get values from base elements |
| 1111 | " | ||
| 1112 | (let ((start 0) width prop title op op-match f printf fun calc) | ||
| 1050 | (setq org-columns-current-fmt-compiled nil) | 1113 | (setq org-columns-current-fmt-compiled nil) |
| 1051 | (while (string-match | 1114 | (while (string-match |
| 1052 | (org-re "%\\([0-9]+\\)?\\([[:alnum:]_-]+\\)\\(?:(\\([^)]+\\))\\)?\\(?:{\\([^}]+\\)}\\)?\\s-*") | 1115 | (org-re "%\\([0-9]+\\)?\\([[:alnum:]_-]+\\)\\(?:(\\([^)]+\\))\\)?\\(?:{\\([^}]+\\)}\\)?\\s-*") |
| @@ -1058,15 +1121,18 @@ fun the lisp function to compute values, derived from operator" | |||
| 1058 | op (match-string 4 fmt) | 1121 | op (match-string 4 fmt) |
| 1059 | f nil | 1122 | f nil |
| 1060 | printf nil | 1123 | printf nil |
| 1061 | fun '+) | 1124 | fun '+ |
| 1125 | calc nil) | ||
| 1062 | (if width (setq width (string-to-number width))) | 1126 | (if width (setq width (string-to-number width))) |
| 1063 | (when (and op (string-match ";" op)) | 1127 | (when (and op (string-match ";" op)) |
| 1064 | (setq printf (substring op (match-end 0)) | 1128 | (setq printf (substring op (match-end 0)) |
| 1065 | op (substring op 0 (match-beginning 0)))) | 1129 | op (substring op 0 (match-beginning 0)))) |
| 1066 | (when (setq op-match (assoc op org-columns-compile-map)) | 1130 | (when (setq op-match (assoc op org-columns-compile-map)) |
| 1067 | (setq f (cadr op-match) | 1131 | (setq f (cadr op-match) |
| 1068 | fun (caddr op-match))) | 1132 | fun (caddr op-match) |
| 1069 | (push (list prop title width op f printf fun) org-columns-current-fmt-compiled)) | 1133 | calc (cadddr op-match))) |
| 1134 | (push (list prop title width op f printf fun calc) | ||
| 1135 | org-columns-current-fmt-compiled)) | ||
| 1070 | (setq org-columns-current-fmt-compiled | 1136 | (setq org-columns-current-fmt-compiled |
| 1071 | (nreverse org-columns-current-fmt-compiled)))) | 1137 | (nreverse org-columns-current-fmt-compiled)))) |
| 1072 | 1138 | ||
| @@ -1121,18 +1187,18 @@ PARAMS is a property list of parameters: | |||
| 1121 | 1187 | ||
| 1122 | :width enforce same column widths with <N> specifiers. | 1188 | :width enforce same column widths with <N> specifiers. |
| 1123 | :id the :ID: property of the entry where the columns view | 1189 | :id the :ID: property of the entry where the columns view |
| 1124 | should be built. When the symbol `local', call locally. | 1190 | should be built. When the symbol `local', call locally. |
| 1125 | When `global' call column view with the cursor at the beginning | 1191 | When `global' call column view with the cursor at the beginning |
| 1126 | of the buffer (usually this means that the whole buffer switches | 1192 | of the buffer (usually this means that the whole buffer switches |
| 1127 | to column view). When \"file:path/to/file.org\", invoke column | 1193 | to column view). When \"file:path/to/file.org\", invoke column |
| 1128 | view at the start of that file. Otherwise, the ID is located | 1194 | view at the start of that file. Otherwise, the ID is located |
| 1129 | using `org-id-find'. | 1195 | using `org-id-find'. |
| 1130 | :hlines When t, insert a hline before each item. When a number, insert | 1196 | :hlines When t, insert a hline before each item. When a number, insert |
| 1131 | a hline before each level <= that number. | 1197 | a hline before each level <= that number. |
| 1132 | :vlines When t, make each column a colgroup to enforce vertical lines. | 1198 | :vlines When t, make each column a colgroup to enforce vertical lines. |
| 1133 | :maxlevel When set to a number, don't capture headlines below this level. | 1199 | :maxlevel When set to a number, don't capture headlines below this level. |
| 1134 | :skip-empty-rows | 1200 | :skip-empty-rows |
| 1135 | When t, skip rows where all specifiers other than ITEM are empty." | 1201 | When t, skip rows where all specifiers other than ITEM are empty." |
| 1136 | (let ((pos (move-marker (make-marker) (point))) | 1202 | (let ((pos (move-marker (make-marker) (point))) |
| 1137 | (hlines (plist-get params :hlines)) | 1203 | (hlines (plist-get params :hlines)) |
| 1138 | (vlines (plist-get params :vlines)) | 1204 | (vlines (plist-get params :vlines)) |
| @@ -1253,7 +1319,8 @@ and tailing newline characters." | |||
| 1253 | (org-verify-version 'columns) | 1319 | (org-verify-version 'columns) |
| 1254 | (org-columns-remove-overlays) | 1320 | (org-columns-remove-overlays) |
| 1255 | (move-marker org-columns-begin-marker (point)) | 1321 | (move-marker org-columns-begin-marker (point)) |
| 1256 | (let (fmt cache maxwidths m p a d) | 1322 | (let ((org-columns-time (time-to-number-of-days (current-time))) |
| 1323 | cache maxwidths m p a d fmt) | ||
| 1257 | (cond | 1324 | (cond |
| 1258 | ((and (boundp 'org-agenda-overriding-columns-format) | 1325 | ((and (boundp 'org-agenda-overriding-columns-format) |
| 1259 | org-agenda-overriding-columns-format) | 1326 | org-agenda-overriding-columns-format) |
| @@ -1313,10 +1380,11 @@ and tailing newline characters." | |||
| 1313 | "Summarize the summarizable columns in column view in the agenda. | 1380 | "Summarize the summarizable columns in column view in the agenda. |
| 1314 | This will add overlays to the date lines, to show the summary for each day." | 1381 | This will add overlays to the date lines, to show the summary for each day." |
| 1315 | (let* ((fmt (mapcar (lambda (x) | 1382 | (let* ((fmt (mapcar (lambda (x) |
| 1316 | (list (car x) (if (equal (car x) "CLOCKSUM") | 1383 | (if (equal (car x) "CLOCKSUM") |
| 1317 | 'add_times (nth 4 x)))) | 1384 | (list "CLOCKSUM" (nth 2 x) nil 'add_times nil '+ 'identity) |
| 1385 | (cdr x))) | ||
| 1318 | org-columns-current-fmt-compiled)) | 1386 | org-columns-current-fmt-compiled)) |
| 1319 | line c c1 stype props lsum entries prop v) | 1387 | line c c1 stype calc sumfunc props lsum entries prop v) |
| 1320 | (catch 'exit | 1388 | (catch 'exit |
| 1321 | (when (delq nil (mapcar 'cadr fmt)) | 1389 | (when (delq nil (mapcar 'cadr fmt)) |
| 1322 | ;; OK, at least one summation column, it makes sense to try this | 1390 | ;; OK, at least one summation column, it makes sense to try this |
| @@ -1339,24 +1407,40 @@ This will add overlays to the date lines, to show the summary for each day." | |||
| 1339 | (setq props | 1407 | (setq props |
| 1340 | (mapcar | 1408 | (mapcar |
| 1341 | (lambda (f) | 1409 | (lambda (f) |
| 1342 | (setq prop (car f) stype (nth 1 f)) | 1410 | (setq prop (car f) |
| 1411 | stype (nth 3 f) | ||
| 1412 | sumfunc (nth 5 f) | ||
| 1413 | calc (or (nth 6 f) 'identity)) | ||
| 1343 | (cond | 1414 | (cond |
| 1344 | ((equal prop "ITEM") | 1415 | ((equal prop "ITEM") |
| 1345 | (cons prop (buffer-substring (point-at-bol) | 1416 | (cons prop (buffer-substring (point-at-bol) |
| 1346 | (point-at-eol)))) | 1417 | (point-at-eol)))) |
| 1347 | ((not stype) (cons prop "")) | 1418 | ((not stype) (cons prop "")) |
| 1348 | (t | 1419 | (t ;; do the summary |
| 1349 | ;; do the summary | 1420 | (setq lsum nil) |
| 1350 | (setq lsum 0) | 1421 | (dolist (x entries) |
| 1351 | (mapc (lambda (x) | 1422 | (setq v (cdr (assoc prop x))) |
| 1352 | (setq v (cdr (assoc prop x))) | 1423 | (if v |
| 1353 | (if v (setq lsum (+ lsum | 1424 | (push |
| 1354 | (org-column-string-to-number | 1425 | (funcall |
| 1355 | v stype))))) | 1426 | (if (not (get-text-property 0 'org-computed v)) |
| 1356 | entries) | 1427 | calc |
| 1357 | (setq lsum (org-columns-number-to-string lsum stype)) | 1428 | 'identity) |
| 1358 | (put-text-property | 1429 | (org-columns-string-to-number |
| 1359 | 0 (length lsum) 'face 'bold lsum) | 1430 | v stype)) |
| 1431 | lsum))) | ||
| 1432 | (setq lsum (remove nil lsum)) | ||
| 1433 | (setq lsum | ||
| 1434 | (cond ((> (length lsum) 1) | ||
| 1435 | (org-columns-number-to-string | ||
| 1436 | (apply sumfunc lsum) stype)) | ||
| 1437 | ((eq (length lsum) 1) | ||
| 1438 | (org-columns-number-to-string | ||
| 1439 | (car lsum) stype)) | ||
| 1440 | (t ""))) | ||
| 1441 | (put-text-property 0 (length lsum) 'face 'bold lsum) | ||
| 1442 | (unless (eq calc 'identity) | ||
| 1443 | (put-text-property 0 (length lsum) 'org-computed t lsum)) | ||
| 1360 | (cons prop lsum)))) | 1444 | (cons prop lsum)))) |
| 1361 | fmt)) | 1445 | fmt)) |
| 1362 | (org-columns-display-here props 'dateline) | 1446 | (org-columns-display-here props 'dateline) |
| @@ -1390,6 +1474,18 @@ This will add overlays to the date lines, to show the summary for each day." | |||
| 1390 | (equal (nth 4 a) (nth 4 fm))) | 1474 | (equal (nth 4 a) (nth 4 fm))) |
| 1391 | (org-columns-compute (car fm))))))))))) | 1475 | (org-columns-compute (car fm))))))))))) |
| 1392 | 1476 | ||
| 1477 | (defun org-format-time-period (interval) | ||
| 1478 | "Convert time in fractional days to days/hours/minutes/seconds" | ||
| 1479 | (if (numberp interval) | ||
| 1480 | (let* ((days (floor interval)) | ||
| 1481 | (frac-hours (* 24 (- interval days))) | ||
| 1482 | (hours (floor frac-hours)) | ||
| 1483 | (minutes (floor (* 60 (- frac-hours hours)))) | ||
| 1484 | (seconds (floor (* 60 (- (* 60 (- frac-hours hours)) minutes))))) | ||
| 1485 | (format "%dd %02dh %02dm %02ds" days hours minutes seconds)) | ||
| 1486 | "")) | ||
| 1487 | |||
| 1488 | |||
| 1393 | (provide 'org-colview) | 1489 | (provide 'org-colview) |
| 1394 | 1490 | ||
| 1395 | ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c | 1491 | ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c |
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 1f6d3e9e5a4..4e2c7d1a775 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el index eda11a2c819..e4455714066 100644 --- a/lisp/org/org-crypt.el +++ b/lisp/org/org-crypt.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Emacs Lisp Archive Entry | 5 | ;; Emacs Lisp Archive Entry |
| 6 | ;; Filename: org-crypt.el | 6 | ;; Filename: org-crypt.el |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; Keywords: org-mode | 8 | ;; Keywords: org-mode |
| 9 | ;; Author: John Wiegley <johnw@gnu.org> | 9 | ;; Author: John Wiegley <johnw@gnu.org> |
| 10 | ;; Maintainer: Peter Jones <pjones@pmade.com> | 10 | ;; Maintainer: Peter Jones <pjones@pmade.com> |
| @@ -94,7 +94,7 @@ heading. This can also be overridden in the CRYPTKEY property." | |||
| 94 | "Returns the encryption key for the current heading." | 94 | "Returns the encryption key for the current heading." |
| 95 | (save-excursion | 95 | (save-excursion |
| 96 | (org-back-to-heading t) | 96 | (org-back-to-heading t) |
| 97 | (or (org-entry-get nil "CRYPTKEY" 'selective) | 97 | (or (org-entry-get nil "CRYPTKEY" 'selective) |
| 98 | org-crypt-key | 98 | org-crypt-key |
| 99 | (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) | 99 | (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) |
| 100 | (error "No crypt key set")))) | 100 | (error "No crypt key set")))) |
| @@ -116,7 +116,7 @@ heading. This can also be overridden in the CRYPTKEY property." | |||
| 116 | (org-back-over-empty-lines) | 116 | (org-back-over-empty-lines) |
| 117 | (setq end (point) | 117 | (setq end (point) |
| 118 | encrypted-text | 118 | encrypted-text |
| 119 | (epg-encrypt-string | 119 | (epg-encrypt-string |
| 120 | epg-context | 120 | epg-context |
| 121 | (buffer-substring-no-properties beg end) | 121 | (buffer-substring-no-properties beg end) |
| 122 | (epg-list-keys epg-context crypt-key))) | 122 | (epg-list-keys epg-context crypt-key))) |
| @@ -136,12 +136,12 @@ heading. This can also be overridden in the CRYPTKEY property." | |||
| 136 | (forward-line) | 136 | (forward-line) |
| 137 | (when (looking-at "-----BEGIN PGP MESSAGE-----") | 137 | (when (looking-at "-----BEGIN PGP MESSAGE-----") |
| 138 | (let* ((beg (point)) | 138 | (let* ((beg (point)) |
| 139 | (end (save-excursion | 139 | (end (save-excursion |
| 140 | (search-forward "-----END PGP MESSAGE-----") | 140 | (search-forward "-----END PGP MESSAGE-----") |
| 141 | (forward-line) | 141 | (forward-line) |
| 142 | (point))) | 142 | (point))) |
| 143 | (epg-context (epg-make-context nil t t)) | 143 | (epg-context (epg-make-context nil t t)) |
| 144 | (decrypted-text | 144 | (decrypted-text |
| 145 | (decode-coding-string | 145 | (decode-coding-string |
| 146 | (epg-decrypt-string | 146 | (epg-decrypt-string |
| 147 | epg-context | 147 | epg-context |
| @@ -159,17 +159,17 @@ heading. This can also be overridden in the CRYPTKEY property." | |||
| 159 | 159 | ||
| 160 | (defun org-decrypt-entries () | 160 | (defun org-decrypt-entries () |
| 161 | (interactive) | 161 | (interactive) |
| 162 | (org-scan-tags | 162 | (org-scan-tags |
| 163 | 'org-decrypt-entry | 163 | 'org-decrypt-entry |
| 164 | (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) | 164 | (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) |
| 165 | 165 | ||
| 166 | (defun org-crypt-use-before-save-magic () | 166 | (defun org-crypt-use-before-save-magic () |
| 167 | "Adds a hook that will automatically encrypt entries before a | 167 | "Adds a hook that will automatically encrypt entries before a |
| 168 | file is saved to disk." | 168 | file is saved to disk." |
| 169 | (add-hook | 169 | (add-hook |
| 170 | 'org-mode-hook | 170 | 'org-mode-hook |
| 171 | (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) | 171 | (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) |
| 172 | 172 | ||
| 173 | (provide 'org-crypt) | 173 | (provide 'org-crypt) |
| 174 | 174 | ||
| 175 | ;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e | 175 | ;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e |
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el new file mode 100644 index 00000000000..ce6c562472e --- /dev/null +++ b/lisp/org/org-datetree.el | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | ;;; org-datetree.el --- Create date entries in a tree | ||
| 2 | |||
| 3 | ;; Copyright (C) 2009 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | ||
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | ||
| 7 | ;; Homepage: http://orgmode.org | ||
| 8 | ;; Version: 6.33 | ||
| 9 | ;; | ||
| 10 | ;; This file is part of GNU Emacs. | ||
| 11 | ;; | ||
| 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 13 | ;; it under the terms of the GNU General Public License as published by | ||
| 14 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 15 | ;; (at your option) any later version. | ||
| 16 | |||
| 17 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | ;; GNU General Public License for more details. | ||
| 21 | |||
| 22 | ;; You should have received a copy of the GNU General Public License | ||
| 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 25 | ;; | ||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;; This file contains code to create entries in a tree where the top-level | ||
| 29 | ;; nodes represent years, the level 2 nodes represent the months, and the | ||
| 30 | ;; level 1 entries days. | ||
| 31 | |||
| 32 | ;;; Code: | ||
| 33 | |||
| 34 | (require 'org) | ||
| 35 | |||
| 36 | (defvar org-datetree-base-level 1 | ||
| 37 | "The level at which years should be placed in the date tree. | ||
| 38 | This is normally one, but if the buffer has an entry with a DATE_TREE | ||
| 39 | property, the date tree will become a subtree under that entry, so the | ||
| 40 | base level will be properly adjusted.") | ||
| 41 | |||
| 42 | (defun org-datetree-find-date-create (date &optional keep-restriction) | ||
| 43 | "Find or create an entry for DATE. | ||
| 44 | If KEEP-RESTRICTION is non-nil, do not widen the buffer. | ||
| 45 | When it is nit, the buffer will be widened to make sure an existing date | ||
| 46 | tree can be found." | ||
| 47 | (let ((year (nth 2 date)) | ||
| 48 | (month (car date)) | ||
| 49 | (day (nth 1 date))) | ||
| 50 | (org-set-local 'org-datetree-base-level 1) | ||
| 51 | (or keep-restriction (widen)) | ||
| 52 | (goto-char (point-min)) | ||
| 53 | (save-restriction | ||
| 54 | (when (re-search-forward "^[ \t]*:DATE_TREE:[ \t]+\\S-" nil t) | ||
| 55 | (org-back-to-heading t) | ||
| 56 | (org-set-local 'org-datetree-base-level | ||
| 57 | (org-get-valid-level (funcall outline-level) 1)) | ||
| 58 | (org-narrow-to-subtree)) | ||
| 59 | (goto-char (point-min)) | ||
| 60 | (org-datetree-find-year-create year) | ||
| 61 | (org-datetree-find-month-create year month) | ||
| 62 | (org-datetree-find-day-create year month day) | ||
| 63 | (goto-char (prog1 (point) (widen)))))) | ||
| 64 | |||
| 65 | (defun org-datetree-find-year-create (year) | ||
| 66 | (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t\n]") | ||
| 67 | match) | ||
| 68 | (goto-char (point-min)) | ||
| 69 | (while (and (setq match (re-search-forward re nil t)) | ||
| 70 | (goto-char (match-beginning 1)) | ||
| 71 | (< (string-to-number (match-string 1)) year))) | ||
| 72 | (cond | ||
| 73 | ((not match) | ||
| 74 | (goto-char (point-max)) | ||
| 75 | (or (bolp) (newline)) | ||
| 76 | (org-datetree-insert-line year)) | ||
| 77 | ((= (string-to-number (match-string 1)) year) | ||
| 78 | (goto-char (point-at-bol))) | ||
| 79 | (t | ||
| 80 | (beginning-of-line 1) | ||
| 81 | (org-datetree-insert-line year))))) | ||
| 82 | |||
| 83 | (defun org-datetree-find-month-create (year month) | ||
| 84 | (org-narrow-to-subtree) | ||
| 85 | (let ((re (format "^\\*+[ \t]+%d-\\([01][0-9]\\)[ \t\n]" year)) | ||
| 86 | match) | ||
| 87 | (goto-char (point-min)) | ||
| 88 | (while (and (setq match (re-search-forward re nil t)) | ||
| 89 | (goto-char (match-beginning 1)) | ||
| 90 | (< (string-to-number (match-string 1)) month))) | ||
| 91 | (cond | ||
| 92 | ((not match) | ||
| 93 | (goto-char (point-max)) | ||
| 94 | (or (bolp) (newline)) | ||
| 95 | (org-datetree-insert-line year month)) | ||
| 96 | ((= (string-to-number (match-string 1)) month) | ||
| 97 | (goto-char (point-at-bol))) | ||
| 98 | (t | ||
| 99 | (beginning-of-line 1) | ||
| 100 | (org-datetree-insert-line year month))))) | ||
| 101 | |||
| 102 | (defun org-datetree-find-day-create (year month day) | ||
| 103 | (org-narrow-to-subtree) | ||
| 104 | (let ((re (format "^\\*+[ \t]+%d-%02d-\\([01][0-9]\\)[ \t\n]" year month)) | ||
| 105 | match) | ||
| 106 | (goto-char (point-min)) | ||
| 107 | (while (and (setq match (re-search-forward re nil t)) | ||
| 108 | (goto-char (match-beginning 1)) | ||
| 109 | (< (string-to-number (match-string 1)) day))) | ||
| 110 | (cond | ||
| 111 | ((not match) | ||
| 112 | (goto-char (point-max)) | ||
| 113 | (or (bolp) (newline)) | ||
| 114 | (org-datetree-insert-line year month day)) | ||
| 115 | ((= (string-to-number (match-string 1)) day) | ||
| 116 | (goto-char (point-at-bol))) | ||
| 117 | (t | ||
| 118 | (beginning-of-line 1) | ||
| 119 | (org-datetree-insert-line year month day))))) | ||
| 120 | |||
| 121 | (defun org-datetree-insert-line (year &optional month day) | ||
| 122 | (let ((pos (point))) | ||
| 123 | (skip-chars-backward " \t\n") | ||
| 124 | (delete-region (point) pos) | ||
| 125 | (insert "\n" (make-string org-datetree-base-level ?*) " \n") | ||
| 126 | (backward-char 1) | ||
| 127 | (if month (org-do-demote)) | ||
| 128 | (if day (org-do-demote)) | ||
| 129 | (insert (format "%d" year)) | ||
| 130 | (when month | ||
| 131 | (insert (format "-%02d" month)) | ||
| 132 | (if day | ||
| 133 | (insert (format "-%02d %s" | ||
| 134 | day (format-time-string | ||
| 135 | "%A" (encode-time 0 0 0 day month year)))) | ||
| 136 | (insert (format " %s" | ||
| 137 | (format-time-string | ||
| 138 | "%B" (encode-time 0 0 0 1 month year)))))) | ||
| 139 | (beginning-of-line 1))) | ||
| 140 | |||
| 141 | (defun org-datetree-file-entry-under (txt date) | ||
| 142 | "Insert a node TXT into the date tree under DATE." | ||
| 143 | (org-datetree-find-date-create date) | ||
| 144 | (let ((level (org-get-valid-level (funcall outline-level) 1))) | ||
| 145 | (org-end-of-subtree t t) | ||
| 146 | (org-back-over-empty-lines) | ||
| 147 | (org-paste-subtree level txt))) | ||
| 148 | |||
| 149 | (defun org-datetree-cleanup () | ||
| 150 | "Make sure all entries in the current tree are under the correct date. | ||
| 151 | It may be useful to restrict the buffer to the applicable portion | ||
| 152 | before running this command, even though the command tries to be smart." | ||
| 153 | (interactive) | ||
| 154 | (goto-char (point-min)) | ||
| 155 | (let ((dre (concat "\\<" org-deadline-string "\\>[ \t]*\\'")) | ||
| 156 | (sre (concat "\\<" org-scheduled-string "\\>[ \t]*\\'")) | ||
| 157 | dct ts tmp date year month day pos hdl-pos) | ||
| 158 | (while (re-search-forward org-ts-regexp nil t) | ||
| 159 | (catch 'next | ||
| 160 | (setq ts (match-string 0)) | ||
| 161 | (setq tmp (buffer-substring | ||
| 162 | (max (point-at-bol) (- (match-beginning 0) | ||
| 163 | org-ds-keyword-length)) | ||
| 164 | (match-beginning 0))) | ||
| 165 | (if (or (string-match "-\\'" tmp) | ||
| 166 | (string-match dre tmp) | ||
| 167 | (string-match sre tmp)) | ||
| 168 | (throw 'next nil)) | ||
| 169 | (setq dct (decode-time (org-time-string-to-time (match-string 0))) | ||
| 170 | date (list (nth 4 dct) (nth 3 dct) (nth 5 dct)) | ||
| 171 | year (nth 2 date) | ||
| 172 | month (car date) | ||
| 173 | day (nth 1 date) | ||
| 174 | pos (point)) | ||
| 175 | (org-back-to-heading t) | ||
| 176 | (setq hdl-pos (point)) | ||
| 177 | (unless (org-up-heading-safe) | ||
| 178 | ;; No parent, we are not in a date tree | ||
| 179 | (goto-char pos) | ||
| 180 | (throw 'next nil)) | ||
| 181 | (unless (looking-at "\\*+[ \t]+[0-9]+-[0-1][0-9]-[0-3][0-9]") | ||
| 182 | ;; Parent looks wrong, we are not in a date tree | ||
| 183 | (goto-char pos) | ||
| 184 | (throw 'next nil)) | ||
| 185 | (when (looking-at (format "\\*+[ \t]+%d-%02d-%02d" year month day)) | ||
| 186 | ;; At correct date already, do nothing | ||
| 187 | (progn (goto-char pos) (throw 'next nil))) | ||
| 188 | ;; OK, we need to refile this entry | ||
| 189 | (goto-char hdl-pos) | ||
| 190 | (org-cut-subtree) | ||
| 191 | (save-excursion | ||
| 192 | (save-restriction | ||
| 193 | (org-datetree-file-entry-under (current-kill 0) date))))))) | ||
| 194 | |||
| 195 | (provide 'org-datetree) | ||
| 196 | |||
| 197 | ;; arch-tag: 1daea962-fd08-448b-9f98-6e8b511b3601 | ||
| 198 | |||
| 199 | ;;; org-datetree.el ends here | ||
diff --git a/lisp/org/org-docbook.el b/lisp/org/org-docbook.el index 11f37999190..33d66dc24de 100644 --- a/lisp/org/org-docbook.el +++ b/lisp/org/org-docbook.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; | 4 | ;; |
| 5 | ;; Emacs Lisp Archive Entry | 5 | ;; Emacs Lisp Archive Entry |
| 6 | ;; Filename: org-docbook.el | 6 | ;; Filename: org-docbook.el |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com> | 8 | ;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com> |
| 9 | ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com> | 9 | ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com> |
| 10 | ;; Keywords: org, wp, docbook | 10 | ;; Keywords: org, wp, docbook |
| @@ -119,7 +119,7 @@ entities, you can set this variable to: | |||
| 119 | ]> | 119 | ]> |
| 120 | \" | 120 | \" |
| 121 | 121 | ||
| 122 | If you want to process DocBook documents without internet | 122 | If you want to process DocBook documents without an Internet |
| 123 | connection, it is suggested that you download the required entity | 123 | connection, it is suggested that you download the required entity |
| 124 | file(s) and use system identifier(s) (external files) in the | 124 | file(s) and use system identifier(s) (external files) in the |
| 125 | DOCTYPE declaration." | 125 | DOCTYPE declaration." |
| @@ -410,7 +410,7 @@ publishing directory." | |||
| 410 | (rbeg (and region-p (region-beginning))) | 410 | (rbeg (and region-p (region-beginning))) |
| 411 | (rend (and region-p (region-end))) | 411 | (rend (and region-p (region-end))) |
| 412 | (subtree-p | 412 | (subtree-p |
| 413 | (if (plist-get opt-plist :ignore-subree-p) | 413 | (if (plist-get opt-plist :ignore-subtree-p) |
| 414 | nil | 414 | nil |
| 415 | (when region-p | 415 | (when region-p |
| 416 | (save-excursion | 416 | (save-excursion |
| @@ -736,8 +736,12 @@ publishing directory." | |||
| 736 | ;; Make targets to anchors. Note that currently FOP does not | 736 | ;; Make targets to anchors. Note that currently FOP does not |
| 737 | ;; seem to support <anchor> tags when generating PDF output, | 737 | ;; seem to support <anchor> tags when generating PDF output, |
| 738 | ;; but this can be used in DocBook --> HTML conversion. | 738 | ;; but this can be used in DocBook --> HTML conversion. |
| 739 | (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line) | 739 | (setq start 0) |
| 740 | (while (string-match | ||
| 741 | "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start) | ||
| 740 | (cond | 742 | (cond |
| 743 | ((get-text-property (match-beginning 1) 'org-protected line) | ||
| 744 | (setq start (match-end 1))) | ||
| 741 | ((match-end 2) | 745 | ((match-end 2) |
| 742 | (setq line (replace-match | 746 | (setq line (replace-match |
| 743 | (format "@<anchor xml:id=\"%s\"/>" | 747 | (format "@<anchor xml:id=\"%s\"/>" |
diff --git a/lisp/org/org-exp-blocks.el b/lisp/org/org-exp-blocks.el index 4dac201a30d..71e1608f9bc 100644 --- a/lisp/org/org-exp-blocks.el +++ b/lisp/org/org-exp-blocks.el | |||
| @@ -60,11 +60,6 @@ | |||
| 60 | ;; their own divs with author-specific ids allowing for css | 60 | ;; their own divs with author-specific ids allowing for css |
| 61 | ;; coloring of comments based on the author. | 61 | ;; coloring of comments based on the author. |
| 62 | ;; | 62 | ;; |
| 63 | ;; R :: Implements Sweave type exporting, evaluates blocks of R code, | ||
| 64 | ;; and also replaces \R{} chunks in the file with their result | ||
| 65 | ;; when passed to R. This require the `R' command which is | ||
| 66 | ;; provided by ESS (Emacs Speaks Statistics). | ||
| 67 | ;; | ||
| 68 | ;;; Adding new blocks | 63 | ;;; Adding new blocks |
| 69 | ;; | 64 | ;; |
| 70 | ;; When adding a new block type first define a formatting function | 65 | ;; When adding a new block type first define a formatting function |
| @@ -76,17 +71,11 @@ | |||
| 76 | (require 'cl)) | 71 | (require 'cl)) |
| 77 | (require 'org) | 72 | (require 'org) |
| 78 | 73 | ||
| 79 | (defvar comint-last-input-end) | ||
| 80 | (defvar comint-prompt-regexp) | ||
| 81 | (defvar comint-last-input-end) | ||
| 82 | (defvar htmlp) | 74 | (defvar htmlp) |
| 83 | (defvar latexp) | 75 | (defvar latexp) |
| 84 | (defvar docbookp) | 76 | (defvar docbookp) |
| 85 | (defvar asciip) | 77 | (defvar asciip) |
| 86 | 78 | ||
| 87 | (declare-function comint-send-input "comint" (&optional no-newline artificial)) | ||
| 88 | (declare-function R "ext:ess" nil) | ||
| 89 | |||
| 90 | (defun org-export-blocks-set (var value) | 79 | (defun org-export-blocks-set (var value) |
| 91 | "Set the value of `org-export-blocks' and install fontification." | 80 | "Set the value of `org-export-blocks' and install fontification." |
| 92 | (set var value) | 81 | (set var value) |
| @@ -102,9 +91,7 @@ | |||
| 102 | (defcustom org-export-blocks | 91 | (defcustom org-export-blocks |
| 103 | '((comment org-export-blocks-format-comment t) | 92 | '((comment org-export-blocks-format-comment t) |
| 104 | (ditaa org-export-blocks-format-ditaa nil) | 93 | (ditaa org-export-blocks-format-ditaa nil) |
| 105 | (dot org-export-blocks-format-dot nil) | 94 | (dot org-export-blocks-format-dot nil)) |
| 106 | (r org-export-blocks-format-R nil) | ||
| 107 | (R org-export-blocks-format-R nil)) | ||
| 108 | "Use this a-list to associate block types with block exporting | 95 | "Use this a-list to associate block types with block exporting |
| 109 | functions. The type of a block is determined by the text | 96 | functions. The type of a block is determined by the text |
| 110 | immediately following the '#+BEGIN_' portion of the block header. | 97 | immediately following the '#+BEGIN_' portion of the block header. |
| @@ -133,8 +120,7 @@ blocks is as follows... | |||
| 133 | (org-export-blocks-set 'org-export-blocks org-export-blocks))) | 120 | (org-export-blocks-set 'org-export-blocks org-export-blocks))) |
| 134 | 121 | ||
| 135 | (defcustom org-export-interblocks | 122 | (defcustom org-export-interblocks |
| 136 | '((r org-export-interblocks-format-R) | 123 | '() |
| 137 | (R org-export-interblocks-format-R)) | ||
| 138 | "Use this a-list to associate block types with block exporting | 124 | "Use this a-list to associate block types with block exporting |
| 139 | functions. The type of a block is determined by the text | 125 | functions. The type of a block is determined by the text |
| 140 | immediately following the '#+BEGIN_' portion of the block header. | 126 | immediately following the '#+BEGIN_' portion of the block header. |
| @@ -172,43 +158,40 @@ CLOSE tags will be inserted around BODY." | |||
| 172 | "#+END_LaTeX\n")) | 158 | "#+END_LaTeX\n")) |
| 173 | 159 | ||
| 174 | (defun org-export-blocks-preprocess () | 160 | (defun org-export-blocks-preprocess () |
| 175 | "Export all blocks acording to the `org-export-blocks' block | 161 | "Export all blocks according to the `org-export-blocks' block |
| 176 | exportation alist. Does not export block types specified in | 162 | exportation alist. Does not export block types specified in |
| 177 | specified in BLOCKS which default to the value of | 163 | specified in BLOCKS which default to the value of |
| 178 | `org-export-blocks-witheld'." | 164 | `org-export-blocks-witheld'." |
| 179 | (interactive) | 165 | (interactive) |
| 180 | (save-window-excursion | 166 | (save-window-excursion |
| 181 | (let ((count 0) | 167 | (let ((case-fold-search t) |
| 182 | (blocks org-export-blocks-witheld) | ||
| 183 | (case-fold-search t) | ||
| 184 | (types '()) | 168 | (types '()) |
| 185 | indentation type func start end) | 169 | indentation type func start body headers preserve-indent) |
| 186 | (flet ((interblock (start end type) | 170 | (flet ((interblock (start end) |
| 187 | (save-match-data | 171 | (mapcar (lambda (pair) (funcall (second pair) start end)) |
| 188 | (when (setf func (cadr (assoc type org-export-interblocks))) | 172 | org-export-interblocks))) |
| 189 | (funcall func start end))))) | ||
| 190 | (goto-char (point-min)) | 173 | (goto-char (point-min)) |
| 191 | (setf start (point)) | 174 | (setq start (point)) |
| 192 | (while (re-search-forward | 175 | (while (re-search-forward |
| 193 | "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t) | 176 | "^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t) |
| 194 | (save-match-data (setq indentation (length (match-string 1)))) | 177 | (setq indentation (length (match-string 1))) |
| 195 | (save-match-data (setf type (intern (match-string 2)))) | 178 | (setq type (intern (downcase (match-string 2)))) |
| 196 | (unless (memq type types) (setf types (cons type types))) | 179 | (setq headers (save-match-data (org-split-string (match-string 3) "[ \t]+"))) |
| 197 | (setf end (save-match-data (match-beginning 0))) | 180 | (setq body (match-string 4)) |
| 198 | (interblock start end type) | 181 | (setq preserve-indent (or org-src-preserve-indentation (member "-i" headers))) |
| 199 | (if (setf func (cadr (assoc type org-export-blocks))) | 182 | (unless preserve-indent |
| 183 | (setq body (save-match-data (org-remove-indentation body)))) | ||
| 184 | (unless (memq type types) (setq types (cons type types))) | ||
| 185 | (save-match-data (interblock start (match-beginning 0))) | ||
| 186 | (if (setq func (cadr (assoc type org-export-blocks))) | ||
| 200 | (progn | 187 | (progn |
| 201 | (replace-match (save-match-data | 188 | (replace-match (save-match-data |
| 202 | (if (memq type blocks) | 189 | (if (memq type org-export-blocks-witheld) "" |
| 203 | "" | 190 | (apply func body headers))) t t) |
| 204 | (apply func (save-match-data (org-remove-indentation (match-string 4))) | 191 | (unless preserve-indent |
| 205 | (split-string (match-string 3) " ")))) t t) | 192 | (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))) |
| 206 | ;; indent block | 193 | (setq start (match-end 0))) |
| 207 | (indent-code-rigidly (match-beginning 0) (match-end 0) indentation))) | 194 | (interblock start (point-max)))))) |
| 208 | (setf start (save-match-data (match-end 0)))) | ||
| 209 | (mapcar (lambda (type) | ||
| 210 | (interblock start (point-max) type)) | ||
| 211 | types))))) | ||
| 212 | 195 | ||
| 213 | (add-hook 'org-export-preprocess-hook 'org-export-blocks-preprocess) | 196 | (add-hook 'org-export-preprocess-hook 'org-export-blocks-preprocess) |
| 214 | 197 | ||
| @@ -321,119 +304,6 @@ other backends, it converts the comment into an EXAMPLE segment." | |||
| 321 | (if (string-match "\n\\'" body) "" "\n") | 304 | (if (string-match "\n\\'" body) "" "\n") |
| 322 | "#+END_EXAMPLE\n"))))) | 305 | "#+END_EXAMPLE\n"))))) |
| 323 | 306 | ||
| 324 | ;;-------------------------------------------------------------------------------- | ||
| 325 | ;; R: Sweave-type functionality | ||
| 326 | (defvar interblock-R-buffer nil | ||
| 327 | "Holds the buffer for the current R process") | ||
| 328 | |||
| 329 | (defvar count) ; dynamicaly scoped from `org-export-blocks-preprocess'? | ||
| 330 | (defun org-export-blocks-format-R (body &rest headers) | ||
| 331 | "Process R blocks and replace \R{} forms outside the blocks | ||
| 332 | with their values as determined by R." | ||
| 333 | (interactive) | ||
| 334 | (message "R processing...") | ||
| 335 | (let ((image-path (or (and (car headers) | ||
| 336 | (string-match "\\(.?\\)\.\\(EPS\\|eps\\)" (car headers)) | ||
| 337 | (match-string 1 (car headers))) | ||
| 338 | (and (> (length (car headers)) 0) | ||
| 339 | (car headers)) | ||
| 340 | ;; create the default filename | ||
| 341 | (format "Rplot-%03d" count))) | ||
| 342 | (plot (string-match "plot" body)) | ||
| 343 | R-proc) | ||
| 344 | (setf count (+ count 1)) | ||
| 345 | (interblock-initiate-R-buffer) | ||
| 346 | (setf R-proc (get-buffer-process interblock-R-buffer)) | ||
| 347 | ;; send strings to the ESS process using `comint-send-string' | ||
| 348 | (setf body (mapconcat (lambda (line) | ||
| 349 | (interblock-R-input-command line) (concat "> " line)) | ||
| 350 | (butlast (split-string body "[\r\n]")) | ||
| 351 | "\n")) | ||
| 352 | ;; if there is a plot command, then create the images | ||
| 353 | (when plot | ||
| 354 | (interblock-R-input-command (format "dev.copy2eps(file=\"%s.eps\")" image-path))) | ||
| 355 | (concat (cond | ||
| 356 | (htmlp (org-export-blocks-html-quote body | ||
| 357 | (format "<div id=\"R-%d\">\n<pre>\n" count) | ||
| 358 | "</pre>\n</div>\n")) | ||
| 359 | (latexp (org-export-blocks-latex-quote body | ||
| 360 | "\\begin{Schunk}\n\\begin{Sinput}\n" | ||
| 361 | "\\end{Sinput}\n\\end{Schunk}\n")) | ||
| 362 | (t (insert ;; default export | ||
| 363 | "#+begin_R " (mapconcat 'identity headers " ") "\n" | ||
| 364 | body (if (string-match "\n$" body) "" "\n") | ||
| 365 | "#+end_R\n"))) | ||
| 366 | (if plot | ||
| 367 | (format "[[file:%s.eps]]\n" image-path) | ||
| 368 | "")))) | ||
| 369 | |||
| 370 | (defun org-export-interblocks-format-R (start end) | ||
| 371 | "This is run over parts of the org-file which are between R | ||
| 372 | blocks. Its main use is to expand the \R{stuff} chunks for | ||
| 373 | export." | ||
| 374 | (save-excursion | ||
| 375 | (goto-char start) | ||
| 376 | (interblock-initiate-R-buffer) | ||
| 377 | (let (code replacement) | ||
| 378 | (while (and (< (point) end) (re-search-forward "\\\\R{\\(.*\\)}" end t)) | ||
| 379 | (save-match-data (setf code (match-string 1))) | ||
| 380 | (setf replacement (interblock-R-command-to-string code)) | ||
| 381 | (setf replacement (cond | ||
| 382 | (htmlp replacement) | ||
| 383 | (latexp replacement) | ||
| 384 | (t replacement))) | ||
| 385 | (setf end (+ end (- (length replacement) (length code)))) | ||
| 386 | (replace-match replacement t t))))) | ||
| 387 | |||
| 388 | (defun interblock-initiate-R-buffer () | ||
| 389 | "If there is not a current R process then create one." | ||
| 390 | (unless (and (buffer-live-p interblock-R-buffer) (get-buffer interblock-R-buffer)) | ||
| 391 | (save-excursion | ||
| 392 | (R) | ||
| 393 | (setf interblock-R-buffer (current-buffer)) | ||
| 394 | (interblock-R-wait-for-output) | ||
| 395 | (interblock-R-input-command "")))) | ||
| 396 | |||
| 397 | (defun interblock-R-command-to-string (command) | ||
| 398 | "Send a command to R, and return the results as a string." | ||
| 399 | (interblock-R-input-command command) | ||
| 400 | (interblock-R-last-output)) | ||
| 401 | |||
| 402 | (defun interblock-R-input-command (command) | ||
| 403 | "Pass COMMAND to the R process running in `interblock-R-buffer'." | ||
| 404 | (save-excursion | ||
| 405 | (save-match-data | ||
| 406 | (set-buffer interblock-R-buffer) | ||
| 407 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| 408 | (insert command) | ||
| 409 | (comint-send-input) | ||
| 410 | (interblock-R-wait-for-output)))) | ||
| 411 | |||
| 412 | (defun interblock-R-wait-for-output () | ||
| 413 | "Wait until output arrives" | ||
| 414 | (save-excursion | ||
| 415 | (save-match-data | ||
| 416 | (set-buffer interblock-R-buffer) | ||
| 417 | (while (progn | ||
| 418 | (goto-char comint-last-input-end) | ||
| 419 | (not (re-search-forward comint-prompt-regexp nil t))) | ||
| 420 | (accept-process-output (get-buffer-process (current-buffer))))))) | ||
| 421 | |||
| 422 | (defun interblock-R-last-output () | ||
| 423 | "Return the last R output as a string" | ||
| 424 | (save-excursion | ||
| 425 | (save-match-data | ||
| 426 | (set-buffer interblock-R-buffer) | ||
| 427 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | ||
| 428 | (forward-line 0) | ||
| 429 | (let ((raw (buffer-substring comint-last-input-end (- (point) 1)))) | ||
| 430 | (if (string-match "\n" raw) | ||
| 431 | raw | ||
| 432 | (and (string-match "\\[[[:digit:]+]\\] *\\(.*\\)$" raw) | ||
| 433 | (message raw) | ||
| 434 | (message (match-string 1 raw)) | ||
| 435 | (match-string 1 raw))))))) | ||
| 436 | |||
| 437 | (provide 'org-exp-blocks) | 307 | (provide 'org-exp-blocks) |
| 438 | 308 | ||
| 439 | ;; arch-tag: 1c365fe9-8808-4f72-bb15-0b00f36d8024 | 309 | ;; arch-tag: 1c365fe9-8808-4f72-bb15-0b00f36d8024 |
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 04b973d6913..5282824a530 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -30,6 +30,7 @@ | |||
| 30 | (require 'org-macs) | 30 | (require 'org-macs) |
| 31 | (require 'org-agenda) | 31 | (require 'org-agenda) |
| 32 | (require 'org-exp-blocks) | 32 | (require 'org-exp-blocks) |
| 33 | (require 'org-src) | ||
| 33 | (eval-when-compile | 34 | (eval-when-compile |
| 34 | (require 'cl)) | 35 | (require 'cl)) |
| 35 | 36 | ||
| @@ -40,6 +41,7 @@ | |||
| 40 | (declare-function org-infojs-options-inbuffer-template "org-jsinfo" ()) | 41 | (declare-function org-infojs-options-inbuffer-template "org-jsinfo" ()) |
| 41 | (declare-function org-export-htmlize-region-for-paste "org-html" (beg end)) | 42 | (declare-function org-export-htmlize-region-for-paste "org-html" (beg end)) |
| 42 | (declare-function htmlize-buffer "ext:htmlize" (&optional buffer)) | 43 | (declare-function htmlize-buffer "ext:htmlize" (&optional buffer)) |
| 44 | (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) | ||
| 43 | (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t) | 45 | (autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t) |
| 44 | (defgroup org-export nil | 46 | (defgroup org-export nil |
| 45 | "Options for exporting org-listings." | 47 | "Options for exporting org-listings." |
| @@ -848,6 +850,8 @@ value of `org-export-run-in-background'." | |||
| 848 | \[D] export as DocBook | 850 | \[D] export as DocBook |
| 849 | \[V] export as DocBook, process to PDF, and open the resulting PDF document | 851 | \[V] export as DocBook, process to PDF, and open the resulting PDF document |
| 850 | 852 | ||
| 853 | \[m] export as Freemind mind map | ||
| 854 | |||
| 851 | \[x] export as XOXO | 855 | \[x] export as XOXO |
| 852 | \[g] export using Wes Hardaker's generic exporter | 856 | \[g] export using Wes Hardaker's generic exporter |
| 853 | 857 | ||
| @@ -870,6 +874,7 @@ value of `org-export-run-in-background'." | |||
| 870 | (?g org-export-generic t) | 874 | (?g org-export-generic t) |
| 871 | (?D org-export-as-docbook t) | 875 | (?D org-export-as-docbook t) |
| 872 | (?V org-export-as-docbook-pdf-and-open t) | 876 | (?V org-export-as-docbook-pdf-and-open t) |
| 877 | (?m org-export-as-freemind t) | ||
| 873 | (?l org-export-as-latex t) | 878 | (?l org-export-as-latex t) |
| 874 | (?p org-export-as-pdf t) | 879 | (?p org-export-as-pdf t) |
| 875 | (?d org-export-as-pdf-and-open t) | 880 | (?d org-export-as-pdf-and-open t) |
| @@ -1305,8 +1310,8 @@ on this string to produce the exported version." | |||
| 1305 | (setq target-alist (org-export-define-heading-targets target-alist)) | 1310 | (setq target-alist (org-export-define-heading-targets target-alist)) |
| 1306 | 1311 | ||
| 1307 | ;; Get rid of drawers | 1312 | ;; Get rid of drawers |
| 1308 | (org-export-remove-or-extract-drawers drawers | 1313 | (org-export-remove-or-extract-drawers |
| 1309 | (plist-get parameters :drawers)) | 1314 | drawers (plist-get parameters :drawers) backend) |
| 1310 | 1315 | ||
| 1311 | ;; Get the correct stuff before the first headline | 1316 | ;; Get the correct stuff before the first headline |
| 1312 | (when (plist-get parameters :skip-before-1st-heading) | 1317 | (when (plist-get parameters :skip-before-1st-heading) |
| @@ -1530,33 +1535,61 @@ the current file." | |||
| 1530 | (unless desc (insert "][" link)) | 1535 | (unless desc (insert "][" link)) |
| 1531 | (add-text-properties pos (point) props)))))) | 1536 | (add-text-properties pos (point) props)))))) |
| 1532 | 1537 | ||
| 1533 | (defun org-export-remove-or-extract-drawers (all-drawers exp-drawers) | 1538 | (defvar org-export-format-drawer-function nil |
| 1534 | "Remove drawers, or extract the content. | 1539 | "Function to be called to format the contents of a drawer. |
| 1540 | The function must accept three parameters: | ||
| 1541 | BACKEND one of the symbols html, docbook, latex, ascii, xoxo | ||
| 1542 | NAME the drawer name, like \"PROPERTIES\" | ||
| 1543 | CONTENT the content of the drawer. | ||
| 1544 | The function should return the text to be inserted into the buffer. | ||
| 1545 | If this is nil, `org-export-format-drawer' is used as a default.") | ||
| 1546 | |||
| 1547 | (defun org-export-remove-or-extract-drawers (all-drawers exp-drawers backend) | ||
| 1548 | "Remove drawers, or extract and format the content. | ||
| 1535 | ALL-DRAWERS is a list of all drawer names valid in the current buffer. | 1549 | ALL-DRAWERS is a list of all drawer names valid in the current buffer. |
| 1536 | EXP-DRAWERS can be t to keep all drawer contents, or a list of drawers | 1550 | EXP-DRAWERS can be t to keep all drawer contents, or a list of drawers |
| 1537 | whose content to keep." | 1551 | whose content to keep. Any drawers that are in ALL-DRAWERS but not in |
| 1538 | (unless (eq t exp-drawers) | 1552 | EXP-DRAWERS will be removed. |
| 1539 | (goto-char (point-min)) | 1553 | BACKEND is the current export backend." |
| 1540 | (let ((re (concat "^[ \t]*:\\(" | 1554 | (goto-char (point-min)) |
| 1541 | (mapconcat | 1555 | (let ((re (concat "^[ \t]*:\\(" |
| 1542 | 'identity | 1556 | (mapconcat 'identity all-drawers "\\|") |
| 1543 | (org-delete-all exp-drawers | 1557 | "\\):[ \t]*$")) |
| 1544 | (copy-sequence all-drawers)) | 1558 | name beg beg-content eol content) |
| 1545 | "\\|") | 1559 | (while (re-search-forward re nil t) |
| 1546 | "\\):[ \t]*$")) | 1560 | (org-if-unprotected |
| 1547 | beg eol) | 1561 | (setq name (match-string 1)) |
| 1548 | (while (re-search-forward re nil t) | 1562 | (setq beg (match-beginning 0) |
| 1549 | (org-if-unprotected | 1563 | beg-content (1+ (point-at-eol)) |
| 1550 | (setq beg (match-beginning 0) | 1564 | eol (point-at-eol)) |
| 1551 | eol (match-end 0)) | 1565 | (if (not (and (re-search-forward |
| 1552 | (if (re-search-forward "^\\([ \t]*:END:[ \t]*\n?\\)\\|^\\*+[ \t]" | 1566 | "^\\([ \t]*:END:[ \t]*\n?\\)\\|^\\*+[ \t]" nil t) |
| 1553 | nil t) | 1567 | (match-end 1))) |
| 1554 | (if (match-end 1) | 1568 | (goto-char eol) |
| 1555 | ;; terminated in this entry | 1569 | (goto-char (match-beginning 0)) |
| 1556 | (progn | 1570 | (and (looking-at ".*\n?") (replace-match "")) |
| 1557 | (delete-region beg (match-end 1)) | 1571 | (setq content (buffer-substring beg-content (point))) |
| 1558 | (goto-char beg)) | 1572 | (delete-region beg (point)) |
| 1559 | (goto-char eol)))))))) | 1573 | (when (or (eq exp-drawers t) |
| 1574 | (member name exp-drawers)) | ||
| 1575 | (setq content (funcall (or org-export-format-drawer-function | ||
| 1576 | 'org-export-format-drawer) | ||
| 1577 | name content backend)) | ||
| 1578 | (insert content))))))) | ||
| 1579 | |||
| 1580 | (defun org-export-format-drawer (name content backend) | ||
| 1581 | "Format the content of a drawer as a colon example." | ||
| 1582 | (if (string-match "[ \t]+\\'" content) | ||
| 1583 | (setq content (substring content (match-beginning 0)))) | ||
| 1584 | (while (string-match "\\`[ \t]*\n" content) | ||
| 1585 | (setq content (substring content (match-end 0)))) | ||
| 1586 | (setq content (org-remove-indentation content)) | ||
| 1587 | (setq content (concat ": " (mapconcat 'identity | ||
| 1588 | (org-split-string content "\n") | ||
| 1589 | "\n: ") | ||
| 1590 | "\n")) | ||
| 1591 | (setq content (concat " : " (upcase name) "\n" content)) | ||
| 1592 | (org-add-props content nil 'org-protected t)) | ||
| 1560 | 1593 | ||
| 1561 | (defun org-export-handle-export-tags (select-tags exclude-tags) | 1594 | (defun org-export-handle-export-tags (select-tags exclude-tags) |
| 1562 | "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS. | 1595 | "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS. |
| @@ -1603,8 +1636,10 @@ removed as well." | |||
| 1603 | (when (org-at-heading-p) | 1636 | (when (org-at-heading-p) |
| 1604 | (org-back-to-heading t) | 1637 | (org-back-to-heading t) |
| 1605 | (setq beg (point)) | 1638 | (setq beg (point)) |
| 1606 | (org-end-of-subtree t) | 1639 | (org-end-of-subtree t t) |
| 1607 | (delete-region beg (point))))) | 1640 | (delete-region beg (point)) |
| 1641 | (when (featurep 'org-inlinetask) | ||
| 1642 | (org-inlinetask-remove-END-maybe))))) | ||
| 1608 | ;; Remove everything that is now still marked for deletion | 1643 | ;; Remove everything that is now still marked for deletion |
| 1609 | (goto-char (point-min)) | 1644 | (goto-char (point-min)) |
| 1610 | (while (setq beg (text-property-any (point-min) (point-max) :org-delete t)) | 1645 | (while (setq beg (text-property-any (point-min) (point-max) :org-delete t)) |
| @@ -1682,9 +1717,10 @@ from the buffer." | |||
| 1682 | "Mark verbatim snippets with the protection property." | 1717 | "Mark verbatim snippets with the protection property." |
| 1683 | (goto-char (point-min)) | 1718 | (goto-char (point-min)) |
| 1684 | (while (re-search-forward org-verbatim-re nil t) | 1719 | (while (re-search-forward org-verbatim-re nil t) |
| 1685 | (add-text-properties (match-beginning 4) (match-end 4) | 1720 | (org-if-unprotected |
| 1686 | '(org-protected t)) | 1721 | (add-text-properties (match-beginning 4) (match-end 4) |
| 1687 | (goto-char (1+ (match-end 4))))) | 1722 | '(org-protected t org-verbatim-emph t)) |
| 1723 | (goto-char (1+ (match-end 4)))))) | ||
| 1688 | 1724 | ||
| 1689 | (defun org-export-protect-colon-examples () | 1725 | (defun org-export-protect-colon-examples () |
| 1690 | "Protect lines starting with a colon." | 1726 | "Protect lines starting with a colon." |
| @@ -1728,7 +1764,12 @@ from the buffer." | |||
| 1728 | (setq end (match-end 0) end-content (match-beginning 0)) | 1764 | (setq end (match-end 0) end-content (match-beginning 0)) |
| 1729 | (if (eq (car fmt) backend) | 1765 | (if (eq (car fmt) backend) |
| 1730 | ;; yes, keep this | 1766 | ;; yes, keep this |
| 1731 | (add-text-properties beg-content end-content '(org-protected t)) | 1767 | (progn |
| 1768 | (add-text-properties beg-content end-content '(org-protected t)) | ||
| 1769 | (delete-region (match-beginning 0) (match-end 0)) | ||
| 1770 | (save-excursion | ||
| 1771 | (goto-char beg) | ||
| 1772 | (delete-region (point) (1+ (point-at-eol))))) | ||
| 1732 | ;; No, this is for a different backend, kill it | 1773 | ;; No, this is for a different backend, kill it |
| 1733 | (delete-region beg end))))))) | 1774 | (delete-region beg end))))))) |
| 1734 | 1775 | ||
| @@ -2252,19 +2293,21 @@ in the list) and remove property and value from the list in LISTVAR." | |||
| 2252 | (backend lang code &optional opts indent) | 2293 | (backend lang code &optional opts indent) |
| 2253 | "Format CODE from language LANG and return it formatted for export. | 2294 | "Format CODE from language LANG and return it formatted for export. |
| 2254 | If LANG is nil, do not add any fontification. | 2295 | If LANG is nil, do not add any fontification. |
| 2255 | OPTS contains formatting optons, like `-n' for triggering numbering lines, | 2296 | OPTS contains formatting options, like `-n' for triggering numbering lines, |
| 2256 | and `+n' for continuing previous numering. | 2297 | and `+n' for continuing previous numbering. |
| 2257 | Code formatting according to language currently only works for HTML. | 2298 | Code formatting according to language currently only works for HTML. |
| 2258 | Numbering lines works for all three major backends (html, latex, and ascii). | 2299 | Numbering lines works for all three major backends (html, latex, and ascii). |
| 2259 | INDENT was the original indentation of the block." | 2300 | INDENT was the original indentation of the block." |
| 2260 | (save-match-data | 2301 | (save-match-data |
| 2261 | (let (num cont rtn rpllbl keepp textareap cols rows fmt) | 2302 | (let (num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) |
| 2262 | (setq opts (or opts "") | 2303 | (setq opts (or opts "") |
| 2263 | num (string-match "[-+]n\\>" opts) | 2304 | num (string-match "[-+]n\\>" opts) |
| 2264 | cont (string-match "\\+n\\>" opts) | 2305 | cont (string-match "\\+n\\>" opts) |
| 2265 | rpllbl (string-match "-r\\>" opts) | 2306 | rpllbl (string-match "-r\\>" opts) |
| 2266 | keepp (string-match "-k\\>" opts) | 2307 | keepp (string-match "-k\\>" opts) |
| 2267 | textareap (string-match "-t\\>" opts) | 2308 | textareap (string-match "-t\\>" opts) |
| 2309 | preserve-indentp (or org-src-preserve-indentation | ||
| 2310 | (string-match "-i\\>" opts)) | ||
| 2268 | cols (if (string-match "-w[ \t]+\\([0-9]+\\)" opts) | 2311 | cols (if (string-match "-w[ \t]+\\([0-9]+\\)" opts) |
| 2269 | (string-to-number (match-string 1 opts)) | 2312 | (string-to-number (match-string 1 opts)) |
| 2270 | 80) | 2313 | 80) |
| @@ -2277,7 +2320,7 @@ INDENT was the original indentation of the block." | |||
| 2277 | ;; we cannot use numbering or highlighting. | 2320 | ;; we cannot use numbering or highlighting. |
| 2278 | (setq num nil cont nil lang nil)) | 2321 | (setq num nil cont nil lang nil)) |
| 2279 | (if keepp (setq rpllbl 'keep)) | 2322 | (if keepp (setq rpllbl 'keep)) |
| 2280 | (setq rtn (org-remove-indentation code)) | 2323 | (setq rtn (if preserve-indentp code (org-remove-indentation code))) |
| 2281 | (when (string-match "^," rtn) | 2324 | (when (string-match "^," rtn) |
| 2282 | (setq rtn (with-temp-buffer | 2325 | (setq rtn (with-temp-buffer |
| 2283 | (insert rtn) | 2326 | (insert rtn) |
| @@ -2736,8 +2779,9 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 2736 | ((not org-log-done) "nologdone")) | 2779 | ((not org-log-done) "nologdone")) |
| 2737 | (or (mapconcat (lambda (x) | 2780 | (or (mapconcat (lambda (x) |
| 2738 | (cond | 2781 | (cond |
| 2739 | ((equal '(:startgroup) x) "{") | 2782 | ((equal :startgroup (car x)) "{") |
| 2740 | ((equal '(:endgroup) x) "}") | 2783 | ((equal :endgroup (car x)) "}") |
| 2784 | ((equal :newline (car x)) "") | ||
| 2741 | ((cdr x) (format "%s(%c)" (car x) (cdr x))) | 2785 | ((cdr x) (format "%s(%c)" (car x) (cdr x))) |
| 2742 | (t (car x)))) | 2786 | (t (car x)))) |
| 2743 | (or org-tag-alist (org-get-buffer-tags)) " ") "") | 2787 | (or org-tag-alist (org-get-buffer-tags)) " ") "") |
| @@ -2889,3 +2933,4 @@ The depends on the variable `org-export-copy-to-kill'." | |||
| 2889 | ;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 | 2933 | ;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 |
| 2890 | 2934 | ||
| 2891 | ;;; org-exp.el ends here | 2935 | ;;; org-exp.el ends here |
| 2936 | |||
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index adf04644b40..ac70649ec53 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index d8cf2e00d93..a63da894a4e 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -83,7 +83,7 @@ | |||
| 83 | ;; | 83 | ;; |
| 84 | ;; #+DRAWERS: PROPERTIES LOGBOOK FEEDSTATUS | 84 | ;; #+DRAWERS: PROPERTIES LOGBOOK FEEDSTATUS |
| 85 | ;; | 85 | ;; |
| 86 | ;; Acknowledgments | 86 | ;; Acknowledgements |
| 87 | ;; ---------------- | 87 | ;; ---------------- |
| 88 | ;; | 88 | ;; |
| 89 | ;; org-feed.el is based on ideas by Brad Bozarth who implemented a | 89 | ;; org-feed.el is based on ideas by Brad Bozarth who implemented a |
| @@ -542,7 +542,7 @@ If that property is already present, nothing changes." | |||
| 542 | (buffer-string))))) | 542 | (buffer-string))))) |
| 543 | 543 | ||
| 544 | (defun org-feed-make-indented-block (s n) | 544 | (defun org-feed-make-indented-block (s n) |
| 545 | "Add indentaton of N spaces to a multiline string S." | 545 | "Add indentation of N spaces to a multiline string S." |
| 546 | (if (not (string-match "\n" s)) | 546 | (if (not (string-match "\n" s)) |
| 547 | s | 547 | s |
| 548 | (mapconcat 'identity | 548 | (mapconcat 'identity |
| @@ -613,7 +613,7 @@ containing the properties `:guid' and `:item-full-text'." | |||
| 613 | 613 | ||
| 614 | (defun org-feed-parse-atom-feed (buffer) | 614 | (defun org-feed-parse-atom-feed (buffer) |
| 615 | "Parse BUFFER for Atom feed entries. | 615 | "Parse BUFFER for Atom feed entries. |
| 616 | Returns a list of enttries, with each entry a property list, | 616 | Returns a list of entries, with each entry a property list, |
| 617 | containing the properties `:guid' and `:item-full-text'. | 617 | containing the properties `:guid' and `:item-full-text'. |
| 618 | 618 | ||
| 619 | The `:item-full-text' property actually contains the sexp | 619 | The `:item-full-text' property actually contains the sexp |
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 6e520a418a0..bfd54721fe8 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -46,6 +46,7 @@ | |||
| 46 | (declare-function org-show-context "org" (&optional key)) | 46 | (declare-function org-show-context "org" (&optional key)) |
| 47 | (declare-function org-back-to-heading "org" (&optional invisible-ok)) | 47 | (declare-function org-back-to-heading "org" (&optional invisible-ok)) |
| 48 | (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) | 48 | (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) |
| 49 | (declare-function org-in-verbatim-emphasis "org" ()) | ||
| 49 | (defvar org-odd-levels-only) ;; defined in org.el | 50 | (defvar org-odd-levels-only) ;; defined in org.el |
| 50 | 51 | ||
| 51 | (defconst org-footnote-re | 52 | (defconst org-footnote-re |
| @@ -75,7 +76,7 @@ If this is a string, during export, all subtrees starting with this | |||
| 75 | heading will be removed after extracting footnote definitions." | 76 | heading will be removed after extracting footnote definitions." |
| 76 | :group 'org-footnotes | 77 | :group 'org-footnotes |
| 77 | :type '(choice | 78 | :type '(choice |
| 78 | (string :tag "Collect fotnotes under heading") | 79 | (string :tag "Collect footnotes under heading") |
| 79 | (const :tag "Define footnotes locally" nil))) | 80 | (const :tag "Define footnotes locally" nil))) |
| 80 | 81 | ||
| 81 | (defcustom org-footnote-tag-for-non-org-mode-files "Footnotes:" | 82 | (defcustom org-footnote-tag-for-non-org-mode-files "Footnotes:" |
| @@ -108,7 +109,7 @@ confirm like t, but let the user edit the created value. In particular, | |||
| 108 | plain Automatically create plain number labels like [1]" | 109 | plain Automatically create plain number labels like [1]" |
| 109 | :group 'org-footnote | 110 | :group 'org-footnote |
| 110 | :type '(choice | 111 | :type '(choice |
| 111 | (const :tag "Frompt for label" nil) | 112 | (const :tag "Prompt for label" nil) |
| 112 | (const :tag "Create automatic [fn:N]" t) | 113 | (const :tag "Create automatic [fn:N]" t) |
| 113 | (const :tag "Offer automatic [fn:N] for editing" confirm) | 114 | (const :tag "Offer automatic [fn:N] for editing" confirm) |
| 114 | (const :tag "Create automatic [N]" plain))) | 115 | (const :tag "Create automatic [N]" plain))) |
| @@ -310,7 +311,7 @@ or new, let the user edit the definition of the footnote." | |||
| 310 | (defun org-footnote-action (&optional special) | 311 | (defun org-footnote-action (&optional special) |
| 311 | "Do the right thing for footnotes. | 312 | "Do the right thing for footnotes. |
| 312 | When at a footnote reference, jump to the definition. When at a definition, | 313 | When at a footnote reference, jump to the definition. When at a definition, |
| 313 | jump to the refernces. When neither at definition or reference, | 314 | jump to the references. When neither at definition or reference, |
| 314 | create a new footnote, interactively. | 315 | create a new footnote, interactively. |
| 315 | With prefix arg SPECIAL, offer additional commands in a menu." | 316 | With prefix arg SPECIAL, offer additional commands in a menu." |
| 316 | (interactive "P") | 317 | (interactive "P") |
| @@ -365,7 +366,7 @@ referenced sequence." | |||
| 365 | ;; Now find footnote references, and extract the definitions | 366 | ;; Now find footnote references, and extract the definitions |
| 366 | (goto-char (point-min)) | 367 | (goto-char (point-min)) |
| 367 | (while (re-search-forward org-footnote-re nil t) | 368 | (while (re-search-forward org-footnote-re nil t) |
| 368 | (unless (org-in-commented-line) | 369 | (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)) |
| 369 | (org-if-unprotected | 370 | (org-if-unprotected |
| 370 | (setq def (match-string 4) | 371 | (setq def (match-string 4) |
| 371 | idef def | 372 | idef def |
diff --git a/lisp/org/org-freemind.el b/lisp/org/org-freemind.el new file mode 100644 index 00000000000..76d17b0ebcb --- /dev/null +++ b/lisp/org/org-freemind.el | |||
| @@ -0,0 +1,1137 @@ | |||
| 1 | ;;; org-freemind.el --- Export Org files to freemind | ||
| 2 | |||
| 3 | ;; Copyright (C) 2009 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Lennart Borgman (lennart O borgman A gmail O com) | ||
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | ||
| 7 | ;; Homepage: http://orgmode.org | ||
| 8 | ;; Version: 6.33 | ||
| 9 | ;; | ||
| 10 | ;; This file is part of GNU Emacs. | ||
| 11 | ;; | ||
| 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 13 | ;; it under the terms of the GNU General Public License as published by | ||
| 14 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 15 | ;; (at your option) any later version. | ||
| 16 | |||
| 17 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | ;; GNU General Public License for more details. | ||
| 21 | |||
| 22 | ;; You should have received a copy of the GNU General Public License | ||
| 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 24 | |||
| 25 | ;; -------------------------------------------------------------------- | ||
| 26 | ;; Features that might be required by this library: | ||
| 27 | ;; | ||
| 28 | ;; `backquote', `bytecomp', `cl', `easymenu', `font-lock', | ||
| 29 | ;; `noutline', `org', `org-compat', `org-faces', `org-footnote', | ||
| 30 | ;; `org-list', `org-macs', `org-src', `outline', `syntax', | ||
| 31 | ;; `time-date', `xml'. | ||
| 32 | ;; | ||
| 33 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 34 | ;; | ||
| 35 | ;;; Commentary: | ||
| 36 | ;; | ||
| 37 | ;; This file tries to implement some functions useful for | ||
| 38 | ;; transformation between org-mode and FreeMind files. | ||
| 39 | ;; | ||
| 40 | ;; Here are the commands you can use: | ||
| 41 | ;; | ||
| 42 | ;; M-x `org-freemind-from-org-mode' | ||
| 43 | ;; M-x `org-freemind-from-org-mode-node' | ||
| 44 | ;; M-x `org-freemind-from-org-sparse-tree' | ||
| 45 | ;; | ||
| 46 | ;; M-x `org-freemind-to-org-mode' | ||
| 47 | ;; | ||
| 48 | ;; M-x `org-freemind-show' | ||
| 49 | ;; | ||
| 50 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 51 | ;; | ||
| 52 | ;;; Change log: | ||
| 53 | ;; | ||
| 54 | ;; 2009-02-15: Added check for next level=current+1 | ||
| 55 | ;; 2009-02-21: Fixed bug in `org-freemind-to-org-mode'. | ||
| 56 | ;; 2009-10-25: Added support for `org-odd-levels-only'. | ||
| 57 | ;; Added y/n question before showing in FreeMind. | ||
| 58 | ;; 2009-11-04: Added support for #+BEGIN_HTML. | ||
| 59 | ;; | ||
| 60 | ;; | ||
| 61 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 62 | ;; | ||
| 63 | ;; This program is free software; you can redistribute it and/or | ||
| 64 | ;; modify it under the terms of the GNU General Public License as | ||
| 65 | ;; published by the Free Software Foundation; either version 2, or | ||
| 66 | ;; (at your option) any later version. | ||
| 67 | ;; | ||
| 68 | ;; This program is distributed in the hope that it will be useful, | ||
| 69 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 70 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 71 | ;; General Public License for more details. | ||
| 72 | ;; | ||
| 73 | ;; You should have received a copy of the GNU General Public License | ||
| 74 | ;; along with this program; see the file COPYING. If not, write to | ||
| 75 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth | ||
| 76 | ;; Floor, Boston, MA 02110-1301, USA. | ||
| 77 | ;; | ||
| 78 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 79 | ;; | ||
| 80 | ;;; Code: | ||
| 81 | |||
| 82 | (require 'xml) | ||
| 83 | (require 'org) | ||
| 84 | (require 'org-exp) | ||
| 85 | (eval-when-compile (require 'cl)) | ||
| 86 | |||
| 87 | ;; Fix-me: I am not sure these are useful: | ||
| 88 | ;; | ||
| 89 | ;; (defcustom org-freemind-main-fgcolor "black" | ||
| 90 | ;; "Color of main node's text." | ||
| 91 | ;; :type 'color | ||
| 92 | ;; :group 'freemind) | ||
| 93 | |||
| 94 | ;; (defcustom org-freemind-main-color "black" | ||
| 95 | ;; "Background color of main node." | ||
| 96 | ;; :type 'color | ||
| 97 | ;; :group 'freemind) | ||
| 98 | |||
| 99 | ;; (defcustom org-freemind-child-fgcolor "black" | ||
| 100 | ;; "Color of child nodes' text." | ||
| 101 | ;; :type 'color | ||
| 102 | ;; :group 'freemind) | ||
| 103 | |||
| 104 | ;; (defcustom org-freemind-child-color "black" | ||
| 105 | ;; "Background color of child nodes." | ||
| 106 | ;; :type 'color | ||
| 107 | ;; :group 'freemind) | ||
| 108 | |||
| 109 | (defvar org-freemind-node-style nil "Internal use.") | ||
| 110 | |||
| 111 | (defcustom org-freemind-node-styles nil | ||
| 112 | "Styles to apply to node. | ||
| 113 | NOT READY YET." | ||
| 114 | :type '(repeat | ||
| 115 | (list :tag "Node styles for file" | ||
| 116 | (regexp :tag "File name") | ||
| 117 | (repeat | ||
| 118 | (list :tag "Node" | ||
| 119 | (regexp :tag "Node name regexp") | ||
| 120 | (set :tag "Node properties" | ||
| 121 | (list :format "%v" (const :format "" node-style) | ||
| 122 | (choice :tag "Style" | ||
| 123 | :value bubble | ||
| 124 | (const bubble) | ||
| 125 | (const fork))) | ||
| 126 | (list :format "%v" (const :format "" color) | ||
| 127 | (color :tag "Color" :value "red")) | ||
| 128 | (list :format "%v" (const :format "" background-color) | ||
| 129 | (color :tag "Background color" :value "yellow")) | ||
| 130 | (list :format "%v" (const :format "" edge-color) | ||
| 131 | (color :tag "Edge color" :value "green")) | ||
| 132 | (list :format "%v" (const :format "" edge-style) | ||
| 133 | (choice :tag "Edge style" :value bezier | ||
| 134 | (const :tag "Linear" linear) | ||
| 135 | (const :tag "Bezier" bezier) | ||
| 136 | (const :tag "Sharp Linear" sharp-linear) | ||
| 137 | (const :tag "Sharp Bezier" sharp-bezier))) | ||
| 138 | (list :format "%v" (const :format "" edge-width) | ||
| 139 | (choice :tag "Edge width" :value thin | ||
| 140 | (const :tag "Parent" parent) | ||
| 141 | (const :tag "Thin" thin) | ||
| 142 | (const 1) | ||
| 143 | (const 2) | ||
| 144 | (const 4) | ||
| 145 | (const 8))) | ||
| 146 | (list :format "%v" (const :format "" italic) | ||
| 147 | (const :tag "Italic font" t)) | ||
| 148 | (list :format "%v" (const :format "" bold) | ||
| 149 | (const :tag "Bold font" t)) | ||
| 150 | (list :format "%v" (const :format "" font-name) | ||
| 151 | (string :tag "Font name" :value "SansSerif")) | ||
| 152 | (list :format "%v" (const :format "" font-size) | ||
| 153 | (integer :tag "Font size" :value 12))))))) | ||
| 154 | :group 'freemind) | ||
| 155 | |||
| 156 | ;;;###autoload | ||
| 157 | (defun org-export-as-freemind (arg &optional hidden ext-plist | ||
| 158 | to-buffer body-only pub-dir) | ||
| 159 | (interactive "P") | ||
| 160 | (let* ((opt-plist (org-combine-plists (org-default-export-plist) | ||
| 161 | ext-plist | ||
| 162 | (org-infile-export-plist))) | ||
| 163 | (region-p (org-region-active-p)) | ||
| 164 | (rbeg (and region-p (region-beginning))) | ||
| 165 | (rend (and region-p (region-end))) | ||
| 166 | (subtree-p | ||
| 167 | (if (plist-get opt-plist :ignore-subtree-p) | ||
| 168 | nil | ||
| 169 | (when region-p | ||
| 170 | (save-excursion | ||
| 171 | (goto-char rbeg) | ||
| 172 | (and (org-at-heading-p) | ||
| 173 | (>= (org-end-of-subtree t t) rend)))))) | ||
| 174 | (opt-plist (setq org-export-opt-plist | ||
| 175 | (if subtree-p | ||
| 176 | (org-export-add-subtree-options opt-plist rbeg) | ||
| 177 | opt-plist))) | ||
| 178 | (bfname (buffer-file-name (or (buffer-base-buffer) (current-buffer)))) | ||
| 179 | (filename (concat (file-name-as-directory | ||
| 180 | (or pub-dir | ||
| 181 | (org-export-directory :ascii opt-plist))) | ||
| 182 | (file-name-sans-extension | ||
| 183 | (or (and subtree-p | ||
| 184 | (org-entry-get (region-beginning) | ||
| 185 | "EXPORT_FILE_NAME" t)) | ||
| 186 | (file-name-nondirectory bfname))) | ||
| 187 | ".mm"))) | ||
| 188 | (when (file-exists-p filename) | ||
| 189 | (delete-file filename)) | ||
| 190 | (cond | ||
| 191 | (subtree-p | ||
| 192 | (org-freemind-from-org-mode-node (line-number-at-pos rbeg) | ||
| 193 | filename)) | ||
| 194 | (t (org-freemind-from-org-mode bfname filename))))) | ||
| 195 | |||
| 196 | ;;;###autoload | ||
| 197 | (defun org-freemind-show (mm-file) | ||
| 198 | "Show file MM-FILE in Freemind." | ||
| 199 | (interactive | ||
| 200 | (list | ||
| 201 | (save-match-data | ||
| 202 | (let ((name (read-file-name "FreeMind file: " | ||
| 203 | nil nil nil | ||
| 204 | (if (buffer-file-name) | ||
| 205 | (file-name-nondirectory (buffer-file-name)) | ||
| 206 | "") | ||
| 207 | ;; Fix-me: Is this an Emacs bug? | ||
| 208 | ;; This predicate function is never | ||
| 209 | ;; called. | ||
| 210 | (lambda (fn) | ||
| 211 | (string-match "^mm$" (file-name-extension fn)))))) | ||
| 212 | (setq name (expand-file-name name)) | ||
| 213 | name)))) | ||
| 214 | (org-open-file mm-file)) | ||
| 215 | |||
| 216 | (defconst org-freemind-org-nfix "--org-mode: ") | ||
| 217 | |||
| 218 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 219 | ;;; Format converters | ||
| 220 | |||
| 221 | (defun org-freemind-escape-str-from-org (org-str) | ||
| 222 | "Do some html-escaping of ORG-STR and return the result. | ||
| 223 | The characters \"&<> will be escaped." | ||
| 224 | (let ((chars (append org-str nil)) | ||
| 225 | (fm-str "")) | ||
| 226 | (dolist (cc chars) | ||
| 227 | (setq fm-str | ||
| 228 | (concat fm-str | ||
| 229 | (if (< cc 256) | ||
| 230 | (cond | ||
| 231 | ((= cc ?\") """) | ||
| 232 | ((= cc ?\&) "&") | ||
| 233 | ((= cc ?\<) "<") | ||
| 234 | ((= cc ?\>) ">") | ||
| 235 | (t (char-to-string cc))) | ||
| 236 | ;; Formatting as &#number; is maybe needed | ||
| 237 | ;; according to a bug report from kazuo | ||
| 238 | ;; fujimoto, but I have now instead added a xml | ||
| 239 | ;; processing instruction saying that the mm | ||
| 240 | ;; file is utf-8: | ||
| 241 | ;; | ||
| 242 | ;; (format "&#x%x;" (- cc ;; ?\x800)) | ||
| 243 | (char-to-string cc) | ||
| 244 | )))) | ||
| 245 | fm-str)) | ||
| 246 | |||
| 247 | ;;(org-freemind-unescape-str-to-org "mA≌B<C<=") | ||
| 248 | ;;(org-freemind-unescape-str-to-org "<<") | ||
| 249 | (defun org-freemind-unescape-str-to-org (fm-str) | ||
| 250 | "Do some html-unescaping of FM-STR and return the result. | ||
| 251 | This is the opposite of `org-freemind-escape-str-from-org' but it | ||
| 252 | will also unescape &#nn;." | ||
| 253 | (let ((org-str fm-str)) | ||
| 254 | (setq org-str (replace-regexp-in-string """ "\"" org-str)) | ||
| 255 | (setq org-str (replace-regexp-in-string "&" "&" org-str)) | ||
| 256 | (setq org-str (replace-regexp-in-string "<" "<" org-str)) | ||
| 257 | (setq org-str (replace-regexp-in-string ">" ">" org-str)) | ||
| 258 | (setq org-str (replace-regexp-in-string | ||
| 259 | "&#x\\([a-f0-9]\\{2,4\\}\\);" | ||
| 260 | (lambda (m) | ||
| 261 | (char-to-string | ||
| 262 | (+ (string-to-number (match-string 1 m) 16) | ||
| 263 | 0 ;?\x800 ;; What is this for? Encoding? | ||
| 264 | ))) | ||
| 265 | org-str)))) | ||
| 266 | |||
| 267 | ;; (org-freemind-test-escape) | ||
| 268 | (defun org-freemind-test-escape () | ||
| 269 | (let* ((str1 "a quote: \", an amp: &, lt: <; over 256: öåäÖÅÄ") | ||
| 270 | (str2 (org-freemind-escape-str-from-org str1)) | ||
| 271 | (str3 (org-freemind-unescape-str-to-org str2)) | ||
| 272 | ) | ||
| 273 | (unless (string= str1 str3) | ||
| 274 | (error "str3=%s" str3)) | ||
| 275 | )) | ||
| 276 | |||
| 277 | (defun org-freemind-convert-links-from-org (org-str) | ||
| 278 | "Convert org links in ORG-STR to freemind links and return the result." | ||
| 279 | (let ((fm-str (replace-regexp-in-string | ||
| 280 | (rx (not (any "[\"")) | ||
| 281 | (submatch | ||
| 282 | "http" | ||
| 283 | (opt ?\s) | ||
| 284 | "://" | ||
| 285 | (1+ | ||
| 286 | (any "-%.?@a-zA-Z0-9()_/:~=&#")))) | ||
| 287 | "[[\\1][\\1]]" | ||
| 288 | org-str))) | ||
| 289 | (replace-regexp-in-string (rx "[[" | ||
| 290 | (submatch (*? nonl)) | ||
| 291 | "][" | ||
| 292 | (submatch (*? nonl)) | ||
| 293 | "]]") | ||
| 294 | "<a href=\"\\1\">\\2</a>" | ||
| 295 | fm-str))) | ||
| 296 | |||
| 297 | ;;(org-freemind-convert-links-to-org "<a href=\"http://www.somewhere/\">link-text</a>") | ||
| 298 | (defun org-freemind-convert-links-to-org (fm-str) | ||
| 299 | "Convert freemind links in FM-STR to org links and return the result." | ||
| 300 | (let ((org-str (replace-regexp-in-string | ||
| 301 | (rx "<a" | ||
| 302 | space | ||
| 303 | (0+ | ||
| 304 | (0+ (not (any ">"))) | ||
| 305 | space) | ||
| 306 | "href=\"" | ||
| 307 | (submatch (0+ (not (any "\"")))) | ||
| 308 | "\"" | ||
| 309 | (0+ (not (any ">"))) | ||
| 310 | ">" | ||
| 311 | (submatch (0+ (not (any "<")))) | ||
| 312 | "</a>") | ||
| 313 | "[[\\1][\\2]]" | ||
| 314 | fm-str))) | ||
| 315 | org-str)) | ||
| 316 | |||
| 317 | ;; Fix-me: | ||
| 318 | ;;(defun org-freemind-convert-drawers-from-org (text) | ||
| 319 | ;; ) | ||
| 320 | |||
| 321 | ;; (org-freemind-test-links) | ||
| 322 | ;; (defun org-freemind-test-links () | ||
| 323 | ;; (let* ((str1 "[[http://www.somewhere/][link-text]") | ||
| 324 | ;; (str2 (org-freemind-convert-links-from-org str1)) | ||
| 325 | ;; (str3 (org-freemind-convert-links-to-org str2)) | ||
| 326 | ;; ) | ||
| 327 | ;; (unless (string= str1 str3) | ||
| 328 | ;; (error "str3=%s" str3)) | ||
| 329 | ;; )) | ||
| 330 | |||
| 331 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 332 | ;;; Org => FreeMind | ||
| 333 | |||
| 334 | (defun org-freemind-convert-text-p (text) | ||
| 335 | "Convert TEXT to html with <p> paragraphs." | ||
| 336 | (setq text (org-freemind-escape-str-from-org text)) | ||
| 337 | (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "</p><p>\n" text)) | ||
| 338 | ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text)) | ||
| 339 | ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "<br />" text)) | ||
| 340 | (setq text (replace-regexp-in-string "\n" "<br />" text)) | ||
| 341 | (concat "<p>" | ||
| 342 | (org-freemind-convert-links-from-org text) | ||
| 343 | "</p>\n")) | ||
| 344 | |||
| 345 | (defun org-freemind-org-text-to-freemind-subnode/note (node-name start end drawers-regexp) | ||
| 346 | "Convert text part of org node to freemind subnode or note. | ||
| 347 | Convert the text part of the org node named NODE-NAME. The text | ||
| 348 | is in the current buffer between START and END. Drawers matching | ||
| 349 | DRAWERS-REGEXP are converted to freemind notes." | ||
| 350 | ;; fix-me: doc | ||
| 351 | (let ((text (buffer-substring-no-properties start end)) | ||
| 352 | (node-res "") | ||
| 353 | (note-res "")) | ||
| 354 | (save-match-data | ||
| 355 | ;;(setq text (org-freemind-escape-str-from-org text)) | ||
| 356 | ;; First see if there is something that should be moved to the | ||
| 357 | ;; note part: | ||
| 358 | (let (drawers) | ||
| 359 | (while (string-match drawers-regexp text) | ||
| 360 | (setq drawers (cons (match-string 0 text) drawers)) | ||
| 361 | (setq text | ||
| 362 | (concat (substring text 0 (match-beginning 0)) | ||
| 363 | (substring text (match-end 0)))) | ||
| 364 | ) | ||
| 365 | (when drawers | ||
| 366 | (dolist (drawer drawers) | ||
| 367 | (let ((lines (split-string drawer "\n"))) | ||
| 368 | (dolist (line lines) | ||
| 369 | (setq note-res (concat | ||
| 370 | note-res | ||
| 371 | org-freemind-org-nfix line "<br />\n"))) | ||
| 372 | )))) | ||
| 373 | |||
| 374 | (when (> (length note-res) 0) | ||
| 375 | (setq note-res (concat | ||
| 376 | "<richcontent TYPE=\"NOTE\"><html>\n" | ||
| 377 | "<head>\n" | ||
| 378 | "</head>\n" | ||
| 379 | "<body>\n" | ||
| 380 | note-res | ||
| 381 | "</body>\n" | ||
| 382 | "</html>\n" | ||
| 383 | "</richcontent>\n")) | ||
| 384 | ) | ||
| 385 | |||
| 386 | ;; There is always an LF char: | ||
| 387 | (when (> (length text) 1) | ||
| 388 | (setq node-res (concat | ||
| 389 | "<node style=\"bubble\" background_color=\"#eeee00\">\n" | ||
| 390 | "<richcontent TYPE=\"NODE\"><html>\n" | ||
| 391 | "<head>\n" | ||
| 392 | "<style type=\"text/css\">\n" | ||
| 393 | "<!--\n" | ||
| 394 | "p { margin-top: 0 }\n" | ||
| 395 | "-->\n" | ||
| 396 | "</style>\n" | ||
| 397 | "</head>\n" | ||
| 398 | "<body>\n")) | ||
| 399 | (let ((begin-html-mark (regexp-quote "#+BEGIN_HTML")) | ||
| 400 | (end-html-mark (regexp-quote "#+END_HTML")) | ||
| 401 | head | ||
| 402 | end-pos | ||
| 403 | end-pos-match | ||
| 404 | ) | ||
| 405 | ;; Take care of #+BEGIN_HTML - #+END_HTML | ||
| 406 | (while (string-match begin-html-mark text) | ||
| 407 | (setq head (substring text 0 (match-beginning 0))) | ||
| 408 | (setq end-pos-match (match-end 0)) | ||
| 409 | (setq node-res (concat node-res | ||
| 410 | (org-freemind-convert-text-p head))) | ||
| 411 | (setq text (substring text end-pos-match)) | ||
| 412 | (setq end-pos (string-match end-html-mark text)) | ||
| 413 | (if end-pos | ||
| 414 | (setq end-pos-match (match-end 0)) | ||
| 415 | (message "org-freemind: Missing #+END_HTML") | ||
| 416 | (setq end-pos (length text)) | ||
| 417 | (setq end-pos-match end-pos)) | ||
| 418 | (setq node-res (concat node-res | ||
| 419 | (substring text 0 end-pos))) | ||
| 420 | (setq text (substring text end-pos-match))) | ||
| 421 | (setq node-res (concat node-res | ||
| 422 | (org-freemind-convert-text-p text)))) | ||
| 423 | (setq node-res (concat | ||
| 424 | node-res | ||
| 425 | "</body>\n" | ||
| 426 | "</html>\n" | ||
| 427 | "</richcontent>\n" | ||
| 428 | ;; Put a note that this is for the parent node | ||
| 429 | "<richcontent TYPE=\"NOTE\"><html>" | ||
| 430 | "<head>" | ||
| 431 | "</head>" | ||
| 432 | "<body>" | ||
| 433 | "<p>" | ||
| 434 | "-- This is more about \"" node-name "\" --" | ||
| 435 | "</p>" | ||
| 436 | "</body>" | ||
| 437 | "</html>" | ||
| 438 | "</richcontent>\n" | ||
| 439 | "</node>\n" ;; ok | ||
| 440 | ))) | ||
| 441 | (list node-res note-res)))) | ||
| 442 | |||
| 443 | (defun org-freemind-write-node (mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child) | ||
| 444 | (let* (this-icons | ||
| 445 | this-bg-color | ||
| 446 | this-m2-escaped | ||
| 447 | this-rich-node | ||
| 448 | this-rich-note | ||
| 449 | ) | ||
| 450 | (when (string-match "TODO" this-m2) | ||
| 451 | (setq this-m2 (replace-match "" nil nil this-m2)) | ||
| 452 | (add-to-list 'this-icons "button_cancel") | ||
| 453 | (setq this-bg-color "#ffff88") | ||
| 454 | (when (string-match "\\[#\\(.\\)\\]" this-m2) | ||
| 455 | (let ((prior (string-to-char (match-string 1 this-m2)))) | ||
| 456 | (setq this-m2 (replace-match "" nil nil this-m2)) | ||
| 457 | (cond | ||
| 458 | ((= prior ?A) | ||
| 459 | (add-to-list 'this-icons "full-1") | ||
| 460 | (setq this-bg-color "#ff0000")) | ||
| 461 | ((= prior ?B) | ||
| 462 | (add-to-list 'this-icons "full-2") | ||
| 463 | (setq this-bg-color "#ffaa00")) | ||
| 464 | ((= prior ?C) | ||
| 465 | (add-to-list 'this-icons "full-3") | ||
| 466 | (setq this-bg-color "#ffdd00")) | ||
| 467 | ((= prior ?D) | ||
| 468 | (add-to-list 'this-icons "full-4") | ||
| 469 | (setq this-bg-color "#ffff00")) | ||
| 470 | ((= prior ?E) | ||
| 471 | (add-to-list 'this-icons "full-5")) | ||
| 472 | ((= prior ?F) | ||
| 473 | (add-to-list 'this-icons "full-6")) | ||
| 474 | ((= prior ?G) | ||
| 475 | (add-to-list 'this-icons "full-7")) | ||
| 476 | )))) | ||
| 477 | (setq this-m2 (org-trim this-m2)) | ||
| 478 | (setq this-m2-escaped (org-freemind-escape-str-from-org this-m2)) | ||
| 479 | (let ((node-notes (org-freemind-org-text-to-freemind-subnode/note | ||
| 480 | this-m2-escaped | ||
| 481 | this-node-end | ||
| 482 | (1- next-node-start) | ||
| 483 | drawers-regexp))) | ||
| 484 | (setq this-rich-node (nth 0 node-notes)) | ||
| 485 | (setq this-rich-note (nth 1 node-notes))) | ||
| 486 | (with-current-buffer mm-buffer | ||
| 487 | (insert "<node text=\"" this-m2-escaped "\"") | ||
| 488 | (org-freemind-get-node-style this-m2) | ||
| 489 | (when (> next-level current-level) | ||
| 490 | (unless (or this-children-visible | ||
| 491 | next-has-some-visible-child) | ||
| 492 | (insert " folded=\"true\""))) | ||
| 493 | (when (and (= current-level (1+ base-level)) | ||
| 494 | (> num-left-nodes 0)) | ||
| 495 | (setq num-left-nodes (1- num-left-nodes)) | ||
| 496 | (insert " position=\"left\"")) | ||
| 497 | (when this-bg-color | ||
| 498 | (insert " background_color=\"" this-bg-color "\"")) | ||
| 499 | (insert ">\n") | ||
| 500 | (when this-icons | ||
| 501 | (dolist (icon this-icons) | ||
| 502 | (insert "<icon builtin=\"" icon "\"/>\n"))) | ||
| 503 | ) | ||
| 504 | (with-current-buffer mm-buffer | ||
| 505 | (when this-rich-note (insert this-rich-note)) | ||
| 506 | (when this-rich-node (insert this-rich-node)))) | ||
| 507 | num-left-nodes) | ||
| 508 | |||
| 509 | (defun org-freemind-check-overwrite (file interactively) | ||
| 510 | "Check if file FILE already exists. | ||
| 511 | If FILE does not exists return t. | ||
| 512 | |||
| 513 | If INTERACTIVELY is non-nil ask if the file should be replaced | ||
| 514 | and return t/nil if it should/should not be replaced. | ||
| 515 | |||
| 516 | Otherwise give an error say the file exists." | ||
| 517 | (if (file-exists-p file) | ||
| 518 | (if interactively | ||
| 519 | (y-or-n-p (format "File %s exists, replace it? " file)) | ||
| 520 | (error "File %s already exists" file)) | ||
| 521 | t)) | ||
| 522 | |||
| 523 | (defvar org-freemind-node-pattern (rx bol | ||
| 524 | (submatch (1+ "*")) | ||
| 525 | (1+ space) | ||
| 526 | (submatch (*? nonl)) | ||
| 527 | eol)) | ||
| 528 | |||
| 529 | (defun org-freemind-look-for-visible-child (node-level) | ||
| 530 | (save-excursion | ||
| 531 | (save-match-data | ||
| 532 | (let ((found-visible-child nil)) | ||
| 533 | (while (and (not found-visible-child) | ||
| 534 | (re-search-forward org-freemind-node-pattern nil t)) | ||
| 535 | (let* ((m1 (match-string-no-properties 1)) | ||
| 536 | (level (length m1))) | ||
| 537 | (if (>= node-level level) | ||
| 538 | (setq found-visible-child 'none) | ||
| 539 | (unless (get-char-property (line-beginning-position) 'invisible) | ||
| 540 | (setq found-visible-child 'found))))) | ||
| 541 | (eq found-visible-child 'found) | ||
| 542 | )))) | ||
| 543 | |||
| 544 | (defun org-freemind-goto-line (line) | ||
| 545 | "Go to line number LINE." | ||
| 546 | (save-restriction | ||
| 547 | (widen) | ||
| 548 | (goto-char (point-min)) | ||
| 549 | (forward-line (1- line)))) | ||
| 550 | |||
| 551 | (defun org-freemind-write-mm-buffer (org-buffer mm-buffer node-at-line) | ||
| 552 | (with-current-buffer org-buffer | ||
| 553 | (dolist (node-style org-freemind-node-styles) | ||
| 554 | (when (string-match-p (car node-style) buffer-file-name) | ||
| 555 | (setq org-freemind-node-style (cadr node-style)))) | ||
| 556 | ;;(message "org-freemind-node-style =%s" org-freemind-node-style) | ||
| 557 | (save-match-data | ||
| 558 | (let* ((drawers (copy-sequence org-drawers)) | ||
| 559 | drawers-regexp | ||
| 560 | (num-top1-nodes 0) | ||
| 561 | (num-top2-nodes 0) | ||
| 562 | num-left-nodes | ||
| 563 | (unclosed-nodes 0) | ||
| 564 | (first-time t) | ||
| 565 | (current-level 1) | ||
| 566 | base-level | ||
| 567 | skipping-odd | ||
| 568 | (skipped-odd 0) | ||
| 569 | prev-node-end | ||
| 570 | rich-text | ||
| 571 | unfinished-tag | ||
| 572 | node-at-line-level | ||
| 573 | node-at-line-last) | ||
| 574 | (with-current-buffer mm-buffer | ||
| 575 | (erase-buffer) | ||
| 576 | (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") | ||
| 577 | (insert "<map version=\"0.9.0\">\n") | ||
| 578 | (insert "<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->\n")) | ||
| 579 | (save-excursion | ||
| 580 | ;; Get special buffer vars: | ||
| 581 | (goto-char (point-min)) | ||
| 582 | (while (re-search-forward (rx bol "#+DRAWERS:") nil t) | ||
| 583 | (let ((dr-txt (buffer-substring-no-properties (match-end 0) (line-end-position)))) | ||
| 584 | (setq drawers (append drawers (split-string dr-txt) nil)))) | ||
| 585 | (setq drawers-regexp | ||
| 586 | (concat (rx bol (0+ blank) ":") | ||
| 587 | (regexp-opt drawers) | ||
| 588 | (rx ":" (0+ blank) | ||
| 589 | "\n" | ||
| 590 | (*? anything) | ||
| 591 | "\n" | ||
| 592 | (0+ blank) | ||
| 593 | ":END:" | ||
| 594 | (0+ blank) | ||
| 595 | eol) | ||
| 596 | )) | ||
| 597 | |||
| 598 | (if node-at-line | ||
| 599 | ;; Get number of top nodes and last line for this node | ||
| 600 | (progn | ||
| 601 | (org-freemind-goto-line node-at-line) | ||
| 602 | (unless (looking-at org-freemind-node-pattern) | ||
| 603 | (error "No node at line %s" node-at-line)) | ||
| 604 | (setq node-at-line-level (length (match-string-no-properties 1))) | ||
| 605 | (forward-line) | ||
| 606 | (setq node-at-line-last | ||
| 607 | (catch 'last-line | ||
| 608 | (while (re-search-forward org-freemind-node-pattern nil t) | ||
| 609 | (let* ((m1 (match-string-no-properties 1)) | ||
| 610 | (level (length m1))) | ||
| 611 | (if (<= level node-at-line-level) | ||
| 612 | (progn | ||
| 613 | (beginning-of-line) | ||
| 614 | (throw 'last-line (1- (point)))) | ||
| 615 | (if (= level (1+ node-at-line-level)) | ||
| 616 | (setq num-top2-nodes (1+ num-top2-nodes)))))))) | ||
| 617 | (setq current-level node-at-line-level) | ||
| 618 | (setq num-top1-nodes 1) | ||
| 619 | (org-freemind-goto-line node-at-line)) | ||
| 620 | |||
| 621 | ;; First get number of top nodes | ||
| 622 | (goto-char (point-min)) | ||
| 623 | (while (re-search-forward org-freemind-node-pattern nil t) | ||
| 624 | (let* ((m1 (match-string-no-properties 1)) | ||
| 625 | (level (length m1))) | ||
| 626 | (if (= level 1) | ||
| 627 | (setq num-top1-nodes (1+ num-top1-nodes)) | ||
| 628 | (if (= level 2) | ||
| 629 | (setq num-top2-nodes (1+ num-top2-nodes)))))) | ||
| 630 | ;; If there is more than one top node we need to insert a node | ||
| 631 | ;; to keep them together. | ||
| 632 | (goto-char (point-min)) | ||
| 633 | (when (> num-top1-nodes 1) | ||
| 634 | (setq num-top2-nodes num-top1-nodes) | ||
| 635 | (setq current-level 0) | ||
| 636 | (let ((orig-name (if buffer-file-name | ||
| 637 | (file-name-nondirectory (buffer-file-name)) | ||
| 638 | (buffer-name)))) | ||
| 639 | (with-current-buffer mm-buffer | ||
| 640 | (insert "<node text=\"" orig-name "\" background_color=\"#00bfff\">\n" | ||
| 641 | ;; Put a note that this is for the parent node | ||
| 642 | "<richcontent TYPE=\"NOTE\"><html>" | ||
| 643 | "<head>" | ||
| 644 | "</head>" | ||
| 645 | "<body>" | ||
| 646 | "<p>" | ||
| 647 | org-freemind-org-nfix "WHOLE FILE" | ||
| 648 | "</p>" | ||
| 649 | "</body>" | ||
| 650 | "</html>" | ||
| 651 | "</richcontent>\n"))))) | ||
| 652 | |||
| 653 | (setq num-left-nodes (floor num-top2-nodes 2)) | ||
| 654 | (setq base-level current-level) | ||
| 655 | (let (this-m2 | ||
| 656 | this-node-end | ||
| 657 | this-children-visible | ||
| 658 | next-m2 | ||
| 659 | next-node-start | ||
| 660 | next-level | ||
| 661 | next-has-some-visible-child | ||
| 662 | next-children-visible | ||
| 663 | ) | ||
| 664 | (while (and | ||
| 665 | (re-search-forward org-freemind-node-pattern nil t) | ||
| 666 | (if node-at-line-last (<= (point) node-at-line-last) t) | ||
| 667 | ) | ||
| 668 | (let* ((next-m1 (match-string-no-properties 1)) | ||
| 669 | (next-node-end (match-end 0)) | ||
| 670 | ) | ||
| 671 | (setq next-node-start (match-beginning 0)) | ||
| 672 | (setq next-m2 (match-string-no-properties 2)) | ||
| 673 | (setq next-level (length next-m1)) | ||
| 674 | (when (> next-level current-level) | ||
| 675 | (if (not (and org-odd-levels-only | ||
| 676 | (/= (mod current-level 2) 0) | ||
| 677 | (= next-level (+ 2 current-level)))) | ||
| 678 | (setq skipping-odd nil) | ||
| 679 | (setq skipping-odd t) | ||
| 680 | (setq skipped-odd (1+ skipped-odd))) | ||
| 681 | (unless (or (= next-level (1+ current-level)) | ||
| 682 | skipping-odd) | ||
| 683 | (if (or org-odd-levels-only | ||
| 684 | (/= next-level (+ 2 current-level))) | ||
| 685 | (error "Next level step > +1 for node ending at line %s" (line-number-at-pos)) | ||
| 686 | (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?" | ||
| 687 | (line-number-at-pos))) | ||
| 688 | )) | ||
| 689 | (setq next-children-visible | ||
| 690 | (not (eq 'outline | ||
| 691 | (get-char-property (line-end-position) 'invisible)))) | ||
| 692 | (setq next-has-some-visible-child | ||
| 693 | (if next-children-visible t | ||
| 694 | (org-freemind-look-for-visible-child next-level))) | ||
| 695 | (when this-m2 | ||
| 696 | (setq num-left-nodes (org-freemind-write-node mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child))) | ||
| 697 | (when (if (= num-top1-nodes 1) (> current-level base-level) t) | ||
| 698 | (while (>= current-level next-level) | ||
| 699 | (with-current-buffer mm-buffer | ||
| 700 | (insert "</node>\n") | ||
| 701 | (setq current-level (1- current-level)) | ||
| 702 | (when (< 0 skipped-odd) | ||
| 703 | (setq skipped-odd (1- skipped-odd)) | ||
| 704 | (setq current-level (1- current-level))) | ||
| 705 | ))) | ||
| 706 | (setq this-node-end (1+ next-node-end)) | ||
| 707 | (setq this-m2 next-m2) | ||
| 708 | (setq current-level next-level) | ||
| 709 | (setq this-children-visible next-children-visible) | ||
| 710 | (forward-char) | ||
| 711 | )) | ||
| 712 | ;;; (unless (if node-at-line-last | ||
| 713 | ;;; (>= (point) node-at-line-last) | ||
| 714 | ;;; nil) | ||
| 715 | ;; Write last node: | ||
| 716 | (setq this-m2 next-m2) | ||
| 717 | (setq current-level next-level) | ||
| 718 | (setq next-node-start (if node-at-line-last | ||
| 719 | (1+ node-at-line-last) | ||
| 720 | (point-max))) | ||
| 721 | (setq num-left-nodes (org-freemind-write-node mm-buffer drawers-regexp num-left-nodes base-level current-level next-level this-m2 this-node-end this-children-visible next-node-start next-has-some-visible-child)) | ||
| 722 | (with-current-buffer mm-buffer (insert "</node>\n")) | ||
| 723 | ;) | ||
| 724 | ) | ||
| 725 | (with-current-buffer mm-buffer | ||
| 726 | (while (> current-level base-level) | ||
| 727 | (insert "</node>\n") | ||
| 728 | (setq current-level (1- current-level)) | ||
| 729 | )) | ||
| 730 | (with-current-buffer mm-buffer | ||
| 731 | (insert "</map>") | ||
| 732 | (delete-trailing-whitespace) | ||
| 733 | (goto-char (point-min)) | ||
| 734 | )))))) | ||
| 735 | |||
| 736 | (defun org-freemind-get-node-style (node-name) | ||
| 737 | "NOT READY YET." | ||
| 738 | ;;<node BACKGROUND_COLOR="#eeee00" CREATED="1234668815593" MODIFIED="1234668815593" STYLE="bubble"> | ||
| 739 | ;;<font BOLD="true" NAME="SansSerif" SIZE="12"/> | ||
| 740 | (let (node-styles | ||
| 741 | node-style) | ||
| 742 | (dolist (style-list org-freemind-node-style) | ||
| 743 | (let ((node-regexp (car style-list))) | ||
| 744 | (message "node-regexp=%s node-name=%s" node-regexp node-name) | ||
| 745 | (when (string-match-p node-regexp node-name) | ||
| 746 | ;;(setq node-style (org-freemind-do-apply-node-style style-list)) | ||
| 747 | (setq node-style (cadr style-list)) | ||
| 748 | (when node-style | ||
| 749 | (message "node-style=%s" node-style) | ||
| 750 | (setq node-styles (append node-styles node-style))) | ||
| 751 | ))))) | ||
| 752 | |||
| 753 | (defun org-freemind-do-apply-node-style (style-list) | ||
| 754 | (message "style-list=%S" style-list) | ||
| 755 | (let ((node-style 'fork) | ||
| 756 | (color "red") | ||
| 757 | (background-color "yellow") | ||
| 758 | (edge-color "green") | ||
| 759 | (edge-style 'bezier) | ||
| 760 | (edge-width 'thin) | ||
| 761 | (italic t) | ||
| 762 | (bold t) | ||
| 763 | (font-name "SansSerif") | ||
| 764 | (font-size 12)) | ||
| 765 | (dolist (style (cadr style-list)) | ||
| 766 | (message " style=%s" style) | ||
| 767 | (let ((what (car style))) | ||
| 768 | (cond | ||
| 769 | ((eq what 'node-style) | ||
| 770 | (setq node-style (cadr style))) | ||
| 771 | ((eq what 'color) | ||
| 772 | (setq color (cadr style))) | ||
| 773 | ((eq what 'background-color) | ||
| 774 | (setq background-color (cadr style))) | ||
| 775 | |||
| 776 | ((eq what 'edge-color) | ||
| 777 | (setq edge-color (cadr style))) | ||
| 778 | |||
| 779 | ((eq what 'edge-style) | ||
| 780 | (setq edge-style (cadr style))) | ||
| 781 | |||
| 782 | ((eq what 'edge-width) | ||
| 783 | (setq edge-width (cadr style))) | ||
| 784 | |||
| 785 | ((eq what 'italic) | ||
| 786 | (setq italic (cadr style))) | ||
| 787 | |||
| 788 | ((eq what 'bold) | ||
| 789 | (setq bold (cadr style))) | ||
| 790 | |||
| 791 | ((eq what 'font-name) | ||
| 792 | (setq font-name (cadr style))) | ||
| 793 | |||
| 794 | ((eq what 'font-size) | ||
| 795 | (setq font-size (cadr style))) | ||
| 796 | ) | ||
| 797 | (insert (format " style=\"%s\"" node-style)) | ||
| 798 | (insert (format " color=\"%s\"" color)) | ||
| 799 | (insert (format " background_color=\"%s\"" background-color)) | ||
| 800 | (insert ">\n") | ||
| 801 | (insert "<edge") | ||
| 802 | (insert (format " color=\"%s\"" edge-color)) | ||
| 803 | (insert (format " style=\"%s\"" edge-style)) | ||
| 804 | (insert (format " width=\"%s\"" edge-width)) | ||
| 805 | (insert "/>\n") | ||
| 806 | (insert "<font") | ||
| 807 | (insert (format " italic=\"%s\"" italic)) | ||
| 808 | (insert (format " bold=\"%s\"" bold)) | ||
| 809 | (insert (format " name=\"%s\"" font-name)) | ||
| 810 | (insert (format " size=\"%s\"" font-size)) | ||
| 811 | )))) | ||
| 812 | |||
| 813 | ;;;###autoload | ||
| 814 | (defun org-freemind-from-org-mode-node (node-line mm-file) | ||
| 815 | "Convert node at line NODE-LINE to the FreeMind file MM-FILE." | ||
| 816 | (interactive | ||
| 817 | (progn | ||
| 818 | (unless (org-back-to-heading nil) | ||
| 819 | (error "Can't find org-mode node start")) | ||
| 820 | (let* ((line (line-number-at-pos)) | ||
| 821 | (default-mm-file (concat (if buffer-file-name | ||
| 822 | (file-name-nondirectory buffer-file-name) | ||
| 823 | "nofile") | ||
| 824 | "-line-" (number-to-string line) | ||
| 825 | ".mm")) | ||
| 826 | (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file))) | ||
| 827 | (list line mm-file)))) | ||
| 828 | (when (org-freemind-check-overwrite mm-file (called-interactively-p)) | ||
| 829 | (let ((org-buffer (current-buffer)) | ||
| 830 | (mm-buffer (find-file-noselect mm-file))) | ||
| 831 | (org-freemind-write-mm-buffer org-buffer mm-buffer node-line) | ||
| 832 | (with-current-buffer mm-buffer | ||
| 833 | (basic-save-buffer) | ||
| 834 | (when (called-interactively-p) | ||
| 835 | (switch-to-buffer-other-window mm-buffer) | ||
| 836 | (when (y-or-n-p "Show in FreeMind? ") | ||
| 837 | (org-freemind-show buffer-file-name))))))) | ||
| 838 | |||
| 839 | ;;;###autoload | ||
| 840 | (defun org-freemind-from-org-mode (org-file mm-file) | ||
| 841 | "Convert the `org-mode' file ORG-FILE to the FreeMind file MM-FILE." | ||
| 842 | ;; Fix-me: better doc, include recommendations etc. | ||
| 843 | (interactive | ||
| 844 | (let* ((org-file buffer-file-name) | ||
| 845 | (default-mm-file (concat | ||
| 846 | (if org-file | ||
| 847 | (file-name-nondirectory org-file) | ||
| 848 | "nofile") | ||
| 849 | ".mm")) | ||
| 850 | (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file))) | ||
| 851 | (list org-file mm-file))) | ||
| 852 | (when (org-freemind-check-overwrite mm-file (called-interactively-p)) | ||
| 853 | (let ((org-buffer (if org-file (find-file-noselect org-file) (current-buffer))) | ||
| 854 | (mm-buffer (find-file-noselect mm-file))) | ||
| 855 | (org-freemind-write-mm-buffer org-buffer mm-buffer nil) | ||
| 856 | (with-current-buffer mm-buffer | ||
| 857 | (basic-save-buffer) | ||
| 858 | (when (called-interactively-p) | ||
| 859 | (switch-to-buffer-other-window mm-buffer) | ||
| 860 | (when (y-or-n-p "Show in FreeMind? ") | ||
| 861 | (org-freemind-show buffer-file-name))))))) | ||
| 862 | |||
| 863 | ;;;###autoload | ||
| 864 | (defun org-freemind-from-org-sparse-tree (org-buffer mm-file) | ||
| 865 | "Convert visible part of buffer ORG-BUFFER to FreeMind file MM-FILE." | ||
| 866 | (interactive | ||
| 867 | (let* ((org-file buffer-file-name) | ||
| 868 | (default-mm-file (concat | ||
| 869 | (if org-file | ||
| 870 | (file-name-nondirectory org-file) | ||
| 871 | "nofile") | ||
| 872 | "-sparse.mm")) | ||
| 873 | (mm-file (read-file-name "Output FreeMind file: " nil nil nil default-mm-file))) | ||
| 874 | (list (current-buffer) mm-file))) | ||
| 875 | (when (org-freemind-check-overwrite mm-file (called-interactively-p)) | ||
| 876 | (let (org-buffer | ||
| 877 | (mm-buffer (find-file-noselect mm-file))) | ||
| 878 | (save-window-excursion | ||
| 879 | (org-export-visible ?\ nil) | ||
| 880 | (setq org-buffer (current-buffer))) | ||
| 881 | (org-freemind-write-mm-buffer org-buffer mm-buffer nil) | ||
| 882 | (with-current-buffer mm-buffer | ||
| 883 | (basic-save-buffer) | ||
| 884 | (when (called-interactively-p) | ||
| 885 | (switch-to-buffer-other-window mm-buffer) | ||
| 886 | (when (y-or-n-p "Show in FreeMind? ") | ||
| 887 | (org-freemind-show buffer-file-name))))))) | ||
| 888 | |||
| 889 | |||
| 890 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 891 | ;;; FreeMind => Org | ||
| 892 | |||
| 893 | ;; (sort '(b a c) 'org-freemind-lt-symbols) | ||
| 894 | (defun org-freemind-lt-symbols (sym-a sym-b) | ||
| 895 | (string< (symbol-name sym-a) (symbol-name sym-b))) | ||
| 896 | ;; (sort '((b . 1) (a . 2) (c . 3)) 'org-freemind-lt-xml-attrs) | ||
| 897 | (defun org-freemind-lt-xml-attrs (attr-a attr-b) | ||
| 898 | (string< (symbol-name (car attr-a)) (symbol-name (car attr-b)))) | ||
| 899 | |||
| 900 | ;; xml-parse-region gives things like | ||
| 901 | ;; ((p nil "\n" | ||
| 902 | ;; (a | ||
| 903 | ;; ((href . "link")) | ||
| 904 | ;; "text") | ||
| 905 | ;; "\n" | ||
| 906 | ;; (b nil "hej") | ||
| 907 | ;; "\n")) | ||
| 908 | |||
| 909 | ;; '(a . nil) | ||
| 910 | |||
| 911 | ;; (org-freemind-symbols= 'a (car '(A B))) | ||
| 912 | (defsubst org-freemind-symbols= (sym-a sym-b) | ||
| 913 | "Return t if downcased names of SYM-A and SYM-B are equal. | ||
| 914 | SYM-A and SYM-B should be symbols." | ||
| 915 | (or (eq sym-a sym-b) | ||
| 916 | (string= (downcase (symbol-name sym-a)) | ||
| 917 | (downcase (symbol-name sym-b))))) | ||
| 918 | |||
| 919 | (defun org-freemind-get-children (parent path) | ||
| 920 | "Find children node to PARENT from PATH. | ||
| 921 | PATH should be a list of steps, where each step has the form | ||
| 922 | |||
| 923 | '(NODE-NAME (ATTR-NAME . ATTR-VALUE))" | ||
| 924 | ;; Fix-me: maybe implement op? step: Name, number, attr, attr op val | ||
| 925 | ;; Fix-me: case insensitive version for children? | ||
| 926 | (let* ((children (if (not (listp (car parent))) | ||
| 927 | (cddr parent) | ||
| 928 | (let (cs) | ||
| 929 | (dolist (p parent) | ||
| 930 | (dolist (c (cddr p)) | ||
| 931 | (add-to-list 'cs c))) | ||
| 932 | cs) | ||
| 933 | )) | ||
| 934 | (step (car path)) | ||
| 935 | (step-node (if (listp step) (car step) step)) | ||
| 936 | (step-attr-list (when (listp step) (sort (cdr step) 'org-freemind-lt-xml-attrs))) | ||
| 937 | (path-tail (cdr path)) | ||
| 938 | path-children) | ||
| 939 | (dolist (child children) | ||
| 940 | ;; skip xml.el formatting nodes | ||
| 941 | (unless (stringp child) | ||
| 942 | ;; compare node name | ||
| 943 | (when (if (not step-node) | ||
| 944 | t ;; any node name | ||
| 945 | (org-freemind-symbols= step-node (car child))) | ||
| 946 | (if (not step-attr-list) | ||
| 947 | ;;(throw 'path-child child) ;; no attr to care about | ||
| 948 | (add-to-list 'path-children child) | ||
| 949 | (let* ((child-attr-list (cadr child)) | ||
| 950 | (step-attr-copy (copy-sequence step-attr-list))) | ||
| 951 | (dolist (child-attr child-attr-list) | ||
| 952 | ;; Compare attr names: | ||
| 953 | (when (org-freemind-symbols= (caar step-attr-copy) (car child-attr)) | ||
| 954 | ;; Compare values: | ||
| 955 | (let ((step-val (cdar step-attr-copy)) | ||
| 956 | (child-val (cdr child-attr))) | ||
| 957 | (when (if (not step-val) | ||
| 958 | t ;; any value | ||
| 959 | (string= step-val child-val)) | ||
| 960 | (setq step-attr-copy (cdr step-attr-copy)))))) | ||
| 961 | ;; Did we find all? | ||
| 962 | (unless step-attr-copy | ||
| 963 | ;;(throw 'path-child child) | ||
| 964 | (add-to-list 'path-children child) | ||
| 965 | )))))) | ||
| 966 | (if path-tail | ||
| 967 | (org-freemind-get-children path-children path-tail) | ||
| 968 | path-children))) | ||
| 969 | |||
| 970 | (defun org-freemind-get-richcontent-node (node) | ||
| 971 | (let ((rc-nodes | ||
| 972 | (org-freemind-get-children node '((richcontent (type . "NODE")) html body)))) | ||
| 973 | (when (> (length rc-nodes) 1) | ||
| 974 | (lwarn t :warning "Unexpected structure: several <richcontent type=\"NODE\" ...>")) | ||
| 975 | (car rc-nodes))) | ||
| 976 | |||
| 977 | (defun org-freemind-get-richcontent-note (node) | ||
| 978 | (let ((rc-notes | ||
| 979 | (org-freemind-get-children node '((richcontent (type . "NOTE")) html body)))) | ||
| 980 | (when (> (length rc-notes) 1) | ||
| 981 | (lwarn t :warning "Unexpected structure: several <richcontent type=\"NOTE\" ...>")) | ||
| 982 | (car rc-notes))) | ||
| 983 | |||
| 984 | (defun org-freemind-test-get-tree-text () | ||
| 985 | (let ((node '(p nil "\n" | ||
| 986 | (a | ||
| 987 | ((href . "link")) | ||
| 988 | "text") | ||
| 989 | "\n" | ||
| 990 | (b nil "hej") | ||
| 991 | "\n"))) | ||
| 992 | (org-freemind-get-tree-text node))) | ||
| 993 | ;; (org-freemind-test-get-tree-text) | ||
| 994 | |||
| 995 | (defun org-freemind-get-tree-text (node) | ||
| 996 | (when node | ||
| 997 | (let ((ntxt "") | ||
| 998 | (link nil) | ||
| 999 | (lf-after nil)) | ||
| 1000 | (dolist (n node) | ||
| 1001 | (case n | ||
| 1002 | ;;(a (setq is-link t) ) | ||
| 1003 | ((h1 h2 h3 h4 h5 h6 p) | ||
| 1004 | ;;(setq ntxt (concat "\n" ntxt)) | ||
| 1005 | (setq lf-after 2) | ||
| 1006 | ) | ||
| 1007 | (br | ||
| 1008 | (setq lf-after 1) | ||
| 1009 | ) | ||
| 1010 | (t | ||
| 1011 | (cond | ||
| 1012 | ((stringp n) | ||
| 1013 | (when (string= n "\n") (setq n "")) | ||
| 1014 | (if link | ||
| 1015 | (setq ntxt (concat ntxt | ||
| 1016 | "[[" link "][" n "]]")) | ||
| 1017 | (setq ntxt (concat ntxt n)))) | ||
| 1018 | ((and n (listp n)) | ||
| 1019 | (if (symbolp (car n)) | ||
| 1020 | (setq ntxt (concat ntxt (org-freemind-get-tree-text n))) | ||
| 1021 | ;; This should be the attributes: | ||
| 1022 | (dolist (att-val n) | ||
| 1023 | (let ((att (car att-val)) | ||
| 1024 | (val (cdr att-val))) | ||
| 1025 | (when (eq att 'href) | ||
| 1026 | (setq link val))))) | ||
| 1027 | ))))) | ||
| 1028 | (if lf-after | ||
| 1029 | (setq ntxt (concat ntxt (make-string lf-after ?\n))) | ||
| 1030 | (setq ntxt (concat ntxt " "))) | ||
| 1031 | ;;(setq ntxt (concat ntxt (format "{%s}" n))) | ||
| 1032 | ntxt))) | ||
| 1033 | |||
| 1034 | (defun org-freemind-get-richcontent-node-text (node) | ||
| 1035 | "Get the node text as from the richcontent node NODE." | ||
| 1036 | (save-match-data | ||
| 1037 | (let* ((rc (org-freemind-get-richcontent-node node)) | ||
| 1038 | (txt (org-freemind-get-tree-text rc))) | ||
| 1039 | ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt))) | ||
| 1040 | txt | ||
| 1041 | ))) | ||
| 1042 | |||
| 1043 | (defun org-freemind-get-richcontent-note-text (node) | ||
| 1044 | "Get the node text as from the richcontent note NODE." | ||
| 1045 | (save-match-data | ||
| 1046 | (let* ((rc (org-freemind-get-richcontent-note node)) | ||
| 1047 | (txt (when rc (org-freemind-get-tree-text rc)))) | ||
| 1048 | ;;(when txt (setq txt (replace-regexp-in-string (rx (1+ whitespace)) " " txt))) | ||
| 1049 | txt | ||
| 1050 | ))) | ||
| 1051 | |||
| 1052 | (defun org-freemind-get-icon-names (node) | ||
| 1053 | (let* ((icon-nodes (org-freemind-get-children node '((icon )))) | ||
| 1054 | names) | ||
| 1055 | (dolist (icn icon-nodes) | ||
| 1056 | (setq names (cons (cdr (assq 'builtin (cadr icn))) names))) | ||
| 1057 | ;; (icon (builtin . "full-1")) | ||
| 1058 | names)) | ||
| 1059 | |||
| 1060 | (defun org-freemind-node-to-org (node level skip-levels) | ||
| 1061 | (let ((qname (car node)) | ||
| 1062 | (attributes (cadr node)) | ||
| 1063 | text | ||
| 1064 | (note (org-freemind-get-richcontent-note-text node)) | ||
| 1065 | (mark "-- This is more about ") | ||
| 1066 | (icons (org-freemind-get-icon-names node)) | ||
| 1067 | (children (cddr node))) | ||
| 1068 | (when (< 0 (- level skip-levels)) | ||
| 1069 | (dolist (attrib attributes) | ||
| 1070 | (case (car attrib) | ||
| 1071 | ('TEXT (setq text (cdr attrib))) | ||
| 1072 | ('text (setq text (cdr attrib))))) | ||
| 1073 | (unless text | ||
| 1074 | ;; There should be a richcontent node holding the text: | ||
| 1075 | (setq text (org-freemind-get-richcontent-node-text node))) | ||
| 1076 | (when icons | ||
| 1077 | (when (member "full-1" icons) (setq text (concat "[#A] " text))) | ||
| 1078 | (when (member "full-2" icons) (setq text (concat "[#B] " text))) | ||
| 1079 | (when (member "full-3" icons) (setq text (concat "[#C] " text))) | ||
| 1080 | (when (member "full-4" icons) (setq text (concat "[#D] " text))) | ||
| 1081 | (when (member "full-5" icons) (setq text (concat "[#E] " text))) | ||
| 1082 | (when (member "full-6" icons) (setq text (concat "[#F] " text))) | ||
| 1083 | (when (member "full-7" icons) (setq text (concat "[#G] " text))) | ||
| 1084 | (when (member "button_cancel" icons) (setq text (concat "TODO " text))) | ||
| 1085 | ) | ||
| 1086 | (if (and note | ||
| 1087 | (string= mark (substring note 0 (length mark)))) | ||
| 1088 | (progn | ||
| 1089 | (setq text (replace-regexp-in-string "\n $" "" text)) | ||
| 1090 | (insert text)) | ||
| 1091 | (case qname | ||
| 1092 | ('node | ||
| 1093 | (insert (make-string (- level skip-levels) ?*) " " text "\n") | ||
| 1094 | )))) | ||
| 1095 | (dolist (child children) | ||
| 1096 | (unless (or (null child) | ||
| 1097 | (stringp child)) | ||
| 1098 | (org-freemind-node-to-org child (1+ level) skip-levels))))) | ||
| 1099 | |||
| 1100 | ;; Fix-me: put back special things, like drawers that are stored in | ||
| 1101 | ;; the notes. Should maybe all notes contents be put in drawers? | ||
| 1102 | ;;;###autoload | ||
| 1103 | (defun org-freemind-to-org-mode (mm-file org-file) | ||
| 1104 | "Convert FreeMind file MM-FILE to `org-mode' file ORG-FILE." | ||
| 1105 | (interactive | ||
| 1106 | (save-match-data | ||
| 1107 | (let* ((mm-file (buffer-file-name)) | ||
| 1108 | (default-org-file (concat (file-name-nondirectory mm-file) ".org")) | ||
| 1109 | (org-file (read-file-name "Output org-mode file: " nil nil nil default-org-file))) | ||
| 1110 | (list mm-file org-file)))) | ||
| 1111 | (when (org-freemind-check-overwrite org-file (called-interactively-p)) | ||
| 1112 | (let ((mm-buffer (find-file-noselect mm-file)) | ||
| 1113 | (org-buffer (find-file-noselect org-file))) | ||
| 1114 | (with-current-buffer mm-buffer | ||
| 1115 | (let* ((xml-list (xml-parse-file mm-file)) | ||
| 1116 | (top-node (cadr (cddar xml-list))) | ||
| 1117 | (note (org-freemind-get-richcontent-note-text top-node)) | ||
| 1118 | (skip-levels | ||
| 1119 | (if (and note | ||
| 1120 | (string-match (rx bol "--org-mode: WHOLE FILE" eol) note)) | ||
| 1121 | 1 | ||
| 1122 | 0))) | ||
| 1123 | (with-current-buffer org-buffer | ||
| 1124 | (erase-buffer) | ||
| 1125 | (org-freemind-node-to-org top-node 1 skip-levels) | ||
| 1126 | (goto-char (point-min)) | ||
| 1127 | (org-set-tags t t) ;; Align all tags | ||
| 1128 | ) | ||
| 1129 | (switch-to-buffer-other-window org-buffer) | ||
| 1130 | ))))) | ||
| 1131 | |||
| 1132 | (provide 'org-freemind) | ||
| 1133 | |||
| 1134 | ;; arch-tag: e7b0d776-94fd-404a-b35e-0f855fae3627 | ||
| 1135 | |||
| 1136 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1137 | ;;; org-freemind.el ends here | ||
diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index 027787c0bfa..c6b9b448edb 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Tassilo Horn <tassilo at member dot fsf dot org> | 7 | ;; Tassilo Horn <tassilo at member dot fsf dot org> |
| 8 | ;; Keywords: outlines, hypermedia, calendar, wp | 8 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 9 | ;; Homepage: http://orgmode.org | 9 | ;; Homepage: http://orgmode.org |
| 10 | ;; Version: 6.31a | 10 | ;; Version: 6.33 |
| 11 | ;; | 11 | ;; |
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | ;; | 13 | ;; |
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el new file mode 100644 index 00000000000..c2f14894d5d --- /dev/null +++ b/lisp/org/org-habit.el | |||
| @@ -0,0 +1,343 @@ | |||
| 1 | ;;; org-habit.el --- The habit tracking code for Org-mode | ||
| 2 | |||
| 3 | ;; Copyright (C) 2009 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: John Wiegley <johnw at gnu dot org> | ||
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | ||
| 7 | ;; Homepage: http://orgmode.org | ||
| 8 | ;; Version: 6.33 | ||
| 9 | ;; | ||
| 10 | ;; This file is part of GNU Emacs. | ||
| 11 | ;; | ||
| 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 13 | ;; it under the terms of the GNU General Public License as published by | ||
| 14 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 15 | ;; (at your option) any later version. | ||
| 16 | |||
| 17 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | ;; GNU General Public License for more details. | ||
| 21 | |||
| 22 | ;; You should have received a copy of the GNU General Public License | ||
| 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 25 | ;; | ||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;; This file contains the habit tracking code for Org-mode | ||
| 29 | |||
| 30 | (require 'org) | ||
| 31 | (require 'org-agenda) | ||
| 32 | (eval-when-compile | ||
| 33 | (require 'cl) | ||
| 34 | (require 'calendar)) | ||
| 35 | |||
| 36 | (defgroup org-habit nil | ||
| 37 | "Options concerning habit tracking in Org-mode." | ||
| 38 | :tag "Org Habit" | ||
| 39 | :group 'org-progress) | ||
| 40 | |||
| 41 | (defcustom org-habit-graph-column 40 | ||
| 42 | "The absolute column at which to insert habit consistency graphs. | ||
| 43 | Note that consistency graphs will overwrite anything else in the buffer." | ||
| 44 | :group 'org-habit | ||
| 45 | :type 'integer) | ||
| 46 | |||
| 47 | (defcustom org-habit-preceding-days 21 | ||
| 48 | "Number of days before today to appear in consistency graphs." | ||
| 49 | :group 'org-habit | ||
| 50 | :type 'integer) | ||
| 51 | |||
| 52 | (defcustom org-habit-following-days 7 | ||
| 53 | "Number of days after today to appear in consistency graphs." | ||
| 54 | :group 'org-habit | ||
| 55 | :type 'integer) | ||
| 56 | |||
| 57 | (defcustom org-habit-show-habits t | ||
| 58 | "If non-nil, show habits in agenda buffers." | ||
| 59 | :group 'org-habit | ||
| 60 | :type 'boolean) | ||
| 61 | |||
| 62 | (defcustom org-habit-show-habits-only-for-today t | ||
| 63 | "If non-nil, only show habits on today's agenda, and not for future days. | ||
| 64 | Note that even when shown for future days, the graph is always | ||
| 65 | relative to the current effective date." | ||
| 66 | :group 'org-habit | ||
| 67 | :type 'boolean) | ||
| 68 | |||
| 69 | (defface org-habit-clear-face | ||
| 70 | '((((background light)) (:background "slateblue")) | ||
| 71 | (((background dark)) (:background "blue"))) | ||
| 72 | "Face for days on which a task shouldn't be done yet." | ||
| 73 | :group 'org-habit | ||
| 74 | :group 'org-faces) | ||
| 75 | (defface org-habit-clear-future-face | ||
| 76 | '((((background light)) (:background "powderblue")) | ||
| 77 | (((background dark)) (:background "midnightblue"))) | ||
| 78 | "Face for future days on which a task shouldn't be done yet." | ||
| 79 | :group 'org-habit | ||
| 80 | :group 'org-faces) | ||
| 81 | |||
| 82 | (defface org-habit-ready-face | ||
| 83 | '((((background light)) (:background "green")) | ||
| 84 | (((background dark)) (:background "forestgreen"))) | ||
| 85 | "Face for days on which a task should start to be done." | ||
| 86 | :group 'org-habit | ||
| 87 | :group 'org-faces) | ||
| 88 | (defface org-habit-ready-future-face | ||
| 89 | '((((background light)) (:background "palegreen")) | ||
| 90 | (((background dark)) (:background "darkgreen"))) | ||
| 91 | "Face for days on which a task should start to be done." | ||
| 92 | :group 'org-habit | ||
| 93 | :group 'org-faces) | ||
| 94 | |||
| 95 | (defface org-habit-alert-face | ||
| 96 | '((((background light)) (:background "yellow")) | ||
| 97 | (((background dark)) (:background "gold"))) | ||
| 98 | "Face for days on which a task is due." | ||
| 99 | :group 'org-habit | ||
| 100 | :group 'org-faces) | ||
| 101 | (defface org-habit-alert-future-face | ||
| 102 | '((((background light)) (:background "palegoldenrod")) | ||
| 103 | (((background dark)) (:background "darkgoldenrod"))) | ||
| 104 | "Face for days on which a task is due." | ||
| 105 | :group 'org-habit | ||
| 106 | :group 'org-faces) | ||
| 107 | |||
| 108 | (defface org-habit-overdue-face | ||
| 109 | '((((background light)) (:background "red")) | ||
| 110 | (((background dark)) (:background "firebrick"))) | ||
| 111 | "Face for days on which a task is overdue." | ||
| 112 | :group 'org-habit | ||
| 113 | :group 'org-faces) | ||
| 114 | (defface org-habit-overdue-future-face | ||
| 115 | '((((background light)) (:background "mistyrose")) | ||
| 116 | (((background dark)) (:background "darkred"))) | ||
| 117 | "Face for days on which a task is overdue." | ||
| 118 | :group 'org-habit | ||
| 119 | :group 'org-faces) | ||
| 120 | |||
| 121 | (defun org-habit-duration-to-days (ts) | ||
| 122 | (if (string-match "\\([0-9]+\\)\\([dwmy]\\)" ts) | ||
| 123 | ;; lead time is specified. | ||
| 124 | (floor (* (string-to-number (match-string 1 ts)) | ||
| 125 | (cdr (assoc (match-string 2 ts) | ||
| 126 | '(("d" . 1) ("w" . 7) | ||
| 127 | ("m" . 30.4) ("y" . 365.25)))))) | ||
| 128 | (error "Invalid duration string: %s" ts))) | ||
| 129 | |||
| 130 | (defun org-is-habit-p (&optional pom) | ||
| 131 | (string= "habit" (org-entry-get (or pom (point)) "STYLE"))) | ||
| 132 | |||
| 133 | (defun org-habit-parse-todo (&optional pom) | ||
| 134 | "Parse the TODO surrounding point for its habit-related data. | ||
| 135 | Returns a list with the following elements: | ||
| 136 | |||
| 137 | 0: Scheduled date for the habit (may be in the past) | ||
| 138 | 1: \".+\"-style repeater for the schedule, in days | ||
| 139 | 2: Optional deadline (nil if not present) | ||
| 140 | 3: If deadline, the repeater for the deadline, otherwise nil | ||
| 141 | 4: A list of all the past dates this todo was mark closed | ||
| 142 | |||
| 143 | This list represents a \"habit\" for the rest of this module." | ||
| 144 | (save-excursion | ||
| 145 | (if pom (goto-char pom)) | ||
| 146 | (assert (org-is-habit-p (point))) | ||
| 147 | (let* ((scheduled (org-get-scheduled-time (point))) | ||
| 148 | (scheduled-repeat (org-get-repeat org-scheduled-string)) | ||
| 149 | (sr-days (org-habit-duration-to-days scheduled-repeat)) | ||
| 150 | (end (org-entry-end-position)) | ||
| 151 | (habit-entry (org-no-properties (nth 5 (org-heading-components)))) | ||
| 152 | closed-dates deadline dr-days) | ||
| 153 | (if scheduled | ||
| 154 | (setq scheduled (time-to-days scheduled)) | ||
| 155 | (error "Habit %s has no scheduled date" habit-entry)) | ||
| 156 | (unless scheduled-repeat | ||
| 157 | (error "Habit %s has no scheduled repeat period" habit-entry)) | ||
| 158 | (unless (> sr-days 0) | ||
| 159 | (error "Habit %s scheduled repeat period is less than 1d" habit-entry)) | ||
| 160 | (when (string-match "/\\([0-9]+[dwmy]\\)" scheduled-repeat) | ||
| 161 | (setq dr-days (org-habit-duration-to-days | ||
| 162 | (match-string-no-properties 1 scheduled-repeat))) | ||
| 163 | (if (<= dr-days sr-days) | ||
| 164 | (error "Habit %s deadline repeat period is less than or equal to scheduled (%s)" | ||
| 165 | habit-entry scheduled-repeat)) | ||
| 166 | (setq deadline (+ scheduled (- dr-days sr-days)))) | ||
| 167 | (org-back-to-heading t) | ||
| 168 | (while (re-search-forward "- State \"DONE\".*\\[\\([^]]+\\)\\]" end t) | ||
| 169 | (push (time-to-days | ||
| 170 | (org-time-string-to-time (match-string-no-properties 1))) | ||
| 171 | closed-dates)) | ||
| 172 | (list scheduled sr-days deadline dr-days closed-dates)))) | ||
| 173 | |||
| 174 | (defsubst org-habit-scheduled (habit) | ||
| 175 | (nth 0 habit)) | ||
| 176 | (defsubst org-habit-scheduled-repeat (habit) | ||
| 177 | (nth 1 habit)) | ||
| 178 | (defsubst org-habit-deadline (habit) | ||
| 179 | (let ((deadline (nth 2 habit))) | ||
| 180 | (or deadline | ||
| 181 | (+ (org-habit-scheduled habit) | ||
| 182 | (1- (org-habit-scheduled-repeat habit)))))) | ||
| 183 | (defsubst org-habit-deadline-repeat (habit) | ||
| 184 | (or (nth 3 habit) | ||
| 185 | (org-habit-scheduled-repeat habit))) | ||
| 186 | (defsubst org-habit-done-dates (habit) | ||
| 187 | (nth 4 habit)) | ||
| 188 | |||
| 189 | (defsubst org-habit-get-priority (habit &optional moment) | ||
| 190 | "Determine the relative priority of a habit. | ||
| 191 | This must take into account not just urgency, but consistency as well." | ||
| 192 | (let ((pri 1000) | ||
| 193 | (now (time-to-days | ||
| 194 | (or moment | ||
| 195 | (time-subtract (current-time) | ||
| 196 | (list 0 (* 3600 org-extend-today-until) 0))))) | ||
| 197 | (scheduled (org-habit-scheduled habit)) | ||
| 198 | (deadline (org-habit-deadline habit))) | ||
| 199 | ;; add 10 for every day past the scheduled date, and subtract for every | ||
| 200 | ;; day before it | ||
| 201 | (setq pri (+ pri (* (- now scheduled) 10))) | ||
| 202 | ;; add 50 if the deadline is today | ||
| 203 | (if (and (/= scheduled deadline) | ||
| 204 | (= now deadline)) | ||
| 205 | (setq pri (+ pri 50))) | ||
| 206 | ;; add 100 for every day beyond the deadline date, and subtract 10 for | ||
| 207 | ;; every day before it | ||
| 208 | (let ((slip (- now (1- deadline)))) | ||
| 209 | (if (> slip 0) | ||
| 210 | (setq pri (+ pri (* slip 100))) | ||
| 211 | (setq pri (+ pri (* slip 10))))) | ||
| 212 | pri)) | ||
| 213 | |||
| 214 | (defun org-habit-get-faces (habit &optional now-days scheduled-days donep) | ||
| 215 | "Return faces for HABIT relative to NOW-DAYS and SCHEDULED-DAYS. | ||
| 216 | NOW-DAYS defaults to the current time's days-past-the-epoch if nil. | ||
| 217 | SCHEDULED-DAYS defaults to the habit's actual scheduled days if nil. | ||
| 218 | |||
| 219 | Habits are assigned colors on the following basis: | ||
| 220 | Blue Task is before the scheduled date. | ||
| 221 | Green Task is on or after scheduled date, but before the | ||
| 222 | end of the schedule's repeat period. | ||
| 223 | Yellow If the task has a deadline, then it is after schedule's | ||
| 224 | repeat period, but before the deadline. | ||
| 225 | Orange The task has reached the deadline day, or if there is | ||
| 226 | no deadline, the end of the schedule's repeat period. | ||
| 227 | Red The task has gone beyond the deadline day or the | ||
| 228 | schedule's repeat period." | ||
| 229 | (let* ((scheduled (or scheduled-days (org-habit-scheduled habit))) | ||
| 230 | (s-repeat (org-habit-scheduled-repeat habit)) | ||
| 231 | (scheduled-end (+ scheduled (1- s-repeat))) | ||
| 232 | (d-repeat (org-habit-deadline-repeat habit)) | ||
| 233 | (deadline (if scheduled-days | ||
| 234 | (+ scheduled-days (- d-repeat s-repeat)) | ||
| 235 | (org-habit-deadline habit))) | ||
| 236 | (m-days (or now-days (time-to-days (current-time))))) | ||
| 237 | (cond | ||
| 238 | ((< m-days scheduled) | ||
| 239 | '(org-habit-clear-face . org-habit-clear-future-face)) | ||
| 240 | ((< m-days deadline) | ||
| 241 | '(org-habit-ready-face . org-habit-ready-future-face)) | ||
| 242 | ((= m-days deadline) | ||
| 243 | (if donep | ||
| 244 | '(org-habit-ready-face . org-habit-ready-future-face) | ||
| 245 | '(org-habit-alert-face . org-habit-alert-future-face))) | ||
| 246 | (t | ||
| 247 | '(org-habit-overdue-face . org-habit-overdue-future-face))))) | ||
| 248 | |||
| 249 | (defun org-habit-build-graph (habit starting current ending) | ||
| 250 | "Build a graph for the given HABIT, from STARTING to ENDING. | ||
| 251 | CURRENT gives the current time between STARTING and ENDING, for | ||
| 252 | the purpose of drawing the graph. It need not be the actual | ||
| 253 | current time." | ||
| 254 | (let* ((done-dates (sort (org-habit-done-dates habit) '<)) | ||
| 255 | (scheduled (org-habit-scheduled habit)) | ||
| 256 | (s-repeat (org-habit-scheduled-repeat habit)) | ||
| 257 | (start (time-to-days starting)) | ||
| 258 | (now (time-to-days current)) | ||
| 259 | (end (time-to-days ending)) | ||
| 260 | (graph (make-string (1+ (- end start)) ?\ )) | ||
| 261 | (index 0) | ||
| 262 | last-done-date) | ||
| 263 | (while (and done-dates (< (car done-dates) start)) | ||
| 264 | (setq last-done-date (car done-dates) | ||
| 265 | done-dates (cdr done-dates))) | ||
| 266 | (while (< start end) | ||
| 267 | (let* ((in-the-past-p (< start now)) | ||
| 268 | (todayp (= start now)) | ||
| 269 | (donep (and done-dates | ||
| 270 | (= start (car done-dates)))) | ||
| 271 | (faces (if (and in-the-past-p | ||
| 272 | (not last-done-date) | ||
| 273 | (not (< scheduled now))) | ||
| 274 | '(org-habit-clear-face . org-habit-clear-future-face) | ||
| 275 | (org-habit-get-faces | ||
| 276 | habit start (and in-the-past-p | ||
| 277 | (if last-done-date | ||
| 278 | (+ last-done-date s-repeat) | ||
| 279 | scheduled)) | ||
| 280 | donep))) | ||
| 281 | markedp face) | ||
| 282 | (if donep | ||
| 283 | (progn | ||
| 284 | (aset graph index ?*) | ||
| 285 | (setq markedp t) | ||
| 286 | (while (and done-dates | ||
| 287 | (= start (car done-dates))) | ||
| 288 | (setq last-done-date (car done-dates) | ||
| 289 | done-dates (cdr done-dates)))) | ||
| 290 | (if todayp | ||
| 291 | (aset graph index ?!))) | ||
| 292 | (setq face (if (or in-the-past-p todayp) | ||
| 293 | (car faces) | ||
| 294 | (cdr faces))) | ||
| 295 | (if (and in-the-past-p | ||
| 296 | (not (eq face 'org-habit-overdue-face)) | ||
| 297 | (not markedp)) | ||
| 298 | (setq face (cdr faces))) | ||
| 299 | (put-text-property index (1+ index) 'face face graph)) | ||
| 300 | (setq start (1+ start) | ||
| 301 | index (1+ index))) | ||
| 302 | graph)) | ||
| 303 | |||
| 304 | (defun org-habit-insert-consistency-graphs (&optional line) | ||
| 305 | "Insert consistency graph for any habitual tasks." | ||
| 306 | (let ((inhibit-read-only t) l c | ||
| 307 | (moment (time-subtract (current-time) | ||
| 308 | (list 0 (* 3600 org-extend-today-until) 0)))) | ||
| 309 | (save-excursion | ||
| 310 | (goto-char (if line (point-at-bol) (point-min))) | ||
| 311 | (while (not (eobp)) | ||
| 312 | (let ((habit (get-text-property (point) 'org-habit-p))) | ||
| 313 | (when habit | ||
| 314 | (move-to-column org-habit-graph-column t) | ||
| 315 | (delete-char (min (+ 1 org-habit-preceding-days | ||
| 316 | org-habit-following-days) | ||
| 317 | (- (line-end-position) (point)))) | ||
| 318 | (insert (org-habit-build-graph | ||
| 319 | habit | ||
| 320 | (time-subtract moment | ||
| 321 | (days-to-time org-habit-preceding-days)) | ||
| 322 | moment | ||
| 323 | (time-add moment | ||
| 324 | (days-to-time org-habit-following-days)))))) | ||
| 325 | (forward-line))))) | ||
| 326 | |||
| 327 | (defun org-habit-toggle-habits () | ||
| 328 | "Toggle display of habits in an agenda buffer." | ||
| 329 | (interactive) | ||
| 330 | (org-agenda-check-type t 'agenda) | ||
| 331 | (setq org-habit-show-habits (not org-habit-show-habits)) | ||
| 332 | (org-agenda-redo) | ||
| 333 | (org-agenda-set-mode-name) | ||
| 334 | (message "Habits turned %s" | ||
| 335 | (if org-habit-show-habits "on" "off"))) | ||
| 336 | |||
| 337 | (org-defkey org-agenda-mode-map "K" 'org-habit-toggle-habits) | ||
| 338 | |||
| 339 | (provide 'org-habit) | ||
| 340 | |||
| 341 | ;; arch-tag: 64e070d9-bd09-4917-bd44-44465f5ed348 | ||
| 342 | |||
| 343 | ;;; org-habit.el ends here | ||
diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el index 194da257961..11a692e86c4 100644 --- a/lisp/org/org-html.el +++ b/lisp/org/org-html.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -507,7 +507,7 @@ in a window. A non-interactive call will only return the buffer." | |||
| 507 | (setq buffer "*Org HTML Export*")) | 507 | (setq buffer "*Org HTML Export*")) |
| 508 | (let ((transient-mark-mode t) (zmacs-regions t) | 508 | (let ((transient-mark-mode t) (zmacs-regions t) |
| 509 | ext-plist rtn) | 509 | ext-plist rtn) |
| 510 | (setq ext-plist (plist-put ext-plist :ignore-subree-p t)) | 510 | (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) |
| 511 | (goto-char end) | 511 | (goto-char end) |
| 512 | (set-mark (point)) ;; to activate the region | 512 | (set-mark (point)) ;; to activate the region |
| 513 | (goto-char beg) | 513 | (goto-char beg) |
| @@ -575,7 +575,7 @@ PUB-DIR is set, use this as the publishing directory." | |||
| 575 | (rbeg (and region-p (region-beginning))) | 575 | (rbeg (and region-p (region-beginning))) |
| 576 | (rend (and region-p (region-end))) | 576 | (rend (and region-p (region-end))) |
| 577 | (subtree-p | 577 | (subtree-p |
| 578 | (if (plist-get opt-plist :ignore-subree-p) | 578 | (if (plist-get opt-plist :ignore-subtree-p) |
| 579 | nil | 579 | nil |
| 580 | (when region-p | 580 | (when region-p |
| 581 | (save-excursion | 581 | (save-excursion |
| @@ -972,9 +972,12 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 972 | (setq line (concat line "\\\\"))))) | 972 | (setq line (concat line "\\\\"))))) |
| 973 | 973 | ||
| 974 | ;; make targets to anchors | 974 | ;; make targets to anchors |
| 975 | (setq start 0) | ||
| 975 | (while (string-match | 976 | (while (string-match |
| 976 | "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line) | 977 | "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start) |
| 977 | (cond | 978 | (cond |
| 979 | ((get-text-property (match-beginning 1) 'org-protected line) | ||
| 980 | (setq start (match-end 1))) | ||
| 978 | ((match-end 2) | 981 | ((match-end 2) |
| 979 | (setq line (replace-match | 982 | (setq line (replace-match |
| 980 | (format | 983 | (format |
| @@ -985,16 +988,18 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 985 | ((and org-export-with-toc (equal (string-to-char line) ?*)) | 988 | ((and org-export-with-toc (equal (string-to-char line) ?*)) |
| 986 | ;; FIXME: NOT DEPENDENT on TOC????????????????????? | 989 | ;; FIXME: NOT DEPENDENT on TOC????????????????????? |
| 987 | (setq line (replace-match | 990 | (setq line (replace-match |
| 988 | (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ") | 991 | (concat "@<span class=\"target\">" |
| 989 | ; (concat "@<i>" (match-string 1 line) "@</i> ") | 992 | (match-string 1 line) "@</span> ") |
| 993 | ;; (concat "@<i>" (match-string 1 line) "@</i> ") | ||
| 990 | t t line))) | 994 | t t line))) |
| 991 | (t | 995 | (t |
| 992 | (setq line (replace-match | 996 | (setq line (replace-match |
| 993 | (concat "@<a name=\"" | 997 | (concat "@<a name=\"" |
| 994 | (org-solidify-link-text (match-string 1 line)) | 998 | (org-solidify-link-text (match-string 1 line)) |
| 995 | "\" class=\"target\">" (match-string 1 line) "@</a> ") | 999 | "\" class=\"target\">" (match-string 1 line) |
| 1000 | "@</a> ") | ||
| 996 | t t line))))) | 1001 | t t line))))) |
| 997 | 1002 | ||
| 998 | (setq line (org-html-handle-time-stamps line)) | 1003 | (setq line (org-html-handle-time-stamps line)) |
| 999 | 1004 | ||
| 1000 | ;; replace "&" by "&", "<" and ">" by "<" and ">" | 1005 | ;; replace "&" by "&", "<" and ">" by "<" and ">" |
| @@ -1505,17 +1510,22 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 1505 | (let* ((caption (org-find-text-property-in-string 'org-caption src)) | 1510 | (let* ((caption (org-find-text-property-in-string 'org-caption src)) |
| 1506 | (attr (org-find-text-property-in-string 'org-attributes src)) | 1511 | (attr (org-find-text-property-in-string 'org-attributes src)) |
| 1507 | (label (org-find-text-property-in-string 'org-label src))) | 1512 | (label (org-find-text-property-in-string 'org-label src))) |
| 1508 | (format "%s<div %sclass=\"figure\"> | 1513 | (concat |
| 1509 | <p><img src=\"%s\"%s /></p>%s | 1514 | (if caption |
| 1510 | </div>%s" | 1515 | (format "%s<div %sclass=\"figure\"> |
| 1511 | (if org-par-open "</p>\n" "") | 1516 | <p>" |
| 1512 | (if label (format "id=\"%s\" " label) "") | 1517 | (if org-par-open "</p>\n" "") |
| 1518 | (if label (format "id=\"%s\" " label) ""))) | ||
| 1519 | (format "<img src=\"%s\"%s />" | ||
| 1513 | src | 1520 | src |
| 1514 | (if (string-match "\\<alt=" (or attr "")) | 1521 | (if (string-match "\\<alt=" (or attr "")) |
| 1515 | (concat " " attr ) | 1522 | (concat " " attr ) |
| 1516 | (concat " " attr " alt=\"" src "\"")) | 1523 | (concat " " attr " alt=\"" src "\""))) |
| 1517 | (if caption (concat "\n<p>" caption "</p>") "") | 1524 | (if caption |
| 1518 | (if org-par-open "\n<p>" "")))))) | 1525 | (format "</p>%s |
| 1526 | </div>%s" | ||
| 1527 | (concat "\n<p>" caption "</p>") | ||
| 1528 | (if org-par-open "\n<p>" "")))))))) | ||
| 1519 | 1529 | ||
| 1520 | (defun org-export-html-get-bibliography () | 1530 | (defun org-export-html-get-bibliography () |
| 1521 | "Find bibliography, cut it out and return it." | 1531 | "Find bibliography, cut it out and return it." |
| @@ -1641,7 +1651,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 1641 | (unless splice (push "</table>\n" html)) | 1651 | (unless splice (push "</table>\n" html)) |
| 1642 | (setq html (nreverse html)) | 1652 | (setq html (nreverse html)) |
| 1643 | (unless splice | 1653 | (unless splice |
| 1644 | ;; Put in col tags with the alignment (unfortuntely often ignored...) | 1654 | ;; Put in col tags with the alignment (unfortunately often ignored...) |
| 1645 | (unless (car org-table-colgroup-info) | 1655 | (unless (car org-table-colgroup-info) |
| 1646 | (setq org-table-colgroup-info | 1656 | (setq org-table-colgroup-info |
| 1647 | (cons :start (cdr org-table-colgroup-info)))) | 1657 | (cons :start (cdr org-table-colgroup-info)))) |
diff --git a/lisp/org/org-icalendar.el b/lisp/org/org-icalendar.el index 23e739fe972..4141196cb3b 100644 --- a/lisp/org/org-icalendar.el +++ b/lisp/org/org-icalendar.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -47,6 +47,11 @@ The file name should be absolute, the file will be overwritten without warning." | |||
| 47 | :group 'org-export-icalendar | 47 | :group 'org-export-icalendar |
| 48 | :type 'string) | 48 | :type 'string) |
| 49 | 49 | ||
| 50 | (defcustom org-icalendar-use-plain-timestamp t | ||
| 51 | "Non-nil means, make an event from every plain time stamp." | ||
| 52 | :group 'org-export-icalendar | ||
| 53 | :type 'boolean) | ||
| 54 | |||
| 50 | (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) | 55 | (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) |
| 51 | "Contexts where iCalendar export should use a deadline time stamp. | 56 | "Contexts where iCalendar export should use a deadline time stamp. |
| 52 | This is a list with several symbols in it. Valid symbol are: | 57 | This is a list with several symbols in it. Valid symbol are: |
| @@ -101,9 +106,9 @@ all-tags All tags, including inherited ones." | |||
| 101 | (defcustom org-icalendar-include-todo nil | 106 | (defcustom org-icalendar-include-todo nil |
| 102 | "Non-nil means, export to iCalendar files should also cover TODO items. | 107 | "Non-nil means, export to iCalendar files should also cover TODO items. |
| 103 | Valid values are: | 108 | Valid values are: |
| 104 | nil don't inlcude any TODO items | 109 | nil don't include any TODO items |
| 105 | t include all TODO items that are not in a DONE state | 110 | t include all TODO items that are not in a DONE state |
| 106 | unblocked include all TODO idems that are not blocked | 111 | unblocked include all TODO items that are not blocked |
| 107 | all include both done and not done items." | 112 | all include both done and not done items." |
| 108 | :group 'org-export-icalendar | 113 | :group 'org-export-icalendar |
| 109 | :type '(choice | 114 | :type '(choice |
| @@ -112,6 +117,17 @@ all include both done and not done items." | |||
| 112 | (const :tag "Unblocked" unblocked) | 117 | (const :tag "Unblocked" unblocked) |
| 113 | (const :tag "All" all))) | 118 | (const :tag "All" all))) |
| 114 | 119 | ||
| 120 | (defvar org-icalendar-verify-function nil | ||
| 121 | "Function to verify entries for iCalendar export. | ||
| 122 | This can be set to a function that will be called at each entry that | ||
| 123 | is considered for export to iCalendar. When the function returns nil, | ||
| 124 | the entry will be skipped. When it returns a non-nil value, the entry | ||
| 125 | will be considered for export. | ||
| 126 | This is used internally when an agenda buffer is exported to an ics file, | ||
| 127 | to make sure that only entries currently listed in the agenda will end | ||
| 128 | up in the ics file. But for normal iCalendar export, you can use this | ||
| 129 | for whatever you need.") | ||
| 130 | |||
| 115 | (defcustom org-icalendar-include-bbdb-anniversaries nil | 131 | (defcustom org-icalendar-include-bbdb-anniversaries nil |
| 116 | "Non-nil means, a combined iCalendar files should include anniversaries. | 132 | "Non-nil means, a combined iCalendar files should include anniversaries. |
| 117 | The anniversaries are define in the BBDB database." | 133 | The anniversaries are define in the BBDB database." |
| @@ -264,8 +280,8 @@ When COMBINE is non nil, add the category to each line." | |||
| 264 | (while (re-search-forward re1 nil t) | 280 | (while (re-search-forward re1 nil t) |
| 265 | (catch :skip | 281 | (catch :skip |
| 266 | (org-agenda-skip) | 282 | (org-agenda-skip) |
| 267 | (when (boundp 'org-icalendar-verify-function) | 283 | (when org-icalendar-verify-function |
| 268 | (unless (funcall org-icalendar-verify-function) | 284 | (unless (save-match-data (funcall org-icalendar-verify-function)) |
| 269 | (outline-next-heading) | 285 | (outline-next-heading) |
| 270 | (backward-char 1) | 286 | (backward-char 1) |
| 271 | (throw :skip nil))) | 287 | (throw :skip nil))) |
| @@ -307,6 +323,9 @@ When COMBINE is non nil, add the category to each line." | |||
| 307 | todo (org-get-todo-state) | 323 | todo (org-get-todo-state) |
| 308 | ;; donep (org-entry-is-done-p) | 324 | ;; donep (org-entry-is-done-p) |
| 309 | )) | 325 | )) |
| 326 | (when (and (not org-icalendar-use-plain-timestamp) | ||
| 327 | (not deadlinep) (not scheduledp)) | ||
| 328 | (throw :skip t)) | ||
| 310 | (when (and | 329 | (when (and |
| 311 | deadlinep | 330 | deadlinep |
| 312 | (if todo | 331 | (if todo |
| @@ -368,6 +387,11 @@ END:VEVENT\n" | |||
| 368 | (while (re-search-forward "^&?%%(" nil t) | 387 | (while (re-search-forward "^&?%%(" nil t) |
| 369 | (catch :skip | 388 | (catch :skip |
| 370 | (org-agenda-skip) | 389 | (org-agenda-skip) |
| 390 | (when org-icalendar-verify-function | ||
| 391 | (unless (save-match-data (funcall org-icalendar-verify-function)) | ||
| 392 | (outline-next-heading) | ||
| 393 | (backward-char 1) | ||
| 394 | (throw :skip nil))) | ||
| 371 | (setq b (match-beginning 0)) | 395 | (setq b (match-beginning 0)) |
| 372 | (goto-char (1- (match-end 0))) | 396 | (goto-char (1- (match-end 0))) |
| 373 | (forward-sexp 1) | 397 | (forward-sexp 1) |
| @@ -384,7 +408,7 @@ END:VEVENT\n" | |||
| 384 | (while (re-search-forward org-todo-line-regexp nil t) | 408 | (while (re-search-forward org-todo-line-regexp nil t) |
| 385 | (catch :skip | 409 | (catch :skip |
| 386 | (org-agenda-skip) | 410 | (org-agenda-skip) |
| 387 | (when (boundp 'org-icalendar-verify-function) | 411 | (when org-icalendar-verify-function |
| 388 | (unless (save-match-data | 412 | (unless (save-match-data |
| 389 | (funcall org-icalendar-verify-function)) | 413 | (funcall org-icalendar-verify-function)) |
| 390 | (outline-next-heading) | 414 | (outline-next-heading) |
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index 01ce9ef35df..c6c007f35d4 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -392,25 +392,32 @@ When CHECK is given, prepare detailed information about duplicate IDs." | |||
| 392 | (interactive) | 392 | (interactive) |
| 393 | (if (not org-id-track-globally) | 393 | (if (not org-id-track-globally) |
| 394 | (error "Please turn on `org-id-track-globally' if you want to track IDs") | 394 | (error "Please turn on `org-id-track-globally' if you want to track IDs") |
| 395 | (let ((files | 395 | (let* ((org-id-search-archives |
| 396 | (or files | 396 | (or org-id-search-archives |
| 397 | (append | 397 | (and (symbolp org-id-extra-files) |
| 398 | ;; Agenda files and all associated archives | 398 | (symbol-value org-id-extra-files) |
| 399 | (org-agenda-files t org-id-search-archives) | 399 | (member 'agenda-archives org-id-extra-files)))) |
| 400 | ;; Explicit extra files | 400 | (files |
| 401 | (if (symbolp org-id-extra-files) | 401 | (or files |
| 402 | (symbol-value org-id-extra-files) | 402 | (append |
| 403 | org-id-extra-files) | 403 | ;; Agenda files and all associated archives |
| 404 | (org-agenda-files t org-id-search-archives) | ||
| 405 | ;; Explicit extra files | ||
| 406 | (if (symbolp org-id-extra-files) | ||
| 407 | (symbol-value org-id-extra-files) | ||
| 408 | org-id-extra-files) | ||
| 404 | ;; Files associated with live org-mode buffers | 409 | ;; Files associated with live org-mode buffers |
| 405 | (delq nil | 410 | (delq nil |
| 406 | (mapcar (lambda (b) | 411 | (mapcar (lambda (b) |
| 407 | (with-current-buffer b | 412 | (with-current-buffer b |
| 408 | (and (org-mode-p) (buffer-file-name)))) | 413 | (and (org-mode-p) (buffer-file-name)))) |
| 409 | (buffer-list))) | 414 | (buffer-list))) |
| 410 | ;; All files known to have IDs | 415 | ;; All files known to have IDs |
| 411 | org-id-files))) | 416 | org-id-files))) |
| 412 | org-agenda-new-buffers | 417 | org-agenda-new-buffers |
| 413 | file nfiles tfile ids reg found id seen (ndup 0)) | 418 | file nfiles tfile ids reg found id seen (ndup 0)) |
| 419 | (when (member 'agenda-archives files) | ||
| 420 | (setq files (delq 'agenda-archives (copy-sequence files)))) | ||
| 414 | (setq nfiles (length files)) | 421 | (setq nfiles (length files)) |
| 415 | (while (setq file (pop files)) | 422 | (while (setq file (pop files)) |
| 416 | (message "Finding ID locations (%d/%d files): %s" | 423 | (message "Finding ID locations (%d/%d files): %s" |
| @@ -430,12 +437,14 @@ When CHECK is given, prepare detailed information about duplicate IDs." | |||
| 430 | (if (member id found) | 437 | (if (member id found) |
| 431 | (progn | 438 | (progn |
| 432 | (message "Duplicate ID \"%s\", also in file %s" | 439 | (message "Duplicate ID \"%s\", also in file %s" |
| 433 | id (car (delq | 440 | id (or (car (delq |
| 434 | nil | 441 | nil |
| 435 | (mapcar | 442 | (mapcar |
| 436 | (lambda (x) | 443 | (lambda (x) |
| 437 | (if (member id (cdr x)) (car x))) | 444 | (if (member id (cdr x)) |
| 438 | reg)))) | 445 | (car x))) |
| 446 | reg))) | ||
| 447 | (buffer-file-name))) | ||
| 439 | (when (= ndup 0) | 448 | (when (= ndup 0) |
| 440 | (ding) | 449 | (ding) |
| 441 | (sit-for 2)) | 450 | (sit-for 2)) |
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 0ae2958c3d0..db0b49f1549 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 4 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 5 | ;; Keywords: outlines, hypermedia, calendar, wp | 5 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 6 | ;; Homepage: http://orgmode.org | 6 | ;; Homepage: http://orgmode.org |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; | 8 | ;; |
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -171,7 +171,7 @@ FIXME: How to update when broken?" | |||
| 171 | (org-compatible-face nil nil) | 171 | (org-compatible-face nil nil) |
| 172 | "Face for outline indentation. | 172 | "Face for outline indentation. |
| 173 | The default is to make it look like whitespace. But you may find it | 173 | The default is to make it look like whitespace. But you may find it |
| 174 | useful to make it evver so slightly different." | 174 | useful to make it ever so slightly different." |
| 175 | :group 'org-faces) | 175 | :group 'org-faces) |
| 176 | 176 | ||
| 177 | (defun org-indent-indent-buffer () | 177 | (defun org-indent-indent-buffer () |
diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index 92ca1264cae..af37256f21f 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el index cd378bc8bcd..d4be908c5ed 100644 --- a/lisp/org/org-inlinetask.el +++ b/lisp/org/org-inlinetask.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -35,7 +35,7 @@ | |||
| 35 | ;; | 35 | ;; |
| 36 | ;; Visibility cycling exempts these nodes from cycling. So whenever their | 36 | ;; Visibility cycling exempts these nodes from cycling. So whenever their |
| 37 | ;; parent is opened, so are these tasks. This will only work with | 37 | ;; parent is opened, so are these tasks. This will only work with |
| 38 | ;; `org-cycle', so if you are also using orther commands to show/hide | 38 | ;; `org-cycle', so if you are also using other commands to show/hide |
| 39 | ;; entries, you will occasionally find these tasks to behave like | 39 | ;; entries, you will occasionally find these tasks to behave like |
| 40 | ;; all other outline nodes, seemingly splitting the text of the parent | 40 | ;; all other outline nodes, seemingly splitting the text of the parent |
| 41 | ;; into children. | 41 | ;; into children. |
| @@ -70,7 +70,7 @@ | |||
| 70 | ;; Also, if you want to use refiling and archiving for inline tasks, | 70 | ;; Also, if you want to use refiling and archiving for inline tasks, |
| 71 | ;; The END line must be present to make things work properly. | 71 | ;; The END line must be present to make things work properly. |
| 72 | ;; | 72 | ;; |
| 73 | ;; This package installs one new comand: | 73 | ;; This package installs one new command: |
| 74 | ;; | 74 | ;; |
| 75 | ;; C-c C-x t Insert a new inline task with END line | 75 | ;; C-c C-x t Insert a new inline task with END line |
| 76 | 76 | ||
| @@ -93,6 +93,12 @@ the value of this variable." | |||
| 93 | :group 'org-inlinetask | 93 | :group 'org-inlinetask |
| 94 | :type 'boolean) | 94 | :type 'boolean) |
| 95 | 95 | ||
| 96 | (defcustom org-inlinetask-export t | ||
| 97 | "Non-nil means, export inline tasks. | ||
| 98 | When nil, they will not be exported." | ||
| 99 | :group 'org-inlinetask | ||
| 100 | :type 'boolean) | ||
| 101 | |||
| 96 | (defvar org-odd-levels-only) | 102 | (defvar org-odd-levels-only) |
| 97 | (defvar org-keyword-time-regexp) | 103 | (defvar org-keyword-time-regexp) |
| 98 | (defvar org-drawer-regexp) | 104 | (defvar org-drawer-regexp) |
| @@ -139,24 +145,42 @@ Either remove headline and meta data, or do special formatting." | |||
| 139 | (setq content (buffer-substring beg (1- (point-at-bol)))) | 145 | (setq content (buffer-substring beg (1- (point-at-bol)))) |
| 140 | (delete-region beg (1+ (match-end 0)))) | 146 | (delete-region beg (1+ (match-end 0)))) |
| 141 | (goto-char beg) | 147 | (goto-char beg) |
| 142 | (when (string-match org-complex-heading-regexp headline) | 148 | (when org-inlinetask-export |
| 143 | (setq headline (concat | 149 | (when (string-match org-complex-heading-regexp headline) |
| 144 | (if (match-end 2) | 150 | (setq headline (concat |
| 145 | (concat (match-string 2 headline) " ") "") | 151 | (if (match-end 2) |
| 146 | (match-string 4 headline))) | 152 | (concat (match-string 2 headline) " ") "") |
| 147 | (if (not (string-match "\\S-" content)) | 153 | (match-string 4 headline))) |
| 148 | (setq content nil) | 154 | (when content |
| 149 | (if (string-match "[ \t\n]+\\'" content) | 155 | (if (not (string-match "\\S-" content)) |
| 150 | (setq content (substring content 0 (match-beginning 0)))) | 156 | (setq content nil) |
| 151 | (setq content (org-remove-indentation content)) | 157 | (if (string-match "[ \t\n]+\\'" content) |
| 152 | (if latexp (setq content (concat "\\quad \\\\\n" content)))) | 158 | (setq content (substring content 0 (match-beginning 0)))) |
| 153 | (insert "- ") | 159 | (setq content (org-remove-indentation content)) |
| 154 | (setq indent (make-string (current-column) ?\ )) | 160 | (if latexp (setq content (concat "\\quad \\\\\n" content))))) |
| 155 | (insert headline " ::") | 161 | (insert (make-string (org-inlinetask-get-current-indentation) ?\ ) |
| 156 | (when content | 162 | "- ") |
| 157 | (insert (if htmlp " " (concat "\n" indent)) | 163 | (setq indent (make-string (current-column) ?\ )) |
| 158 | (mapconcat 'identity (org-split-string content "\n") | 164 | (insert headline " ::") |
| 159 | (concat "\n" indent)) "\n")))))) | 165 | (if content |
| 166 | (insert (if htmlp " " (concat "\n" indent)) | ||
| 167 | (mapconcat 'identity (org-split-string content "\n") | ||
| 168 | (concat "\n" indent)) "\n") | ||
| 169 | (insert "\n")) | ||
| 170 | (insert indent) | ||
| 171 | (backward-delete-char 2) | ||
| 172 | (insert "THISISTHEINLINELISTTEMINATOR\n")))))) | ||
| 173 | |||
| 174 | (defun org-inlinetask-get-current-indentation () | ||
| 175 | "Get the indentation of the last non-while line above this one." | ||
| 176 | (save-excursion | ||
| 177 | (beginning-of-line 1) | ||
| 178 | (skip-chars-backward " \t\n") | ||
| 179 | (beginning-of-line 1) | ||
| 180 | (or (org-at-item-p) | ||
| 181 | (looking-at "[ \t]*")) | ||
| 182 | (goto-char (match-end 0)) | ||
| 183 | (current-column))) | ||
| 160 | 184 | ||
| 161 | (defun org-inlinetask-fontify (limit) | 185 | (defun org-inlinetask-fontify (limit) |
| 162 | "Fontify the inline tasks." | 186 | "Fontify the inline tasks." |
| @@ -180,13 +204,32 @@ Either remove headline and meta data, or do special formatting." | |||
| 180 | org-inlinetask-min-level)) | 204 | org-inlinetask-min-level)) |
| 181 | (replace-match ""))) | 205 | (replace-match ""))) |
| 182 | 206 | ||
| 207 | (defun org-inlinetask-remove-terminator () | ||
| 208 | (let (beg end) | ||
| 209 | (save-excursion | ||
| 210 | (goto-char (point-min)) | ||
| 211 | (while (re-search-forward "THISISTHEINLINELISTTEMINATOR\n" nil t) | ||
| 212 | (setq beg (match-beginning 0) end (match-end 0)) | ||
| 213 | (save-excursion | ||
| 214 | (beginning-of-line 1) | ||
| 215 | (and (looking-at "<p\\(ara\\)?>THISISTHEINLINELISTTEMINATOR[ \t\n]*</p\\(ara\\)?>") | ||
| 216 | (setq beg (point) end (match-end 0)))) | ||
| 217 | (delete-region beg end))))) | ||
| 218 | |||
| 183 | (eval-after-load "org-exp" | 219 | (eval-after-load "org-exp" |
| 184 | '(add-hook 'org-export-preprocess-after-tree-selection-hook | 220 | '(add-hook 'org-export-preprocess-after-tree-selection-hook |
| 185 | 'org-inlinetask-export-handler)) | 221 | 'org-inlinetask-export-handler)) |
| 186 | (eval-after-load "org" | 222 | (eval-after-load "org" |
| 187 | '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)) | 223 | '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)) |
| 224 | (eval-after-load "org-html" | ||
| 225 | '(add-hook 'org-export-html-final-hook 'org-inlinetask-remove-terminator)) | ||
| 226 | (eval-after-load "org-latex" | ||
| 227 | '(add-hook 'org-export-latex-final-hook 'org-inlinetask-remove-terminator)) | ||
| 228 | (eval-after-load "org-ascii" | ||
| 229 | '(add-hook 'org-export-ascii-final-hook 'org-inlinetask-remove-terminator)) | ||
| 230 | (eval-after-load "org-docbook" | ||
| 231 | '(add-hook 'org-export-docbook-final-hook 'org-inlinetask-remove-terminator)) | ||
| 188 | 232 | ||
| 189 | (provide 'org-inlinetask) | 233 | (provide 'org-inlinetask) |
| 190 | 234 | ||
| 191 | ;; arch-tag: b0974e46-1d51-49d5-8bda-737617019a1b | ||
| 192 | ;;; org-inlinetask.el ends here | 235 | ;;; org-inlinetask.el ends here |
diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index 258a5c2224a..cf7bdf0f31b 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; | 4 | ;; |
| 5 | ;; Author: Philip Jackson <emacs@shellarchive.co.uk> | 5 | ;; Author: Philip Jackson <emacs@shellarchive.co.uk> |
| 6 | ;; Keywords: erc, irc, link, org | 6 | ;; Keywords: erc, irc, link, org |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; | 8 | ;; |
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el index 52d5739e933..02d867a6d73 100644 --- a/lisp/org/org-jsinfo.el +++ b/lisp/org/org-jsinfo.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el index 7b6970bbca9..bea5955ec5c 100644 --- a/lisp/org/org-latex.el +++ b/lisp/org/org-latex.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; | 4 | ;; |
| 5 | ;; Emacs Lisp Archive Entry | 5 | ;; Emacs Lisp Archive Entry |
| 6 | ;; Filename: org-latex.el | 6 | ;; Filename: org-latex.el |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; Author: Bastien Guerry <bzg AT altern DOT org> | 8 | ;; Author: Bastien Guerry <bzg AT altern DOT org> |
| 9 | ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com> | 9 | ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com> |
| 10 | ;; Keywords: org, wp, tex | 10 | ;; Keywords: org, wp, tex |
| @@ -94,7 +94,10 @@ | |||
| 94 | \\usepackage[T1]{fontenc} | 94 | \\usepackage[T1]{fontenc} |
| 95 | \\usepackage{graphicx} | 95 | \\usepackage{graphicx} |
| 96 | \\usepackage{longtable} | 96 | \\usepackage{longtable} |
| 97 | \\usepackage{float} | ||
| 98 | \\usepackage{wrapfig} | ||
| 97 | \\usepackage{soul} | 99 | \\usepackage{soul} |
| 100 | \\usepackage{amssymb} | ||
| 98 | \\usepackage{hyperref}" | 101 | \\usepackage{hyperref}" |
| 99 | ("\\section{%s}" . "\\section*{%s}") | 102 | ("\\section{%s}" . "\\section*{%s}") |
| 100 | ("\\subsection{%s}" . "\\subsection*{%s}") | 103 | ("\\subsection{%s}" . "\\subsection*{%s}") |
| @@ -107,7 +110,10 @@ | |||
| 107 | \\usepackage[T1]{fontenc} | 110 | \\usepackage[T1]{fontenc} |
| 108 | \\usepackage{graphicx} | 111 | \\usepackage{graphicx} |
| 109 | \\usepackage{longtable} | 112 | \\usepackage{longtable} |
| 113 | \\usepackage{float} | ||
| 114 | \\usepackage{wrapfig} | ||
| 110 | \\usepackage{soul} | 115 | \\usepackage{soul} |
| 116 | \\usepackage{amssymb} | ||
| 111 | \\usepackage{hyperref}" | 117 | \\usepackage{hyperref}" |
| 112 | ("\\part{%s}" . "\\part*{%s}") | 118 | ("\\part{%s}" . "\\part*{%s}") |
| 113 | ("\\chapter{%s}" . "\\chapter*{%s}") | 119 | ("\\chapter{%s}" . "\\chapter*{%s}") |
| @@ -120,7 +126,10 @@ | |||
| 120 | \\usepackage[T1]{fontenc} | 126 | \\usepackage[T1]{fontenc} |
| 121 | \\usepackage{graphicx} | 127 | \\usepackage{graphicx} |
| 122 | \\usepackage{longtable} | 128 | \\usepackage{longtable} |
| 129 | \\usepackage{float} | ||
| 130 | \\usepackage{wrapfig} | ||
| 123 | \\usepackage{soul} | 131 | \\usepackage{soul} |
| 132 | \\usepackage{amssymb} | ||
| 124 | \\usepackage{hyperref}" | 133 | \\usepackage{hyperref}" |
| 125 | ("\\part{%s}" . "\\part*{%s}") | 134 | ("\\part{%s}" . "\\part*{%s}") |
| 126 | ("\\chapter{%s}" . "\\chapter*{%s}") | 135 | ("\\chapter{%s}" . "\\chapter*{%s}") |
| @@ -177,7 +186,7 @@ to represent the section title." | |||
| 177 | Each element of the list is a list of three elements. | 186 | Each element of the list is a list of three elements. |
| 178 | The first element is the character used as a marker for fontification. | 187 | The first element is the character used as a marker for fontification. |
| 179 | The second element is a formatting string to wrap fontified text with. | 188 | The second element is a formatting string to wrap fontified text with. |
| 180 | If it is \"\\verb\", Org will automatically select a deimiter | 189 | If it is \"\\verb\", Org will automatically select a delimiter |
| 181 | character that is not in the string. | 190 | character that is not in the string. |
| 182 | The third element decides whether to protect converted text from other | 191 | The third element decides whether to protect converted text from other |
| 183 | conversions." | 192 | conversions." |
| @@ -269,7 +278,7 @@ the %s stands here for the inserted headline and is mandatory. | |||
| 269 | It may also be a list of three string to define a user-defined environment | 278 | It may also be a list of three string to define a user-defined environment |
| 270 | that should be used. The first string should be the like | 279 | that should be used. The first string should be the like |
| 271 | \"\\begin{itemize}\", the second should be like \"\\item %s %s\" with up | 280 | \"\\begin{itemize}\", the second should be like \"\\item %s %s\" with up |
| 272 | to two occurrences of %s for the title and a lable, respectively. The third | 281 | to two occurrences of %s for the title and a label, respectively. The third |
| 273 | string should be like \"\\end{itemize\"." | 282 | string should be like \"\\end{itemize\"." |
| 274 | :group 'org-export-latex | 283 | :group 'org-export-latex |
| 275 | :type '(choice (const :tag "Ignore" nil) | 284 | :type '(choice (const :tag "Ignore" nil) |
| @@ -284,7 +293,7 @@ string should be like \"\\end{itemize\"." | |||
| 284 | (string :tag "Use a section string" :value "\\subparagraph{%s}"))) | 293 | (string :tag "Use a section string" :value "\\subparagraph{%s}"))) |
| 285 | 294 | ||
| 286 | (defcustom org-export-latex-list-parameters | 295 | (defcustom org-export-latex-list-parameters |
| 287 | '(:cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}") | 296 | '(:cbon "$\\boxtimes$" :cboff "$\\Box$") |
| 288 | "Parameters for the LaTeX list exporter. | 297 | "Parameters for the LaTeX list exporter. |
| 289 | These parameters will be passed on to `org-list-to-latex', which in turn | 298 | These parameters will be passed on to `org-list-to-latex', which in turn |
| 290 | will pass them (combined with the LaTeX default list parameters) to | 299 | will pass them (combined with the LaTeX default list parameters) to |
| @@ -389,12 +398,12 @@ as a command. %s in the command will be replaced by the full file name, %b | |||
| 389 | by the file base name (i.e. without extension). | 398 | by the file base name (i.e. without extension). |
| 390 | The reason why this is a list is that it usually takes several runs of | 399 | The reason why this is a list is that it usually takes several runs of |
| 391 | pdflatex, maybe mixed with a call to bibtex. Org does not have a clever | 400 | pdflatex, maybe mixed with a call to bibtex. Org does not have a clever |
| 392 | mechanism to detect whihc of these commands have to be run to get to a stable | 401 | mechanism to detect which of these commands have to be run to get to a stable |
| 393 | result, and it also does not do any error checking. | 402 | result, and it also does not do any error checking. |
| 394 | 403 | ||
| 395 | Alternatively, this may be a Lisp function that does the processing, so you | 404 | Alternatively, this may be a Lisp function that does the processing, so you |
| 396 | could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. | 405 | could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. |
| 397 | THis function should accept the file name as its single argument." | 406 | This function should accept the file name as its single argument." |
| 398 | :group 'org-export-latex | 407 | :group 'org-export-latex |
| 399 | :type '(choice (repeat :tag "Shell command sequence" | 408 | :type '(choice (repeat :tag "Shell command sequence" |
| 400 | (string :tag "Shell command")) | 409 | (string :tag "Shell command")) |
| @@ -481,7 +490,7 @@ in a window. A non-interactive call will only return the buffer." | |||
| 481 | (setq buffer "*Org LaTeX Export*")) | 490 | (setq buffer "*Org LaTeX Export*")) |
| 482 | (let ((transient-mark-mode t) (zmacs-regions t) | 491 | (let ((transient-mark-mode t) (zmacs-regions t) |
| 483 | ext-plist rtn) | 492 | ext-plist rtn) |
| 484 | (setq ext-plist (plist-put ext-plist :ignore-subree-p t)) | 493 | (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) |
| 485 | (goto-char end) | 494 | (goto-char end) |
| 486 | (set-mark (point)) ;; to activate the region | 495 | (set-mark (point)) ;; to activate the region |
| 487 | (goto-char beg) | 496 | (goto-char beg) |
| @@ -535,7 +544,7 @@ when PUB-DIR is set, use this as the publishing directory." | |||
| 535 | (rbeg (and region-p (region-beginning))) | 544 | (rbeg (and region-p (region-beginning))) |
| 536 | (rend (and region-p (region-end))) | 545 | (rend (and region-p (region-end))) |
| 537 | (subtree-p | 546 | (subtree-p |
| 538 | (if (plist-get opt-plist :ignore-subree-p) | 547 | (if (plist-get opt-plist :ignore-subtree-p) |
| 539 | nil | 548 | nil |
| 540 | (when region-p | 549 | (when region-p |
| 541 | (save-excursion | 550 | (save-excursion |
| @@ -977,7 +986,7 @@ OPT-PLIST is the options plist for current buffer." | |||
| 977 | ;; insert author info | 986 | ;; insert author info |
| 978 | (if (plist-get opt-plist :author-info) | 987 | (if (plist-get opt-plist :author-info) |
| 979 | (format "\\author{%s}\n" | 988 | (format "\\author{%s}\n" |
| 980 | (org-export-latex-fontify-headline (or author user-full-name)));???????????????????? | 989 | (org-export-latex-fontify-headline (or author user-full-name))) |
| 981 | (format "%%\\author{%s}\n" | 990 | (format "%%\\author{%s}\n" |
| 982 | (or author user-full-name))) | 991 | (or author user-full-name))) |
| 983 | ;; insert the date | 992 | ;; insert the date |
| @@ -1000,7 +1009,9 @@ OPT-PLIST is the options plist for current buffer." | |||
| 1000 | (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" | 1009 | (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" |
| 1001 | (min toc (plist-get opt-plist :headline-levels)))) | 1010 | (min toc (plist-get opt-plist :headline-levels)))) |
| 1002 | (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" | 1011 | (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" |
| 1003 | (plist-get opt-plist :headline-levels)))))))) | 1012 | (plist-get opt-plist :headline-levels))))) |
| 1013 | (when (plist-get opt-plist :preserve-breaks) | ||
| 1014 | "\\obeylines\n")))) | ||
| 1004 | 1015 | ||
| 1005 | (defun org-export-latex-first-lines (opt-plist &optional beg end) | 1016 | (defun org-export-latex-first-lines (opt-plist &optional beg end) |
| 1006 | "Export the first lines before first headline. | 1017 | "Export the first lines before first headline. |
| @@ -1124,6 +1135,15 @@ links, keywords, lists, tables, fixed-width" | |||
| 1124 | ;; the beginning of the buffer - inserting "\n" is safe here though. | 1135 | ;; the beginning of the buffer - inserting "\n" is safe here though. |
| 1125 | (insert "\n" string) | 1136 | (insert "\n" string) |
| 1126 | (goto-char (point-min)) | 1137 | (goto-char (point-min)) |
| 1138 | (let ((re (concat "\\\\[a-zA-Z]+\\(?:" | ||
| 1139 | "\\[.*\\]" | ||
| 1140 | "\\)?" | ||
| 1141 | (org-create-multibrace-regexp "{" "}" 3)))) | ||
| 1142 | (while (re-search-forward re nil t) | ||
| 1143 | (unless (save-excursion (goto-char (match-beginning 0)) | ||
| 1144 | (equal (char-after (point-at-bol)) ?#)) | ||
| 1145 | (add-text-properties (match-beginning 0) (match-end 0) | ||
| 1146 | '(org-protected t))))) | ||
| 1127 | (when (plist-get org-export-latex-options-plist :emphasize) | 1147 | (when (plist-get org-export-latex-options-plist :emphasize) |
| 1128 | (org-export-latex-fontify)) | 1148 | (org-export-latex-fontify)) |
| 1129 | (org-export-latex-keywords-maybe) | 1149 | (org-export-latex-keywords-maybe) |
| @@ -1151,13 +1171,14 @@ links, keywords, lists, tables, fixed-width" | |||
| 1151 | '(("\\(\\s-\\)\"" "«~") | 1171 | '(("\\(\\s-\\)\"" "«~") |
| 1152 | ("\\(\\S-\\)\"" "~»") | 1172 | ("\\(\\S-\\)\"" "~»") |
| 1153 | ("\\(\\s-\\)'" "`")) | 1173 | ("\\(\\s-\\)'" "`")) |
| 1154 | '(("\\(\\s-\\|(\\)\"" "``") | 1174 | '(("\\(\\s-\\|[[(]\\)\"" "``") |
| 1155 | ("\\(\\S-\\)\"" "''") | 1175 | ("\\(\\S-\\)\"" "''") |
| 1156 | ("\\(\\s-\\|(\\)'" "`"))))) | 1176 | ("\\(\\s-\\|(\\)'" "`"))))) |
| 1157 | (mapc (lambda(l) (goto-char (point-min)) | 1177 | (mapc (lambda(l) (goto-char (point-min)) |
| 1158 | (while (re-search-forward (car l) nil t) | 1178 | (while (re-search-forward (car l) nil t) |
| 1159 | (let ((rpl (concat (match-string 1) (cadr l)))) | 1179 | (let ((rpl (concat (match-string 1) |
| 1160 | (org-export-latex-protect-string rpl) | 1180 | (org-export-latex-protect-string |
| 1181 | (copy-sequence (cadr l)))))) | ||
| 1161 | (org-if-unprotected-1 | 1182 | (org-if-unprotected-1 |
| 1162 | (replace-match rpl t t))))) quote-rpl))) | 1183 | (replace-match rpl t t))))) quote-rpl))) |
| 1163 | 1184 | ||
| @@ -1329,114 +1350,115 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1329 | "Convert tables to LaTeX and INSERT it." | 1350 | "Convert tables to LaTeX and INSERT it." |
| 1330 | (goto-char (point-min)) | 1351 | (goto-char (point-min)) |
| 1331 | (while (re-search-forward "^\\([ \t]*\\)|" nil t) | 1352 | (while (re-search-forward "^\\([ \t]*\\)|" nil t) |
| 1332 | (org-table-align) | 1353 | (org-if-unprotected-at (1- (point)) |
| 1333 | (let* ((beg (org-table-begin)) | 1354 | (org-table-align) |
| 1334 | (end (org-table-end)) | 1355 | (let* ((beg (org-table-begin)) |
| 1335 | (raw-table (buffer-substring beg end)) | 1356 | (end (org-table-end)) |
| 1336 | (org-table-last-alignment (copy-sequence org-table-last-alignment)) | 1357 | (raw-table (buffer-substring beg end)) |
| 1337 | (org-table-last-column-widths (copy-sequence | 1358 | (org-table-last-alignment (copy-sequence org-table-last-alignment)) |
| 1338 | org-table-last-column-widths)) | 1359 | (org-table-last-column-widths (copy-sequence |
| 1339 | fnum fields line lines olines gr colgropen line-fmt align | 1360 | org-table-last-column-widths)) |
| 1340 | caption label attr floatp longtblp) | 1361 | fnum fields line lines olines gr colgropen line-fmt align |
| 1341 | (if org-export-latex-tables-verbatim | 1362 | caption label attr floatp longtblp) |
| 1342 | (let* ((tbl (concat "\\begin{verbatim}\n" raw-table | 1363 | (if org-export-latex-tables-verbatim |
| 1343 | "\\end{verbatim}\n"))) | 1364 | (let* ((tbl (concat "\\begin{verbatim}\n" raw-table |
| 1344 | (apply 'delete-region (list beg end)) | 1365 | "\\end{verbatim}\n"))) |
| 1345 | (insert (org-export-latex-protect-string tbl))) | 1366 | (apply 'delete-region (list beg end)) |
| 1346 | (progn | 1367 | (insert (org-export-latex-protect-string tbl))) |
| 1347 | (setq caption (org-find-text-property-in-string | 1368 | (progn |
| 1348 | 'org-caption raw-table) | 1369 | (setq caption (org-find-text-property-in-string |
| 1349 | attr (org-find-text-property-in-string | 1370 | 'org-caption raw-table) |
| 1350 | 'org-attributes raw-table) | 1371 | attr (org-find-text-property-in-string |
| 1351 | label (org-find-text-property-in-string | 1372 | 'org-attributes raw-table) |
| 1352 | 'org-label raw-table) | 1373 | label (org-find-text-property-in-string |
| 1353 | longtblp (and attr (stringp attr) | 1374 | 'org-label raw-table) |
| 1354 | (string-match "\\<longtable\\>" attr)) | 1375 | longtblp (and attr (stringp attr) |
| 1355 | align (and attr (stringp attr) | 1376 | (string-match "\\<longtable\\>" attr)) |
| 1356 | (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) | 1377 | align (and attr (stringp attr) |
| 1357 | (match-string 1 attr)) | 1378 | (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) |
| 1358 | floatp (or caption label)) | 1379 | (match-string 1 attr)) |
| 1359 | (setq lines (org-split-string raw-table "\n")) | 1380 | floatp (or caption label)) |
| 1360 | (apply 'delete-region (list beg end)) | 1381 | (setq lines (org-split-string raw-table "\n")) |
| 1361 | (when org-export-table-remove-special-lines | 1382 | (apply 'delete-region (list beg end)) |
| 1362 | (setq lines (org-table-clean-before-export lines 'maybe-quoted))) | 1383 | (when org-export-table-remove-special-lines |
| 1363 | (when org-table-clean-did-remove-column | 1384 | (setq lines (org-table-clean-before-export lines 'maybe-quoted))) |
| 1385 | (when org-table-clean-did-remove-column | ||
| 1364 | (pop org-table-last-alignment) | 1386 | (pop org-table-last-alignment) |
| 1365 | (pop org-table-last-column-widths)) | 1387 | (pop org-table-last-column-widths)) |
| 1366 | ;; make a formatting string to reflect aligment | 1388 | ;; make a formatting string to reflect alignment |
| 1367 | (setq olines lines) | 1389 | (setq olines lines) |
| 1368 | (while (and (not line-fmt) (setq line (pop olines))) | 1390 | (while (and (not line-fmt) (setq line (pop olines))) |
| 1369 | (unless (string-match "^[ \t]*|-" line) | 1391 | (unless (string-match "^[ \t]*|-" line) |
| 1370 | (setq fields (org-split-string line "[ \t]*|[ \t]*")) | 1392 | (setq fields (org-split-string line "[ \t]*|[ \t]*")) |
| 1371 | (setq fnum (make-vector (length fields) 0)) | 1393 | (setq fnum (make-vector (length fields) 0)) |
| 1372 | (setq line-fmt | 1394 | (setq line-fmt |
| 1373 | (mapconcat | 1395 | (mapconcat |
| 1374 | (lambda (x) | 1396 | (lambda (x) |
| 1375 | (setq gr (pop org-table-colgroup-info)) | 1397 | (setq gr (pop org-table-colgroup-info)) |
| 1376 | (format "%s%%s%s" | 1398 | (format "%s%%s%s" |
| 1377 | (cond ((eq gr :start) | 1399 | (cond ((eq gr :start) |
| 1378 | (prog1 (if colgropen "|" "|") | 1400 | (prog1 (if colgropen "|" "|") |
| 1379 | (setq colgropen t))) | 1401 | (setq colgropen t))) |
| 1380 | ((eq gr :startend) | 1402 | ((eq gr :startend) |
| 1381 | (prog1 (if colgropen "|" "|") | 1403 | (prog1 (if colgropen "|" "|") |
| 1382 | (setq colgropen nil))) | 1404 | (setq colgropen nil))) |
| 1383 | (t "")) | 1405 | (t "")) |
| 1384 | (if (memq gr '(:end :startend)) | 1406 | (if (memq gr '(:end :startend)) |
| 1385 | (progn (setq colgropen nil) "|") | 1407 | (progn (setq colgropen nil) "|") |
| 1386 | ""))) | 1408 | ""))) |
| 1387 | fnum "")))) | 1409 | fnum "")))) |
| 1388 | ;; fix double || in line-fmt | 1410 | ;; fix double || in line-fmt |
| 1389 | (setq line-fmt (replace-regexp-in-string "||" "|" line-fmt)) | 1411 | (setq line-fmt (replace-regexp-in-string "||" "|" line-fmt)) |
| 1390 | ;; maybe remove the first and last "|" | 1412 | ;; maybe remove the first and last "|" |
| 1391 | (when (and (not org-export-latex-tables-column-borders) | 1413 | (when (and (not org-export-latex-tables-column-borders) |
| 1392 | (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt)) | 1414 | (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt)) |
| 1393 | (setq line-fmt (match-string 2 line-fmt))) | 1415 | (setq line-fmt (match-string 2 line-fmt))) |
| 1394 | ;; format alignment | 1416 | ;; format alignment |
| 1395 | (unless align | 1417 | (unless align |
| 1396 | (setq align (apply 'format | 1418 | (setq align (apply 'format |
| 1397 | (cons line-fmt | 1419 | (cons line-fmt |
| 1398 | (mapcar (lambda (x) (if x "r" "l")) | 1420 | (mapcar (lambda (x) (if x "r" "l")) |
| 1399 | org-table-last-alignment))))) | 1421 | org-table-last-alignment))))) |
| 1400 | ;; prepare the table to send to orgtbl-to-latex | 1422 | ;; prepare the table to send to orgtbl-to-latex |
| 1401 | (setq lines | 1423 | (setq lines |
| 1402 | (mapcar | 1424 | (mapcar |
| 1403 | (lambda(elem) | 1425 | (lambda(elem) |
| 1404 | (or (and (string-match "[ \t]*|-+" elem) 'hline) | 1426 | (or (and (string-match "[ \t]*|-+" elem) 'hline) |
| 1405 | (org-split-string (org-trim elem) "|"))) | 1427 | (org-split-string (org-trim elem) "|"))) |
| 1406 | lines)) | 1428 | lines)) |
| 1407 | (when insert | 1429 | (when insert |
| 1408 | (insert (org-export-latex-protect-string | 1430 | (insert (org-export-latex-protect-string |
| 1409 | (concat | 1431 | (concat |
| 1410 | (if longtblp | 1432 | (if longtblp |
| 1411 | (concat "\\begin{longtable}{" align "}\n") | 1433 | (concat "\\begin{longtable}{" align "}\n") |
| 1412 | (if floatp "\\begin{table}[htb]\n")) | 1434 | (if floatp "\\begin{table}[htb]\n")) |
| 1413 | (if (or floatp longtblp) | 1435 | (if (or floatp longtblp) |
| 1414 | (format | 1436 | (format |
| 1415 | "\\caption{%s%s}" | 1437 | "\\caption{%s%s}" |
| 1416 | (if label (concat "\\\label{" label "}") "") | 1438 | (if label (concat "\\\label{" label "}") "") |
| 1417 | (or caption ""))) | 1439 | (or caption ""))) |
| 1418 | (if longtblp "\\\\\n" "\n") | 1440 | (if longtblp "\\\\\n" "\n") |
| 1419 | (if (and org-export-latex-tables-centered (not longtblp)) | 1441 | (if (and org-export-latex-tables-centered (not longtblp)) |
| 1420 | "\\begin{center}\n") | 1442 | "\\begin{center}\n") |
| 1421 | (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) | 1443 | (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) |
| 1422 | (orgtbl-to-latex | 1444 | (orgtbl-to-latex |
| 1423 | lines | 1445 | lines |
| 1424 | `(:tstart nil :tend nil | 1446 | `(:tstart nil :tend nil |
| 1425 | :hlend ,(if longtblp | 1447 | :hlend ,(if longtblp |
| 1426 | (format "\\\\ | 1448 | (format "\\\\ |
| 1427 | \\hline | 1449 | \\hline |
| 1428 | \\endhead | 1450 | \\endhead |
| 1429 | \\hline\\multicolumn{%d}{r}{Continued on next page}\\ | 1451 | \\hline\\multicolumn{%d}{r}{Continued on next page}\\ |
| 1430 | \\endfoot | 1452 | \\endfoot |
| 1431 | \\endlastfoot" (length org-table-last-alignment)) | 1453 | \\endlastfoot" (length org-table-last-alignment)) |
| 1432 | nil))) | 1454 | nil))) |
| 1433 | (if (not longtblp) (concat "\n\\end{tabular}")) | 1455 | (if (not longtblp) (concat "\n\\end{tabular}")) |
| 1434 | (if longtblp "\n" (if org-export-latex-tables-centered | 1456 | (if longtblp "\n" (if org-export-latex-tables-centered |
| 1435 | "\n\\end{center}\n" "\n")) | 1457 | "\n\\end{center}\n" "\n")) |
| 1436 | (if longtblp | 1458 | (if longtblp |
| 1437 | "\\end{longtable}" | 1459 | "\\end{longtable}" |
| 1438 | (if floatp "\\end{table}")))) | 1460 | (if floatp "\\end{table}")))) |
| 1439 | "\n\n"))))))) | 1461 | "\n\n")))))))) |
| 1440 | 1462 | ||
| 1441 | (defun org-export-latex-fontify () | 1463 | (defun org-export-latex-fontify () |
| 1442 | "Convert fontification to LaTeX." | 1464 | "Convert fontification to LaTeX." |
| @@ -1447,23 +1469,33 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1447 | org-export-latex-emphasis-alist)) | 1469 | org-export-latex-emphasis-alist)) |
| 1448 | (beg (match-beginning 0)) | 1470 | (beg (match-beginning 0)) |
| 1449 | (end (match-end 0)) | 1471 | (end (match-end 0)) |
| 1450 | rpl) | 1472 | rpl s) |
| 1451 | (unless emph | 1473 | (unless emph |
| 1452 | (message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\"" | 1474 | (message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\"" |
| 1453 | (match-string 3))) | 1475 | (match-string 3))) |
| 1454 | (unless (or (get-text-property (1- (point)) 'org-protected) | 1476 | (unless (or (and (get-text-property (- (point) 2) 'org-protected) |
| 1477 | (not (get-text-property | ||
| 1478 | (- (point) 2) 'org-verbatim-emph))) | ||
| 1455 | (save-excursion | 1479 | (save-excursion |
| 1456 | (goto-char (match-beginning 1)) | 1480 | (goto-char (match-beginning 1)) |
| 1457 | (save-match-data | 1481 | (save-match-data |
| 1458 | (and (org-at-table-p) | 1482 | (and (org-at-table-p) |
| 1459 | (string-match | 1483 | (string-match |
| 1460 | "[|\n]" (buffer-substring beg end)))))) | 1484 | "[|\n]" (buffer-substring beg end)))))) |
| 1485 | (setq s (match-string 4)) | ||
| 1461 | (setq rpl (concat (match-string 1) | 1486 | (setq rpl (concat (match-string 1) |
| 1462 | (org-export-latex-emph-format (cadr emph) | 1487 | (org-export-latex-emph-format (cadr emph) |
| 1463 | (match-string 4)) | 1488 | (match-string 4)) |
| 1464 | (match-string 5))) | 1489 | (match-string 5))) |
| 1465 | (if (caddr emph) | 1490 | (if (caddr emph) |
| 1466 | (setq rpl (org-export-latex-protect-string rpl))) | 1491 | (setq rpl (org-export-latex-protect-string rpl)) |
| 1492 | (save-match-data | ||
| 1493 | (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).\\'" rpl) | ||
| 1494 | (progn | ||
| 1495 | (add-text-properties (match-beginning 1) (match-end 1) | ||
| 1496 | '(org-protected t) rpl) | ||
| 1497 | (add-text-properties (match-beginning 3) (match-end 3) | ||
| 1498 | '(org-protected t) rpl))))) | ||
| 1467 | (replace-match rpl t t))) | 1499 | (replace-match rpl t t))) |
| 1468 | (backward-char))) | 1500 | (backward-char))) |
| 1469 | 1501 | ||
| @@ -1496,8 +1528,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1496 | (setq char (or (cdr (assoc char trans)) (concat "\\" char)) | 1528 | (setq char (or (cdr (assoc char trans)) (concat "\\" char)) |
| 1497 | rtn (concat rtn char))) | 1529 | rtn (concat rtn char))) |
| 1498 | (setq string (concat rtn string) format "\\texttt{%s}"))))) | 1530 | (setq string (concat rtn string) format "\\texttt{%s}"))))) |
| 1499 | (setq string (org-export-latex-protect-string | 1531 | (format format string)) |
| 1500 | (format format string)))) | ||
| 1501 | 1532 | ||
| 1502 | (defun org-export-latex-links () | 1533 | (defun org-export-latex-links () |
| 1503 | ;; Make sure to use the LaTeX hyperref and graphicx package | 1534 | ;; Make sure to use the LaTeX hyperref and graphicx package |
| @@ -1505,7 +1536,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1505 | "Convert links to LaTeX." | 1536 | "Convert links to LaTeX." |
| 1506 | (goto-char (point-min)) | 1537 | (goto-char (point-min)) |
| 1507 | (while (re-search-forward org-bracket-link-analytic-regexp++ nil t) | 1538 | (while (re-search-forward org-bracket-link-analytic-regexp++ nil t) |
| 1508 | (org-if-unprotected | 1539 | (org-if-unprotected-1 |
| 1509 | (goto-char (match-beginning 0)) | 1540 | (goto-char (match-beginning 0)) |
| 1510 | (let* ((re-radio org-export-latex-all-targets-re) | 1541 | (let* ((re-radio org-export-latex-all-targets-re) |
| 1511 | (remove (list (match-beginning 0) (match-end 0))) | 1542 | (remove (list (match-beginning 0) (match-end 0))) |
| @@ -1521,7 +1552,6 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1521 | (attr (or (org-find-text-property-in-string 'org-attributes raw-path) | 1552 | (attr (or (org-find-text-property-in-string 'org-attributes raw-path) |
| 1522 | (plist-get org-export-latex-options-plist :latex-image-options))) | 1553 | (plist-get org-export-latex-options-plist :latex-image-options))) |
| 1523 | (label (org-find-text-property-in-string 'org-label raw-path)) | 1554 | (label (org-find-text-property-in-string 'org-label raw-path)) |
| 1524 | (floatp (or label caption)) | ||
| 1525 | imgp radiop | 1555 | imgp radiop |
| 1526 | ;; define the path of the link | 1556 | ;; define the path of the link |
| 1527 | (path (cond | 1557 | (path (cond |
| @@ -1551,20 +1581,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1551 | raw-path)))))))) | 1581 | raw-path)))))))) |
| 1552 | ;; process with link inserting | 1582 | ;; process with link inserting |
| 1553 | (apply 'delete-region remove) | 1583 | (apply 'delete-region remove) |
| 1554 | (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) | 1584 | (cond ((and imgp |
| 1585 | (plist-get org-export-latex-options-plist :inline-images)) | ||
| 1586 | ;; OK, we need to inline an image | ||
| 1555 | (insert | 1587 | (insert |
| 1556 | (concat | 1588 | (org-export-latex-format-image raw-path caption label attr))) |
| 1557 | (if floatp "\\begin{figure}[htb]\n\\centering\n") | ||
| 1558 | (format "\\includegraphics[%s]{%s}\n" | ||
| 1559 | attr | ||
| 1560 | (if (file-name-absolute-p raw-path) | ||
| 1561 | (expand-file-name raw-path) | ||
| 1562 | raw-path)) | ||
| 1563 | (if floatp | ||
| 1564 | (format "\\caption{%s%s}\n" | ||
| 1565 | (if label (concat "\\label{" label "}") "") | ||
| 1566 | (or caption ""))) | ||
| 1567 | (if floatp "\\end{figure}")))) | ||
| 1568 | (coderefp | 1589 | (coderefp |
| 1569 | (insert (format | 1590 | (insert (format |
| 1570 | (org-export-get-coderef-format path desc) | 1591 | (org-export-get-coderef-format path desc) |
| @@ -1586,6 +1607,61 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1586 | (insert (format "\\href{%s}{%s}" path desc))) | 1607 | (insert (format "\\href{%s}{%s}" path desc))) |
| 1587 | (t (insert "\\texttt{" desc "}"))))))) | 1608 | (t (insert "\\texttt{" desc "}"))))))) |
| 1588 | 1609 | ||
| 1610 | |||
| 1611 | (defun org-export-latex-format-image (path caption label attr) | ||
| 1612 | "Format the image element, depending on user settings." | ||
| 1613 | (let (floatp wrapp placement figenv) | ||
| 1614 | (setq floatp (or caption label)) | ||
| 1615 | (when (and attr (stringp attr)) | ||
| 1616 | (if (string-match "[ \t]*\\<wrap\\>" attr) | ||
| 1617 | (setq wrapp t floatp nil attr (replace-match "" t t attr))) | ||
| 1618 | (if (string-match "[ \t]*\\<float\\>" attr) | ||
| 1619 | (setq wrapp nil floatp t attr (replace-match "" t t attr)))) | ||
| 1620 | |||
| 1621 | (setq placement | ||
| 1622 | (cond | ||
| 1623 | (wrapp "{l}{0.5\\textwidth}") | ||
| 1624 | (floatp "[htb]") | ||
| 1625 | (t ""))) | ||
| 1626 | |||
| 1627 | (when (and attr (stringp attr) | ||
| 1628 | (string-match "[ \t]*\\<placement=\\(\\S-+\\)" attr)) | ||
| 1629 | (setq placement (match-string 1 attr) | ||
| 1630 | attr (replace-match "" t t attr))) | ||
| 1631 | (setq attr (and attr (org-trim attr))) | ||
| 1632 | (when (or (not attr) (= (length attr) 0)) | ||
| 1633 | (setq attr (cond (floatp "width=0.7\\textwidth") | ||
| 1634 | (wrapp "width=0.48\\textwidth") | ||
| 1635 | (t attr)))) | ||
| 1636 | (setq figenv | ||
| 1637 | (cond | ||
| 1638 | (wrapp "\\begin{wrapfigure}%placement | ||
| 1639 | \\centering | ||
| 1640 | \\includegraphics[%attr]{%path} | ||
| 1641 | \\caption{%labelcmd%caption} | ||
| 1642 | \\end{wrapfigure}") | ||
| 1643 | (floatp "\\begin{figure}%placement | ||
| 1644 | \\centering | ||
| 1645 | \\includegraphics[%attr]{%path} | ||
| 1646 | \\caption{%labelcmd%caption} | ||
| 1647 | \\end{figure}") | ||
| 1648 | (t "\\includegraphics[%attr]{%path}"))) | ||
| 1649 | |||
| 1650 | (if (and (not label) (not caption) | ||
| 1651 | (string-match "^\\\\caption{.*\n" figenv)) | ||
| 1652 | (setq figenv (replace-match "" t t figenv))) | ||
| 1653 | (org-fill-template | ||
| 1654 | figenv | ||
| 1655 | (list (cons "path" | ||
| 1656 | (if (file-name-absolute-p path) | ||
| 1657 | (expand-file-name path) | ||
| 1658 | path)) | ||
| 1659 | (cons "attr" attr) | ||
| 1660 | (cons "labelcmd" (if label (format "\\label{%s}" | ||
| 1661 | label)"")) | ||
| 1662 | (cons "caption" (or caption "")) | ||
| 1663 | (cons "placement" (or placement "")))))) | ||
| 1664 | |||
| 1589 | (defun org-export-latex-protect-amp (s) | 1665 | (defun org-export-latex-protect-amp (s) |
| 1590 | (while (string-match "\\([^\\\\]\\)\\(&\\)" s) | 1666 | (while (string-match "\\([^\\\\]\\)\\(&\\)" s) |
| 1591 | (setq s (replace-match (concat (match-string 1 s) "\\" (match-string 2 s)) | 1667 | (setq s (replace-match (concat (match-string 1 s) "\\" (match-string 2 s)) |
| @@ -1666,7 +1742,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1666 | (concat "\\hspace*{1cm}" (match-string 2))) t t) | 1742 | (concat "\\hspace*{1cm}" (match-string 2))) t t) |
| 1667 | (beginning-of-line 1)) | 1743 | (beginning-of-line 1)) |
| 1668 | (if (looking-at "[ \t]*$") | 1744 | (if (looking-at "[ \t]*$") |
| 1669 | (insert "\\vspace*{1em}") | 1745 | (insert (org-export-latex-protect-string "\\vspace*{1em}")) |
| 1670 | (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") | 1746 | (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") |
| 1671 | (end-of-line 1) | 1747 | (end-of-line 1) |
| 1672 | (insert "\\\\"))) | 1748 | (insert "\\\\"))) |
| @@ -1716,7 +1792,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1716 | (while (re-search-forward | 1792 | (while (re-search-forward |
| 1717 | (concat "<<<?" org-export-latex-all-targets-re | 1793 | (concat "<<<?" org-export-latex-all-targets-re |
| 1718 | ">>>?\\((INVISIBLE)\\)?") nil t) | 1794 | ">>>?\\((INVISIBLE)\\)?") nil t) |
| 1719 | (org-if-unprotected | 1795 | (org-if-unprotected-at (+ (match-beginning 0) 2) |
| 1720 | (replace-match | 1796 | (replace-match |
| 1721 | (org-export-latex-protect-string | 1797 | (org-export-latex-protect-string |
| 1722 | (format "\\label{%s}%s" (save-match-data (org-solidify-link-text | 1798 | (format "\\label{%s}%s" (save-match-data (org-solidify-link-text |
| @@ -1736,9 +1812,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1736 | (goto-char (point-min)) | 1812 | (goto-char (point-min)) |
| 1737 | (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t) | 1813 | (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t) |
| 1738 | (org-if-unprotected | 1814 | (org-if-unprotected |
| 1739 | (when (save-match-data | 1815 | (when (and (save-match-data |
| 1740 | (save-excursion (beginning-of-line) | 1816 | (save-excursion (beginning-of-line) |
| 1741 | (looking-at "[^:|#]"))) | 1817 | (looking-at "[^:|#]"))) |
| 1818 | (not (org-in-verbatim-emphasis))) | ||
| 1742 | (let ((foot-beg (match-beginning 0)) | 1819 | (let ((foot-beg (match-beginning 0)) |
| 1743 | (foot-end (match-end 0)) | 1820 | (foot-end (match-end 0)) |
| 1744 | (foot-prefix (match-string 0)) | 1821 | (foot-prefix (match-string 0)) |
| @@ -1969,7 +2046,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 1969 | (when (consp x) | 2046 | (when (consp x) |
| 1970 | (add-to-list 'org-latex-entities-exceptions x) | 2047 | (add-to-list 'org-latex-entities-exceptions x) |
| 1971 | (setq x (car x))) | 2048 | (setq x (car x))) |
| 1972 | (if (string-match "[a-z][A-Z]$" x) | 2049 | (if (string-match "[a-zA-Z]$" x) |
| 1973 | (push x names) | 2050 | (push x names) |
| 1974 | (push x rest))) | 2051 | (push x rest))) |
| 1975 | (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)" | 2052 | (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)" |
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index ed09f5b585d..99cc4feeef1 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Bastien Guerry <bzg AT altern DOT org> | 7 | ;; Bastien Guerry <bzg AT altern DOT org> |
| 8 | ;; Keywords: outlines, hypermedia, calendar, wp | 8 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 9 | ;; Homepage: http://orgmode.org | 9 | ;; Homepage: http://orgmode.org |
| 10 | ;; Version: 6.31a | 10 | ;; Version: 6.33 |
| 11 | ;; | 11 | ;; |
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | ;; | 13 | ;; |
| @@ -149,7 +149,7 @@ toggle a checkbox with \\[org-ctrl-c-ctrl-c]." | |||
| 149 | (defcustom org-hierarchical-checkbox-statistics t | 149 | (defcustom org-hierarchical-checkbox-statistics t |
| 150 | "Non-nil means, checkbox statistics counts only the state of direct children. | 150 | "Non-nil means, checkbox statistics counts only the state of direct children. |
| 151 | When nil, all boxes below the cookie are counted. | 151 | When nil, all boxes below the cookie are counted. |
| 152 | This can be set to nil on a per-node basis using a COCKIE_DATA property | 152 | This can be set to nil on a per-node basis using a COOKIE_DATA property |
| 153 | with the word \"recursive\" in the value." | 153 | with the word \"recursive\" in the value." |
| 154 | :group 'org-plain-lists | 154 | :group 'org-plain-lists |
| 155 | :type 'boolean) | 155 | :type 'boolean) |
| @@ -840,6 +840,7 @@ with something like \"1.\" or \"2)\"." | |||
| 840 | (org-goto-line line) | 840 | (org-goto-line line) |
| 841 | (org-move-to-column col))) | 841 | (org-move-to-column col))) |
| 842 | 842 | ||
| 843 | (defvar org-suppress-item-indentation) ; dynamically scoped parameter | ||
| 843 | (defun org-fix-bullet-type (&optional force-bullet) | 844 | (defun org-fix-bullet-type (&optional force-bullet) |
| 844 | "Make sure all items in this list have the same bullet as the first item. | 845 | "Make sure all items in this list have the same bullet as the first item. |
| 845 | Also, fix the indentation." | 846 | Also, fix the indentation." |
| @@ -874,7 +875,8 @@ Also, fix the indentation." | |||
| 874 | (looking-at "\\S-+ *") | 875 | (looking-at "\\S-+ *") |
| 875 | (setq oldbullet (match-string 0)) | 876 | (setq oldbullet (match-string 0)) |
| 876 | (unless (equal bullet oldbullet) (replace-match bullet)) | 877 | (unless (equal bullet oldbullet) (replace-match bullet)) |
| 877 | (org-shift-item-indentation (- (length bullet) (length oldbullet)))))) | 878 | (org-shift-item-indentation (- (length bullet) |
| 879 | (length oldbullet)))))) | ||
| 878 | (org-goto-line line) | 880 | (org-goto-line line) |
| 879 | (org-move-to-column col) | 881 | (org-move-to-column col) |
| 880 | (if (string-match "[0-9]" bullet) | 882 | (if (string-match "[0-9]" bullet) |
| @@ -882,19 +884,20 @@ Also, fix the indentation." | |||
| 882 | 884 | ||
| 883 | (defun org-shift-item-indentation (delta) | 885 | (defun org-shift-item-indentation (delta) |
| 884 | "Shift the indentation in current item by DELTA." | 886 | "Shift the indentation in current item by DELTA." |
| 885 | (save-excursion | 887 | (unless (org-bound-and-true-p org-suppress-item-indentation) |
| 886 | (let ((beg (point-at-bol)) | 888 | (save-excursion |
| 887 | (end (progn (org-end-of-item) (point))) | 889 | (let ((beg (point-at-bol)) |
| 888 | i) | 890 | (end (progn (org-end-of-item) (point))) |
| 889 | (goto-char end) | 891 | i) |
| 890 | (beginning-of-line 0) | 892 | (goto-char end) |
| 891 | (while (> (point) beg) | 893 | (beginning-of-line 0) |
| 892 | (when (looking-at "[ \t]*\\S-") | 894 | (while (> (point) beg) |
| 893 | ;; this is not an empty line | 895 | (when (looking-at "[ \t]*\\S-") |
| 894 | (setq i (org-get-indentation)) | 896 | ;; this is not an empty line |
| 895 | (if (and (> i 0) (> (setq i (+ i delta)) 0)) | 897 | (setq i (org-get-indentation)) |
| 896 | (indent-line-to i))) | 898 | (if (and (> i 0) (> (setq i (+ i delta)) 0)) |
| 897 | (beginning-of-line 0))))) | 899 | (indent-line-to i))) |
| 900 | (beginning-of-line 0)))))) | ||
| 898 | 901 | ||
| 899 | (defun org-beginning-of-item-list () | 902 | (defun org-beginning-of-item-list () |
| 900 | "Go to the beginning of the current item list. | 903 | "Go to the beginning of the current item list. |
| @@ -1040,6 +1043,29 @@ Assumes cursor in item line." | |||
| 1040 | (cons ind-up bullet-up) | 1043 | (cons ind-up bullet-up) |
| 1041 | (cons ind-down bullet-down)))) | 1044 | (cons ind-down bullet-down)))) |
| 1042 | 1045 | ||
| 1046 | (defvar org-tab-ind-state) ; defined in org.el | ||
| 1047 | (defun org-cycle-item-indentation () | ||
| 1048 | (let ((org-suppress-item-indentation t) | ||
| 1049 | (org-adapt-indentation nil)) | ||
| 1050 | (cond | ||
| 1051 | ((and (looking-at "[ \t]*$") | ||
| 1052 | (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) | ||
| 1053 | (setq this-command 'org-cycle-item-indentation) | ||
| 1054 | (if (eq last-command 'org-cycle-item-indentation) | ||
| 1055 | (condition-case nil | ||
| 1056 | (progn (org-outdent-item 1) | ||
| 1057 | (if (equal org-tab-ind-state (org-get-indentation)) | ||
| 1058 | (org-outdent-item 1)) | ||
| 1059 | (end-of-line 1)) | ||
| 1060 | (error | ||
| 1061 | (progn | ||
| 1062 | (while (< (org-get-indentation) org-tab-ind-state) | ||
| 1063 | (progn (org-indent-item 1) (end-of-line 1))) | ||
| 1064 | (setq this-command 'org-cycle)))) | ||
| 1065 | (setq org-tab-ind-state (org-get-indentation)) | ||
| 1066 | (org-indent-item 1)) | ||
| 1067 | t)))) | ||
| 1068 | |||
| 1043 | (defun org-get-bullet () | 1069 | (defun org-get-bullet () |
| 1044 | (save-excursion | 1070 | (save-excursion |
| 1045 | (goto-char (point-at-bol)) | 1071 | (goto-char (point-at-bol)) |
| @@ -1172,7 +1198,7 @@ INDENT is the indentation of the list, as a string." | |||
| 1172 | (goto-char pos))) | 1198 | (goto-char pos))) |
| 1173 | 1199 | ||
| 1174 | (defun org-list-send-list (&optional maybe) | 1200 | (defun org-list-send-list (&optional maybe) |
| 1175 | "Send a tranformed version of this list to the receiver position. | 1201 | "Send a transformed version of this list to the receiver position. |
| 1176 | With argument MAYBE, fail quietly if no transformation is defined for | 1202 | With argument MAYBE, fail quietly if no transformation is defined for |
| 1177 | this list." | 1203 | this list." |
| 1178 | (interactive) | 1204 | (interactive) |
| @@ -1186,8 +1212,8 @@ this list." | |||
| 1186 | (throw 'exit nil) | 1212 | (throw 'exit nil) |
| 1187 | (error "Don't know how to transform this list")))) | 1213 | (error "Don't know how to transform this list")))) |
| 1188 | (let* ((name (match-string 1)) | 1214 | (let* ((name (match-string 1)) |
| 1189 | (item-beginning (org-list-item-beginning)) | ||
| 1190 | (transform (intern (match-string 2))) | 1215 | (transform (intern (match-string 2))) |
| 1216 | (item-beginning (org-list-item-beginning)) | ||
| 1191 | (txt (buffer-substring-no-properties | 1217 | (txt (buffer-substring-no-properties |
| 1192 | (car item-beginning) | 1218 | (car item-beginning) |
| 1193 | (org-list-end (cdr item-beginning)))) | 1219 | (org-list-end (cdr item-beginning)))) |
| @@ -1279,6 +1305,8 @@ Valid parameters PARAMS are | |||
| 1279 | (setq sublist (replace-match cbon t t sublist))) | 1305 | (setq sublist (replace-match cbon t t sublist))) |
| 1280 | (if (string-match "\\[CBOFF\\]" sublist) | 1306 | (if (string-match "\\[CBOFF\\]" sublist) |
| 1281 | (setq sublist (replace-match cboff t t sublist))) | 1307 | (setq sublist (replace-match cboff t t sublist))) |
| 1308 | (if (string-match "\\[-\\]" sublist) | ||
| 1309 | (setq sublist (replace-match "$\\boxminus$" t t sublist))) | ||
| 1282 | (setq rtn (concat rtn istart term ddstart | 1310 | (setq rtn (concat rtn istart term ddstart |
| 1283 | sublist ddend iend isep))) | 1311 | sublist ddend iend isep))) |
| 1284 | (t (setq rtn (concat rtn ;; previous list | 1312 | (t (setq rtn (concat rtn ;; previous list |
diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el index b2abe95ad40..94fe2325dd7 100644 --- a/lisp/org/org-mac-message.el +++ b/lisp/org/org-mac-message.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | ;; Christopher Suckling <suckling at gmail dot com> | 6 | ;; Christopher Suckling <suckling at gmail dot com> |
| 7 | 7 | ||
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; Keywords: outlines, hypermedia, calendar, wp | 9 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index f9d1d9b7124..cdcbe04ab0c 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -121,6 +121,8 @@ We use a macro so that the test can happen at compilation time." | |||
| 121 | "Execute BODY if there is no `org-protected' text property at POS." | 121 | "Execute BODY if there is no `org-protected' text property at POS." |
| 122 | `(unless (get-text-property ,pos 'org-protected) | 122 | `(unless (get-text-property ,pos 'org-protected) |
| 123 | ,@body)) | 123 | ,@body)) |
| 124 | (put 'org-if-unprotected-at 'lisp-indent-function 1) | ||
| 125 | |||
| 124 | 126 | ||
| 125 | (defmacro org-with-remote-undo (_buffer &rest _body) | 127 | (defmacro org-with-remote-undo (_buffer &rest _body) |
| 126 | "Execute BODY while recording undo information in two buffers." | 128 | "Execute BODY while recording undo information in two buffers." |
| @@ -173,7 +175,7 @@ We use a macro so that the test can happen at compilation time." | |||
| 173 | (t (cdr (assq 'default option))))) | 175 | (t (cdr (assq 'default option))))) |
| 174 | 176 | ||
| 175 | (defsubst org-check-external-command (cmd &optional use no-error) | 177 | (defsubst org-check-external-command (cmd &optional use no-error) |
| 176 | "Check if external progam CMD for USE exists, error if not. | 178 | "Check if external program CMD for USE exists, error if not. |
| 177 | When the program does exist, return its path. | 179 | When the program does exist, return its path. |
| 178 | When it does not exist and NO-ERROR is set, return nil. | 180 | When it does not exist and NO-ERROR is set, return nil. |
| 179 | Otherwise, throw an error. The optional argument USE can describe what this | 181 | Otherwise, throw an error. The optional argument USE can describe what this |
diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el index 4542f5be079..6ccc995c158 100644 --- a/lisp/org/org-mew.el +++ b/lisp/org/org-mew.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> | 5 | ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index 3f628962ec4..d70bcea6880 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> | 6 | ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> |
| 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 | ;; |
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index 65d063db7d1..b9e267113d1 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 4 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 5 | ;; Keywords: outlines, hypermedia, calendar, wp | 5 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 6 | ;; Homepage: http://orgmode.org | 6 | ;; Homepage: http://orgmode.org |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; | 8 | ;; |
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -28,20 +28,21 @@ | |||
| 28 | ;; This file contains the code to interact with Richard Moreland's iPhone | 28 | ;; This file contains the code to interact with Richard Moreland's iPhone |
| 29 | ;; application MobileOrg. This code is documented in Appendix B of the | 29 | ;; application MobileOrg. This code is documented in Appendix B of the |
| 30 | ;; Org-mode manual. The code is not specific for the iPhone, however. | 30 | ;; Org-mode manual. The code is not specific for the iPhone, however. |
| 31 | ;; Any external viewer and flagging application that uses the same | 31 | ;; Any external viewer/flagging/editing application that uses the same |
| 32 | ;; conventions could be used. | 32 | ;; conventions could be used. |
| 33 | 33 | ||
| 34 | (require 'org) | 34 | (require 'org) |
| 35 | (require 'org-agenda) | 35 | (require 'org-agenda) |
| 36 | (eval-when-compile (require 'cl)) | ||
| 36 | 37 | ||
| 37 | (defgroup org-mobile nil | 38 | (defgroup org-mobile nil |
| 38 | "Options concerning support for a viewer on a mobile device." | 39 | "Options concerning support for a viewer/editor on a mobile device." |
| 39 | :tag "Org Mobile" | 40 | :tag "Org Mobile" |
| 40 | :group 'org) | 41 | :group 'org) |
| 41 | 42 | ||
| 42 | (defcustom org-mobile-files '(org-agenda-files) | 43 | (defcustom org-mobile-files '(org-agenda-files) |
| 43 | "Files to be staged for MobileOrg. | 44 | "Files to be staged for MobileOrg. |
| 44 | This is basically a list of filesand directories. Files will be staged | 45 | This is basically a list of files and directories. Files will be staged |
| 45 | directly. Directories will be search for files with the extension `.org'. | 46 | directly. Directories will be search for files with the extension `.org'. |
| 46 | In addition to this, the list may also contain the following symbols: | 47 | In addition to this, the list may also contain the following symbols: |
| 47 | 48 | ||
| @@ -68,7 +69,8 @@ org-agenda-text-search-extra-files | |||
| 68 | "The file where captured notes and flags will be appended to. | 69 | "The file where captured notes and flags will be appended to. |
| 69 | During the execution of `org-mobile-pull', the file | 70 | During the execution of `org-mobile-pull', the file |
| 70 | `org-mobile-capture-file' will be emptied it's contents have | 71 | `org-mobile-capture-file' will be emptied it's contents have |
| 71 | been appended to the file given here." | 72 | been appended to the file given here. This file should be in |
| 73 | `org-directory', and not in the staging area or on the web server." | ||
| 72 | :group 'org-mobile | 74 | :group 'org-mobile |
| 73 | :type 'file) | 75 | :type 'file) |
| 74 | 76 | ||
| @@ -88,12 +90,26 @@ should point to this file." | |||
| 88 | :group 'org-mobile | 90 | :group 'org-mobile |
| 89 | :type 'boolean) | 91 | :type 'boolean) |
| 90 | 92 | ||
| 93 | (defcustom org-mobile-force-mobile-change nil | ||
| 94 | "Non-nil means, force the change made on the mobile device. | ||
| 95 | So even if there have been changes to the computer version of the entry, | ||
| 96 | force the new value set on the mobile. | ||
| 97 | When nil, mark the entry from the mobile with an error message. | ||
| 98 | Instead of nil or t, this variable can also be a list of symbols, indicating | ||
| 99 | the editing types for which the mobile version should always dominate." | ||
| 100 | :group 'org-mobile | ||
| 101 | :type '(choice | ||
| 102 | (const :tag "Always" t) | ||
| 103 | (const :tag "Never" nil) | ||
| 104 | (set :greedy t :tag "Specify" | ||
| 105 | (const todo) | ||
| 106 | (const tags) | ||
| 107 | (const priority) | ||
| 108 | (const heading) | ||
| 109 | (const body)))) | ||
| 110 | |||
| 91 | (defcustom org-mobile-action-alist | 111 | (defcustom org-mobile-action-alist |
| 92 | '(("d" . (org-todo 'done)) | 112 | '(("edit" . (org-mobile-edit data old new))) |
| 93 | ("a" . (org-archive-subtree-default)) | ||
| 94 | ("d-a" . (progn (org-todo 'done) (org-archive-subtree-default))) | ||
| 95 | ("todo" . (org-todo data)) | ||
| 96 | ("tags" . (org-set-tags-to data))) | ||
| 97 | "Alist with flags and actions for mobile sync. | 113 | "Alist with flags and actions for mobile sync. |
| 98 | When flagging an entry, MobileOrg will create entries that look like | 114 | When flagging an entry, MobileOrg will create entries that look like |
| 99 | 115 | ||
| @@ -105,12 +121,22 @@ optional. If present, the string after the colon will be passed to the | |||
| 105 | action form as the `data' variable. | 121 | action form as the `data' variable. |
| 106 | The car of each elements of the alist is an actions string. The cdr is | 122 | The car of each elements of the alist is an actions string. The cdr is |
| 107 | an Emacs Lisp form that will be evaluated with the cursor on the headline | 123 | an Emacs Lisp form that will be evaluated with the cursor on the headline |
| 108 | of that entry." | 124 | of that entry. |
| 125 | |||
| 126 | For now, it is not recommended to change this variable." | ||
| 109 | :group 'org-mobile | 127 | :group 'org-mobile |
| 110 | :type '(repeat | 128 | :type '(repeat |
| 111 | (cons (string :tag "Action flag") | 129 | (cons (string :tag "Action flag") |
| 112 | (sexp :tag "Action form")))) | 130 | (sexp :tag "Action form")))) |
| 113 | 131 | ||
| 132 | (defcustom org-mobile-checksum-binary (or (executable-find "shasum") | ||
| 133 | (executable-find "sha1sum") | ||
| 134 | (executable-find "md5sum") | ||
| 135 | (executable-find "md5")) | ||
| 136 | "Executable used for computing checksums of agenda files." | ||
| 137 | :group 'org-mobile | ||
| 138 | :type 'string) | ||
| 139 | |||
| 114 | (defvar org-mobile-pre-push-hook nil | 140 | (defvar org-mobile-pre-push-hook nil |
| 115 | "Hook run before running `org-mobile-push'. | 141 | "Hook run before running `org-mobile-push'. |
| 116 | This could be used to clean up `org-mobile-directory', for example to | 142 | This could be used to clean up `org-mobile-directory', for example to |
| @@ -140,36 +166,46 @@ capture file `mobileorg.org' back to the WebDAV directory, for example | |||
| 140 | using `rsync' or `scp'.") | 166 | using `rsync' or `scp'.") |
| 141 | 167 | ||
| 142 | (defvar org-mobile-last-flagged-files nil | 168 | (defvar org-mobile-last-flagged-files nil |
| 143 | "List of files containing entreis flagged in the latest pull.") | 169 | "List of files containing entries flagged in the latest pull.") |
| 144 | 170 | ||
| 145 | (defvar org-mobile-files-alist nil) | 171 | (defvar org-mobile-files-alist nil) |
| 146 | (defvar org-mobile-checksum-files nil) | 172 | (defvar org-mobile-checksum-files nil) |
| 147 | 173 | ||
| 148 | (defun org-mobile-prepare-file-lists () | 174 | (defun org-mobile-prepare-file-lists () |
| 149 | (setq org-mobile-files-alist (org-mobile-files-alist)) | 175 | (setq org-mobile-files-alist (org-mobile-files-alist)) |
| 150 | (setq org-mobile-checksum-files (mapcar 'cdr org-mobile-files-alist))) | 176 | (setq org-mobile-checksum-files nil)) |
| 151 | 177 | ||
| 152 | (defun org-mobile-files-alist () | 178 | (defun org-mobile-files-alist () |
| 153 | "Expand the list in `org-mobile-files' to a list of existing files." | 179 | "Expand the list in `org-mobile-files' to a list of existing files." |
| 154 | (let* ((files | 180 | (let* ((include-archives |
| 155 | (apply 'append (mapcar | 181 | (and (member 'org-agenda-text-search-extra-files org-mobile-files) |
| 156 | (lambda (f) | 182 | (member 'agenda-archives org-agenda-text-search-extra-files) |
| 157 | (cond | 183 | t)) |
| 158 | ((eq f 'org-agenda-files) (org-agenda-files t)) | 184 | (files |
| 159 | ((eq f 'org-agenda-text-search-extra-files) | 185 | (apply 'append |
| 160 | org-agenda-text-search-extra-files) | 186 | (mapcar |
| 161 | ((and (stringp f) (file-directory-p f)) | 187 | (lambda (f) |
| 162 | (directory-files f 'full "\\.org\\'")) | 188 | (cond |
| 163 | ((and (stringp f) (file-exists-p f)) | 189 | ((eq f 'org-agenda-files) |
| 164 | (list f)) | 190 | (org-agenda-files t include-archives)) |
| 165 | (t nil))) | 191 | ((eq f 'org-agenda-text-search-extra-files) |
| 166 | org-mobile-files))) | 192 | (delq 'agenda-archives |
| 193 | (copy-sequence | ||
| 194 | org-agenda-text-search-extra-files))) | ||
| 195 | ((and (stringp f) (file-directory-p f)) | ||
| 196 | (directory-files f 'full "\\.org\\'")) | ||
| 197 | ((and (stringp f) (file-exists-p f)) | ||
| 198 | (list f)) | ||
| 199 | (t nil))) | ||
| 200 | org-mobile-files))) | ||
| 167 | (orgdir-uname (file-name-as-directory (file-truename org-directory))) | 201 | (orgdir-uname (file-name-as-directory (file-truename org-directory))) |
| 168 | (orgdir-re (concat "\\`" (regexp-quote orgdir-uname))) | 202 | (orgdir-re (concat "\\`" (regexp-quote orgdir-uname))) |
| 169 | uname seen rtn file link-name) | 203 | uname seen rtn file link-name) |
| 170 | ;; Make the files unique, and determine the name under which they will | 204 | ;; Make the files unique, and determine the name under which they will |
| 171 | ;; be listed. | 205 | ;; be listed. |
| 172 | (while (setq file (pop files)) | 206 | (while (setq file (pop files)) |
| 207 | (if (not (file-name-absolute-p file)) | ||
| 208 | (setq file (expand-file-name file org-directory))) | ||
| 173 | (setq uname (file-truename file)) | 209 | (setq uname (file-truename file)) |
| 174 | (unless (member uname seen) | 210 | (unless (member uname seen) |
| 175 | (push uname seen) | 211 | (push uname seen) |
| @@ -185,16 +221,41 @@ using `rsync' or `scp'.") | |||
| 185 | This will create the index file, copy all agenda files there, and also | 221 | This will create the index file, copy all agenda files there, and also |
| 186 | create all custom agenda views, for upload to the mobile phone." | 222 | create all custom agenda views, for upload to the mobile phone." |
| 187 | (interactive) | 223 | (interactive) |
| 188 | (org-mobile-check-setup) | 224 | (let ((a-buffer (get-buffer org-agenda-buffer-name))) |
| 189 | (org-mobile-prepare-file-lists) | 225 | (let ((org-agenda-buffer-name "*SUMO*") |
| 190 | (run-hooks 'org-mobile-pre-push-hook) | 226 | (org-agenda-filter org-agenda-filter) |
| 191 | (org-mobile-create-sumo-agenda) | 227 | (org-agenda-redo-command org-agenda-redo-command)) |
| 192 | (org-save-all-org-buffers) ; to save any IDs created by this process | 228 | (save-excursion |
| 193 | (org-mobile-copy-agenda-files) | 229 | (save-window-excursion |
| 194 | (org-mobile-create-index-file) | 230 | (org-mobile-check-setup) |
| 195 | (org-mobile-write-checksums) | 231 | (org-mobile-prepare-file-lists) |
| 196 | (run-hooks 'org-mobile-post-push-hook) | 232 | (run-hooks 'org-mobile-pre-push-hook) |
| 233 | (message "Creating agendas...") | ||
| 234 | (let ((inhibit-redisplay t)) (org-mobile-create-sumo-agenda)) | ||
| 235 | (message "Creating agendas...done") | ||
| 236 | (org-save-all-org-buffers) ; to save any IDs created by this process | ||
| 237 | (message "Copying files...") | ||
| 238 | (org-mobile-copy-agenda-files) | ||
| 239 | (message "Writing index file...") | ||
| 240 | (org-mobile-create-index-file) | ||
| 241 | (message "Writing checksums...") | ||
| 242 | (org-mobile-write-checksums) | ||
| 243 | (run-hooks 'org-mobile-post-push-hook)))) | ||
| 244 | (redraw-display) | ||
| 245 | (when (and a-buffer (buffer-live-p a-buffer)) | ||
| 246 | (if (not (get-buffer-window a-buffer)) | ||
| 247 | (kill-buffer a-buffer) | ||
| 248 | (let ((cw (selected-window))) | ||
| 249 | (select-window (get-buffer-window a-buffer)) | ||
| 250 | |||
| 251 | (org-agenda-redo) | ||
| 252 | (select-window cw))))) | ||
| 197 | (message "Files for mobile viewer staged")) | 253 | (message "Files for mobile viewer staged")) |
| 254 | |||
| 255 | (defvar org-mobile-before-process-capture-hook nil | ||
| 256 | "Hook that is run after content was moved to `org-mobile-inbox-for-pull'. | ||
| 257 | The inbox file is in the current buffer, and the buffer is arrowed to the | ||
| 258 | new captured data.") | ||
| 198 | 259 | ||
| 199 | ;;;###autoload | 260 | ;;;###autoload |
| 200 | (defun org-mobile-pull () | 261 | (defun org-mobile-pull () |
| @@ -208,37 +269,52 @@ agenda view showing the flagged items." | |||
| 208 | (if (not (markerp insertion-marker)) | 269 | (if (not (markerp insertion-marker)) |
| 209 | (message "No new items") | 270 | (message "No new items") |
| 210 | (org-with-point-at insertion-marker | 271 | (org-with-point-at insertion-marker |
| 211 | (org-mobile-apply-flags (point) (point-max))) | 272 | (save-restriction |
| 273 | (narrow-to-region (point) (point-max)) | ||
| 274 | (run-hooks 'org-mobile-before-process-capture-hook))) | ||
| 275 | (org-with-point-at insertion-marker | ||
| 276 | (org-mobile-apply (point) (point-max))) | ||
| 212 | (move-marker insertion-marker nil) | 277 | (move-marker insertion-marker nil) |
| 213 | (run-hooks 'org-mobile-post-pull-hook) | 278 | (run-hooks 'org-mobile-post-pull-hook) |
| 214 | (when org-mobile-last-flagged-files | 279 | (when org-mobile-last-flagged-files |
| 215 | ;; Make an agenda view of flagged entries, but only in the files | 280 | ;; Make an agenda view of flagged entries, but only in the files |
| 216 | ;; where stuff has been added. | 281 | ;; where stuff has been added. |
| 217 | (put 'org-agenda-files 'org-restrict org-mobile-last-flagged-files) | 282 | (put 'org-agenda-files 'org-restrict org-mobile-last-flagged-files) |
| 218 | (let ((org-agenda-keep-restriced-file-list t)) | 283 | (let ((org-agenda-keep-restricted-file-list t)) |
| 219 | (org-agenda nil "?")))))) | 284 | (org-agenda nil "?")))))) |
| 220 | 285 | ||
| 221 | (defun org-mobile-check-setup () | 286 | (defun org-mobile-check-setup () |
| 222 | "Check if org-mobile-directory has been set up." | 287 | "Check if org-mobile-directory has been set up." |
| 223 | (when (or (not org-mobile-directory) | 288 | (unless (and org-directory |
| 224 | (not (stringp org-mobile-directory)) | 289 | (stringp org-directory) |
| 225 | (not (string-match "\\S-" org-mobile-directory)) | 290 | (string-match "\\S-" org-directory) |
| 226 | (not (file-exists-p org-mobile-directory)) | 291 | (file-exists-p org-directory) |
| 227 | (not (file-directory-p org-mobile-directory))) | 292 | (file-directory-p org-directory)) |
| 293 | (error | ||
| 294 | "Please set `org-directory' to the directory where your org files live")) | ||
| 295 | (unless (and org-mobile-directory | ||
| 296 | (stringp org-mobile-directory) | ||
| 297 | (string-match "\\S-" org-mobile-directory) | ||
| 298 | (file-exists-p org-mobile-directory) | ||
| 299 | (file-directory-p org-mobile-directory)) | ||
| 228 | (error | 300 | (error |
| 229 | "Variable `org-mobile-directory' must point to an existing directory")) | 301 | "Variable `org-mobile-directory' must point to an existing directory")) |
| 230 | (when (or (not org-mobile-inbox-for-pull) | 302 | (unless (and org-mobile-inbox-for-pull |
| 231 | (not (stringp org-mobile-inbox-for-pull)) | 303 | (stringp org-mobile-inbox-for-pull) |
| 232 | (not (string-match "\\S-" org-mobile-inbox-for-pull)) | 304 | (string-match "\\S-" org-mobile-inbox-for-pull) |
| 233 | (not (file-exists-p | 305 | (file-exists-p |
| 234 | (file-name-directory org-mobile-inbox-for-pull)))) | 306 | (file-name-directory org-mobile-inbox-for-pull))) |
| 235 | (error | 307 | (error |
| 236 | "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))) | 308 | "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))) |
| 237 | 309 | ||
| 238 | (defun org-mobile-create-index-file () | 310 | (defun org-mobile-create-index-file () |
| 239 | "Write the index file in the WebDAV directory." | 311 | "Write the index file in the WebDAV directory." |
| 240 | (let ((files-alist org-mobile-files-alist) | 312 | (let ((files-alist (sort (copy-sequence org-mobile-files-alist) |
| 241 | file link-name todo-kwds done-kwds tags drawers entry) | 313 | (lambda (a b) (string< (cdr a) (cdr b))))) |
| 314 | (def-todo (default-value 'org-todo-keywords)) | ||
| 315 | (def-tags (default-value 'org-tag-alist)) | ||
| 316 | file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds) | ||
| 317 | |||
| 242 | (org-prepare-agenda-buffers (mapcar 'car files-alist)) | 318 | (org-prepare-agenda-buffers (mapcar 'car files-alist)) |
| 243 | (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) | 319 | (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) |
| 244 | (setq todo-kwds (org-delete-all | 320 | (setq todo-kwds (org-delete-all |
| @@ -256,61 +332,87 @@ agenda view showing the flagged items." | |||
| 256 | org-tag-alist-for-agenda)))) | 332 | org-tag-alist-for-agenda)))) |
| 257 | (with-temp-file | 333 | (with-temp-file |
| 258 | (expand-file-name org-mobile-index-file org-mobile-directory) | 334 | (expand-file-name org-mobile-index-file org-mobile-directory) |
| 259 | (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | " | 335 | (while (setq entry (pop def-todo)) |
| 260 | (mapconcat 'identity done-kwds " ") "\n" | 336 | (insert "#+READONLY\n") |
| 261 | "#+TAGS: " (mapconcat 'identity tags " ") "\n" | 337 | (setq kwds (mapcar (lambda (x) (if (string-match "(" x) |
| 262 | "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n") | 338 | (substring x 0 (match-beginning 0)) |
| 263 | (insert "* [[file:agendas.org][Agenda Views]]\n") | 339 | x)) |
| 340 | (cdr entry))) | ||
| 341 | (insert "#+TODO: " (mapconcat 'identity kwds " ") "\n") | ||
| 342 | (setq dwds (member "|" kwds) | ||
| 343 | twds (org-delete-all dwds kwds) | ||
| 344 | todo-kwds (org-delete-all twds todo-kwds) | ||
| 345 | done-kwds (org-delete-all dwds done-kwds))) | ||
| 346 | (when (or todo-kwds done-kwds) | ||
| 347 | (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | " | ||
| 348 | (mapconcat 'identity done-kwds " ") "\n")) | ||
| 349 | (setq def-tags (mapcar | ||
| 350 | (lambda (x) | ||
| 351 | (cond ((null x) nil) | ||
| 352 | ((stringp x) x) | ||
| 353 | ((eq (car x) :startgroup) "{") | ||
| 354 | ((eq (car x) :endgroup) "}") | ||
| 355 | ((eq (car x) :newline) nil) | ||
| 356 | ((listp x) (car x)) | ||
| 357 | (t nil))) | ||
| 358 | def-tags)) | ||
| 359 | (setq def-tags (delq nil def-tags)) | ||
| 360 | (setq tags (org-delete-all def-tags tags)) | ||
| 361 | (setq tags (sort tags (lambda (a b) (string< (downcase a) (downcase b))))) | ||
| 362 | (setq tags (append def-tags tags nil)) | ||
| 363 | (insert "#+TAGS: " (mapconcat 'identity tags " ") "\n") | ||
| 364 | (insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n") | ||
| 365 | (insert "#+ALLPRIORITIES: A B C" "\n") | ||
| 366 | (when (file-exists-p (expand-file-name | ||
| 367 | org-mobile-directory "agendas.org")) | ||
| 368 | (insert "* [[file:agendas.org][Agenda Views]]\n")) | ||
| 264 | (while (setq entry (pop files-alist)) | 369 | (while (setq entry (pop files-alist)) |
| 265 | (setq file (car entry) | 370 | (setq file (car entry) |
| 266 | link-name (cdr entry)) | 371 | link-name (cdr entry)) |
| 267 | (insert (format "* [[file:%s][%s]]\n" | 372 | (insert (format "* [[file:%s][%s]]\n" |
| 268 | link-name link-name))) | 373 | link-name link-name))) |
| 269 | (insert (format "* [[file:%s][Captured before last sync]]\n" | 374 | (push (cons org-mobile-index-file (md5 (buffer-string))) |
| 270 | org-mobile-capture-file))))) | 375 | org-mobile-checksum-files)))) |
| 271 | 376 | ||
| 272 | (defun org-mobile-copy-agenda-files () | 377 | (defun org-mobile-copy-agenda-files () |
| 273 | "Copy all agenda files to the stage or WebDAV directory." | 378 | "Copy all agenda files to the stage or WebDAV directory." |
| 274 | (let ((files-alist org-mobile-files-alist) | 379 | (let ((files-alist org-mobile-files-alist) |
| 275 | file buf entry link-name target-path target-dir) | 380 | file buf entry link-name target-path target-dir check) |
| 276 | (while (setq entry (pop files-alist)) | 381 | (while (setq entry (pop files-alist)) |
| 277 | (setq file (car entry) link-name (cdr entry)) | 382 | (setq file (car entry) link-name (cdr entry)) |
| 278 | (when (file-exists-p file) | 383 | (when (file-exists-p file) |
| 279 | (setq target-path (expand-file-name link-name org-mobile-directory) | 384 | (setq target-path (expand-file-name link-name org-mobile-directory) |
| 280 | target-dir (file-name-directory target-path)) | 385 | target-dir (file-name-directory target-path)) |
| 281 | (unless (file-directory-p target-dir) | 386 | (unless (file-directory-p target-dir) |
| 282 | (make-directory target-dir 'parents) | 387 | (make-directory target-dir 'parents)) |
| 283 | (copy-file file target-path 'ok-if-exists)))) | 388 | (copy-file file target-path 'ok-if-exists) |
| 389 | (setq check (shell-command-to-string | ||
| 390 | (concat org-mobile-checksum-binary " " | ||
| 391 | (shell-quote-argument (expand-file-name file))))) | ||
| 392 | (when (string-match "[a-fA-F0-9]\\{30,40\\}" check) | ||
| 393 | (push (cons link-name (match-string 0 check)) | ||
| 394 | org-mobile-checksum-files)))) | ||
| 284 | (setq file (expand-file-name org-mobile-capture-file | 395 | (setq file (expand-file-name org-mobile-capture-file |
| 285 | org-mobile-directory)) | 396 | org-mobile-directory)) |
| 286 | (unless (file-exists-p file) | 397 | (save-excursion |
| 287 | (save-excursion | 398 | (setq buf (find-file file)) |
| 288 | (setq buf (find-file file)) | 399 | (and (= (point-min) (point-max)) (insert "\n")) |
| 289 | (insert "\n") | 400 | (save-buffer) |
| 290 | (save-buffer)) | 401 | (push (cons org-mobile-capture-file (md5 (buffer-string))) |
| 291 | (kill-buffer buf)))) | 402 | org-mobile-checksum-files)) |
| 403 | (kill-buffer buf))) | ||
| 292 | 404 | ||
| 293 | (defun org-mobile-write-checksums () | 405 | (defun org-mobile-write-checksums () |
| 294 | "Create checksums for all files in `org-mobile-directory'. | 406 | "Create checksums for all files in `org-mobile-directory'. |
| 295 | The table of checksums is written to the file mobile-checksums." | 407 | The table of checksums is written to the file mobile-checksums." |
| 296 | (let ((cmd (cond ((executable-find "shasum")) | 408 | (let ((sumfile (expand-file-name "checksums.dat" org-mobile-directory)) |
| 297 | ((executable-find "sha1sum")) | 409 | (files org-mobile-checksum-files) |
| 298 | ((executable-find "md5sum")) | 410 | entry file sum) |
| 299 | ((executable-find "md5")))) | 411 | (with-temp-file sumfile |
| 300 | (files org-mobile-checksum-files)) | 412 | (set-buffer-file-coding-system 'undecided-unix nil) |
| 301 | (if (not cmd) | 413 | (while (setq entry (pop files)) |
| 302 | (message "Checksums could not be generated: no executable") | 414 | (setq file (car entry) sum (cdr entry)) |
| 303 | (with-temp-buffer | 415 | (insert (format "%s %s\n" sum file)))))) |
| 304 | (cd org-mobile-directory) | ||
| 305 | (if (file-exists-p "agendas.org") | ||
| 306 | (push "agendas.org" files)) | ||
| 307 | (if (file-exists-p "mobileorg.org") | ||
| 308 | (push "mobileorg.org" files)) | ||
| 309 | (setq cmd (concat cmd " " (mapconcat 'shell-quote-argument files " ") | ||
| 310 | " > checksums.dat")) | ||
| 311 | (if (equal 0 (shell-command cmd)) | ||
| 312 | (message "Checksums written") | ||
| 313 | (message "Checksums could not be generated")))))) | ||
| 314 | 416 | ||
| 315 | (defun org-mobile-sumo-agenda-command () | 417 | (defun org-mobile-sumo-agenda-command () |
| 316 | "Return an agenda custom command that comprises all custom commands." | 418 | "Return an agenda custom command that comprises all custom commands." |
| @@ -342,10 +444,10 @@ The table of checksums is written to the file mobile-checksums." | |||
| 342 | settings (nth 4 e)) | 444 | settings (nth 4 e)) |
| 343 | (setq settings | 445 | (setq settings |
| 344 | (cons (list 'org-agenda-title-append | 446 | (cons (list 'org-agenda-title-append |
| 345 | (concat "<break>KEYS=" key " TITLE: " | 447 | (concat "<after>KEYS=" key " TITLE: " |
| 346 | (if (and (stringp desc) (> (length desc) 0)) | 448 | (if (and (stringp desc) (> (length desc) 0)) |
| 347 | desc (symbol-name type)) | 449 | desc (symbol-name type)) |
| 348 | " " match)) | 450 | " " match "</after>")) |
| 349 | settings)) | 451 | settings)) |
| 350 | (push (list type match settings) new)) | 452 | (push (list type match settings) new)) |
| 351 | ((symbolp (nth 2 e)) | 453 | ((symbolp (nth 2 e)) |
| @@ -360,12 +462,78 @@ The table of checksums is written to the file mobile-checksums." | |||
| 360 | (setq settings (append gsettings settings)) | 462 | (setq settings (append gsettings settings)) |
| 361 | (setq settings | 463 | (setq settings |
| 362 | (cons (list 'org-agenda-title-append | 464 | (cons (list 'org-agenda-title-append |
| 363 | (concat "<break>KEYS=" gkey "#" (number-to-string | 465 | (concat "<after>KEYS=" gkey "#" (number-to-string |
| 364 | (setq cnt (1+ cnt))) | 466 | (setq cnt (1+ cnt))) |
| 365 | " TITLE: " gdesc " " match)) | 467 | " TITLE: " gdesc " " match "</after>")) |
| 366 | settings)) | 468 | settings)) |
| 367 | (push (list type match settings) new))))) | 469 | (push (list type match settings) new))))) |
| 368 | (list "X" "SUMO" (reverse new) nil))) | 470 | (and new (list "X" "SUMO" (reverse new) |
| 471 | '((org-agenda-compact-blocks nil)))))) | ||
| 472 | |||
| 473 | (defvar org-mobile-creating-agendas nil) | ||
| 474 | (defun org-mobile-write-agenda-for-mobile (file) | ||
| 475 | (let ((all (buffer-string)) in-date id pl prefix line app short m sexp) | ||
| 476 | (with-temp-file file | ||
| 477 | (org-mode) | ||
| 478 | (insert "#+READONLY\n") | ||
| 479 | (insert all) | ||
| 480 | (goto-char (point-min)) | ||
| 481 | (while (not (eobp)) | ||
| 482 | (cond | ||
| 483 | ((looking-at "[ \t]*$")) ; keep empty lines | ||
| 484 | ((looking-at "=+$") | ||
| 485 | ;; remove underlining | ||
| 486 | (delete-region (point) (point-at-eol))) | ||
| 487 | ((get-text-property (point) 'org-agenda-structural-header) | ||
| 488 | (setq in-date nil) | ||
| 489 | (setq app (get-text-property (point) | ||
| 490 | 'org-agenda-title-append)) | ||
| 491 | (setq short (get-text-property (point) | ||
| 492 | 'short-heading)) | ||
| 493 | (when (and short (looking-at ".+")) | ||
| 494 | (replace-match short) | ||
| 495 | (beginning-of-line 1)) | ||
| 496 | (when app | ||
| 497 | (end-of-line 1) | ||
| 498 | (insert app) | ||
| 499 | (beginning-of-line 1)) | ||
| 500 | (insert "* ")) | ||
| 501 | ((get-text-property (point) 'org-agenda-date-header) | ||
| 502 | (setq in-date t) | ||
| 503 | (insert "** ")) | ||
| 504 | ((setq m (or (get-text-property (point) 'org-hd-marker) | ||
| 505 | (get-text-property (point) 'org-marker))) | ||
| 506 | (setq sexp (member (get-text-property (point) 'type) | ||
| 507 | '("diary" "sexp"))) | ||
| 508 | (if (setq pl (get-text-property (point) 'prefix-length)) | ||
| 509 | (progn | ||
| 510 | (setq prefix (org-trim (buffer-substring | ||
| 511 | (point) (+ (point) pl))) | ||
| 512 | line (org-trim (buffer-substring | ||
| 513 | (+ (point) pl) | ||
| 514 | (point-at-eol)))) | ||
| 515 | (delete-region (point-at-bol) (point-at-eol)) | ||
| 516 | (insert line "<before>" prefix "</before>") | ||
| 517 | (beginning-of-line 1)) | ||
| 518 | (and (looking-at "[ \t]+") (replace-match ""))) | ||
| 519 | (insert (if in-date "*** " "** ")) | ||
| 520 | (end-of-line 1) | ||
| 521 | (insert "\n") | ||
| 522 | (unless sexp | ||
| 523 | (insert (org-agenda-get-some-entry-text | ||
| 524 | m 10 " " 'planning) | ||
| 525 | "\n") | ||
| 526 | (when (setq id | ||
| 527 | (if (org-bound-and-true-p | ||
| 528 | org-mobile-force-id-on-agenda-items) | ||
| 529 | (org-id-get m 'create) | ||
| 530 | (org-entry-get m "ID"))) | ||
| 531 | (insert " :PROPERTIES:\n :ORIGINAL_ID: " id | ||
| 532 | "\n :END:\n"))))) | ||
| 533 | (beginning-of-line 2)) | ||
| 534 | (push (cons (file-name-nondirectory file) (md5 (buffer-string))) | ||
| 535 | org-mobile-checksum-files)) | ||
| 536 | (message "Agenda written to Org file %s" file))) | ||
| 369 | 537 | ||
| 370 | ;;;###autoload | 538 | ;;;###autoload |
| 371 | (defun org-mobile-create-sumo-agenda () | 539 | (defun org-mobile-create-sumo-agenda () |
| @@ -373,17 +541,19 @@ The table of checksums is written to the file mobile-checksums." | |||
| 373 | (interactive) | 541 | (interactive) |
| 374 | (let* ((file (expand-file-name "agendas.org" | 542 | (let* ((file (expand-file-name "agendas.org" |
| 375 | org-mobile-directory)) | 543 | org-mobile-directory)) |
| 544 | (sumo (org-mobile-sumo-agenda-command)) | ||
| 376 | (org-agenda-custom-commands | 545 | (org-agenda-custom-commands |
| 377 | (list (append (org-mobile-sumo-agenda-command) | 546 | (list (append sumo (list (list file))))) |
| 378 | (list (list file)))))) | 547 | (org-mobile-creating-agendas t)) |
| 379 | (unless (file-writable-p file) | 548 | (unless (file-writable-p file) |
| 380 | (error "Cannot write to file %s" file)) | 549 | (error "Cannot write to file %s" file)) |
| 381 | (org-store-agenda-views))) | 550 | (when sumo |
| 551 | (org-store-agenda-views)))) | ||
| 382 | 552 | ||
| 383 | (defun org-mobile-move-capture () | 553 | (defun org-mobile-move-capture () |
| 384 | "Move the contents of the capture file to the inbox file. | 554 | "Move the contents of the capture file to the inbox file. |
| 385 | Return a marker to the location where the new content has been added. | 555 | Return a marker to the location where the new content has been added. |
| 386 | If nothing new has beed added, return nil." | 556 | If nothing new has been added, return nil." |
| 387 | (interactive) | 557 | (interactive) |
| 388 | (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) | 558 | (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) |
| 389 | (capture-buffer (find-file-noselect | 559 | (capture-buffer (find-file-noselect |
| @@ -404,71 +574,180 @@ If nothing new has beed added, return nil." | |||
| 404 | (save-buffer) | 574 | (save-buffer) |
| 405 | (set-buffer capture-buffer) | 575 | (set-buffer capture-buffer) |
| 406 | (erase-buffer) | 576 | (erase-buffer) |
| 407 | (save-buffer))) | 577 | (save-buffer) |
| 578 | (org-mobile-update-checksum-for-capture-file (buffer-string)))) | ||
| 408 | (kill-buffer capture-buffer) | 579 | (kill-buffer capture-buffer) |
| 409 | (if not-empty insertion-point))) | 580 | (if not-empty insertion-point))) |
| 410 | 581 | ||
| 411 | (defun org-mobile-apply-flags (&optional beg end) | 582 | (defun org-mobile-update-checksum-for-capture-file (buffer-string) |
| 412 | "Apply all flags in the current buffer. | 583 | (let* ((file (expand-file-name "checksums.dat" org-mobile-directory)) |
| 584 | (buffer (find-file-noselect file))) | ||
| 585 | (when buffer | ||
| 586 | (with-current-buffer buffer | ||
| 587 | (when (re-search-forward (concat "\\([0-9a-fA-F]\\{30,\\}\\).*?" | ||
| 588 | (regexp-quote org-mobile-capture-file) | ||
| 589 | "[ \t]*$") nil t) | ||
| 590 | (goto-char (match-beginning 1)) | ||
| 591 | (delete-region (match-beginning 1) (match-end 1)) | ||
| 592 | (insert (md5 buffer-string)) | ||
| 593 | (save-buffer))) | ||
| 594 | (kill-buffer buffer)))) | ||
| 595 | |||
| 596 | (defun org-mobile-apply (&optional beg end) | ||
| 597 | "Apply all change requests in the current buffer. | ||
| 413 | If BEG and END are given, only do this in that region." | 598 | If BEG and END are given, only do this in that region." |
| 414 | (interactive) | 599 | (interactive) |
| 415 | (require 'org-archive) | 600 | (require 'org-archive) |
| 416 | (setq org-mobile-last-flagged-files nil) | 601 | (setq org-mobile-last-flagged-files nil) |
| 417 | (setq beg (or beg (point-min)) end (or end (point-max))) | 602 | (setq beg (or beg (point-min)) end (or end (point-max))) |
| 603 | |||
| 604 | ;; Remove all Note IDs | ||
| 418 | (goto-char beg) | 605 | (goto-char beg) |
| 606 | (while (re-search-forward "^\\*\\* Note ID: [-0-9A-F]+[ \t]*\n" end t) | ||
| 607 | (replace-match "")) | ||
| 608 | |||
| 609 | ;; Find all the referenced entries, without making any changes yet | ||
| 419 | (let ((marker (make-marker)) | 610 | (let ((marker (make-marker)) |
| 420 | (org-inhibit-logging 'note) | 611 | (bos-marker (make-marker)) |
| 421 | (end (move-marker (make-marker) end)) | 612 | (end (move-marker (make-marker) end)) |
| 422 | action data id id-pos cmd text) | 613 | (cnt-new 0) |
| 614 | (cnt-edit 0) | ||
| 615 | (cnt-flag 0) | ||
| 616 | (cnt-error 0) | ||
| 617 | buf-list | ||
| 618 | id-pos org-mobile-error) | ||
| 619 | |||
| 620 | ;; Count the new captures | ||
| 621 | (goto-char beg) | ||
| 622 | (while (re-search-forward "^\\* \\(.*\\)" end t) | ||
| 623 | (and (>= (- (match-end 1) (match-beginning 1)) 2) | ||
| 624 | (not (equal (downcase (substring (match-string 1) 0 2)) "f(")) | ||
| 625 | (incf cnt-new))) | ||
| 626 | |||
| 627 | (goto-char beg) | ||
| 423 | (while (re-search-forward | 628 | (while (re-search-forward |
| 424 | "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[id:\\([^]\n ]+\\)" end t) | 629 | "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[\\(\\(id\\|olp\\):\\([^]\n]+\\)\\)" end t) |
| 425 | (goto-char (- (match-beginning 1) 2)) | 630 | (setq id-pos (condition-case msg |
| 631 | (org-mobile-locate-entry (match-string 4)) | ||
| 632 | (error (nth 1 msg)))) | ||
| 633 | (when (and (markerp id-pos) | ||
| 634 | (not (member (marker-buffer id-pos) buf-list))) | ||
| 635 | (org-mobile-timestamp-buffer (marker-buffer id-pos)) | ||
| 636 | (push (marker-buffer id-pos) buf-list)) | ||
| 637 | |||
| 638 | (if (or (not id-pos) (stringp id-pos)) | ||
| 639 | (progn | ||
| 640 | (goto-char (+ 2 (point-at-bol))) | ||
| 641 | (insert id-pos " ") | ||
| 642 | (incf cnt-error)) | ||
| 643 | (add-text-properties (point-at-bol) (point-at-eol) | ||
| 644 | (list 'org-mobile-marker | ||
| 645 | (or id-pos "Linked entry not found"))))) | ||
| 646 | |||
| 647 | ;; OK, now go back and start applying | ||
| 648 | (goto-char beg) | ||
| 649 | (while (re-search-forward "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)" end t) | ||
| 426 | (catch 'next | 650 | (catch 'next |
| 427 | (setq action (match-string 1) | 651 | (setq id-pos (get-text-property (point-at-bol) 'org-mobile-marker)) |
| 428 | data (and (match-end 3) (match-string 3)) | 652 | (if (not (markerp id-pos)) |
| 429 | id (match-string 4) | 653 | (progn |
| 430 | cmd (if (equal action "") | 654 | (incf cnt-error) |
| 431 | '(progn | 655 | (insert "UNKNOWN PROBLEM")) |
| 432 | (org-toggle-tag "FLAGGED" 'on) | 656 | (let* ((action (match-string 1)) |
| 433 | (and text (org-entry-put nil "THEFLAGGINGNOTE" text))) | 657 | (data (and (match-end 3) (match-string 3))) |
| 434 | (cdr (assoc action org-mobile-action-alist))) | 658 | (bos (point-at-bol)) |
| 435 | text (org-trim (buffer-substring (1+ (point-at-eol)) | 659 | (eos (save-excursion (org-end-of-subtree t t))) |
| 436 | (save-excursion | 660 | (cmd (if (equal action "") |
| 437 | (org-end-of-subtree t)))) | 661 | '(progn |
| 438 | id-pos (org-id-find id 'marker)) | 662 | (incf cnt-flag) |
| 439 | (if (> (length text) 0) | 663 | (org-toggle-tag "FLAGGED" 'on) |
| 440 | ;; Make TEXT into a single line, to fit into a property | 664 | (and note |
| 441 | (setq text (mapconcat 'identity | 665 | (org-entry-put nil "THEFLAGGINGNOTE" note))) |
| 442 | (org-split-string text "\n") | 666 | (incf cnt-edit) |
| 443 | "\\n")) | 667 | (cdr (assoc action org-mobile-action-alist)))) |
| 444 | (setq text nil)) | 668 | (note (and (equal action "") |
| 445 | (unless id-pos | 669 | (buffer-substring (1+ (point-at-eol)) eos))) |
| 446 | (insert "BAD ID REFERENCE ") | 670 | (org-inhibit-logging 'note) ;; Do not take notes interactively |
| 447 | (throw 'next t)) | 671 | old new) |
| 448 | (unless cmd | 672 | (goto-char bos) |
| 449 | (insert "BAD FLAG ") | 673 | (move-marker bos-marker (point)) |
| 450 | (throw 'next t)) | 674 | (if (re-search-forward "^** Old value[ \t]*$" eos t) |
| 451 | (move-marker marker (point)) | 675 | (setq old (buffer-substring |
| 452 | (save-excursion | 676 | (1+ (match-end 0)) |
| 453 | (condition-case nil | 677 | (progn (outline-next-heading) (point))))) |
| 454 | (org-with-point-at id-pos | 678 | (if (re-search-forward "^** New value[ \t]*$" eos t) |
| 455 | (progn | 679 | (setq new (buffer-substring |
| 680 | (1+ (match-end 0)) | ||
| 681 | (progn (outline-next-heading) | ||
| 682 | (if (eobp) (org-back-over-empty-lines)) | ||
| 683 | (point))))) | ||
| 684 | (setq old (and old (if (string-match "\\S-" old) old nil))) | ||
| 685 | (setq new (and new (if (string-match "\\S-" new) new nil))) | ||
| 686 | (if (and note (> (length note) 0)) | ||
| 687 | ;; Make Note into a single line, to fit into a property | ||
| 688 | (setq note (mapconcat 'identity | ||
| 689 | (org-split-string (org-trim note) "\n") | ||
| 690 | "\\n"))) | ||
| 691 | (unless (equal data "body") | ||
| 692 | (setq new (and new (org-trim new)) | ||
| 693 | old (and old (org-trim old)))) | ||
| 694 | (goto-char (+ 2 bos-marker)) | ||
| 695 | (unless (markerp id-pos) | ||
| 696 | (insert "BAD REFERENCE ") | ||
| 697 | (incf cnt-error) | ||
| 698 | (throw 'next t)) | ||
| 699 | (unless cmd | ||
| 700 | (insert "BAD FLAG ") | ||
| 701 | (incf cnt-error) | ||
| 702 | (throw 'next t)) | ||
| 703 | ;; Remember this place so that we can return | ||
| 704 | (move-marker marker (point)) | ||
| 705 | (setq org-mobile-error nil) | ||
| 706 | (save-excursion | ||
| 707 | (condition-case msg | ||
| 708 | (org-with-point-at id-pos | ||
| 709 | (progn | ||
| 456 | (eval cmd) | 710 | (eval cmd) |
| 457 | (if (member "FLAGGED" (org-get-tags)) | 711 | (if (member "FLAGGED" (org-get-tags)) |
| 458 | (add-to-list 'org-mobile-last-flagged-files | 712 | (add-to-list 'org-mobile-last-flagged-files |
| 459 | (buffer-file-name (current-buffer)))))) | 713 | (buffer-file-name (current-buffer)))))) |
| 460 | (error | 714 | (error (setq org-mobile-error msg)))) |
| 461 | (progn | 715 | (when org-mobile-error |
| 462 | (switch-to-buffer (marker-buffer marker)) | 716 | (switch-to-buffer (marker-buffer marker)) |
| 463 | (goto-char marker) | 717 | (goto-char marker) |
| 464 | (insert "EXECUTION FAILED ") | 718 | (incf cnt-error) |
| 465 | (throw 'next t))))) | 719 | (insert (if (stringp (nth 1 org-mobile-error)) |
| 466 | ;; If we get here, the action has been applied successfully | 720 | (nth 1 org-mobile-error) |
| 467 | ;; So remove the entry | 721 | "EXECUTION FAILED") |
| 468 | (org-back-to-heading t) | 722 | " ") |
| 469 | (delete-region (point) (org-end-of-subtree t t)))) | 723 | (throw 'next t)) |
| 724 | ;; If we get here, the action has been applied successfully | ||
| 725 | ;; So remove the entry | ||
| 726 | (goto-char bos-marker) | ||
| 727 | (delete-region (point) (org-end-of-subtree t t)))))) | ||
| 728 | (save-buffer) | ||
| 470 | (move-marker marker nil) | 729 | (move-marker marker nil) |
| 471 | (move-marker end nil))) | 730 | (move-marker end nil) |
| 731 | (message "%d new, %d edits, %d flags, %d errors" cnt-new | ||
| 732 | cnt-edit cnt-flag cnt-error) | ||
| 733 | (sit-for 1))) | ||
| 734 | |||
| 735 | (defun org-mobile-timestamp-buffer (buf) | ||
| 736 | "Time stamp buffer BUF, just to make sure its checksum will change." | ||
| 737 | (with-current-buffer buf | ||
| 738 | (save-excursion | ||
| 739 | (save-restriction | ||
| 740 | (widen) | ||
| 741 | (goto-char (point-min)) | ||
| 742 | (if (re-search-forward | ||
| 743 | "^\\([ \t]*\\)#\\+LAST_MOBILE_CHANGE:.*\n?" nil t) | ||
| 744 | (progn | ||
| 745 | (goto-char (match-end 1)) | ||
| 746 | (delete-region (point) (match-end 0))) | ||
| 747 | (if (looking-at ".*?-\\*-.*-\\*-") | ||
| 748 | (forward-line 1))) | ||
| 749 | (insert "#+LAST_MOBILE_CHANGE: " | ||
| 750 | (format-time-string "%Y-%m-%d %T") "\n"))))) | ||
| 472 | 751 | ||
| 473 | (defun org-mobile-smart-read () | 752 | (defun org-mobile-smart-read () |
| 474 | "Parse the entry at point for shortcuts and expand them. | 753 | "Parse the entry at point for shortcuts and expand them. |
| @@ -480,7 +759,7 @@ The entry is expected to contain an inactive time stamp indicating when | |||
| 480 | the entry was created. When setting dates and | 759 | the entry was created. When setting dates and |
| 481 | times (for example for deadlines), the time strings are interpreted | 760 | times (for example for deadlines), the time strings are interpreted |
| 482 | relative to that creation date. | 761 | relative to that creation date. |
| 483 | Abbreviations are expected to take up entire lines, jst because it is so | 762 | Abbreviations are expected to take up entire lines, just because it is so |
| 484 | easy to type RET on a mobile device. Abbreviations start with one or two | 763 | easy to type RET on a mobile device. Abbreviations start with one or two |
| 485 | letters, followed immediately by a dot and then additional information. | 764 | letters, followed immediately by a dot and then additional information. |
| 486 | Generally the entire shortcut line is removed after action have been taken. | 765 | Generally the entire shortcut line is removed after action have been taken. |
| @@ -502,6 +781,161 @@ FIXME: Hmmm, not sure if we can make his work against the | |||
| 502 | auto-correction feature. Needs a bit more thinking. So this function | 781 | auto-correction feature. Needs a bit more thinking. So this function |
| 503 | is currently a noop.") | 782 | is currently a noop.") |
| 504 | 783 | ||
| 784 | |||
| 785 | (defun org-find-olp (path) | ||
| 786 | "Return a marker pointing to the entry at outline path OLP. | ||
| 787 | If anything goes wrong, the return value will instead an error message, | ||
| 788 | as a string." | ||
| 789 | (let* ((file (pop path)) | ||
| 790 | (buffer (find-file-noselect file)) | ||
| 791 | (level 1) | ||
| 792 | (lmin 1) | ||
| 793 | (lmax 1) | ||
| 794 | limit re end found pos heading cnt) | ||
| 795 | (unless buffer (error "File not found :%s" file)) | ||
| 796 | (with-current-buffer buffer | ||
| 797 | (save-excursion | ||
| 798 | (save-restriction | ||
| 799 | (widen) | ||
| 800 | (setq limit (point-max)) | ||
| 801 | (goto-char (point-min)) | ||
| 802 | (while (setq heading (pop path)) | ||
| 803 | (setq re (format org-complex-heading-regexp-format | ||
| 804 | (regexp-quote heading))) | ||
| 805 | (setq cnt 0 pos (point)) | ||
| 806 | (while (re-search-forward re end t) | ||
| 807 | (setq level (- (match-end 1) (match-beginning 1))) | ||
| 808 | (if (and (>= level lmin) (<= level lmax)) | ||
| 809 | (setq found (match-beginning 0) cnt (1+ cnt)))) | ||
| 810 | (when (= cnt 0) (error "Heading not found on level %d: %s" | ||
| 811 | lmax heading)) | ||
| 812 | (when (> cnt 1) (error "Heading not unique on level %d: %s" | ||
| 813 | lmax heading)) | ||
| 814 | (goto-char found) | ||
| 815 | (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0))) | ||
| 816 | (setq end (save-excursion (org-end-of-subtree t t)))) | ||
| 817 | (when (org-on-heading-p) | ||
| 818 | (move-marker (make-marker) (point)))))))) | ||
| 819 | |||
| 820 | (defun org-mobile-locate-entry (link) | ||
| 821 | (if (string-match "\\`id:\\(.*\\)$" link) | ||
| 822 | (org-id-find (match-string 1 link) 'marker) | ||
| 823 | (if (not (string-match "\\`olp:\\(.*?\\):\\(.*\\)$" link)) | ||
| 824 | nil | ||
| 825 | (let ((file (match-string 1 link)) | ||
| 826 | (path (match-string 2 link)) | ||
| 827 | (table '((?: . "%3a") (?\[ . "%5b") (?\] . "%5d") (?/ . "%2f")))) | ||
| 828 | (setq file (org-link-unescape file table)) | ||
| 829 | (setq file (expand-file-name file org-directory)) | ||
| 830 | (setq path (mapcar (lambda (x) (org-link-unescape x table)) | ||
| 831 | (org-split-string path "/"))) | ||
| 832 | (org-find-olp (cons file path)))))) | ||
| 833 | |||
| 834 | (defun org-mobile-edit (what old new) | ||
| 835 | "Edit item WHAT in the current entry by replacing OLD with NEW. | ||
| 836 | WHAT can be \"heading\", \"todo\", \"tags\", \"priority\", or \"body\". | ||
| 837 | The edit only takes place if the current value is equal (except for | ||
| 838 | white space) the OLD. If this is so, OLD will be replace by NEW | ||
| 839 | and the command will return t. If something goes wrong, a string will | ||
| 840 | be returned that indicates what went wrong." | ||
| 841 | (let (current old1 new1) | ||
| 842 | (if (stringp what) (setq what (intern what))) | ||
| 843 | |||
| 844 | (cond | ||
| 845 | |||
| 846 | ((memq what '(todo todostate)) | ||
| 847 | (setq current (org-get-todo-state)) | ||
| 848 | (cond | ||
| 849 | ((equal new "DONEARCHIVE") | ||
| 850 | (org-todo 'done) | ||
| 851 | (org-archive-subtree-default)) | ||
| 852 | ((equal new current) t) ; nothing needs to be done | ||
| 853 | ((or (equal current old) | ||
| 854 | (eq org-mobile-force-mobile-change t) | ||
| 855 | (memq 'todo org-mobile-force-mobile-change)) | ||
| 856 | (org-todo (or new 'none)) t) | ||
| 857 | (t (error "State before change was expected as \"%s\", but is \"%s\"" | ||
| 858 | old current)))) | ||
| 859 | |||
| 860 | ((eq what 'tags) | ||
| 861 | (setq current (org-get-tags) | ||
| 862 | new1 (and new (org-split-string new ":+")) | ||
| 863 | old1 (and old (org-split-string old ":+"))) | ||
| 864 | (cond | ||
| 865 | ((org-mobile-tags-same-p current new1) t) ; no change needed | ||
| 866 | ((or (org-mobile-tags-same-p current old1) | ||
| 867 | (eq org-mobile-force-mobile-change t) | ||
| 868 | (memq 'tags org-mobile-force-mobile-change)) | ||
| 869 | (org-set-tags-to new1) t) | ||
| 870 | (t (error "Tags before change were expected as \"%s\", but are \"%s\"" | ||
| 871 | (or old "") (or current ""))))) | ||
| 872 | |||
| 873 | ((eq what 'priority) | ||
| 874 | (when (looking-at org-complex-heading-regexp) | ||
| 875 | (setq current (and (match-end 3) (substring (match-string 3) 2 3))) | ||
| 876 | (cond | ||
| 877 | ((equal current new) t) ; no action required | ||
| 878 | ((or (equal current old) | ||
| 879 | (eq org-mobile-force-mobile-change t) | ||
| 880 | (memq 'tags org-mobile-force-mobile-change)) | ||
| 881 | (org-priority (and new (string-to-char new)))) | ||
| 882 | (t (error "Priority was expected to be %s, but is %s" | ||
| 883 | old current))))) | ||
| 884 | |||
| 885 | ((eq what 'heading) | ||
| 886 | (when (looking-at org-complex-heading-regexp) | ||
| 887 | (setq current (match-string 4)) | ||
| 888 | (cond | ||
| 889 | ((equal current new) t) ; no action required | ||
| 890 | ((or (equal current old) | ||
| 891 | (eq org-mobile-force-mobile-change t) | ||
| 892 | (memq 'heading org-mobile-force-mobile-change)) | ||
| 893 | (goto-char (match-beginning 4)) | ||
| 894 | (insert new) | ||
| 895 | (delete-region (point) (+ (point) (length current))) | ||
| 896 | (org-set-tags nil 'align)) | ||
| 897 | (t (error "Heading changed in MobileOrg and on the computer"))))) | ||
| 898 | |||
| 899 | ((eq what 'body) | ||
| 900 | (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) | ||
| 901 | (save-excursion (outline-next-heading) | ||
| 902 | (point)))) | ||
| 903 | (if (not (string-match "\\S-" current)) (setq current nil)) | ||
| 904 | (cond | ||
| 905 | ((org-mobile-bodies-same-p current new) t) ; no action necessary | ||
| 906 | ((or (org-mobile-bodies-same-p current old) | ||
| 907 | (eq org-mobile-force-mobile-change t) | ||
| 908 | (memq 'body org-mobile-force-mobile-change)) | ||
| 909 | (save-excursion | ||
| 910 | (end-of-line 1) | ||
| 911 | (insert "\n" new) | ||
| 912 | (or (bolp) (insert "\n")) | ||
| 913 | (delete-region (point) (progn (org-back-to-heading t) | ||
| 914 | (outline-next-heading) | ||
| 915 | (point)))) | ||
| 916 | t) | ||
| 917 | (t (error "Body was changed in MobileOrg and on the computer"))))))) | ||
| 918 | |||
| 919 | |||
| 920 | (defun org-mobile-tags-same-p (list1 list2) | ||
| 921 | "Are the two tag lists the same?" | ||
| 922 | (not (or (org-delete-all list1 list2) | ||
| 923 | (org-delete-all list2 list1)))) | ||
| 924 | |||
| 925 | (defun org-mobile-bodies-same-p (a b) | ||
| 926 | "Compare if A and B are visually equal strings. | ||
| 927 | We first remove leading and trailing white space from the entire strings. | ||
| 928 | Then we split the strings into lines and remove leading/trailing whitespace | ||
| 929 | from each line. Then we compare. | ||
| 930 | A and B must be strings or nil." | ||
| 931 | (cond | ||
| 932 | ((and (not a) (not b)) t) | ||
| 933 | ((or (not a) (not b)) nil) | ||
| 934 | (t (setq a (org-trim a) b (org-trim b)) | ||
| 935 | (setq a (mapconcat 'identity (org-split-string a "[ \t]*\n[ \t]*") "\n")) | ||
| 936 | (setq b (mapconcat 'identity (org-split-string b "[ \t]*\n[ \t]*") "\n")) | ||
| 937 | (equal a b)))) | ||
| 938 | |||
| 505 | (provide 'org-mobile) | 939 | (provide 'org-mobile) |
| 506 | 940 | ||
| 507 | ;; arch-tag: ace0e26c-58f2-4309-8a61-05ec1535f658 | 941 | ;; arch-tag: ace0e26c-58f2-4309-8a61-05ec1535f658 |
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index e5e540d84d8..7860fca2252 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; | 4 | ;; |
| 5 | ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> | 5 | ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> |
| 6 | ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> | 6 | ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | ;; | 8 | ;; |
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -1043,9 +1043,9 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" | |||
| 1043 | (org-mouse-main-buffer (current-buffer))) | 1043 | (org-mouse-main-buffer (current-buffer))) |
| 1044 | (when (eq (with-current-buffer buffer major-mode) 'org-mode) | 1044 | (when (eq (with-current-buffer buffer major-mode) 'org-mode) |
| 1045 | (let ((endmarker (with-current-buffer buffer | 1045 | (let ((endmarker (with-current-buffer buffer |
| 1046 | (outline-end-of-subtree) | 1046 | (outline-end-of-subtree) |
| 1047 | (forward-char 1) | 1047 | (forward-char 1) |
| 1048 | (copy-marker (point))))) | 1048 | (copy-marker (point))))) |
| 1049 | (org-with-remote-undo buffer | 1049 | (org-with-remote-undo buffer |
| 1050 | (with-current-buffer buffer | 1050 | (with-current-buffer buffer |
| 1051 | (widen) | 1051 | (widen) |
| @@ -1131,13 +1131,13 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" | |||
| 1131 | (add-hook 'org-agenda-mode-hook | 1131 | (add-hook 'org-agenda-mode-hook |
| 1132 | '(lambda () | 1132 | '(lambda () |
| 1133 | (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) | 1133 | (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) |
| 1134 | (define-key org-agenda-keymap | 1134 | (define-key org-agenda-mode-map |
| 1135 | (if (featurep 'xemacs) [button3] [mouse-3]) | 1135 | (if (featurep 'xemacs) [button3] [mouse-3]) |
| 1136 | 'org-mouse-show-context-menu) | 1136 | 'org-mouse-show-context-menu) |
| 1137 | (define-key org-agenda-keymap [down-mouse-3] 'org-mouse-move-tree-start) | 1137 | (define-key org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start) |
| 1138 | (define-key org-agenda-keymap (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier) | 1138 | (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier) |
| 1139 | (define-key org-agenda-keymap (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later) | 1139 | (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later) |
| 1140 | (define-key org-agenda-keymap [drag-mouse-3] | 1140 | (define-key org-agenda-mode-map [drag-mouse-3] |
| 1141 | '(lambda (event) (interactive "e") | 1141 | '(lambda (event) (interactive "e") |
| 1142 | (case (org-mouse-get-gesture event) | 1142 | (case (org-mouse-get-gesture event) |
| 1143 | (:left (org-agenda-earlier 1)) | 1143 | (:left (org-agenda-earlier 1)) |
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 81605f79c38..f91df114aca 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Eric Schulte <schulte dot eric at gmail dot com> | 5 | ;; Author: Eric Schulte <schulte dot eric at gmail dot com> |
| 6 | ;; Keywords: tables, plotting | 6 | ;; Keywords: tables, plotting |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -280,7 +280,7 @@ line directly before or after the table." | |||
| 280 | (delete-other-windows) | 280 | (delete-other-windows) |
| 281 | (when (get-buffer "*gnuplot*") ;; reset *gnuplot* if it already running | 281 | (when (get-buffer "*gnuplot*") ;; reset *gnuplot* if it already running |
| 282 | (with-current-buffer "*gnuplot*" | 282 | (with-current-buffer "*gnuplot*" |
| 283 | (goto-char (point-max)) | 283 | (goto-char (point-max)) |
| 284 | (gnuplot-delchar-or-maybe-eof nil))) | 284 | (gnuplot-delchar-or-maybe-eof nil))) |
| 285 | (org-plot/goto-nearest-table) | 285 | (org-plot/goto-nearest-table) |
| 286 | ;; set default options | 286 | ;; set default options |
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 3b4f53f3b70..30d2dd3a050 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | ;; Author: Ross Patterson <me AT rpatterson DOT net> | 9 | ;; Author: Ross Patterson <me AT rpatterson DOT net> |
| 10 | ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> | 10 | ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> |
| 11 | ;; Keywords: org, emacsclient, wp | 11 | ;; Keywords: org, emacsclient, wp |
| 12 | ;; Version: 6.31a | 12 | ;; Version: 6.33 |
| 13 | 13 | ||
| 14 | ;; This file is part of GNU Emacs. | 14 | ;; This file is part of GNU Emacs. |
| 15 | ;; | 15 | ;; |
| @@ -88,7 +88,7 @@ | |||
| 88 | ;; triggered through the sub-protocol \"store-link\". | 88 | ;; triggered through the sub-protocol \"store-link\". |
| 89 | ;; | 89 | ;; |
| 90 | ;; * Call `org-protocol-remember' by using the sub-protocol \"remember\". If | 90 | ;; * Call `org-protocol-remember' by using the sub-protocol \"remember\". If |
| 91 | ;; Org-mode is loaded, emacs will popup a remember buffer and fill the | 91 | ;; Org-mode is loaded, emacs will pop-up a remember buffer and fill the |
| 92 | ;; template with the data provided. I.e. the browser's URL is inserted as an | 92 | ;; template with the data provided. I.e. the browser's URL is inserted as an |
| 93 | ;; Org-link of which the page title will be the description part. If text | 93 | ;; Org-link of which the page title will be the description part. If text |
| 94 | ;; was select in the browser, that text will be the body of the entry. | 94 | ;; was select in the browser, that text will be the body of the entry. |
| @@ -109,8 +109,8 @@ | |||
| 109 | ;; | 109 | ;; |
| 110 | ;; use template ?x. | 110 | ;; use template ?x. |
| 111 | ;; | 111 | ;; |
| 112 | ;; Note, that using double shlashes is optional from org-protocol.el's point of | 112 | ;; Note, that using double slashes is optional from org-protocol.el's point of |
| 113 | ;; view because emacsclient sqashes the slashes to one. | 113 | ;; view because emacsclient squashes the slashes to one. |
| 114 | ;; | 114 | ;; |
| 115 | ;; | 115 | ;; |
| 116 | ;; provides: 'org-protocol | 116 | ;; provides: 'org-protocol |
| @@ -231,7 +231,7 @@ function - function that handles requests with protocol and takes exactly one | |||
| 231 | `org-protocol-protocol-alist-default'. See `org-protocol-split-data'. | 231 | `org-protocol-protocol-alist-default'. See `org-protocol-split-data'. |
| 232 | 232 | ||
| 233 | kill-client - If t, kill the client immediately, once the sub-protocol is | 233 | kill-client - If t, kill the client immediately, once the sub-protocol is |
| 234 | detected. This is neccessary for actions that can be interupted by | 234 | detected. This is necessary for actions that can be interrupted by |
| 235 | `C-g' to avoid dangeling emacsclients. Note, that all other command | 235 | `C-g' to avoid dangeling emacsclients. Note, that all other command |
| 236 | line arguments but the this one will be discarded, greedy handlers | 236 | line arguments but the this one will be discarded, greedy handlers |
| 237 | still receive the whole list of arguments though. | 237 | still receive the whole list of arguments though. |
| @@ -280,6 +280,17 @@ decode each split part." | |||
| 280 | (mapcar 'org-protocol-unhex-string split-parts)) | 280 | (mapcar 'org-protocol-unhex-string split-parts)) |
| 281 | split-parts))) | 281 | split-parts))) |
| 282 | 282 | ||
| 283 | ;; This inline function is needed in org-protocol-unhex-compound to do | ||
| 284 | ;; the right thing to decode UTF-8 char integer values. | ||
| 285 | (eval-when-compile | ||
| 286 | (if (>= emacs-major-version 23) | ||
| 287 | (defsubst org-protocol-char-to-string(c) | ||
| 288 | "Defsubst to decode UTF-8 character values in emacs 23 and beyond." | ||
| 289 | (char-to-string c)) | ||
| 290 | (defsubst org-protocol-char-to-string (c) | ||
| 291 | "Defsubst to decode UTF-8 character values in emacs 22." | ||
| 292 | (string (decode-char 'ucs c))))) | ||
| 293 | |||
| 283 | (defun org-protocol-unhex-string(str) | 294 | (defun org-protocol-unhex-string(str) |
| 284 | "Unhex hexified unicode strings as returned from the JavaScript function | 295 | "Unhex hexified unicode strings as returned from the JavaScript function |
| 285 | encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'." | 296 | encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'." |
| @@ -331,7 +342,7 @@ encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'." | |||
| 331 | (setq sum (+ (lsh sum shift) val)) | 342 | (setq sum (+ (lsh sum shift) val)) |
| 332 | (if (> eat 0) (setq eat (- eat 1))) | 343 | (if (> eat 0) (setq eat (- eat 1))) |
| 333 | (when (= 0 eat) | 344 | (when (= 0 eat) |
| 334 | (setq ret (concat ret (char-to-string sum))) | 345 | (setq ret (concat ret (org-protocol-char-to-string sum))) |
| 335 | (setq sum 0)) | 346 | (setq sum 0)) |
| 336 | )) ;; end (while bytes | 347 | )) ;; end (while bytes |
| 337 | ret )) | 348 | ret )) |
| @@ -428,7 +439,7 @@ The sub-protocol used to reach this function is set in | |||
| 428 | The sub-protocol used to reach this function is set in | 439 | The sub-protocol used to reach this function is set in |
| 429 | `org-protocol-protocol-alist'. | 440 | `org-protocol-protocol-alist'. |
| 430 | 441 | ||
| 431 | This function detects an URL, title and optinal text, separated by '/' | 442 | This function detects an URL, title and optional text, separated by '/' |
| 432 | The location for a browser's bookmark has to look like this: | 443 | The location for a browser's bookmark has to look like this: |
| 433 | 444 | ||
| 434 | javascript:location.href='org-protocol://remember://'+ \\ | 445 | javascript:location.href='org-protocol://remember://'+ \\ |
diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index 2bd92268657..d42abd43fc9 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; Author: David O'Toole <dto@gnu.org> | 4 | ;; Author: David O'Toole <dto@gnu.org> |
| 5 | ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com> | 5 | ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com> |
| 6 | ;; Keywords: hypermedia, outlines, wp | 6 | ;; Keywords: hypermedia, outlines, wp |
| 7 | ;; Version: 6.31a | 7 | ;; Version: 6.33 |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -184,7 +184,7 @@ When nil, do no timestamp checking and always publish all files." | |||
| 184 | (defcustom org-publish-before-export-hook nil | 184 | (defcustom org-publish-before-export-hook nil |
| 185 | "Hook run before export on the Org file. | 185 | "Hook run before export on the Org file. |
| 186 | The hook may modify the file in arbitrary ways before publishing happens. | 186 | The hook may modify the file in arbitrary ways before publishing happens. |
| 187 | The orgiginal version of the buffer will be restored after publishing." | 187 | The original version of the buffer will be restored after publishing." |
| 188 | :group 'org-publish | 188 | :group 'org-publish |
| 189 | :type 'hook) | 189 | :type 'hook) |
| 190 | 190 | ||
diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index 708c8e9aed1..5eef7a22bb5 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -34,6 +34,7 @@ | |||
| 34 | (eval-when-compile | 34 | (eval-when-compile |
| 35 | (require 'cl)) | 35 | (require 'cl)) |
| 36 | (require 'org) | 36 | (require 'org) |
| 37 | (require 'org-datetree) | ||
| 37 | 38 | ||
| 38 | (declare-function remember-mode "remember" ()) | 39 | (declare-function remember-mode "remember" ()) |
| 39 | (declare-function remember "remember" (&optional initial)) | 40 | (declare-function remember "remember" (&optional initial)) |
| @@ -189,7 +190,8 @@ calendar | %:type %:date" | |||
| 189 | (function :tag "Function") | 190 | (function :tag "Function") |
| 190 | (const :tag "Use `org-remember-default-headline'" nil) | 191 | (const :tag "Use `org-remember-default-headline'" nil) |
| 191 | (const :tag "At beginning of file" top) | 192 | (const :tag "At beginning of file" top) |
| 192 | (const :tag "At end of file" bottom)) | 193 | (const :tag "At end of file" bottom) |
| 194 | (const :tag "In a date tree" date-tree)) | ||
| 193 | (choice :tag "Context" | 195 | (choice :tag "Context" |
| 194 | (const :tag "Use in all contexts" nil) | 196 | (const :tag "Use in all contexts" nil) |
| 195 | (const :tag "Use in all contexts" t) | 197 | (const :tag "Use in all contexts" t) |
| @@ -296,6 +298,7 @@ RET at beg-of-buf -> Append to file as level 2 headline | |||
| 296 | 298 | ||
| 297 | (defvar org-jump-to-target-location nil) | 299 | (defvar org-jump-to-target-location nil) |
| 298 | (defvar org-remember-previous-location nil) | 300 | (defvar org-remember-previous-location nil) |
| 301 | (defvar org-remember-reference-date nil) | ||
| 299 | (defvar org-force-remember-template-char) ;; dynamically scoped | 302 | (defvar org-force-remember-template-char) ;; dynamically scoped |
| 300 | 303 | ||
| 301 | ;; Save the major mode of the buffer we called remember from | 304 | ;; Save the major mode of the buffer we called remember from |
| @@ -534,6 +537,8 @@ to be run from that hook to function properly." | |||
| 534 | (org-set-local 'org-default-notes-file file)) | 537 | (org-set-local 'org-default-notes-file file)) |
| 535 | (if headline | 538 | (if headline |
| 536 | (org-set-local 'org-remember-default-headline headline)) | 539 | (org-set-local 'org-remember-default-headline headline)) |
| 540 | (org-set-local 'org-remember-reference-date | ||
| 541 | (list (nth 4 dct) (nth 3 dct) (nth 5 dct))) | ||
| 537 | ;; Interactive template entries | 542 | ;; Interactive template entries |
| 538 | (goto-char (point-min)) | 543 | (goto-char (point-min)) |
| 539 | (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t) | 544 | (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t) |
| @@ -588,12 +593,14 @@ to be run from that hook to function properly." | |||
| 588 | (pall (concat prop "_ALL")) | 593 | (pall (concat prop "_ALL")) |
| 589 | (allowed | 594 | (allowed |
| 590 | (with-current-buffer | 595 | (with-current-buffer |
| 591 | (get-buffer (file-name-nondirectory file)) | 596 | (or (find-buffer-visiting file) |
| 597 | (find-file-noselect file)) | ||
| 592 | (or (cdr (assoc pall org-file-properties)) | 598 | (or (cdr (assoc pall org-file-properties)) |
| 593 | (cdr (assoc pall org-global-properties)) | 599 | (cdr (assoc pall org-global-properties)) |
| 594 | (cdr (assoc pall org-global-properties-fixed))))) | 600 | (cdr (assoc pall org-global-properties-fixed))))) |
| 595 | (existing (with-current-buffer | 601 | (existing (with-current-buffer |
| 596 | (get-buffer (file-name-nondirectory file)) | 602 | (or (find-buffer-visiting file) |
| 603 | (find-file-noselect file)) | ||
| 597 | (mapcar 'list (org-property-values prop)))) | 604 | (mapcar 'list (org-property-values prop)))) |
| 598 | (propprompt (concat "Value for " prop ": ")) | 605 | (propprompt (concat "Value for " prop ": ")) |
| 599 | (val (if allowed | 606 | (val (if allowed |
| @@ -614,11 +621,12 @@ to be run from that hook to function properly." | |||
| 614 | nil nil (list org-end-time-was-given))) | 621 | nil nil (list org-end-time-was-given))) |
| 615 | (t | 622 | (t |
| 616 | (let (org-completion-use-ido) | 623 | (let (org-completion-use-ido) |
| 617 | (insert (org-completing-read-no-i | 624 | (insert (org-without-partial-completion |
| 618 | (concat (if prompt prompt "Enter string") | 625 | (org-completing-read-no-i |
| 619 | (if default (concat " [" default "]")) | 626 | (concat (if prompt prompt "Enter string") |
| 620 | ": ") | 627 | (if default (concat " [" default "]")) |
| 621 | completions nil nil nil histvar default))))))) | 628 | ": ") |
| 629 | completions nil nil nil histvar default)))))))) | ||
| 622 | 630 | ||
| 623 | (goto-char (point-min)) | 631 | (goto-char (point-min)) |
| 624 | (if (re-search-forward "%\\?" nil t) | 632 | (if (re-search-forward "%\\?" nil t) |
| @@ -848,6 +856,7 @@ See also the variable `org-reverse-note-order'." | |||
| 848 | (delete-file (concat backup-file "~")))) | 856 | (delete-file (concat backup-file "~")))) |
| 849 | (set-buffer-modified-p nil) | 857 | (set-buffer-modified-p nil) |
| 850 | (throw 'quit t))) | 858 | (throw 'quit t))) |
| 859 | (reference-date org-remember-reference-date) | ||
| 851 | (previousp (and (member current-prefix-arg '((16) 0)) | 860 | (previousp (and (member current-prefix-arg '((16) 0)) |
| 852 | org-remember-previous-location)) | 861 | org-remember-previous-location)) |
| 853 | (clockp (equal current-prefix-arg 2)) | 862 | (clockp (equal current-prefix-arg 2)) |
| @@ -887,9 +896,9 @@ See also the variable `org-reverse-note-order'." | |||
| 887 | ;; remove empty lines at end | 896 | ;; remove empty lines at end |
| 888 | (replace-match ""))) | 897 | (replace-match ""))) |
| 889 | (goto-char (point-min)) | 898 | (goto-char (point-min)) |
| 899 | (setq text-before-node-creation (buffer-string)) | ||
| 890 | (unless (looking-at org-outline-regexp) | 900 | (unless (looking-at org-outline-regexp) |
| 891 | ;; add a headline | 901 | ;; add a headline |
| 892 | (setq text-before-node-creation (buffer-string)) | ||
| 893 | (insert (concat "* " (current-time-string) | 902 | (insert (concat "* " (current-time-string) |
| 894 | " (" (remember-buffer-desc) ")\n")) | 903 | " (" (remember-buffer-desc) ")\n")) |
| 895 | (backward-char 1) | 904 | (backward-char 1) |
| @@ -947,6 +956,10 @@ See also the variable `org-reverse-note-order'." | |||
| 947 | (goto-char (point-max)) | 956 | (goto-char (point-max)) |
| 948 | (or (bolp) (newline)) | 957 | (or (bolp) (newline)) |
| 949 | (setq org-goto-start-pos (point))) | 958 | (setq org-goto-start-pos (point))) |
| 959 | ((eq heading 'date-tree) | ||
| 960 | (org-datetree-find-date-create reference-date) | ||
| 961 | (setq reversed nil) | ||
| 962 | (setq org-goto-start-pos (point))) | ||
| 950 | ((and (stringp heading) (string-match "\\S-" heading)) | 963 | ((and (stringp heading) (string-match "\\S-" heading)) |
| 951 | (goto-char (point-min)) | 964 | (goto-char (point-min)) |
| 952 | (if (re-search-forward | 965 | (if (re-search-forward |
diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index 111124a87ec..f1fe9f8f2ad 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index a5718d884de..a2321d2edd3 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el | |||
| @@ -5,9 +5,10 @@ | |||
| 5 | ;; | 5 | ;; |
| 6 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 6 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 7 | ;; Bastien Guerry <bzg AT altern DOT org> | 7 | ;; Bastien Guerry <bzg AT altern DOT org> |
| 8 | ;; Dan Davison <davison at stats dot ox dot ac dot uk> | ||
| 8 | ;; Keywords: outlines, hypermedia, calendar, wp | 9 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 9 | ;; Homepage: http://orgmode.org | 10 | ;; Homepage: http://orgmode.org |
| 10 | ;; Version: 6.31a | 11 | ;; Version: 6.33 |
| 11 | ;; | 12 | ;; |
| 12 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| 13 | ;; | 14 | ;; |
| @@ -33,9 +34,12 @@ | |||
| 33 | 34 | ||
| 34 | (require 'org-macs) | 35 | (require 'org-macs) |
| 35 | (require 'org-compat) | 36 | (require 'org-compat) |
| 37 | (eval-when-compile | ||
| 38 | (require 'cl)) | ||
| 36 | 39 | ||
| 37 | (declare-function org-do-remove-indentation "org" (&optional n)) | 40 | (declare-function org-do-remove-indentation "org" (&optional n)) |
| 38 | (declare-function org-get-indentation "org" (&optional line)) | 41 | (declare-function org-get-indentation "org" (&optional line)) |
| 42 | (declare-function org-switch-to-buffer-other-window "org" (&rest args)) | ||
| 39 | 43 | ||
| 40 | (defcustom org-edit-src-region-extra nil | 44 | (defcustom org-edit-src-region-extra nil |
| 41 | "Additional regexps to identify regions for editing with `org-edit-src-code'. | 45 | "Additional regexps to identify regions for editing with `org-edit-src-code'. |
| @@ -81,11 +85,23 @@ These are the regions where each line starts with a colon." | |||
| 81 | (const fundamental-mode) | 85 | (const fundamental-mode) |
| 82 | (function :tag "Other (specify)"))) | 86 | (function :tag "Other (specify)"))) |
| 83 | 87 | ||
| 88 | (defcustom org-src-preserve-indentation nil | ||
| 89 | "If non-nil, leading whitespace characters in source code | ||
| 90 | blocks are preserved on export, and when switching between the | ||
| 91 | org buffer and the language mode edit buffer. If this variable | ||
| 92 | is nil then, after editing with \\[org-edit-src-code], the | ||
| 93 | minimum (across-lines) number of leading whitespace characters | ||
| 94 | are removed from all lines, and the code block is uniformly | ||
| 95 | indented according to the value of `org-edit-src-content-indentation'." | ||
| 96 | :group 'org-edit-structure | ||
| 97 | :type 'boolean) | ||
| 98 | |||
| 84 | (defcustom org-edit-src-content-indentation 2 | 99 | (defcustom org-edit-src-content-indentation 2 |
| 85 | "Indentation for the content is a source code block. | 100 | "Indentation for the content of a source code block. |
| 86 | This should be the number of spaces added to the indentation of the #+begin | 101 | This should be the number of spaces added to the indentation of the #+begin |
| 87 | line in order to compute the indentation of the block content after | 102 | line in order to compute the indentation of the block content after |
| 88 | editing it with \\[org-edit-src-code]." | 103 | editing it with \\[org-edit-src-code]. Has no effect if |
| 104 | `org-src-preserve-indentation' is non-nil." | ||
| 89 | :group 'org-edit-structure | 105 | :group 'org-edit-structure |
| 90 | :type 'integer) | 106 | :type 'integer) |
| 91 | 107 | ||
| @@ -98,6 +114,25 @@ When nil, the message will only be shown intermittently in the echo area." | |||
| 98 | :type 'boolean) | 114 | :type 'boolean) |
| 99 | 115 | ||
| 100 | 116 | ||
| 117 | (defcustom org-src-window-setup 'reorganize-frame | ||
| 118 | "How the source code edit buffer should be displayed. | ||
| 119 | Possible values for this option are: | ||
| 120 | |||
| 121 | current-window Show edit buffer in the current window, keeping all other | ||
| 122 | windows. | ||
| 123 | other-window Use `switch-to-buffer-other-window' to display edit buffer. | ||
| 124 | reorganize-frame Show only two windows on the current frame, the current | ||
| 125 | window and the edit buffer. When exiting the edit buffer, | ||
| 126 | return to one window. | ||
| 127 | other-frame Use `switch-to-buffer-other-frame' to display edit buffer. | ||
| 128 | Also, when exiting the edit buffer, kill that frame." | ||
| 129 | :group 'org-edit-structure | ||
| 130 | :type '(choice | ||
| 131 | (const current-window) | ||
| 132 | (const other-frame) | ||
| 133 | (const other-window) | ||
| 134 | (const reorganize-frame))) | ||
| 135 | |||
| 101 | (defvar org-src-mode-hook nil | 136 | (defvar org-src-mode-hook nil |
| 102 | "Hook run after Org switched a source code snippet to its Emacs mode. | 137 | "Hook run after Org switched a source code snippet to its Emacs mode. |
| 103 | This hook will run | 138 | This hook will run |
| @@ -111,7 +146,7 @@ but which mess up the display of a snippet in Org exported files.") | |||
| 111 | 146 | ||
| 112 | (defcustom org-src-lang-modes | 147 | (defcustom org-src-lang-modes |
| 113 | '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) | 148 | '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) |
| 114 | ("asymptote" . asy)) | 149 | ("asymptote" . asy) ("dot" . fundamental)) |
| 115 | "Alist mapping languages to their major mode. | 150 | "Alist mapping languages to their major mode. |
| 116 | The key is the language name, the value is the string that should | 151 | The key is the language name, the value is the string that should |
| 117 | be inserted as the name of the major mode. For many languages this is | 152 | be inserted as the name of the major mode. For many languages this is |
| @@ -135,7 +170,14 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is | |||
| 135 | (defvar org-edit-src-beg-marker nil) | 170 | (defvar org-edit-src-beg-marker nil) |
| 136 | (defvar org-edit-src-end-marker nil) | 171 | (defvar org-edit-src-end-marker nil) |
| 137 | (defvar org-edit-src-overlay nil) | 172 | (defvar org-edit-src-overlay nil) |
| 138 | (defvar org-edit-src-nindent nil) | 173 | (defvar org-edit-src-block-indentation nil) |
| 174 | (defvar org-edit-src-saved-temp-window-config nil) | ||
| 175 | |||
| 176 | (defvar org-src-ask-before-returning-to-edit-buffer t | ||
| 177 | "If nil, when org-edit-src code is used on a block that already | ||
| 178 | has an active edit buffer, it will switch to that edit buffer | ||
| 179 | immediately; otherwise it will ask whether you want to return | ||
| 180 | to the existing edit buffer.") | ||
| 139 | 181 | ||
| 140 | (define-minor-mode org-src-mode | 182 | (define-minor-mode org-src-mode |
| 141 | "Minor mode for language major mode buffers generated by org. | 183 | "Minor mode for language major mode buffers generated by org. |
| @@ -145,14 +187,18 @@ This minor mode is turned on in two situations: | |||
| 145 | There is a mode hook, and keybindings for `org-edit-src-exit' and | 187 | There is a mode hook, and keybindings for `org-edit-src-exit' and |
| 146 | `org-edit-src-save'") | 188 | `org-edit-src-save'") |
| 147 | 189 | ||
| 148 | (defun org-edit-src-code () | 190 | (defun org-edit-src-code (&optional context) |
| 149 | "Edit the source code example at point. | 191 | "Edit the source code example at point. |
| 150 | The example is copied to a separate buffer, and that buffer is switched | 192 | The example is copied to a separate buffer, and that buffer is switched |
| 151 | to the correct language mode. When done, exit with \\[org-edit-src-exit]. | 193 | to the correct language mode. When done, exit with \\[org-edit-src-exit]. |
| 152 | This will remove the original code in the Org buffer, and replace it with | 194 | This will remove the original code in the Org buffer, and replace it with |
| 153 | the edited version." | 195 | the edited version. Optional argument CONTEXT is used by |
| 196 | \\[org-edit-src-save] when calling this function." | ||
| 154 | (interactive) | 197 | (interactive) |
| 198 | (unless (eq context 'save) | ||
| 199 | (setq org-edit-src-saved-temp-window-config (current-window-configuration))) | ||
| 155 | (let ((line (org-current-line)) | 200 | (let ((line (org-current-line)) |
| 201 | (col (current-column)) | ||
| 156 | (case-fold-search t) | 202 | (case-fold-search t) |
| 157 | (msg (substitute-command-keys | 203 | (msg (substitute-command-keys |
| 158 | "Edit, then exit with C-c ' (C-c and single quote)")) | 204 | "Edit, then exit with C-c ' (C-c and single quote)")) |
| @@ -160,7 +206,8 @@ the edited version." | |||
| 160 | (org-mode-p (eq major-mode 'org-mode)) | 206 | (org-mode-p (eq major-mode 'org-mode)) |
| 161 | (beg (make-marker)) | 207 | (beg (make-marker)) |
| 162 | (end (make-marker)) | 208 | (end (make-marker)) |
| 163 | nindent ovl lang lang-f single lfmt code begline buffer) | 209 | (preserve-indentation org-src-preserve-indentation) |
| 210 | block-nindent total-nindent ovl lang lang-f single lfmt code begline buffer) | ||
| 164 | (if (not info) | 211 | (if (not info) |
| 165 | nil | 212 | nil |
| 166 | (setq beg (move-marker beg (nth 0 info)) | 213 | (setq beg (move-marker beg (nth 0 info)) |
| @@ -171,15 +218,16 @@ the edited version." | |||
| 171 | lang (if (symbolp lang) (symbol-name lang) lang) | 218 | lang (if (symbolp lang) (symbol-name lang) lang) |
| 172 | single (nth 3 info) | 219 | single (nth 3 info) |
| 173 | lfmt (nth 4 info) | 220 | lfmt (nth 4 info) |
| 174 | nindent (nth 5 info) | 221 | block-nindent (nth 5 info) |
| 175 | lang-f (intern (concat lang "-mode")) | 222 | lang-f (intern (concat lang "-mode")) |
| 176 | begline (save-excursion (goto-char beg) (org-current-line))) | 223 | begline (save-excursion (goto-char beg) (org-current-line))) |
| 177 | (unless (functionp lang-f) | 224 | (unless (functionp lang-f) |
| 178 | (error "No such language mode: %s" lang-f)) | 225 | (error "No such language mode: %s" lang-f)) |
| 179 | (org-goto-line line) | 226 | (org-goto-line line) |
| 180 | (if (and (setq buffer (org-edit-src-find-buffer beg end)) | 227 | (if (and (setq buffer (org-edit-src-find-buffer beg end)) |
| 181 | (y-or-n-p "Return to existing edit buffer? [n] will revert changes: ")) | 228 | (if org-src-ask-before-returning-to-edit-buffer |
| 182 | (switch-to-buffer buffer) | 229 | (y-or-n-p "Return to existing edit buffer? [n] will revert changes: ") t)) |
| 230 | (org-src-switch-to-buffer buffer 'return) | ||
| 183 | (when buffer | 231 | (when buffer |
| 184 | (with-current-buffer buffer | 232 | (with-current-buffer buffer |
| 185 | (if (boundp 'org-edit-src-overlay) | 233 | (if (boundp 'org-edit-src-overlay) |
| @@ -188,7 +236,6 @@ the edited version." | |||
| 188 | (setq buffer (generate-new-buffer | 236 | (setq buffer (generate-new-buffer |
| 189 | (org-src-construct-edit-buffer-name (buffer-name) lang))) | 237 | (org-src-construct-edit-buffer-name (buffer-name) lang))) |
| 190 | (setq ovl (org-make-overlay beg end)) | 238 | (setq ovl (org-make-overlay beg end)) |
| 191 | (org-overlay-put ovl 'face 'secondary-selection) | ||
| 192 | (org-overlay-put ovl 'edit-buffer buffer) | 239 | (org-overlay-put ovl 'edit-buffer buffer) |
| 193 | (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") | 240 | (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment") |
| 194 | (org-overlay-put ovl 'face 'secondary-selection) | 241 | (org-overlay-put ovl 'face 'secondary-selection) |
| @@ -198,26 +245,33 @@ the edited version." | |||
| 198 | (define-key map [mouse-1] 'org-edit-src-continue) | 245 | (define-key map [mouse-1] 'org-edit-src-continue) |
| 199 | map)) | 246 | map)) |
| 200 | (org-overlay-put ovl :read-only "Leave me alone") | 247 | (org-overlay-put ovl :read-only "Leave me alone") |
| 201 | (switch-to-buffer buffer) | 248 | (org-src-switch-to-buffer buffer 'edit) |
| 249 | (if (eq single 'macro-definition) | ||
| 250 | (setq code (replace-regexp-in-string "\\\\n" "\n" code t t))) | ||
| 202 | (insert code) | 251 | (insert code) |
| 203 | (remove-text-properties (point-min) (point-max) | 252 | (remove-text-properties (point-min) (point-max) |
| 204 | '(display nil invisible nil intangible nil)) | 253 | '(display nil invisible nil intangible nil)) |
| 205 | (org-do-remove-indentation) | 254 | (unless preserve-indentation |
| 255 | (setq total-nindent (or (org-do-remove-indentation) 0))) | ||
| 206 | (let ((org-inhibit-startup t)) | 256 | (let ((org-inhibit-startup t)) |
| 207 | (funcall lang-f)) | 257 | (funcall lang-f)) |
| 208 | (set (make-local-variable 'org-edit-src-force-single-line) single) | 258 | (set (make-local-variable 'org-edit-src-force-single-line) single) |
| 209 | (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) | 259 | (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) |
| 260 | (set (make-local-variable 'org-src-preserve-indentation) preserve-indentation) | ||
| 210 | (when lfmt | 261 | (when lfmt |
| 211 | (set (make-local-variable 'org-coderef-label-format) lfmt)) | 262 | (set (make-local-variable 'org-coderef-label-format) lfmt)) |
| 212 | (when org-mode-p | 263 | (when org-mode-p |
| 213 | (goto-char (point-min)) | 264 | (goto-char (point-min)) |
| 214 | (while (re-search-forward "^," nil t) | 265 | (while (re-search-forward "^," nil t) |
| 266 | (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) | ||
| 215 | (replace-match ""))) | 267 | (replace-match ""))) |
| 216 | (org-goto-line (1+ (- line begline))) | 268 | (org-goto-line (1+ (- line begline))) |
| 269 | (org-move-to-column | ||
| 270 | (if preserve-indentation col (max 0 (- col total-nindent)))) | ||
| 217 | (org-set-local 'org-edit-src-beg-marker beg) | 271 | (org-set-local 'org-edit-src-beg-marker beg) |
| 218 | (org-set-local 'org-edit-src-end-marker end) | 272 | (org-set-local 'org-edit-src-end-marker end) |
| 219 | (org-set-local 'org-edit-src-overlay ovl) | 273 | (org-set-local 'org-edit-src-overlay ovl) |
| 220 | (org-set-local 'org-edit-src-nindent nindent) | 274 | (org-set-local 'org-edit-src-block-indentation block-nindent) |
| 221 | (org-src-mode) | 275 | (org-src-mode) |
| 222 | (set-buffer-modified-p nil) | 276 | (set-buffer-modified-p nil) |
| 223 | (and org-edit-src-persistent-message | 277 | (and org-edit-src-persistent-message |
| @@ -229,9 +283,35 @@ the edited version." | |||
| 229 | (interactive "e") | 283 | (interactive "e") |
| 230 | (mouse-set-point e) | 284 | (mouse-set-point e) |
| 231 | (let ((buf (get-char-property (point) 'edit-buffer))) | 285 | (let ((buf (get-char-property (point) 'edit-buffer))) |
| 232 | (if buf (switch-to-buffer buf) | 286 | (if buf (org-src-switch-to-buffer buf 'continue) |
| 233 | (error "Something is wrong here")))) | 287 | (error "Something is wrong here")))) |
| 234 | 288 | ||
| 289 | (defun org-src-switch-to-buffer (buffer context) | ||
| 290 | (case org-src-window-setup | ||
| 291 | ('current-window | ||
| 292 | (switch-to-buffer buffer)) | ||
| 293 | ('other-window | ||
| 294 | (switch-to-buffer-other-window buffer)) | ||
| 295 | ('other-frame | ||
| 296 | (case context | ||
| 297 | ('exit | ||
| 298 | (let ((frame (selected-frame))) | ||
| 299 | (switch-to-buffer-other-frame buffer) | ||
| 300 | (delete-frame frame))) | ||
| 301 | ('save | ||
| 302 | (kill-buffer (current-buffer)) | ||
| 303 | (switch-to-buffer buffer)) | ||
| 304 | (t | ||
| 305 | (switch-to-buffer-other-frame buffer)))) | ||
| 306 | ('reorganize-frame | ||
| 307 | (if (eq context 'edit) (delete-other-windows)) | ||
| 308 | (org-switch-to-buffer-other-window buffer) | ||
| 309 | (if (eq context 'exit) (delete-other-windows))) | ||
| 310 | (t | ||
| 311 | (message "Invalid value %s for org-src-window-setup" | ||
| 312 | (symbol-name org-src-window-setup)) | ||
| 313 | (switch-to-buffer buffer)))) | ||
| 314 | |||
| 235 | (defun org-src-construct-edit-buffer-name (org-buffer-name lang) | 315 | (defun org-src-construct-edit-buffer-name (org-buffer-name lang) |
| 236 | "Construct the buffer name for a source editing buffer" | 316 | "Construct the buffer name for a source editing buffer" |
| 237 | (concat "*Org Src " org-buffer-name "[ " lang " ]*")) | 317 | (concat "*Org Src " org-buffer-name "[ " lang " ]*")) |
| @@ -261,13 +341,15 @@ exit with \\[org-edit-src-exit]. The edited text will then replace | |||
| 261 | the fragment in the Org-mode buffer." | 341 | the fragment in the Org-mode buffer." |
| 262 | (interactive) | 342 | (interactive) |
| 263 | (let ((line (org-current-line)) | 343 | (let ((line (org-current-line)) |
| 344 | (col (current-column)) | ||
| 264 | (case-fold-search t) | 345 | (case-fold-search t) |
| 265 | (msg (substitute-command-keys | 346 | (msg (substitute-command-keys |
| 266 | "Edit, then exit with C-c ' (C-c and single quote)")) | 347 | "Edit, then exit with C-c ' (C-c and single quote)")) |
| 267 | (org-mode-p (eq major-mode 'org-mode)) | 348 | (org-mode-p (eq major-mode 'org-mode)) |
| 268 | (beg (make-marker)) | 349 | (beg (make-marker)) |
| 269 | (end (make-marker)) | 350 | (end (make-marker)) |
| 270 | nindent ovl beg1 end1 code begline buffer) | 351 | (preserve-indentation org-src-preserve-indentation) |
| 352 | block-nindent ovl beg1 end1 code begline buffer) | ||
| 271 | (beginning-of-line 1) | 353 | (beginning-of-line 1) |
| 272 | (if (looking-at "[ \t]*[^:\n \t]") | 354 | (if (looking-at "[ \t]*[^:\n \t]") |
| 273 | nil | 355 | nil |
| @@ -312,7 +394,7 @@ the fragment in the Org-mode buffer." | |||
| 312 | (insert code) | 394 | (insert code) |
| 313 | (remove-text-properties (point-min) (point-max) | 395 | (remove-text-properties (point-min) (point-max) |
| 314 | '(display nil invisible nil intangible nil)) | 396 | '(display nil invisible nil intangible nil)) |
| 315 | (setq nindent (org-do-remove-indentation)) | 397 | (setq block-nindent (or (org-do-remove-indentation) 0)) |
| 316 | (cond | 398 | (cond |
| 317 | ((eq org-edit-fixed-width-region-mode 'artist-mode) | 399 | ((eq org-edit-fixed-width-region-mode 'artist-mode) |
| 318 | (fundamental-mode) | 400 | (fundamental-mode) |
| @@ -325,10 +407,13 @@ the fragment in the Org-mode buffer." | |||
| 325 | (while (re-search-forward "^[ \t]*: ?" nil t) | 407 | (while (re-search-forward "^[ \t]*: ?" nil t) |
| 326 | (replace-match "")) | 408 | (replace-match "")) |
| 327 | (org-goto-line (1+ (- line begline))) | 409 | (org-goto-line (1+ (- line begline))) |
| 410 | (org-move-to-column (max 0 (- col block-nindent 2))) | ||
| 328 | (org-set-local 'org-edit-src-beg-marker beg) | 411 | (org-set-local 'org-edit-src-beg-marker beg) |
| 329 | (org-set-local 'org-edit-src-end-marker end) | 412 | (org-set-local 'org-edit-src-end-marker end) |
| 330 | (org-set-local 'org-edit-src-overlay ovl) | 413 | (org-set-local 'org-edit-src-overlay ovl) |
| 331 | (org-set-local 'org-edit-src-nindent nindent) | 414 | (org-set-local 'org-edit-src-block-indentation block-nindent) |
| 415 | (org-set-local 'org-edit-src-content-indentation 0) | ||
| 416 | (org-set-local 'org-src-preserve-indentation nil) | ||
| 332 | (org-src-mode) | 417 | (org-src-mode) |
| 333 | (set-buffer-modified-p nil) | 418 | (set-buffer-modified-p nil) |
| 334 | (and org-edit-src-persistent-message | 419 | (and org-edit-src-persistent-message |
| @@ -339,7 +424,7 @@ the fragment in the Org-mode buffer." | |||
| 339 | (defun org-edit-src-find-region-and-lang () | 424 | (defun org-edit-src-find-region-and-lang () |
| 340 | "Find the region and language for a local edit. | 425 | "Find the region and language for a local edit. |
| 341 | Return a list with beginning and end of the region, a string representing | 426 | Return a list with beginning and end of the region, a string representing |
| 342 | the language, a switch telling of the content should be in a single line." | 427 | the language, a switch telling if the content should be in a single line." |
| 343 | (let ((re-list | 428 | (let ((re-list |
| 344 | (append | 429 | (append |
| 345 | org-edit-src-region-extra | 430 | org-edit-src-region-extra |
| @@ -360,6 +445,8 @@ the language, a switch telling of the content should be in a single line." | |||
| 360 | ("^[ \t]*#\\+ascii:" "\n" "fundamental" single-line) | 445 | ("^[ \t]*#\\+ascii:" "\n" "fundamental" single-line) |
| 361 | ("^[ \t]*#\\+begin_ascii.*\n" "\n[ \t]*#\\+end_ascii" "fundamental") | 446 | ("^[ \t]*#\\+begin_ascii.*\n" "\n[ \t]*#\\+end_ascii" "fundamental") |
| 362 | ("^[ \t]*#\\+docbook:" "\n" "xml" single-line) | 447 | ("^[ \t]*#\\+docbook:" "\n" "xml" single-line) |
| 448 | ("^[ \t]*#\\+macro:[ \t]+\\S-+\\( \\|$\\)" | ||
| 449 | "\n" "fundamental" macro-definition) | ||
| 363 | ("^[ \t]*#\\+begin_docbook.*\n" "\n[ \t]*#\\+end_docbook" "xml") | 450 | ("^[ \t]*#\\+begin_docbook.*\n" "\n[ \t]*#\\+end_docbook" "xml") |
| 364 | ))) | 451 | ))) |
| 365 | (pos (point)) | 452 | (pos (point)) |
| @@ -418,78 +505,100 @@ the language, a switch telling of the content should be in a single line." | |||
| 418 | (match-string 1 s)))) | 505 | (match-string 1 s)))) |
| 419 | 506 | ||
| 420 | (defun org-edit-src-get-indentation (pos) | 507 | (defun org-edit-src-get-indentation (pos) |
| 421 | "Extract the label format." | 508 | "Count leading whitespace characters on line" |
| 422 | (save-match-data | 509 | (save-match-data |
| 423 | (goto-char pos) | 510 | (goto-char pos) |
| 424 | (org-get-indentation))) | 511 | (org-get-indentation))) |
| 425 | 512 | ||
| 426 | (defun org-edit-src-exit () | 513 | (defun org-edit-src-exit (&optional context) |
| 427 | "Exit special edit and protect problematic lines." | 514 | "Exit special edit and protect problematic lines." |
| 428 | (interactive) | 515 | (interactive) |
| 429 | (unless org-edit-src-from-org-mode | 516 | (unless org-edit-src-from-org-mode |
| 430 | (error "This is not a sub-editing buffer, something is wrong...")) | 517 | (error "This is not a sub-editing buffer, something is wrong...")) |
| 431 | (let ((beg org-edit-src-beg-marker) | 518 | (let* ((beg org-edit-src-beg-marker) |
| 432 | (end org-edit-src-end-marker) | 519 | (end org-edit-src-end-marker) |
| 433 | (ovl org-edit-src-overlay) | 520 | (ovl org-edit-src-overlay) |
| 434 | (buffer (current-buffer)) | 521 | (buffer (current-buffer)) |
| 435 | (nindent org-edit-src-nindent) | 522 | (single (org-bound-and-true-p org-edit-src-force-single-line)) |
| 436 | code line) | 523 | (macro (eq single 'macro-definition)) |
| 524 | (total-nindent (+ (or org-edit-src-block-indentation 0) | ||
| 525 | org-edit-src-content-indentation)) | ||
| 526 | (preserve-indentation org-src-preserve-indentation) | ||
| 527 | (delta 0) code line col indent) | ||
| 437 | (untabify (point-min) (point-max)) | 528 | (untabify (point-min) (point-max)) |
| 438 | (save-excursion | 529 | (save-excursion |
| 439 | (goto-char (point-min)) | 530 | (goto-char (point-min)) |
| 440 | (if (looking-at "[ \t\n]*\n") (replace-match "")) | 531 | (if (looking-at "[ \t\n]*\n") (replace-match "")) |
| 441 | (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match ""))) | 532 | (unless macro |
| 533 | (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")))) | ||
| 442 | (setq line (if (org-bound-and-true-p org-edit-src-force-single-line) | 534 | (setq line (if (org-bound-and-true-p org-edit-src-force-single-line) |
| 443 | 1 | 535 | 1 |
| 444 | (org-current-line))) | 536 | (org-current-line)) |
| 445 | (when (org-bound-and-true-p org-edit-src-force-single-line) | 537 | col (current-column)) |
| 538 | (when single | ||
| 539 | (goto-char (point-min)) | ||
| 540 | (if (re-search-forward "\\s-+\\'" nil t) (replace-match "")) | ||
| 446 | (goto-char (point-min)) | 541 | (goto-char (point-min)) |
| 447 | (while (re-search-forward "\n" nil t) | 542 | (let ((cnt 0)) |
| 448 | (replace-match " ")) | 543 | (while (re-search-forward "\n" nil t) |
| 544 | (setq cnt (1+ cnt)) | ||
| 545 | (replace-match (if macro "\\n" " ") t t)) | ||
| 546 | (when (and macro (> cnt 0)) | ||
| 547 | (goto-char (point-max)) (insert "\\n"))) | ||
| 449 | (goto-char (point-min)) | 548 | (goto-char (point-min)) |
| 450 | (if (looking-at "\\s-*") (replace-match " ")) | 549 | (if (looking-at "\\s-*") (replace-match " "))) |
| 451 | (if (re-search-forward "\\s-+\\'" nil t) | ||
| 452 | (replace-match ""))) | ||
| 453 | (when (org-bound-and-true-p org-edit-src-from-org-mode) | 550 | (when (org-bound-and-true-p org-edit-src-from-org-mode) |
| 454 | (goto-char (point-min)) | 551 | (goto-char (point-min)) |
| 455 | (while (re-search-forward | 552 | (while (re-search-forward |
| 456 | (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) | 553 | (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) |
| 554 | (if (eq (org-current-line) line) (setq delta (1+ delta))) | ||
| 457 | (replace-match ",\\1"))) | 555 | (replace-match ",\\1"))) |
| 458 | (when (org-bound-and-true-p org-edit-src-picture) | 556 | (when (org-bound-and-true-p org-edit-src-picture) |
| 557 | (setq preserve-indentation nil) | ||
| 459 | (untabify (point-min) (point-max)) | 558 | (untabify (point-min) (point-max)) |
| 460 | (goto-char (point-min)) | 559 | (goto-char (point-min)) |
| 461 | (while (re-search-forward "^" nil t) | 560 | (while (re-search-forward "^" nil t) |
| 462 | (replace-match ": "))) | 561 | (replace-match ": "))) |
| 463 | (when nindent | 562 | (unless (or single preserve-indentation (= total-nindent 0)) |
| 464 | (setq nindent (make-string (+ org-edit-src-content-indentation nindent) | 563 | (setq indent (make-string total-nindent ?\ )) |
| 465 | ?\ )) | ||
| 466 | (goto-char (point-min)) | 564 | (goto-char (point-min)) |
| 467 | (while (re-search-forward "^" nil t) | 565 | (while (re-search-forward "^" nil t) |
| 468 | (replace-match nindent))) | 566 | (replace-match indent))) |
| 567 | (if (org-bound-and-true-p org-edit-src-picture) | ||
| 568 | (setq total-nindent (+ total-nindent 2))) | ||
| 469 | (setq code (buffer-string)) | 569 | (setq code (buffer-string)) |
| 470 | (set-buffer-modified-p nil) | 570 | (set-buffer-modified-p nil) |
| 471 | (switch-to-buffer (marker-buffer beg)) | 571 | (org-src-switch-to-buffer (marker-buffer beg) (or context 'exit)) |
| 472 | (kill-buffer buffer) | 572 | (kill-buffer buffer) |
| 473 | (goto-char beg) | 573 | (goto-char beg) |
| 474 | (delete-region beg end) | 574 | (delete-region beg end) |
| 475 | (insert code) | 575 | (insert code) |
| 476 | (goto-char beg) | 576 | (goto-char beg) |
| 577 | (if single (just-one-space)) | ||
| 477 | (org-goto-line (1- (+ (org-current-line) line))) | 578 | (org-goto-line (1- (+ (org-current-line) line))) |
| 579 | (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))) | ||
| 478 | (move-marker beg nil) | 580 | (move-marker beg nil) |
| 479 | (move-marker end nil))) | 581 | (move-marker end nil)) |
| 582 | (unless (eq context 'save) | ||
| 583 | (when org-edit-src-saved-temp-window-config | ||
| 584 | (set-window-configuration org-edit-src-saved-temp-window-config) | ||
| 585 | (setq org-edit-src-saved-temp-window-config nil)))) | ||
| 480 | 586 | ||
| 481 | (defun org-edit-src-save () | 587 | (defun org-edit-src-save () |
| 482 | "Save parent buffer with current state source-code buffer." | 588 | "Save parent buffer with current state source-code buffer." |
| 483 | (interactive) | 589 | (interactive) |
| 484 | (save-window-excursion | 590 | (let ((p (point)) (m (mark)) msg) |
| 485 | (let ((p (point)) (m (mark)) msg) | 591 | (save-window-excursion |
| 486 | (org-edit-src-exit) | 592 | (org-edit-src-exit 'save) |
| 487 | (save-buffer) | 593 | (save-buffer) |
| 488 | (setq msg (current-message)) | 594 | (setq msg (current-message)) |
| 489 | (org-edit-src-code) | 595 | (if (eq org-src-window-setup 'other-frame) |
| 490 | (push-mark m 'nomessage) | 596 | (let ((org-src-window-setup 'current-window)) |
| 491 | (goto-char (min p (point-max))) | 597 | (org-edit-src-code 'save)) |
| 492 | (message (or msg ""))))) | 598 | (org-edit-src-code 'save))) |
| 599 | (push-mark m 'nomessage) | ||
| 600 | (goto-char (min p (point-max))) | ||
| 601 | (message (or msg "")))) | ||
| 493 | 602 | ||
| 494 | (defun org-src-mode-configure-edit-buffer () | 603 | (defun org-src-mode-configure-edit-buffer () |
| 495 | (when org-edit-src-from-org-mode | 604 | (when org-edit-src-from-org-mode |
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 452fba8bd33..a484571dcde 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -252,14 +252,14 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line." | |||
| 252 | :type 'boolean) | 252 | :type 'boolean) |
| 253 | 253 | ||
| 254 | (defcustom org-table-relative-ref-may-cross-hline t | 254 | (defcustom org-table-relative-ref-may-cross-hline t |
| 255 | "Non-nil means, reltive formula references may cross hlines. | 255 | "Non-nil means, relative formula references may cross hlines. |
| 256 | Here are the allowed values: | 256 | Here are the allowed values: |
| 257 | 257 | ||
| 258 | nil Relative references may not cross hlines. They will reference the | 258 | nil Relative references may not cross hlines. They will reference the |
| 259 | field next to the hline instead. Coming from below, the reference | 259 | field next to the hline instead. Coming from below, the reference |
| 260 | will be to the field below the hline. Coming from above, it will be | 260 | will be to the field below the hline. Coming from above, it will be |
| 261 | to the field above. | 261 | to the field above. |
| 262 | t Relative references may cros hlines. | 262 | t Relative references may cross hlines. |
| 263 | error An attempt to cross a hline will throw an error. | 263 | error An attempt to cross a hline will throw an error. |
| 264 | 264 | ||
| 265 | It is probably good to never set this variable to nil, for the sake of | 265 | It is probably good to never set this variable to nil, for the sake of |
| @@ -424,17 +424,28 @@ nil When nil, the command tries to be smart and figure out the | |||
| 424 | ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) | 424 | ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) |
| 425 | ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) | 425 | ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) |
| 426 | (t 1)))) | 426 | (t 1)))) |
| 427 | (setq re (cond | ||
| 428 | ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") | ||
| 429 | ((equal separator '(16)) "^\\|\t") | ||
| 430 | ((integerp separator) | ||
| 431 | (format "^ *\\| *\t *\\| \\{%d,\\}" separator)) | ||
| 432 | (t (error "This should not happen")))) | ||
| 433 | (goto-char beg) | 427 | (goto-char beg) |
| 434 | (while (re-search-forward re end t) | 428 | (if (equal separator '(4)) |
| 435 | (replace-match "| " t t)) | 429 | (while (<= (point) end) |
| 430 | ;; parse the csv stuff | ||
| 431 | (cond | ||
| 432 | ((looking-at "^") (insert "| ")) | ||
| 433 | ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) | ||
| 434 | ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") | ||
| 435 | (replace-match "\\1") | ||
| 436 | (if (looking-at "\"") (insert "\""))) | ||
| 437 | ((looking-at "[^,\n]+") (goto-char (match-end 0))) | ||
| 438 | ((looking-at "[ \t]*,") (replace-match " | ")) | ||
| 439 | (t (beginning-of-line 2)))) | ||
| 440 | (setq re (cond | ||
| 441 | ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") | ||
| 442 | ((equal separator '(16)) "^\\|\t") | ||
| 443 | ((integerp separator) | ||
| 444 | (format "^ *\\| *\t *\\| \\{%d,\\}" separator)) | ||
| 445 | (t (error "This should not happen")))) | ||
| 446 | (while (re-search-forward re end t) | ||
| 447 | (replace-match "| " t t))) | ||
| 436 | (goto-char beg) | 448 | (goto-char beg) |
| 437 | (insert " ") | ||
| 438 | (org-table-align))) | 449 | (org-table-align))) |
| 439 | 450 | ||
| 440 | (defun org-table-import (file arg) | 451 | (defun org-table-import (file arg) |
| @@ -2136,7 +2147,7 @@ installed in order to use this function. | |||
| 2136 | In a table, this command replaces the value in the current field with the | 2147 | In a table, this command replaces the value in the current field with the |
| 2137 | result of a formula. It also installs the formula as the \"current\" column | 2148 | result of a formula. It also installs the formula as the \"current\" column |
| 2138 | formula, by storing it in a special line below the table. When called | 2149 | formula, by storing it in a special line below the table. When called |
| 2139 | with a `C-u' prefix, the current field must ba a named field, and the | 2150 | with a `C-u' prefix, the current field must be a named field, and the |
| 2140 | formula is installed as valid in only this specific field. | 2151 | formula is installed as valid in only this specific field. |
| 2141 | 2152 | ||
| 2142 | When called with two `C-u' prefixes, insert the active equation | 2153 | When called with two `C-u' prefixes, insert the active equation |
| @@ -2556,7 +2567,7 @@ known that the table will be realigned a little later anyway." | |||
| 2556 | (push (append a (list (cdr eq))) eqlname1) | 2567 | (push (append a (list (cdr eq))) eqlname1) |
| 2557 | (org-table-put-field-property :org-untouchable t))) | 2568 | (org-table-put-field-property :org-untouchable t))) |
| 2558 | 2569 | ||
| 2559 | ;; Now evauluate the column formulas, but skip fields covered by | 2570 | ;; Now evaluate the column formulas, but skip fields covered by |
| 2560 | ;; field formulas | 2571 | ;; field formulas |
| 2561 | (goto-char beg) | 2572 | (goto-char beg) |
| 2562 | (while (re-search-forward line-re end t) | 2573 | (while (re-search-forward line-re end t) |
| @@ -3499,10 +3510,12 @@ to execute outside of tables." | |||
| 3499 | (orgtbl-make-binding 'org-table-previous-field 104 | 3510 | (orgtbl-make-binding 'org-table-previous-field 104 |
| 3500 | [(shift tab)] [(tab)] "\C-i")) | 3511 | [(shift tab)] [(tab)] "\C-i")) |
| 3501 | 3512 | ||
| 3502 | (org-defkey orgtbl-mode-map [S-iso-lefttab] | 3513 | |
| 3503 | (orgtbl-make-binding 'org-table-previous-field 107 | 3514 | (unless (featurep 'xemacs) |
| 3504 | [S-iso-lefttab] [backtab] [(shift tab)] | 3515 | (org-defkey orgtbl-mode-map [S-iso-lefttab] |
| 3505 | [(tab)] "\C-i")) | 3516 | (orgtbl-make-binding 'org-table-previous-field 107 |
| 3517 | [S-iso-lefttab] [backtab] [(shift tab)] | ||
| 3518 | [(tab)] "\C-i"))) | ||
| 3506 | 3519 | ||
| 3507 | (org-defkey orgtbl-mode-map [backtab] | 3520 | (org-defkey orgtbl-mode-map [backtab] |
| 3508 | (orgtbl-make-binding 'org-table-previous-field 108 | 3521 | (orgtbl-make-binding 'org-table-previous-field 108 |
| @@ -4202,7 +4215,7 @@ NAME-OR-ID may be the name of a table in the current file as set by | |||
| 4202 | a \"#+TBLNAME:\" directive. The first table following this line | 4215 | a \"#+TBLNAME:\" directive. The first table following this line |
| 4203 | will then be used. Alternatively, it may be an ID referring to | 4216 | will then be used. Alternatively, it may be an ID referring to |
| 4204 | any entry, also in a different file. In this case, the first table | 4217 | any entry, also in a different file. In this case, the first table |
| 4205 | in that netry will be referenced. | 4218 | in that entry will be referenced. |
| 4206 | FORM is a field or range descriptor like \"@2$3\" or or \"B3\" or | 4219 | FORM is a field or range descriptor like \"@2$3\" or or \"B3\" or |
| 4207 | \"@I$2..@II$2\". All the references must be absolute, not relative. | 4220 | \"@I$2..@II$2\". All the references must be absolute, not relative. |
| 4208 | 4221 | ||
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 715797c4021..ab2a8c1d896 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -217,7 +217,7 @@ If the integer is negative, the string will start with \"-\"." | |||
| 217 | (defvar org-timer-mode-line-string nil) | 217 | (defvar org-timer-mode-line-string nil) |
| 218 | 218 | ||
| 219 | (defun org-timer-set-mode-line (value) | 219 | (defun org-timer-set-mode-line (value) |
| 220 | "Set the mode-line dispay of the relative timer. | 220 | "Set the mode-line display of the relative timer. |
| 221 | VALUE can be `on', `off', or `pause'." | 221 | VALUE can be `on', `off', or `pause'." |
| 222 | (or global-mode-string (setq global-mode-string '(""))) | 222 | (or global-mode-string (setq global-mode-string '(""))) |
| 223 | (or (memq 'org-timer-mode-line-string global-mode-string) | 223 | (or (memq 'org-timer-mode-line-string global-mode-string) |
| @@ -284,7 +284,7 @@ VALUE can be `on', `off', or `pause'." | |||
| 284 | (current-time)))) | 284 | (current-time)))) |
| 285 | (rsecs (nth 0 rtime)) | 285 | (rsecs (nth 0 rtime)) |
| 286 | (rmins (nth 1 rtime))) | 286 | (rmins (nth 1 rtime))) |
| 287 | (message "%d minutes %d secondes left before next time out" | 287 | (message "%d minutes %d seconds left before next time out" |
| 288 | rmins rsecs)))) | 288 | rmins rsecs)))) |
| 289 | 289 | ||
| 290 | ;;;###autoload | 290 | ;;;###autoload |
| @@ -312,12 +312,12 @@ VALUE can be `on', `off', or `pause'." | |||
| 312 | (t (error "Not in an Org buffer")))) | 312 | (t (error "Not in an Org buffer")))) |
| 313 | timer-set) | 313 | timer-set) |
| 314 | (mapcar (lambda(timer) | 314 | (mapcar (lambda(timer) |
| 315 | (if (not (or (eval timer) timer-set)) | 315 | (when (not (or (eval timer) timer-set)) |
| 316 | (setq timer-set t | 316 | (setq timer-set t) |
| 317 | timer | 317 | (setq org-timer-last-timer |
| 318 | (run-with-timer | 318 | (run-with-timer |
| 319 | secs nil 'org-notify (format "%s: time out" hl) t) | 319 | secs nil 'org-notify (format "%s: time out" hl) t)) |
| 320 | org-timer-last-timer timer))) | 320 | (set timer org-timer-last-timer))) |
| 321 | '(org-timer-timer1 | 321 | '(org-timer-timer1 |
| 322 | org-timer-timer2 | 322 | org-timer-timer2 |
| 323 | org-timer-timer3))))) | 323 | org-timer-timer3))))) |
diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el index b271c515667..8b0a2eeff4f 100644 --- a/lisp/org/org-vm.el +++ b/lisp/org/org-vm.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el index feba5608fd9..359182ad5bc 100644 --- a/lisp/org/org-w3m.el +++ b/lisp/org/org-w3m.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com> | 5 | ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://orgmode.org | 7 | ;; Homepage: http://orgmode.org |
| 8 | ;; Version: 6.31a | 8 | ;; Version: 6.33 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -26,7 +26,7 @@ | |||
| 26 | ;;; Commentary: | 26 | ;;; Commentary: |
| 27 | 27 | ||
| 28 | ;; This file implements copying HTML content from a w3m buffer and | 28 | ;; This file implements copying HTML content from a w3m buffer and |
| 29 | ;; transfomring the text on the fly so that it can be pasted into | 29 | ;; transforming the text on the fly so that it can be pasted into |
| 30 | ;; an org-mode buffer with hot links. It will also work for regions | 30 | ;; an org-mode buffer with hot links. It will also work for regions |
| 31 | ;; in gnus buffers that have ben washed with w3m. | 31 | ;; in gnus buffers that have ben washed with w3m. |
| 32 | 32 | ||
| @@ -121,7 +121,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly." | |||
| 121 | (point)) | 121 | (point)) |
| 122 | 122 | ||
| 123 | (defun org-w3m-get-prev-link-start () | 123 | (defun org-w3m-get-prev-link-start () |
| 124 | "Move cursor to the start of prevoius link. Return point." | 124 | "Move cursor to the start of previous link. Return point." |
| 125 | (catch 'reach | 125 | (catch 'reach |
| 126 | (while (previous-single-property-change (point) 'w3m-anchor-sequence) | 126 | (while (previous-single-property-change (point) 'w3m-anchor-sequence) |
| 127 | ;; jump to previous anchor | 127 | ;; jump to previous anchor |
diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el index f4cdf7db259..96eb0612f3d 100644 --- a/lisp/org/org-wl.el +++ b/lisp/org/org-wl.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> | 6 | ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> |
| 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 | ;; |
diff --git a/lisp/org/org-xoxo.el b/lisp/org/org-xoxo.el index e58a0003e35..95c13dfb6d1 100644 --- a/lisp/org/org-xoxo.el +++ b/lisp/org/org-xoxo.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
diff --git a/lisp/org/org.el b/lisp/org/org.el index d3db0094aab..7b2e95b0976 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -6,7 +6,7 @@ | |||
| 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 | ;; |
| @@ -95,35 +95,36 @@ | |||
| 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 | ||
| @@ -136,6 +137,11 @@ With prefix arg HERE, insert it at point." | |||
| 136 | :group 'hypermedia | 137 | :group 'hypermedia |
| 137 | :group 'calendar) | 138 | :group 'calendar) |
| 138 | 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) | ||
| 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 |
| @@ -187,6 +193,7 @@ to add the symbol `xyz', and the package must have a call to | |||
| 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) |
| @@ -196,40 +203,40 @@ to add the symbol `xyz', and the package must have a call to | |||
| 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 |
| @@ -473,7 +480,7 @@ An entry can be toggled between QUOTE and normal with | |||
| 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 | ||
| @@ -586,6 +593,28 @@ new-frame Make a new frame each time. Note that in this case | |||
| 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" |
| @@ -650,6 +679,21 @@ of the buffer." | |||
| 650 | :group 'org-cycle | 679 | :group 'org-cycle |
| 651 | :type 'boolean) | 680 | :type 'boolean) |
| 652 | 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." | ||
| 694 | :group 'org-cycle | ||
| 695 | :type 'boolean) | ||
| 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. |
| 655 | nil Never | 699 | nil Never |
| @@ -971,7 +1015,7 @@ See also the variable `org-table-auto-blank-field'." | |||
| 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 |
| @@ -1290,7 +1334,7 @@ changes to the current buffer." | |||
| 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 | ||
| @@ -1388,6 +1432,7 @@ See `org-file-apps'.") | |||
| 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 | ) |
| @@ -1905,7 +1950,7 @@ 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 | ||
| @@ -1920,7 +1965,7 @@ property to one or more of these keywords." | |||
| 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 |
| @@ -1928,6 +1973,51 @@ property to one or more of these keywords." | |||
| 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 |
| @@ -1949,6 +2039,8 @@ When nil, only the date will be recorded." | |||
| 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 |
| @@ -1967,7 +2059,9 @@ empty string. | |||
| 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)) |
| @@ -2173,6 +2267,18 @@ 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. |
| @@ -2187,20 +2293,29 @@ Custom commands can set this variable in the options section." | |||
| 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. | ||
| 2195 | For example, if it is april and you enter \"feb 2\", this will be read | ||
| 2196 | as feb 2, *next* year. \"May 5\", however, will be this year. | ||
| 2197 | 2303 | ||
| 2198 | Currently this does not work for ISO week specifications. | 2304 | If you set this variable to the symbol `time', then also the following |
| 2305 | will work: | ||
| 2306 | |||
| 2307 | 3. If the user gives a time, but no day. If the time is before now, | ||
| 2308 | to will be interpreted as tomorrow. | ||
| 2199 | 2309 | ||
| 2200 | When this option is nil, the current month and year will always be used | 2310 | Currently none of this works for ISO week specifications. |
| 2201 | as defaults." | 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. |
| @@ -2272,8 +2387,12 @@ See the manual for details." | |||
| 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 |
| @@ -2300,7 +2419,7 @@ To disable these tags on a per-file basis, insert anywhere in the file: | |||
| 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. |
| @@ -2640,12 +2759,39 @@ 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." |
| @@ -2749,7 +2895,7 @@ Changing this variable requires a restart of Emacs to take effect." | |||
| 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 | ||
| @@ -2905,7 +3051,7 @@ See also `org-completion-use-iswitchb'." | |||
| 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 | ||
| @@ -2915,7 +3061,7 @@ 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 |
| @@ -2959,6 +3105,7 @@ Normal means, no org-mode-specific context." | |||
| 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)) |
| @@ -3131,11 +3278,15 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." | |||
| 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." |
| @@ -3148,7 +3299,7 @@ The return value is actually the clock marker." | |||
| 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. |
| @@ -3228,6 +3379,11 @@ If yes, offer to stop it and to save the buffer with the changes." | |||
| 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" |
| @@ -3280,7 +3436,7 @@ Here are a few examples: | |||
| 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\" |
| @@ -3317,8 +3473,8 @@ Instead, use the key `v' to cycle the archives-mode in the agenda." | |||
| 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) |
| @@ -3367,9 +3523,17 @@ collapsed state." | |||
| 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))))) |
| 3372 | 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))) | ||
| 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 |
| @@ -3513,7 +3677,7 @@ groups carry important information: | |||
| 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 | ||
| @@ -3541,6 +3705,12 @@ After a match, the following groups carry important information: | |||
| 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) |
| @@ -3927,7 +4097,6 @@ This is for getting out of special buffers like remember.") | |||
| 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 | ||
| @@ -3945,8 +4114,6 @@ This variable is set by `org-before-change-function'. | |||
| 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. |
| @@ -4085,6 +4252,10 @@ The following commands are available: | |||
| 4085 | (org-indent-mode 1)) | 4252 | (org-indent-mode 1)) |
| 4086 | (org-set-startup-visibility))) | 4253 | (org-set-startup-visibility))) |
| 4087 | 4254 | ||
| 4255 | (when (fboundp 'abbrev-table-put) | ||
| 4256 | (abbrev-table-put org-mode-abbrev-table | ||
| 4257 | :parents (list text-mode-abbrev-table))) | ||
| 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 () |
| @@ -4649,6 +4820,13 @@ between words." | |||
| 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) |
| @@ -4824,11 +5002,17 @@ If KWD is a number, get the corresponding match group." | |||
| 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 | ||
| @@ -4847,7 +5031,7 @@ If KWD is a number, get the corresponding match group." | |||
| 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 |
| @@ -4885,7 +5069,10 @@ in special contexts. | |||
| 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) |
| @@ -4972,6 +5159,9 @@ in special contexts. | |||
| 4972 | 5159 | ||
| 4973 | ((org-try-cdlatex-tab)) | 5160 | ((org-try-cdlatex-tab)) |
| 4974 | 5161 | ||
| 5162 | ((run-hook-with-args-until-success | ||
| 5163 | 'org-tab-before-tab-emulation-hook)) | ||
| 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)))) |
| @@ -5318,6 +5508,27 @@ are at least `org-cycle-separator-lines' empty lines before the headline." | |||
| 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) |
| @@ -5366,7 +5577,7 @@ Optional argument N means, put the headline into the Nth line of the window." | |||
| 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) |
| @@ -5497,7 +5708,7 @@ RET=jump to location [Q]uit and return to previous location | |||
| 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 | ||
| @@ -5988,6 +6199,16 @@ in the region." | |||
| 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'." |
| @@ -6040,6 +6261,31 @@ in the region." | |||
| 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))) |
| 6042 | 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))) | ||
| 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) |
| @@ -6489,6 +6735,7 @@ and still retain the repeater to cover future instances of the task." | |||
| 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 |
| @@ -6565,7 +6812,7 @@ 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 |
| @@ -7762,24 +8009,27 @@ from." | |||
| 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." |
| @@ -7881,7 +8131,7 @@ This is still an experimental function, your mileage may vary." | |||
| 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))))) |
| @@ -7949,7 +8199,8 @@ application the system uses for this file type." | |||
| 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)) |
| @@ -8110,7 +8361,7 @@ application the system uses for this file type." | |||
| 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 |
| @@ -8132,7 +8383,8 @@ there is one, offer it as link number zero." | |||
| 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))) |
| @@ -8162,7 +8414,9 @@ there is one, offer it as link number zero." | |||
| 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 | ||
| @@ -8674,7 +8928,7 @@ on the system \"/user@host:\"." | |||
| 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) |
| @@ -8770,6 +9024,7 @@ 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 | ||
| @@ -8791,11 +9046,21 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'" | |||
| 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)) |
| @@ -8823,7 +9088,7 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'" | |||
| 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 |
| @@ -8992,7 +9257,7 @@ If not found, stay at current position and return nil." | |||
| 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.") |
| @@ -9129,6 +9394,7 @@ This function can be used in a hook." | |||
| 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 | ||
| @@ -9412,7 +9678,7 @@ DONE are present, add TODO at the beginning of the heading. | |||
| 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 |
| @@ -9434,7 +9700,7 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 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 " *")) |
| @@ -9500,6 +9766,8 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 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))) |
| @@ -9627,7 +9895,8 @@ changes. Such blocking occurs when: | |||
| 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 |
| @@ -9709,7 +9978,7 @@ See variable `org-track-ordered-property-with-tag'." | |||
| 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 |
| @@ -9717,7 +9986,8 @@ changes because there are uncheckd boxes in this entry." | |||
| 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 |
| @@ -9796,7 +10066,7 @@ statistics everywhere." | |||
| 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\\>" |
| @@ -9831,10 +10101,10 @@ statistics everywhere." | |||
| 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 |
| @@ -9855,7 +10125,7 @@ when there is a statistics cookie in the headline! | |||
| 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) |
| @@ -10004,14 +10274,16 @@ Returns the new TODO keyword, or nil if no state change should occur." | |||
| 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) |
| @@ -10124,29 +10396,41 @@ 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 |
| @@ -10158,7 +10442,7 @@ returns nil." | |||
| 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 |
| @@ -10258,6 +10542,7 @@ be removed." | |||
| 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) ?\ ))) " " "") |
| @@ -10387,6 +10672,10 @@ EXTRA is additional text that will be inserted into the notes buffer." | |||
| 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"))))) |
| @@ -10452,7 +10741,7 @@ EXTRA is additional text that will be inserted into the notes buffer." | |||
| 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 |
| @@ -10472,7 +10761,7 @@ 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." |
| @@ -10656,6 +10945,8 @@ ACTION can be `set', `up', `down', or a character." | |||
| 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)) |
| @@ -10717,7 +11008,7 @@ ACTION can be `set', `up', `down', or a character." | |||
| 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.") |
| @@ -10754,7 +11045,6 @@ only lines with a TODO keyword are included in the output." | |||
| 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 |
| @@ -11497,15 +11787,15 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 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) |
| @@ -11550,8 +11840,8 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 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 |
| @@ -11656,6 +11946,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 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 |
| @@ -11788,7 +12079,7 @@ but in some other way.") | |||
| 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 | ||
| @@ -11843,13 +12134,24 @@ allowed value." | |||
| 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 |
| @@ -12699,6 +13001,7 @@ user." | |||
| 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 |
| @@ -12728,6 +13031,8 @@ user." | |||
| 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)))) |
| @@ -12737,8 +13042,8 @@ user." | |||
| 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 | ||
| @@ -12811,22 +13116,36 @@ user." | |||
| 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 |
| @@ -12846,6 +13165,7 @@ user." | |||
| 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)))) |
| @@ -12854,6 +13174,7 @@ user." | |||
| 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)))) |
| @@ -12864,6 +13185,7 @@ user." | |||
| 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) |
| @@ -12982,7 +13304,7 @@ The command returns the inserted time stamp." | |||
| 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) |
| @@ -13494,7 +13816,7 @@ in the timestamp determines what will be changed." | |||
| 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) |
| @@ -13637,7 +13959,7 @@ If there is already a time stamp at the cursor position, update it." | |||
| 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." |
| @@ -14398,7 +14720,7 @@ Some of the options can be changed using the variable | |||
| 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) |
| @@ -14505,34 +14827,115 @@ Some of the options can be changed using the variable | |||
| 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) |
| @@ -14546,7 +14949,7 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 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)) ?*) |
| @@ -14676,6 +15079,12 @@ 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.") |
| 14678 | 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.") | ||
| 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.") |
| @@ -15443,21 +15852,11 @@ See the individual commands for more information." | |||
| 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" |
| 15446 | ["Toggle ARCHIVE tag" org-toggle-archive-tag t] | 15855 | ["Archive (default method)" org-archive-subtree-default t] |
| 15447 | ; ["Check and Tag Children" (org-toggle-archive-tag (4)) | ||
| 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 | "--" | 15856 | "--" |
| 15457 | ["Move subtree to archive sibling" org-archive-to-archive-sibling t] | 15857 | ["Move Subtree to Archive file" org-advertized-archive-subtree t] |
| 15458 | ["Move Subtree to Archive" org-advertized-archive-subtree t] | 15858 | ["Toggle ARCHIVE tag" org-toggle-archive-tag t] |
| 15459 | ; ["Check and Move Children" (org-archive-subtree '(4)) | 15859 | ["Move subtree to Archive sibling" org-archive-to-archive-sibling t] |
| 15460 | ; :active t :keys "C-u C-c C-x C-s"] | ||
| 15461 | ) | 15860 | ) |
| 15462 | "--" | 15861 | "--" |
| 15463 | ("Hyperlinks" | 15862 | ("Hyperlinks" |
| @@ -15795,6 +16194,10 @@ With prefix arg UNCOMPILED, load the uncompiled versions." | |||
| 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) |
| @@ -15913,6 +16316,18 @@ N may optionally be the number of spaces to remove." | |||
| 15913 | (end-of-line 1)) | 16316 | (end-of-line 1)) |
| 15914 | min))) | 16317 | min))) |
| 15915 | 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)) | ||
| 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) |
| @@ -16041,7 +16456,7 @@ and :keyword." | |||
| 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 | ||
| @@ -16422,9 +16837,10 @@ which make use of the date at the cursor." | |||
| 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 () |
| @@ -16560,7 +16976,7 @@ 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. |
| @@ -17162,10 +17578,11 @@ Show the heading too, if it is currently invisible." | |||
| 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 |
| @@ -17188,12 +17605,9 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." | |||
| 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 |
| @@ -17203,15 +17617,12 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." | |||
| 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)) |
| @@ -17244,7 +17655,7 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." | |||
| 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 |
| @@ -17254,12 +17665,19 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." | |||
| 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))) |
| 17262 | 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)))) | ||
| 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) |
| @@ -17304,3 +17722,4 @@ Still experimental, may disappear in the future." | |||
| 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 | |||