* org-exp.el (org-export-as-html): Turn \par into a paragraph.
* org.el (org-agenda-tags-todo-honor-ignore-options): Declare
variable.
* org-table.el (org-table-insert-hline): Fix typo in fuction call
to `backward-char'.
* org-exp.el (org-export-as-html): Remove the initial space from
colon examples.
* org.el (org-scan-tags): Call
`org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item'.
* org-agenda.el (org-agenda-todo-list, org-agenda-match-view): New
customization groups.
(org-agenda-tags-todo-honor-ignore-options): New option.
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
New function.
(org-agenda-get-todos): Use
`org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item'.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-format-source-code-or-example): Escape
HTML characters also in examples that anre not treated with
htmlize. Also, just switch to EXAMPLE processing if we do not
have a good version of htmlize.
* org-rmail.el: Fix copyright notice.
* org.el (org-activate-footnote-links): Improve footnote link
highlighting.
* org-footnote.el (org-footnote-normalize): Fix finding the end of
a footnote definition at the end of the file.
* org-table.el (org-table-get-specials): Add an imagined hline at
the end of the table. This can be useful for references that want
to go to the end of the table. Also fix bug when computing last
row constants, in tables that do not start right at the right
margin.
(org-table-eval-formula): Match and replace remove references.
(org-table-formula-substitute-names): Make sure that names inside
a "remote" call are left alone, the will be replaced later when
the remote call is handled.
(org-table-convert-refs-to-rc): Do not convert things that might
look like a reference, but are really part of an ID or namei n a
remote reference.
(org-table-get-remote-range): New function.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-faces.el (org-clock-overlay): Fix bug in face definition.
* org-clock.el (org-clock-put-overlay): Use new face instead of
`secondary-selection'.
* org-faces.el (org-clock-overlay): New face.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-get-current-options): Include the option for
publishing time stamps.
* org.el (org-toggle-heading): Renamed from
`org-toggel-region-headings'.
No longer needs a region defined, but will use it if there is one.
(org-ctrl-c-star): Simplified, relying more on the internal
workings of `org-toggle-heading'.
(org-toggle-item): Renamed from `org-toggle-region-items'.
No longer needs a region defined, but will use it if there is one.
(org-ctrl-c-minus): Simplified, relying more on the inernal
workings of `org-toggle-item'.
* org-export-latex.el (org-export-latex-preprocess): Fix bug in
environment detection. Also, do real changes only in unprotected
places.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-export-latex.el (org-export-latex-quotation-marks): Use
`org-if-unprotected-1'.
(org-export-latex-set-initial-vars): Check for class definition in
property.
* org-macs.el (org-if-unprotected-1): New macro.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-compat.el (org-count-lines): New function.
* org-exp.el (org-export-format-source-code-or-example): Handle
switches related to text areas.
* org.el (org-activate-footnote-links): Don't allow match inside a
link.
* org-footnote.el (org-footnote-re): Don't allow match inside a link.
* org-export-latex.el (org-export-latex-links): Keep a relative
path relative also after export.
* org-exp.el (org-export-html-scripts): Fix HTML snippet.
* org.el (org-make-tags-matcher): Never use IDO for completing the
tags matcher match string.
(org-completing-read): Also remove the special biding for "?".
* org-attach.el (org-attach-allow-inheritance): New option.
(org-attach-inherited): New variable.
(org-attach-dir): Handle properties related to the attachment
directory.
(org-attach-check-absolute-path): New function.
(org-attach-set-directory, org-attach-set-inherit): New commands.
(org-attach): Accommodate the new commands in the dispatcher.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-compat.el (org-fit-window-to-buffer): Fix bug with using
`window-full-width-p'.
* org-exp.el (org-export-as-html): Only check for images files
that really can be inlined
* org.el (org-image-file-name-regexp, org-file-image-p): Allow the
list of extensions to be a parameter.
* org-exp.el (org-export-html-inline-image-extensions): New
variable.
* org-agenda.el (org-prepare-agenda): Use
`org-agenda-block-separator'.
(org-agenda-block-separator): New option.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-export-latex.el (org-export-latex-tables): Call
`org-table-clean-before-export' with the new optional argument.
* org-exp.el (org-table-clean-before-export): New optional
parameter MAYBE-QUOTED, allows for quoted characters like \# in
first column.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-plot.el (org-plot/gnuplot): Fix text-ind parameter for
histograms.
* org-colview.el (org-colview-construct-allowed-dates): Better
error catching when a date/time property does not have allowed
values defined.
* org-colview-xemacs.el (org-colview-construct-allowed-dates):
Better error catching when a date/time property does not have
allowed values defined.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-map-entries): Restore point and restriction after
`org-map-entries'.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-time=, org-time<, org-time<=, org-time>)
(org-time>=, org-time<>): Make sure both values are dates.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-archive.el (org-extract-archive-heading): Allow %s for file
name also in achive location heading.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-archive.el (org-add-archive-files): Uniquify the list before
returning it.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-compat.el (org-fit-window-to-buffer): Use
`window-full-width-p'.
* org-export-latex.el (org-export-latex-fixed-width): Enforce the
space after the colon in short examples.
* org-exp.el (org-export-protect-colon-examples): Rewritten, to
enforce a space after the colon. However, we also allow lines
that are *only* a colon.
(org-export-as-html): Enforce the space after the colon in short
examples.
(org-export-preprocess-string): Do the colon example protection
earlier.
(org-export-remove-timestamps): Do not check for protection at the
end of the line.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-format-latex-options): Add new matcher for single
letters between dollars.
(org-get-header): Function removed.
(org-heading-components): New function.
* org-exp.el (org-export-define-heading-targets): Record ID's also
as alternative targets.
(org-export-as-html): Interpret "id:" links to other files by
preserving the relative path.
* org-jsinfo.el (org-infojs-handle-options): Catch the case if v
is nil.
* org-exp.el (org-export-normalize-links): Protect the main link,
to avoid special character processing.
* org-export-latex.el (org-export-latex-special-keyword-regexp):
New variable.
(org-export-latex-special-string-regexps): Variable removed.
(org-export-latex-keywords): Use the new regexp.
* org-exp.el (org-export-handle-include-files): Fetch switches and
put them into the BEGIN statement.
* org-timer.el (org-timer-mode-line-string): New variable.
* org-clock.el (org-clock-mode-line-map): Renamed from
`org-clock-mode-map'.
(org-clock-mode-line-timer): Renamed from `org-mode-line-timer'.
(org-clock-update-mode-line): Renamed from `org-update-mode-line'.
(org-clock-put-overlay): Renamed from `org-put-clock-overlay'.
(org-clock-remove-overlays): Renamed from
`org-remove-clock-overlays'.
* org-timer.el (org-timer-pause-or-continue): Implement stopping
and mode line display.
(org-timer-stop): New command.
(org-timer-seconds): Return correct time when timer is paused.
(org-timer-mode-line-timer): New variable.
(org-timer-set-mode-line, org-timer-update-mode-line): New
functions.
* org.el (org-insert-heading): Handle new value `auto' for
`org-blank-before-new-entry'.
(org-org-menu): Add new items for timer functions.
* org-list.el (org-insert-item): Handle new value `auto' for
`org-blank-before-new-entry'.
* org.el (org-blank-before-new-entry): New value `auto', made
default.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-normalize-links): If the link is also
used as the description, protect the description.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-closest-date): Fix bug with yearly repeats, in
combination with preference of the past as it is used for deadline
and scheduling search.
* org-exp.el (org-html-handle-time-stamps): No longer check for
the `org-export-with-timestamps' option, because the preprocesser
has taken care of this already.
* org.el (org-entry-properties): Catch the case when this is
called in a non-org-mode file.
* org-export-latex.el (org-export-latex-remove-from-headlines):
Variable made obsolete, also LaTeX export now uses the standard
variables.
(org-export-as-latex): Add the timestamps parameter to the
preprocessor parameter list.
(org-export-latex-content): Export the remaining keywords without
considering to remove them.
(org-export-latex-keywords-maybe): Make the REMOVE-LIST optional.
Use bold font instead of tt font for the keywords.
(org-export-latex-fontify-headline): Format headlines, assuming
that all keywords still present should be published.
(org-export-latex-keywords): Remove argument TIMESTAMPS and just
publish what ever remains of the time stamps.
(org-export-latex-list-parameters): New option.
(org-export-latex-lists): Pass additional parameters to the list
converter.
* org-exp.el (org-export-preprocess-string): Remove clock lines
and timestamps already in the preprocesor.
(org-export-remove-timestamps, org-export-remove-clock-lines): New
functions.
(org-export-as-ascii, org-export-as-html): Add the timestamps
parameter to the preprocessor parameter list.
* org-list.el (org-list-parse-list): Parse for checkboxes.
(org-list-to-generic): Introduce and handle new parameters :cbon
and :cboff.
(org-list-to-latex, org-list-to-html, org-list-to-texinfo): Add
optional parameter PARAMS.
* org-export-latex.el (org-export-latex-special-chars): Fix
problems with interpreting dollar signs.
(org-inside-latex-math-p): New function.
(org-export-latex-preprocess): Protect all the math fragments.
* org.el (org-latex-regexps): Allow a dash after a dollar.
* org-w3m.el (org-w3m-copy-for-org-mode): Always deactivate the
mark after copying.
* org-agenda.el (org-run-agenda-series): Have series options set
when finalizing the agenda.
* org-exp.el (org-export-format-source-code-or-example): Protect
the converted examples.
* org.el (org-set-regexps-and-options): Fix the regexp
`org-complex-heading-regexp'.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-edit-src-get-label-format): New function.
(org-coderef-label-format): New option.
(org-edit-src-code, org-edit-src-find-region-and-lang): Parse for
a label format specification and make sure it is used in the edit
buffer.
(org-edit-src-get-label-format): New function.
(org-store-link): Handle new coderef formats.
(org-link-search): Handle new coderef formats.
* org-footnote.el (org-footnote-create-definition)
(org-footnote-goto-local-insertion-point): Make footnote insertion
work correctly when the "Footnotes" headline is the last line in
the buffer.
* org.el (org-goto-marker-or-bmk): Expose context after jumping to
the location.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-w3m.el (org-w3m): New customization group.
(org-w3m-deactivate-mark): New option.
(org-w3m-copy-for-org-mode): Deactivate region, unless the user
option say not to.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-set-font-lock-defaults): Trigger footnote
fontification.
(org-activate-footnote-links): New function.
(org-activate-links): New entry `footnote'.
* org-faces.el (org-footnote): New face.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-macs.el (org-re): Handle the [:word:] class.
* org-exp.el (org-export-preprocess-string): Call
`org-export-protect-colon-examples'.
(org-export-protect-colon-examples): Renamed from
`org-export-protect-examples', and scope limited to lines starting
with a colon.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-preprocess-string): Move the preprocess
hook to after turning on Org-mode.
(org-export-preprocess-after-include-files-hook)
(org-export-preprocess-after-tree-selection-hook)
(org-export-preprocess-before-backend-specifics-hook)
(org-export-preprocess-final-hook): New hooks.
(org-export-preprocess-string): Run the new hooks.
* org.el (org-ctrl-c-minus): Fix indentation for new items.
* org-footnote.el: New file.
* org.el (org-footnote): Require footnote code.
(org-startup-options): Add new footnote options.
(org-mode-map): New keybindig for footnotes.
(org-ctrl-c-ctrl-c): Add function at footnotes.
(org-org-menu): New menu entries for footnotes.
* org-export-latex.el (org-export-as-latex): Pass footnote
variable to preprocessor.
(org-export-latex-preprocess): Treat multiple references to a
footnote.
* org-exp.el (org-export-preprocess-string): Call
`org-footnote-normalize'.
(org-export-as-ascii, org-export-as-html): Pass footnote variable
to preprocessor.
(org-export-as-html): Treat multiple references to a footnote.
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
* org-export-latex.el (org-export-latex-links): Handle coderef
links.
* org.el (org-bracket-link-analytic-regexp++): New variable.
(org-make-link-regexps): Initialize
`org-bracket-link-analytic-regexp++'.
(org-store-link): Implement special case in edit-src buffer.
(org-insert-link): No use of ide to insert stored links.
(org-link-search): Implement special case for coderefs.
* org-exp.el (org-export-html-scripts): New constant.
(org-export-html-style-default): Add a new style for highlighted
code.
(org-export-code-refs): New variable.
(org-export-preprocess-string): Initialize `org-export-code-refs'.
Call `org-export-replace-src-segments-and-examples'
No longer call `org-export-protect-examples'.
(org-export-target-internal-links): Take care of coderef targets.
(org-export-last-code-line-counter-value): New variable.
(org-export-replace-src-segments-and-examples): Renamed from
`org-export-replace-src-segments', and modified.
(org-export-format-source-code-or-example): Renamed from
`org-export-format-source-code'.
(org-export-number-lines): New function.
(org-export-as-ascii, org-export-as-html): Handle coderef links.
+2009-01-25 Carsten Dominik <dominik@science.uva.nl>
+
+ * org.texi (References): Add information about remote references.
+ (Built-in table editor): Document `C-c RET' in tables.
+ (Math symbols, Quoting LaTeX code): Mention that simple
+ LaTeX macros survive LaTeX export.
+ (Images in LaTeX export): Show how to create a reference to a
+ figure.
+ (Sectioning structure): Document that the LaTeX class can be
+ specified in a property.
+ (Text areas in HTML export): New section.
+ (External links): Add examples for text search and ID links.
+ (Built-in table editor): Remove the descriptio of `C-c
+ C-q', it not longer works.
+ (Literal examples): Document that a space must follow
+ the colon in short examples.
+ (Relative timer): Document `org-timer-stop'.
+ (Footnotes): New section.
+ (Footnote markup): Shorten section and refer to new Footnote
+ section.
+ (Literal examples): Add documentation for line
+ numbering in and references to code examples.
+ (CSS support): Fix the description of default CSS styles.
+ (Capturing column view): Document
+ "file:path/to/file.org" as an allowed value for the ID property of
+ a dynamic block copying column view.
+
2009-01-23 Stephen Eglen <stephen@gnu.org>
* mh-e.texi (Getting Started): Describe $MH.
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-exp.el (org-export-as-html): Turn \par into a paragraph.
+
+ * org.el (org-agenda-tags-todo-honor-ignore-options): Declare
+ variable.
+
+ * org-table.el (org-table-insert-hline): Fix typo in fuction call
+ to `backward-char'.
+
+ * org-exp.el (org-export-as-html): Remove the initial space from
+ colon examples.
+
+ * org.el (org-scan-tags): Call
+ `org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item'.
+
+ * org-agenda.el (org-agenda-todo-list, org-agenda-match-view): New
+ customization groups.
+ (org-agenda-tags-todo-honor-ignore-options): New option.
+ (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
+ New function.
+ (org-agenda-get-todos): Use
+ `org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item'.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-exp.el (org-export-format-source-code-or-example): Escape
+ HTML characters also in examples that anre not treated with
+ htmlize. Also, just switch to EXAMPLE processing if we do not
+ have a good version of htmlize.
+
+ * org-rmail.el: Fix copyright notice.
+
+ * org.el (org-activate-footnote-links): Improve footnote link
+ highlighting.
+
+ * org-footnote.el (org-footnote-normalize): Fix finding the end of
+ a footnote definition at the end of the file.
+
+ * org-table.el (org-table-get-specials): Add an imagined hline at
+ the end of the table. This can be useful for references that want
+ to go to the end of the table. Also fix bug when computing last
+ row constants, in tables that do not start right at the right
+ margin.
+ (org-table-eval-formula): Match and replace remove references.
+ (org-table-formula-substitute-names): Make sure that names inside
+ a "remote" call are left alone, the will be replaced later when
+ the remote call is handled.
+ (org-table-convert-refs-to-rc): Do not convert things that might
+ look like a reference, but are really part of an ID or namei n a
+ remote reference.
+ (org-table-get-remote-range): New function.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-faces.el (org-clock-overlay): Fix bug in face definition.
+
+ * org-clock.el (org-clock-put-overlay): Use new face instead of
+ `secondary-selection'.
+
+ * org-faces.el (org-clock-overlay): New face.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-exp.el (org-get-current-options): Include the option for
+ publishing time stamps.
+
+ * org.el (org-toggle-heading): Renamed from
+ `org-toggel-region-headings'.
+ No longer needs a region defined, but will use it if there is one.
+ (org-ctrl-c-star): Simplified, relying more on the internal
+ workings of `org-toggle-heading'.
+ (org-toggle-item): Renamed from `org-toggle-region-items'.
+ No longer needs a region defined, but will use it if there is one.
+ (org-ctrl-c-minus): Simplified, relying more on the inernal
+ workings of `org-toggle-item'.
+
+ * org-export-latex.el (org-export-latex-preprocess): Fix bug in
+ environment detection. Also, do real changes only in unprotected
+ places.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-export-latex.el (org-export-latex-quotation-marks): Use
+ `org-if-unprotected-1'.
+ (org-export-latex-set-initial-vars): Check for class definition in
+ property.
+
+ * org-macs.el (org-if-unprotected-1): New macro.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-compat.el (org-count-lines): New function.
+
+ * org-exp.el (org-export-format-source-code-or-example): Handle
+ switches related to text areas.
+
+ * org.el (org-activate-footnote-links): Don't allow match inside a
+ link.
+
+ * org-footnote.el (org-footnote-re): Don't allow match inside a link.
+
+ * org-export-latex.el (org-export-latex-links): Keep a relative
+ path relative also after export.
+
+ * org-exp.el (org-export-html-scripts): Fix HTML snippet.
+
+ * org.el (org-make-tags-matcher): Never use IDO for completing the
+ tags matcher match string.
+ (org-completing-read): Also remove the special biding for "?".
+
+ * org-attach.el (org-attach-allow-inheritance): New option.
+ (org-attach-inherited): New variable.
+ (org-attach-dir): Handle properties related to the attachment
+ directory.
+ (org-attach-check-absolute-path): New function.
+ (org-attach-set-directory, org-attach-set-inherit): New commands.
+ (org-attach): Accommodate the new commands in the dispatcher.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-compat.el (org-fit-window-to-buffer): Fix bug with using
+ `window-full-width-p'.
+
+ * org-exp.el (org-export-as-html): Only check for images files
+ that really can be inlined
+
+ * org.el (org-image-file-name-regexp, org-file-image-p): Allow the
+ list of extensions to be a parameter.
+
+ * org-exp.el (org-export-html-inline-image-extensions): New
+ variable.
+
+ * org-agenda.el (org-prepare-agenda): Use
+ `org-agenda-block-separator'.
+ (org-agenda-block-separator): New option.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-export-latex.el (org-export-latex-tables): Call
+ `org-table-clean-before-export' with the new optional argument.
+
+ * org-exp.el (org-table-clean-before-export): New optional
+ parameter MAYBE-QUOTED, allows for quoted characters like \# in
+ first column.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-plot.el (org-plot/gnuplot): Fix text-ind parameter for
+ histograms.
+
+ * org-colview.el (org-colview-construct-allowed-dates): Better
+ error catching when a date/time property does not have allowed
+ values defined.
+
+ * org-colview-xemacs.el (org-colview-construct-allowed-dates):
+ Better error catching when a date/time property does not have
+ allowed values defined.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-map-entries): Restore point and restriction after
+ `org-map-entries'.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-time=, org-time<, org-time<=, org-time>)
+ (org-time>=, org-time<>): Make sure both values are dates.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-archive.el (org-extract-archive-heading): Allow %s for file
+ name also in achive location heading.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-archive.el (org-add-archive-files): Uniquify the list before
+ returning it.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-compat.el (org-fit-window-to-buffer): Use
+ `window-full-width-p'.
+
+ * org-export-latex.el (org-export-latex-fixed-width): Enforce the
+ space after the colon in short examples.
+
+ * org-exp.el (org-export-protect-colon-examples): Rewritten, to
+ enforce a space after the colon. However, we also allow lines
+ that are *only* a colon.
+ (org-export-as-html): Enforce the space after the colon in short
+ examples.
+ (org-export-preprocess-string): Do the colon example protection
+ earlier.
+ (org-export-remove-timestamps): Do not check for protection at the
+ end of the line.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-format-latex-options): Add new matcher for single
+ letters between dollars.
+ (org-get-header): Function removed.
+ (org-heading-components): New function.
+
+ * org-exp.el (org-export-define-heading-targets): Record ID's also
+ as alternative targets.
+ (org-export-as-html): Interpret "id:" links to other files by
+ preserving the relative path.
+
+ * org-jsinfo.el (org-infojs-handle-options): Catch the case if v
+ is nil.
+
+ * org-exp.el (org-export-normalize-links): Protect the main link,
+ to avoid special character processing.
+
+ * org-export-latex.el (org-export-latex-special-keyword-regexp):
+ New variable.
+ (org-export-latex-special-string-regexps): Variable removed.
+ (org-export-latex-keywords): Use the new regexp.
+
+ * org-exp.el (org-export-handle-include-files): Fetch switches and
+ put them into the BEGIN statement.
+
+ * org-timer.el (org-timer-mode-line-string): New variable.
+
+ * org-clock.el (org-clock-mode-line-map): Renamed from
+ `org-clock-mode-map'.
+ (org-clock-mode-line-timer): Renamed from `org-mode-line-timer'.
+ (org-clock-update-mode-line): Renamed from `org-update-mode-line'.
+ (org-clock-put-overlay): Renamed from `org-put-clock-overlay'.
+ (org-clock-remove-overlays): Renamed from
+ `org-remove-clock-overlays'.
+
+ * org-timer.el (org-timer-pause-or-continue): Implement stopping
+ and mode line display.
+ (org-timer-stop): New command.
+ (org-timer-seconds): Return correct time when timer is paused.
+ (org-timer-mode-line-timer): New variable.
+ (org-timer-set-mode-line, org-timer-update-mode-line): New
+ functions.
+
+ * org.el (org-insert-heading): Handle new value `auto' for
+ `org-blank-before-new-entry'.
+ (org-org-menu): Add new items for timer functions.
+
+ * org-list.el (org-insert-item): Handle new value `auto' for
+ `org-blank-before-new-entry'.
+
+ * org.el (org-blank-before-new-entry): New value `auto', made
+ default.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-exp.el (org-export-normalize-links): If the link is also
+ used as the description, protect the description.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-closest-date): Fix bug with yearly repeats, in
+ combination with preference of the past as it is used for deadline
+ and scheduling search.
+
+ * org-exp.el (org-html-handle-time-stamps): No longer check for
+ the `org-export-with-timestamps' option, because the preprocesser
+ has taken care of this already.
+
+ * org.el (org-entry-properties): Catch the case when this is
+ called in a non-org-mode file.
+
+ * org-export-latex.el (org-export-latex-remove-from-headlines):
+ Variable made obsolete, also LaTeX export now uses the standard
+ variables.
+ (org-export-as-latex): Add the timestamps parameter to the
+ preprocessor parameter list.
+ (org-export-latex-content): Export the remaining keywords without
+ considering to remove them.
+ (org-export-latex-keywords-maybe): Make the REMOVE-LIST optional.
+ Use bold font instead of tt font for the keywords.
+ (org-export-latex-fontify-headline): Format headlines, assuming
+ that all keywords still present should be published.
+ (org-export-latex-keywords): Remove argument TIMESTAMPS and just
+ publish what ever remains of the time stamps.
+ (org-export-latex-list-parameters): New option.
+ (org-export-latex-lists): Pass additional parameters to the list
+ converter.
+
+ * org-exp.el (org-export-preprocess-string): Remove clock lines
+ and timestamps already in the preprocesor.
+ (org-export-remove-timestamps, org-export-remove-clock-lines): New
+ functions.
+ (org-export-as-ascii, org-export-as-html): Add the timestamps
+ parameter to the preprocessor parameter list.
+
+ * org-list.el (org-list-parse-list): Parse for checkboxes.
+ (org-list-to-generic): Introduce and handle new parameters :cbon
+ and :cboff.
+ (org-list-to-latex, org-list-to-html, org-list-to-texinfo): Add
+ optional parameter PARAMS.
+
+ * org-export-latex.el (org-export-latex-special-chars): Fix
+ problems with interpreting dollar signs.
+ (org-inside-latex-math-p): New function.
+ (org-export-latex-preprocess): Protect all the math fragments.
+
+ * org.el (org-latex-regexps): Allow a dash after a dollar.
+
+ * org-w3m.el (org-w3m-copy-for-org-mode): Always deactivate the
+ mark after copying.
+
+ * org-agenda.el (org-run-agenda-series): Have series options set
+ when finalizing the agenda.
+
+ * org-exp.el (org-export-format-source-code-or-example): Protect
+ the converted examples.
+
+ * org.el (org-set-regexps-and-options): Fix the regexp
+ `org-complex-heading-regexp'.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-edit-src-get-label-format): New function.
+ (org-coderef-label-format): New option.
+ (org-edit-src-code, org-edit-src-find-region-and-lang): Parse for
+ a label format specification and make sure it is used in the edit
+ buffer.
+ (org-edit-src-get-label-format): New function.
+ (org-store-link): Handle new coderef formats.
+ (org-link-search): Handle new coderef formats.
+
+ * org-footnote.el (org-footnote-create-definition)
+ (org-footnote-goto-local-insertion-point): Make footnote insertion
+ work correctly when the "Footnotes" headline is the last line in
+ the buffer.
+
+ * org.el (org-goto-marker-or-bmk): Expose context after jumping to
+ the location.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-w3m.el (org-w3m): New customization group.
+ (org-w3m-deactivate-mark): New option.
+ (org-w3m-copy-for-org-mode): Deactivate region, unless the user
+ option say not to.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-set-font-lock-defaults): Trigger footnote
+ fontification.
+ (org-activate-footnote-links): New function.
+ (org-activate-links): New entry `footnote'.
+
+ * org-faces.el (org-footnote): New face.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-macs.el (org-re): Handle the [:word:] class.
+
+ * org-exp.el (org-export-preprocess-string): Call
+ `org-export-protect-colon-examples'.
+ (org-export-protect-colon-examples): Renamed from
+ `org-export-protect-examples', and scope limited to lines starting
+ with a colon.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-exp.el (org-export-preprocess-string): Move the preprocess
+ hook to after turning on Org-mode.
+ (org-export-preprocess-after-include-files-hook)
+ (org-export-preprocess-after-tree-selection-hook)
+ (org-export-preprocess-before-backend-specifics-hook)
+ (org-export-preprocess-final-hook): New hooks.
+ (org-export-preprocess-string): Run the new hooks.
+
+ * org.el (org-ctrl-c-minus): Fix indentation for new items.
+
+ * org-footnote.el: New file.
+
+ * org.el (org-footnote): Require footnote code.
+ (org-startup-options): Add new footnote options.
+ (org-mode-map): New keybindig for footnotes.
+ (org-ctrl-c-ctrl-c): Add function at footnotes.
+ (org-org-menu): New menu entries for footnotes.
+
+ * org-export-latex.el (org-export-as-latex): Pass footnote
+ variable to preprocessor.
+ (org-export-latex-preprocess): Treat multiple references to a
+ footnote.
+
+ * org-exp.el (org-export-preprocess-string): Call
+ `org-footnote-normalize'.
+ (org-export-as-ascii, org-export-as-html): Pass footnote variable
+ to preprocessor.
+ (org-export-as-html): Treat multiple references to a footnote.
+
+2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org-export-latex.el (org-export-latex-links): Handle coderef
+ links.
+
+ * org.el (org-bracket-link-analytic-regexp++): New variable.
+ (org-make-link-regexps): Initialize
+ `org-bracket-link-analytic-regexp++'.
+ (org-store-link): Implement special case in edit-src buffer.
+ (org-insert-link): No use of ide to insert stored links.
+ (org-link-search): Implement special case for coderefs.
+
+ * org-exp.el (org-export-html-scripts): New constant.
+ (org-export-html-style-default): Add a new style for highlighted
+ code.
+ (org-export-code-refs): New variable.
+ (org-export-preprocess-string): Initialize `org-export-code-refs'.
+ Call `org-export-replace-src-segments-and-examples'
+ No longer call `org-export-protect-examples'.
+ (org-export-target-internal-links): Take care of coderef targets.
+ (org-export-last-code-line-counter-value): New variable.
+ (org-export-replace-src-segments-and-examples): Renamed from
+ `org-export-replace-src-segments', and modified.
+ (org-export-format-source-code-or-example): Renamed from
+ `org-export-format-source-code'.
+ (org-export-number-lines): New function.
+ (org-export-as-ascii, org-export-as-html): Handle coderef links.
+
2009-01-23 Glenn Morris <rgm@gnu.org>
* org-rmail.el (rmail-narrow-to-non-pruned-header):
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
:group 'org-agenda
:type 'boolean)
+(defcustom org-agenda-block-separator ?=
+ "The separator between blocks in the agenda.
+If this is a string, it will be used as the separator, with a newline added.
+If it is a character, it will be repeated to fill the window width."
+ :group 'org-agenda
+ :type '(choice
+ (character)
+ (string)))
+
(defgroup org-agenda-export nil
"Options concerning exporting agenda views in Org-mode."
:tag "Org Agenda Export"
"Options concerning skipping parts of agenda files."
:tag "Org Agenda Skip"
:group 'org-agenda)
+(defgroup org-agenda-daily/weekly nil
+ "Options concerning the daily/weekly agenda."
+ :tag "Org Agenda Daily/Weekly"
+ :group 'org-agenda)
+(defgroup org-agenda-todo-list nil
+ "Options concerning the global todo list agenda view."
+ :tag "Org Agenda Todo List"
+ :group 'org-agenda)
+(defgroup org-agenda-match-view nil
+ "Options concerning the general tags/property/todo match agenda view."
+ :tag "Org Agenda Match View"
+ :group 'org-agenda)
(defvar org-agenda-archives-mode nil
"Non-nil means, the agenda will include archived items.
When nil, the sublevels of a TODO entry are not checked, resulting in
potentially much shorter TODO lists."
:group 'org-agenda-skip
- :group 'org-todo
+ :group 'org-agenda-todo-list
:type 'boolean)
(defcustom org-agenda-todo-ignore-with-date nil
of `org-agenda-todo-ignore-scheduled' and `org-agenda-todo-ignore-deadlines'
will be ignored."
:group 'org-agenda-skip
- :group 'org-todo
+ :group 'org-agenda-todo-list
:type 'boolean)
(defcustom org-agenda-todo-ignore-scheduled nil
of this item.
See also `org-agenda-todo-ignore-with-date'."
:group 'org-agenda-skip
- :group 'org-todo
+ :group 'org-agenda-todo-list
:type 'boolean)
(defcustom org-agenda-todo-ignore-deadlines nil
The idea behind this is that such items will appear in the agenda anyway.
See also `org-agenda-todo-ignore-with-date'."
:group 'org-agenda-skip
- :group 'org-todo
+ :group 'org-agenda-todo-list
+ :type 'boolean)
+
+(defcustom org-agenda-tags-todo-honor-ignore-options nil
+ "Non-nil means, honor todo-list ...ignore options also in tags-todo search.
+The variables
+ `org-agenda-todo-ignore-with-date',
+ `org-agenda-todo-ignore-scheduled'
+ `org-agenda-todo-ignore-deadlines'
+make the global TODO list skip entries that have time stamps of certain
+kinds. If this option is set, the same options will also apply for the
+tags-todo search, which is the general tags/property matcher
+restricted to unfinished TODO entries only."
+ :group 'org-agenda-skip
+ :group 'org-agenda-todo-list
+ :group 'org-agenda-match-view
:type 'boolean)
(defcustom org-agenda-skip-scheduled-if-done nil
an item with a past scheduling dates are always turned off when the item
is DONE."
:group 'org-agenda-skip
+ :group 'org-agenda-daily/weekly
:type 'boolean)
(defcustom org-agenda-skip-deadline-if-done nil
actually date of the deadline. Warnings about approaching and past-due
deadlines are always turned off when the item is DONE."
:group 'org-agenda-skip
+ :group 'org-agenda-daily/weekly
:type 'boolean)
(defcustom org-agenda-skip-timestamp-if-done nil
"Non-nil means don't select item by timestamp or -range if it is DONE."
:group 'org-agenda-skip
+ :group 'org-agenda-daily/weekly
:type 'boolean)
(defcustom org-timeline-show-empty-dates 3
:group 'org-agenda-windows
:type 'boolean)
-(defgroup org-agenda-daily/weekly nil
- "Options concerning the daily/weekly agenda."
- :tag "Org Agenda Daily/Weekly"
- :group 'org-agenda)
-
(defcustom org-agenda-ndays 7
"Number of days to include in overview display.
Should be 1 or 7."
(defcustom org-agenda-include-all-todo nil
"Set means weekly/daily agenda will always contain all TODO entries.
The TODO entries will be listed at the top of the agenda, before
-the entries for specific days."
+the entries for specific days.
+This option is deprecated, it is better to define a block agenda instead."
:group 'org-agenda-daily/weekly
:type 'boolean)
(list (character :tag "Priority" :value ?A)
(sexp :tag "face")))))
-
(defgroup org-agenda-column-view nil
"Options concerning column view in the agenda."
:tag "Org Agenda Column View"
(defvar org-agenda-show-log nil)
(defvar org-agenda-redo-command nil)
(defvar org-agenda-query-string nil)
-(defvar org-agenda-mode-hook nil)
+(defvar org-agenda-mode-hook nil
+ "Hook for org-agenda-mode, run after the mode is turned on.")
(defvar org-agenda-type nil)
(defvar org-agenda-force-single-file nil)
(widen)
(setq org-agenda-redo-command redo)
(goto-char (point-min)))
- (org-finalize-agenda))
+ (org-let (nth 1 series) '(org-finalize-agenda)))
;;;###autoload
(defmacro org-batch-agenda (cmd-key &rest parameters)
(setq buffer-read-only nil)
(goto-char (point-max))
(unless (or (bobp) org-agenda-compact-blocks)
- (insert "\n" (make-string (window-width) ?=) "\n"))
+ (insert "\n"
+ (if (stringp org-agenda-block-separator)
+ org-agenda-block-separator
+ (make-string (window-width) org-agenda-block-separator))
+ "\n"))
(narrow-to-region (point) (point-max)))
(org-agenda-reset-markers)
(setq org-agenda-contributing-files nil)
(save-match-data
(beginning-of-line)
(setq beg (point) end (progn (outline-next-heading) (point)))
- (when (or (and org-agenda-todo-ignore-with-date (goto-char beg)
- (re-search-forward org-ts-regexp end t))
- (and org-agenda-todo-ignore-scheduled (goto-char beg)
- (re-search-forward org-scheduled-time-regexp end t))
- (and org-agenda-todo-ignore-deadlines (goto-char beg)
- (re-search-forward org-deadline-time-regexp end t)
- (org-deadline-close (match-string 1))))
+ (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end)
(goto-char (1+ beg))
(or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
(throw :skip nil)))
(org-end-of-subtree 'invisible))))
(nreverse ee)))
+;;;###autoload
+(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end)
+ "Do we have a reason to ignore this todo entry because it has a time stamp?"
+ (when (or org-agenda-todo-ignore-with-date
+ org-agenda-todo-ignore-scheduled
+ org-agenda-todo-ignore-deadlines)
+ (setq end (or end (save-excursion (outline-next-heading) (point))))
+ (save-excursion
+ (or (and org-agenda-todo-ignore-with-date
+ (re-search-forward org-ts-regexp end t))
+ (and org-agenda-todo-ignore-scheduled
+ (re-search-forward org-scheduled-time-regexp end t))
+ (and org-agenda-todo-ignore-deadlines
+ (re-search-forward org-deadline-time-regexp end t)
+ (org-deadline-close (match-string 1)))))))
+
(defconst org-agenda-no-heading-message
"No heading for this item in buffer or region.")
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(t org-archive-location (match-string 1)))))))
(defun org-add-archive-files (files)
- "Splice the archive files into the list f files.
+ "Splice the archive files into the list of files.
This implies visiting all these files and finding out what the
archive file is."
- (apply
- 'append
- (mapcar
- (lambda (f)
- (if (not (file-exists-p f))
- nil
- (with-current-buffer (org-get-agenda-file-buffer f)
- (cons f (org-all-archive-files)))))
- files)))
+ (org-uniquify
+ (apply
+ 'append
+ (mapcar
+ (lambda (f)
+ (if (not (file-exists-p f))
+ nil
+ (with-current-buffer (org-get-agenda-file-buffer f)
+ (cons f (org-all-archive-files)))))
+ files))))
(defun org-all-archive-files ()
"Get a list of all archive files used in the current buffer."
if LOCATION is not given, the value of `org-archive-location' is used."
(setq location (or location org-archive-location))
(if (string-match "\\(.*\\)::\\(.*\\)" location)
- (match-string 2 location)))
+ (format (match-string 2 location)
+ (file-name-nondirectory buffer-file-name))))
(defun org-archive-subtree (&optional find-done)
"Move the current subtree to the archive.
(message "Subtree archived %s"
(if (eq this-buffer buffer)
(concat "under heading: " heading)
- (concat "in file: " (abbreviate-file-name afile)))))))
+ (concat "in file: " (abbreviate-file-name afile))))))
+ (org-reveal))
(defun org-archive-to-archive-sibling ()
"Archive the current heading by moving it under the archive sibling.
(outline-up-heading 1 t)
(hide-subtree)
(org-cycle-show-empty-lines 'folded)
- (goto-char pos))))
+ (goto-char pos)))
+ (org-reveal))
(defun org-archive-all-done (&optional tag)
"Archive sublevels of the current tree without open TODO items.
;; Author: John Wiegley <johnw@newartisans.com>
;; Keywords: org data task
-;; Version: 6.16
+;; Version: 6.19a
;; This file is part of GNU Emacs.
;;
(defcustom org-attach-file-list-property "Attachments"
"The property used to keep a list of attachment belonging to this entry.
-This is not really needed, so you may set this to nil if you don't want it."
+This is not really needed, so you may set this to nil if you don't want it.
+Also, for entries where children inherit the directory, the list of
+attachments is not kept in this property."
:group 'org-attach
:type '(choice
(const :tag "None" nil)
:group 'org-attach
:type 'boolean)
+(defcustom org-attach-allow-inheritance t
+ "Non-nil means, allow attachment directories be inherited."
+ :group 'org-attach
+ :type 'boolean)
+
+
+(defvar org-attach-inherited nil
+ "Indicates if the last access to the attachment directory was inherited.")
+
;;;###autoload
(defun org-attach ()
"The dispatcher for attachment commands.
d Delete one attachment, you will be prompted for a file name.
D Delete all of a task's attachments. A safer way is
- to open the directory in dired and delete from there.")))
+ to open the directory in dired and delete from there.
+
+s Set a specific attachment directory for this entry.
+i Make children of the current entry inherit its attachment directory.")))
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
(message "Select command: [acmlzoOfFdD]")
(setq c (read-char-exclusive))
'org-attach-delete-one))
((eq c ?D) (call-interactively 'org-attach-delete-all))
((eq c ?q) (message "Abort"))
+ ((memq c '(?s ?\C-s)) (call-interactively
+ 'org-attach-set-directory))
+ ((memq c '(?i ?\C-i)) (call-interactively
+ 'org-attach-set-inherit))
(t (error "No such attachment command %c" c))))))
(defun org-attach-dir (&optional create-if-not-exists-p)
"Return the directory associated with the current entry.
+This first checks for a local property ATTACH_DIR, and then for an inherited
+property ATTACH_DIR_INHERIT. If neither exists, the default mechanism
+using the entry ID will be invoked to access the unique directory for the
+current entry.
If the directory does not exist and CREATE-IF-NOT-EXISTS-P is non-nil,
-the directory and the corresponding ID will be created."
- (when (and (not (buffer-file-name (buffer-base-buffer)))
- (not (file-name-absolute-p org-attach-directory)))
- (error "Need absolute `org-attach-directory' to attach in buffers without filename."))
- (let ((uuid (org-id-get (point) create-if-not-exists-p)))
- (when (or uuid create-if-not-exists-p)
- (unless uuid
- (error "ID retrieval/creation failed"))
- (let ((attach-dir (expand-file-name
- (format "%s/%s"
- (substring uuid 0 2)
- (substring uuid 2))
- (expand-file-name org-attach-directory))))
- (if (and create-if-not-exists-p
- (not (file-directory-p attach-dir)))
- (make-directory attach-dir t))
- (and (file-exists-p attach-dir)
- attach-dir)))))
+the directory and (if necessary) the corresponding ID will be created."
+ (let (attach-dir uuid inherit)
+ (setq org-attach-inherited (org-entry-get nil "ATTACH_DIR_INHERIT"))
+ (cond
+ ((setq attach-dir (org-entry-get nil "ATTACH_DIR"))
+ (org-attach-check-absolute-path attach-dir))
+ ((and org-attach-allow-inheritance
+ (setq inherit (org-entry-get nil "ATTACH_DIR_INHERIT" t)))
+ (setq attach-dir
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char org-entry-property-inherited-from)
+ (let (org-attach-allow-inheritance)
+ (org-attach-dir create-if-not-exists-p)))))
+ (org-attach-check-absolute-path attach-dir)
+ (setq org-attach-inherited t))
+ (t ; use the ID
+ (org-attach-check-absolute-path nil)
+ (setq uuid (org-id-get (point) create-if-not-exists-p))
+ (when (or uuid create-if-not-exists-p)
+ (unless uuid (error "ID retrieval/creation failed"))
+ (setq attach-dir (expand-file-name
+ (format "%s/%s"
+ (substring uuid 0 2)
+ (substring uuid 2))
+ (expand-file-name org-attach-directory))))))
+ (when attach-dir
+ (if (and create-if-not-exists-p
+ (not (file-directory-p attach-dir)))
+ (make-directory attach-dir t))
+ (and (file-exists-p attach-dir)
+ attach-dir))))
+
+(defun org-attach-check-absolute-path (dir)
+ "Check if we have enough information to root the atachment directory.
+When DIR is given, check also if it is already absolute. Otherwise,
+assume that it will be relative, and check if `org-attach-directory' is
+absolute, or if at least the current buffer has a file name.
+Throw an error if we cannot root the directory."
+ (or (and dir (file-name-absolute-p dir))
+ (file-name-absolute-p org-attach-directory)
+ (buffer-file-name (buffer-base-buffer))
+ (error "Need absolute `org-attach-directory' to attach in buffers without filename.")))
+
+(defun org-attach-set-directory ()
+ "Set the ATTACH_DIR property of the current entry.
+The property defines the directory that is used for attachments
+of the entry."
+ (interactive)
+ (let ((dir (org-entry-get nil "ATTACH_DIR")))
+ (setq dir (read-directory-name "Attachment directory: " dir))
+ (org-entry-put nil "ATTACH_DIR" dir)))
+
+(defun org-attach-set-inherit ()
+ "Set the ATTACH_DIR_INHERIT property of the current entry.
+The property defines the directory that is used for attachments
+of the entry and any children that do not explicitly define (by setting
+the ATTACH_DIR property) their own attachment directory."
+ (interactive)
+ (org-entry-put nil "ATTACH_DIR_INHERIT" "t")
+ (message "Children will inherit attachment directory"))
(defun org-attach-commit ()
"Commit changes to git if `org-attach-directory' is properly initialized.
(interactive "fFile to keep as an attachment: \nP")
(setq method (or method org-attach-method))
(let ((basename (file-name-nondirectory file)))
- (when org-attach-file-list-property
+ (when (and org-attach-file-list-property (not org-attach-inherited))
(org-entry-add-to-multivalued-property
(point) org-attach-file-list-property basename))
(let* ((attach-dir (org-attach-dir t))
"Create a new attachment FILE for the current task.
The attachment is created as an Emacs buffer."
(interactive "sCreate attachment named: ")
- (when org-attach-file-list-property
+ (when (and org-attach-file-list-property (not org-attach-inherited))
(org-entry-add-to-multivalued-property
(point) org-attach-file-list-property file))
(let ((attach-dir (org-attach-dir t)))
This actually deletes the entire attachment directory.
A safer way is to open the directory in dired and delete from there."
(interactive "P")
- (when org-attach-file-list-property
+ (when (and org-attach-file-list-property (not org-attach-inherited))
(org-entry-delete (point) org-attach-file-list-property))
(let ((attach-dir (org-attach-dir)))
(when
This can be used after files have been added externally."
(interactive)
(org-attach-commit)
- (when org-attach-file-list-property
+ (when (and org-attach-file-list-property (not org-attach-inherited))
(org-entry-delete (point) org-attach-file-list-property))
(let ((attach-dir (org-attach-dir)))
(when attach-dir
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Bastien Guerry <bzg at altern dot org>
;; Carsten Dominik <carsten dot dominik at gmail dot com>
;; Keywords: org, wp, remember
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(defvar org-mode-line-string "")
(put 'org-mode-line-string 'risky-local-variable t)
-(defvar org-mode-line-timer nil)
+(defvar org-clock-mode-line-timer nil)
(defvar org-clock-heading "")
(defvar org-clock-heading-for-remember "")
(defvar org-clock-start-time "")
(defvar org-clock-interrupted-task (make-marker)
"Marker pointing to the task that has been interrupted by the current clock.")
-(defvar org-clock-mode-map (make-sparse-keymap))
-(define-key org-clock-mode-map [mode-line mouse-2] 'org-clock-goto)
+(defvar org-clock-mode-line-map (make-sparse-keymap))
+(define-key org-clock-mode-line-map [mode-line mouse-2] 'org-clock-goto)
(defun org-clock-history-push (&optional pos buffer)
"Push a marker to the clock history."
(insert (format "[%c] %-15s %s\n" i cat task))
(cons i marker)))))
-(defun org-update-mode-line ()
+(defun org-clock-update-mode-line ()
(let* ((delta (- (time-to-seconds (current-time))
(time-to-seconds org-clock-start-time)))
(h (floor delta 3600))
(org-propertize (substring clock-string 0 org-clock-string-limit)
'help-echo (concat help-text ": " org-clock-heading))
(org-propertize clock-string 'help-echo help-text)))
- 'local-map org-clock-mode-map
+ 'local-map org-clock-mode-line-map
'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)))
(force-mode-line-update)))
(or (memq 'org-mode-line-string global-mode-string)
(setq global-mode-string
(append global-mode-string '(org-mode-line-string))))
- (org-update-mode-line)
- (setq org-mode-line-timer
- (run-with-timer 60 60 'org-update-mode-line))
+ (org-clock-update-mode-line)
+ (setq org-clock-mode-line-timer
+ (run-with-timer 60 60 'org-clock-update-mode-line))
(message "Clock started at %s" ts)))))))
(defun org-clock-find-position ()
(when org-log-note-clock-out
(org-add-log-setup 'clock-out nil nil nil
(concat "# Task: " (org-get-heading t) "\n\n")))
- (when org-mode-line-timer
- (cancel-timer org-mode-line-timer)
- (setq org-mode-line-timer nil))
+ (when org-clock-mode-line-timer
+ (cancel-timer org-clock-mode-line-timer)
+ (setq org-clock-mode-line-timer nil))
(setq global-mode-string
(delq 'org-mode-line-string global-mode-string))
(force-mode-line-update)
If TOTAL-ONLY is non-nil, only show the total time for the entire file
in the echo area."
(interactive)
- (org-remove-clock-overlays)
+ (org-clock-remove-overlays)
(let (time h m p)
(org-clock-sum)
(unless total-only
(point) :org-clock-minutes)))
(goto-char p)
(when (setq time (get-text-property p :org-clock-minutes))
- (org-put-clock-overlay time (funcall outline-level))))
+ (org-clock-put-overlay time (funcall outline-level))))
(setq h (/ org-clock-file-total-minutes 60)
m (- org-clock-file-total-minutes (* 60 h)))
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
- (org-add-hook 'before-change-functions 'org-remove-clock-overlays
+ (org-add-hook 'before-change-functions 'org-clock-remove-overlays
nil 'local))))
(message (concat "Total file time: " org-time-clocksum-format " (%d hours and %d minutes)") h m h m)))
(defvar org-clock-overlays nil)
(make-variable-buffer-local 'org-clock-overlays)
-(defun org-put-clock-overlay (time &optional level)
+(defun org-clock-put-overlay (time &optional level)
"Put an overlays on the current line, displaying TIME.
If LEVEL is given, prefix time with a corresponding number of stars.
This creates a new overlay and stores it in `org-clock-overlays', so that it
(org-add-props (format fmt
(make-string l ?*) h m
(make-string (- 16 l) ?\ ))
- '(face secondary-selection))
+ (list 'face 'org-clock-overlay))
""))
(if (not (featurep 'xemacs))
(org-overlay-put ov 'display tx)
(org-overlay-put ov 'end-glyph (make-glyph tx)))
(push ov org-clock-overlays)))
-(defun org-remove-clock-overlays (&optional beg end noremove)
+(defun org-clock-remove-overlays (&optional beg end noremove)
"Remove the occur highlights from the buffer.
BEG and END are ignored. If NOREMOVE is nil, remove this function
from the `before-change-functions' in the current buffer."
(setq org-clock-overlays nil)
(unless noremove
(remove-hook 'before-change-functions
- 'org-remove-clock-overlays 'local))))
+ 'org-clock-remove-overlays 'local))))
(defvar state) ;; dynamically scoped into this function
(defun org-clock-out-if-current ()
When called with a prefix argument, move to the first clock table in the
buffer and update it."
(interactive "P")
- (org-remove-clock-overlays)
+ (org-clock-remove-overlays)
(when arg
(org-find-dblock "clocktable")
(org-show-entry))
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
This respects the format of the time stamp in S, active or non-active,
and also including time or not. S must be just a time stamp, no text
around it."
- (when (string-match (concat "^" org-ts-regexp3 "$") s)
+ (when (and s (string-match (concat "^" org-ts-regexp3 "$") s))
(let* ((time (org-parse-time-string s 'nodefaults))
(active (equal (string-to-char s) ?<))
(fmt (funcall (if (nth 1 time) 'cdr 'car) org-time-stamp-formats))
:width enforce same column widths with <N> specifiers.
:id the :ID: property of the entry where the columns view
- should be built, as a string. When `local', call locally.
+ should be built. When the symbol `local', call locally.
When `global' call column view with the cursor at the beginning
of the buffer (usually this means that the whole buffer switches
- to column view).
+ to column view). When \"file:path/to/file.org\", invoke column
+ view at the start of that file. Otherwise, the ID is located
+ using `org-id-find'.
:hlines When t, insert a hline before each item. When a number, insert
a hline before each level <= that number.
:vlines When t, make each column a colgroup to enforce vertical lines.
(maxlevel (plist-get params :maxlevel))
(content-lines (org-split-string (plist-get params :content) "\n"))
(skip-empty-rows (plist-get params :skip-empty-rows))
- tbl id idpos nfields tmp recalc line)
- (save-excursion
- (save-restriction
- (when (setq id (plist-get params :id))
- (cond ((not id) nil)
- ((eq id 'global) (goto-char (point-min)))
- ((eq id 'local) nil)
- ((setq idpos (org-find-entry-with-id id))
- (goto-char idpos))
- (t (error "Cannot find entry with :ID: %s" id))))
- (org-columns)
- (setq tbl (org-columns-capture-view maxlevel skip-empty-rows))
- (setq nfields (length (car tbl)))
- (org-columns-quit)))
+ tbl id idpos nfields tmp recalc line
+ id-as-string view-file view-pos)
+ (when (setq id (plist-get params :id))
+ (setq id-as-string (cond ((numberp id) (number-to-string id))
+ ((symbolp id) (symbol-name id))
+ ((stringp id) id)
+ (t "")))
+ (cond ((not id) nil)
+ ((eq id 'global) (setq view-pos (point-min)))
+ ((eq id 'local))
+ ((string-match "^file:\\(.*\\)" id-as-string)
+ (setq view-file (match-string 1 id-as-string)
+ view-pos 1)
+ (unless (file-exists-p view-file)
+ (error "No such file: \"%s\"" id-as-string)))
+ ((setq idpos (org-find-entry-with-id id))
+ (setq view-pos idpos))
+ ((setq idpos (org-id-find id))
+ (setq view-file (car idpos))
+ (setq view-pos (cdr idpos)))
+ (t (error "Cannot find entry with :ID: %s" id))))
+ (with-current-buffer (if view-file
+ (get-file-buffer view-file)
+ (current-buffer))
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (or view-pos (point)))
+ (org-columns)
+ (setq tbl (org-columns-capture-view maxlevel skip-empty-rows))
+ (setq nfields (length (car tbl)))
+ (org-columns-quit))))
(goto-char pos)
(move-marker pos nil)
(when tbl
(if (string-match "\\` *\\(\\*+\\)" (caar tbl))
(if (and (not (eq (car tmp) 'hline))
(or (eq hlines t)
- (and (numberp hlines) (<= (- (match-end 1) (match-beginning 1)) hlines))))
+ (and (numberp hlines)
+ (<= (- (match-end 1) (match-beginning 1))
+ hlines))))
(push 'hline tmp)))
(push (pop tbl) tmp)))
(setq tbl (nreverse tmp)))
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call
`shrink-window-if-larger-than-buffer' instead, the hight limit are
ignored in this case."
- (cond ((> (frame-width) (window-width window))
+ (cond ((if (fboundp 'window-full-width-p)
+ (not (window-full-width-p window))
+ (> (frame-width) (window-width window)))
;; do nothing if another window would suffer
)
((and (fboundp 'fit-window-to-buffer) (not shrink-only))
(org-no-properties (substring string (or from 0) to))
(substring-no-properties string from to)))
+(defun org-count-lines (s)
+ "How many lines in string S?"
+ (let ((start 0) (n 1))
+ (while (string-match "\n" s start)
+ (setq start (match-end 0) n (1+ n)))
+ (if (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
+ (setq n (1- n)))
+ n))
+
(provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(declare-function org-agenda-skip "org-agenda" ())
(declare-function org-infojs-options-inbuffer-template "org-jsinfo" ())
(declare-function htmlize-region "ext:htmlize" (beg end))
+(declare-function org-id-find-id-file "org-id" (id))
(defvar htmlize-buffer-places) ; from htmlize.el
(defgroup org-export nil
"Hook for preprocessing an export buffer.
Pretty much the first thing when exporting is running this hook.")
+(defvar org-export-preprocess-after-include-files-hook nil
+ "Hook for preprocessing an export buffer.
+This is run after the contents of included files have been inserted.")
+
+(defvar org-export-preprocess-after-tree-selection-hook nil
+ "Hook for preprocessing an export buffer.
+This is run after selection of trees to be exported has happened.
+This selection includes tags-based selection, as well as removal
+of commented and archived trees.")
+
+(defvar org-export-preprocess-before-backend-specifics-hook nil
+ "Hook run before backend-specific functions are called during preprocessing.")
+
+(defvar org-export-preprocess-final-hook nil
+ "Hook for preprocessing an export buffer.
+This is run as the last thing in the preprocessing buffer, just before
+returning the buffer string to the backend.")
+
(defgroup org-export-translation nil
"Options for translating special ascii sequences for the export backends."
:tag "Org Export Translation"
(defcustom org-export-with-TeX-macros t
"Non-nil means, interpret simple TeX-like macros when exporting.
For example, HTML export converts \\alpha to α and \\AA to Å.
-No only real TeX macros will work here, but the standard HTML entities
+Not only real TeX macros will work here, but the standard HTML entities
for math can be used as macro names as well. For a list of supported
names in HTML export, see the constant `org-html-entities'.
Not all export backends support this.
:group 'org-export-html
:type '(string :tag "File or URL"))
+(defconst org-export-html-scripts
+"<script type=\"text/javascript\">
+<!--/*--><![CDATA[/*><!--*/
+ function CodeHighlightOn(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(null != target) {
+ elem.cacheClassElem = elem.className;
+ elem.cacheClassTarget = target.className;
+ target.className = \"code-highlighted\";
+ elem.className = \"code-highlighted\";
+ }
+ }
+ function CodeHighlightOff(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(elem.cacheClassElem)
+ elem.className = elem.cacheClassElem;
+ if(elem.cacheClassTarget)
+ target.className = elem.cacheClassTarget;
+ }
+/*]]>*/-->
+</script>"
+"Basic javascript that is needed by HTML files produced by Org-mode.")
+
(defconst org-export-html-style-default
"<style type=\"text/css\">
<!--/*--><![CDATA[/*><!--*/
dt { font-weight: bold; }
div.figure { padding: 0.5em; }
div.figure p { text-align: center; }
+ .linenr { font-size:smaller }
+ .code-highlighted {background-color:#ffff00;}
.org-info-js_info-navigation { border-style:none; }
#org-info-js_console-label { font-size:10px; font-weight:bold;
white-space:nowrap; }
(const :tag "Always" t)
(const :tag "When there is no description" maybe)))
+(defcustom org-export-html-inline-image-extensions
+ '("png" "jpeg" "jpg" "gif")
+ "Extensions of image files that can be inlined into HTML."
+ :group 'org-export-html
+ :type '(repeat (string :tag "Extension")))
+
;; FIXME: rename
(defcustom org-export-html-expand t
"Non-nil means, for HTML export, treat @<...> as HTML tag.
(defvar org-export-target-aliases nil
"Alist of targets with invisible aliases.")
+(defvar org-export-code-refs nil
+ "Alist of code references and line numbers")
(defun org-export-preprocess-string (string &rest parameters)
"Cleanup STRING so that that the true exported has a more consistent source.
target-alist rtn)
(setq org-export-target-aliases nil)
+ (setq org-export-code-refs nil)
(with-current-buffer (get-buffer-create " org-mode-tmp")
(erase-buffer)
(insert string)
(setq case-fold-search t)
- ;; Call the hook
- (run-hooks 'org-export-preprocess-hook)
;; Remove license-to-kill stuff
;; The caller marks some stuff for killing, stuff that has been
(let ((org-inhibit-startup t)) (org-mode))
(setq case-fold-search t)
+
+ ;; Call the hook
+ (run-hooks 'org-export-preprocess-hook)
+
(untabify (point-min) (point-max))
- ;; Handle include files
+ ;; Handle include files, and call a hook
(org-export-handle-include-files)
+ (run-hooks 'org-export-preprocess-after-include-files-hook)
- ;; Get rid of excluded trees
+ ;; Get rid of archived trees
+ (org-export-remove-archived-trees archived-trees)
+
+ ;; Remove comment environment and comment subtrees
+ (org-export-remove-comment-blocks-and-subtrees)
+
+ ;; Get rid of excluded trees, and call a hook
(org-export-handle-export-tags (plist-get parameters :select-tags)
(plist-get parameters :exclude-tags))
+ (run-hooks 'org-export-preprocess-after-tree-selection-hook)
;; Handle source code snippets
- (org-export-replace-src-segments)
+ (org-export-replace-src-segments-and-examples backend)
+
+ ;; Protect short examples marked by a leading colon
+ (org-export-protect-colon-examples)
+
+ ;; Normalize footnotes
+ (when (plist-get parameters :footnotes)
+ (org-footnote-normalize nil t))
;; Find all headings and compute the targets for them
(setq target-alist (org-export-define-heading-targets target-alist))
(goto-char (point-min))
(insert (plist-get parameters :add-text) "\n"))
- ;; Get rid of archived trees
- (org-export-remove-archived-trees archived-trees)
-
;; Remove todo-keywords before exporting, if the user has requested so
(org-export-remove-headline-metadata parameters)
;; but mark them as targets that should be invisible
(setq target-alist (org-export-handle-invisible-targets target-alist))
- ;; Protect examples
- (org-export-protect-examples (if asciip 'indent nil))
-
- ;; Protect backend specific stuff, throw away the others.
+ ;; Select and protect backend specific stuff, throw away stuff
+ ;; that is specific for other backends
(org-export-select-backend-specific-text backend)
;; Protect quoted subtrees
;; Blockquotes and verse
(org-export-mark-blockquote-and-verse)
+ ;; Remove timestamps, if the user has requested so
+ (org-export-remove-clock-lines)
+ (unless (plist-get parameters :timestamps)
+ (org-export-remove-timestamps))
+
;; Attach captions to the correct object
(setq target-alist (org-export-attach-captions-and-attributes
backend target-alist))
- ;; Remove comment environment and comment subtrees
- (org-export-remove-comment-blocks-and-subtrees)
-
;; Find matches for radio targets and turn them into internal links
(org-export-mark-radio-links)
(when org-export-table-remove-special-lines
(org-export-remove-special-table-lines))
- ;; Specific LaTeX stuff
+ ;; Another hook
+ (run-hooks 'org-export-preprocess-before-backend-specifics-hook)
+
+ ;; LaTeX-specific preprocessing
(when latexp
(require 'org-export-latex nil)
(org-export-latex-preprocess))
- ;; Specific ASCII stuff
+ ;; ASCII-specific preprocessing
(when asciip
(org-export-ascii-preprocess))
- ;; Specific HTML stuff
+ ;; HTML-specific preprocessing
(when htmlp
(org-export-html-preprocess parameters))
;; Remove or replace comments
(org-export-handle-comments (plist-get parameters :comments))
+ ;; Run the final hook
+ (run-hooks 'org-export-preprocess-final-hook)
+
(setq rtn (buffer-string)))
(kill-buffer " org-mode-tmp")
rtn))
(org-init-section-numbers)
(let ((re (concat "^" org-outline-regexp
"\\| [ \t]*:ID:[ \t]*\\([^ \t\r\n]+\\)"))
- level target)
+ level target last-section-target a)
(while (re-search-forward re nil t)
(if (match-end 1)
- (push (cons (org-match-string-no-properties 1)
- target) target-alist)
+ (progn
+ (push (cons (org-match-string-no-properties 1)
+ target) target-alist)
+ (setq a (or (assoc last-section-target org-export-target-aliases)
+ (progn
+ (push (list last-section-target)
+ org-export-target-aliases)
+ (car org-export-target-aliases))))
+ (push (caar target-alist) (cdr a)))
(setq level (org-reduced-level
(save-excursion (goto-char (point-at-bol))
(org-outline-level))))
(setq target (org-solidify-link-text
(format "sec-%s" (org-section-number level))))
+ (setq last-section-target target)
(push (cons target target) target-alist)
(add-text-properties
(point-at-bol) (point-at-eol)
(desc (match-end 2))
(link (org-link-unescape (match-string 1)))
(slink (org-solidify-link-text link))
- found props pos
+ found props pos cref
(target
(cond
((cdr (assoc slink target-alist)))
((and (string-match "^id:" link)
(cdr (assoc (substring link 3) target-alist))))
+ ((string-match "^(\\(.*\\))$" link)
+ (setq cref (match-string 1 link))
+ (concat "coderef:" cref))
((string-match org-link-types-re link) nil)
((or (file-name-absolute-p link)
(string-match "^\\." link))
(when (or (not todo) (not tags) (not pri))
(goto-char (point-min))
(while (re-search-forward re nil t)
- (setq rpl (mapconcat (lambda (i) (if (match-end i) (match-string i) ""))
- elts " "))
- (replace-match rpl t t)))))
+ (org-if-unprotected
+ (setq rpl (mapconcat (lambda (i) (if (match-end i) (match-string i) ""))
+ elts " "))
+ (replace-match rpl t t))))))
+
+(defun org-export-remove-timestamps ()
+ "Remove timestamps and keywords for export."
+ (while (re-search-forward org-maybe-keyword-time-regexp nil t)
+ (backward-char 1)
+ (org-if-unprotected
+ (replace-match "")
+ (beginning-of-line 1)
+ (if (looking-at "[- \t]*\\(=>[- \t0-9:]*\\)?[ \t]*\n")
+ (replace-match "")))))
+
+(defun org-export-remove-clock-lines ()
+ "Remove timestamps and keywords for export."
+ (let ((re (concat "^[ \t]*" org-clock-string ".*\n?")))
+ (while (re-search-forward re nil t)
+ (org-if-unprotected
+ (replace-match "")))))
(defun org-export-protect-quoted-subtrees ()
"Mark quoted subtrees with the protection property."
'(org-protected t))
(goto-char (1+ (match-end 4)))))
-(defun org-export-protect-examples (&optional indent)
- "Protect code that should be exported as monospaced examples."
- (goto-char (point-min))
- (while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t)
- (goto-char (match-end 0))
- (while (and (not (looking-at "#\\+END_EXAMPLE")) (not (eobp)))
- (insert (if indent ": " ":"))
- (beginning-of-line 2)))
+(defun org-export-protect-colon-examples ()
+ "Protect lines starting with a colon."
(goto-char (point-min))
- (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t)
- (add-text-properties (match-beginning 0) (match-end 0)
- '(org-protected t))))
+ (let ((re "^[ \t]*:\\([ \t]\\|$\\)") beg end)
+ (while (re-search-forward re nil t)
+ (beginning-of-line 1)
+ (setq beg (point))
+ (while (looking-at re)
+ (end-of-line 1)
+ (or (eobp) (forward-char 1)))
+ (add-text-properties beg (if (bolp) (1- (point)) (point))
+ '(org-protected t)))))
(defun org-export-select-backend-specific-text (backend)
(let ((formatters
'((html "HTML" "BEGIN_HTML" "END_HTML")
(ascii "ASCII" "BEGIN_ASCII" "END_ASCII")
(latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX")))
+ (case-fold-search t)
fmt)
(while formatters
(org-translate-link
(org-link-expand-abbrev (match-string 1)))))
(s (concat
- "[[" xx "]"
+ "[[" (org-add-props (copy-sequence xx)
+ nil 'org-protected t)
+ "]"
(if (match-end 3)
(match-string 2)
- (concat "[" xx "]"))
+ (concat "[" (org-add-props
+ (copy-sequence xx)
+ '(org-protected t))
+ "]"))
"]")))
(put-text-property 0 (length s) 'face 'org-link s)
(replace-match s t t))))))
can work correctly."
(goto-char (point-min))
(while (re-search-forward org-emph-re nil t)
- (if (not (= (char-after (match-beginning 3))
- (char-after (match-beginning 4))))
+ (if (and (not (= (char-after (match-beginning 3))
+ (char-after (match-beginning 4))))
+ (save-excursion (goto-char (match-beginning 0))
+ (save-match-data (not (org-at-table-p)))))
(org-if-unprotected
(subst-char-in-region (match-beginning 0) (match-end 0)
?\n ?\ t)
(defun org-export-handle-include-files ()
"Include the contents of include files, with proper formatting."
(let ((case-fold-search t)
- params file markup lang start end prefix prefix1)
+ params file markup lang start end prefix prefix1 switches)
(goto-char (point-min))
(while (re-search-forward "^#\\+INCLUDE:?[ \t]+\\(.*\\)" nil t)
(setq params (read (concat "(" (match-string 1) ")"))
prefix1 (org-get-and-remove-property 'params :prefix1)
file (org-symname-or-string (pop params))
markup (org-symname-or-string (pop params))
- lang (org-symname-or-string (pop params)))
+ lang (and (member markup '("src" "SRC"))
+ (org-symname-or-string (pop params)))
+ switches (mapconcat '(lambda (x) (format "%s" x)) params " "))
(delete-region (match-beginning 0) (match-end 0))
(if (or (not file)
(not (file-exists-p file))
(insert (format "CANNOT INCLUDE FILE %s" file))
(when markup
(if (equal (downcase markup) "src")
- (setq start (format "#+begin_src %s\n" (or lang "fundamental"))
+ (setq start (format "#+begin_src %s %s\n"
+ (or lang "fundamental")
+ (or switches ""))
end "#+end_src")
- (setq start (format "#+begin_%s\n" markup)
+ (setq start (format "#+begin_%s %s\n" markup switches)
end (format "#+end_%s" markup))))
(insert (or start ""))
(insert (org-get-file-contents (expand-file-name file) prefix prefix1))
(if s (symbol-name s) s)
s))
-;;; Fontification of code
-;; Currently only for the HTML backend, but who knows....
-(defun org-export-replace-src-segments ()
+;;; Fontification and line numbers for code examples
+
+(defvar org-export-last-code-line-counter-value 0)
+
+(defun org-export-replace-src-segments-and-examples (backend)
"Replace source code segments with special code for export."
+ (setq org-export-last-code-line-counter-value 0)
(let ((case-fold-search t)
- lang code trans)
+ lang code trans opts)
(goto-char (point-min))
(while (re-search-forward
- "^#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)[ \t]*\n\\([^\000]+?\n\\)#\\+END_SRC.*"
+ "\\(^#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)#\\+END_SRC.*\\)\\|\\(^#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)#\\+END_EXAMPLE.*\\)"
nil t)
- (setq lang (match-string 1) code (match-string 2)
- trans (org-export-format-source-code lang code))
+ (if (match-end 1)
+ ;; src segments
+ (setq lang (match-string 2)
+ opts (match-string 3)
+ code (match-string 4))
+ (setq lang nil
+ opts (match-string 6)
+ code (match-string 7)))
+
+ (setq trans (org-export-format-source-code-or-example
+ backend lang code opts))
(replace-match trans t t))))
-(defvar htmlp) ;; dynamically scoped from org-exp.el
+(defvar htmlp) ;; dynamically scoped
+(defvar latexp) ;; dynamically scoped
-(defun org-export-format-source-code (lang code)
+(defun org-export-format-source-code-or-example (backend
+ lang code &optional opts)
"Format CODE from language LANG and return it formatted for export.
-Currently, this only does something for HTML export, for all other
-backends, it converts the segment into an EXAMPLE segment."
+If LANG is nil, do not add any fontification.
+OPTS contains formatting optons, like `-n' for triggering numbering lines,
+and `+n' for continuing previous numering.
+Code formatting according to language currently only works for HTML.
+Numbering lines works for all three major backends (html, latex, and ascii)."
(save-match-data
- (cond
- (htmlp
- ;; We are exporting to HTML
- (require 'htmlize nil t)
- (if (not (fboundp 'htmlize-region-for-paste))
- (progn
+ (let (num cont rtn named rpllbl keepp textareap cols rows fmt)
+ (setq opts (or opts "")
+ num (string-match "[-+]n\\>" opts)
+ cont (string-match "\\+n\\>" opts)
+ rpllbl (string-match "-r\\>" opts)
+ keepp (string-match "-k\\>" opts)
+ textareap (string-match "-t\\>" opts)
+ cols (if (string-match "-w[ \t]+\\([0-9]+\\)" opts)
+ (string-to-number (match-string 1 opts))
+ 80)
+ rows (if (string-match "-h[ \t]+\\([0-9]+\\)" opts)
+ (string-to-number (match-string 1 opts))
+ (org-count-lines code))
+ fmt (if (string-match "-l[ \t]+\"\\([^\"\n]+\\)\"" opts)
+ (match-string 1 opts)))
+ (when (and textareap (eq backend 'html))
+ ;; we cannot use numbering or highlighting.
+ (setq num nil cont nil lang nil))
+ (if keepp (setq rpllbl 'keep))
+ (setq rtn code)
+ (when (equal lang "org")
+ (setq rtn (with-temp-buffer
+ (insert rtn)
+ ;; Free up the protected lines
+ (goto-char (point-min))
+ (while (re-search-forward "^," nil t)
+ (replace-match "")
+ (end-of-line 1))
+ (buffer-string))))
+ ;; Now backend-specific coding
+ (cond
+ ((eq backend 'html)
+ ;; We are exporting to HTML
+ (when lang
+ (require 'htmlize nil t)
+ (when (not (fboundp 'htmlize-region-for-paste))
;; we do not have htmlize.el, or an old version of it
+ (setq lang nil)
(message
- "htmlize.el 1.34 or later is needed for source code formatting")
- (concat "#+BEGIN_EXAMPLE\n" code
- (if (string-match "\n\\'" code) "" "\n")
- "#+END_EXAMPLE\n"))
- ;; ok, we are good to go
- (let* ((mode (and lang (intern (concat lang "-mode"))))
- (org-inhibit-startup t)
- (org-startup-folded nil)
- (htmltext
- (with-temp-buffer
- (insert code)
- ;; Free up the protected stuff
- (goto-char (point-min))
- (while (re-search-forward "^," nil t)
- (replace-match "")
- (end-of-line 1))
- (if (functionp mode)
- (funcall mode)
- (fundamental-mode))
- (font-lock-fontify-buffer)
- (org-export-htmlize-region-for-paste
- (point-min) (point-max)))))
- (if (string-match "<pre\\([^>]*\\)>\n?" htmltext)
- (setq htmltext (replace-match
- (format "<pre class=\"src src-%s\">\n" lang)
- t t htmltext)))
- (concat "\n#+BEGIN_HTML\n" htmltext "\n#+END_HTML\n\n"))))
- (t
- ;; This is not HTML, so just make it an example.
- (when (equal lang "org")
- (while (string-match "^," code)
- (setq code (replace-match "" t t code))))
- (concat "#+BEGIN_EXAMPLE\n" code
- (if (string-match "\n\\'" code) "" "\n")
- "#+END_EXAMPLE\n")))))
+ "htmlize.el 1.34 or later is needed for source code formatting")))
+
+ (if lang
+ (let* ((mode (and lang (intern (concat lang "-mode"))))
+ (org-inhibit-startup t)
+ (org-startup-folded nil))
+ (setq rtn
+ (with-temp-buffer
+ (insert rtn)
+ (if (functionp mode)
+ (funcall mode)
+ (fundamental-mode))
+ (font-lock-fontify-buffer)
+ (org-export-htmlize-region-for-paste
+ (point-min) (point-max))))
+ (if (string-match "<pre\\([^>]*\\)>\n?" rtn)
+ (setq rtn (replace-match
+ (format "<pre class=\"src src-%s\">\n" lang)
+ t t rtn))))
+ (if textareap
+ (setq rtn (concat
+ (format "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n"
+ cols rows)
+ rtn "</textarea>\n</p>\n"))
+ (with-temp-buffer
+ (insert rtn)
+ (goto-char (point-min))
+ (while (re-search-forward "[<>&]" nil t)
+ (replace-match (cdr (assq (char-before)
+ '((?&."&")(?<."<")(?>.">"))))
+ t t))
+ (setq rtn (buffer-string)))
+ (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n"))))
+ (unless textareap
+ (setq rtn (org-export-number-lines rtn 'html 1 1 num
+ cont rpllbl fmt)))
+ (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
+ ((eq backend 'latex)
+ (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
+ (concat "\n#+BEGIN_LaTeX\n"
+ (org-add-props (concat "\\begin{verbatim}\n" rtn "\n\\end{verbatim}\n")
+ '(org-protected t))
+ "#+END_LaTeX\n\n"))
+ ((eq backend 'ascii)
+ ;; This is not HTML or LaTeX, so just make it an example.
+ (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt))
+ (concat "#+BEGIN_ASCII\n"
+ (org-add-props
+ (concat
+ (mapconcat
+ (lambda (l) (concat " " l))
+ (org-split-string rtn "\n")
+ "\n")
+ "\n")
+ '(org-protected t))
+ "#+END_ASCII\n"))))))
+
+(defun org-export-number-lines (text backend
+ &optional skip1 skip2 number cont
+ replace-labels label-format)
+ (if (and (not number) (not (eq replace-labels 'keep)))
+ (setq replace-labels nil)) ;; must use names if no numbers
+ (setq skip1 (or skip1 0) skip2 (or skip2 0))
+ (if (not cont) (setq org-export-last-code-line-counter-value 0))
+ (with-temp-buffer
+ (insert text)
+ (goto-char (point-max))
+ (skip-chars-backward " \t\n\r")
+ (delete-region (point) (point-max))
+ (beginning-of-line (- 1 skip2))
+ (let* ((last (org-current-line))
+ (n org-export-last-code-line-counter-value)
+ (nmax (+ n (- last skip1)))
+ (fmt (format "%%%dd: " (length (number-to-string nmax))))
+ (fm
+ (cond
+ ((eq backend 'html) (format "<span class=\"linenr\">%s</span>"
+ fmt))
+ ((eq backend 'ascii) fmt)
+ ((eq backend 'latex) fmt)
+ (t "")))
+ (label-format (or label-format org-coderef-label-format))
+ (label-pre (if (string-match "%s" label-format)
+ (substring label-format 0 (match-beginning 0))
+ label-format))
+ (label-post (if (string-match "%s" label-format)
+ (substring label-format (match-end 0))
+ ""))
+ (lbl-re
+ (concat
+ ".*?\\S-.*?\\([ \t]*\\("
+ (regexp-quote label-pre)
+ "\\([-a-zA-Z0-9_]+\\)"
+ (regexp-quote label-post)
+ "\\)\\)"))
+ ref)
+
+ (goto-line (1+ skip1))
+ (while (and (re-search-forward "^" nil t) (not (eobp)) (< n nmax))
+ (if number
+ (insert (format fm (incf n)))
+ (forward-char 1))
+ (when (and (not (eq replace-labels 'keep))
+ (looking-at lbl-re))
+ (setq ref (match-string 3))
+ (if replace-labels
+ (progn
+ (delete-region (match-beginning 1) (match-end 1))
+ (push (cons ref n) org-export-code-refs))
+ (goto-char (match-beginning 2))
+ (delete-region (match-beginning 2) (match-end 2))
+ (insert "(" ref ")")
+ (push (cons ref (concat "(" ref ")")) org-export-code-refs))
+ (when (eq backend 'html)
+ (save-excursion
+ (beginning-of-line 1)
+ (insert (format "<span id=\"coderef-%s\" class=\"coderef-off\">"
+ ref))
+ (end-of-line 1)
+ (insert "</span>")))))
+ (setq org-export-last-code-line-counter-value n)
+ (goto-char (point-max))
+ (newline)
+ (buffer-string))))
;;; ASCII export
:drawers (plist-get opt-plist :drawers)
:tags (plist-get opt-plist :tags)
:priority (plist-get opt-plist :priority)
+ :footnotes (plist-get opt-plist :footnotes)
+ :timestamps (plist-get opt-plist :timestamps)
:todo-keywords (plist-get opt-plist :todo-keywords)
:verbatim-multiline t
:select-tags (plist-get opt-plist :select-tags)
:add-text (plist-get opt-plist :text))
"\n"))
thetoc have-headings first-heading-pos
- table-open table-buffer)
+ table-open table-buffer link desc)
(let ((inhibit-read-only t))
(org-unmodified
(setq line (org-html-expand-for-ascii line))
;; Replace links with the description when possible
(while (string-match org-bracket-link-regexp line)
- (setq line (replace-match
- (if (match-end 3) "[\\3]" "[\\1]")
- t nil line)))
+ (setq link (match-string 1 line)
+ desc (match-string (if (match-end 3) 3 1) line))
+ (if (and (> (length link) 8)
+ (equal (substring link 0 8) "coderef:"))
+ (setq line (replace-match
+ (format (org-export-get-coderef-format (substring link 8) desc)
+ (cdr (assoc
+ (substring link 8)
+ org-export-code-refs)))
+ t t line))
+ (setq line (replace-match
+ (if (match-end 3) "[\\3]" "[\\1]")
+ t nil line))))
(when custom-times
(setq line (org-translate-time line)))
(cond
#+EMAIL: %s
#+DATE: %s
#+LANGUAGE: %s
-#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s d:%s todo:%s pri:%s tags:%s
+#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s <:%s
+#+OPTIONS: TeX:%s LaTeX:%s skip:%s d:%s todo:%s pri:%s tags:%s
%s
#+EXPORT_SELECT_TAGS: %s
#+EXPORT_EXCLUDE_TAGS: %s
org-export-with-special-strings
org-export-with-footnotes
org-export-with-emphasize
+ org-export-with-timestamps
org-export-with-TeX-macros
org-export-with-LaTeX-fragments
org-export-skip-text-before-1st-heading
(style (concat (if (plist-get opt-plist :style-include-default)
org-export-html-style-default)
(plist-get opt-plist :style)
- (plist-get opt-plist :style-extra)))
+ (plist-get opt-plist :style-extra)
+ "\n" org-export-html-scripts))
(html-extension (plist-get opt-plist :html-extension))
(link-validate (plist-get opt-plist :link-validation-function))
valid thetoc have-headings first-heading-pos
:todo-keywords (plist-get opt-plist :todo-keywords)
:tags (plist-get opt-plist :tags)
:priority (plist-get opt-plist :priority)
+ :footnotes (plist-get opt-plist :footnotes)
+ :timestamps (plist-get opt-plist :timestamps)
:archived-trees
(plist-get opt-plist :archived-trees)
:select-tags (plist-get opt-plist :select-tags)
ind item-type starter didclose
rpl path attr desc descp desc1 desc2 link
snumber fnc item-tag
- footnotes
+ footnotes footref-seen
+ id-file
)
(let ((inhibit-read-only t))
;; Fixed-width, verbatim lines (examples)
(when (and org-export-with-fixed-width
- (string-match "^[ \t]*:\\(.*\\)" line))
+ (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)" line))
(when (not infixed)
(setq infixed t)
(org-close-par-maybe)
(insert "<pre class=\"example\">\n"))
- (insert (org-html-protect (match-string 1 line)) "\n")
+ (insert (org-html-protect (match-string 3 line)) "\n")
(when (or (not lines)
(not (string-match "^[ \t]*\\(:.*\\)"
(car lines))))
(replace-match "\\2\n"))
(insert line "\n")
(while (and lines
- (not (string-match "^[ \t]*:" (car lines)))
(or (= (length (car lines)) 0)
(get-text-property 0 'org-protected (car lines))))
(insert (pop lines) "\n"))
;; Format the links
(setq start 0)
- (while (string-match org-bracket-link-analytic-regexp line start)
+ (while (string-match org-bracket-link-analytic-regexp++ line start)
(setq start (match-beginning 0))
(setq path (save-match-data (org-link-unescape
(match-string 3 line))))
descp (and desc1 (not (equal desc1 desc2)))
desc (or desc1 desc2))
;; Make an image out of the description if that is so wanted
- (when (and descp (org-file-image-p desc))
+ (when (and descp (org-file-image-p
+ desc org-export-html-inline-image-extensions))
(save-match-data
(if (string-match "^file:" desc)
(setq desc (substring desc (match-end 0)))))
"\"" attr ">"
(org-export-html-format-desc desc)
"</a>")))
+ ((and (equal type "id")
+ (setq id-file (org-id-find-id-file path)))
+ ;; This is an id: link to another file (if it was the same file,
+ ;; it would have become an internal link...)
+ (setq id-file (file-relative-name
+ id-file (file-name-directory org-current-export-file)))
+ (setq id-file (concat (file-name-sans-extension id-file)
+ "." html-extension))
+ (setq rpl (concat "<a href=\"" id-file "#" path "\""
+ attr ">"
+ (org-export-html-format-desc desc)
+ "</a>")))
((member type '("http" "https"))
;; standard URL, just check if we need to inline an image
(if (and (or (eq t org-export-html-inline-images)
(and org-export-html-inline-images (not descp)))
- (org-file-image-p path))
+ (org-file-image-p
+ path org-export-html-inline-image-extensions))
(setq rpl (org-export-html-format-image
(concat type ":" path)))
(setq link (concat type ":" path))
(org-export-html-format-desc desc)
"</a>")))
+ ((string= type "coderef")
+
+ (setq rpl (format "<a href=\"#coderef-%s\" class=\"coderef\" onmouseover=\"CodeHighlightOn(this, 'coderef-%s');\" onmouseout=\"CodeHighlightOff(this, 'coderef-%s');\">%s</a>"
+ path path path
+ (format (org-export-get-coderef-format path (and descp desc))
+ (cdr (assoc path org-export-code-refs))))))
+
((functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
;; The link protocol has a function for format the link
(setq rpl
(if (functionp link-validate)
(funcall link-validate filename current-dir)
t))
- (setq file-is-image-p (org-file-image-p filename))
+ (setq file-is-image-p
+ (org-file-image-p
+ filename org-export-html-inline-image-extensions))
(setq thefile (if abs-p (expand-file-name filename) filename))
(when (and org-export-html-link-org-files-as-html
(string-match "\\.org$" thefile))
(while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
(if (get-text-property (match-beginning 2) 'org-protected line)
(setq start (match-end 2))
- (let ((n (match-string 2 line)))
+ (let ((n (match-string 2 line)) extra a)
+ (if (setq a (assoc n footref-seen))
+ (progn
+ (setcdr a (1+ (cdr a)))
+ (setq extra (format ".%d" (cdr a))))
+ (setq extra "")
+ (push (cons n 1) footref-seen))
(setq line
(replace-match
(format
- "%s<sup><a class=\"footref\" name=\"fnr.%s\" href=\"#fn.%s\">%s</a></sup>"
- (match-string 1 line) n n n)
+ "%s<sup><a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a></sup>"
+ (match-string 1 line) n extra n n)
t t line))))))
(cond
(org-export-preserve-breaks
(setq line (concat line "<br/>"))))
+ ;; Check if a paragraph should be started
+ (let ((start 0))
+ (while (and org-par-open
+ (string-match "\\\\par\\>" line start))
+ ;; Leave a space in the </p> so that the footnote matcher
+ ;; does not see this.
+ (if (not (get-text-property (match-beginning 0)
+ 'org-protected line))
+ (setq line (replace-match "</p ><p >" t t line)))
+ (setq start (match-end 0))))
+
(insert line "\n")))))
;; Properly close all local lists and other lists
(kill-buffer (current-buffer)))
(current-buffer)))))
+(defun org-export-get-coderef-format (path desc)
+ (save-match-data
+ (if (and desc (string-match
+ (regexp-quote (concat "(" path ")"))
+ desc))
+ (replace-match "%s" t t desc)
+ "%s")))
+
+
(defun org-export-html-format-href (s)
"Make sure the S is valid as a href reference in an XHTML document."
(save-match-data
(push html-table-tag html))
(concat (mapconcat 'identity html "\n") "\n")))
-(defun org-table-clean-before-export (lines)
+(defun org-table-clean-before-export (lines &optional maybe-quoted)
"Check if the table has a marking column.
If yes remove the column and the special lines."
(setq org-table-colgroup-info nil)
(if (memq nil
(mapcar
(lambda (x) (or (string-match "^[ \t]*|-" x)
- (string-match "^[ \t]*| *\\([#!$*_^ /]\\) *|" x)))
+ (string-match
+ (if maybe-quoted
+ "^[ \t]*| *\\\\?\\([\#!$*_^ /]\\) *|"
+ "^[ \t]*| *\\([\#!$*_^ /]\\) *|")
+ x)))
lines))
(progn
(setq org-table-clean-did-remove-column nil)
(catch 'exit
(let (r b)
(while (string-match org-maybe-keyword-time-regexp s)
- (if (and (match-end 1) (equal (match-string 1 s) org-clock-string))
- ;; never export CLOCK
- (throw 'exit ""))
(or b (setq b (substring s 0 (match-beginning 0))))
- (if (not org-export-with-timestamps)
- (setq r (concat r (substring s 0 (match-beginning 0)))
- s (substring s (match-end 0)))
- (setq r (concat
- r (substring s 0 (match-beginning 0))
- (if (match-end 1)
- (format "@<span class=\"timestamp-kwd\">%s @</span>"
- (match-string 1 s)))
- (format " @<span class=\"timestamp\">%s@</span>"
- (substring
- (org-translate-time (match-string 3 s)) 1 -1)))
- s (substring s (match-end 0)))))
+ (setq r (concat
+ r (substring s 0 (match-beginning 0))
+ (if (match-end 1)
+ (format "@<span class=\"timestamp-kwd\">%s @</span>"
+ (match-string 1 s)))
+ (format " @<span class=\"timestamp\">%s@</span>"
+ (substring
+ (org-translate-time (match-string 3 s)) 1 -1)))
+ s (substring s (match-end 0))))
;; Line break if line started and ended with time stamp stuff
(if (not r)
s
;;
;; Emacs Lisp Archive Entry
;; Filename: org-export-latex.el
-;; Version: 6.16
+;; Version: 6.19a
;; Author: Bastien Guerry <bzg AT altern DOT org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: org, wp, tex
(defvar org-export-latex-add-level 0)
(defvar org-export-latex-sectioning "")
(defvar org-export-latex-sectioning-depth 0)
-(defvar org-export-latex-special-string-regexps
- '(org-ts-regexp
- org-scheduled-string
- org-deadline-string
- org-clock-string)
- "A list of regexps to convert as special keywords.")
+(defvar org-export-latex-special-keyword-regexp
+ (concat "\\<\\(" org-scheduled-string "\\|"
+ org-deadline-string "\\|"
+ org-closed-string"\\)")
+ "Regexp matching special time planning keywords plus the time after it.")
(defvar latexp) ; dynamically scoped from org.el
(defvar re-quote) ; dynamically scoped from org.el
(symbol :tag "Convert as descriptive list" description)
(string :tag "Use a section string" :value "\\subparagraph{%s}")))
+(defcustom org-export-latex-list-parameters
+ '(:cbon "\\texttt{[ ]}" :cboff "\\texttt{[ ]}")
+ "Parameters for the LaTeX list exporter.
+These parameters will be passed on to `org-list-to-latex', which in turn
+will pass them (combined with the LaTeX default list parameters) to
+`org-list-to-generic'."
+ :group 'org-export-latex
+ :type 'plist)
+
(defcustom org-export-latex-remove-from-headlines
- '(:todo t :priority t :tags t)
- "A plist of keywords to remove from headlines.
+ '(:todo nil :priority nil :tags nil)
+ "A plist of keywords to remove from headlines. OBSOLETE.
Non-nil means remove this keyword type from the headline.
-Don't remove the keys, just change their values."
+Don't remove the keys, just change their values.
+
+Obsolete, this variable is no longer used. Use the separate
+variables `org-export-with-todo-keywords', `org-export-with-priority',
+and `org-export-with-tags' instead."
:type 'plist
:group 'org-export-latex)
:group 'org-export-latex
:type 'string)
+(defcustom org-export-latex-inline-image-extensions
+ '("pdf" "jpeg" "jpg" "png")
+ "Extensions of image files that can be inlined into LaTeX.
+Note that this depends on the way the LaTeX file is processed.
+The default setting (pdf and jpg) assumes that pdflatex is doing the
+processing. If you are using latex and dvips or something similar,
+only postscript files can be included."
+ :group 'org-export-html
+ :type '(repeat (string :tag "Extension")))
+
(defcustom org-export-latex-coding-system nil
"Coding system for the exported LaTex file."
:group 'org-export-latex
:comments nil
:tags (plist-get opt-plist :tags)
:priority (plist-get opt-plist :priority)
+ :footnotes (plist-get opt-plist :footnotes)
+ :timestamps (plist-get opt-plist :timestamps)
:todo-keywords (plist-get opt-plist :todo-keywords)
:add-text (if (eq to-buffer 'string) nil text)
:skip-before-1st-heading skip
(org-combine-plists (org-default-export-plist) ext-plist
(org-infile-export-plist))
org-export-latex-class
- (save-excursion
- (goto-char (point-min))
- (if (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
- (assoc (match-string 1) org-export-latex-classes))
- (match-string 1)
- org-export-latex-default-class))
+ (or (and (org-region-active-p)
+ (save-excursion
+ (goto-char (region-beginning))
+ (and (looking-at org-complex-heading-regexp)
+ (org-entry-get nil "LaTeX_CLASS" 'selective))))
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
+ (match-string 1))))
+ org-export-latex-default-class)
+ org-export-latex-class
+ (or (car (assoc org-export-latex-class org-export-latex-classes))
+ (error "No definition for class `%s' in `org-export-latex-classes'"
+ org-export-latex-class))
org-export-latex-header
(cadr (assoc org-export-latex-class org-export-latex-classes))
org-export-latex-sectioning
(unless (memq 'links exclude-list)
(org-export-latex-links))
(unless (memq 'keywords exclude-list)
- (org-export-latex-keywords
- (plist-get org-export-latex-options-plist :timestamps)))
+ (org-export-latex-keywords))
(unless (memq 'lists exclude-list)
(org-export-latex-lists))
(unless (memq 'tables exclude-list)
(match-end 0) '(org-protected t)))
(buffer-string))))
-(defun org-export-latex-keywords-maybe (remove-list)
+(defun org-export-latex-keywords-maybe (&optional remove-list)
"Maybe remove keywords depending on rules in REMOVE-LIST."
(goto-char (point-min))
(let ((re-todo (mapconcat 'identity org-export-latex-todo-keywords-1 "\\|"))
(when (re-search-forward (concat "^\\(" re-todo "\\)") nil t)
(if (plist-get remove-list :todo)
(replace-match "")
- (replace-match (format "\\texttt{%s}" (match-string 1)) t t)))
+ (replace-match (format "\\textbf{%s}" (match-string 1)) t t)))
;; convert priority string
(when (re-search-forward "\\[\\\\#.\\]" nil t)
(if (plist-get remove-list :priority)
(replace-match "")
- (replace-match (format "\\texttt{%s}" (match-string 0)) t t)))
+ (replace-match (format "\\textbf{%s}" (match-string 0)) t t)))
;; convert tags
(when (re-search-forward "\\(:[a-zA-Z0-9_@]+\\)+:" nil t)
(if (or (not org-export-with-tags)
(replace-match "")
(replace-match
(org-export-latex-protect-string
- (format "\\texttt{%s}"
+ (format "\\textbf{%s}"
(save-match-data
(replace-regexp-in-string
"_" "\\\\_" (match-string 0)))))
(goto-char (point-min))
(when (plist-get org-export-latex-options-plist :emphasize)
(org-export-latex-fontify))
- (org-export-latex-keywords-maybe
- org-export-latex-remove-from-headlines)
+ (org-export-latex-keywords-maybe)
(org-export-latex-special-chars
(plist-get org-export-latex-options-plist :sub-superscript))
(org-export-latex-links)
-; (org-trim (buffer-substring-no-properties (point-min) (point-max)))))
(org-trim (buffer-string))))
(defun org-export-latex-quotation-marks ()
(while (re-search-forward (car l) nil t)
(let ((rpl (concat (match-string 1) (cadr l))))
(org-export-latex-protect-string rpl)
- (org-if-unprotected
+ (org-if-unprotected-1
(replace-match rpl t t))))) quote-rpl)))
(defun org-export-latex-special-chars (sub-superscript)
(goto-char (point-min))
(while (re-search-forward c nil t)
;; Put the point where to check for org-protected
-; (unless (or (get-text-property (match-beginning 2) 'org-protected);
-; (org-at-table-p))
(unless (get-text-property (match-beginning 2) 'org-protected)
(cond ((member (match-string 2) '("\\$" "$"))
(if (equal (match-string 2) "\\$")
- (replace-match (concat (match-string 1) "$"
- (match-string 3)) t t)
- (replace-match (concat (match-string 1) "\\$"
- (match-string 3)) t t)))
+ nil
+ (replace-match "\\$" t t)))
((member (match-string 2) '("&" "%" "#"))
(if (equal (match-string 1) "\\")
(replace-match (match-string 2) t t)
(org-export-latex-protect-string
(concat (match-string 1) "\\~{}")) t t))))
((member (match-string 2) '("{" "}"))
- (unless (save-match-data (org-inside-LaTeX-fragment-p))
+ (unless (save-match-data (org-inside-latex-math-p))
(if (equal (match-string 1) "\\")
(replace-match (match-string 2) t t)
(replace-match (concat (match-string 1) "\\"
(match-string 2)) t t)))))
- (unless (save-match-data (org-inside-LaTeX-fragment-p))
+ (unless (save-match-data (org-inside-latex-math-p))
(cond ((equal (match-string 2) "\\")
(replace-match (or (save-match-data
(org-export-latex-treat-backslash-char
(match-string 2)
(match-string 1)
(match-string 3))) "") t t)))))))
- '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
+ '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
+ "\\(\\(\\\\?\\$\\)\\)"
"\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)"
"\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)"
"\\(.\\|^\\)\\(&\\)"
;; (?\> . "\\textgreater{}")
)))
+(defun org-inside-latex-math-p ()
+ (get-text-property (point) 'org-latex-math))
+
(defun org-export-latex-treat-sub-super-char
(subsup char string-before string-after)
"Convert the \"_\" and \"^\" characters to LaTeX.
(string-match "\\S-+" string-after))
(cond ((eq 'org-link (get-text-property 0 'face char))
(concat string-before "\\" char string-after))
- ((save-match-data (org-inside-LaTeX-fragment-p))
+ ((save-match-data (org-inside-latex-math-p))
(if subsup
(cond ((eq 1 (length string-after))
(concat string-before char string-after))
(t (org-export-latex-protect-string
(concat string-before "\\textbackslash{}" string-after)))))
-(defun org-export-latex-keywords (timestamps)
- "Convert special keywords to LaTeX.
-Regexps are those from `org-export-latex-special-string-regexps'.
-If TIMESTAMPS, convert timestamps, otherwise delete them."
- (let ((rg org-export-latex-special-string-regexps) r)
- (while (setq r (pop rg))
- (goto-char (point-min))
- (while (re-search-forward (eval r) nil t)
- (if (not timestamps)
- (replace-match (format "\\\\texttt{%s}" (match-string 0)) t)
- (replace-match ""))))))
+(defun org-export-latex-keywords ()
+ "Convert special keywords to LaTeX."
+ (goto-char (point-min))
+ (let ((re (concat org-export-latex-special-keyword-regexp
+ ".*" ; including the time stamp....
+ )))
+ (while (re-search-forward re nil t)
+ (replace-match (format "\\\\texttt{%s}" (match-string 0)) t))))
(defun org-export-latex-fixed-width (opt)
"When OPT is non-nil convert fixed-width sections to LaTeX."
(goto-char (point-min))
- (while (re-search-forward "^[ \t]*:" nil t)
+ (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t)
(if opt
(progn (goto-char (match-beginning 0))
(insert "\\begin{verbatim}\n")
- (while (looking-at "^\\([ \t]*\\):\\(.*\\)$")
+ (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
(replace-match (concat (match-string 1)
(match-string 2)) t t)
(forward-line))
(insert "\\end{verbatim}\n\n"))
(progn (goto-char (match-beginning 0))
- (while (looking-at "^\\([ \t]*\\):\\(.*\\)$")
+ (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
(replace-match (concat "%" (match-string 1)
(match-string 2)) t t)
(forward-line))))))
(setq lines (split-string raw-table "\n" t))
(apply 'delete-region (list beg end))
(when org-export-table-remove-special-lines
- (setq lines (org-table-clean-before-export lines)))
+ (setq lines (org-table-clean-before-export lines 'maybe-quoted)))
;; make a formatting string to reflect aligment
(setq olines lines)
(while (and (not line-fmt) (setq line (pop olines)))
;; The match goes one char after the *string*
(let ((emph (assoc (match-string 3)
org-export-latex-emphasis-alist))
+ (beg (match-beginning 0))
+ (end (match-end 0))
rpl)
- (unless (get-text-property (1- (point)) 'org-protected)
+ (unless (or (get-text-property (1- (point)) 'org-protected)
+ (save-excursion
+ (goto-char (match-beginning 1))
+ (save-match-data
+ (and (org-at-table-p)
+ (string-match
+ "[|\n]" (buffer-substring beg end))))))
(setq rpl (concat (match-string 1)
(format (org-export-latex-protect-char-in-string
'("\\" "{" "}") (cadr emph))
;; or send some warnings.
"Convert links to LaTeX."
(goto-char (point-min))
- (while (re-search-forward org-bracket-link-analytic-regexp nil t)
+ (while (re-search-forward org-bracket-link-analytic-regexp++ nil t)
(org-if-unprotected
(goto-char (match-beginning 0))
(let* ((re-radio org-export-latex-all-targets-re)
(if (or (file-name-absolute-p raw-path)
(string-match "^\\.\\.?/" raw-path))
"file")))
+ (coderefp (equal type "coderef"))
(caption (org-find-text-property-in-string 'org-caption raw-path))
(attr (org-find-text-property-in-string 'org-attributes raw-path))
(label (org-find-text-property-in-string 'org-label raw-path))
imgp radiop
;; define the path of the link
(path (cond
+ ((member type '("coderef"))
+ raw-path)
((member type '("http" "https" "ftp"))
(concat type ":" raw-path))
((and re-radio (string-match re-radio raw-path))
((equal type "mailto")
(concat type ":" raw-path))
((equal type "file")
- (if (and (or (org-file-image-p (expand-file-name raw-path))
- (string-match "\\.\\(pdf\\|jpg\\|ps\\|eps\\)$"
- raw-path))
+ (if (and (org-file-image-p
+ (expand-file-name
+ raw-path)
+ org-export-latex-inline-image-extensions)
(equal desc full-raw-path))
(setq imgp t)
(progn (when (string-match "\\(.+\\)::.+" raw-path)
(if floatp "\\begin{figure}[htb]\n")
(format "\\centerline{\\includegraphics[%s]{%s}}\n"
(or attr org-export-latex-image-default-option)
- (expand-file-name raw-path))
+ (if (file-name-absolute-p raw-path)
+ (expand-file-name raw-path)
+ raw-path))
(if floatp
(format "\\caption{%s%s}\n"
(if label (concat "\\label{" label "}") "")
(or caption "")))
(if floatp "\\end{figure}\n"))))
+ (coderefp
+ (insert (format
+ (org-export-get-coderef-format path desc)
+ (cdr (assoc path org-export-code-refs)))))
(radiop (insert (format "\\hyperref[%s]{%s}"
(org-solidify-link-text raw-path) desc)))
((not type)
;; Preserve latex environments
(goto-char (point-min))
- (while (re-search-forward "^[ \t]*\\begin{\\([a-zA-Z]+\\)}" nil t)
+ (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\)}" nil t)
(let* ((start (progn (beginning-of-line) (point)))
(end (or (and (re-search-forward
- (concat "^[ \t]*\\end{" (match-string 1) "}" nil t)
- (point-at-eol)))
+ (concat "^[ \t]*\\\\end{" (match-string 1) "}") nil t)
+ (point-at-eol))
(point-max))))
(add-text-properties start end '(org-protected t))))
+ ;; Preserve math snippets
+
+ (let* ((matchers (plist-get org-format-latex-options :matchers))
+ (re-list org-latex-regexps)
+ beg end re e m n block off)
+ ;; Check the different regular expressions
+ (while (setq e (pop re-list))
+ (setq m (car e) re (nth 1 e) n (nth 2 e)
+ block (if (nth 3 e) "\n\n" ""))
+ (setq off (if (member m '("$" "$1")) 1 0))
+ (when (and (member m matchers) (not (equal m "begin")))
+ (goto-char (point-min))
+ (while (re-search-forward re nil t)
+ (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0))
+ (add-text-properties beg end '(org-protected t org-latex-math t))))))
+
;; Convert LaTeX to \LaTeX{}
(goto-char (point-min))
(let ((case-fold-search nil) rpl)
(while (re-search-forward "\\([^+_]\\)LaTeX" nil t)
- (replace-match (org-export-latex-protect-string
- (concat (match-string 1) "\\LaTeX{}")) t t)))
+ (org-if-unprotected
+ (replace-match (org-export-latex-protect-string
+ (concat (match-string 1) "\\LaTeX{}")) t t))))
;; Convert blockquotes
(goto-char (point-min))
;; Convert horizontal rules
(goto-char (point-min))
(while (re-search-forward "^----+.$" nil t)
- (replace-match (org-export-latex-protect-string "\\hrule") t t))
+ (org-if-unprotected
+ (replace-match (org-export-latex-protect-string "\\hrule") t t)))
;; Protect LaTeX commands like \command[...]{...} or \command{...}
(goto-char (point-min))
(while (re-search-forward
(concat "<<<?" org-export-latex-all-targets-re
">>>?\\((INVISIBLE)\\)?") nil t)
- (replace-match
- (org-export-latex-protect-string
- (format "\\label{%s}%s" (save-match-data (org-solidify-link-text
- (match-string 1)))
- (if (match-string 2) "" (match-string 1)))) t t))
+ (org-if-unprotected
+ (replace-match
+ (org-export-latex-protect-string
+ (format "\\label{%s}%s" (save-match-data (org-solidify-link-text
+ (match-string 1)))
+ (if (match-string 2) "" (match-string 1)))) t t)))
;; Delete @<...> constructs
;; Thanks to Daniel Clemente for this regexp
(goto-char (point-min))
(while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t)
- (replace-match ""))
+ (org-if-unprotected
+ (replace-match "")))
;; When converting to LaTeX, replace footnotes
;; FIXME: don't protect footnotes from conversion
(when (plist-get org-export-latex-options-plist :footnotes)
(goto-char (point-min))
- (while (re-search-forward "\\[[0-9]+\\]" nil t)
- (when (save-match-data
- (save-excursion (beginning-of-line)
- (looking-at "[^:|#]")))
- (let ((foot-beg (match-beginning 0))
- (foot-end (match-end 0))
- (foot-prefix (match-string 0))
- footnote footnote-rpl)
- (save-excursion
- (when (search-forward foot-prefix nil t)
- (replace-match "")
- (let ((end (save-excursion
- (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
- (match-beginning 0) (point-max)))))
- (setq footnote (concat (org-trim (buffer-substring (point) end))
- " ")) ; prevent last } being part of a link
- (delete-region (point) end))
- (goto-char foot-beg)
- (delete-region foot-beg foot-end)
- (unless (null footnote)
- (setq footnote-rpl (format "\\footnote{%s}" footnote))
- (add-text-properties 0 10 '(org-protected t) footnote-rpl)
- (add-text-properties (1- (length footnote-rpl))
- (length footnote-rpl)
- '(org-protected t) footnote-rpl)
- (insert footnote-rpl)))))))
-
- ;; Replace footnote section tag for LaTeX
+ (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t)
+ (org-if-unprotected
+ (when (save-match-data
+ (save-excursion (beginning-of-line)
+ (looking-at "[^:|#]")))
+ (let ((foot-beg (match-beginning 0))
+ (foot-end (match-end 0))
+ (foot-prefix (match-string 0))
+ footnote footnote-rpl)
+ (save-excursion
+ (if (not (re-search-forward (concat "^" (regexp-quote foot-prefix))
+ nil t))
+ (replace-match "$^{\\1}$")
+ (replace-match "")
+ (let ((end (save-excursion
+ (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
+ (match-beginning 0) (point-max)))))
+ (setq footnote (concat (org-trim (buffer-substring (point) end))
+ " ")) ; prevent last } being part of a link
+ (delete-region (point) end))
+ (goto-char foot-beg)
+ (delete-region foot-beg foot-end)
+ (unless (null footnote)
+ (setq footnote-rpl (format "\\footnote{%s}" footnote))
+ (add-text-properties 0 10 '(org-protected t) footnote-rpl)
+ (add-text-properties (1- (length footnote-rpl))
+ (length footnote-rpl)
+ '(org-protected t) footnote-rpl)
+ (insert footnote-rpl)))
+ )))))
+
+ ;; Remove footnote section tag for LaTeX
(goto-char (point-min))
(while (re-search-forward
(concat "^" footnote-section-tag-regexp) nil t)
- (replace-match ""))))
+ (org-if-unprotected
+ (replace-match "")))))
;;; List handling:
(defun org-export-latex-lists ()
- "Replace plain text lists in current buffer into LaTeX lists."
- "Convert lists to LaTeX."
+ "Convert plain text lists in current buffer into LaTeX lists."
(goto-char (point-min))
(while (re-search-forward org-list-beginning-re nil t)
(org-if-unprotected
(beginning-of-line)
- (insert (org-list-to-latex (org-list-parse-list t)) "\n"))))
+ (insert (org-list-to-latex (org-list-parse-list t)
+ org-export-latex-list-parameters))
+ "\n")))
(defconst org-latex-entities
'("\\!"
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
"Face for links."
:group 'org-faces)
+(defface org-footnote
+ '((((class color) (background light)) (:foreground "Purple" :underline t))
+ (((class color) (background dark)) (:foreground "Cyan" :underline t))
+ (t (:underline t)))
+ "Face for links."
+ :group 'org-faces)
+
(defface org-ellipsis
'((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
(((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
:group 'org-faces
:version "22.1")
+(defface org-clock-overlay ;; copied from secondary-selection
+ (org-compatible-face nil
+ '((((class color) (min-colors 88) (background light))
+ :background "yellow1")
+ (((class color) (min-colors 88) (background dark))
+ :background "SkyBlue4")
+ (((class color) (min-colors 16) (background light))
+ :background "yellow")
+ (((class color) (min-colors 16) (background dark))
+ :background "SkyBlue4")
+ (((class color) (min-colors 8))
+ :background "cyan" :foreground "black")
+ (t :inverse-video t)))
+ "Basic face for displaying the secondary selection."
+ :group 'org-faces)
+
(defface org-agenda-structure ;; originally copied from font-lock-function-name-face
(org-compatible-face nil
'((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
--- /dev/null
+;;; org-footnote.el --- Footnote support in Org and elsewhere
+;;
+;; Copyright (C) 2009 Free Software Foundation, Inc.
+;;
+;; Author: Carsten Dominik <carsten at orgmode dot org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 6.19a
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file contains the code dealing with footnotes in Org-mode.
+;; The code can also be used in arbitrary text modes to provide
+;; footnotes. Compared to Steven L Baur's footnote.el it provides
+;; better support for resuming editing. It is less configurable than
+;; Steve's code, though.
+
+;;; Code:
+
+(eval-when-compile
+ (require 'cl))
+(require 'org-macs)
+(require 'org-compat)
+
+(declare-function org-in-regexp "org" (re &optional nlines visually))
+(declare-function org-mark-ring-push "org" (&optional pos buffer))
+(declare-function outline-next-heading "outline")
+(declare-function org-trim "org" (s))
+(declare-function org-show-context "org" (&optional key))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
+
+(defconst org-footnote-re
+ (concat "[^][\n]" ; to make sure it is not at the beginning of a line
+ "\\["
+ "\\(?:"
+ "\\([0-9]+\\)"
+ "\\|"
+ (org-re "\\(fn:\\([-_[:word:]]+?\\)?\\)\\(?::\\([^\]]*?\\)\\)?")
+ "\\)"
+ "\\]")
+ "Regular expression for matching footnotes.")
+
+(defconst org-footnote-definition-re
+ (org-re "^\\(\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]\\)")
+ "Regular expression matching the definition of a footnote.")
+
+(defcustom org-footnote-section "Footnotes"
+ "Outline heading containing footnote definitions before export.
+This can be nil, to place footnotes locally at the end of the current
+outline node. If can also be the name of a special outline heading
+under which footnotes should be put.
+This variable defines the place where Org puts the definition
+automatically, i.e. when creating the footnote, and when sorting the notes.
+However, by hand you may place definitions *anywhere*.
+If this is a string, during export, all subtrees starting with this
+heading will be removed after extracting footnote definitions."
+ :group 'org-footnotes
+ :type '(choice
+ (string :tag "Collect fotnotes under heading")
+ (const :tag "Define footnotes locally" nil)))
+
+(defcustom org-footnote-tag-for-non-org-mode-files "Footnotes:"
+ "Tag marking the beginning of footnote section.
+The Org-mode footnote engine can be used in arbitrary text files as well
+as in Org-mode. Outside Org-mode, new footnotes are always placed at
+the end of the file. When you normalize the notes, any line containing
+only this tag will be removed, a new one will be inserted at the end
+of the file, followed by the collected and normalized footnotes."
+ :group 'org-footnotes
+ :type 'string)
+
+(defcustom org-footnote-define-inline nil
+ "Non-nil means, define footnotes inline, at reference location.
+When nil, footnotes will be defined in a special section near
+the end of the document. When t, the [fn:label:definition] notation
+will be used to define the footnote at the reference position."
+ :group 'org-footnote
+ :type 'boolean)
+
+(defcustom org-footnote-auto-label t
+ "Non-nil means, define automatically new labels for footnotes.
+Possible values are:
+
+nil prompt the user for each label
+t create unique labels of the form [fn:1], [fn:2], ...
+confirm like t, but let the user edit the created value. In particular,
+ the label can be removed from the minibuffer, to create
+ an anonymous footnote.
+plain Automatically create plain number labels like [1]"
+ :group 'org-footnote
+ :type '(choice
+ (const :tag "Frompt for label" nil)
+ (const :tag "Create automatic [fn:N]" t)
+ (const :tag "Offer automatic [fn:N] for editing" confirm)
+ (const :tag "Create automatic [N]" plain)))
+
+(defcustom org-footnote-fill-after-inline-note-extraction nil
+ "Non-nil means, fill paragraphs after extracting footnotes.
+When extracting inline footnotes, the lengths of lines can change a lot.
+When this option is set, paragraphs from which an inline footnote has been
+extracted will be filled again."
+ :group 'org-footnote
+ :type 'boolean)
+
+(defun org-footnote-at-reference-p ()
+ "Is the cursor at a footnote reference?
+If yes, return the beginning position, the label, and the definition, if local."
+ (when (org-in-regexp org-footnote-re 15)
+ (list (match-beginning 0)
+ (or (match-string 1)
+ (if (equal (match-string 2) "fn:") nil (match-string 2)))
+ (match-string 4))))
+
+(defun org-footnote-at-definition-p ()
+ "Is the cursor at a footnote definition.
+This matches only pure definitions like [1] or [fn:name] at the beginning
+of a line. It does not a references like [fn:name:definition], where the
+footnote text is included and defined locally.
+The return value will be nil if not at a foornote definition, and a list
+with start and label of the footnote if there is a definition at point."
+ (save-excursion
+ (end-of-line 1)
+ (let ((lim (save-excursion (re-search-backward "^\\*+ \\|^[ \t]*$" nil t))))
+ (when (re-search-backward org-footnote-definition-re lim t)
+ (list (match-beginning 0) (match-string 2))))))
+
+(defun org-footnote-goto-definition (label)
+ "Find the definition of the footnote with label LABEL."
+ (interactive "sLabel: ")
+ (org-mark-ring-push)
+ (setq label (org-footnote-normalize-label label))
+ (let ((re (format "^\\[%s\\]\\|.\\[%s:" label label))
+ pos)
+ (save-excursion
+ (setq pos (or (re-search-forward re nil t)
+ (and (goto-char (point-min))
+ (re-search-forward re nil t))
+ (and (progn (widen) t)
+ (goto-char (point-min))
+ (re-search-forward re nil t)))))
+ (if (not pos)
+ (error "Cannot find definition of footnote %s" label)
+ (goto-char pos)
+ (org-show-context 'link-search)
+ (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))))
+
+(defun org-footnote-goto-next-reference (label)
+ "Find the definition of the footnote with label LABEL."
+ (interactive "sLabel: ")
+ (org-mark-ring-push)
+ (setq label (org-footnote-normalize-label label))
+ (let ((re (format ".\\[%s[]:]" label))
+ (p0 (point)) pos)
+ (save-excursion
+ (setq pos (or (re-search-forward re nil t)
+ (and (goto-char (point-min))
+ (re-search-forward re nil t))
+ (and (progn (widen) t)
+ (goto-char p0)
+ (re-search-forward re nil t))
+ (and (goto-char (point-min))
+ (re-search-forward re nil t)))))
+ (if pos
+ (progn
+ (goto-char pos)
+ (org-show-context 'link-search))
+ (error "Cannot find reference of footnote %s" label))))
+
+(defun org-footnote-normalize-label (label)
+ (if (numberp label) (setq label (number-to-string label)))
+ (if (not (string-match "^[0-9]+$\\|^$\\|^fn:" label))
+ (setq label (concat "fn:" label)))
+ label)
+
+(defun org-footnote-all-labels ()
+ "Return list with all defined foot labels used in the buffer."
+ (let (rtn l)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (while (re-search-forward org-footnote-definition-re nil t)
+ (setq l (org-match-string-no-properties 2))
+ (and l (add-to-list 'rtn l)))
+ (goto-char (point-min))
+ (while (re-search-forward org-footnote-re nil t)
+ (setq l (or (org-match-string-no-properties 1)
+ (org-match-string-no-properties 2)))
+ (and l (not (equal l "fn:")) (add-to-list 'rtn l)))))
+ rtn))
+
+(defun org-footnote-unique-label (&optional current)
+ "Return a new unique footnote label.
+The returns the firsts fn:N labels that is currently not used."
+ (unless current (setq current (org-footnote-all-labels)))
+ (let ((fmt (if (eq org-footnote-auto-label 'plain) "%d" "fn:%d"))
+ (cnt 1))
+ (while (member (format fmt cnt) current)
+ (incf cnt))
+ (format fmt cnt)))
+
+(defvar org-footnote-label-history nil
+ "History of footnote labels entered in current buffer.")
+(make-variable-buffer-local 'org-footnote-label-history)
+
+(defun org-footnote-new ()
+ "Insert a new footnote.
+This command prompts for a label. If this is a label referencing an
+existing label, only insert the label. If the footnote label is empty
+or new, let the user edit the definition of the footnote."
+ (interactive)
+ (let* ((labels (org-footnote-all-labels))
+ (propose (org-footnote-unique-label labels))
+ (label
+ (if (member org-footnote-auto-label '(t plain))
+ propose
+ (completing-read
+ "Label (leave empty for anonymous): "
+ (mapcar 'list labels) nil nil
+ (if (eq org-footnote-auto-label 'confirm) propose nil)
+ 'org-footnote-label-history))))
+ (setq label (org-footnote-normalize-label label))
+ (cond
+ ((equal label "")
+ (insert "[fn:: ]")
+ (backward-char 1))
+ ((member label labels)
+ (insert "[" label "]")
+ (message "New reference to existing note"))
+ (org-footnote-define-inline
+ (insert "[" label ": ]")
+ (backward-char 1))
+ (t
+ (insert "[" label "]")
+ (org-footnote-create-definition label)))))
+
+(defun org-footnote-create-definition (label)
+ "Start the definition of a footnote with label LABEL."
+ (interactive "sLabel: ")
+ (setq label (org-footnote-normalize-label label))
+ (let (re p)
+ (cond
+ ((org-mode-p)
+ (if (not org-footnote-section)
+ ;; No section, put footnote into the current outline node
+ nil
+ ;; Try to find or make the special node
+ (setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
+ (unless (or (re-search-forward re nil t)
+ (and (progn (widen) t)
+ (re-search-forward re nil t)))
+ (goto-char (point-max))
+ (insert "\n\n* " org-footnote-section "\n")))
+ ;; Now go to the end of this entry and insert there.
+ (org-footnote-goto-local-insertion-point))
+ (t
+ (setq re (concat "^" org-footnote-tag-for-non-org-mode-files "[ \t]*$"))
+ (unless (re-search-forward re nil t)
+ (goto-char (point-max))
+ (skip-chars-backward " \t\r\n")
+ (insert "\n\n")
+ (delete-region (point) (point-max))
+ (insert org-footnote-tag-for-non-org-mode-files "\n"))
+ (goto-char (point-max))
+ (skip-chars-backward " \t\r\n")))
+ (insert "\n\n")
+ (insert "[" label "] ")
+ (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))
+
+;;;###autoload
+(defun org-footnote-action (&optional special)
+ "Do the right thing for footnotes.
+When at a foornote reference, jump to the definition. When at a definition,
+jump to the refernces. When neither at definition or reference,
+create a new footnote, interactively.
+With prefix arg SPECIAL, offer additional commands in a menu."
+ (interactive "P")
+ (let (tmp c)
+ (cond
+ (special
+ (message "Footnotes: [s]ort | convert to [n]umeric | [d]elete")
+ (setq c (read-char-exclusive))
+ (cond
+ ((equal c ?s)
+ (org-footnote-normalize 'sort))
+ ((equal c ?n)
+ (org-footnote-normalize))
+ ((equal c ?d)
+ (org-footnote-delete))
+ (t (error "No such footnote command %c" c))))
+ ((setq tmp (org-footnote-at-reference-p))
+ (if (nth 1 tmp)
+ (org-footnote-goto-definition (nth 1 tmp))
+ (goto-char (match-beginning 4))))
+ ((setq tmp (org-footnote-at-definition-p))
+ (org-footnote-goto-next-reference (nth 1 tmp)))
+ (t (org-footnote-new)))))
+
+;;;###autoload
+(defun org-footnote-normalize (&optional sort-only for-preprocessor)
+ "Collect the footnotes in various formats and normalize them.
+This find the different sorts of footnotes allowed in Org, and
+normalizes them to the usual [N] format that is understood by the
+Org-mode exporters.
+When SORT-ONLY is set, only sort the footnote definitions into the
+referenced sequence."
+ ;; This is based on Paul's function, but rewritten.
+ (let ((count 0) ref def idef ref-table liste beg beg1 marker a before
+ ins-point)
+ (save-excursion
+ ;; Now find footnote references, and extract the definitions
+ (goto-char (point-min))
+ (while (re-search-forward org-footnote-re nil t)
+ (org-if-unprotected
+ (setq def (match-string 4)
+ idef def
+ ref (or (match-string 1) (match-string 2))
+ before (char-to-string (char-after (match-beginning 0))))
+ (if (equal ref "fn:") (setq ref nil))
+ (if (and ref (setq a (assoc ref ref-table)))
+ (progn
+ (setq marker (nth 1 a))
+ (unless (nth 2 a) (setf (caddr a) def)))
+ (setq marker (number-to-string (incf count))))
+ (save-match-data
+ (if def
+ (setq def (org-trim def))
+ (save-excursion
+ (goto-char (point-min))
+ (if (not (re-search-forward (concat "^\\[" (regexp-quote ref)
+ "\\]") nil t))
+ (setq def nil)
+ (setq beg (match-beginning 0))
+ (setq beg1 (match-end 0))
+ (re-search-forward
+ (org-re "^[ \t]*$\\|^\\*+ \\|^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]")
+ nil 'move)
+ (setq def (buffer-substring beg1 (or (match-beginning 0)
+ (point-max))))
+ (goto-char beg)
+ (skip-chars-backward " \t\n\t")
+ (delete-region (1+ (point)) (match-beginning 0))))))
+ (unless sort-only
+ (replace-match (concat before "[" marker "]"))
+ (and idef
+ org-footnote-fill-after-inline-note-extraction
+ (fill-paragraph)))
+ (if (not a) (push (list ref marker def) ref-table))))
+
+ ;; First find and remove the footnote section
+ (goto-char (point-min))
+ (cond
+ ((org-mode-p)
+ (if (and org-footnote-section
+ (re-search-forward
+ (concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
+ "[ \t]*$")
+ nil t))
+ (if (or for-preprocessor (not org-footnote-section))
+ (replace-match "")
+ (org-back-to-heading t)
+ (forward-line 1)
+ (setq ins-point (point))
+ (delete-region (point) (org-end-of-subtree t)))
+ (goto-char (point-max))
+ (unless for-preprocessor
+ (when org-footnote-section
+ (or (bolp) (insert "\n"))
+ (insert "* " org-footnote-section "\n")
+ (setq ins-point (point))))))
+ (t
+ (if (re-search-forward
+ (concat "^"
+ (regexp-quote org-footnote-tag-for-non-org-mode-files)
+ "[ \t]*$")
+ nil t)
+ (replace-match ""))
+ (goto-char (point-max))
+ (skip-chars-backward " \t\n\r")
+ (delete-region (point) (point-max))
+ (insert "\n\n" org-footnote-tag-for-non-org-mode-files "\n")
+ (setq ins-point (point))))
+
+ ;; Insert the footnotes again
+ (goto-char (or ins-point (point-max)))
+ (setq ref-table (reverse ref-table))
+ (when sort-only
+ ;; remove anonymous fotnotes from the list
+ (setq ref-table
+ (delq nil (mapcar
+ (lambda (x) (and (car x)
+ (not (equal (car x) "fn:"))
+ x))
+ ref-table))))
+ ;; Make sure each footnote has a description, or an error message.
+ (setq ref-table
+ (mapcar
+ (lambda (x)
+ (if (not (nth 2 x))
+ (setcar (cddr x)
+ (format "FOOTNOTE DEFINITION NOT FOUND: %s" (car x)))
+ (setcar (cddr x) (org-trim (nth 2 x))))
+ x)
+ ref-table))
+
+ (if (or (not (org-mode-p)) ; not an Org file
+ org-footnote-section ; we do not use a footnote section
+ (not sort-only) ; this is normalization
+ for-preprocessor) ; the is the preprocessor
+ ;; Insert the footnotes together in one place
+ (progn
+ (setq def
+ (mapconcat
+ (lambda (x)
+ (format "[%s] %s" (nth (if sort-only 0 1) x)
+ (org-trim (nth 2 x))))
+ ref-table "\n\n"))
+ (if ref-table (insert "\n" def "\n\n")))
+ ;; Insert each footnote near the first reference
+ ;; Happens only in Org files with no special footnote section,
+ ;; and only when doing sorting
+ (mapc 'org-insert-footnote-reference-near-definition
+ ref-table)))))
+
+(defun org-insert-footnote-reference-near-definition (entry)
+ "Find first reference of footnote ENTRY and insert the definition there.
+ENTRY is (fn-label num-mark definition)."
+ (when (car entry)
+ (let ((pos (point)))
+ (goto-char (point-min))
+ (when (re-search-forward (format ".\\[%s[]:]" (regexp-quote (car entry)))
+ nil t)
+ (org-footnote-goto-local-insertion-point)
+ (insert (format "\n\n[%s] %s" (car entry) (nth 2 entry)))))))
+
+(defun org-footnote-goto-local-insertion-point ()
+ "Find insertion point for footnote, just before next outline heading."
+ (outline-next-heading)
+ (or (bolp) (newline))
+ (beginning-of-line 0)
+ (while (and (not (bobp)) (= (char-after) ?#))
+ (beginning-of-line 0))
+ (if (looking-at "#\\+TBLFM:") (beginning-of-line 2))
+ (end-of-line 1)
+ (skip-chars-backward "\n\r\t "))
+
+(defun org-footnote-delete (&optional label)
+ "Delete the footnote at point.
+This will remove the definition (even multiple definitions if they exist)
+and all references of a footnote label."
+ (catch 'done
+ (let (x label l beg def-re (nref 0) (ndef 0))
+ (unless label
+ (when (setq x (org-footnote-at-reference-p))
+ (setq label (nth 1 x))
+ (when (or (not label) (equal "fn:" label))
+ (delete-region (1+ (match-beginning 0)) (match-end 0))
+ (message "Anonymous footnote removed")
+ (throw 'done t)))
+ (when (and (not label) (setq x (org-footnote-at-definition-p)))
+ (setq label (nth 1 x)))
+ (unless label (error "Don't know which footnote to remove")))
+ (save-excursion
+ (save-restriction
+ (goto-char (point-min))
+ (while (re-search-forward org-footnote-re nil t)
+ (setq l (or (match-string 1) (match-string 2)))
+ (when (equal l label)
+ (delete-region (1+ (match-beginning 0)) (match-end 0))
+ (incf nref)))
+ (goto-char (point-min))
+ (setq def-re (concat "^\\[" (regexp-quote label) "\\]"))
+ (while (re-search-forward def-re nil t)
+ (setq beg (match-beginning 0))
+ (if (re-search-forward "^\\[\\|^[ \t]*$\\|^\\*+ " nil t)
+ (goto-char (match-beginning 0))
+ (goto-char (point-max)))
+ (delete-region beg (point))
+ (incf ndef))))
+ (message "%d definition(s) of and %d reference(s) of footnote %s removed"
+ ndef nref label))))
+
+(provide 'org-footnote)
+
+;; arch-tag: 1b5954df-fb5d-4da5-8709-78d944dbfc37
+
+;;; org-footnote.el ends here
;; Tassilo Horn <tassilo at member dot fsf dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(gnus-group-name))
(t "???")))
desc link)
- (unless group (error "Not on a group"))
- (org-store-link-props :type "gnus" :group group)
- (setq desc (org-gnus-group-link group)
- link desc)
- (org-add-link-props :link link :description desc)
- link))
+ (when group
+ (org-store-link-props :type "gnus" :group group)
+ (setq desc (org-gnus-group-link group)
+ link desc)
+ (org-add-link-props :link link :description desc)
+ link)))
((memq major-mode '(gnus-summary-mode gnus-article-mode))
(and (eq major-mode 'gnus-summary-mode) (gnus-summary-show-article))
;;; org-id.el --- Global identifiers for Org-mode entries
+;;
;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
The return value is a cons cell (file-name . position), or nil
if there is no entry with that ID.
With optional argument MARKERP, return the position as a new marker."
+ (cond
+ ((symbolp id) (setq id (symbol-name id)))
+ ((numberp id) (setq id (number-to-string id))))
(let ((file (org-id-find-id-file id))
org-agenda-new-buffers where)
(when file
;; Finding entries with specified id
+;;;###autoload
(defun org-id-find-id-file (id)
"Query the id database for the file in which this ID is located."
(unless org-id-locations (org-id-locations-load))
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;;; org-irc.el --- Store links to IRC sessions
;;
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
;;
;; Author: Philip Jackson <emacs@shellarchive.co.uk>
;; Keywords: erc, irc, link, org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
default (cdr (assoc opt org-infojs-options)))
(and (symbolp default) (not (memq default '(t nil)))
(setq default (plist-get exp-plist default)))
- (if (string-match (format " %s:\\(\\S-+\\)" opt) v)
+ (if (and v (string-match (format " %s:\\(\\S-+\\)" opt) v))
(setq val (match-string 1 v))
(setq val default))
(cond
;; Bastien Guerry <bzg AT altern DOT org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(declare-function org-trim "org" (s))
(declare-function org-get-indentation "org" (&optional line))
(declare-function org-timer-item "org-timer" (&optional arg))
+(declare-function org-combine-plists "org" (&rest plists))
(defgroup org-plain-lists nil
"Options concerning plain lists in Org-mode."
(save-match-data
(and (looking-at "[ \t]*\\(.*?\\) ::")
(match-string 1)))))
+ (empty-line-p (save-excursion
+ (goto-char (match-beginning 0))
+ (and (not (bobp))
+ (or (beginning-of-line 0) t)
+ (save-match-data
+ (looking-at "[ \t]*$")))))
(timerp (and descp
(save-match-data
(string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$"
descp))))
(eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
(match-end 0)))
- (blank (cdr (assq 'plain-list-item org-blank-before-new-entry)))
+ (blank-a (cdr (assq 'plain-list-item org-blank-before-new-entry)))
+ (blank (if (eq blank-a 'auto) empty-line-p blank-a))
pos)
(if descp (setq checkbox nil))
(if timerp
(goto-char end))))
(nextindent (match-string 1))
(item (org-trim item))
- (item (if (string-match "^\\[.+\\]" item)
- (replace-match "\\\\texttt{\\&}"
- t nil item) item)))
+ (item (if (string-match "^\\[\\([xX ]\\)\\]" item)
+ (replace-match (if (equal (match-string 1 item) " ")
+ "[CBOFF]"
+ "[CBON]")
+ t nil item)
+ item)))
(push item output)
(when (> (length nextindent)
(length indent1))
:istart String to start a list item
:iend String to end a list item
:isep String to separate items
-:lsep String to separate sublists"
+:lsep String to separate sublists
+
+:cboff String to insert for an unchecked checkbox
+:cbon String to insert for a checked checkbox"
(interactive)
(let* ((p params) sublist
(splicep (plist-get p :splice))
(istart (plist-get p :istart))
(iend (plist-get p :iend))
(isep (plist-get p :isep))
- (lsep (plist-get p :lsep)))
+ (lsep (plist-get p :lsep))
+ (cbon (plist-get p :cbon))
+ (cboff (plist-get p :cboff)))
(let ((wrapper
(cond ((eq (car list) 'ordered)
(concat ostart "\n%s" oend "\n"))
(setq term (org-trim (format (concat dtstart "%s" dtend)
(match-string 1 sublist))))
(setq sublist (substring sublist (1+ (length term)))))
+ (if (string-match "\\[CBON\\]" sublist)
+ (setq sublist (replace-match cbon t t sublist)))
+ (if (string-match "\\[CBOFF\\]" sublist)
+ (setq sublist (replace-match cboff t t sublist)))
(setq rtn (concat rtn istart term ddstart
sublist ddend iend isep)))
(t (setq rtn (concat rtn ;; previous list
)))))
(format wrapper rtn))))
-(defun org-list-to-latex (list)
- "Convert LIST into a LaTeX list."
+(defun org-list-to-latex (list &optional params)
+ "Convert LIST into a LaTeX list.
+LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
+with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
- list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
- :ustart "\\begin{itemize}" :uend "\\end{itemize}"
- :dstart "\\begin{description}" :dend "\\end{description}"
- :dtstart "[" :dtend "]"
- :ddstart "" :ddend ""
- :istart "\\item " :iend ""
- :isep "\n" :lsep "\n")))
-
-(defun org-list-to-html (list)
- "Convert LIST into a HTML list."
+ list
+ (org-combine-plists
+ '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
+ :ustart "\\begin{itemize}" :uend "\\end{itemize}"
+ :dstart "\\begin{description}" :dend "\\end{description}"
+ :dtstart "[" :dtend "]"
+ :ddstart "" :ddend ""
+ :istart "\\item " :iend ""
+ :isep "\n" :lsep "\n"
+ :cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}")
+ params)))
+
+(defun org-list-to-html (list &optional params)
+ "Convert LIST into a HTML list.
+LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
+with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
- list '(:splicep nil :ostart "<ol>" :oend "</ol>"
- :ustart "<ul>" :uend "</ul>"
- :dstart "<dl>" :dend "</dl>"
- :dtstart "<dt>" :dtend "</dt>"
- :ddstart "<dd>" :ddend "</dd>"
- :istart "<li>" :iend "</li>"
- :isep "\n" :lsep "\n")))
-
-(defun org-list-to-texinfo (list)
- "Convert LIST into a Texinfo list."
+ list
+ (org-combine-plists
+ '(:splicep nil :ostart "<ol>" :oend "</ol>"
+ :ustart "<ul>" :uend "</ul>"
+ :dstart "<dl>" :dend "</dl>"
+ :dtstart "<dt>" :dtend "</dt>"
+ :ddstart "<dd>" :ddend "</dd>"
+ :istart "<li>" :iend "</li>"
+ :isep "\n" :lsep "\n"
+ :cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
+ params)))
+
+(defun org-list-to-texinfo (list &optional params)
+ "Convert LIST into a Texinfo list.
+LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
+with overruling parameters for `org-list-to-generic'."
(org-list-to-generic
- list '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
- :ustart "@enumerate" :uend "@end enumerate"
- :dstart "@table" :dend "@end table"
- :dtstart "@item " :dtend "\n"
- :ddstart "" :ddend ""
- :istart "@item\n" :iend ""
- :isep "\n" :lsep "\n")))
+ list
+ (org-combine-plists
+ '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
+ :ustart "@enumerate" :uend "@end enumerate"
+ :dstart "@table" :dend "@end table"
+ :dtstart "@item " :dtend "\n"
+ :ddstart "" :ddend ""
+ :istart "@item\n" :iend ""
+ :isep "\n" :lsep "\n"
+ :cbon "@code{[X]}" :cboff "@code{[ ]}")
+ params)))
(provide 'org-list)
;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
-;; Version: 6.16
+;; Version: 6.19a
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(save-match-data
(while (string-match "\\[:alnum:\\]" ss)
(setq ss (replace-match "a-zA-Z0-9" t t ss)))
+ (while (string-match "\\[:word:\\]" ss)
+ (setq ss (replace-match "a-zA-Z0-9" t t ss)))
(while (string-match "\\[:alpha:\\]" ss)
(setq ss (replace-match "a-zA-Z" t t ss)))
ss))
`(unless (get-text-property (point) 'org-protected)
,@body))
+(defmacro org-if-unprotected-1 (&rest body)
+ "Execute BODY if there is no `org-protected' text property at point-1."
+ `(unless (get-text-property (1- (point)) 'org-protected)
+ ,@body))
+
(defmacro org-with-remote-undo (_buffer &rest _body)
"Execute BODY while recording undo information in two buffers."
`(let ((_cline (org-current-line))
;; works also in narrowed buffer, because we start at 1, not point-min
(+ (if (bolp) 1 0) (count-lines 1 (point)))))
+(defsubst org-current-line-string (&optional to-here)
+ (buffer-substring (point-at-bol) (if to-here (point) (point-at-eol))))
+
(defsubst org-pos-in-match-range (pos n)
(and (match-beginning n)
(<= (match-beginning n) pos)
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;; This file is part of GNU Emacs.
;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;;
;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(funcall org-mouse-context-menu-function event)
(if (fboundp 'mouse-menu-major-mode-map)
(popup-menu (mouse-menu-major-mode-map) event prefix)
- (with-no-warnings ; don't warn about fallback, obsolete since 23.1
- (mouse-major-mode-menu event prefix)))))
+ (org-no-warnings ; don't warn about fallback, obsolete since 23.1
+ (mouse-major-mode-menu event prefix)))))
(setq this-command 'mouse-save-then-kill)
(mouse-save-then-kill event)))
-
(defun org-mouse-line-position ()
"Returns `:beginning' or `:middle' or `:end', depending on the point position.
;; Author: Eric Schulte <schulte dot eric at gmail dot com>
;; Keywords: tables, plotting
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(mapcar (lambda (row) (nth ind row)) table)))) 0)
(plist-put params :timeind t)
;; check for text ind column
- (if (> (length
- (delq 0 (mapcar
- (lambda (el)
- (if (string-match org-table-number-regexp el)
- 0 1))
- (mapcar (lambda (row) (nth ind row)) table)))) 0)
+
+ (if (or (string= (plist-get params :with) "hist")
+ (> (length
+ (delq 0 (mapcar
+ (lambda (el)
+ (if (string-match org-table-number-regexp el)
+ 0 1))
+ (mapcar (lambda (row) (nth ind row)) table)))) 0))
(plist-put params :textind t)))))
;; write script
(with-temp-buffer
;; Author: David O'Toole <dto@gnu.org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: hypermedia, outlines, wp
-;; Version: 6.16
+;; Version: 6.19a
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(interactive "P")
(if (not (org-at-table-p))
(error "Not at a table"))
+ (when (eobp) (insert "\n") (backward-char 1))
+ (if (not (string-match "|[ \t]*$" (org-current-line-string)))
+ (org-table-align))
(let ((line (org-table-clean-line
(buffer-substring (point-at-bol) (point-at-eol))))
(col (current-column)))
ref)
(int-to-string (org-table-current-column))))
(dummy (and (or nameass refass) (not named)
- (not (y-or-n-p "Replace field formula with column formula? " ))
+ (not (y-or-n-p "Replace existing field formula with column formula? " ))
(error "Abort")))
(name (or name ref))
(org-table-may-need-update nil)
(if (match-end 1) (push l hlines) (push l dlines))
(beginning-of-line 2)
(setq l (1+ l)))
+ (push 'hline types) ;; add an imaginary extra hline to the end
(setq org-table-current-line-types (apply 'vector (nreverse types))
last-dline (car dlines)
org-table-dlines (apply 'vector (cons nil (nreverse dlines)))
(let* ((l last-dline)
(fields (org-split-string
(buffer-substring (point-at-bol) (point-at-eol))
- "|"))
+ "[ \t]*|[ \t]*"))
(nfields (length fields))
al al2)
(loop for i from 1 to nfields do
(if (and lispp literal) (setq lispp 'literal))
;; Check for old vertical references
(setq form (org-table-rewrite-old-row-references form))
+ ;; Insert remote references
+ (while (string-match "\\<remote([ \t]*\\([-_a-zA-Z0-9]+\\)[ \t]*,[ \t]*\\([^\n)]+\\))" form)
+ (setq form
+ (replace-match
+ (save-match-data
+ (org-table-make-reference
+ (org-table-get-remote-range
+ (match-string 1 form) (match-string 2 form))
+ keep-empty numbers lispp))
+ t t form)))
;; Insert complex ranges
(while (and (string-match org-table-range-regexp form)
(> (length (match-string 0 form)) 1))
(setq f (replace-match (concat "$" (cdr a)) t t f)))
;; Parameters and constants
(setq start 0)
- (while (setq start (string-match "\\$\\([a-zA-Z][_a-zA-Z0-9]*\\)" f start))
- (setq start (1+ start))
- (if (setq a (save-match-data
- (org-table-get-constant (match-string 1 f))))
- (setq f (replace-match
- (concat (if pp "(") a (if pp ")")) t t f))))
+ (while (setq start (string-match "\\$\\([a-zA-Z][_a-zA-Z0-9]*\\)\\|\\(\\<remote([^)]*)\\)" f start))
+ (if (match-end 2)
+ (setq start (match-end 2))
+ (setq start (1+ start))
+ (if (setq a (save-match-data
+ (org-table-get-constant (match-string 1 f))))
+ (setq f (replace-match
+ (concat (if pp "(") a (if pp ")")) t t f)))))
(if org-table-formula-debug
(put-text-property 0 (length f) :orig-formula f1 f))
f))
Works for single references, but also for entire formulas and even the
full TBLFM line."
(let ((start 0))
- (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\)" s start)
+ (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
(cond
((match-end 3)
;; format match, just advance
(params (org-combine-plists params2 params)))
(orgtbl-to-generic table params)))
+(defun org-table-get-remote-range (name-or-id form)
+ "Get a field value or a list of values in a range from table at ID.
+
+NAME-OR-ID may be the name of a table in the current file as set by
+a \"#+TBLNAME:\" directive. The first table following this line
+will then be used. Alternatively, it may be an ID referring to
+any entry, also in a different file. In this case, the first table
+in that netry will be referenced.
+FORM is a field or range descriptor like \"@2$3\" or or \"B3\" or
+\"@I$2..@II$2\". All the references must be absolute, not relative.
+
+The return value is either a single string for a single field, or a
+list of the fields in the rectangle ."
+ (save-match-data
+ (let ((id-loc nil)
+ org-table-column-names org-table-column-name-regexp
+ org-table-local-parameters org-table-named-field-locations
+ org-table-current-line-types org-table-current-begin-line
+ org-table-current-begin-pos org-table-dlines
+ org-table-hlines org-table-last-alignment
+ org-table-last-column-widths org-table-last-alignment
+ org-table-last-column-widths tbeg
+ buffer loc)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward
+ (concat "^#\\+TBLNAME:[ \t]*" (regexp-quote name-or-id) "[ \t]*$")
+ nil t)
+ (setq buffer (current-buffer) loc (match-beginning 0))
+ (setq id-loc (org-id-find name-or-id 'marker)
+ buffer (marker-buffer id-loc)
+ loc (marker-position id-loc))
+ (move-marker id-loc nil)))
+ (switch-to-buffer buffer)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char loc)
+ (forward-char 1)
+ (unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t)
+ (not (match-beginning 1)))
+ (error "Cannot find a table at NAME or ID %s" name-or-id))
+ (setq tbeg (point-at-bol))
+ (org-table-get-specials)
+ (setq form (org-table-formula-substitute-names form))
+ (if (and (string-match org-table-range-regexp form)
+ (> (length (match-string 0 form)) 1))
+ (save-match-data
+ (org-table-get-range (match-string 0 form) tbeg 1))
+ form))))))))
+
(provide 'org-table)
;; arch-tag: 4d21cfdd-0268-440a-84b0-09237a0fe0ef
-;;; org-clock.el --- The time clocking code for Org-mode
+;;; org-timer.el --- The relative timer code for Org-mode
;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(defvar org-timer-start-time nil
"t=0 for the running timer.")
+(defvar org-timer-pause-time nil
+ "Time when the timer was paused.")
+
(defconst org-timer-re "\\([-+]?[0-9]+\\):\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)"
"Regular expression used to match timer stamps.")
(-
(time-to-seconds (current-time))
(org-timer-hms-to-secs s)))))
+ (org-timer-set-mode-line 'on)
(message "Timer start time set to %s, current value is %s"
(format-time-string "%T" org-timer-start-time)
(org-timer-secs-to-hms (or delta 0))))))
+(defun org-timer-pause-or-continue (&optional stop)
+ "Pause or continue the relative timer. With prefix arg, stop it entirely."
+ (interactive "P")
+ (cond
+ (stop (org-timer-stop))
+ ((not org-timer-start-time) (error "No timer is running"))
+ (org-timer-pause-time
+ ;; timer is paused, continue
+ (setq org-timer-start-time
+ (seconds-to-time
+ (-
+ (time-to-seconds (current-time))
+ (- (time-to-seconds org-timer-pause-time)
+ (time-to-seconds org-timer-start-time))))
+ org-timer-pause-time nil)
+ (org-timer-set-mode-line 'on)
+ (message "Timer continues at %s" (org-timer-value-string)))
+ (t
+ ;; pause timer
+ (setq org-timer-pause-time (current-time))
+ (org-timer-set-mode-line 'pause)
+ (message "Timer paused at %s" (org-timer-value-string)))))
+
+(defun org-timer-stop ()
+ "Stop the relative timer."
+ (interactive)
+ (setq org-timer-start-time nil
+ org-timer-pause-time nil)
+ (org-timer-set-mode-line 'off))
+
;;;###autoload
(defun org-timer (&optional restart)
"Insert a H:MM:SS string from the timer into the buffer.
(interactive "P")
(if (equal restart '(4)) (org-timer-start))
(or org-timer-start-time (org-timer-start))
- (insert (format
- org-timer-format
- (org-timer-secs-to-hms
- (floor
- (- (time-to-seconds (current-time))
- (time-to-seconds org-timer-start-time)))))))
+ (insert (org-timer-value-string)))
+
+(defun org-timer-value-string ()
+ (format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds)))))
+
+(defun org-timer-seconds ()
+ (- (time-to-seconds (or org-timer-pause-time (current-time)))
+ (time-to-seconds org-timer-start-time)))
;;;###autoload
(defun org-timer-change-times-in-region (beg end delta)
h (/ m 60) m (- m (* 60 h)))
(format "%s%d:%02d:%02d" sign h m s)))
+(defvar org-timer-mode-line-timer nil)
+(defvar org-timer-mode-line-string nil)
+
+(defun org-timer-set-mode-line (value)
+ "Set the mode-line dispay of the relative timer.
+VALUE can be `on', `off', or `pause'."
+ (or global-mode-string (setq global-mode-string '("")))
+ (or (memq 'org-timer-mode-line-string global-mode-string)
+ (setq global-mode-string
+ (append global-mode-string '(org-timer-mode-line-string))))
+ (cond
+ ((equal value 'off)
+ (when org-timer-mode-line-timer
+ (cancel-timer org-timer-mode-line-timer)
+ (setq org-timer-mode-line-timer nil))
+ (setq global-mode-string
+ (delq 'org-timer-mode-line-string global-mode-string))
+ (force-mode-line-update))
+ ((equal value 'pause)
+ (when org-timer-mode-line-timer
+ (cancel-timer org-timer-mode-line-timer)
+ (setq org-timer-mode-line-timer nil)))
+ ((equal value 'on)
+ (or global-mode-string (setq global-mode-string '("")))
+ (or (memq 'org-timer-mode-line-string global-mode-string)
+ (setq global-mode-string
+ (append global-mode-string '(org-timer-mode-line-string))))
+ (org-timer-update-mode-line)
+ (when org-timer-mode-line-timer
+ (cancel-timer org-timer-mode-line-timer))
+ (setq org-timer-mode-line-timer
+ (run-with-timer 1 1 'org-timer-update-mode-line)))))
+
+(defun org-timer-update-mode-line ()
+ "Update the timer time in the mode line."
+ (if org-timer-pause-time
+ nil
+ (setq org-timer-mode-line-string
+ (concat " <" (substring (org-timer-value-string) 0 -1) ">"))
+ (force-mode-line-update)))
+
;; arch-tag: 97538f8c-3871-4509-8f23-1e7b3ff3d107
;;; org-timer.el ends here
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
`org-make-link-string', and insert the transformed test into the kill ring,
so that it can be yanked into an Org-mode buffer with links working correctly."
(interactive)
- (let ((regionp (org-region-active-p))
- transform-start transform-end
- return-content
- link-location link-title
- temp-position out-bound)
- (setq transform-start (if regionp (region-beginning) (point-min))
- transform-end (if regionp (region-end) (point-max)))
+ (let* ((regionp (org-region-active-p))
+ (transform-start (point-min))
+ (transform-end (point-max))
+ return-content
+ link-location link-title
+ temp-position out-bound)
+ (when regionp
+ (setq transform-start (region-beginning))
+ (setq transform-end (region-end))
+ ;; Deactivate mark if current mark is activate.
+ (if (fboundp 'deactivate-mark) (deactivate-mark)))
(message "Transforming links...")
(save-excursion
(goto-char transform-start)
- (while (and (not out-bound) ; still inside region to copy
- (not (org-w3m-no-next-link-p))) ; no next link current buffer
- ;; store current point before jump next anchor
- (setq temp-position (point))
- ;; move to next anchor when current point is not at anchor
- (or (w3m-anchor (point)) (org-w3m-get-next-link-start))
- (if (<= (point) transform-end) ; if point is inside transform bound
- (progn
- ;; get content between two links.
- (if (> (point) temp-position)
- (setq return-content (concat return-content
- (buffer-substring
- temp-position (point)))))
- ;; get link location at current point.
- (setq link-location (w3m-anchor (point)))
- ;; get link title at current point.
- (setq link-title (buffer-substring (point)
- (org-w3m-get-anchor-end)))
- ;; concat `org-mode' style url to `return-content'.
- (setq return-content (concat return-content
- (org-make-link-string
- link-location link-title))))
- (goto-char temp-position) ; reset point before jump next anchor
- (setq out-bound t) ; for break out `while' loop
- ))
+ (while (and (not out-bound) ; still inside region to copy
+ (not (org-w3m-no-next-link-p))) ; no next link current buffer
+ ;; store current point before jump next anchor
+ (setq temp-position (point))
+ ;; move to next anchor when current point is not at anchor
+ (or (w3m-anchor (point)) (org-w3m-get-next-link-start))
+ (if (<= (point) transform-end) ; if point is inside transform bound
+ (progn
+ ;; get content between two links.
+ (if (> (point) temp-position)
+ (setq return-content (concat return-content
+ (buffer-substring
+ temp-position (point)))))
+ ;; get link location at current point.
+ (setq link-location (w3m-anchor (point)))
+ ;; get link title at current point.
+ (setq link-title (buffer-substring (point)
+ (org-w3m-get-anchor-end)))
+ ;; concat `org-mode' style url to `return-content'.
+ (setq return-content (concat return-content
+ (org-make-link-string
+ link-location link-title))))
+ (goto-char temp-position) ; reset point before jump next anchor
+ (setq out-bound t) ; for break out `while' loop
+ ))
;; add the rest until end of the region to be copied
(if (< (point) transform-end)
- (setq return-content
- (concat return-content
- (buffer-substring (point) transform-end))))
+ (setq return-content
+ (concat return-content
+ (buffer-substring (point) transform-end))))
(kill-new return-content)
(message "Transforming links...done, use C-y to insert text into Org-mode file")
(message "Copy with link transformation complete."))))
(defun org-w3m-get-anchor-start ()
- "Move to and return `point' for the start of the current anchor."
+ "Move cursor to the start of current anchor. Return point."
;; get start position of anchor or current point
(goto-char (or (previous-single-property-change (point) 'w3m-anchor-sequence)
- (point))))
+ (point))))
(defun org-w3m-get-anchor-end ()
- "Move and return `point' after the end of current anchor."
+ "Move cursor to the end of current anchor. Return point."
;; get end position of anchor or point
(goto-char (or (next-single-property-change (point) 'w3m-anchor-sequence)
(point))))
(defun org-w3m-get-next-link-start ()
- "Move and return `point' for that start of the current link."
+ "Move cursor to the start of next link. Return point."
(catch 'reach
(while (next-single-property-change (point) 'w3m-anchor-sequence)
;; jump to next anchor
(goto-char (next-single-property-change (point) 'w3m-anchor-sequence))
(when (w3m-anchor (point))
- ;; return point when current is valid link
- (throw 'reach nil))))
+ ;; return point when current is valid link
+ (throw 'reach nil))))
(point))
(defun org-w3m-get-prev-link-start ()
- "Move and return `point' for that end of the current link."
+ "Move cursor to the start of prevoius link. Return point."
(catch 'reach
(while (previous-single-property-change (point) 'w3m-anchor-sequence)
;; jump to previous anchor
(goto-char (previous-single-property-change (point) 'w3m-anchor-sequence))
(when (w3m-anchor (point))
- ;; return point when current is valid link
- (throw 'reach nil))))
+ ;; return point when current is valid link
+ (throw 'reach nil))))
(point))
(defun org-w3m-no-next-link-p ()
- "Return t if no next link after cursor.
-Otherwise, return nil."
+ "Whether there is no next link after the cursor.
+Return t if there is no next link; otherwise, return nil."
(save-excursion
(equal (point) (org-w3m-get-next-link-start))))
(defun org-w3m-no-prev-link-p ()
- "Return t if no previous link after cursor.
-Otherwise, return nil."
+ "Whether there is no previous link after the cursor.
+Return t if there is no previous link; otherwise, return nil."
(save-excursion
(equal (point) (org-w3m-get-prev-link-start))))
(defvar w3m-mode-map)
(defvar w3m-minor-mode-map)
(when (and (boundp 'w3m-mode-map)
- (keymapp w3m-mode-map))
+ (keymapp w3m-mode-map))
(define-key w3m-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode)
(define-key w3m-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode))
(when (and (boundp 'w3m-minor-mode-map)
- (keymapp w3m-minor-mode-map))
+ (keymapp w3m-minor-mode-map))
(define-key w3m-minor-mode-map "\C-c\C-x\M-w" 'org-w3m-copy-for-org-mode)
(define-key w3m-minor-mode-map "\C-c\C-x\C-w" 'org-w3m-copy-for-org-mode))
(add-hook
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.16
+;; Version: 6.19a
;;
;; This file is part of GNU Emacs.
;;
(require 'org-compat)
(require 'org-faces)
(require 'org-list)
+(require 'org-footnote)
;;;; Customization variables
;;; Version
-(defconst org-version "6.16"
+(defconst org-version "6.19a"
"The version number of the file org.el.")
(defun org-version (&optional here)
:group 'org-structure
:type 'boolean)
-(defcustom org-blank-before-new-entry '((heading . nil)
- (plain-list-item . nil))
+(defcustom org-blank-before-new-entry '((heading . auto)
+ (plain-list-item . auto))
"Should `org-insert-heading' leave a blank line before new heading/item?
The value is an alist, with `heading' and `plain-list-item' as car,
and a boolean flag as cdr."
:group 'org-edit-structure
:type '(list
- (cons (const heading) (boolean))
- (cons (const plain-list-item) (boolean))))
+ (cons (const heading)
+ (choice (const :tag "Never" nil)
+ (const :tag "Always" t)
+ (const :tag "Auto" auto)))
+ (cons (const plain-list-item)
+ (choice (const :tag "Never" nil)
+ (const :tag "Always" t)
+ (const :tag "Auto" auto)))))
(defcustom org-insert-heading-hook nil
"Hook being run after inserting a new heading."
(const :tag "from `lang' element")
(const :tag "from `style' element")))))
+(defcustom org-coderef-label-format "(ref:%s)"
+ "The default coderef format.
+This format string will be used to search for coderef labels in literal
+examples (EXAMPLE and SRC blocks). The format can be overwritten
+an individual literal example with the -f option, like
+
+#+BEGIN_SRC pascal +n -r -l \"((%s))\"
+...
+#+END_SRC
+
+If you want to use this for HTML export, make sure that the format does
+not introduce special font-locking, and avoid the HTML special
+characters `<', `>', and `&'. The reason for this restriction is that
+the labels are searched for only after htmlize has done its job."
+ :group 'org-edit-structure ; FIXME this is not in the right group
+ :type 'string)
+
(defcustom org-edit-fixed-width-region-mode 'artist-mode
"The mode that should be used to edit fixed-width regions.
These are the regions where each line starts with a colon."
(const noabbrev)
(const adaptive)))
-(defcustom org-activate-links '(bracket angle plain radio tag date)
+(defcustom org-activate-links '(bracket angle plain radio tag date footnote)
"Types of links that should be activated in Org-mode files.
This is a list of symbols, each leading to the activation of a certain link
type. In principle, it does not hurt to turn on most link types - there may
radio Text that is matched by a radio target, see manual for details.
tag Tag settings in a headline (link to tag search).
date Time stamps (link to calendar).
+footnote Footnote labels.
Changing this variable requires a restart of Emacs to become effective."
:group 'org-link
- :type '(set (const :tag "Double bracket links (new style)" bracket)
+ :type '(set :greedy t
+ (const :tag "Double bracket links (new style)" bracket)
(const :tag "Angular bracket links (old style)" angular)
(const :tag "Plain text links" plain)
(const :tag "Radio target matches" radio)
(const :tag "Tags" tag)
- (const :tag "Timestamps" date)))
+ (const :tag "Timestamps" date)
+ (const :tag "Footnotes" footnote)))
(defcustom org-make-link-description-function nil
"Function to use to generate link descriptions from links. If
(defcustom org-format-latex-options
'(:foreground default :background default :scale 1.0
:html-foreground "Black" :html-background "Transparent" :html-scale 1.0
- :matchers ("begin" "$" "$$" "\\(" "\\["))
+ :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
"Options for creating images from LaTeX fragments.
This is a property list with the following properties:
:foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
:matchers a list indicating which matchers should be used to
find LaTeX fragments. Valid members of this list are:
\"begin\" find environments
+ \"$1\" find single characters surrounded by $.$
\"$\" find math expressions surrounded by $...$
\"$$\" find math expressions surrounded by $$....$$
\"\\(\" find math expressions surrounded by \\(...\\)
:group 'org)
(defcustom org-completion-use-ido nil
- "Non-nil means, use ido completion wherever possible."
+ "Non-nil means, use ido completion wherever possible.
+Note that `ido-mode' must be active for this variable to be relevant.
+If you decide to turn this variable on, you might well want to turn off
+`org-outline-path-complete-in-steps'."
:group 'org-completion
:type 'boolean)
(declare-function iswitchb-read-buffer (prompt &optional default require-match start matches-set))
(defvar iswitchb-temp-buflist)
(declare-function org-gnus-follow-link "org-gnus" (&optional group article))
+(defvar org-agenda-tags-todo-honor-ignore-options)
(declare-function org-agenda-skip "org-agenda" ())
(declare-function org-format-agenda-item "org-agenda"
(extra txt &optional category tags dotime noprefix remove-re))
(declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda"
(beg end))
(declare-function org-agenda-copy-local-variable "org-agenda" (var))
+(declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
+ "org-agenda" (&optional end))
+
(declare-function parse-time-string "parse-time" (string))
(declare-function remember "remember" (&optional initial))
(declare-function remember-buffer-desc "remember" ())
(org-autoload "org-agenda"
'(org-agenda org-agenda-list org-search-view
org-todo-list org-tags-view org-agenda-list-stuck-projects
- org-diary org-agenda-to-appt)))
+ org-diary org-agenda-to-appt
+ org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))
;; Autoload org-remember
(declare-function org-clock-save-markers-for-cut-and-paste "org-clock"
(beg end))
-(declare-function org-update-mode-line "org-clock" ())
+(declare-function org-clock-update-mode-line "org-clock" ())
(defvar org-clock-start-time)
(defvar org-clock-marker (make-marker)
"Marker recording the last clock-in.")
"org-clock"
'(org-clock-in org-clock-out org-clock-cancel
org-clock-goto org-clock-sum org-clock-display
- org-remove-clock-overlays org-clock-report
+ org-clock-remove-overlays org-clock-report
org-clocktable-shift org-dblock-write:clocktable
org-get-clocktable)))
(setq org-clock-start-time
(apply 'encode-time
(org-parse-time-string (match-string 1))))
- (org-update-mode-line)))
+ (org-clock-update-mode-line)))
(t
(and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
(end-of-line 1)
The archived entries will be filed as subtrees of the specified
headline. When the headline is omitted, the subtrees are simply
-filed away at the end of the file, as top-level entries.
+filed away at the end of the file, as top-level entries. Also in
+the heading you can use %s to represent the file name, this can be
+useful when using the same archive for a number of different files.
Here are a few examples:
\"%s_archive::\"
\"~/org/archive.org::\"
Archive in file ~/org/archive.org (absolute path), as top-level trees.
+\"~/org/archive.org::From %s\"
+ Archive in file ~/org/archive.org (absolute path), und headlines
+ \"From FILENAME\" where file name is the current file name.
+
\"basement::** Finished Tasks\"
Archive in file ./basement (relative path), as level 3 trees
below the level 2 heading \"** Finished Tasks\".
("logrepeat" org-log-repeat state)
("lognoterepeat" org-log-repeat note)
("nologrepeat" org-log-repeat nil)
+ ("fninline" org-footnote-define-inline t)
+ ("nofninline" org-footnote-define-inline nil)
+ ("fnlocal" org-footnote-section nil)
+ ("fnauto" org-footnote-auto-label t)
+ ("fnprompt" org-footnote-auto-label nil)
+ ("fnconfirm" org-footnote-auto-label confirm)
+ ("fnplain" org-footnote-auto-label plain)
("constcgs" constants-unit-system cgs)
("constSI" constants-unit-system SI))
"Variable associated with STARTUP options for org-mode.
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
"\\)\\>\\)?[ \t]*\\(.*\\)")
org-complex-heading-regexp
- (concat "^\\(\\*+\\)\\(?:[ \t]+\\("
+ (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
"\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)"
"\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
"Every change indicates that a table might need an update."
(setq org-table-may-need-update t))
(defvar org-mode-map)
-(defvar org-mode-hook nil)
+(defvar org-mode-hook nil
+ "Mode hook for Org-mode, run after the mode was turned on.")
(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
(defvar org-table-buffer-is-an nil)
3: path
4: [desc]
5: desc")
+(defvar org-bracket-link-analytic-regexp++ nil
+ "Like org-bracket-link-analytic-regexp, but include coderef internal type.")
(defvar org-any-link-re nil
"Regular expression matching any link.")
"\\]"
"\\(\\[" "\\([^]]+\\)" "\\]\\)?"
"\\]")
+ org-bracket-link-analytic-regexp++
+ (concat
+ "\\[\\["
+ "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?"
+ "\\([^]]+\\)"
+ "\\]"
+ "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
+ "\\]")
org-any-link-re
(concat "\\(" org-bracket-link-regexp "\\)\\|\\("
org-angle-link-re "\\)\\|\\("
))
t)))
+(defun org-activate-footnote-links (limit)
+ "Run through the buffer and add overlays to links."
+ (if (re-search-forward "\\(^\\|[^][]\\)\\(\\[\\([0-9]+\\]\\|fn:[^ \t\r\n:]+?[]:]\\)\\)"
+ limit t)
+ (progn
+ (add-text-properties (match-beginning 2) (match-end 2)
+ (list 'mouse-face 'highlight
+ 'rear-nonsticky org-nonsticky-props
+ 'keymap org-mouse-map
+ 'help-echo
+ (if (= (point-at-bol) (match-beginning 2))
+ "Footnote definition"
+ "Footnote reference")
+ ))
+ t)))
+
(defun org-activate-bracket-links (limit)
"Run through the buffer and add overlays to bracketed links."
(if (re-search-forward org-bracket-link-regexp limit t)
(if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
(if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
(if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
+ (if (memq 'footnote lk) '(org-activate-footnote-links
+ (2 'org-footnote t)))
'("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
'(org-hide-wide-columns (0 nil append))
;; TODO lines
;;; Inserting headlines
+(defun org-previous-line-empty-p ()
+ (save-excursion
+ (and (not (bobp))
+ (or (beginning-of-line 0) t)
+ (save-match-data
+ (looking-at "[ \t]*$")))))
+
(defun org-insert-heading (&optional force-heading)
"Insert a new heading or item with same depth at point.
If point is in a plain list and FORCE-HEADING is nil, create a new list item.
(if (= (buffer-size) 0)
(insert "\n* ")
(when (or force-heading (not (org-insert-item)))
- (let* ((head (save-excursion
+ (let* ((empty-line-p nil)
+ (head (save-excursion
(condition-case nil
(progn
(org-back-to-heading)
+ (setq empty-line-p (org-previous-line-empty-p))
(match-string 0))
(error "*"))))
- (blank (cdr (assq 'heading org-blank-before-new-entry)))
+ (blank-a (cdr (assq 'heading org-blank-before-new-entry)))
+ (blank (if (eq blank-a 'auto) empty-line-p blank-a))
pos hide-previous previous-pos)
(cond
((and (org-on-heading-p) (bolp)
(org-insert-heading-respect-content
(org-end-of-subtree nil t)
(or (bolp) (newline))
+ (or (org-previous-line-empty-p)
+ (and blank (newline)))
(open-line 1))
((org-on-heading-p)
(when hide-previous
"\\*+[ \t]+\\([^\r\n]*\\)"))
(match-string 1) "")))
+(defun org-heading-components ()
+ "Return the components of the current heading.
+This is a list with the following elements:
+- the level as an integer
+- the reduced level, different if `org-odd-levels-only' is set.
+- the TODO keyword, or nil
+- the priority character, like ?A, or nil if no priority is given
+- the headline text itself, or the tags string if no headline text
+- the tags string, or nil."
+ (save-excursion
+ (org-back-to-heading t)
+ (if (looking-at org-complex-heading-regexp)
+ (list (length (match-string 1))
+ (org-reduced-level (length (match-string 1)))
+ (org-match-string-no-properties 2)
+ (and (match-end 3) (aref (match-string 3) 2))
+ (org-match-string-no-properties 4)
+ (org-match-string-no-properties 5)))))
+
(defun org-insert-heading-after-current ()
"Insert a new heading with same level as current, after current subtree."
(interactive)
((equal (char-after) ?\ ) (forward-char 1))))))
(defun org-reduced-level (l)
+ "Compute the effective level of a heading.
+This takes into account the setting of `org-odd-levels-only'."
(if org-odd-levels-only (1+ (floor (/ l 2))) l))
(defun org-get-valid-level (level &optional change)
"Edit, then exit with C-c ' (C-c and single quote)"))
(info (org-edit-src-find-region-and-lang))
(org-mode-p (eq major-mode 'org-mode))
- beg end lang lang-f single)
+ beg end lang lang-f single lfmt)
(if (not info)
nil
(setq beg (nth 0 info)
end (nth 1 info)
lang (nth 2 info)
single (nth 3 info)
+ lfmt (nth 4 info)
lang-f (intern (concat lang "-mode")))
(unless (functionp lang-f)
(error "No such language mode: %s" lang-f))
(funcall lang-f))
(set (make-local-variable 'org-edit-src-force-single-line) single)
(set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
+ (when lfmt
+ (set (make-local-variable 'org-coderef-label-format) lfmt))
(when org-mode-p
(goto-char (point-min))
(while (re-search-forward "^," nil t)
("^#\\+ascii:" "\n" "ascii" single-line)
)))
(pos (point))
- re re1 re2 single beg end lang)
+ re re1 re2 single beg end lang lfmt match-re1)
(catch 'exit
(while (setq entry (pop re-list))
(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
(if (or (looking-at re1)
(re-search-backward re1 nil t))
(progn
- (setq beg (match-end 0) lang (org-edit-src-get-lang lang))
+ (setq match-re1 (match-string 0))
+ (setq beg (match-end 0)
+ lang (org-edit-src-get-lang lang)
+ lfmt (org-edit-src-get-label-format match-re1))
(if (and (re-search-forward re2 nil t)
(>= (match-end 0) pos))
- (throw 'exit (list beg (match-beginning 0) lang single))))
+ (throw 'exit (list beg (match-beginning 0)
+ lang single lfmt))))
(if (or (looking-at re2)
(re-search-forward re2 nil t))
(progn
(setq end (match-beginning 0))
(if (and (re-search-backward re1 nil t)
(<= (match-beginning 0) pos))
- (throw 'exit
- (list (match-end 0) end
- (org-edit-src-get-lang lang) single)))))))))))
+ (progn
+ (setq lfmt (org-edit-src-get-label-format
+ (match-string 0)))
+ (throw 'exit
+ (list (match-end 0) end
+ (org-edit-src-get-lang lang)
+ single lfmt))))))))))))
(defun org-edit-src-get-lang (lang)
"Extract the src language."
(match-string 1 m))
(t "fundamental"))))
+(defun org-edit-src-get-label-format (s)
+ "Extract the label format."
+ (save-match-data
+ (if (string-match "-l[ \t]+\\\\?\"\\([^\t\r\n\"]+\\)\\\\?\"" s)
+ (match-string 1 s))))
+
(defun org-edit-src-exit ()
"Exit special edit and protect problematic lines."
(interactive)
(setq link (plist-get org-store-link-plist :link)
desc (or (plist-get org-store-link-plist :description) link)))
+ ((equal (buffer-name) "*Org Edit Src Example*")
+ (let (label gc)
+ (while (or (not label)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (re-search-forward
+ (regexp-quote (format org-coderef-label-format label))
+ nil t))))
+ (when label (message "Label exists already") (sit-for 2))
+ (setq label (read-string "Code line label: " label)))
+ (end-of-line 1)
+ (setq link (format org-coderef-label-format label))
+ (setq gc (- 79 (length link)))
+ (if (< (current-column) gc) (org-move-to-column gc t) (insert " "))
+ (insert link)
+ (setq link (concat "(" label ")") desc nil)))
+
((eq major-mode 'calendar-mode)
(let ((cd (calendar-cursor-to-date)))
(setq link
"Exclusive or."
(if a (not b) b))
-(defun org-get-header (header)
- "Find a header field in the current buffer."
- (save-excursion
- (goto-char (point-min))
- (let ((case-fold-search t) s)
- (cond
- ((eq header 'from)
- (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t)
- (setq s (match-string 1)))
- (while (string-match "\"" s)
- (setq s (replace-match "" t t s)))
- (if (string-match "[<(].*" s)
- (setq s (replace-match "" t t s))))
- ((eq header 'message-id)
- (if (re-search-forward "^message-id:\\s-+\\(.*\\)" nil t)
- (setq s (match-string 1))))
- ((eq header 'subject)
- (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t)
- (setq s (match-string 1)))))
- (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s)))
- (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s)))
- s)))
-
-
(defun org-fixup-message-id-for-http (s)
"Replace special characters in a message id, so it can be used in an http query."
(while (string-match "<" s)
(reverse org-stored-links) "\n"))))
(let ((cw (selected-window)))
(select-window (get-buffer-window "*Org Links*"))
- (org-fit-window-to-buffer)
(setq truncate-lines t)
+ (org-fit-window-to-buffer)
(select-window cw))
;; Fake a link history, containing the stored links.
(setq tmphist (append (mapcar 'car org-stored-links)
org-insert-link-history))
(unwind-protect
- (setq link (org-completing-read
- "Link: "
- (append
- (mapcar (lambda (x) (list (concat (car x) ":")))
- (append org-link-abbrev-alist-local org-link-abbrev-alist))
- (mapcar (lambda (x) (list (concat x ":")))
- org-link-types))
- nil nil nil
- 'tmphist
- (or (car (car org-stored-links)))))
+ (setq link
+ (let ((org-completion-use-ido nil))
+ (org-completing-read
+ "Link: "
+ (append
+ (mapcar (lambda (x) (list (concat (car x) ":")))
+ (append org-link-abbrev-alist-local org-link-abbrev-alist))
+ (mapcar (lambda (x) (list (concat x ":")))
+ org-link-types))
+ nil nil nil
+ 'tmphist
+ (or (car (car org-stored-links))))))
(set-window-configuration wcf)
(kill-buffer "*Org Links*"))
(setq entry (assoc link org-stored-links))
(let ((minibuffer-local-completion-map
(copy-keymap minibuffer-local-completion-map)))
(org-defkey minibuffer-local-completion-map " " 'self-insert-command)
+ (org-defkey minibuffer-local-completion-map "?" 'self-insert-command)
(apply 'org-ido-completing-read args)))
(defun org-ido-completing-read (&rest args)
(move-marker org-open-link-marker (point))
(setq org-window-config-before-follow-link (current-window-configuration))
(org-remove-occur-highlights nil nil t)
- (if (org-at-timestamp-p t)
- (org-follow-timestamp-link)
+ (cond
+ ((org-at-timestamp-p t) (org-follow-timestamp-link))
+ ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p))
+ (org-footnote-action))
+ (t
(let (type path link line search (pos (point)))
(catch 'match
(save-excursion
(error "Abort"))))
(t
- (browse-url-at-point)))))
+ (browse-url-at-point))))))
(move-marker org-open-link-marker nil)
(run-hook-with-args 'org-follow-link-hook))
pos (match-beginning 0))))
;; There is an exact target for this
(goto-char pos))
+ ((and (string-match "^(\\(.*\\))$" s0)
+ (save-excursion
+ (goto-char (point-min))
+ (and
+ (re-search-forward
+ (concat "[^[]" (regexp-quote
+ (format org-coderef-label-format
+ (match-string 1 s0))))
+ nil t)
+ (setq type 'dedicated
+ pos (1+ (match-beginning 0))))))
+ ;; There is a coderef target for this
+ (goto-char pos))
((string-match "^/\\(.*\\)/$" s)
;; A regular expression
(cond
MATCHER is a Lisp form to be evaluated, testing if a given set of tags
qualifies a headline for inclusion. When TODO-ONLY is non-nil,
only lines with a TODO keyword are included in the output."
+ (require 'org-agenda)
(let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
(org-re
;; selective inheritance, remove uninherited ones
(setcdr (car tags-alist)
(org-remove-uniherited-tags (cdar tags-alist))))
- (when (and (or (not todo-only) (member todo org-not-done-keywords))
+ (when (and (or (not todo-only)
+ (and (member todo org-not-done-keywords)
+ (or (not org-agenda-tags-todo-honor-ignore-options)
+ (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
(let ((case-fold-search t)) (eval matcher))
(or
(not (member org-archive-tag tags-list))
;; Get a new match request, with completion
(let ((org-last-tags-completion-table
(org-global-tags-completion-table)))
- (setq match (org-ido-completing-read
+ (setq match (org-completing-read
"Match: " 'org-tags-completion-function nil nil nil
'org-tags-history))))
(defun org-string>= (a b) (not (string< a b)))
(defun org-string> (a b) (and (not (string= a b)) (not (string< a b))))
(defun org-string<> (a b) (not (string= a b)))
-(defun org-time= (a b) (= (org-2ft a) (org-2ft b)))
-(defun org-time< (a b) (< (org-2ft a) (org-2ft b)))
-(defun org-time<= (a b) (<= (org-2ft a) (org-2ft b)))
-(defun org-time> (a b) (> (org-2ft a) (org-2ft b)))
-(defun org-time>= (a b) (>= (org-2ft a) (org-2ft b)))
-(defun org-time<> (a b) (org<> (org-2ft a) (org-2ft b)))
+(defun org-time= (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (= a b)))
+(defun org-time< (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (< a b)))
+(defun org-time<= (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (<= a b)))
+(defun org-time> (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (> a b)))
+(defun org-time>= (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (>= a b)))
+(defun org-time<> (a b) (setq a (org-2ft a) b (org-2ft b)) (and (> a 0) (> b 0) (org<> a b)))
(defun org-2ft (s)
"Convert S to a floating point time.
If S is already a number, just return it. If it is a string, parse
-it as a time string and apply `float-time' to it. f S is nil, just return 0."
+it as a time string and apply `float-time' to it. If S is nil, just return 0."
(cond
((numberp s) s)
((stringp s)
((eq match nil) (setq matcher t))
(t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
- (when (eq scope 'tree)
- (org-back-to-heading t)
- (org-narrow-to-subtree)
- (setq scope nil))
+ (save-excursion
+ (save-restriction
+ (when (eq scope 'tree)
+ (org-back-to-heading t)
+ (org-narrow-to-subtree)
+ (setq scope nil))
- (if (not scope)
- (progn
- (org-prepare-agenda-buffers
- (list (buffer-file-name (current-buffer))))
- (org-scan-tags func matcher))
- ;; Get the right scope
- (setq pos (point))
- (cond
- ((and scope (listp scope) (symbolp (car scope)))
- (setq scope (eval scope)))
- ((eq scope 'agenda)
- (setq scope (org-agenda-files t)))
- ((eq scope 'agenda-with-archives)
- (setq scope (org-agenda-files t))
- (setq scope (org-add-archive-files scope)))
- ((eq scope 'file)
- (setq scope (list (buffer-file-name))))
- ((eq scope 'file-with-archives)
- (setq scope (org-add-archive-files (list (buffer-file-name))))))
- (org-prepare-agenda-buffers scope)
- (while (setq file (pop scope))
- (with-current-buffer (org-find-base-buffer-visiting file)
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- (setq res (append res (org-scan-tags func matcher)))))))
- res)))
+ (if (not scope)
+ (progn
+ (org-prepare-agenda-buffers
+ (list (buffer-file-name (current-buffer))))
+ (setq res (org-scan-tags func matcher)))
+ ;; Get the right scope
+ (setq pos (point))
+ (cond
+ ((and scope (listp scope) (symbolp (car scope)))
+ (setq scope (eval scope)))
+ ((eq scope 'agenda)
+ (setq scope (org-agenda-files t)))
+ ((eq scope 'agenda-with-archives)
+ (setq scope (org-agenda-files t))
+ (setq scope (org-add-archive-files scope)))
+ ((eq scope 'file)
+ (setq scope (list (buffer-file-name))))
+ ((eq scope 'file-with-archives)
+ (setq scope (org-add-archive-files (list (buffer-file-name))))))
+ (org-prepare-agenda-buffers scope)
+ (while (setq file (pop scope))
+ (with-current-buffer (org-find-base-buffer-visiting file)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (setq res (append res (org-scan-tags func matcher))))))))))
+ res))
;;;; Properties
(excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY"))
beg end range props sum-props key value string clocksum)
(save-excursion
- (when (condition-case nil (org-back-to-heading t) (error nil))
+ (when (condition-case nil
+ (and (org-mode-p) (org-back-to-heading t))
+ (error nil))
(setq beg (point))
(setq sum-props (get-text-property (point) 'org-summaries))
(setq clocksum (get-text-property (point) :org-clock-minutes))
;; Make the proper lists from the dates
(catch 'exit
(let ((a1 '(("d" . day) ("w" . week) ("m" . month) ("y" . year)))
- dn dw sday cday n1 n2
+ dn dw sday cday n1 n2 n0
d m y y1 y2 date1 date2 nmonths nm ny m2)
(setq start (org-date-to-gregorian start)
(setq m2 (+ m dn) y2 y)
(if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12)))
(setq n2 (calendar-absolute-from-gregorian (list m2 d y2))))))
+ ;; Make sure n1 is the earlier date
+ (setq n0 n1 n1 (min n1 n2) n2 (max n0 n2))
(if show-all
(cond
((eq prefer 'past) n1)
'(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
- ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([ .,?;:'\")\000]\\|$\\)" 2 nil)
+ ("$1" "\\([^$]\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil)
+ ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil)
("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 t)
("$$" "\\$\\$[^\000]*?\\$\\$" 0 t))
"Return string to be used as color value for an RGB component."
(format "%g" (/ value 65535.0)))
-
;;;; Key bindings
;; Make `C-c C-x' a prefix key
(org-defkey org-mode-map "\C-c\C-e" 'org-export)
(org-defkey org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
(org-defkey org-mode-map "\C-c\C-x\C-f" 'org-emphasize)
+(org-defkey org-mode-map "\C-c\C-xf" 'org-footnote-action)
(org-defkey org-mode-map "\C-c\C-x\C-k" 'org-mark-entry-for-agenda-action)
(org-defkey org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
(org-defkey org-mode-map "\C-c\C-x." 'org-timer)
(org-defkey org-mode-map "\C-c\C-x-" 'org-timer-item)
(org-defkey org-mode-map "\C-c\C-x0" 'org-timer-start)
+(org-defkey org-mode-map "\C-c\C-x," 'org-timer-pause-or-continue)
(define-key org-mode-map "\C-c\C-x\C-c" 'org-columns)
- If the cursor is on a #+TBLFM line, re-apply the formulas to
the entire table.
+- If the cursor is at a footnote reference or definition, jump to
+ the corresponding definition or references, respectively.
+
- If the cursor is a the beginning of a dynamic block, update it.
- If the cursor is inside a table created by the table.el package,
((or (and (boundp 'org-clock-overlays) org-clock-overlays)
org-occur-highlights
org-latex-fragment-image-overlays)
- (and (boundp 'org-clock-overlays) (org-remove-clock-overlays))
+ (and (boundp 'org-clock-overlays) (org-clock-remove-overlays))
(org-remove-occur-highlights)
(org-remove-latex-fragment-image-overlays)
(message "Temporary highlights/overlays removed from current buffer"))
(call-interactively 'org-table-recalculate)
(org-table-maybe-recalculate-line))
(call-interactively 'org-table-align))
+ ((or (org-footnote-at-reference-p)
+ (org-footnote-at-definition-p))
+ (call-interactively 'org-footnote-action))
((org-at-item-checkbox-p)
(call-interactively 'org-toggle-checkbox))
((org-at-item-p)
(defun org-ctrl-c-star ()
"Compute table, or change heading status of lines.
-Calls `org-table-recalculate' or `org-toggle-region-headings',
-depending on context. This will also turn a plain list item or a normal
-line into a subheading."
+Calls `org-table-recalculate' or `org-toggle-heading',
+depending on context."
(interactive)
(cond
((org-at-table-p)
(call-interactively 'org-table-recalculate))
- ((org-region-active-p)
+ (t
;; Convert all lines in region to list items
- (call-interactively 'org-toggle-region-headings))
- ((org-on-heading-p)
- (org-toggle-region-headings (point-at-bol)
- (min (1+ (point-at-eol)) (point-max))))
- ((org-at-item-p)
- ;; Convert to heading
- (let ((level (save-match-data
- (save-excursion
- (condition-case nil
- (progn
- (org-back-to-heading t)
- (funcall outline-level))
- (error 0))))))
- (replace-match
- (concat (make-string (org-get-valid-level level 1) ?*) " ") t t)))
- (t (org-toggle-region-headings (point-at-bol)
- (min (1+ (point-at-eol)) (point-max))))))
+ (call-interactively 'org-toggle-heading))))
(defun org-ctrl-c-minus ()
"Insert separator line in table or modify bullet status of line.
Also turns a plain line or a region of lines into list items.
-Calls `org-table-insert-hline', `org-toggle-region-items', or
+Calls `org-table-insert-hline', `org-toggle-item', or
`org-cycle-list-bullet', depending on context."
(interactive)
(cond
((org-at-table-p)
(call-interactively 'org-table-insert-hline))
- ((org-on-heading-p)
- ;; Convert to item
- (save-excursion
- (beginning-of-line 1)
- (if (looking-at "\\*+ ")
- (replace-match (concat (make-string (- (match-end 0) (point) 1) ?\ ) "- ")))))
((org-region-active-p)
- ;; Convert all lines in region to list items
- (call-interactively 'org-toggle-region-items))
+ (call-interactively 'org-toggle-item))
((org-in-item-p)
(call-interactively 'org-cycle-list-bullet))
- (t (org-toggle-region-items (point-at-bol)
- (min (1+ (point-at-eol)) (point-max))))))
-
-(defun org-toggle-region-items (beg end)
- "Convert all lines in region to list items.
-If the first line is already an item, convert all list items in the region
-to normal lines."
- (interactive "r")
- (let (l2 l)
+ (t
+ (call-interactively 'org-toggle-item))))
+
+(defun org-toggle-item ()
+ "Convert headings or normal lines to items, items to normal lines.
+If there is no active region, only the current line is considered.
+
+If the first line in the region is a headline, convert all headlines to items.
+
+If the first line in the region is an item, convert all items to normal lines.
+
+If the first line is normal text, add an item bullet to each line."
+ (interactive)
+ (let (l2 l beg end)
+ (if (org-region-active-p)
+ (setq beg (region-beginning) end (region-end))
+ (setq beg (point-at-bol)
+ end (min (1+ (point-at-eol)) (point-max))))
(save-excursion
(goto-char end)
(setq l2 (org-current-line))
(delete-region (match-beginning 2) (match-end 2))
(and (looking-at "[ \t]+") (replace-match "")))
(beginning-of-line 2))
- (while (< (setq l (1+ l)) l2)
- (unless (org-at-item-p)
- (if (looking-at "\\([ \t]*\\)\\(\\S-\\)")
- (replace-match "\\1- \\2")))
- (beginning-of-line 2))))))
-
-(defun org-toggle-region-headings (beg end)
- "Convert all lines in region to list items.
-If the first line is already an item, convert all list items in the region
-to normal lines."
- (interactive "r")
- (let (l2 l)
+ (if (org-on-heading-p)
+ ;; Headings, convert to items
+ (while (< (setq l (1+ l)) l2)
+ (if (looking-at org-outline-regexp)
+ (replace-match "- " t t))
+ (beginning-of-line 2))
+ ;; normal lines, turn them into items
+ (while (< (setq l (1+ l)) l2)
+ (unless (org-at-item-p)
+ (if (looking-at "\\([ \t]*\\)\\(\\S-\\)")
+ (replace-match "\\1- \\2")))
+ (beginning-of-line 2)))))))
+
+(defun org-toggle-heading (&optional nstars)
+ "Convert headings to normal text, or items or text to headings.
+If there is no active region, only the current line is considered.
+
+If the first line is a heading, remove the stars from all headlines
+in the region.
+
+If the first line is a plain list item, turn all plain list items into
+headings.
+
+If the first line is a normal line, turn each and every line in the region
+into a heading.
+
+When converting a line into a heading, the number of stars is chosen
+such that the lines become children of the current entry. However, when
+a prefix argument is given, its value determines the number of stars to add."
+ (interactive "P")
+ (let (l2 l itemp beg end)
+ (if (org-region-active-p)
+ (setq beg (region-beginning) end (region-end))
+ (setq beg (point-at-bol)
+ end (min (1+ (point-at-eol)) (point-max))))
(save-excursion
(goto-char end)
(setq l2 (org-current-line))
(when (org-on-heading-p t)
(and (looking-at outline-regexp) (replace-match "")))
(beginning-of-line 2))
- (let* ((stars (save-excursion
- (re-search-backward org-complex-heading-regexp nil t)
- (or (match-string 1) "*")))
- (add-stars (if org-odd-levels-only "**" "*"))
- (rpl (concat stars add-stars " \\2")))
+ (setq itemp (org-at-item-p))
+ (let* ((stars
+ (if nstars
+ (make-string (prefix-numeric-value current-prefix-arg)
+ ?*)
+ (save-excursion
+ (re-search-backward org-complex-heading-regexp nil t)
+ (or (match-string 1) "*"))))
+ (add-stars (if nstars "" (if org-odd-levels-only "**" "*")))
+ (rpl (concat stars add-stars " ")))
(while (< (setq l (1+ l)) l2)
- (unless (org-on-heading-p)
- (if (looking-at "\\([ \t]*\\)\\(\\S-\\)")
- (replace-match rpl)))
+ (if itemp
+ (and (org-at-item-p) (replace-match rpl t t))
+ (unless (org-on-heading-p)
+ (if (looking-at "\\([ \t]*\\)\\(\\S-\\)")
+ (replace-match (concat rpl (match-string 2))))))
(beginning-of-line 2)))))))
(defun org-meta-return (&optional arg)
["Convert to odd/even levels" org-convert-to-oddeven-levels t])
("Editing"
["Emphasis..." org-emphasize t]
- ["Edit Source Example" org-edit-special t])
+ ["Edit Source Example" org-edit-special t]
+ "--"
+ ["Footnote new/jump" org-footnote-action t]
+ ["Footnote extra" (org-footnote-action t) :active t :keys "C-u C-c C-x f"])
("Archive"
["Toggle ARCHIVE tag" org-toggle-archive-tag t]
; ["Check and Tag Children" (org-toggle-archive-tag (4))
["Goto Calendar" org-goto-calendar t]
["Date from Calendar" org-date-from-calendar t]
"--"
- ["Start/restart timer" org-timer-start t]
- ["Insert timer string" org-timer t]
- ["Insert timer item" org-timer-item t])
+ ["Start/Restart Timer" org-timer-start t]
+ ["Pause/Continue Timer" org-timer-pause-or-continue t]
+ ["Stop Timer" org-timer-pause-or-continue :active t :keys "C-u C-c C-x ,"]
+ ["Insert Timer String" org-timer t]
+ ["Insert Timer Item" org-timer-item t])
("Logging work"
["Clock in" org-clock-in t]
["Clock out" org-clock-out t]
(switch-to-buffer (marker-buffer marker))
(if (or (> marker (point-max)) (< marker (point-min)))
(widen))
- (goto-char marker))
+ (goto-char marker)
+ (org-show-context 'org-goto))
(if bookmark
(bookmark-jump bookmark)
(error "Cannot find location"))))
(or (buffer-base-buffer buf) buf)
nil)))
-(defun org-image-file-name-regexp ()
- "Return regexp matching the file names of images."
- (if (fboundp 'image-file-name-regexp)
+(defun org-image-file-name-regexp (&optional extensions)
+ "Return regexp matching the file names of images.
+If EXTENSIONS is given, only match these."
+ (if (and (not extensions) (fboundp 'image-file-name-regexp))
(image-file-name-regexp)
(let ((image-file-name-extensions
- '("png" "jpeg" "jpg" "gif" "tiff" "tif"
- "xbm" "xpm" "pbm" "pgm" "ppm")))
+ (or extensions
+ '("png" "jpeg" "jpg" "gif" "tiff" "tif"
+ "xbm" "xpm" "pbm" "pgm" "ppm"))))
(concat "\\."
(regexp-opt (nconc (mapcar 'upcase
image-file-name-extensions)
t)
"\\'"))))
-(defun org-file-image-p (file)
+(defun org-file-image-p (file &optional extensions)
"Return non-nil if FILE is an image."
(save-match-data
- (string-match (org-image-file-name-regexp) file)))
+ (string-match (org-image-file-name-regexp extensions) file)))
(defun org-get-cursor-date ()
"Return the date at cursor in as a time.