summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/org/ChangeLog397
-rw-r--r--lisp/org/org-agenda.el193
-rw-r--r--lisp/org/org-archive.el3
-rw-r--r--lisp/org/org-bbdb.el13
-rw-r--r--lisp/org/org-bibtex.el2
-rw-r--r--lisp/org/org-clock.el50
-rw-r--r--lisp/org/org-colview.el65
-rw-r--r--lisp/org/org-compat.el20
-rw-r--r--lisp/org/org-exp.el236
-rw-r--r--lisp/org/org-export-latex.el339
-rw-r--r--lisp/org/org-faces.el12
-rw-r--r--lisp/org/org-gnus.el6
-rw-r--r--lisp/org/org-id.el113
-rw-r--r--lisp/org/org-info.el2
-rw-r--r--lisp/org/org-irc.el2
-rw-r--r--lisp/org/org-jsinfo.el2
-rw-r--r--lisp/org/org-mac-message.el2
-rw-r--r--lisp/org/org-macs.el2
-rw-r--r--lisp/org/org-mew.el2
-rw-r--r--lisp/org/org-mhe.el2
-rw-r--r--lisp/org/org-mouse.el2
-rw-r--r--lisp/org/org-publish.el46
-rw-r--r--lisp/org/org-remember.el212
-rw-r--r--lisp/org/org-rmail.el2
-rw-r--r--lisp/org/org-table.el24
-rw-r--r--lisp/org/org-vm.el2
-rw-r--r--lisp/org/org-wl.el11
-rw-r--r--lisp/org/org.el1542
28 files changed, 1802 insertions, 1502 deletions
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index bf437350c8e..9e1283ee773 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,400 @@
+2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
+
+ * org.el (org-edit-fixed-width-region): Exclude final newline from
+ picture area.
+
+ * org-export-latex.el (org-export-latex-subcontent): Add labels to
+ sections, to make internal links work.
+ (org-export-latex-fontify-headline): Do not remove all text
+ properties, to make sure that target properties survive this
+ process.
+
+ * org-exp.el (org-export-preprocess-string): Change sequence of
+ modifications, to make sure links are prepared before the LaTeX
+ conversions do happen.
+
+ * org-attach.el (org-attach-delete-all): Renamed from
+ `org-attch-delete'. Add a security query before deleting the
+ entire directory. New optional argument FORCE can overrule the
+ security query.
+ (org-attach-delete-one): New command.
+
+ * org-attach.el (org-attach-file-list): Fix bug with directory.
+
+ * org.el (org-apps-regexp-alist): New function.
+ (org-file-apps): Add auto-mode to the default value.
+ (org-open-file): Use the new structure of org-file-apps.
+
+ * org-attach.el (org-attach): Support the new keys.
+ (org-attach-method): New option.
+
+ * org-bbdb.el (org-bbdb-anniversaries): Fix but with 29 Feb/1
+ March.
+
+ * org.el (org-remove-uniherited-tags): Fix reverse interpretation
+ of the list value o `org-use-tag-inheritance'.
+
+ * org-attach.el (org-attach-auto-tag): New option.
+ (org-attach-tag, org-attach-untag): New functions.
+ (org-attach-attach, org-attach-new, org-attach-sync): Call
+ `org-attach-tag'.
+ (org-attach-delete): Call `org-attach-untag'.
+
+ * org-attach.el: New file.
+
+ * org-table.el (orgtbl-self-insert-command): Make this work for
+ the keypad as well.
+
+ * org.el (org-add-log-setup): Limit searc for drawers to entry
+ text, not to subtree.
+
+ * org-clock.el (org-clock-heading-for-remember): New variable.
+ (org-clock-in): Set `org-clock-heading-for-remember'.
+
+2008-10-12 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * org-remember.el (org-remember-apply-template): Add new
+ expansions: %k, %K for currently clocked task and a link to the
+ currently clocked task, and %< to file notes in the currently
+ clocked task.
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-export-latex.el (org-export-latex-make-header): Also insert
+ the content of the property :latex-header-extra.
+
+ * org-exp.el (org-infile-export-plist): Put the content of
+ #+LATEX_HEADER: into the property :latex-header-extra.
+
+ * org-colview.el (org-columns-get-format-and-top-level): Remove
+ resetting the marker.
+
+ * org-colview-xemacs.el (org-columns-get-format-and-top-level):
+ Remove resetting the marker.
+
+ * org.el (org-entry-property-inherited-from): Improve docstring.
+ (org-entry-get-with-inheritance): Reset marker before starting the
+ search.
+
+ * org-exp.el (org-infile-export-plist): Allow multiple STYLE lines.
+
+ * org.el (org-entry-get-multivalued-property)
+ (org-entry-protect-space, org-entry-restore-space): New
+ functions.
+ (org-file-apps-defaults-macosx): Let postscript files be opened by
+ preview.
+ (org-time-stamp-inactive): Call `org-time-stamp'.
+ (org-time-stamp): New argument `inactive'. Also edit inacive
+ stamps. Convert time stamp type.
+ (org-open-file): Interpret the `default' value for the `command'
+ in `org-file-apps'.
+
+ * org-id.el (org-id-int-to-b36-one-digit)
+ (org-id-b36-to-int-one-digit, org-id-int-to-b36)
+ (org-id-b36-to-int, org-id-time-to-b36): Modified from b62 to
+ b36.
+
+ * org-id.el (org-id-reverse-string): New function.
+ (org-id-new): Use `org-id-reverse-string' to make sure the
+ beginning chars of the ID are mutating fast. This allows to use a
+ directory structure to spread things better.
+ (org-id-prefix): Changed default to nil.
+
+ * org-list.el (org-move-item-down, org-move-item-up): Remember and
+ restore the column of the cursor position.
+
+ * org-remember.el (org-remember-apply-template): Remove properties
+ from `initial'.
+
+ * org-wl.el (org-wl-open): Remove useless call to
+ `wl-thread-open-all'.
+
+ * org-remember.el (org-remember-handler): Fix bug with `bottom'
+ location.
+
+ * org-bbdb.el (org-bbdb-anniversaries): Require bbdb in
+ `org-bbdb-anniversaries'.
+
+ * org.el (org-get-next-sibling, org-forward-same-level): New
+ functions, similar to the outline versions, but invisible headings
+ are OK.
+
+2008-10-12 Bastien Guerry <bzg@altern.org>
+
+ * org.el (org-auto-repeat-maybe): Insert a space between
+ the timestamp's type and the timestamp itself.
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-table.el (org-table-sum): Do not format the result with %g,
+ it does rounding when there are too many digits.
+
+ * org.el (org-map-entries): Protect the keyword-selecting variables.
+
+2008-10-12 Bastien Guerry <bzg@altern.org>
+
+ * org-agenda.el (org-agenda-to-appt): Make sure the function check
+ against all agenda files.
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-list.el: New file, aggregating list functions from org.el
+ and org-export-latex.el.
+
+ * org.el (org-edit-src-region-extra): New option.
+
+ * org-agenda.el (org-agenda-to-appt): Fix bug with appointment
+ time before 1am.
+
+2008-10-12 Bastien Guerry <bzg@altern.org>
+
+ * org-export-latex.el (org-export-latex-keywords-maybe): Bug fix.
+
+2008-10-12 James TA Smith <ahktenzero@mohorovi.cc>
+
+ * org-plot.el (org-plot/gnuplot): Make tables starting with a
+ hline work correctly.
+ (org-plot/gnuplot-script): Put commas at the end of each script
+ line.
+
+ * org.el (org-get-refile-targets): Replace links with their
+ descriptions
+ (org-imenu-get-tree): Replace links with their descriptions.
+
+ * org-remember.el (org-remember-apply-template): Add a new
+ expansion for adding properties to remember items.
+
+ * org.el (org-add-log-setup): Skip over drawers (properties,
+ clocks etc) when adding notes.
+
+ * org-agenda.el (org-agenda-get-closed): show durations of clocked
+ items as well as the start and end times.
+
+ * org-compat.el (org-get-x-clipboard-compat): Add a compat
+ function for fetching the X clipboard on XEmacs and GNU Emacs 21.
+
+ * org-remember.el (org-get-x-clipboard): Use the compat
+ function to get clipboard values when x-selection-value is
+ unavailable. Use substring-no-properties instead of
+ set-text-properties to remove text properties from the clipboard
+ value.
+
+ * lisp/org-clock.el (org-update-mode-line): Support limiting the
+ modeline clock string, and display the full todo value in the
+ tooltip. Set a local keymap so mouse-3 on the clock string goes to
+ the currently clocked task.
+ (org-clock-string-limit): Add a custom value for the maximum
+ length of the clock string in the modeline.
+ (org-clock-mode-map): Add a keymap for the modeline string
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-compat.el (org-propertize): New function.
+
+2008-10-12 Bastien Guerry <bzg@altern.org>
+
+ * org-export-latex.el (org-export-latex-tables): protect exported
+ tables from further special chars conversion.
+ (org-export-latex-preprocess): Preserve LaTeX environments.
+ (org-list-parse-list): Parse descriptive lists.
+ (org-list-to-generic, org-list-to-latex, org-list-to-html)
+ (org-list-to-texinfo): Export descriptive lists.
+ (org-quote-chars): Remove.
+ (org-export-latex-keywords-maybe): Use `replace-regexp-in-string'.
+ (org-export-latex-list-beginning-re): Rename to
+ `org-list-beginning-re'
+ (org-list-item-begin): Rename to `org-list-item-beginning'
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org.el (org-refile): Allow refiling to the last entry in the
+ buffer.
+ (org-get-tags-at): Fix bug when inheritance is turned off.
+
+ * org.el (org-indent-line-function): No longer check for src
+ regions, this is too much overhead.
+
+ * org-agenda.el (org-agenda-highlight-todo): Fix bugs with keyword
+ matching.
+
+ * org.el (org-scan-tags): Make sure that tags matching is not case
+ sensitive. TODO keyword matching is case sensitive, however, to
+ avoid confusion with similar words that are not meant to be
+ keywords.
+
+ * org.el (org-get-local-tags-at): New function.
+ (org-get-local-tags): New function.
+
+ * org-exp.el (org-export-get-categories): New function.
+
+ * org-agenda.el (org-sorting-choice)
+ (org-agenda-sorting-strategy, org-agenda-get-todos)
+ (org-agenda-get-timestamps, org-agenda-get-deadlines)
+ (org-agenda-get-scheduled, org-agenda-get-blocks)
+ (org-entries-lessp): Implement sorting by TODO state.
+ (org-cmp-todo-state): New defsubst.
+
+ * org-colview.el (org-colview-construct-allowed-dates): New
+ function.
+ (org-columns-next-allowed-value): Use
+ `org-colview-construct-allowed-dates'.
+
+ * org-colview-xemacs.el (org-colview-construct-allowed-dates): New
+ function.
+ (org-columns-next-allowed-value): Use
+ `org-colview-construct-allowed-dates'.
+
+ * org.el (org-protect-slash): New function.
+ (org-get-refile-targets): Use `org-protect-slash'.
+
+ * org-agenda.el (org-global-tags-completion-table): New variable.
+
+ * org-exp.el (org-export-handle-export-tags): New function.
+ (org-export-preprocess-string): Call
+ `org-export-handle-export-tags'.
+
+ * org-plot.el: New file.
+
+ * org-publish.el (org-publish-expand-components): Function removed.
+ (org-publish-expand-projects): Allow components to have components.
+
+ * org.el (org-indent-line-function): Do not indent in regions that
+ are external source code.
+ (org-yank-and-fold-if-subtree): New function.
+
+ * org-agenda.el (org-agenda-todayp): New function.
+ (org-agenda-get-deadlines, org-agenda-get-scheduled): Use
+ `org-agenda-todayp'.
+
+ * org.el (org-insert-heading-respect-content)
+ (org-insert-todo-heading-respect-content): New commands.
+ (org-insert-heading-respect-content): New option.
+ (org-insert-heading): Respect `org-insert-heading-respect-content'.
+
+ * org-clock.el (org-clock-find-position): Make sure the note after
+ the clock line gets moved into the new clock drawer.
+
+ * org-id.el (org-id-new): New option.
+
+ * org-table.el (org-table-copy-down): Avoid overflow during
+ increment. Use prefix argument 0 to temporarily disable the
+ increment.
+
+ * org-exp.el (org-export-as-html): Do not turn on the major mode
+ if the buffer will be killed anyway.
+ (org-get-current-options): Exclude the #+TEXT field.
+ (org-export-as-html): Make sure text before the first headline is
+ a paragraph.
+
+ * org-publish.el (org-publish-org-to): Tell the exporter that this
+ buffer will be killed, so it is not necessary to do major mode
+ initialization.
+
+ * org-archive.el (org-archive-to-archive-sibling): Show empty
+ lines after folding the archive sibling.
+
+ * org.el (org-log-note-extra): New variable.
+
+2008-10-12 Bastien Guerry <bzg@altern.org>
+
+ * org.el (org-additional-option-like-keywords): Added keywords for
+ the _QUOTE, _VERSE and _SRC environments.
+
+ * org-export-latex.el (org-export-latex-preprocess): Fix bug when
+ exporting _QUOTE and _VERSE environments.
+
+2008-10-12 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-agenda.el (org-agenda-filter-by-tag): New command.
+
+ * org-exp.el (org-get-current-options): Remove angular brackets
+ from the date entry.
+
+ * org.el (org-edit-fixed-width-region): New function.
+ (org-edit-fixed-width-region): Also try
+ `org-edit-fixed-width-region'.
+ (org-edit-fixed-width-region-mode): New option.
+ (org-activate-code): Only interprete lines starting with colon
+ plus a space as example lines.
+
+ * org-remember.el (org-remember-templates): Add nil instead of
+ empty strings to fix the length of remember templates.
+
+ * org-table.el (org-calc-default-modes): Fix the time format for
+ calc, from 12 hour to 24 hour clock.
+
+ * org-agenda.el (org-agenda-get-deadlines)
+ (org-agenda-get-scheduled): Avoid `time-of-day' extraction for
+ entries that are pre-warnings of deadlines or reminders.
+
+ * org.el (org-sort-entries-or-items): Make numeric and alpha
+ comparisons ignore any TODO keyword and priority cookie.
+
+ * org-remember.el (org-remember-handler): Reinterpretation of the
+ prefix argument.
+
+ * org-agenda.el (org-agenda-get-scheduled): Use new
+ `org-scheduled' face.
+
+ * org-faces.el (org-scheduled): New face.
+
+ * org-wl.el (org-wl-open): Remove incorrect declaration.
+
+ * org-gnus.el (org-gnus-store-link): Support for :to information
+ in gnus links.
+
+ * org-exp.el (org-export-as-html): Fixed typo in creator
+ information.
+ (org-export-protect-examples): New parameter indent. Insert extra
+ spaces only when this parameter is specified.
+ (org-export-preprocess-string): Call `org-export-protect-examples'
+ with an indentation parameter when exporting to ASCII.
+
+ * org-remember.el (org-remember-templates)
+ (org-remember-apply-template): Allow the file component to be a
+ function.
+
+ * org.el (org-goto-local-search-headings): Renamed from
+ `org-goto-local-search-forward-headings'. Added the possibility
+ to search backwards.
+
+ * org-export-latex.el (org-export-latex): New customization
+ group.
+
+ * org-agenda.el (org-write-agenda): Erase buffer for txt export.
+
+ * org-exp.el (org-html-do-expand): Allow {} to terminate
+ tex macro
+
+ * org.el (org-buffer-list): Select buffers based on major mode,
+ not on file name.
+
+ * org-agenda.el (org-agenda-align-tags): Fix bug with malformed
+ face property.
+
+ * org-colview.el (org-columns-display-here): Use
+ `org-columns-modify-value-for-display-function'.
+
+ * org-colview-xemacs.el (org-columns-display-here): Use
+ `org-columns-modify-value-for-display-function'.
+
+ * org.el (org-columns-modify-value-for-display-function): New option.
+
+
+ * org-publish.el (org-publish-file): Make sure the directory match
+ for the publishing directory works correctly.
+
+ * org-agenda.el (org-agenda-execute-calendar-command)
+ (org-agenda-diary-entry): Additional optional argument.
+
+2008-07-24 Carsten Dominik <dominik@science.uva.nl>
+
+ * org-exp.el (org-export-as-html): Add attributes also in mailto
+ and ftp links.
+
+ * org.el (org-autoload): Add `org-dblock-write:columnview'.
+
+
2008-08-11 Glenn Morris <rgm@gnu.org>
* org-mac-message.el (do-applescript): Fix declaration.
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 9a7ed8b6b98..3a244302e93 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -6,7 +6,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -149,6 +149,7 @@ you can \"misuse\" it to also add other text to the header. However,
(const category-keep) (const category-up) (const category-down)
(const tag-down) (const tag-up)
(const priority-up) (const priority-down)
+ (const todo-state-up) (const todo-state-down)
(const effort-up) (const effort-down))
"Sorting choices.")
@@ -730,6 +731,8 @@ tag-up Sort alphabetically by last tag, A-Z.
tag-down Sort alphabetically by last tag, Z-A.
priority-up Sort numerically by priority, high priority last.
priority-down Sort numerically by priority, high priority first.
+todo-state-up Sort by todo state, tasks that are done last.
+todo-state-down Sort by todo state, tasks that are done first.
effort-up Sort numerically by estimated effort, high effort last.
effort-down Sort numerically by estimated effort, high effort first.
@@ -938,8 +941,11 @@ it means that the tags should be flushright to that column. For example,
(defcustom org-agenda-fontify-priorities t
"Non-nil means, highlight low and high priorities in agenda.
When t, the highest priority entries are bold, lowest priority italic.
-This may also be an association list of priority faces. The face may be
-a names face, or a list like `(:background \"Red\")'."
+This may also be an association list of priority faces, whose
+keys are the character values of `org-highest-priority',
+`org-default-priority', and `org-lowest-priority' (the default values
+are ?A, ?B, and ?C, respectively). The face may be a names face,
+or a list like `(:background \"Red\")'."
:group 'org-agenda-line-format
:type '(choice
(const :tag "Never" nil)
@@ -1126,6 +1132,7 @@ The following commands are available:
(org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags)
(org-defkey org-agenda-mode-map "n" 'next-line)
(org-defkey org-agenda-mode-map "p" 'previous-line)
+(org-defkey org-agenda-mode-map "\C-c\C-a" 'org-attach)
(org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line)
(org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line)
(org-defkey org-agenda-mode-map "," 'org-agenda-priority)
@@ -1159,6 +1166,7 @@ The following commands are available:
(org-defkey org-agenda-mode-map "]" 'org-agenda-manipulate-query-subtract)
(org-defkey org-agenda-mode-map "{" 'org-agenda-manipulate-query-add-re)
(org-defkey org-agenda-mode-map "}" 'org-agenda-manipulate-query-subtract-re)
+(org-defkey org-agenda-mode-map "/" 'org-agenda-filter-by-tag)
(defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
"Local keymap for agenda entries from Org-mode.")
@@ -1497,7 +1505,7 @@ Press key for an agenda command: < Buffer, subtree/region restriction
-------------------------------- > Remove restriction
a Agenda for current week or day e Export agenda views
t List of all TODO entries T Entries with special TODO kwd
-m Match a TAGS query M Like m, but only TODO entries
+m Match a TAGS/PROP/TODO query M Like m, but only TODO entries
L Timeline for current buffer # List stuck projects (!=configure)
s Search for keywords C Configure custom agenda commands
/ Multi-occur
@@ -1879,6 +1887,7 @@ higher priority settings."
(t
(let ((bs (buffer-string)))
(find-file file)
+ (erase-buffer)
(insert bs)
(save-buffer 0)
(kill-buffer (current-buffer))
@@ -3133,7 +3142,7 @@ the documentation of `org-diary'."
"\\)\\>"))
org-not-done-regexp)
"[^\n\r]*\\)"))
- marker priority category tags
+ marker priority category tags todo-state
ee txt beg end)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
@@ -3158,11 +3167,12 @@ the documentation of `org-diary'."
category (org-get-category)
tags (org-get-tags-at (point))
txt (org-format-agenda-item "" (match-string 1) category tags)
- priority (1+ (org-get-priority txt)))
+ priority (1+ (org-get-priority txt))
+ todo-state (org-get-todo-state))
(org-add-props txt props
'org-marker marker 'org-hd-marker marker
'priority priority 'org-category category
- 'type "todo")
+ 'type "todo" 'todo-state todo-state)
(push txt ee)
(if org-agenda-todo-list-sublevels
(goto-char (match-end 1))
@@ -3204,7 +3214,8 @@ the documentation of `org-diary'."
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
marker hdmarker deadlinep scheduledp clockp closedp inactivep
- donep tmp priority category ee txt timestr tags b0 b3 e3 head)
+ donep tmp priority category ee txt timestr tags b0 b3 e3 head
+ todo-state)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(setq b0 (match-beginning 0)
@@ -3234,7 +3245,8 @@ the documentation of `org-diary'."
clockp (and org-agenda-include-inactive-timestamps
(or (string-match org-clock-string tmp)
(string-match "]-+\\'" tmp)))
- donep (org-entry-is-done-p))
+ todo-state (org-get-todo-state)
+ donep (member todo-state org-done-keywords))
(if (or scheduledp deadlinep closedp clockp)
(throw :skip t))
(if (string-match ">" timestr)
@@ -3259,6 +3271,7 @@ the documentation of `org-diary'."
'org-marker marker 'org-hd-marker hdmarker)
(org-add-props txt nil 'priority priority
'org-category category 'date date
+ 'todo-state todo-state
'type "timestamp")
(push txt ee))
(outline-next-heading)))
@@ -3325,7 +3338,7 @@ the documentation of `org-diary'."
(list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
1 11))))
marker hdmarker priority category tags closedp
- ee txt timestr rest)
+ ee txt timestr rest clocked)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -3341,10 +3354,11 @@ the documentation of `org-diary'."
(setq rest (substring timestr (match-end 0))
timestr (substring timestr 0 (match-end 0)))
(if (and (not closedp)
- (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\]" rest))
- (setq timestr (concat (substring timestr 0 -1)
- "-" (match-string 1 rest) "]"))))
-
+ (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" rest))
+ (progn (setq timestr (concat (substring timestr 0 -1)
+ "-" (match-string 1 rest) "]"))
+ (setq clocked (match-string 2 rest)))
+ (setq clocked "-")))
(save-excursion
(if (re-search-backward "^\\*+ " nil t)
(progn
@@ -3353,7 +3367,8 @@ the documentation of `org-diary'."
tags (org-get-tags-at))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq txt (org-format-agenda-item
- (if closedp "Closed: " "Clocked: ")
+ (if closedp "Closed: "
+ (concat "Clocked: (" clocked ")"))
(match-string 1) category tags timestr)))
(setq txt org-agenda-no-heading-message))
(setq priority 100000)
@@ -3377,10 +3392,10 @@ the documentation of `org-diary'."
(format "mouse-2 or RET jump to org file %s"
(abbreviate-file-name buffer-file-name))))
(regexp org-deadline-time-regexp)
- (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+ (todayp (org-agenda-todayp date)) ; DATE bound by calendar
(d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
d2 diff dfrac wdays pos pos1 category tags
- ee txt head face s upcomingp donep timestr)
+ ee txt head face s todo-state upcomingp donep timestr)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -3402,6 +3417,7 @@ the documentation of `org-diary'."
(= diff 0))
(save-excursion
(setq category (org-get-category))
+ (setq todo-state (org-get-todo-state))
(if (re-search-backward "^\\*+[ \t]+" nil t)
(progn
(goto-char (match-end 0))
@@ -3411,7 +3427,7 @@ the documentation of `org-diary'."
(point)
(progn (skip-chars-forward "^\r\n")
(point))))
- (setq donep (string-match org-looking-at-done-regexp head))
+ (setq donep (member todo-state org-done-keywords))
(if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
(setq timestr
(concat (substring s (match-beginning 1)) " "))
@@ -3427,7 +3443,8 @@ the documentation of `org-diary'."
(funcall (nth 1 org-agenda-deadline-leaders) diff date)
(format (nth 1 org-agenda-deadline-leaders)
diff)))
- head category tags timestr))))
+ head category tags
+ (if (not (= diff 0)) nil timestr)))))
(setq txt org-agenda-no-heading-message))
(when txt
(setq face (org-agenda-deadline-face dfrac wdays))
@@ -3437,6 +3454,7 @@ the documentation of `org-diary'."
'priority (+ (- diff)
(org-get-priority txt))
'org-category category
+ 'todo-state todo-state
'type (if upcomingp "upcoming-deadline" "deadline")
'date (if upcomingp date d2)
'face (if donep 'org-done face)
@@ -3465,10 +3483,10 @@ FRACTION is what fraction of the head-warning time has passed."
(format "mouse-2 or RET jump to org file %s"
(abbreviate-file-name buffer-file-name))))
(regexp org-scheduled-time-regexp)
- (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+ (todayp (org-agenda-todayp date)) ; DATE bound by calendar
(d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
- d2 diff pos pos1 category tags
- ee txt head pastschedp donep face timestr s)
+ d2 diff pos pos1 category tags donep
+ ee txt head pastschedp todo-state face timestr s)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -3488,6 +3506,7 @@ FRACTION is what fraction of the head-warning time has passed."
(= diff 0))
(save-excursion
(setq category (org-get-category))
+ (setq todo-state (org-get-todo-state))
(if (re-search-backward "^\\*+[ \t]+" nil t)
(progn
(goto-char (match-end 0))
@@ -3496,7 +3515,7 @@ FRACTION is what fraction of the head-warning time has passed."
(setq head (buffer-substring-no-properties
(point)
(progn (skip-chars-forward "^\r\n") (point))))
- (setq donep (string-match org-looking-at-done-regexp head))
+ (setq donep (member todo-state org-done-keywords))
(if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
(setq timestr
(concat (substring s (match-beginning 1)) " "))
@@ -3510,12 +3529,15 @@ FRACTION is what fraction of the head-warning time has passed."
(car org-agenda-scheduled-leaders)
(format (nth 1 org-agenda-scheduled-leaders)
(- 1 diff)))
- head category tags timestr))))
+ head category tags
+ (if (not (= diff 0)) nil timestr)))))
(setq txt org-agenda-no-heading-message))
(when txt
- (setq face (if pastschedp
- 'org-scheduled-previously
- 'org-scheduled-today))
+ (setq face
+ (cond
+ (pastschedp 'org-scheduled-previously)
+ (todayp 'org-scheduled-today)
+ (t 'org-scheduled)))
(org-add-props txt props
'undone-face face
'face (if donep 'org-done face)
@@ -3524,7 +3546,8 @@ FRACTION is what fraction of the head-warning time has passed."
'type (if pastschedp "past-scheduled" "scheduled")
'date (if pastschedp d2 date)
'priority (+ 94 (- 5 diff) (org-get-priority txt))
- 'org-category category)
+ 'org-category category
+ 'todo-state todo-state)
(push txt ee))))))
(nreverse ee)))
@@ -3541,7 +3564,7 @@ FRACTION is what fraction of the head-warning time has passed."
(abbreviate-file-name buffer-file-name))))
(regexp org-tr-regexp)
(d0 (calendar-absolute-from-gregorian date))
- marker hdmarker ee txt d1 d2 s1 s2 timestr category tags pos
+ marker hdmarker ee txt d1 d2 s1 s2 timestr category todo-state tags pos
donep head)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
@@ -3559,6 +3582,7 @@ FRACTION is what fraction of the head-warning time has passed."
(save-excursion
(setq marker (org-agenda-new-marker (point)))
(setq category (org-get-category))
+ (setq todo-state (org-get-todo-state))
(if (re-search-backward "^\\*+ " nil t)
(progn
(goto-char (match-beginning 0))
@@ -3578,6 +3602,7 @@ FRACTION is what fraction of the head-warning time has passed."
(org-add-props txt props
'org-marker marker 'org-hd-marker hdmarker
'type "block" 'date date
+ 'todo-state todo-state
'priority (org-get-priority txt) 'org-category category)
(push txt ee)))
(goto-char pos)))
@@ -3839,15 +3864,16 @@ HH:MM."
(mapconcat 'identity (sort list 'org-entries-lessp) "\n")))
(defun org-agenda-highlight-todo (x)
- (let (re pl)
+ (let ((org-done-keywords org-done-keywords-for-agenda)
+ re pl)
(if (eq x 'line)
(save-excursion
(beginning-of-line 1)
(setq re (get-text-property (point) 'org-todo-regexp))
(goto-char (+ (point) (or (get-text-property (point) 'prefix-length) 0)))
- (when (looking-at (concat "[ \t]*\\.*" re " +"))
+ (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
(add-text-properties (match-beginning 0) (match-end 0)
- (list 'face (org-get-todo-face 0)))
+ (list 'face (org-get-todo-face 1)))
(let ((s (buffer-substring (match-beginning 1) (match-end 1))))
(delete-region (match-beginning 1) (1- (match-end 0)))
(goto-char (match-beginning 1))
@@ -3893,6 +3919,20 @@ HH:MM."
((string-lessp cb ca) +1)
(t nil))))
+(defsubst org-cmp-todo-state (a b)
+ "Compare the todo states of strings A and B."
+ (let* ((ta (or (get-text-property 1 'todo-state a) ""))
+ (tb (or (get-text-property 1 'todo-state b) ""))
+ (la (- (length (member ta org-todo-keywords-for-agenda))))
+ (lb (- (length (member tb org-todo-keywords-for-agenda))))
+ (donepa (member ta org-done-keywords-for-agenda))
+ (donepb (member tb org-done-keywords-for-agenda)))
+ (cond ((and donepa (not donepb)) -1)
+ ((and (not donepa) donepb) +1)
+ ((< la lb) -1)
+ ((< lb la) +1)
+ (t nil))))
+
(defsubst org-cmp-tag (a b)
"Compare the string values of categories of strings A and B."
(let ((ta (car (last (get-text-property 1 'tags a))))
@@ -3926,7 +3966,9 @@ HH:MM."
(category-down (if category-up (- category-up) nil))
(category-keep (if category-up +1 nil))
(tag-up (org-cmp-tag a b))
- (tag-down (if tag-up (- tag-up) nil)))
+ (tag-down (if tag-up (- tag-up) nil))
+ (todo-state-up (org-cmp-todo-state a b))
+ (todo-state-down (if todo-state-up (- todo-state-up) nil)))
(cdr (assoc
(eval (cons 'or org-agenda-sorting-strategy-selected))
'((-1 . t) (1 . nil) (nil . nil))))))
@@ -4073,6 +4115,63 @@ When this is the global TODO list, a prefix argument will be interpreted."
(goto-line line)
(recenter window-line)))
+(defvar org-global-tags-completion-table nil)
+(defun org-agenda-filter-by-tag (strip &optional char)
+ "Keep only those lines in the agenda buffer that have a specific tag.
+The tag is selected with its fast selection letter, as configured.
+With prefix argument STRIP, remove all lines that do have the tag."
+ (interactive "P")
+ (let (char a tag tags (inhibit-read-only t))
+ (message "Select tag [%s] or no tag [ ], [TAB] to complete, [/] to restore: "
+ (mapconcat
+ (lambda (x) (if (cdr x) (char-to-string (cdr x)) ""))
+ org-tag-alist-for-agenda ""))
+ (setq char (read-char))
+ (when (equal char ?\t)
+ (unless (local-variable-p 'org-global-tags-completion-table)
+ (org-set-local 'org-global-tags-completion-table
+ (org-global-tags-completion-table)))
+ (let ((completion-ignore-case t))
+ (setq tag (completing-read
+ "Tag: " org-global-tags-completion-table))))
+ (cond
+ ((equal char ?/) (org-agenda-filter-by-tag-show-all))
+ ((or (equal char ?\ )
+ (setq a (rassoc char org-tag-alist-for-agenda))
+ (and tag (setq a (cons tag nil))))
+ (org-agenda-filter-by-tag-show-all)
+ (setq tag (car a))
+ (save-excursion
+ (goto-char (point-min))
+ (while (not (eobp))
+ (if (get-text-property (point) 'org-marker)
+ (progn
+ (setq tags (get-text-property (point) 'tags))
+ (if (not tag)
+ (if (or (and strip (not tags))
+ (and (not strip) tags))
+ (org-agenda-filter-by-tag-hide-line))
+ (if (or (and (member tag tags) strip)
+ (and (not (member tag tags)) (not strip)))
+ (org-agenda-filter-by-tag-hide-line)))
+ (beginning-of-line 2))
+ (beginning-of-line 2)))))
+ (t (error "Invalid tag selection character %c" char)))))
+
+(defvar org-agenda-filter-overlays nil)
+
+(defun org-agenda-filter-by-tag-hide-line ()
+ (let (ov)
+ (setq ov (org-make-overlay (max (point-min) (1- (point-at-bol)))
+ (point-at-eol)))
+ (org-overlay-put ov 'invisible t)
+ (org-overlay-put ov 'type 'tags-filter)
+ (push ov org-agenda-filter-overlays)))
+
+(defun org-agenda-filter-by-tag-show-all ()
+ (mapc 'org-delete-overlay org-agenda-filter-overlays)
+ (setq org-agenda-filter-overlays nil))
+
(defun org-agenda-manipulate-query-add ()
"Manipulate the query by adding a search term with positive selection.
Positive selection means, the term must be matched for selection of an entry."
@@ -4768,8 +4867,12 @@ the new TODO state."
(if line (point-at-eol) nil) t)
(add-text-properties
(match-beginning 2) (match-end 2)
- (list 'face (delq nil (list 'org-tag (get-text-property
- (match-beginning 2) 'face)))))
+ (list 'face (delq nil (adjoin 'org-tag
+ (let ((prop (get-text-property
+ (match-beginning 2) 'face)))
+ (if (listp prop)
+ prop
+ (list prop)))))))
(setq l (- (match-end 2) (match-beginning 2))
c (if (< org-agenda-tags-column 0)
(- (abs org-agenda-tags-column) l)
@@ -5265,7 +5368,7 @@ belonging to the \"Work\" category."
(org-deadline-warning-days 0)
(today (org-date-to-gregorian
(time-to-days (current-time))))
- (files (org-agenda-files)) entries file)
+ (files (org-agenda-files 'unrestricted)) entries file)
;; Get all entries which may contain an appt
(while (setq file (pop files))
(setq entries
@@ -5276,7 +5379,7 @@ belonging to the \"Work\" category."
;; Map thru entries and find if we should filter them out
(mapc
(lambda(x)
- (let* ((evt (org-trim (get-text-property 1 'txt x)))
+ (let* ((evt (org-trim (or (get-text-property 1 'txt x) "")))
(cat (get-text-property 1 'org-category x))
(tod (get-text-property 1 'time-of-day x))
(ok (or (null filter)
@@ -5289,9 +5392,9 @@ belonging to the \"Work\" category."
;; FIXME: Shall we remove text-properties for the appt text?
;; (setq evt (set-text-properties 0 (length evt) nil evt))
(when (and ok tod)
- (setq tod (number-to-string tod)
+ (setq tod (concat "00" (number-to-string tod))
tod (when (string-match
- "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod)
+ "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)\\'" tod)
(concat (match-string 1 tod) ":"
(match-string 2 tod))))
(appt-add tod evt)
@@ -5301,10 +5404,20 @@ belonging to the \"Work\" category."
(message "No event to add")
(message "Added %d event%s for today" cnt (if (> cnt 1) "s" "")))))
+(defun org-agenda-todayp (date)
+ "Does DATE mean today, when considering `org-extend-today-until'?"
+ (let (today h)
+ (if (listp date) (setq date (calendar-absolute-from-gregorian date)))
+ (setq today (calendar-absolute-from-gregorian (calendar-current-date)))
+ (setq h (nth 2 (decode-time (current-time))))
+ (or (and (>= h org-extend-today-until)
+ (= date today))
+ (and (< h org-extend-today-until)
+ (= date (1- today))))))
+
(provide 'org-agenda)
;; arch-tag: 77f7565d-7c4b-44af-a2df-9f6f7070cff1
;;; org-agenda.el ends here
-
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index 3cd44dafd3e..91705775e00 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -353,6 +353,7 @@ sibling does not exist, it will be created at the end of the subtree."
(current-time)))
(outline-up-heading 1 t)
(hide-subtree)
+ (org-cycle-show-empty-lines 'folded)
(goto-char pos))))
(defun org-archive-all-done (&optional tag)
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index 947b55933ce..fa72ba57086 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -6,7 +6,7 @@
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -276,6 +276,7 @@ This is used by Org to re-create the anniversary hash table."
;;;###autoload
(defun org-bbdb-anniversaries()
"Extract anniversaries from BBDB for display in the agenda."
+ (require 'bbdb)
(require 'diary-lib)
(unless (hash-table-p org-bbdb-anniv-hash)
(setq org-bbdb-anniv-hash
@@ -290,11 +291,15 @@ This is used by Org to re-create the anniversary hash table."
(y (nth 2 date)) ; year
(annivs (gethash (list m d) org-bbdb-anniv-hash))
(text ())
- split class form rec)
+ split class form rec recs)
;; we don't want to miss people born on Feb. 29th
- (when (and (= m 3) (= d 1) (not (calendar-leap-year-p y)))
- (setq annivs (cons annivs (gethash (list 2 29) org-bbdb-anniv-hash))))
+ (when (and (= m 3) (= d 1)
+ (not (null (gethash (list 2 29) org-bbdb-anniv-hash)))
+ (not (calendar-leap-year-p y)))
+ (setq recs (gethash (list 2 29) org-bbdb-anniv-hash))
+ (while (setq rec (pop recs))
+ (push rec annivs)))
(when annivs
(while (setq rec (pop annivs))
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index 6c067f533df..3b92b9c3430 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -5,7 +5,7 @@
;; Author: Bastien Guerry <bzg at altern dot org>
;; Carsten Dominik <carsten dot dominik at gmail dot com>
;; Keywords: org, wp, remember
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index dcaa8a08140..4a14100e2bf 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -86,6 +86,10 @@ The function is called with point at the beginning of the headline."
:group 'org-clock
:type 'function)
+(defcustom org-clock-string-limit 0
+ "Maximum length of clock strings in the modeline. 0 means no limit"
+ :group 'org-clock
+ :type 'integer)
;;; The clock for measuring work time.
@@ -94,6 +98,7 @@ The function is called with point at the beginning of the headline."
(defvar org-mode-line-timer nil)
(defvar org-clock-heading "")
+(defvar org-clock-heading-for-remember "")
(defvar org-clock-start-time "")
(defvar org-clock-history nil
@@ -107,6 +112,9 @@ of a different task.")
(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)
+
(defun org-clock-history-push (&optional pos buffer)
"Push a marker to the clock history."
(setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
@@ -190,15 +198,24 @@ of a different task.")
(when (and cat task)
(insert (format "[%c] %-15s %s\n" i cat task))
(cons i marker)))))
-
+
(defun org-update-mode-line ()
(let* ((delta (- (time-to-seconds (current-time))
- (time-to-seconds org-clock-start-time)))
+ (time-to-seconds org-clock-start-time)))
(h (floor delta 3600))
(m (floor (- delta (* 3600 h)) 60)))
(setq org-mode-line-string
- (propertize (format (concat "-[" org-time-clocksum-format " (%s)]") h m org-clock-heading)
- 'help-echo "Org-mode clock is running"))
+ (org-propertize
+ (let ((clock-string (format (concat "-[" org-time-clocksum-format " (%s)]")
+ h m org-clock-heading))
+ (help-text "Org-mode clock is running. Mouse-2 to go there."))
+ (if (and (> org-clock-string-limit 0)
+ (> (length clock-string) org-clock-string-limit))
+ (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
+ 'mouse-face '(face mode-line-highlight)))
(force-mode-line-update)))
(defvar org-clock-mode-line-entry nil
@@ -253,13 +270,18 @@ the clocking selection, associated with the letter `d'."
org-clock-in-switch-to-state
"\\>"))))
(org-todo org-clock-in-switch-to-state))
- (if (and org-clock-heading-function
- (functionp org-clock-heading-function))
- (setq org-clock-heading (funcall org-clock-heading-function))
- (if (looking-at org-complex-heading-regexp)
- (setq org-clock-heading (match-string 4))
- (setq org-clock-heading "???")))
- (setq org-clock-heading (propertize org-clock-heading 'face nil))
+ (setq org-clock-heading-for-remember
+ (and (looking-at org-complex-heading-regexp)
+ (match-end 4)
+ (org-trim (buffer-substring (match-end 1) (match-end 4)))))
+ (setq org-clock-heading
+ (cond ((and org-clock-heading-function
+ (functionp org-clock-heading-function))
+ (funcall org-clock-heading-function))
+ ((looking-at org-complex-heading-regexp)
+ (match-string 4))
+ (t "???")))
+ (setq org-clock-heading (org-propertize org-clock-heading 'face nil))
(org-clock-find-position)
(insert "\n") (backward-char 1)
@@ -306,6 +328,7 @@ the clocking selection, associated with the letter `d'."
;; Wrap current entries into a new drawer
(goto-char last)
(beginning-of-line 2)
+ (if (org-at-item-p) (org-end-of-item))
(insert ":END:\n")
(beginning-of-line 0)
(org-indent-line-function)
@@ -368,7 +391,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(delete-char 1)))
(move-marker org-clock-marker nil)
(when org-log-note-clock-out
- (org-add-log-setup '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))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 5c6d46becbf..18c14ccaeb7 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -147,7 +147,7 @@ This is the compiled version of the format.")
(face (list color 'org-column ref-face))
(pl (or (get-text-property (point-at-bol) 'prefix-length) 0))
(cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
- pom property ass width f string ov column val modval s1 s2)
+ pom property ass width f string ov column val modval s1 s2 title)
;; Check if the entry is in another buffer.
(unless props
(if (eq major-mode 'org-agenda-mode)
@@ -158,6 +158,7 @@ This is the compiled version of the format.")
;; Walk the format
(while (setq column (pop fmt))
(setq property (car column)
+ title (nth 1 column)
ass (if (equal property "ITEM")
(cons "ITEM"
(save-match-data
@@ -171,12 +172,18 @@ This is the compiled version of the format.")
(length property))
f (format "%%-%d.%ds | " width width)
val (or (cdr ass) "")
- modval (if (equal property "ITEM")
- (if (org-mode-p)
- (org-columns-cleanup-item
- val org-columns-current-fmt-compiled)
- (org-agenda-columns-cleanup-item
- val pl cphr org-columns-current-fmt-compiled))))
+ modval (or (and org-columns-modify-value-for-display-function
+ (functionp
+ org-columns-modify-value-for-display-function)
+ (funcall
+ org-columns-modify-value-for-display-function
+ title val))
+ (if (equal property "ITEM")
+ (if (org-mode-p)
+ (org-columns-cleanup-item
+ val org-columns-current-fmt-compiled)
+ (org-agenda-columns-cleanup-item
+ val pl cphr org-columns-current-fmt-compiled)))))
(setq s2 (org-columns-add-ellipses (or modval val) width))
(setq string (format f s2))
;; Create the overlay
@@ -531,7 +538,8 @@ an integer, select that value."
(and (memq
(nth 4 (assoc key org-columns-current-fmt-compiled))
'(checkbox checkbox-n-of-m checkbox-percent))
- '("[ ]" "[X]"))))
+ '("[ ]" "[X]"))
+ (org-colview-construct-allowed-dates value)))
nval)
(when (integerp nth)
(setq nth (1- nth))
@@ -580,6 +588,27 @@ an integer, select that value."
(and (nth 3 (assoc key org-columns-current-fmt-compiled))
(org-columns-update key))))))
+(defun org-colview-construct-allowed-dates (s)
+ "Construct a list of three dates around the date in S.
+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)
+ (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))
+ time-before time-after)
+ (unless active (setq fmt (concat "[" (substring fmt 1 -1) "]")))
+ (setf (car time) (or (car time) 0))
+ (setf (nth 1 time) (or (nth 1 time) 0))
+ (setf (nth 2 time) (or (nth 2 time) 0))
+ (setq time-before (copy-sequence time))
+ (setq time-after (copy-sequence time))
+ (setf (nth 3 time-before) (1- (nth 3 time)))
+ (setf (nth 3 time-after) (1+ (nth 3 time)))
+ (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
+ (list time-before time time-after)))))
+
(defun org-verify-version (task)
(cond
((eq task 'columns)
@@ -595,7 +624,6 @@ an integer, select that value."
(defun org-columns-get-format-and-top-level ()
(let (fmt)
(when (condition-case nil (org-back-to-heading) (error nil))
- (move-marker org-entry-property-inherited-from nil)
(setq fmt (org-entry-get nil "COLUMNS" t)))
(setq fmt (or fmt org-columns-default-format))
(org-set-local 'org-columns-current-fmt fmt)
@@ -1052,8 +1080,9 @@ PARAMS is a property list of parameters:
(hlines (plist-get params :hlines))
(vlines (plist-get params :vlines))
(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)
+ tbl id idpos nfields tmp recalc line)
(save-excursion
(save-restriction
(when (setq id (plist-get params :id))
@@ -1088,12 +1117,22 @@ PARAMS is a property list of parameters:
tbl))
(setq tbl (append tbl (list (cons "/" (make-list nfields "<>"))))))
(setq pos (point))
+ (when content-lines
+ (while (string-match "^#" (car content-lines))
+ (insert (pop content-lines) "\n")))
(insert (org-listtable-to-string tbl))
(when (plist-get params :width)
(insert "\n|" (mapconcat (lambda (x) (format "<%d>" (max 3 x)))
org-columns-current-widths "|")))
- (goto-char pos)
- (org-table-align))))
+ (while (setq line (pop content-lines))
+ (when (string-match "^#" line)
+ (insert "\n" line)
+ (when (string-match "^#\\+TBLFM" line)
+ (setq recalc t))))
+ (if recalc
+ (progn (goto-char pos) (org-table-recalculate 'all))
+ (goto-char pos)
+ (org-table-align)))))
(defun org-listtable-to-string (tbl)
"Convert a listtable TBL to a string that contains the Org-mode table.
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index a80f671aceb..22348e5f19d 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -30,6 +30,8 @@
;;; Code:
+(require 'org-macs)
+
(defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
(defconst org-format-transports-properties-p
(let ((x "a"))
@@ -245,6 +247,22 @@ that can be added."
(set-extent-property (car ext-inv-spec) 'invisible
(cadr ext-inv-spec))))
(move-to-column column force)))
+
+(defun org-get-x-clipboard-compat (value)
+ "Get the clipboard value on XEmacs or Emacs 21"
+ (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+ ((fboundp 'x-get-selection)
+ (condition-case nil
+ (or (x-get-selection value 'UTF8_STRING)
+ (x-get-selection value 'COMPOUND_TEXT)
+ (x-get-selection value 'STRING)
+ (x-get-selection value 'TEXT))
+ (error nil)))))
+
+(defun org-propertize (string &rest properties)
+ (if (featurep 'xemacs)
+ (add-text-properties 0 (length string) properties string)
+ (apply 'propertize string properties)))
(provide 'org-compat)
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index bfdeb1271e8..081b33309ea 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -64,6 +64,24 @@ force an export command into the current process."
:group 'org-export-general
:type 'boolean)
+
+(defcustom org-export-select-tags '("export")
+ "Tags that select a tree for export.
+If any such tag is found in a buffer, all trees that do not carry one
+of these tags will be deleted before export.
+Inside trees that are selected like this, you can still deselect a
+subtree by tagging it with one of the `org-export-excude-tags'."
+ :group 'org-export-general
+ :type '(repeat (string :tag "Tag")))
+
+(defcustom org-export-exclude-tags '("noexport")
+ "Tags that exclude a tree from export.
+All trees carrying any of these tags will be excluded from export.
+This is without contition, so even subtrees inside that carry one of the
+`org-export-select-tags' will be removed."
+ :group 'org-export-general
+ :type '(repeat (string :tag "Tag")))
+
(defcustom org-export-with-special-strings t
"Non-nil means, interpret \"\-\", \"--\" and \"---\" for export.
When this option is turned on, these strings will be exported as:
@@ -494,6 +512,13 @@ Org-mode file."
table { border-collapse: collapse; }
td, th { vertical-align: top; }
dt { font-weight: bold; }
+
+ .org-info-js_info-navigation { border-style:none; }
+ #org-info-js_console-label { font-size:10px; font-weight:bold;
+ white-space:nowrap; }
+ .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
+ font-weight:bold; }
+
</style>"
"The default style specification for exported HTML files.
Please use the variables `org-export-html-style' and
@@ -540,6 +565,7 @@ settings with <style>...</style> tags."
;;;###autoload
(put 'org-export-html-style-extra 'safe-local-variable 'stringp)
+
(defcustom org-export-html-title-format "<h1 class=\"title\">%s</h1>\n"
"Format for typesetting the document title in HTML export."
:group 'org-export-html
@@ -687,6 +713,22 @@ todo-start Scheduling time stamps in TODO entries become start date.
(const :tag "SCHEDULED in TODO entries become start date"
todo-start)))
+(defcustom org-icalendar-categories '(local-tags category)
+ "Items that should be entered into the categories field.
+This is a list of symbols, the following are valid:
+
+category The Org-mode category of the current file or tree
+todo-state The todo state, if any
+local-tags The tags, defined in the current line
+all-tags All tags, including inherited ones."
+ :group 'org-export-icalendar
+ :type '(repeat
+ (choice
+ (const :tag "The file or tree category" category)
+ (const :tag "The TODO state" todo-state)
+ (const :tag "Tags defined in current line" local-tags)
+ (const :tag "All tags, including inherited ones" all-tags))))
+
(defcustom org-icalendar-include-todo nil
"Non-nil means, export to iCalendar files should also cover TODO items."
:group 'org-export-icalendar
@@ -733,9 +775,9 @@ or if they are only using it locally."
(defconst org-level-max 20)
(defvar org-export-html-preamble nil
- "Preamble, to be inserted just after <body>. Set by publishing functions.")
+ "Preamble, to be inserted just before <body>. Set by publishing functions.")
(defvar org-export-html-postamble nil
- "Preamble, to be inserted just before </body>. Set by publishing functions.")
+ "Preamble, to be inserted just after </body>. Set by publishing functions.")
(defvar org-export-html-auto-preamble t
"Should default preamble be inserted? Set by publishing functions.")
(defvar org-export-html-auto-postamble t
@@ -785,7 +827,9 @@ or if they are only using it locally."
(:auto-preamble . org-export-html-auto-preamble)
(:auto-postamble . org-export-html-auto-postamble)
(:author . user-full-name)
- (:email . user-mail-address)))
+ (:email . user-mail-address)
+ (:select-tags . org-export-select-tags)
+ (:exclude-tags . org-export-exclude-tags)))
(defun org-default-export-plist ()
"Return the property list with default settings for the export variables."
@@ -821,9 +865,11 @@ modified) list.")
(let ((re (org-make-options-regexp
(append
'("TITLE" "AUTHOR" "DATE" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"
- "LINK_UP" "LINK_HOME" "SETUPFILE")
+ "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" "LATEX_HEADER"
+ "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS")
(mapcar 'car org-export-inbuffer-options-extra))))
- p key val text options js-up js-main js-css js-opt a pr
+ p key val text options js-up js-main js-css js-opt a pr style
+ latex-header
ext-setup-or-nil setup-contents (start 0))
(while (or (and ext-setup-or-nil
(string-match re ext-setup-or-nil start)
@@ -841,6 +887,10 @@ modified) list.")
((string-equal key "EMAIL") (setq p (plist-put p :email val)))
((string-equal key "DATE") (setq p (plist-put p :date val)))
((string-equal key "LANGUAGE") (setq p (plist-put p :language val)))
+ ((string-equal key "STYLE")
+ (setq style (concat style "\n" val)))
+ ((string-equal key "LATEX_HEADER")
+ (setq latex-header (concat latex-header "\n" val)))
((string-equal key "TEXT")
(setq text (if text (concat text "\n" val) val)))
((string-equal key "OPTIONS")
@@ -849,6 +899,10 @@ modified) list.")
(setq p (plist-put p :link-up val)))
((string-equal key "LINK_HOME")
(setq p (plist-put p :link-home val)))
+ ((string-equal key "EXPORT_SELECT_TAGS")
+ (setq p (plist-put p :select-tags (org-split-string val))))
+ ((string-equal key "EXPORT_EXCLUDE_TAGS")
+ (setq p (plist-put p :exclude-tags (org-split-string val))))
((equal key "SETUPFILE")
(setq setup-contents (org-file-contents
(expand-file-name
@@ -862,6 +916,9 @@ modified) list.")
"\n" setup-contents "\n"
(substring ext-setup-or-nil start)))))))
(setq p (plist-put p :text text))
+ (when style (setq p (plist-put p :style-extra style)))
+ (when latex-header
+ (setq p (plist-put p :latex-header-extra (substring latex-header 1))))
(when options
(setq p (org-export-add-options-to-plist p options)))
p))))
@@ -1345,9 +1402,13 @@ on this string to produce the exported version."
(setq case-fold-search t)
(untabify (point-min) (point-max))
- ;; Handle incude files
+ ;; Handle include files
(org-export-handle-include-files)
+ ;; Get rid of excluded trees
+ (org-export-handle-export-tags (plist-get parameters :select-tags)
+ (plist-get parameters :exclude-tags))
+
;; Handle source code snippets
(org-export-replace-src-segments)
@@ -1377,7 +1438,7 @@ on this string to produce the exported version."
(setq target-alist (org-export-handle-invisible-targets target-alist))
;; Protect examples
- (org-export-protect-examples)
+ (org-export-protect-examples (if asciip 'indent nil))
;; Protect backend specific stuff, throw away the others.
(org-export-select-backend-specific-text
@@ -1395,6 +1456,26 @@ on this string to produce the exported version."
;; 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)
+
+ ;; Find all links that contain a newline and put them into a single line
+ (org-export-concatenate-multiline-links)
+
+ ;; Normalize links: Convert angle and plain links into bracket links
+ ;; and expand link abbreviations
+ (org-export-normalize-links)
+
+ ;; Find all internal links. If they have a fuzzy match (i.e. not
+ ;; a *dedicated* target match, let the link point to the
+ ;; corresponding section.
+ (org-export-target-internal-links target-alist)
+
+ ;; Find multiline emphasis and put them into single line
+ (when (plist-get parameters :emph-multiline)
+ (org-export-concatenate-multiline-emphasis))
+
;; Remove special table lines
(when org-export-table-remove-special-lines
(org-export-remove-special-table-lines))
@@ -1415,24 +1496,6 @@ on this string to produce the exported version."
;; Remove or replace comments
(org-export-handle-comments (plist-get parameters :comments))
- ;; Find matches for radio targets and turn them into internal links
- (org-export-mark-radio-links)
-
- ;; Find all links that contain a newline and put them into a single line
- (org-export-concatenate-multiline-links)
-
- ;; Normalize links: Convert angle and plain links into bracket links
- ;; and expand link abbreviations
- (org-export-normalize-links)
-
- ;; Find all internal links. If they have a fuzzy match (i.e. not
- ;; a *dedicated* target match, let the link point to the
- ;; corresponding section.
- (org-export-target-internal-links target-alist)
-
- ;; Find multiline emphasis and put them into single line
- (when (plist-get parameters :emph-multiline)
- (org-export-concatenate-multiline-emphasis))
(setq rtn (buffer-string)))
(kill-buffer " org-mode-tmp")
@@ -1545,6 +1608,60 @@ whose content to keep."
(while (re-search-forward re nil t)
(replace-match "")))))
+(defun org-export-handle-export-tags (select-tags exclude-tags)
+ "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS.
+Both arguments are lists of tags.
+If any of SELECT-TAGS is found, all trees not marked by a SELECT-TAG
+will be removed.
+After that, all subtrees that are marked by EXCLUDE-TAGS will be
+removed as well."
+ (remove-text-properties (point-min) (point-max) '(:org-delete t))
+ (let* ((re-sel (concat ":\\(" (mapconcat 'regexp-quote
+ select-tags "\\|")
+ "\\):"))
+ (re-excl (concat ":\\(" (mapconcat 'regexp-quote
+ exclude-tags "\\|")
+ "\\):"))
+ beg end cont)
+ (goto-char (point-min))
+ (when (and select-tags
+ (re-search-forward
+ (concat "^\\*+[ \t].*" re-sel "[^ \t\n]*[ \t]*$") nil t))
+ ;; At least one tree is marked for export, this means
+ ;; all the unmarked stuff needs to go.
+ ;; Dig out the trees that should be exported
+ (goto-char (point-min))
+ (outline-next-heading)
+ (setq beg (point))
+ (put-text-property beg (point-max) :org-delete t)
+ (while (re-search-forward re-sel nil t)
+ (when (org-on-heading-p)
+ (org-back-to-heading)
+ (remove-text-properties
+ (max (1- (point)) (point-min))
+ (setq cont (save-excursion (org-end-of-subtree t t)))
+ '(:org-delete t))
+ (while (and (org-up-heading-safe)
+ (get-text-property (point) :org-delete))
+ (remove-text-properties (max (1- (point)) (point-min))
+ (point-at-eol) '(:org-delete t)))
+ (goto-char cont))))
+ ;; Remove the trees explicitly marked for noexport
+ (when exclude-tags
+ (goto-char (point-min))
+ (while (re-search-forward re-excl nil t)
+ (when (org-at-heading-p)
+ (org-back-to-heading t)
+ (setq beg (point))
+ (org-end-of-subtree t)
+ (delete-region beg (point)))))
+ ;; Remove everything that is now still marked for deletion
+ (goto-char (point-min))
+ (while (setq beg (text-property-any (point-min) (point-max) :org-delete t))
+ (setq end (or (next-single-property-change beg :org-delete)
+ (point-max)))
+ (delete-region beg end))))
+
(defun org-export-remove-archived-trees (export-archived-trees)
"Remove archived trees.
When EXPORT-ARCHIVED-TREES is `headline;, only the headline will be exported.
@@ -1582,13 +1699,13 @@ from the buffer."
'(org-protected t))
(goto-char (1+ (match-end 4)))))
-(defun org-export-protect-examples ()
+(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 ": ")
+ (insert (if indent ": " ":"))
(beginning-of-line 2)))
(goto-char (point-min))
(while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t)
@@ -1763,7 +1880,9 @@ can work correctly."
(let ((inhibit-read-only t))
(save-excursion
(goto-char (point-min))
- (let ((end (save-excursion (outline-next-heading) (point))))
+ (let ((end (if (looking-at org-outline-regexp)
+ (point)
+ (save-excursion (outline-next-heading) (point)))))
(when (re-search-forward "^[ \t]*[^|# \t\r\n].*\n" end t)
;; Mark the line so that it will not be exported as normal text.
(org-unmodified
@@ -2104,6 +2223,8 @@ underlined headlines. The default is 3."
(plist-get opt-plist :skip-before-1st-heading)
:drawers (plist-get opt-plist :drawers)
:verbatim-multiline t
+ :select-tags (plist-get opt-plist :select-tags)
+ :exclude-tags (plist-get opt-plist :exclude-tags)
:archived-trees
(plist-get opt-plist :archived-trees)
:add-text (plist-get opt-plist :text))
@@ -2463,9 +2584,10 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
#+EMAIL: %s
#+DATE: %s
#+LANGUAGE: %s
-#+TEXT: Some descriptive text to be emitted. Several lines OK.
#+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 tags:%s
%s
+#+EXPORT_SELECT_TAGS: %s
+#+EXPORT_EXCUDE_TAGS: %s
#+LINK_UP: %s
#+LINK_HOME: %s
#+CATEGORY: %s
@@ -2480,7 +2602,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
#+LINK: %s
"
(buffer-name) (user-full-name) user-mail-address
- (format-time-string (car org-time-stamp-formats))
+ (format-time-string (substring (car org-time-stamp-formats) 1 -1))
org-export-default-language
org-export-headline-levels
org-export-with-section-numbers
@@ -2499,6 +2621,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
org-export-with-drawers
org-export-with-tags
(if (featurep 'org-jsinfo) (org-infojs-options-inbuffer-template) "")
+ (mapconcat 'identity org-export-select-tags " ")
+ (mapconcat 'identity org-export-exclude-tags " ")
org-export-html-link-up
org-export-html-link-home
(file-name-nondirectory buffer-file-name)
@@ -2769,6 +2893,8 @@ PUB-DIR is set, use this as the publishing directory."
:drawers (plist-get opt-plist :drawers)
:archived-trees
(plist-get opt-plist :archived-trees)
+ :select-tags (plist-get opt-plist :select-tags)
+ :exclude-tags (plist-get opt-plist :exclude-tags)
:add-text
(plist-get opt-plist :text)
:LaTeX-fragments
@@ -2930,6 +3056,8 @@ lang=\"%s\" xml:lang=\"%s\">
(setq head-count 0)
(org-init-section-numbers)
+ (org-open-par)
+
(while (setq line (pop lines) origline line)
(catch 'nextline
@@ -2994,11 +3122,11 @@ lang=\"%s\" xml:lang=\"%s\">
(throw 'nextline nil))
(when inverse
(let ((i (org-get-string-indentation line)))
- (if (> i 0)
- (setq line (concat (mapconcat 'identity
- (make-list (* 2 i) "\\nbsp") "")
- " " (org-trim line))))
- (setq line (concat line " \\\\"))))
+ (if (> i 0)
+ (setq line (concat (mapconcat 'identity
+ (make-list (* 2 i) "\\nbsp") "")
+ " " (org-trim line))))
+ (setq line (concat line " \\\\"))))
;; make targets to anchors
(while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
@@ -3306,7 +3434,7 @@ lang=\"%s\" xml:lang=\"%s\">
(org-html-level-start 1 nil umax
(and org-export-with-toc (<= level umax))
head-count)
- ;; the </div> to lose the last text-... div.
+ ;; the </div> to close the last text-... div.
(insert "</div>\n")
(unless body-only
@@ -3329,7 +3457,7 @@ lang=\"%s\" xml:lang=\"%s\">
(nth 2 lang-words) ": "
date "</p>\n"))
(when org-export-creator-info
- (insert (format "<p>HTML generated by org-mode %s in emacs %s<\p>\n"
+ (insert (format "<p>HTML generated by org-mode %s in emacs %s</p>\n"
org-version emacs-major-version)))
(insert "</div>"))
@@ -3338,8 +3466,9 @@ lang=\"%s\" xml:lang=\"%s\">
(insert (or (plist-get opt-plist :postamble) ""))
(insert "</body>\n</html>\n"))
- (normal-mode)
- (if (eq major-mode default-major-mode) (html-mode))
+ (unless (plist-get opt-plist :buffer-will-be-killed)
+ (normal-mode)
+ (if (eq major-mode default-major-mode) (html-mode)))
;; insert the table of contents
(goto-char (point-min))
@@ -3789,7 +3918,8 @@ If there are links in the string, don't modify these."
(setq s (org-export-html-convert-sub-super s)))
(if org-export-with-TeX-macros
(let ((start 0) wd ass)
- (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
+ (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
+ s start))
(if (get-text-property (match-beginning 0) 'org-protected s)
(setq start (match-end 0))
(setq wd (match-string 1 s))
@@ -4074,7 +4204,7 @@ When COMBINE is non nil, add the category to each line."
"DTSTART"))
hd ts ts2 state status (inc t) pos b sexp rrule
scheduledp deadlinep todo prefix due start
- tmp pri category entry location summary desc uid
+ tmp pri categories entry location summary desc uid
(sexp-buffer (get-buffer-create "*ical-tmp*")))
(org-refresh-category-properties)
(save-excursion
@@ -4105,7 +4235,7 @@ When COMBINE is non nil, add the category to each line."
uid (if org-icalendar-store-UID
(org-id-get-create)
(or (org-id-get) (org-id-new)))
- category (org-get-category)
+ categories (org-export-get-categories)
deadlinep nil scheduledp nil)
(if (looking-at re2)
(progn
@@ -4177,7 +4307,7 @@ END:VEVENT\n"
(concat "\nDESCRIPTION: " desc) "")
(if (and location (string-match "\\S-" location))
(concat "\nLOCATION: " location) "")
- category)))))
+ categories)))))
(when (and org-icalendar-include-sexps
(condition-case nil (require 'icalendar) (error nil))
(fboundp 'icalendar-export-region))
@@ -4228,6 +4358,7 @@ END:VEVENT\n"
(org-entry-get nil "DEADLINE"))
start (and (member 'todo-start org-icalendar-use-scheduled)
(org-entry-get nil "SCHEDULED"))
+ categories (org-export-get-categories)
uid (if org-icalendar-store-UID
(org-id-get-create)
(or (org-id-get) (org-id-new))))
@@ -4263,9 +4394,24 @@ END:VTODO\n"
(if (and desc (string-match "\\S-" desc))
(concat "\nDESCRIPTION: " desc) "")
(if due (concat "\n" due) "")
- category
+ categories
pri status)))))))))
+(defun org-export-get-categories ()
+ "Get categories according to `org-icalendar-categories'."
+ (let ((cs org-icalendar-categories) c rtn tmp)
+ (while (setq c (pop cs))
+ (cond
+ ((eq c 'category) (push (org-get-category) rtn))
+ ((eq c 'todo-state)
+ (setq tmp (org-get-todo-state))
+ (and tmp (push tmp rtn)))
+ ((eq c 'local-tags)
+ (setq rtn (append (nreverse (org-get-local-tags-at (point))) rtn)))
+ ((eq c 'all-tags)
+ (setq rtn (append (nreverse (org-get-tags-at (point))) rtn)))))
+ (mapconcat 'identity (nreverse rtn) ",")))
+
(defun org-icalendar-cleanup-string (s &optional is-body maxlength)
"Take out stuff and quote what needs to be quoted.
When IS-BODY is non-nil, assume that this is the body of an item, clean up
diff --git a/lisp/org/org-export-latex.el b/lisp/org/org-export-latex.el
index a0a9e5f988d..09ddd9ada34 100644
--- a/lisp/org/org-export-latex.el
+++ b/lisp/org/org-export-latex.el
@@ -4,7 +4,7 @@
;;
;; Emacs Lisp Archive Entry
;; Filename: org-export-latex.el
-;; Version: 6.06b
+;; Version: 6.09a
;; Author: Bastien Guerry <bzg AT altern DOT org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: org, wp, tex
@@ -60,9 +60,6 @@
(defvar org-export-latex-add-level 0)
(defvar org-export-latex-sectioning "")
(defvar org-export-latex-sectioning-depth 0)
-(defvar org-export-latex-list-beginning-re
- "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +?")
-
(defvar org-export-latex-special-string-regexps
'(org-ts-regexp
org-scheduled-string
@@ -76,6 +73,11 @@
;;; User variables:
+(defgroup org-export-latex nil
+ "Options for exporting Org-mode files to LaTeX."
+ :tag "Org Export LaTeX"
+ :group 'org-export)
+
(defcustom org-export-latex-default-class "article"
"The default LaTeX class."
:group 'org-export-latex
@@ -174,13 +176,12 @@ argument."
:type 'string)
(defcustom org-export-latex-tables-verbatim nil
- "When non-nil, export tables as verbatim."
+ "When non-nil, tables are exported verbatim."
:group 'org-export-latex
:type 'boolean)
(defcustom org-export-latex-tables-column-borders nil
- "When non-nil, group of columns are surrounded with borders,
-XSeven if these borders are the outside borders of the table."
+ "When non-nil, group of columns are surrounded with borders."
:group 'org-export-latex
:type 'boolean)
@@ -191,9 +192,9 @@ Each cell is of the forma \( \"option\" . \"package\" \)."
:type 'alist)
(defcustom org-export-latex-low-levels 'description
- "How to convert sections below the current level of sectioning,
-as specified by `org-export-headline-levels' or the value of \"H:\"
-in Org's #+OPTION line.
+ "How to convert sections below the current level of sectioning.
+This is specified by the `org-export-headline-levels' option or the
+value of \"H:\" in Org's #+OPTION line.
This can be either nil (skip the sections), 'description (convert
the sections as descriptive lists) or a string to be used instead
@@ -223,38 +224,13 @@ Don't remove the keys, just change their values."
:group 'org-export-latex
:type 'coding-system)
-(defcustom org-list-radio-list-templates
- '((latex-mode "% BEGIN RECEIVE ORGLST %n
-% END RECEIVE ORGLST %n
-\\begin{comment}
-#+ORGLST: SEND %n org-list-to-latex
-| | |
-\\end{comment}\n")
- (texinfo-mode "@c BEGIN RECEIVE ORGLST %n
-@c END RECEIVE ORGLST %n
-@ignore
-#+ORGLST: SEND %n org-list-to-texinfo
-| | |
-@end ignore\n")
- (html-mode "<!-- BEGIN RECEIVE ORGLST %n -->
-<!-- END RECEIVE ORGLST %n -->
-<!--
-#+ORGLST: SEND %n org-list-to-html
-| | |
--->\n"))
- "Templates for radio lists in different major modes.
-All occurrences of %n in a template will be replaced with the name of the
-list, obtained by prompting the user."
- :group 'org-plain-lists
- :type '(repeat
- (list (symbol :tag "Major mode")
- (string :tag "Format"))))
-
;;; Autoload functions:
;;;###autoload
(defun org-export-as-latex-batch ()
- "Call `org-export-as-latex', may be used in batch processing as
+ "Call `org-export-as-latex', may be used in batch processing.
+For example:
+
emacs --batch
--load=$HOME/lib/emacs/org.el
--eval \"(setq org-export-headline-levels 2)\"
@@ -369,7 +345,7 @@ when PUB-DIR is set, use this as the publishing directory."
(goto-char rbeg)
(and (org-at-heading-p)
(>= (org-end-of-subtree t t) rend)))))
- (opt-plist (if subtree-p
+ (opt-plist (if subtree-p
(org-export-add-subtree-options opt-plist rbeg)
opt-plist))
;; Make sure the variable contains the updated values.
@@ -424,6 +400,8 @@ when PUB-DIR is set, use this as the publishing directory."
:comments nil
:add-text (if (eq to-buffer 'string) nil text)
:skip-before-1st-heading skip
+ :select-tags (plist-get opt-plist :select-tags)
+ :exclude-tags (plist-get opt-plist :exclude-tags)
:LaTeX-fragments nil)))
(set-buffer buffer)
@@ -563,32 +541,38 @@ and its content."
(mapc (lambda(x) (org-export-latex-subcontent x num)) subcontent)))
(defun org-export-latex-subcontent (subcontent num)
- "Export each cell of SUBCONTENT to LaTeX."
- (let ((heading (org-export-latex-fontify-headline
- (cdr (assoc 'heading subcontent))))
- (level (- (cdr (assoc 'level subcontent))
- org-export-latex-add-level))
- (occur (number-to-string (cdr (assoc 'occur subcontent))))
- (content (cdr (assoc 'content subcontent)))
- (subcontent (cadr (assoc 'subcontent subcontent))))
+ "Export each cell of SUBCONTENT to LaTeX.
+If NUM, export sections as numerical sections."
+ (let* ((heading (org-export-latex-fontify-headline
+ (cdr (assoc 'heading subcontent))))
+ (level (- (cdr (assoc 'level subcontent))
+ org-export-latex-add-level))
+ (occur (number-to-string (cdr (assoc 'occur subcontent))))
+ (content (cdr (assoc 'content subcontent)))
+ (subcontent (cadr (assoc 'subcontent subcontent)))
+ (label (org-get-text-property-any 0 'target heading)))
(cond
;; Normal conversion
((<= level org-export-latex-sectioning-depth)
(let ((sec (nth (1- level) org-export-latex-sectioning)))
(insert (format (if num (car sec) (cdr sec)) heading) "\n"))
+ (when label (insert (format "\\label{%s}\n" label)))
(insert (org-export-latex-content content))
(cond ((stringp subcontent) (insert subcontent))
((listp subcontent) (org-export-latex-sub subcontent))))
;; At a level under the hl option: we can drop this subsection
((> level org-export-latex-sectioning-depth)
(cond ((eq org-export-latex-low-levels 'description)
- (insert (format "\\begin{description}\n\n\\item[%s]\n\n" heading))
+ (insert (format "\\begin{description}\n\n\\item[%s]%s\n\n"
+ heading
+ (if label (format "\\label{%s}" label) "")))
(insert (org-export-latex-content content))
(cond ((stringp subcontent) (insert subcontent))
((listp subcontent) (org-export-latex-sub subcontent)))
(insert "\\end{description}\n"))
((stringp org-export-latex-low-levels)
(insert (format org-export-latex-low-levels heading) "\n")
+ (when label (insert (format "\\label{%s}\n" label)))
(insert (org-export-latex-content content))
(cond ((stringp subcontent) (insert subcontent))
((listp subcontent) (org-export-latex-sub subcontent)))))))))
@@ -643,6 +627,7 @@ OPT-PLIST is the options plist for current buffer."
(car p) (cadr p))))
org-export-latex-packages-alist "\n"))
;; insert additional commands in the header
+ (plist-get opt-plist :latex-header-extra)
org-export-latex-append-header
;; insert the title
(format
@@ -731,8 +716,7 @@ links, keywords, lists, tables, fixed-width"
(buffer-substring (point-min) (point-max))))
(defun org-export-latex-protect-string (s)
- "Prevent further conversion for string S by adding the
-org-protect property."
+ "Add the org-protected property to string S."
(add-text-properties 0 (length s) '(org-protected t) s) s)
(defun org-export-latex-protect-char-in-string (char-list string)
@@ -766,21 +750,16 @@ org-protect property."
(if (or (not org-export-with-tags)
(plist-get remove-list :tags))
(replace-match "")
- (replace-match
+ (replace-match
(org-export-latex-protect-string
- (format "\\texttt{%s}" (save-match-data
- (org-quote-chars (match-string 0)))))
- t t)))))
-
-(defun org-quote-chars (s)
- (let ((start 0))
- (while (string-match "_" s start)
- (setq start (+ 2 (match-beginning 0))
- s (replace-match "\\_" t t s))))
- s)
+ (format "\\texttt{%s}"
+ (save-match-data
+ (replace-regexp-in-string
+ "_" "\\\\_" (match-string 0)))))
+ t t)))))
(defun org-export-latex-fontify-headline (string)
- "Fontify special words in string."
+ "Fontify special words in STRING."
(with-temp-buffer
;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at
;; the beginning of the buffer - inserting "\n" is safe here though.
@@ -793,14 +772,15 @@ org-protect property."
(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-substring-no-properties (point-min) (point-max)))))
+ (org-trim (buffer-string))))
(defun org-export-latex-quotation-marks ()
- "Export question marks depending on language conventions."
+ "Export quotation marks depending on language conventions."
(let* ((lang (plist-get org-export-latex-options-plist :language))
(quote-rpl (if (equal lang "fr")
- '(("\\(\\s-\\)\"" "«~")
- ("\\(\\S-\\)\"" "~»")
+ '(("\\(\\s-\\)\"" "«~")
+ ("\\(\\S-\\)\"" "~»")
("\\(\\s-\\)'" "`"))
'(("\\(\\s-\\)\"" "``")
("\\(\\S-\\)\"" "''")
@@ -861,8 +841,8 @@ See the `org-export-latex.el' code for a complete conversion table."
(replace-match (or (save-match-data
(org-export-latex-treat-sub-super-char
sub-superscript
- (match-string 1)
(match-string 2)
+ (match-string 1)
(match-string 3))) "") t t)))))))
'("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
"\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)"
@@ -879,7 +859,7 @@ See the `org-export-latex.el' code for a complete conversion table."
)))
(defun org-export-latex-treat-sub-super-char
- (subsup string-before char string-after)
+ (subsup char string-before string-after)
"Convert the \"_\" and \"^\" characters to LaTeX.
SUBSUP corresponds to the ^: option in the #+OPTIONS line.
Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
@@ -937,7 +917,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(defun org-export-latex-keywords (timestamps)
"Convert special keywords to LaTeX.
-Regexps are those from `org-export-latex-special-string-regexps'."
+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))
@@ -981,7 +962,7 @@ Regexps are those from `org-export-latex-special-string-regexps'."
(let* ((tbl (concat "\\begin{verbatim}\n" raw-table
"\\end{verbatim}\n")))
(apply 'delete-region (list beg end))
- (insert tbl))
+ (insert (org-export-latex-protect-string tbl)))
(progn
(setq lines (split-string raw-table "\n" t))
(apply 'delete-region (list beg end))
@@ -1028,8 +1009,9 @@ Regexps are those from `org-export-latex-special-string-regexps'."
(split-string (org-trim elem) "|" t)))
lines))
(when insert
- (insert (orgtbl-to-latex
- lines `(:tstart ,(concat "\\begin{tabular}{" align "}")))
+ (insert (org-export-latex-protect-string
+ (orgtbl-to-latex
+ lines `(:tstart ,(concat "\\begin{tabular}{" align "}"))))
"\n\n")))))))
(defun org-export-latex-fontify ()
@@ -1093,7 +1075,11 @@ Regexps are those from `org-export-latex-special-string-regexps'."
;; image option should be set be a comment line
org-export-latex-image-default-option
(expand-file-name raw-path))))
- (radiop (insert (format "\\hyperref[%s]{%s}" raw-path desc)))
+ (radiop (insert (format "\\hyperref[%s]{%s}"
+ (org-solidify-link-text raw-path) desc)))
+ ((not type)
+ (insert (format "\\hyperref[%s]{%s}"
+ (org-solidify-link-text raw-path) desc)))
(path (insert (format "\\href{%s}{%s}" path desc)))
(t (insert "\\texttt{" desc "}")))))))
@@ -1108,6 +1094,15 @@ Regexps are those from `org-export-latex-special-string-regexps'."
(add-text-properties (match-beginning 0) (match-end 0)
'(org-protected t)))
+ ;; Preserve latex environments
+ (goto-char (point-min))
+ (while (search-forward "\\begin{" nil t)
+ (let ((start (progn (beginning-of-line) (point)))
+ (end (or (and (search-forward "\\end{" nil t)
+ (end-of-line) (point))
+ (point-max))))
+ (add-text-properties start end '(org-protected t))))
+
;; Convert LaTeX to \LaTeX{}
(goto-char (point-min))
(let ((case-fold-search nil) rpl)
@@ -1117,18 +1112,18 @@ Regexps are those from `org-export-latex-special-string-regexps'."
;; Convert blockquotes
(goto-char (point-min))
- (while (re-search-forward "^#\\+BEGIN_QUOTE" nil t)
+ (while (search-forward "ORG-BLOCKQUOTE-START" nil t)
(replace-match "\\begin{quote}" t t))
(goto-char (point-min))
- (while (re-search-forward "^#\\+END_QUOTE" nil t)
+ (while (search-forward "ORG-BLOCKQUOTE-END" nil t)
(replace-match "\\end{quote}" t t))
;; Convert verse
(goto-char (point-min))
- (while (re-search-forward "^#\\+BEGIN_VERSE" nil t)
+ (while (search-forward "ORG-VERSE-START" nil t)
(replace-match "\\begin{verse}" t t))
(goto-char (point-min))
- (while (re-search-forward "^#\\+END_VERSE" nil t)
+ (while (search-forward "ORG-VERSE-END" nil t)
(replace-match "\\end{verse}" t t))
;; Convert horizontal rules
@@ -1155,7 +1150,8 @@ Regexps are those from `org-export-latex-special-string-regexps'."
">>>?\\((INVISIBLE)\\)?") nil t)
(replace-match
(org-export-latex-protect-string
- (format "\\label{%s}%s"(match-string 1)
+ (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
@@ -1207,195 +1203,10 @@ Regexps are those from `org-export-latex-special-string-regexps'."
"Replace plain text lists in current buffer into LaTeX lists."
"Convert lists to LaTeX."
(goto-char (point-min))
- (while (re-search-forward org-export-latex-list-beginning-re nil t)
+ (while (re-search-forward org-list-beginning-re nil t)
(beginning-of-line)
(insert (org-list-to-latex (org-list-parse-list t)) "\n")))
-(defun org-list-parse-list (&optional delete)
- "Parse the list at point.
-Return a list containing first level items as strings and
-sublevels as a list of strings."
- (let ((start (org-list-item-begin))
- (end (org-list-end))
- output itemsep)
- (while (re-search-forward org-export-latex-list-beginning-re end t)
- (setq itemsep (if (save-match-data
- (string-match "^[0-9]" (match-string 2)))
- "[0-9]+\\(?:\\.\\|)\\)" "[-+]"))
- (let* ((indent1 (match-string 1))
- (nextitem (save-excursion
- (save-match-data
- (or (and (re-search-forward
- (concat "^" indent1 itemsep " *?") end t)
- (match-beginning 0)) end))))
- (item (buffer-substring
- (point)
- (or (and (re-search-forward
- org-export-latex-list-beginning-re end t)
- (goto-char (match-beginning 0)))
- (goto-char end))))
- (nextindent (match-string 1))
- (item (org-trim item))
- (item (if (string-match "^\\[.+\\]" item)
- (replace-match "\\\\texttt{\\&}"
- t nil item) item)))
- (push item output)
- (when (> (length nextindent)
- (length indent1))
- (narrow-to-region (point) nextitem)
- (push (org-list-parse-list) output)
- (widen))))
- (when delete (delete-region start end))
- (setq output (nreverse output))
- (push (if (string-match "^\\[0" itemsep)
- 'ordered 'unordered) output)))
-
-(defun org-list-item-begin ()
- "Find the beginning of the list item and return its position."
- (save-excursion
- (if (not (or (looking-at org-export-latex-list-beginning-re)
- (re-search-backward
- org-export-latex-list-beginning-re nil t)))
- (progn (goto-char (point-min)) (point))
- (match-beginning 0))))
-
-(defun org-list-end ()
- "Find the end of the list and return its position."
- (save-excursion
- (catch 'exit
- (while (or (looking-at org-export-latex-list-beginning-re)
- (looking-at "^[ \t]+\\|^$"))
- (if (eq (point) (point-max))
- (throw 'exit (point-max)))
- (forward-line 1))) (point)))
-
-(defun org-list-insert-radio-list ()
- "Insert a radio list template appropriate for this major mode."
- (interactive)
- (let* ((e (assq major-mode org-list-radio-list-templates))
- (txt (nth 1 e))
- name pos)
- (unless e (error "No radio list setup defined for %s" major-mode))
- (setq name (read-string "List name: "))
- (while (string-match "%n" txt)
- (setq txt (replace-match name t t txt)))
- (or (bolp) (insert "\n"))
- (setq pos (point))
- (insert txt)
- (goto-char pos)))
-
-(defun org-list-send-list (&optional maybe)
- "Send a tranformed version of this list to the receiver position.
-With argument MAYBE, fail quietly if no transformation is defined for
-this list."
- (interactive)
- (catch 'exit
- (unless (org-at-item-p) (error "Not at a list"))
- (save-excursion
- (goto-char (org-list-item-begin))
- (beginning-of-line 0)
- (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
- (if maybe
- (throw 'exit nil)
- (error "Don't know how to transform this list"))))
- (let* ((name (match-string 1))
- beg
- (transform (intern (match-string 2)))
- (txt (buffer-substring-no-properties
- (org-list-item-begin)
- (org-list-end)))
- (list (org-list-parse-list)))
- (unless (fboundp transform)
- (error "No such transformation function %s" transform))
- (setq txt (funcall transform list))
- ;; Find the insertion place
- (save-excursion
- (goto-char (point-min))
- (unless (re-search-forward
- (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
- (error "Don't know where to insert translated list"))
- (goto-char (match-beginning 0))
- (beginning-of-line 2)
- (setq beg (point))
- (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
- (error "Cannot find end of insertion region"))
- (beginning-of-line 1)
- (delete-region beg (point))
- (goto-char beg)
- (insert txt "\n"))
- (message "List converted and installed at receiver location"))))
-
-(defun org-list-to-generic (list params)
- "Convert a LIST parsed through `org-list-parse-list' to other formats.
-
-Valid parameters are
-
-:ustart String to start an unordered list
-:uend String to end an unordered list
-
-:ostart String to start an ordered list
-:oend String to end an ordered list
-
-:splice When set to t, return only list body lines, don't wrap
- them into :[u/o]start and :[u/o]end. Default is nil.
-
-:istart String to start a list item
-:iend String to end a list item
-:isep String to separate items
-:lsep String to separate sublists"
- (interactive)
- (let* ((p params) sublist
- (splicep (plist-get p :splice))
- (ostart (plist-get p :ostart))
- (oend (plist-get p :oend))
- (ustart (plist-get p :ustart))
- (uend (plist-get p :uend))
- (istart (plist-get p :istart))
- (iend (plist-get p :iend))
- (isep (plist-get p :isep))
- (lsep (plist-get p :lsep)))
- (let ((wrapper
- (cond ((eq (car list) 'ordered)
- (concat ostart "\n%s" oend "\n"))
- ((eq (car list) 'unordered)
- (concat ustart "\n%s" uend "\n"))))
- rtn)
- (while (setq sublist (pop list))
- (cond ((symbolp sublist) nil)
- ((stringp sublist)
- (setq rtn (concat rtn istart sublist iend isep)))
- (t
- (setq rtn (concat rtn ;; previous list
- lsep ;; list separator
- (org-list-to-generic sublist p)
- lsep ;; list separator
- )))))
- (format wrapper rtn))))
-
-(defun org-list-to-latex (list)
- "Convert LIST into a LaTeX list."
- (org-list-to-generic
- list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
- :ustart "\\begin{itemize}" :uend "\\end{itemize}"
- :istart "\\item " :iend ""
- :isep "\n" :lsep "\n")))
-
-(defun org-list-to-html (list)
- "Convert LIST into a HTML list."
- (org-list-to-generic
- list '(:splicep nil :ostart "<ol>" :oend "</ol>"
- :ustart "<ul>" :uend "</ul>"
- :istart "<li>" :iend "</li>"
- :isep "\n" :lsep "\n")))
-
-(defun org-list-to-texinfo (list)
- "Convert LIST into a Texinfo list."
- (org-list-to-generic
- list '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
- :ustart "@enumerate" :uend "@end enumerate"
- :istart "@item\n" :iend ""
- :isep "\n" :lsep "\n")))
-
(defconst org-latex-entities
'("\\!"
"\\'"
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index c3e4ac60950..6094ea077dd 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -381,6 +381,15 @@ belong to the weekend.")
(when (fboundp 'set-face-attribute)
(set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
+(defface org-scheduled
+ (org-compatible-face nil
+ '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
+ (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
+ (((class color) (min-colors 8)) (:foreground "green"))
+ (t (:bold t :italic t))))
+ "Face for items scheduled for a certain day."
+ :group 'org-faces)
+
(defface org-scheduled-today
(org-compatible-face nil
'((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
@@ -390,6 +399,7 @@ belong to the weekend.")
"Face for items scheduled for a certain day."
:group 'org-faces)
+
(defface org-scheduled-previously
(org-compatible-face nil
'((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el
index e1d82321388..61a3334d313 100644
--- a/lisp/org/org-gnus.el
+++ b/lisp/org/org-gnus.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -87,10 +87,12 @@ negates this setting for the duration of the command."
(from (mail-header-from header))
(message-id (mail-header-id header))
(date (mail-header-date header))
+ (extra (mail-header-extra header))
+ (to (cdr (assoc 'To extra)))
(subject (gnus-summary-subject-string))
desc link)
(org-store-link-props :type "gnus" :from from :subject subject
- :message-id message-id :group group)
+ :message-id message-id :group group :to to)
(setq desc (org-email-link-description))
(if (org-xor current-prefix-arg org-usenet-links-prefer-google)
(setq link
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index c43de2e98b9..cfb16d63954 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -29,12 +29,15 @@
;; are provided that create and retrieve such identifiers, and that find
;; entries based on the identifier.
-;; Identifiers consist of a prefix (default "Org") and a compact encoding
-;; of the creation time of the ID, with microsecond accuracy. This virtually
+;; Identifiers consist of a prefix (default "Org" given by the variable
+;; `org-id-prefix') and a unique part that can be created by a number
+;; of different methods, see the variable `org-id-method'.
+;; Org has a builtin method that uses a compact encoding of the creation
+;; time of the ID, with microsecond accuracy. This virtually
;; guarantees globally unique identifiers, even if several people are
;; creating ID's at the same time in files that will eventually be used
-;; together. Even higher security can be achieved by using different
-;; prefix values for each collaborator or file.
+;; together. As an exernal method `uuidgen' is supported, if installed
+;; on the system.
;;
;; This file defines the following API:
;;
@@ -75,7 +78,25 @@
:tag "Org ID"
:group 'org)
-(defcustom org-id-prefix "Org"
+(defcustom org-id-method 'org
+ "The method that should be used to create new ID's.
+
+An ID will consist of the prefix specified in `org-id-prefix', and a unique
+part created by the method this variable specifies.
+
+Allowed values are:
+
+org Org's own internal method, using an encoding of the current time,
+ and the current domain of the computer. This method will
+ honor the variable `org-id-include-domain'.
+
+uuidgen Call the external command uuidgen."
+ :group 'org-id
+ :type '(choice
+ (const :tag "Org's internal method" org)
+ (const :tag "external: uuidgen" uuidgen)))
+
+(defcustom org-id-prefix nil
"The prefix for IDs.
This may be a string, or it can be nil to indicate that no prefix is required.
@@ -89,7 +110,9 @@ to have no space characters in them."
(defcustom org-id-include-domain t
"Non-nil means, add the domain name to new IDs.
This ensures global uniqueness of ID's, and is also suggested by
-RFC 2445 in combination with RFC 822."
+RFC 2445 in combination with RFC 822. This is only relevant if
+`org-id-method' is `org'. When uuidgen is used, the domain will never
+be added."
:group 'org-id
:type 'boolean)
@@ -213,7 +236,7 @@ With optional argument MARKERP, return the position as a new marker."
An ID consists of two parts separated by a colon:
- a prefix
-- an encoding of the current time to micro-second accuracy
+- a unique part that will be created according to `org-id-method'.
PREFIX can specify the prefix, the default is given by the variable
`org-id-prefix'. However, if PREFIX is the symbol `none', don't use any
@@ -221,62 +244,69 @@ prefix even if `org-id-prefix' specifies one.
So a typical ID could look like \"Org:4nd91V40HI\"."
(let* ((prefix (if (eq prefix 'none)
- nil
- (or prefix org-id-prefix)))
- (etime (org-id-time-to-b62))
- (postfix (if org-id-include-domain
- (progn
- (require 'message)
- (concat "@" (message-make-fqdn))))))
- (if prefix
- (concat prefix ":" etime postfix)
- (concat etime postfix))))
-
-(defun org-id-int-to-b62-one-digit (i)
+ ""
+ (concat (or prefix org-id-prefix) ":")))
+ unique)
+ (if (equal prefix ":") (setq prefix ""))
+ (cond
+ ((eq org-id-method 'uuidgen)
+ (setq unique (substring (shell-command-to-string "uuidgen") 1 -1)))
+ ((eq org-id-method 'org)
+ (let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
+ (postfix (if org-id-include-domain
+ (progn
+ (require 'message)
+ (concat "@" (message-make-fqdn))))))
+ (setq unique (concat etime postfix))))
+ (t (error "Invalid `org-id-method'")))
+ (concat prefix unique)))
+
+(defun org-id-reverse-string (s)
+ (mapconcat 'char-to-string (nreverse (string-to-list s)) ""))
+
+(defun org-id-int-to-b36-one-digit (i)
"Turn an integer between 0 and 61 into a single character 0..9, A..Z, a..z."
(cond
((< i 10) (+ ?0 i))
- ((< i 36) (+ ?A i -10))
- ((< i 62) (+ ?a i -36))
- (t (error "Larger that 61"))))
+ ((< i 36) (+ ?a i -10))
+ (t (error "Larger that 35"))))
-(defun org-id-b62-to-int-one-digit (i)
+(defun org-id-b36-to-int-one-digit (i)
"Turn a character 0..9, A..Z, a..z into a number 0..61.
The input I may be a character, or a single-letter string."
(and (stringp i) (setq i (string-to-char i)))
(cond
((and (>= i ?0) (<= i ?9)) (- i ?0))
- ((and (>= i ?A) (<= i ?Z)) (+ (- i ?A) 10))
- ((and (>= i ?a) (<= i ?z)) (+ (- i ?a) 36))
- (t (error "Invalid b62 letter"))))
+ ((and (>= i ?a) (<= i ?z)) (+ (- i ?a) 10))
+ (t (error "Invalid b36 letter"))))
-(defun org-id-int-to-b62 (i &optional length)
- "Convert an integer to a base-62 number represented as a string."
+(defun org-id-int-to-b36 (i &optional length)
+ "Convert an integer to a base-36 number represented as a string."
(let ((s ""))
(while (> i 0)
(setq s (concat (char-to-string
- (org-id-int-to-b62-one-digit (mod i 62))) s)
- i (/ i 62)))
+ (org-id-int-to-b36-one-digit (mod i 36))) s)
+ i (/ i 36)))
(setq length (max 1 (or length 1)))
(if (< (length s) length)
(setq s (concat (make-string (- length (length s)) ?0) s)))
s))
-(defun org-id-b62-to-int (s)
- "Convert a base-62 string into the corresponding integer."
+(defun org-id-b36-to-int (s)
+ "Convert a base-36 string into the corresponding integer."
(let ((r 0))
- (mapc (lambda (i) (setq r (+ (* r 62) (org-id-b62-to-int-one-digit i))))
+ (mapc (lambda (i) (setq r (+ (* r 36) (org-id-b36-to-int-one-digit i))))
s)
r))
-(defun org-id-time-to-b62 (&optional time)
+(defun org-id-time-to-b36 (&optional time)
"Encode TIME as a 10-digit string.
This string holds the time to micro-second accuracy, and can be decoded
using `org-id-decode'."
(setq time (or time (current-time)))
- (concat (org-id-int-to-b62 (nth 0 time) 3)
- (org-id-int-to-b62 (nth 1 time) 3)
- (org-id-int-to-b62 (or (nth 2 time) 0) 4)))
+ (concat (org-id-int-to-b36 (nth 0 time) 4)
+ (org-id-int-to-b36 (nth 1 time) 4)
+ (org-id-int-to-b36 (or (nth 2 time) 0) 4)))
(defun org-id-decode (id)
"Split ID into the prefix and the time value that was used to create it.
@@ -287,9 +317,10 @@ and time is the usual three-integer representation of time."
(if (= 2 (length parts))
(setq prefix (car parts) time (nth 1 parts))
(setq prefix nil time (nth 0 parts)))
- (setq time (list (org-id-b62-to-int (substring time 0 3))
- (org-id-b62-to-int (substring time 3 6))
- (org-id-b62-to-int (substring time 6 10))))
+ (setq time (org-id-reverse-string time))
+ (setq time (list (org-id-b36-to-int (substring time 0 4))
+ (org-id-b36-to-int (substring time 4 8))
+ (org-id-b36-to-int (substring time 8 12))))
(cons prefix time)))
;; Storing ID locations (files)
diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el
index 779dbb48772..c523caf538f 100644
--- a/lisp/org/org-info.el
+++ b/lisp/org/org-info.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el
index 30f6479545e..275034a02e2 100644
--- a/lisp/org/org-irc.el
+++ b/lisp/org/org-irc.el
@@ -4,7 +4,7 @@
;;
;; Author: Philip Jackson <emacs@shellarchive.co.uk>
;; Keywords: erc, irc, link, org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el
index cb6bbd071c8..903e1dbec97 100644
--- a/lisp/org/org-jsinfo.el
+++ b/lisp/org/org-jsinfo.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el
index 1ee0b57f6a6..d2b21460f90 100644
--- a/lisp/org/org-mac-message.el
+++ b/lisp/org/org-mac-message.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2008 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
-;; Version: 6.06b
+;; Version: 6.09a
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index e957d3feb2b..c2870126b24 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el
index 65d1cc3a4a8..e4c7be398c0 100644
--- a/lisp/org/org-mew.el
+++ b/lisp/org/org-mew.el
@@ -5,7 +5,7 @@
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;; This file is part of GNU Emacs.
diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el
index abec4b9449e..3a580f09b0c 100644
--- a/lisp/org/org-mhe.el
+++ b/lisp/org/org-mhe.el
@@ -5,7 +5,7 @@
;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index 7f6827a077d..d09e4eb0434 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -4,7 +4,7 @@
;;
;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el
index c34d97f8598..a8279e3e1e2 100644
--- a/lisp/org/org-publish.el
+++ b/lisp/org/org-publish.el
@@ -4,7 +4,7 @@
;; Author: David O'Toole <dto@gnu.org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: hypermedia, outlines, wp
-;; Version: 6.06b
+;; Version: 6.09a
;; This file is part of GNU Emacs.
;;
@@ -23,8 +23,6 @@
;;; Commentary:
-;; Requires at least version 4.27 of org.el
-
;; This program allow configurable publishing of related sets of
;; Org-mode files as a complete website.
;;
@@ -408,25 +406,18 @@ If NO-EXCLUSION is non-nil, don't exclude files."
all-files))
(defun org-publish-expand-projects (projects-alist)
- "Expand projects contained in PROJECTS-ALIST."
- (let (without-component with-component)
- (mapc (lambda(p)
- (add-to-list
- (if (plist-get (cdr p) :components)
- 'with-component 'without-component) p))
- projects-alist)
- (org-publish-delete-dups
- (append without-component
- (car (mapcar (lambda(p) (org-publish-expand-components p))
- with-component))))))
-
-(defun org-publish-expand-components (project)
- "Expand PROJECT into an alist of its components."
- (let* ((components (plist-get (cdr project) :components)))
- (org-publish-delete-dups
- (delq nil (mapcar (lambda(c) (assoc c org-publish-project-alist))
- components)))))
-
+ "Expand projects in PROJECTS-ALIST.
+This splices all the components into the list."
+ (let ((rest projects-alist) rtn p components)
+ (while (setq p (pop rest))
+ (if (setq components (plist-get (cdr p) :components))
+ (setq rest (append
+ (mapcar (lambda (x) (assoc x org-publish-project-alist))
+ components)
+ rest))
+ (push p rtn)))
+ (nreverse (org-publish-delete-dups (delq nil rtn)))))
+
(defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir)
"Set `org-publish-temp-files' with files from BASE-DIR directory.
If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is
@@ -487,10 +478,11 @@ PUB-DIR is the publishing directory."
(require 'org)
(unless (file-exists-p pub-dir)
(make-directory pub-dir t))
- (find-file filename)
- (let ((init-buf (current-buffer))
- (init-point (point))
- (init-buf-string (buffer-string)) export-buf)
+ (let* ((visiting (find-buffer-visiting filename))
+ (plist (cons :buffer-will-be-killed (cons t plist)))
+ (init-buf (or visiting (find-file filename)))
+ (init-point (point))
+ (init-buf-string (buffer-string)) export-buf)
;; run hooks before exporting
(run-hooks 'org-publish-before-export-hook)
;; export the possibly modified buffer
@@ -510,7 +502,7 @@ PUB-DIR is the publishing directory."
(insert init-buf-string)
(save-buffer)
(goto-char init-point))
- (unless (eq init-buf org-publish-initial-buffer)
+ (unless visiting
(kill-buffer init-buf))))
(defun org-publish-org-to-latex (plist filename pub-dir)
diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el
index ebeb1120cac..2bd08833def 100644
--- a/lisp/org/org-remember.el
+++ b/lisp/org/org-remember.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -34,15 +34,17 @@
(require 'cl))
(require 'org)
+(declare-function remember-mode "remember" ())
(declare-function remember "remember" (&optional initial))
(declare-function remember-buffer-desc "remember" ())
(declare-function remember-finalize "remember" ())
(defvar remember-save-after-remembering)
-(defvar remember-data-file)
(defvar remember-register)
(defvar remember-buffer)
(defvar remember-handler-functions)
(defvar remember-annotation-functions)
+(defvar org-clock-heading)
+(defvar org-clock-heading-for-remember)
(defgroup org-remember nil
"Options concerning interaction with remember.el."
@@ -133,8 +135,11 @@ Furthermore, the following %-escapes will be replaced with content:
%x content of the X clipboard
%^C Interactive selection of which kill or clip to use
%^L Like %^C, but insert as link
+ %k title of currently clocked task
+ %K link to currently clocked task
%^g prompt for tags, with completion on tags in target file
%^G prompt for tags, with completion all tags in all agenda files
+ %^{prop}p Prompt the user for a value for property `prop'
%:keyword specific information for certain link types, see below
%[pathname] insert the contents of the file given by `pathname'
%(sexp) evaluate elisp `(sexp)' and replace with the result
@@ -164,8 +169,8 @@ calendar | %:type %:date"
:get (lambda (var) ; Make sure all entries have at least 5 elements
(mapcar (lambda (x)
(if (not (stringp (car x))) (setq x (cons "" x)))
- (cond ((= (length x) 4) (append x '("")))
- ((= (length x) 3) (append x '("" "")))
+ (cond ((= (length x) 4) (append x '(nil)))
+ ((= (length x) 3) (append x '(nil nil)))
(t x)))
(default-value var)))
:type '(repeat
@@ -176,6 +181,7 @@ calendar | %:type %:date"
(string :tag "Template")
(choice :tag "Destination file"
(file :tag "Specify")
+ (function :tag "Function")
(const :tag "Use `org-default-notes-file'" nil))
(choice :tag "Destin. headline"
(string :tag "Specify")
@@ -207,8 +213,8 @@ user each time a remember buffer with a running clock is filed away. "
;;;###autoload
(defun org-remember-insinuate ()
- "Setup remember.el for use wiht Org-mode."
- (require 'remember)
+ "Setup remember.el for use with Org-mode."
+ (org-require-remember)
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
(add-hook 'remember-mode-hook 'org-remember-apply-template))
@@ -300,26 +306,33 @@ RET at beg-of-buf -> Append to file as level 2 headline
(cddr (assoc char templates)))))
(defun org-get-x-clipboard (value)
- "Get the value of the x clibboard, in a way that also works with XEmacs."
+ "Get the value of the x clibboard, compatible with XEmacs, and GNU Emacs 21."
(if (eq window-system 'x)
- (let ((x (if org-xemacs-p
- (org-no-warnings (get-selection-no-error value))
- (and (fboundp 'x-selection-value)
- (x-selection-value value)))))
- (and (> (length x) 0) (set-text-properties 0 (length x) nil x) x))))
+ (let ((x (org-get-x-clipboard-compat value)))
+ (if x (org-no-properties x)))))
;;;###autoload
(defun org-remember-apply-template (&optional use-char skip-interactive)
"Initialize *remember* buffer with template, invoke `org-mode'.
This function should be placed into `remember-mode-hook' and in fact requires
to be run from that hook to function properly."
+ (when (and (boundp 'initial) (stringp initial))
+ (setq initial (org-no-properties initial))
+ (remove-text-properties 0 (length initial) '(read-only t) initial))
(if org-remember-templates
(let* ((entry (org-select-remember-template use-char))
(ct (or org-overriding-default-time (org-current-time)))
+ (dct (decode-time ct))
+ (ct1
+ (if (< (nth 2 dct) org-extend-today-until)
+ (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
+ ct))
(tpl (car entry))
(plist-p (if org-store-link-plist t nil))
- (file (if (and (nth 1 entry) (stringp (nth 1 entry))
- (string-match "\\S-" (nth 1 entry)))
+ (file (if (and (nth 1 entry)
+ (or (and (stringp (nth 1 entry))
+ (string-match "\\S-" (nth 1 entry)))
+ (functionp (nth 1 entry))))
(nth 1 entry)
org-default-notes-file))
(headline (nth 2 entry))
@@ -346,11 +359,24 @@ to be run from that hook to function properly."
(replace-match "[\\1[%^{Link description}]]" nil nil v-a)
v-a))
(v-n user-full-name)
+ (v-k (if (marker-buffer org-clock-marker)
+ (substring-no-properties org-clock-heading)))
+ (v-K (if (marker-buffer org-clock-marker)
+ (org-make-link-string
+ (buffer-file-name (marker-buffer org-clock-marker))
+ org-clock-heading)))
+ v-I
(org-startup-folded nil)
+ (org-inhibit-startup t)
org-time-was-given org-end-time-was-given x
prompt completions char time pos default histvar)
+
+ (when (functionp file)
+ (setq file (funcall file)))
(when (and file (not (file-name-absolute-p file)))
(setq file (expand-file-name file org-directory)))
+
+
(setq org-store-link-plist
(append (list :annotation v-a :initial v-i)
org-store-link-plist))
@@ -358,20 +384,23 @@ to be run from that hook to function properly."
(erase-buffer)
(insert (substitute-command-keys
(format
-"## Filing location: Select interactively, default, or last used:
+"## %s \"%s\" -> \"* %s\"
+## C-u C-c C-c like C-c C-c, and immediately visit note at target location
+## C-0 C-c C-c \"%s\" -> \"* %s\"
## %s to select file and header location interactively.
-## %s \"%s\" -> \"* %s\"
-## C-u C-u C-c C-c \"%s\" -> \"* %s\"
+## C-2 C-c C-c as child of the currently clocked item
## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n"
- (if org-remember-store-without-prompt " C-u C-c C-c" " C-c C-c")
- (if org-remember-store-without-prompt " C-c C-c" " C-u C-c C-c")
+ (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c")
(abbreviate-file-name (or file org-default-notes-file))
(or headline "")
(or (car org-remember-previous-location) "???")
- (or (cdr org-remember-previous-location) "???"))))
- (insert tpl) (goto-char (point-min))
+ (or (cdr org-remember-previous-location) "???")
+ (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c"))))
+ (insert tpl)
+ (goto-char (point-min))
+
;; Simple %-escapes
- (while (re-search-forward "%\\([tTuUaiAcx]\\)" nil t)
+ (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
(when (and initial (equal (match-string 0) "%i"))
(save-match-data
(let* ((lead (buffer-substring
@@ -417,7 +446,7 @@ to be run from that hook to function properly."
(replace-match x t t))))
;; Turn on org-mode in the remember buffer, set local variables
- (org-mode)
+ (let ((org-inhibit-startup t)) (org-mode))
(org-set-local 'org-finish-function 'org-remember-finalize)
(if (and file (string-match "\\S-" file) (not (file-directory-p file)))
(org-set-local 'org-default-notes-file file))
@@ -425,7 +454,7 @@ to be run from that hook to function properly."
(org-set-local 'org-remember-default-headline headline))
;; Interactive template entries
(goto-char (point-min))
- (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCL]\\)?" nil t)
+ (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
(setq char (if (match-end 3) (match-string 3))
prompt (if (match-end 2) (match-string 2)))
(goto-char (match-beginning 0))
@@ -470,6 +499,22 @@ to be run from that hook to function properly."
(car clipboards)
'(clipboards . 1)
(car clipboards))))))
+ ((equal char "p")
+ (let*
+ ((prop (substring-no-properties prompt))
+ (allowed (with-current-buffer
+ (get-buffer (file-name-nondirectory file))
+ (org-property-get-allowed-values nil prop 'table)))
+ (existing (with-current-buffer
+ (get-buffer (file-name-nondirectory file))
+ (mapcar 'list (org-property-values prop))))
+ (propprompt (concat "Value for " prop ": "))
+ (val (if allowed
+ (org-completing-read propprompt allowed nil
+ 'req-match)
+ (org-completing-read propprompt existing nil nil
+ "" nil ""))))
+ (org-set-property prop val)))
(char
;; These are the date/time related ones
(setq org-time-was-given (equal (upcase char) char))
@@ -488,7 +533,7 @@ to be run from that hook to function properly."
(if (re-search-forward "%\\?" nil t)
(replace-match "")
(and (re-search-forward "^[^#\n]" nil t) (backward-char 1))))
- (org-mode)
+ (let ((org-inhibit-startup t)) (org-mode))
(org-set-local 'org-finish-function 'org-remember-finalize))
(when (save-excursion
(goto-char (point-min))
@@ -556,6 +601,7 @@ note stored by remember.
Lisp programs can set ORG-FORCE-REMEMBER-TEMPLATE-CHAR to a character
associated with a template in `org-remember-templates'."
(interactive "P")
+ (org-require-remember)
(cond
((equal goto '(4)) (org-go-to-remember-target))
((equal goto '(16)) (org-remember-goto-last-stored))
@@ -617,39 +663,38 @@ The user is queried for the template."
;;;###autoload
(defun org-remember-handler ()
"Store stuff from remember.el into an org file.
-First prompts for an org file. If the user just presses return, the value
-of `org-default-notes-file' is used.
-Then the command offers the headings tree of the selected file in order to
-file the text at a specific location.
-You can either immediately press RET to get the note appended to the
-file, or you can use vertical cursor motion and visibility cycling (TAB) to
-find a better place. Then press RET or <left> or <right> in insert the note.
-
-Key Cursor position Note gets inserted
------------------------------------------------------------------------------
-RET buffer-start as level 1 heading at end of file
-RET on headline as sublevel of the heading at cursor
-RET no heading at cursor position, level taken from context.
- Or use prefix arg to specify level manually.
-<left> on headline as same level, before current heading
-<right> on headline as same level, after current heading
-
-So the fastest way to store the note is to press RET RET to append it to
-the default file. This way your current train of thought is not
-interrupted, in accordance with the principles of remember.el.
-You can also get the fast execution without prompting by using
-C-u C-c C-c to exit the remember buffer. See also the variable
-`org-remember-store-without-prompt'.
-
-Before being stored away, the function ensures that the text has a
-headline, i.e. a first line that starts with a \"*\". If not, a headline
-is constructed from the current date and some additional data.
+When the template has specified a file and a headline, the entry is filed
+there, or in the location defined by `org-default-notes-file' and
+`org-remember-default-headline'.
+
+If no defaults have been defined, or if the current prefix argument
+is 1 (so you must use `C-1 C-c C-c' to exit remember), an interactive
+process is used to select the target location.
+
+When the prefix is 0 (i.e. when remember is exited with `C-0 C-c C-c'),
+the entry is filed to the same location as the previous note.
+
+When the prefix is 2 (i.e. when remember is exited with `C-2 C-c C-c'),
+the entry is fild as a subentry of the entry where the clock is
+currently running.
+
+When `C-u' has been used as prefix argument, the note is stored and emacs
+moves point to the new location of the note, so that editing can be
+continued there (smilar to inserting \"%&\" into the tempate).
+
+Before storing the note, the function ensures that the text has an
+org-mode-style headline, i.e. a first line that starts with
+a \"*\". If not, a headline is constructed from the current date and
+some additional data.
If the variable `org-adapt-indentation' is non-nil, the entire text is
also indented so that it starts in the same column as the headline
\(i.e. after the stars).
See also the variable `org-reverse-note-order'."
+ (when (and (equal current-prefix-arg 2)
+ (not (marker-buffer org-clock-marker)))
+ (error "No runing clock"))
(when (org-bound-and-true-p org-jump-to-target-location)
(let* ((end (min (point-max) (1+ (point))))
(beg (point)))
@@ -666,15 +711,17 @@ See also the variable `org-reverse-note-order'."
(catch 'quit
(if org-note-abort (throw 'quit nil))
(let* ((visitp (org-bound-and-true-p org-jump-to-target-location))
- (fastp (org-xor (equal current-prefix-arg '(4))
+ (previousp (and (member current-prefix-arg '((16) 0))
+ org-remember-previous-location))
+ (clockp (equal current-prefix-arg 2))
+ (fastp (org-xor (equal current-prefix-arg 1)
org-remember-store-without-prompt))
(file (cond
(fastp org-default-notes-file)
((and (eq org-remember-interactive-interface 'refile)
org-refile-targets)
org-default-notes-file)
- ((not (and (equal current-prefix-arg '(16))
- org-remember-previous-location))
+ ((not previousp)
(org-get-org-file))))
(heading org-remember-default-headline)
(visiting (and file (org-find-base-buffer-visiting file)))
@@ -682,10 +729,16 @@ See also the variable `org-reverse-note-order'."
(org-startup-align-all-tables nil)
(org-goto-start-pos 1)
spos exitcmd level reversed txt)
- (if (and (equal current-prefix-arg '(16)) org-remember-previous-location)
- (setq file (car org-remember-previous-location)
- heading (cdr org-remember-previous-location)
- fastp t))
+ (when (equal current-prefix-arg '(4))
+ (setq visitp t))
+ (when previousp
+ (setq file (car org-remember-previous-location)
+ heading (cdr org-remember-previous-location)
+ fastp t))
+ (when clockp
+ (setq file (buffer-file-name (marker-buffer org-clock-marker))
+ heading org-clock-heading-for-remember
+ fastp t))
(setq current-prefix-arg nil)
;; Modify text so that it becomes a nice subtree which can be inserted
;; into an org tree.
@@ -739,7 +792,6 @@ See also the variable `org-reverse-note-order'."
(setq org-goto-start-pos (or (match-beginning 0) (point-min))))
((eq heading 'bottom)
(goto-char (point-max))
- (re-search-backward "^\\* " nil t)
(or (bolp) (newline))
(setq org-goto-start-pos (point)))
((and (stringp heading) (string-match "\\S-" heading))
@@ -761,7 +813,7 @@ See also the variable `org-reverse-note-order'."
(cond
((and fastp (memq heading '(top bottom)))
(setq spos org-goto-start-pos
- exitcmd (if (eq heading 'top) 'left 'right)))
+ exitcmd (if (eq heading 'top) 'left nil)))
(fastp (setq spos org-goto-start-pos
exitcmd 'return))
((eq org-remember-interactive-interface 'outline)
@@ -816,6 +868,12 @@ See also the variable `org-reverse-note-order'."
(move-marker org-remember-last-stored-marker (point)))
(t (error "This should not happen"))))
+ ((eq heading 'bottom)
+ (org-paste-subtree 1 txt)
+ (and org-auto-align-tags (org-set-tags nil t))
+ (bookmark-set "org-remember-last-stored")
+ (move-marker org-remember-last-stored-marker (point)))
+
((and (bobp) (not reversed))
;; Put it at the end, one level below level 1
(save-restriction
@@ -857,11 +915,41 @@ See also the variable `org-reverse-note-order'."
t) ;; return t to indicate that we took care of this note.
-
(defun org-do-remember (&optional initial)
"Call remember."
(remember initial))
+(defun org-require-remember ()
+ "Make sure remember is loaded, or install our own emergency version of it."
+ (condition-case nil
+ (require 'remember)
+ (error
+ ;; Lets install our own micro version of remember
+ (defvar remember-register ?R)
+ (defvar remember-mode-hook nil)
+ (defvar remember-handler-functions nil)
+ (defvar remember-buffer "*Remember*")
+ (defvar remember-save-after-remembering t)
+ (defvar remember-annotation-functions '(buffer-file-name))
+ (defun remember-finalize ()
+ (run-hook-with-args-until-success 'remember-handler-functions)
+ (when (equal remember-buffer (buffer-name))
+ (kill-buffer (current-buffer))
+ (jump-to-register remember-register)))
+ (defun remember-mode ()
+ (fundamental-mode)
+ (setq mode-name "Remember")
+ (run-hooks 'remember-mode-hook))
+ (defun remember (&optional initial)
+ (window-configuration-to-register remember-register)
+ (let* ((annotation (run-hook-with-args-until-success
+ 'remember-annotation-functions)))
+ (switch-to-buffer-other-window (get-buffer-create remember-buffer))
+ (remember-mode)))
+ (defun remember-buffer-desc ()
+ (buffer-substring (point-min) (save-excursion (goto-char (point-min))
+ (point-at-eol)))))))
+
(provide 'org-remember)
;; arch-tag: 497f30d0-4bc3-4097-8622-2d27ac5f2698
diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el
index 4d30664d84a..240ed3ed59b 100644
--- a/lisp/org/org-rmail.el
+++ b/lisp/org/org-rmail.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 2b771a6f671..339c01cf27a 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -191,7 +191,7 @@ t: accept as input and present for editing"
calc-angle-mode deg
calc-prefer-frac nil
calc-symbolic-mode nil
- calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
+ calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm))
calc-display-working-message t
)
"List with Calc mode settings for use in calc-eval for table formulas.
@@ -865,6 +865,7 @@ in order to easily repeat the interval."
(field (org-table-get-field))
(non-empty (string-match "[^ \t]" field))
(beg (org-table-begin))
+ (orig-n n)
txt)
(org-table-check-inside-data-field)
(if non-empty
@@ -881,12 +882,14 @@ in order to easily repeat the interval."
(org-table-goto-column colpos t)
(if (and (looking-at
"|[ \t]*\\([^| \t][^|]*?\\)[ \t]*|")
- (= (setq n (1- n)) 0))
+ (<= (setq n (1- n)) 0))
(throw 'exit (match-string 1))))))))
(if txt
(progn
(if (and org-table-copy-increment
- (string-match "^[0-9]+$" txt))
+ (not (equal orig-n 0))
+ (string-match "^[0-9]+$" txt)
+ (< (string-to-number txt) 100000000))
(setq txt (format "%d" (+ (string-to-number txt) 1))))
(insert txt)
(org-move-to-column col)
@@ -1641,7 +1644,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
items1)))
(res (apply '+ numbers))
(sres (if (= org-timecnt 0)
- (format "%g" res)
+ (number-to-string res)
(setq diff (* 3600 res)
h (floor (/ diff 3600)) diff (mod diff 3600)
m (floor (/ diff 60)) diff (mod diff 60)
@@ -3312,7 +3315,6 @@ to execute outside of tables."
'("\C-c{" org-table-toggle-formula-debugger)
'("\C-m" org-table-next-row)
'([(shift return)] org-table-copy-down)
- '("\C-c\C-q" org-table-wrap-region)
'("\C-c?" org-table-field-info)
'("\C-c " org-table-blank-field)
'("\C-c+" org-table-sum)
@@ -3486,8 +3488,13 @@ overwritten, and the table is not marked as requiring realignment."
(goto-char (match-beginning 0))
(self-insert-command N))
(setq org-table-may-need-update t)
- (let (orgtbl-mode)
- (call-interactively (key-binding (vector last-input-event))))))
+ (let (orgtbl-mode a)
+ (call-interactively
+ (key-binding
+ (or (and (listp function-key-map)
+ (setq a (assoc last-input-event function-key-map))
+ (cdr a))
+ (vector last-input-event)))))))
(defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$"
"Regular expression matching exponentials as produced by calc.")
@@ -3552,6 +3559,7 @@ a radio table."
(delete-region beg (point))))
(insert txt "\n")))
+;;;###autoload
(defun org-table-to-lisp (&optional txt)
"Convert the table at point to a Lisp structure.
The structure will be a list. Each item is either the symbol `hline'
diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el
index 759b0de3815..5bccc49ee93 100644
--- a/lisp/org/org-vm.el
+++ b/lisp/org/org-vm.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el
index e3700b1749c..a82afdbed77 100644
--- a/lisp/org/org-wl.el
+++ b/lisp/org/org-wl.el
@@ -5,7 +5,7 @@
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -53,8 +53,8 @@
;; Backward compatibility to old version of wl
(declare-function wl "ext:wl" () t)
(declare-function wl-summary-buffer-msgdb "ext:wl-folder" () t)
-(declare-function wl-folder-get-elmo-folder "ext:wl-folder"
- (entity &optional no-cache))
+;(declare-function wl-folder-get-elmo-folder "ext:wl-folder"
+; (entity &optional no-cache))
(declare-function wl-summary-goto-folder-subr "ext:wl-summary"
(&optional name scan-type other-window sticky interactive
scoring force-exit))
@@ -67,7 +67,6 @@
(declare-function wl-summary-registered-temp-mark "ext:wl-action" (number))
(declare-function wl-folder-goto-folder-subr "ext:wl-folder"
(&optional folder sticky))
-(declare-function wl-thread-open-all "ext:wl-thread" ())
(defvar wl-init)
(defvar wl-summary-buffer-elmo-folder)
(defvar wl-summary-buffer-folder-name)
@@ -123,7 +122,8 @@
(error "Error in Wanderlust link"))
(let ((folder (match-string 1 path))
(article (match-string 3 path)))
- (if (not (elmo-folder-exists-p (wl-folder-get-elmo-folder folder)))
+ (if (not (elmo-folder-exists-p (org-no-warnings
+ (wl-folder-get-elmo-folder folder))))
(error "No such folder: %s" folder))
(let ((old-buf (current-buffer))
(old-point (point-marker)))
@@ -134,7 +134,6 @@
;; in the old buffer.
(set-buffer old-buf)
(goto-char old-point))
- (wl-thread-open-all)
(and (wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
article))
(wl-summary-redisplay)))))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 79cb5cf4794..497a6df0747 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
;;
;; This file is part of GNU Emacs.
;;
@@ -86,12 +86,13 @@
(require 'org-macs)
(require 'org-compat)
(require 'org-faces)
+(require 'org-list)
;;;; Customization variables
;;; Version
-(defconst org-version "6.06b"
+(defconst org-version "6.09a"
"The version number of the file org.el.")
(defun org-version (&optional here)
@@ -220,20 +221,6 @@ uninteresting. Also tables look terrible when wrapped."
:group 'org-startup
:type 'boolean)
-(defcustom org-startup-indented nil
- "Non-nil means, turn on `org-indent-mode' on startup.
-This can also be configured on a per-file basis by adding one of
-the following lines anywhere in the buffer:
-
- #+STARTUP: localindent
- #+STARTUP: indent
- #+STARTUP: noindent"
- :group 'org-structure
- :type '(choice
- (const :tag "Not" nil)
- (const :tag "Locally" local)
- (const :tag "Globally (slow on startup in large files)" t)))
-
(defcustom org-startup-align-all-tables nil
"Non-nil means, align all tables when visiting a file.
This is useful when the column width in tables is forced with <N> cookies
@@ -270,6 +257,19 @@ become effective."
:group 'org-startup
:type 'boolean)
+(defcustom org-use-extra-keys nil
+ "Non-nil means use extra key sequence definitions for certain
+commands. This happens automatically if you run XEmacs or if
+window-system is nil. This variable lets you do the same
+manually. You must set it before loading org.
+
+Example: on Carbon Emacs 22 running graphically, with an external
+keyboard on a Powerbook, the default way of setting M-left might
+not work for either Alt or ESC. Setting this variable will make
+it work for ESC."
+ :group 'org-startup
+ :type 'boolean)
+
(if (fboundp 'defvaralias)
(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys))
@@ -554,6 +554,7 @@ following headline.
Special case: when 0, never leave empty lines in collapsed view."
:group 'org-cycle
:type 'integer)
+(put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers
@@ -632,6 +633,14 @@ When t, the following will happen while the cursor is in the headline:
:group 'org-edit-structure
:type 'boolean)
+(defcustom org-yank-folded-subtrees t
+ "Non-nil means, when yanking subtrees, fold them.
+If the kill is a single subtree, or a sequence of subtrees, i.e. if
+it starts with a heading and all other headings in it are either children
+or siblings, then fold all the subtrees."
+ :group 'org-edit-structure
+ :type 'boolean)
+
(defcustom org-M-RET-may-split-line '((default . t))
"Non-nil means, M-RET will split the line at the cursor position.
When nil, it will go to the end of the line before making a
@@ -659,6 +668,15 @@ default the value to be used for all contexts not explicitly
(boolean)))))
+(defcustom org-insert-heading-respect-content nil
+ "Non-nil means, insert new headings after the current subtree.
+When nil, the new heading is created directly after the current line.
+The commands \\[org-insert-heading-respect-content] and
+\\[org-insert-todo-heading-respect-content] turn this variable on
+for the duration of the command."
+ :group 'org-structure
+ :type 'boolean)
+
(defcustom org-blank-before-new-entry '((heading . nil)
(plain-list-item . nil))
"Should `org-insert-heading' leave a blank line before new heading/item?
@@ -682,6 +700,33 @@ See also the QUOTE keyword."
:group 'org-edit-structure
:type 'boolean)
+(defcustom org-edit-src-region-extra nil
+ "Additional regexps to identify regions for editing with `org-edit-src-code'.
+For examples see the function `org-edit-src-find-region-and-lang'.
+The regular expression identifying the begin marker should end with a newline,
+and the regexp marking the end line should start with a newline, to make sure
+there are kept outside the narrowed region."
+ :group 'org-edit-structure
+ :type '(repeat
+ (list
+ (regexp :tag "begin regexp")
+ (regexp :tag "end regexp")
+ (choice :tag "language"
+ (string :tag "specify")
+ (integer :tag "from match group")
+ (const :tag "from `lang' element")
+ (const :tag "from `style' element")))))
+
+(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."
+ :group 'org-edit-structure
+ :type '(choice
+ (const artist-mode)
+ (const picture-mode)
+ (const fundamental-mode)
+ (function :tag "Other (specify)")))
+
(defcustom org-goto-auto-isearch t
"Non-nil means, typing characters in org-goto starts incremental search."
:group 'org-edit-structure
@@ -717,61 +762,6 @@ as possible."
:group 'org-sparse-trees
:type 'hook)
-(defgroup org-plain-lists nil
- "Options concerning plain lists in Org-mode."
- :tag "Org Plain lists"
- :group 'org-structure)
-
-(defcustom org-cycle-include-plain-lists nil
- "Non-nil means, include plain lists into visibility cycling.
-This means that during cycling, plain list items will *temporarily* be
-interpreted as outline headlines with a level given by 1000+i where i is the
-indentation of the bullet. In all other operations, plain list items are
-not seen as headlines. For example, you cannot assign a TODO keyword to
-such an item."
- :group 'org-plain-lists
- :type 'boolean)
-
-(defcustom org-plain-list-ordered-item-terminator t
- "The character that makes a line with leading number an ordered list item.
-Valid values are ?. and ?\). To get both terminators, use t. While
-?. may look nicer, it creates the danger that a line with leading
-number may be incorrectly interpreted as an item. ?\) therefore is
-the safe choice."
- :group 'org-plain-lists
- :type '(choice (const :tag "dot like in \"2.\"" ?.)
- (const :tag "paren like in \"2)\"" ?\))
- (const :tab "both" t)))
-
-(defcustom org-empty-line-terminates-plain-lists nil
- "Non-nil means, an empty line ends all plain list levels.
-When nil, empty lines are part of the preceeding item."
- :group 'org-plain-lists
- :type 'boolean)
-
-(defcustom org-auto-renumber-ordered-lists t
- "Non-nil means, automatically renumber ordered plain lists.
-Renumbering happens when the sequence have been changed with
-\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
-use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
- :group 'org-plain-lists
- :type 'boolean)
-
-(defcustom org-provide-checkbox-statistics t
- "Non-nil means, update checkbox statistics after insert and toggle.
-When this is set, checkbox statistics is updated each time you either insert
-a new checkbox with \\[org-insert-todo-heading] or toggle a checkbox
-with \\[org-ctrl-c-ctrl-c\\]."
- :group 'org-plain-lists
- :type 'boolean)
-
-(defcustom org-description-max-indent 20
- "Maximum indentation for the second line of a description list.
-When the indentation would be larger than this, it will become
-5 characters instead."
- :group 'org-plain-lists
- :type 'integer)
-
(defgroup org-imenu-and-speedbar nil
"Options concerning imenu and speedbar in Org-mode."
:tag "Org Imenu and Speedbar"
@@ -1125,9 +1115,7 @@ See `org-file-apps'.")
(defconst org-file-apps-defaults-macosx
'((remote . emacs)
(t . "open %s")
- ("ps" . "gv %s")
("ps.gz" . "gv %s")
- ("eps" . "gv %s")
("eps.gz" . "gv %s")
("dvi" . "xdvi %s")
("fig" . "xfig %s"))
@@ -1150,12 +1138,8 @@ See `org-file-apps'.")
(defcustom org-file-apps
'(
- ("txt" . emacs)
- ("tex" . emacs)
- ("ltx" . emacs)
- ("org" . emacs)
- ("el" . emacs)
- ("bib" . emacs)
+ (auto-mode . emacs)
+ ("\\.x?html?\\'" . default)
)
"External applications for opening `file:path' items in a document.
Org-mode uses system defaults for different file types, but
@@ -1163,16 +1147,27 @@ you can use this variable to set the application for a given file
extension. The entries in this list are cons cells where the car identifies
files and the cdr the corresponding command. Possible values for the
file identifier are
- \"ext\" A string identifying an extension
+ \"regex\" Regular expression matched against the file name. For backward
+ compatibility, this can also be a string with only alphanumeric
+ characters, which is then interpreted as an extension.
`directory' Matches a directory
`remote' Matches a remote file, accessible through tramp or efs.
Remote files most likely should be visited through Emacs
because external applications cannot handle such paths.
- t Default for all remaining files
+`auto-mode' Matches files that are mached by any entry in `auto-mode-alist',
+ so all files Emacs knows how to handle. Useing this with
+ command `emacs' will open most files in Emacs. Beware that this
+ will also open html files insite Emacs, unless you add
+ (\"html\" . default) to the list as well.
+ t Default for files not matched by any of the other options.
Possible values for the command are:
`emacs' The file will be visited by the current Emacs process.
- `default' Use the default application for this file type.
+ `default' Use the default application for this file type, which is the
+ association for t in the list, most likely in the system-specific
+ part.
+ This can be used to overrule an unwanted seting in the
+ system-specific variable.
string A command to be executed by a shell; %s will be replaced
by the path to the file.
sexp A Lisp form which will be evaluated. The file path will
@@ -1187,7 +1182,9 @@ For more examples, see the system specific constants
(string :tag "Extension")
(const :tag "Default for unrecognized files" t)
(const :tag "Remote file" remote)
- (const :tag "Links to a directory" directory))
+ (const :tag "Links to a directory" directory)
+ (const :tag "Any files that have Emacs modes"
+ auto-mode))
(choice :value ""
(const :tag "Visit with Emacs" emacs)
(const :tag "Use system default" default)
@@ -1261,7 +1258,10 @@ This is list of cons cells. Each cell contains:
- a cons cell (:regexp . \"REGEXP\") with a regular expression matching
headlines that are refiling targets.
- a cons cell (:level . N). Any headline of level N is considered a target.
- - a cons cell (:maxlevel . N). Any headline with level <= N is a target."
+ - a cons cell (:maxlevel . N). Any headline with level <= N is a target.
+
+When this variable is nil, all top-level headlines in the current buffer
+are used, equivalent to the vlaue `((nil . (:level . 1))'."
:group 'org-remember
:type '(repeat
(cons
@@ -1357,6 +1357,8 @@ taken from the (otherwise obsolete) variable `org-todo-interpretation'."
(make-variable-buffer-local 'org-todo-keywords-1)
(defvar org-todo-keywords-for-agenda nil)
(defvar org-done-keywords-for-agenda nil)
+(defvar org-todo-keyword-alist-for-agenda nil)
+(defvar org-tag-alist-for-agenda nil)
(defvar org-agenda-contributing-files nil)
(defvar org-not-done-keywords nil)
(make-variable-buffer-local 'org-not-done-keywords)
@@ -1447,7 +1449,7 @@ the following lines anywhere in the buffer:
(setq org-log-done 'note)))
(defcustom org-log-note-clock-out nil
- "Non-nil means, recored a note when clocking out of an item.
+ "Non-nil means, record a note when clocking out of an item.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
@@ -1678,16 +1680,17 @@ When nil, only the minibuffer will be available."
'org-read-date-popup-calendar))
(defcustom org-extend-today-until 0
- "The hour when your day really ends.
+ "The hour when your day really ends. Must be an integer.
This has influence for the following applications:
- When switching the agenda to \"today\". It it is still earlier than
the time given here, the day recognized as TODAY is actually yesterday.
- When a date is read from the user and it is still before the time given
here, the current date and time will be assumed to be yesterday, 23:59.
+ Also, timestamps inserted in remember templates follow this rule.
-FIXME:
-IMPORTANT: This is still a very experimental feature, it may disappear
-again or it may be extended to mean more things."
+IMPORTANT: This is a feature whose implementation is and likely will
+remain incomplete. Really, it is only here because past midnight seems to
+ne the favorite working time of John Wiegley :-)"
:group 'org-time
:type 'number)
@@ -1900,6 +1903,18 @@ ellipses string, only part of the ellipses string will be shown."
:group 'org-properties
:type 'string)
+(defcustom org-columns-modify-value-for-display-function nil
+ "Function that modifies values for display in column view.
+For example, it can be used to cut out a certain part from a time stamp.
+The function must take 2 argments:
+
+column-title The tite of the column (*not* the property name)
+value The value that should be modified.
+
+The function should return the value that should be displayed,
+or nil if the normal value should be used."
+ :group 'org-properties
+ :type 'function)
(defcustom org-effort-property "Effort"
"The property that is being used to keep track of effort estimates.
@@ -1948,6 +1963,7 @@ or contain a special line
If the file does not specify a category, then file's base name
is used instead.")
(make-variable-buffer-local 'org-category)
+(put 'org-category 'safe-local-variable '(lambda (x) (or (symbolp x) (stringp x))))
(defcustom org-agenda-files nil
"The files to be used for agenda display.
@@ -2344,7 +2360,7 @@ outside the table.")
org-table-rotate-recalc-marks org-table-sort-lines org-table-sum
org-table-toggle-coordinate-overlays
org-table-toggle-formula-debugger org-table-wrap-region
- orgtbl-mode turn-on-orgtbl)))
+ orgtbl-mode turn-on-orgtbl org-table-to-lisp)))
(defun org-at-table-p (&optional table-type)
"Return t if the cursor is inside an org-type table.
@@ -2429,10 +2445,10 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
org-table-clean-before-export
org-export-icalendar-combine-agenda-files org-export-as-xoxo)))
-;; Declare and autoload functions from org-exp.el
+;; Declare and autoload functions from org-agenda.el
(eval-and-compile
- (org-autoload "org-exp"
+ (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)))
@@ -3499,8 +3515,8 @@ will be prompted for."
(throw 'exit t))))))
(defun org-activate-code (limit)
- (if (re-search-forward "^[ \t]*\\(:.*\\)" limit t)
- (unless (get-text-property (match-beginning 1) 'face)
+ (if (re-search-forward "^[ \t]*\\(: .*\n?\\)" limit t)
+ (progn
(remove-text-properties (match-beginning 0) (match-end 0)
'(display t invisible t intangible t))
t)))
@@ -3871,9 +3887,11 @@ If KWD is a number, get the corresponding match group."
1. OVERVIEW: Show only top-level headlines.
2. CONTENTS: Show all headlines of all levels, but no body text.
3. SHOW ALL: Show everything.
- When called with two C-c C-u prefixes, switch to the startup visibility,
+ When called with two C-u C-u prefixes, switch to the startup visibility,
determined by the variable `org-startup-folded', and by any VISIBILITY
properties in the buffer.
+ When called with three C-u C-u C-u prefixed, show the entire buffer,
+ including drawers.
- When point is at the beginning of a headline, rotate the subtree started
by this line through 3 different states (local cycling)
@@ -3917,7 +3935,11 @@ If KWD is a number, get the corresponding match group."
((equal arg '(16))
(org-set-startup-visibility)
- (message "Startup visibility, plus VISIBILITY properties."))
+ (message "Startup visibility, plus VISIBILITY properties"))
+
+ ((equal arg '(64))
+ (show-all)
+ (message "Entire buffer visible, including drawers"))
((org-at-table-p 'any)
;; Enter the table or move to the next field in the table
@@ -4351,7 +4373,7 @@ or nil."
(let ((isearch-mode-map org-goto-local-auto-isearch-map)
(isearch-hide-immediately nil)
(isearch-search-fun-function
- (lambda () 'org-goto-local-search-forward-headings))
+ (lambda () 'org-goto-local-search-headings))
(org-goto-selected-point org-goto-exit-command))
(save-excursion
(save-window-excursion
@@ -4392,10 +4414,12 @@ or nil."
(define-key org-goto-local-auto-isearch-map "\C-i" 'isearch-other-control-char)
(define-key org-goto-local-auto-isearch-map "\C-m" 'isearch-other-control-char)
-(defun org-goto-local-search-forward-headings (string bound noerror)
- "Search and make sure that anu matches are in headlines."
+(defun org-goto-local-search-headings (string bound noerror)
+ "Search and make sure that any matches are in headlines."
(catch 'return
- (while (search-forward string bound noerror)
+ (while (if isearch-forward
+ (search-forward string bound noerror)
+ (search-backward string bound noerror))
(when (let ((context (mapcar 'car (save-match-data (org-context)))))
(and (member :headline context)
(not (member :tags context))))
@@ -4568,24 +4592,28 @@ but create the new hedline after the current line."
(let ((split
(org-get-alist-option org-M-RET-may-split-line 'headline))
tags pos)
- (if (org-on-heading-p)
- (progn
- (looking-at ".*?\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
- (setq tags (and (match-end 2) (match-string 2)))
- (and (match-end 1)
- (delete-region (match-beginning 1) (match-end 1)))
- (setq pos (point-at-bol))
- (or split (end-of-line 1))
- (delete-horizontal-space)
- (newline (if blank 2 1))
- (when tags
- (save-excursion
- (goto-char pos)
- (end-of-line 1)
- (insert " " tags)
- (org-set-tags nil 'align))))
+ (cond
+ (org-insert-heading-respect-content
+ (org-end-of-subtree nil t)
+ (open-line 1))
+ ((org-on-heading-p)
+ (looking-at ".*?\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
+ (setq tags (and (match-end 2) (match-string 2)))
+ (and (match-end 1)
+ (delete-region (match-beginning 1) (match-end 1)))
+ (setq pos (point-at-bol))
(or split (end-of-line 1))
- (newline (if blank 2 1))))))
+ (delete-horizontal-space)
+ (newline (if blank 2 1))
+ (when tags
+ (save-excursion
+ (goto-char pos)
+ (end-of-line 1)
+ (insert " " tags)
+ (org-set-tags nil 'align))))
+ (t
+ (or split (end-of-line 1))
+ (newline (if blank 2 1)))))))
(insert head) (just-one-space)
(setq pos (point))
(end-of-line 1)
@@ -4610,6 +4638,16 @@ but create the new hedline after the current line."
(org-move-subtree-down)
(end-of-line 1))
+(defun org-insert-heading-respect-content ()
+ (interactive)
+ (let ((org-insert-heading-respect-content t))
+ (call-interactively 'org-insert-heading)))
+
+(defun org-insert-todo-heading-respect-content ()
+ (interactive)
+ (let ((org-insert-heading-respect-content t))
+ (call-interactively 'org-insert-todo-todo-heading)))
+
(defun org-insert-todo-heading (arg)
"Insert a new heading with the same level and TODO state as current heading.
If the heading has no TODO state, or if the state is DONE, use the first
@@ -5077,7 +5115,7 @@ If optional TXT is given, check this string instead of the current kill."
kill)
(- (match-end 2) (match-beginning 2) 1)))
(re (concat "^" org-outline-regexp))
- (start (1+ (match-beginning 2))))
+ (start (1+ (or (match-beginning 2) -1))))
(if (not start-level)
(progn
nil) ;; does not even start with a heading
@@ -5295,13 +5333,13 @@ WITH-CASE, the sorting considers case as well."
(lambda nil
(cond
((= dcst ?n)
- (if (looking-at outline-regexp)
- (string-to-number (buffer-substring (match-end 0)
- (point-at-eol)))
+ (if (looking-at org-complex-heading-regexp)
+ (string-to-number (match-string 4))
nil))
((= dcst ?a)
- (funcall case-func (buffer-substring (point-at-bol)
- (point-at-eol))))
+ (if (looking-at org-complex-heading-regexp)
+ (funcall case-func (match-string 4))
+ nil))
((= dcst ?t)
(if (re-search-forward org-ts-regexp
(save-excursion
@@ -5380,6 +5418,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
(define-key org-exit-edit-mode-map "\C-c'" 'org-edit-src-exit)
(defvar org-edit-src-force-single-line nil)
(defvar org-edit-src-from-org-mode nil)
+(defvar org-edit-src-picture nil)
(define-minor-mode org-exit-edit-mode
"Minor mode installing a single key binding, \"C-c '\" to exit special edit.")
@@ -5428,28 +5467,85 @@ exit by killing the buffer with \\[org-edit-src-exit]."
(message "%s" msg)
t)))
+(defun org-edit-fixed-width-region ()
+ "Edit the fixed-width ascii drawing at point.
+This must be a region where each line starts with ca colon followed by
+a space character.
+An indirect buffer is created, and that buffer is then narrowed to the
+example at point and switched to artist-mode. When done,
+exit by killing the buffer with \\[org-edit-src-exit]."
+ (interactive)
+ (let ((line (org-current-line))
+ (case-fold-search t)
+ (msg (substitute-command-keys
+ "Edit, then exit with C-c ' (C-c and single quote)"))
+ (org-mode-p (eq major-mode 'org-mode))
+ beg end lang lang-f)
+ (beginning-of-line 1)
+ (if (looking-at "[ \t]*[^:\n \t]")
+ nil
+ (if (looking-at "[ \t]*\\(\n\\|\\'\\)]")
+ (setq beg (point) end (match-end 0))
+ (save-excursion
+ (if (re-search-backward "^[ \t]*[^:]" nil 'move)
+ (setq beg (point-at-bol 2))
+ (setq beg (point))))
+ (save-excursion
+ (if (re-search-forward "^[ \t]*[^:]" nil 'move)
+ (setq end (1- (match-beginning 0)))
+ (setq end (point))))
+ (goto-line line)
+ (if (get-buffer "*Org Edit Picture*")
+ (kill-buffer "*Org Edit Picture*"))
+ (switch-to-buffer (make-indirect-buffer (current-buffer)
+ "*Org Edit Picture*"))
+ (narrow-to-region beg end)
+ (remove-text-properties beg end '(display nil invisible nil
+ intangible nil))
+ (when (fboundp 'font-lock-unfontify-region)
+ (font-lock-unfontify-region (point-min) (point-max)))
+ (cond
+ ((eq org-edit-fixed-width-region-mode 'artist-mode)
+ (fundamental-mode)
+ (artist-mode 1))
+ (t (funcall org-edit-fixed-width-region-mode)))
+ (set (make-local-variable 'org-edit-src-force-single-line) nil)
+ (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
+ (set (make-local-variable 'org-edit-src-picture) t)
+ (goto-char (point-min))
+ (while (re-search-forward "^[ \t]*: " nil t)
+ (replace-match ""))
+ (goto-line line)
+ (org-exit-edit-mode)
+ (org-set-local 'header-line-format msg)
+ (message "%s" msg)
+ t))))
+
+
(defun org-edit-src-find-region-and-lang ()
"Find the region and language for a local edit.
Return a list with beginning and end of the region, a string representing
the language, a switch telling of the content should be in a single line."
(let ((re-list
- '(
- ("<src\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</src>" lang)
- ("<literal\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</literal>" style)
- ("<example>[ \t]*\n?" "\n?[ \t]*</example>" "fundamental")
- ("<lisp>[ \t]*\n?" "\n?[ \t]*</lisp>" "emacs-lisp")
- ("<perl>[ \t]*\n?" "\n?[ \t]*</perl>" "perl")
- ("<python>[ \t]*\n?" "\n?[ \t]*</python>" "python")
- ("<ruby>[ \t]*\n?" "\n?[ \t]*</ruby>" "ruby")
- ("^#\\+begin_src\\( \\([^ \t\n]+\\)\\)?.*\n" "\n#\\+end_src" 2)
- ("^#\\+begin_example.*\n" "^#\\+end_example" "fundamental")
- ("^#\\+html:" "\n" "html" single-line)
- ("^#\\+begin_html.*\n" "\n#\\+end_html" "html")
- ("^#\\+begin_latex.*\n" "\n#\\+end_latex" "latex")
- ("^#\\+latex:" "\n" "latex" single-line)
- ("^#\\+begin_ascii.*\n" "\n#\\+end_ascii" "fundamental")
- ("^#\\+ascii:" "\n" "ascii" single-line)
- ))
+ (append
+ org-edit-src-region-extra
+ '(
+ ("<src\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</src>" lang)
+ ("<literal\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</literal>" style)
+ ("<example>[ \t]*\n?" "\n?[ \t]*</example>" "fundamental")
+ ("<lisp>[ \t]*\n?" "\n?[ \t]*</lisp>" "emacs-lisp")
+ ("<perl>[ \t]*\n?" "\n?[ \t]*</perl>" "perl")
+ ("<python>[ \t]*\n?" "\n?[ \t]*</python>" "python")
+ ("<ruby>[ \t]*\n?" "\n?[ \t]*</ruby>" "ruby")
+ ("^#\\+begin_src\\( \\([^ \t\n]+\\)\\)?.*\n" "\n#\\+end_src" 2)
+ ("^#\\+begin_example.*\n" "\n#\\+end_example" "fundamental")
+ ("^#\\+html:" "\n" "html" single-line)
+ ("^#\\+begin_html.*\n" "\n#\\+end_html" "html")
+ ("^#\\+begin_latex.*\n" "\n#\\+end_latex" "latex")
+ ("^#\\+latex:" "\n" "latex" single-line)
+ ("^#\\+begin_ascii.*\n" "\n#\\+end_ascii" "fundamental")
+ ("^#\\+ascii:" "\n" "ascii" single-line)
+ )))
(pos (point))
re re1 re2 single beg end lang)
(catch 'exit
@@ -5480,10 +5576,10 @@ the language, a switch telling of the content should be in a single line."
(cond
((stringp lang) lang)
((integerp lang) (match-string lang))
- ((and (eq lang lang)
+ ((and (eq lang 'lang)
(string-match "\\<lang=\"\\([^ \t\n\"]+\\)\"" m))
(match-string 1 m))
- ((and (eq lang lang)
+ ((and (eq lang 'style)
(string-match "\\<style=\"\\([^ \t\n\"]+\\)\"" m))
(match-string 1 m))
(t "fundamental"))))
@@ -5513,717 +5609,16 @@ the language, a switch telling of the content should be in a single line."
(when font-lock-mode
(font-lock-unfontify-region (point-min) (point-max)))
(put-text-property (point-min) (point-max) 'font-lock-fontified t))
+ (when (org-bound-and-true-p org-edit-src-picture)
+ (goto-char (point-min))
+ (while (re-search-forward "^" nil t)
+ (replace-match ": "))
+ (when font-lock-mode
+ (font-lock-unfontify-region (point-min) (point-max)))
+ (put-text-property (point-min) (point-max) 'font-lock-fontified t))
(kill-buffer (current-buffer))
(and (org-mode-p) (org-restart-font-lock)))
-;;;; Plain list items, including checkboxes
-
-;;; Plain list items
-
-(defun org-at-item-p ()
- "Is point in a line starting a hand-formatted item?"
- (let ((llt org-plain-list-ordered-item-terminator))
- (save-excursion
- (goto-char (point-at-bol))
- (looking-at
- (cond
- ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
- ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
- ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
- (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
-
-(defun org-in-item-p ()
- "It the cursor inside a plain list item.
-Does not have to be the first line."
- (save-excursion
- (condition-case nil
- (progn
- (org-beginning-of-item)
- (org-at-item-p)
- t)
- (error nil))))
-
-(defun org-insert-item (&optional checkbox)
- "Insert a new item at the current level.
-Return t when things worked, nil when we are not in an item."
- (when (save-excursion
- (condition-case nil
- (progn
- (org-beginning-of-item)
- (org-at-item-p)
- (if (org-invisible-p) (error "Invisible item"))
- t)
- (error nil)))
- (let* ((bul (match-string 0))
- (descp (save-excursion (goto-char (match-beginning 0))
- (beginning-of-line 1)
- (save-match-data
- (looking-at "[ \t]*.*? ::"))))
- (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
- (match-end 0)))
- (blank (cdr (assq 'plain-list-item org-blank-before-new-entry)))
- pos)
- (if descp (setq checkbox nil))
- (cond
- ((and (org-at-item-p) (<= (point) eow))
- ;; before the bullet
- (beginning-of-line 1)
- (open-line (if blank 2 1)))
- ((<= (point) eow)
- (beginning-of-line 1))
- (t
- (unless (org-get-alist-option org-M-RET-may-split-line 'item)
- (end-of-line 1)
- (delete-horizontal-space))
- (newline (if blank 2 1))))
- (insert bul
- (if checkbox "[ ]" "")
- (if descp (concat (if checkbox " " "")
- (read-string "Term: ") " :: ") ""))
- (just-one-space)
- (setq pos (point))
- (end-of-line 1)
- (unless (= (point) pos) (just-one-space) (backward-delete-char 1)))
- (org-maybe-renumber-ordered-list)
- (and checkbox (org-update-checkbox-count-maybe))
- t))
-
-;;; Checkboxes
-
-(defun org-at-item-checkbox-p ()
- "Is point at a line starting a plain-list item with a checklet?"
- (and (org-at-item-p)
- (save-excursion
- (goto-char (match-end 0))
- (skip-chars-forward " \t")
- (looking-at "\\[[- X]\\]"))))
-
-(defun org-toggle-checkbox (&optional arg)
- "Toggle the checkbox in the current line."
- (interactive "P")
- (catch 'exit
- (let (beg end status (firstnew 'unknown))
- (cond
- ((org-region-active-p)
- (setq beg (region-beginning) end (region-end)))
- ((org-on-heading-p)
- (setq beg (point) end (save-excursion (outline-next-heading) (point))))
- ((org-at-item-checkbox-p)
- (let ((pos (point)))
- (replace-match
- (cond (arg "[-]")
- ((member (match-string 0) '("[ ]" "[-]")) "[X]")
- (t "[ ]"))
- t t)
- (goto-char pos))
- (throw 'exit t))
- (t (error "Not at a checkbox or heading, and no active region")))
- (save-excursion
- (goto-char beg)
- (while (< (point) end)
- (when (org-at-item-checkbox-p)
- (setq status (equal (match-string 0) "[X]"))
- (when (eq firstnew 'unknown)
- (setq firstnew (not status)))
- (replace-match
- (if (if arg (not status) firstnew) "[X]" "[ ]") t t))
- (beginning-of-line 2)))))
- (org-update-checkbox-count-maybe))
-
-(defun org-update-checkbox-count-maybe ()
- "Update checkbox statistics unless turned off by user."
- (when org-provide-checkbox-statistics
- (org-update-checkbox-count)))
-
-(defun org-update-checkbox-count (&optional all)
- "Update the checkbox statistics in the current section.
-This will find all statistic cookies like [57%] and [6/12] and update them
-with the current numbers. With optional prefix argument ALL, do this for
-the whole buffer."
- (interactive "P")
- (save-excursion
- (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
- (beg (condition-case nil
- (progn (outline-back-to-heading) (point))
- (error (point-min))))
- (end (move-marker (make-marker)
- (progn (outline-next-heading) (point))))
- (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
- (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
- (re-find (concat re "\\|" re-box))
- beg-cookie end-cookie is-percent c-on c-off lim
- eline curr-ind next-ind continue-from startsearch
- (cstat 0)
- )
- (when all
- (goto-char (point-min))
- (outline-next-heading)
- (setq beg (point) end (point-max)))
- (goto-char end)
- ;; find each statistic cookie
- (while (re-search-backward re-find beg t)
- (setq beg-cookie (match-beginning 1)
- end-cookie (match-end 1)
- cstat (+ cstat (if end-cookie 1 0))
- startsearch (point-at-eol)
- continue-from (point-at-bol)
- is-percent (match-beginning 2)
- lim (cond
- ((org-on-heading-p) (outline-next-heading) (point))
- ((org-at-item-p) (org-end-of-item) (point))
- (t nil))
- c-on 0
- c-off 0)
- (when lim
- ;; find first checkbox for this cookie and gather
- ;; statistics from all that are at this indentation level
- (goto-char startsearch)
- (if (re-search-forward re-box lim t)
- (progn
- (org-beginning-of-item)
- (setq curr-ind (org-get-indentation))
- (setq next-ind curr-ind)
- (while (and (bolp) (org-at-item-p) (= curr-ind next-ind))
- (save-excursion (end-of-line) (setq eline (point)))
- (if (re-search-forward re-box eline t)
- (if (member (match-string 2) '("[ ]" "[-]"))
- (setq c-off (1+ c-off))
- (setq c-on (1+ c-on))
- )
- )
- (org-end-of-item)
- (setq next-ind (org-get-indentation))
- )))
- (goto-char continue-from)
- ;; update cookie
- (when end-cookie
- (delete-region beg-cookie end-cookie)
- (goto-char beg-cookie)
- (insert
- (if is-percent
- (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off))))
- (format "[%d/%d]" c-on (+ c-on c-off)))))
- ;; update items checkbox if it has one
- (when (org-at-item-p)
- (org-beginning-of-item)
- (when (and (> (+ c-on c-off) 0)
- (re-search-forward re-box (point-at-eol) t))
- (setq beg-cookie (match-beginning 2)
- end-cookie (match-end 2))
- (delete-region beg-cookie end-cookie)
- (goto-char beg-cookie)
- (cond ((= c-off 0) (insert "[X]"))
- ((= c-on 0) (insert "[ ]"))
- (t (insert "[-]")))
- )))
- (goto-char continue-from))
- (when (interactive-p)
- (message "Checkbox satistics updated %s (%d places)"
- (if all "in entire file" "in current outline entry") cstat)))))
-
-(defun org-get-checkbox-statistics-face ()
- "Select the face for checkbox statistics.
-The face will be `org-done' when all relevant boxes are checked. Otherwise
-it will be `org-todo'."
- (if (match-end 1)
- (if (equal (match-string 1) "100%") 'org-done 'org-todo)
- (if (and (> (match-end 2) (match-beginning 2))
- (equal (match-string 2) (match-string 3)))
- 'org-done
- 'org-todo)))
-
-(defun org-get-indentation (&optional line)
- "Get the indentation of the current line, interpreting tabs.
-When LINE is given, assume it represents a line and compute its indentation."
- (if line
- (if (string-match "^ *" (org-remove-tabs line))
- (match-end 0))
- (save-excursion
- (beginning-of-line 1)
- (skip-chars-forward " \t")
- (current-column))))
-
-(defun org-remove-tabs (s &optional width)
- "Replace tabulators in S with spaces.
-Assumes that s is a single line, starting in column 0."
- (setq width (or width tab-width))
- (while (string-match "\t" s)
- (setq s (replace-match
- (make-string
- (- (* width (/ (+ (match-beginning 0) width) width))
- (match-beginning 0)) ?\ )
- t t s)))
- s)
-
-(defun org-fix-indentation (line ind)
- "Fix indentation in LINE.
-IND is a cons cell with target and minimum indentation.
-If the current indenation in LINE is smaller than the minimum,
-leave it alone. If it is larger than ind, set it to the target."
- (let* ((l (org-remove-tabs line))
- (i (org-get-indentation l))
- (i1 (car ind)) (i2 (cdr ind)))
- (if (>= i i2) (setq l (substring line i2)))
- (if (> i1 0)
- (concat (make-string i1 ?\ ) l)
- l)))
-
-(defun org-beginning-of-item ()
- "Go to the beginning of the current hand-formatted item.
-If the cursor is not in an item, throw an error."
- (interactive)
- (let ((pos (point))
- (limit (save-excursion
- (condition-case nil
- (progn
- (org-back-to-heading)
- (beginning-of-line 2) (point))
- (error (point-min)))))
- (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
- ind ind1)
- (if (org-at-item-p)
- (beginning-of-line 1)
- (beginning-of-line 1)
- (skip-chars-forward " \t")
- (setq ind (current-column))
- (if (catch 'exit
- (while t
- (beginning-of-line 0)
- (if (or (bobp) (< (point) limit)) (throw 'exit nil))
-
- (if (looking-at "[ \t]*$")
- (setq ind1 ind-empty)
- (skip-chars-forward " \t")
- (setq ind1 (current-column)))
- (if (< ind1 ind)
- (progn (beginning-of-line 1) (throw 'exit (org-at-item-p))))))
- nil
- (goto-char pos)
- (error "Not in an item")))))
-
-(defun org-end-of-item ()
- "Go to the end of the current hand-formatted item.
-If the cursor is not in an item, throw an error."
- (interactive)
- (let* ((pos (point))
- ind1
- (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
- (limit (save-excursion (outline-next-heading) (point)))
- (ind (save-excursion
- (org-beginning-of-item)
- (skip-chars-forward " \t")
- (current-column)))
- (end (catch 'exit
- (while t
- (beginning-of-line 2)
- (if (eobp) (throw 'exit (point)))
- (if (>= (point) limit) (throw 'exit (point-at-bol)))
- (if (looking-at "[ \t]*$")
- (setq ind1 ind-empty)
- (skip-chars-forward " \t")
- (setq ind1 (current-column)))
- (if (<= ind1 ind)
- (throw 'exit (point-at-bol)))))))
- (if end
- (goto-char end)
- (goto-char pos)
- (error "Not in an item"))))
-
-(defun org-next-item ()
- "Move to the beginning of the next item in the current plain list.
-Error if not at a plain list, or if this is the last item in the list."
- (interactive)
- (let (ind ind1 (pos (point)))
- (org-beginning-of-item)
- (setq ind (org-get-indentation))
- (org-end-of-item)
- (setq ind1 (org-get-indentation))
- (unless (and (org-at-item-p) (= ind ind1))
- (goto-char pos)
- (error "On last item"))))
-
-(defun org-previous-item ()
- "Move to the beginning of the previous item in the current plain list.
-Error if not at a plain list, or if this is the first item in the list."
- (interactive)
- (let (beg ind ind1 (pos (point)))
- (org-beginning-of-item)
- (setq beg (point))
- (setq ind (org-get-indentation))
- (goto-char beg)
- (catch 'exit
- (while t
- (beginning-of-line 0)
- (if (looking-at "[ \t]*$")
- nil
- (if (<= (setq ind1 (org-get-indentation)) ind)
- (throw 'exit t)))))
- (condition-case nil
- (if (or (not (org-at-item-p))
- (< ind1 (1- ind)))
- (error "")
- (org-beginning-of-item))
- (error (goto-char pos)
- (error "On first item")))))
-
-(defun org-first-list-item-p ()
- "Is this heading the item in a plain list?"
- (unless (org-at-item-p)
- (error "Not at a plain list item"))
- (org-beginning-of-item)
- (= (point) (save-excursion (org-beginning-of-item-list))))
-
-(defun org-move-item-down ()
- "Move the plain list item at point down, i.e. swap with following item.
-Subitems (items with larger indentation) are considered part of the item,
-so this really moves item trees."
- (interactive)
- (let (beg beg0 end end0 ind ind1 (pos (point)) txt ne-end ne-beg)
- (org-beginning-of-item)
- (setq beg0 (point))
- (save-excursion
- (setq ne-beg (org-back-over-empty-lines))
- (setq beg (point)))
- (goto-char beg0)
- (setq ind (org-get-indentation))
- (org-end-of-item)
- (setq end0 (point))
- (setq ind1 (org-get-indentation))
- (setq ne-end (org-back-over-empty-lines))
- (setq end (point))
- (goto-char beg0)
- (when (and (org-first-list-item-p) (< ne-end ne-beg))
- ;; include less whitespace
- (save-excursion
- (goto-char beg)
- (forward-line (- ne-beg ne-end))
- (setq beg (point))))
- (goto-char end0)
- (if (and (org-at-item-p) (= ind ind1))
- (progn
- (org-end-of-item)
- (org-back-over-empty-lines)
- (setq txt (buffer-substring beg end))
- (save-excursion
- (delete-region beg end))
- (setq pos (point))
- (insert txt)
- (goto-char pos) (org-skip-whitespace)
- (org-maybe-renumber-ordered-list))
- (goto-char pos)
- (error "Cannot move this item further down"))))
-
-(defun org-move-item-up (arg)
- "Move the plain list item at point up, i.e. swap with previous item.
-Subitems (items with larger indentation) are considered part of the item,
-so this really moves item trees."
- (interactive "p")
- (let (beg beg0 end ind ind1 (pos (point)) txt
- ne-beg ne-ins ins-end)
- (org-beginning-of-item)
- (setq beg0 (point))
- (setq ind (org-get-indentation))
- (save-excursion
- (setq ne-beg (org-back-over-empty-lines))
- (setq beg (point)))
- (goto-char beg0)
- (org-end-of-item)
- (org-back-over-empty-lines)
- (setq end (point))
- (goto-char beg0)
- (catch 'exit
- (while t
- (beginning-of-line 0)
- (if (looking-at "[ \t]*$")
- (if org-empty-line-terminates-plain-lists
- (progn
- (goto-char pos)
- (error "Cannot move this item further up"))
- nil)
- (if (<= (setq ind1 (org-get-indentation)) ind)
- (throw 'exit t)))))
- (condition-case nil
- (org-beginning-of-item)
- (error (goto-char beg0)
- (error "Cannot move this item further up")))
- (setq ind1 (org-get-indentation))
- (if (and (org-at-item-p) (= ind ind1))
- (progn
- (setq ne-ins (org-back-over-empty-lines))
- (setq txt (buffer-substring beg end))
- (save-excursion
- (delete-region beg end))
- (setq pos (point))
- (insert txt)
- (setq ins-end (point))
- (goto-char pos) (org-skip-whitespace)
-
- (when (and (org-first-list-item-p) (> ne-ins ne-beg))
- ;; Move whitespace back to beginning
- (save-excursion
- (goto-char ins-end)
- (let ((kill-whole-line t))
- (kill-line (- ne-ins ne-beg)) (point)))
- (insert (make-string (- ne-ins ne-beg) ?\n)))
-
- (org-maybe-renumber-ordered-list))
- (goto-char pos)
- (error "Cannot move this item further up"))))
-
-(defun org-maybe-renumber-ordered-list ()
- "Renumber the ordered list at point if setup allows it.
-This tests the user option `org-auto-renumber-ordered-lists' before
-doing the renumbering."
- (interactive)
- (when (and org-auto-renumber-ordered-lists
- (org-at-item-p))
- (if (match-beginning 3)
- (org-renumber-ordered-list 1)
- (org-fix-bullet-type))))
-
-(defun org-maybe-renumber-ordered-list-safe ()
- (condition-case nil
- (save-excursion
- (org-maybe-renumber-ordered-list))
- (error nil)))
-
-(defun org-cycle-list-bullet (&optional which)
- "Cycle through the different itemize/enumerate bullets.
-This cycle the entire list level through the sequence:
-
- `-' -> `+' -> `*' -> `1.' -> `1)'
-
-If WHICH is a string, use that as the new bullet. If WHICH is an integer,
-0 meand `-', 1 means `+' etc."
- (interactive "P")
- (org-preserve-lc
- (org-beginning-of-item-list)
- (org-at-item-p)
- (beginning-of-line 1)
- (let ((current (match-string 0))
- (prevp (eq which 'previous))
- new)
- (setq new (cond
- ((and (numberp which)
- (nth (1- which) '("-" "+" "*" "1." "1)"))))
- ((string-match "-" current) (if prevp "1)" "+"))
- ((string-match "\\+" current)
- (if prevp "-" (if (looking-at "\\S-") "1." "*")))
- ((string-match "\\*" current) (if prevp "+" "1."))
- ((string-match "\\." current) (if prevp "*" "1)"))
- ((string-match ")" current) (if prevp "1." "-"))
- (t (error "This should not happen"))))
- (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new)))
- (org-fix-bullet-type)
- (org-maybe-renumber-ordered-list))))
-
-(defun org-get-string-indentation (s)
- "What indentation has S due to SPACE and TAB at the beginning of the string?"
- (let ((n -1) (i 0) (w tab-width) c)
- (catch 'exit
- (while (< (setq n (1+ n)) (length s))
- (setq c (aref s n))
- (cond ((= c ?\ ) (setq i (1+ i)))
- ((= c ?\t) (setq i (* (/ (+ w i) w) w)))
- (t (throw 'exit t)))))
- i))
-
-(defun org-renumber-ordered-list (arg)
- "Renumber an ordered plain list.
-Cursor needs to be in the first line of an item, the line that starts
-with something like \"1.\" or \"2)\"."
- (interactive "p")
- (unless (and (org-at-item-p)
- (match-beginning 3))
- (error "This is not an ordered list"))
- (let ((line (org-current-line))
- (col (current-column))
- (ind (org-get-string-indentation
- (buffer-substring (point-at-bol) (match-beginning 3))))
- ;; (term (substring (match-string 3) -1))
- ind1 (n (1- arg))
- fmt bobp)
- ;; find where this list begins
- (org-beginning-of-item-list)
- (setq bobp (bobp))
- (looking-at "[ \t]*[0-9]+\\([.)]\\)")
- (setq fmt (concat "%d" (match-string 1)))
- (beginning-of-line 0)
- ;; walk forward and replace these numbers
- (catch 'exit
- (while t
- (catch 'next
- (if bobp (setq bobp nil) (beginning-of-line 2))
- (if (eobp) (throw 'exit nil))
- (if (looking-at "[ \t]*$") (throw 'next nil))
- (skip-chars-forward " \t") (setq ind1 (current-column))
- (if (> ind1 ind) (throw 'next t))
- (if (< ind1 ind) (throw 'exit t))
- (if (not (org-at-item-p)) (throw 'exit nil))
- (delete-region (match-beginning 2) (match-end 2))
- (goto-char (match-beginning 2))
- (insert (format fmt (setq n (1+ n)))))))
- (goto-line line)
- (org-move-to-column col)))
-
-(defun org-fix-bullet-type ()
- "Make sure all items in this list have the same bullet as the firsst item."
- (interactive)
- (unless (org-at-item-p) (error "This is not a list"))
- (let ((line (org-current-line))
- (col (current-column))
- (ind (current-indentation))
- ind1 bullet)
- ;; find where this list begins
- (org-beginning-of-item-list)
- (beginning-of-line 1)
- ;; find out what the bullet type is
- (looking-at "[ \t]*\\(\\S-+\\)")
- (setq bullet (match-string 1))
- ;; walk forward and replace these numbers
- (beginning-of-line 0)
- (catch 'exit
- (while t
- (catch 'next
- (beginning-of-line 2)
- (if (eobp) (throw 'exit nil))
- (if (looking-at "[ \t]*$") (throw 'next nil))
- (skip-chars-forward " \t") (setq ind1 (current-column))
- (if (> ind1 ind) (throw 'next t))
- (if (< ind1 ind) (throw 'exit t))
- (if (not (org-at-item-p)) (throw 'exit nil))
- (skip-chars-forward " \t")
- (looking-at "\\S-+")
- (replace-match bullet))))
- (goto-line line)
- (org-move-to-column col)
- (if (string-match "[0-9]" bullet)
- (org-renumber-ordered-list 1))))
-
-(defun org-beginning-of-item-list ()
- "Go to the beginning of the current item list.
-I.e. to the first item in this list."
- (interactive)
- (org-beginning-of-item)
- (let ((pos (point-at-bol))
- (ind (org-get-indentation))
- ind1)
- ;; find where this list begins
- (catch 'exit
- (while t
- (catch 'next
- (beginning-of-line 0)
- (if (looking-at "[ \t]*$")
- (throw (if (bobp) 'exit 'next) t))
- (skip-chars-forward " \t") (setq ind1 (current-column))
- (if (or (< ind1 ind)
- (and (= ind1 ind)
- (not (org-at-item-p)))
- (and (= (point-at-bol) (point-min))
- (setq pos (point-min))))
- (throw 'exit t)
- (when (org-at-item-p) (setq pos (point-at-bol)))))))
- (goto-char pos)))
-
-
-(defun org-end-of-item-list ()
- "Go to the end of the current item list.
-I.e. to the text after the last item."
- (interactive)
- (org-beginning-of-item)
- (let ((pos (point-at-bol))
- (ind (org-get-indentation))
- ind1)
- ;; find where this list begins
- (catch 'exit
- (while t
- (catch 'next
- (beginning-of-line 2)
- (if (looking-at "[ \t]*$")
- (throw (if (eobp) 'exit 'next) t))
- (skip-chars-forward " \t") (setq ind1 (current-column))
- (if (or (< ind1 ind)
- (and (= ind1 ind)
- (not (org-at-item-p)))
- (eobp))
- (progn
- (setq pos (point-at-bol))
- (throw 'exit t))))))
- (goto-char pos)))
-
-
-(defvar org-last-indent-begin-marker (make-marker))
-(defvar org-last-indent-end-marker (make-marker))
-
-(defun org-outdent-item (arg)
- "Outdent a local list item."
- (interactive "p")
- (org-indent-item (- arg)))
-
-(defun org-indent-item (arg)
- "Indent a local list item."
- (interactive "p")
- (unless (org-at-item-p)
- (error "Not on an item"))
- (save-excursion
- (let (beg end ind ind1 tmp delta ind-down ind-up)
- (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
- (setq beg org-last-indent-begin-marker
- end org-last-indent-end-marker)
- (org-beginning-of-item)
- (setq beg (move-marker org-last-indent-begin-marker (point)))
- (org-end-of-item)
- (setq end (move-marker org-last-indent-end-marker (point))))
- (goto-char beg)
- (setq tmp (org-item-indent-positions)
- ind (car tmp)
- ind-down (nth 2 tmp)
- ind-up (nth 1 tmp)
- delta (if (> arg 0)
- (if ind-down (- ind-down ind) 2)
- (if ind-up (- ind-up ind) -2)))
- (if (< (+ delta ind) 0) (error "Cannot outdent beyond margin"))
- (while (< (point) end)
- (beginning-of-line 1)
- (skip-chars-forward " \t") (setq ind1 (current-column))
- (delete-region (point-at-bol) (point))
- (or (eolp) (org-indent-to-column (+ ind1 delta)))
- (beginning-of-line 2))))
- (org-fix-bullet-type)
- (org-maybe-renumber-ordered-list-safe)
- (save-excursion
- (beginning-of-line 0)
- (condition-case nil (org-beginning-of-item) (error nil))
- (org-maybe-renumber-ordered-list-safe)))
-
-(defun org-item-indent-positions ()
- "Return indentation for plain list items.
-This returns a list with three values: The current indentation, the
-parent indentation and the indentation a child should habe.
-Assumes cursor in item line."
- (let* ((bolpos (point-at-bol))
- (ind (org-get-indentation))
- ind-down ind-up pos)
- (save-excursion
- (org-beginning-of-item-list)
- (skip-chars-backward "\n\r \t")
- (when (org-in-item-p)
- (org-beginning-of-item)
- (setq ind-up (org-get-indentation))))
- (setq pos (point))
- (save-excursion
- (cond
- ((and (condition-case nil (progn (org-previous-item) t)
- (error nil))
- (or (forward-char 1) t)
- (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
- (setq ind-down (org-get-indentation)))
- ((and (goto-char pos)
- (org-at-item-p))
- (goto-char (match-end 0))
- (skip-chars-forward " \t")
- (setq ind-down (current-column)))))
- (list ind ind-up ind-down)))
;;; The orgstruct minor mode
@@ -6383,14 +5778,15 @@ to execute outside of tables."
'('orgstruct-error))))))))
(defun org-context-p (&rest contexts)
- "Check if local context is and of CONTEXTS.
+ "Check if local context is any of CONTEXTS.
Possible values in the list of contexts are `table', `headline', and `item'."
(let ((pos (point)))
(goto-char (point-at-bol))
(prog1 (or (and (memq 'table contexts)
(looking-at "[ \t]*|"))
(and (memq 'headline contexts)
- (looking-at "\\*+"))
+;;????????? (looking-at "\\*+"))
+ (looking-at outline-regexp))
(and (memq 'item contexts)
(looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)")))
(goto-char pos))))
@@ -7031,7 +6427,7 @@ used as the link location instead of reading one interactively."
(defun org-extract-attributes (s)
"Extract the attributes cookie from a string and set as text property."
- (let (a attr key value (start 0))
+ (let (a attr (start 0) key value)
(save-match-data
(when (string-match "{{\\([^}]+\\)}}$" s)
(setq a (match-string 1 s) s (substring s 0 (match-beginning 0)))
@@ -7582,6 +6978,7 @@ If the file does not exist, an error is thrown."
(file (if (and dirp org-open-directory-means-index-dot-org)
(concat (file-name-as-directory file) "index.org")
file))
+ (a-m-a-p (assq 'auto-mode apps))
(dfile (downcase file))
(old-buffer (current-buffer))
(old-pos (point))
@@ -7595,8 +6992,12 @@ If the file does not exist, an error is thrown."
(setq cmd 'emacs)
(setq cmd (or (and remp (cdr (assoc 'remote apps)))
(and dirp (cdr (assoc 'directory apps)))
+ (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p)
+ 'string-match)
(cdr (assoc ext apps))
(cdr (assoc t apps)))))
+ (when (eq cmd 'default)
+ (setq cmd (cdr (assoc t apps))))
(when (eq cmd 'mailcap)
(require 'mailcap)
(mailcap-parse-mailcaps)
@@ -7648,6 +7049,25 @@ If the file does not exist, an error is thrown."
org-file-apps-defaults-windowsnt)
(t org-file-apps-defaults-gnu)))
+(defun org-apps-regexp-alist (list &optional add-auto-mode)
+ "Convert extensions to regular expressions in the cars of LIST.
+Also, weed out any non-string entries, because the return value is used
+only for regexp matching.
+When ADD-AUTO-MODE is set, make all matches in `auto-mode-alist'
+point to the symbol `emacs', indicating that the file should
+be opened in Emacs."
+ (append
+ (delq nil
+ (mapcar (lambda (x)
+ (if (not (stringp (car x)))
+ nil
+ (if (string-match "\\W" (car x))
+ x
+ (cons (concat "\\." (car x) "\\'") (cdr x)))))
+ list))
+ (if add-auto-mode
+ (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist))))
+
(defvar ange-ftp-name-format) ; to silence the XEmacs compiler.
(defun org-file-remote-p (file)
"Test whether FILE specifies a location on a remote system.
@@ -7741,7 +7161,7 @@ on the system \"/user@host:\"."
(while (re-search-forward descre nil t)
(goto-char (point-at-bol))
(when (looking-at org-complex-heading-regexp)
- (setq txt (match-string 4)
+ (setq txt (org-link-display-format (match-string 4))
re (concat "^" (regexp-quote
(buffer-substring (match-beginning 1)
(match-end 4)))))
@@ -7750,7 +7170,7 @@ on the system \"/user@host:\"."
(match-string 5)))))
(setq re (concat re "[ \t]*$"))
(when org-refile-use-outline-path
- (setq txt (mapconcat 'identity
+ (setq txt (mapconcat 'org-protect-slash
(append
(if (eq org-refile-use-outline-path 'file)
(list (file-name-nondirectory
@@ -7764,6 +7184,11 @@ on the system \"/user@host:\"."
(goto-char (point-at-eol))))))))
(nreverse targets))))
+(defun org-protect-slash (s)
+ (while (string-match "/" s)
+ (setq s (replace-match "\\" t t s)))
+ s)
+
(defun org-get-outline-path ()
"Return the outline path to the current entry, as a list."
(let (rtn)
@@ -7788,7 +7213,7 @@ first of the last subitem.
With prefix arg GOTO, the command will only visit the target location,
not actually move anything.
-With a double prefix `C-c C-c', go to the location where the last refiling
+With a double prefix `C-u C-u', go to the location where the last refiling
operation has put the subtree."
(interactive "P")
(let* ((cbuf (current-buffer))
@@ -7821,10 +7246,11 @@ operation has put the subtree."
(setq level (org-get-valid-level (funcall outline-level) 1))
(goto-char
(if reversed
- (outline-next-heading)
+ (or (outline-next-heading) (point-max))
(or (save-excursion (outline-get-next-sibling))
(org-end-of-subtree t t)
(point-max))))
+ (if (not (bolp)) (newline))
(bookmark-set "org-refile-last-stored")
(org-paste-subtree level))))
(org-cut-subtree)
@@ -8016,7 +7442,10 @@ This function can be used in a hook."
(defconst org-additional-option-like-keywords
'("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX"
"ORGTBL" "HTML:" "LaTeX:" "BEGIN:" "END:" "TBLFM"
- "BEGIN_EXAMPLE" "END_EXAMPLE"))
+ "BEGIN_EXAMPLE" "END_EXAMPLE"
+ "BEGIN_QUOTE" "END_QUOTE"
+ "BEGIN_VERSE" "END_VERSE"
+ "BEGIN_SRC" "END_SRC"))
(defcustom org-structure-template-alist
'(
@@ -8489,7 +7918,7 @@ For calling through lisp, arg is also interpreted in the following way:
(and (member kwd org-done-keywords)
(setq cnt-done (1+ cnt-done)))
(condition-case nil
- (outline-forward-same-level 1)
+ (org-forward-same-level 1)
(error (end-of-line 1)))))
(replace-match
(if is-percent
@@ -8651,6 +8080,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
(defvar org-log-post-message)
(defvar org-log-note-purpose)
(defvar org-log-note-how)
+(defvar org-log-note-extra)
(defun org-auto-repeat-maybe (done-word)
"Check if the current headline contains a repeated deadline/schedule.
If yes, set TODO state back to what it was and change the base date
@@ -8720,7 +8150,7 @@ This function is run automatically after each state change to a DONE state."
(setq ts (match-string 1))
(string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\)" ts))))
(org-timestamp-change n (cdr (assoc what whata)))
- (setq msg (concat msg type org-last-changed-timestamp " "))))
+ (setq msg (concat msg type " " org-last-changed-timestamp " "))))
(setq org-log-post-message msg)
(message "%s" msg))))
@@ -8889,6 +8319,7 @@ be removed."
(defvar org-log-note-purpose nil)
(defvar org-log-note-state nil)
(defvar org-log-note-how nil)
+(defvar org-log-note-extra nil)
(defvar org-log-note-window-configuration nil)
(defvar org-log-note-return-to (make-marker))
(defvar org-log-post-message nil
@@ -8899,29 +8330,39 @@ The auto-repeater uses this.")
"Add a note to the current entry.
This is done in the same way as adding a state change note."
(interactive)
- (org-add-log-setup 'note nil t nil))
+ (org-add-log-setup 'note nil 'findpos nil))
-(defun org-add-log-setup (&optional purpose state findpos how)
+(defvar org-property-end-re)
+(defun org-add-log-setup (&optional purpose state findpos how &optional extra)
"Set up the post command hook to take a note.
If this is about to TODO state change, the new state is expected in STATE.
When FINDPOS is non-nil, find the correct position for the note in
-the current entry. If not, assume that it can be inserted at point."
- (save-excursion
- (when findpos
- (org-back-to-heading t)
- (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
- "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
- "[^\r\n]*\\)?"))
- (goto-char (match-end 0))
- (unless org-log-states-order-reversed
- (and (= (char-after) ?\n) (forward-char 1))
- (org-skip-over-state-notes)
- (skip-chars-backward " \t\n\r")))
- (move-marker org-log-note-marker (point))
- (setq org-log-note-purpose purpose
- org-log-note-state state
- org-log-note-how how)
- (add-hook 'post-command-hook 'org-add-log-note 'append)))
+the current entry. If not, assume that it can be inserted at point.
+HOW is an indicator what kind of note should be created.
+EXTRA is additional text that will be inserted into the notes buffer."
+ (save-restriction
+ (save-excursion
+ (when findpos
+ (org-back-to-heading t)
+ (narrow-to-region (point) (save-excursion
+ (outline-next-heading) (point)))
+ (while (re-search-forward
+ (concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)")
+ (point-max) t) (forward-line))
+ (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
+ "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
+ "[^\r\n]*\\)?"))
+ (goto-char (match-end 0))
+ (unless org-log-states-order-reversed
+ (and (= (char-after) ?\n) (forward-char 1))
+ (org-skip-over-state-notes)
+ (skip-chars-backward " \t\n\r")))
+ (move-marker org-log-note-marker (point))
+ (setq org-log-note-purpose purpose
+ org-log-note-state state
+ org-log-note-how how
+ org-log-note-extra extra)
+ (add-hook 'post-command-hook 'org-add-log-note 'append))))
(defun org-skip-over-state-notes ()
"Skip past the list of State notes in an entry."
@@ -8954,6 +8395,7 @@ the current entry. If not, assume that it can be inserted at point."
((eq org-log-note-purpose 'note)
"this entry")
(t (error "This should not happen")))))
+ (if org-log-note-extra (insert org-log-note-extra))
(org-set-local 'org-finish-function 'org-store-log-note)))
(defvar org-note-abort nil) ; dynamically scoped
@@ -9281,7 +8723,7 @@ only lines with a TODO keyword are included in the output."
(tags-alist (list (cons 0 (mapcar 'downcase org-file-tags))))
(llast 0) rtn rtn1 level category i txt
todo marker entry priority)
- (when (not (member action '(agenda sparse-tree)))
+ (when (not (or (member action '(agenda sparse-tree)) (functionp action)))
(setq action (list 'lambda nil action)))
(save-excursion
(goto-char (point-min))
@@ -9317,7 +8759,7 @@ only lines with a TODO keyword are included in the output."
(setcdr (car tags-alist)
(org-remove-uniherited-tags (cdar tags-alist))))
(when (and (or (not todo-only) (member todo org-not-done-keywords))
- (eval matcher)
+ (let ((case-fold-search t)) (eval matcher))
(or
(not (member org-archive-tag tags-list))
;; we have an archive tag, should we use this anyway?
@@ -9373,7 +8815,9 @@ only lines with a TODO keyword are included in the output."
(lambda (x) (if (string-match org-use-tag-inheritance x) x nil))
tags)))
((listp org-use-tag-inheritance)
- (org-delete-all org-use-tag-inheritance tags))))
+ (delq nil (mapcar
+ (lambda (x) (if (member x org-use-tag-inheritance) x nil))
+ tags)))))
(defvar todo-only) ;; dynamically scoped
@@ -9435,8 +8879,8 @@ also TODO lines."
(re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\([[:alnum:]_]+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@]+\\)"))
minus tag mm
tagsmatch todomatch tagsmatcher todomatcher kwd matcher
- orterms term orlist re-p str-p level-p level-op
- prop-p pn pv po cat-p gv time-p)
+ orterms term orlist re-p str-p level-p level-op time-p
+ prop-p pn pv po cat-p gv)
(if (string-match "/+" match)
;; match contains also a todo-matching request
(progn
@@ -9584,11 +9028,21 @@ it as a time string and apply `float-time' to it. f S is nil, just return 0."
(defvar org-tags-overlay (org-make-overlay 1 1))
(org-detach-overlay org-tags-overlay)
-(defun org-get-tags-at (&optional pos)
+(defun org-get-local-tags-at (&optional pos)
+ "Get a list of tags defined in the current headline."
+ (org-get-tags-at pos 'local))
+
+(defun org-get-local-tags ()
+ "Get a list of tags defined in the current headline."
+ (org-get-tags-at nil 'local))
+
+(defun org-get-tags-at (&optional pos local)
"Get a list of all headline tags applicable at POS.
POS defaults to point. If tags are inherited, the list contains
the targets in the same sequence as the headlines appear, i.e.
-the tags of the current headline come last."
+the tags of the current headline come last.
+When LOCAL is non-nil, only return tags from the current headline,
+ignore inherited ones."
(interactive)
(let (tags ltags lastpos parent)
(save-excursion
@@ -9596,20 +9050,25 @@ the tags of the current headline come last."
(widen)
(goto-char (or pos (point)))
(save-match-data
- (condition-case nil
- (progn
- (org-back-to-heading t)
- (while (not (equal lastpos (point)))
- (setq lastpos (point))
- (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$"))
- (setq ltags (org-split-string
- (org-match-string-no-properties 1) ":"))
- (setq tags (append (org-remove-uniherited-tags ltags)
- tags)))
- (or org-use-tag-inheritance (error ""))
- (org-up-heading-all 1)
- (setq parent t)))
- (error nil))))
+ (catch 'done
+ (condition-case nil
+ (progn
+ (org-back-to-heading t)
+ (while (not (equal lastpos (point)))
+ (setq lastpos (point))
+ (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$"))
+ (setq ltags (org-split-string
+ (org-match-string-no-properties 1) ":"))
+ (setq tags (append
+ (if parent
+ (org-remove-uniherited-tags ltags)
+ ltags)
+ tags)))
+ (or org-use-tag-inheritance (throw 'done t))
+ (if local (throw 'done t))
+ (org-up-heading-all 1)
+ (setq parent t)))
+ (error nil)))))
(append (org-remove-uniherited-tags org-file-tags) tags))))
(defun org-toggle-tag (tag &optional onoff)
@@ -10087,7 +9546,11 @@ the scanner. The following items can be given here:
(org-agenda-skip-function
(car (org-delete-all '(comment archive) skip)))
(org-tags-match-list-sublevels t)
- matcher pos file)
+ matcher pos file
+ org-todo-keywords-for-agenda
+ org-done-keywords-for-agenda
+ org-todo-keyword-alist-for-agenda
+ org-tag-alist-for-agenda)
(cond
((eq match t) (setq matcher t))
@@ -10352,6 +9815,7 @@ If yes, return this value. If not, return the current value of the variable."
"Add VALUE to the words in the PROPERTY in entry at point-or-marker POM."
(let* ((old (org-entry-get pom property))
(values (and old (org-split-string old "[ \t]"))))
+ (setq value (org-entry-protect-space value))
(unless (member value values)
(setq values (cons value values))
(org-entry-put pom property
@@ -10361,6 +9825,7 @@ If yes, return this value. If not, return the current value of the variable."
"Remove VALUE from words in the PROPERTY in entry at point-or-marker POM."
(let* ((old (org-entry-get pom property))
(values (and old (org-split-string old "[ \t]"))))
+ (setq value (org-entry-protect-space value))
(when (member value values)
(setq values (delete value values))
(org-entry-put pom property
@@ -10370,12 +9835,51 @@ If yes, return this value. If not, return the current value of the variable."
"Is VALUE one of the words in the PROPERTY in entry at point-or-marker POM?"
(let* ((old (org-entry-get pom property))
(values (and old (org-split-string old "[ \t]"))))
+ (setq value (org-entry-protect-space value))
(member value values)))
-(defvar org-entry-property-inherited-from (make-marker))
+(defun org-entry-get-multivalued-property (pom property)
+ "Return a list of values in a multivalued property."
+ (let* ((value (org-entry-get pom property))
+ (values (and value (org-split-string value "[ \t]"))))
+ (mapcar 'org-entry-restore-space values)))
+
+(defun org-entry-put-multivalued-property (pom property &rest values)
+ "Set multivalued PROPERTY at point-or-marker POM to VALUES.
+VALUES should be a list of strings. Spaces will be protected."
+ (org-entry-put pom property
+ (mapconcat 'org-entry-protect-space values " "))
+ (let* ((value (org-entry-get pom property))
+ (values (and value (org-split-string value "[ \t]"))))
+ (mapcar 'org-entry-restore-space values)))
+
+(defun org-entry-protect-space (s)
+ "Protect spaces and newline in string S."
+ (while (string-match " " s)
+ (setq s (replace-match "%20" t t s)))
+ (while (string-match "\n" s)
+ (setq s (replace-match "%0A" t t s)))
+ s)
+
+(defun org-entry-restore-space (s)
+ "Restore spaces and newline in string S."
+ (while (string-match "%20" s)
+ (setq s (replace-match " " t t s)))
+ (while (string-match "%0A" s)
+ (setq s (replace-match "\n" t t s)))
+ s)
+
+(defvar org-entry-property-inherited-from (make-marker)
+ "Marker pointing to the entry from where a proerty was inherited.
+Each call to `org-entry-get-with-inheritance' will set this marker to the
+location of the entry where the inheriance search matched. If there was
+no match, the marker will point nowhere.
+Note that also `org-entry-get' calls this function, if the INHERIT flag
+is set.")
(defun org-entry-get-with-inheritance (property)
"Get entry property, and search higher levels if not present."
+ (move-marker org-entry-property-inherited-from nil)
(let (tmp)
(save-excursion
(save-restriction
@@ -10704,7 +10208,7 @@ Return the position where this entry starts, or nil if there is no such entry."
(defvar org-end-time-was-given) ; dynamically scoped parameter
(defvar org-ts-what) ; dynamically scoped parameter
-(defun org-time-stamp (arg)
+(defun org-time-stamp (arg &optional inactive)
"Prompt for a date/time and insert a time stamp.
If the user specifies a time like HH:MM, or if this command is called
with a prefix argument, the time stamp will contain date and time.
@@ -10728,28 +10232,30 @@ at the cursor, it will be modified."
(default-input (and ts (org-get-compact-tod ts)))
org-time-was-given org-end-time-was-given time)
(cond
- ((and (org-at-timestamp-p)
- (eq last-command 'org-time-stamp)
- (eq this-command 'org-time-stamp))
+ ((and (org-at-timestamp-p t)
+ (memq last-command '(org-time-stamp org-time-stamp-inactive))
+ (memq this-command '(org-time-stamp org-time-stamp-inactive)))
(insert "--")
(setq time (let ((this-command this-command))
- (org-read-date arg 'totime nil nil default-time default-input)))
- (org-insert-time-stamp time (or org-time-was-given arg)))
- ((org-at-timestamp-p)
+ (org-read-date arg 'totime nil nil
+ default-time default-input)))
+ (org-insert-time-stamp time (or org-time-was-given arg) inactive))
+ ((org-at-timestamp-p t)
(setq time (let ((this-command this-command))
(org-read-date arg 'totime nil nil default-time default-input)))
- (when (org-at-timestamp-p) ; just to get the match data
+ (when (org-at-timestamp-p t) ; just to get the match data
+; (setq inactive (eq (char-after (match-beginning 0)) ?\[))
(replace-match "")
(setq org-last-changed-timestamp
(org-insert-time-stamp
time (or org-time-was-given arg)
- nil nil nil (list org-end-time-was-given))))
+ inactive nil nil (list org-end-time-was-given))))
(message "Timestamp updated"))
(t
(setq time (let ((this-command this-command))
(org-read-date arg 'totime nil nil default-time default-input)))
- (org-insert-time-stamp time (or org-time-was-given arg)
- nil nil nil (list org-end-time-was-given))))))
+ (org-insert-time-stamp time (or org-time-was-given arg) inactive
+ nil nil (list org-end-time-was-given))))))
;; FIXME: can we use this for something else, like computing time differences?
(defun org-get-compact-tod (s)
@@ -10775,10 +10281,7 @@ brackets. It is inactive in the sense that it does not trigger agenda entries,
does not link to the calendar and cannot be changed with the S-cursor keys.
So these are more for recording a certain time/date."
(interactive "P")
- (let (org-time-was-given org-end-time-was-given time)
- (setq time (org-read-date arg 'totime))
- (org-insert-time-stamp time (or org-time-was-given arg) 'inactive
- nil nil (list org-end-time-was-given))))
+ (org-time-stamp arg 'inactive))
(defvar org-date-ovl (org-make-overlay 1 1))
(org-overlay-put org-date-ovl 'face 'org-warning)
@@ -10978,7 +10481,7 @@ user."
org-end-time-was-given
(substring txt (match-end 0)))))
(setq org-read-date-overlay
- (make-overlay (1- (point-at-eol)) (point-at-eol)))
+ (org-make-overlay (1- (point-at-eol)) (point-at-eol)))
(org-overlay-display org-read-date-overlay txt 'secondary-selection))))
(defun org-read-date-analyze (ans def defdecode)
@@ -11164,17 +10667,6 @@ Also, store the cursor date in variable org-ans2."
(org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
(select-window sw)))
-; ;; Update the prompt to show new default date
-; (save-excursion
-; (goto-char (point-min))
-; (when (and org-ans2
-; (re-search-forward "\\[[-0-9]+\\]" nil t)
-; (get-text-property (match-end 0) 'field))
-; (let ((inhibit-read-only t))
-; (replace-match (concat "[" org-ans2 "]") t t)
-; (add-text-properties (point-min) (1+ (match-end 0))
-; (text-properties-at (1+ (point-min)))))))))
-
(defun org-calendar-select ()
"Return to `org-read-date' with the date currently selected.
This is used by `org-read-date' in a temporary keymap for the calendar buffer."
@@ -11880,7 +11372,7 @@ If there is already a time stamp at the cursor position, update it."
With a prefix argument, restrict available to files.
With two prefix arguments, restrict available buffers to agenda files.
-Due to some yet unresolved reason, global function
+Due to some yet unresolved reason, the global function
`iswitchb-mode' needs to be active for this function to work."
(interactive "P")
(require 'iswitchb)
@@ -11899,33 +11391,43 @@ Due to some yet unresolved reason, global function
"Switch-to: " nil t))
(or enabled (iswitchb-mode -1))))))
-(defun org-buffer-list (&optional predicate tmp)
+(defun org-buffer-list (&optional predicate exclude-tmp)
"Return a list of Org buffers.
-PREDICATE can be either 'export, 'files or 'agenda.
-
-'export restrict the list to Export buffers.
-'files restrict the list to buffers visiting Org files.
-'agenda restrict the list to buffers visiting agenda files.
-
-If TMP is non-nil, don't include temporary buffers."
- (let (filter blist)
- (setq filter
- (cond ((eq predicate 'files) "\.org$")
- ((eq predicate 'export) "\*Org .*Export")
- (t "\*Org \\|\.org$")))
- (setq blist
+PREDICATE can be `export', `files' or `agenda'.
+
+export restrict the list to Export buffers.
+files restrict the list to buffers visiting Org files.
+agenda restrict the list to buffers visiting agenda files.
+
+If EXCLUDE-TMP is non-nil, ignore temporary buffers."
+ (let* ((bfn nil)
+ (agenda-files (and (eq predicate 'agenda)
+ (mapcar 'file-truename (org-agenda-files t))))
+ (filter
+ (cond
+ ((eq predicate 'files)
+ (lambda (b) (with-current-buffer b (eq major-mode 'org-mode))))
+ ((eq predicate 'export)
+ (lambda (b) (string-match "\*Org .*Export" (buffer-name b))))
+ ((eq predicate 'agenda)
+ (lambda (b)
+ (with-current-buffer b
+ (and (eq major-mode 'org-mode)
+ (setq bfn (buffer-file-name b))
+ (member (file-truename bfn) agenda-files)))))
+ (t (lambda (b) (with-current-buffer b
+ (or (eq major-mode 'org-mode)
+ (string-match "\*Org .*Export"
+ (buffer-name b)))))))))
+ (delq nil
(mapcar
(lambda(b)
- (let ((bname (buffer-name b))
- (bfile (buffer-file-name b)))
- (if (and (string-match filter bname)
- (if (eq predicate 'agenda)
- (member bfile
- (mapcar (lambda(f) (file-truename f))
- org-agenda-files)) t)
- (if tmp (not (string-match "tmp" bname)) t)) b)))
- (buffer-list)))
- (delete nil blist)))
+ (if (and (funcall filter b)
+ (or (not exclude-tmp)
+ (not (string-match "tmp" (buffer-name b)))))
+ b
+ nil))
+ (buffer-list)))))
(defun org-agenda-files (&optional unrestricted archives)
"Get the list of agenda files.
@@ -12129,6 +11631,11 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(append org-todo-keywords-for-agenda org-todo-keywords-1))
(setq org-done-keywords-for-agenda
(append org-done-keywords-for-agenda org-done-keywords))
+ (setq org-todo-keyword-alist-for-agenda
+ (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
+ (setq org-tag-alist-for-agenda
+ (append org-tag-alist-for-agenda org-tag-alist))
+
(save-excursion
(remove-text-properties (point-min) (point-max) pall)
(when org-agenda-skip-archived-trees
@@ -12141,7 +11648,10 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(while (re-search-forward re nil t)
(add-text-properties
(match-beginning 0) (org-end-of-subtree t) pc)))
- (set-buffer-modified-p bmp))))))
+ (set-buffer-modified-p bmp))))
+ (setq org-todo-keyword-alist-for-agenda
+ (org-uniquify org-todo-keyword-alist-for-agenda)
+ org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
;;;; Embedded LaTeX
@@ -12491,7 +12001,8 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
;; We only set them when really needed because otherwise the
;; menus don't show the simple keys
-(when (or (featurep 'xemacs) ;; because XEmacs supports multi-device stuff
+(when (or org-use-extra-keys
+ (featurep 'xemacs) ;; because XEmacs supports multi-device stuff
(not window-system))
(org-defkey org-mode-map "\C-c\C-xc" 'org-table-copy-down)
(org-defkey org-mode-map "\C-c\C-xM" 'org-insert-todo-heading)
@@ -12540,7 +12051,8 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
(org-defkey org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res.
(org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret)
(org-defkey org-mode-map "\M-\C-m" 'org-insert-heading)
-(org-defkey org-mode-map [(control return)] 'org-insert-heading-after-current)
+(org-defkey org-mode-map [(control return)] 'org-insert-heading-respect-content)
+(org-defkey org-mode-map [(shift control return)] 'org-insert-todo-heading-respect-content)
(org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link)
(org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link)
(org-defkey org-mode-map "\C-c\C-l" 'org-insert-link)
@@ -12577,7 +12089,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
(org-defkey org-mode-map "\C-c|" 'org-table-create-or-convert-from-region)
(org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
(org-defkey org-mode-map "\C-c~" 'org-table-create-with-table.el)
-(org-defkey org-mode-map "\C-c\C-q" 'org-table-wrap-region)
+(org-defkey org-mode-map "\C-c\C-a" 'org-attach)
(org-defkey org-mode-map "\C-c}" 'org-table-toggle-coordinate-overlays)
(org-defkey org-mode-map "\C-c{" 'org-table-toggle-formula-debugger)
(org-defkey org-mode-map "\C-c\C-e" 'org-export)
@@ -12600,7 +12112,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
(org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
(org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
(org-defkey org-mode-map "\C-c\C-xp" 'org-set-property)
-(org-defkey org-mode-map "\C-c\C-xr" 'org-insert-columns-dblock)
+(org-defkey org-mode-map "\C-c\C-xi" 'org-insert-columns-dblock)
(define-key org-mode-map "\C-c\C-x\C-c" 'org-columns)
@@ -12955,6 +12467,7 @@ When in an #+include line, visit the include file. Otherwise call
(looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)"))
(find-file (org-trim (match-string 1))))
((org-edit-src-code))
+ ((org-edit-fixed-width-region))
(t (call-interactively 'ffap))))
(defun org-ctrl-c-ctrl-c (&optional arg)
@@ -13027,7 +12540,7 @@ This command does many different things, depending on context:
((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:"))
;; Dynamic block
(beginning-of-line 1)
- (org-update-dblock))
+ (save-excursion (org-update-dblock)))
((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
(cond
((equal (match-string 1) "TBLFM")
@@ -13316,6 +12829,7 @@ See the individual commands for more information."
(setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees))
:style toggle :selected org-cycle-open-archived-trees]
"--"
+ ["Move subtree to archive sibling" org-archive-to-archive-sibling t]
["Move Subtree to Archive" org-advertized-archive-subtree t]
; ["Check and Move Children" (org-archive-subtree '(4))
; :active t :keys "C-u C-c C-x C-s"]
@@ -13513,7 +13027,7 @@ With optional NODE, go directly to that node."
(sit-for 0))))
(defun org-goto-marker-or-bmk (marker &optional bookmark)
- "Go to MARKER, widen if necesary. When marker is not live, try BOOKMARK."
+ "Go to MARKER, widen if necessary. When marker is not live, try BOOKMARK."
(if (and marker (marker-buffer marker)
(buffer-live-p (marker-buffer marker)))
(progn
@@ -13568,6 +13082,42 @@ upon the next fontification round."
(setq l (- l (get-text-property b 'org-dwidth-n s))))
l))
+(defun org-get-indentation (&optional line)
+ "Get the indentation of the current line, interpreting tabs.
+When LINE is given, assume it represents a line and compute its indentation."
+ (if line
+ (if (string-match "^ *" (org-remove-tabs line))
+ (match-end 0))
+ (save-excursion
+ (beginning-of-line 1)
+ (skip-chars-forward " \t")
+ (current-column))))
+
+(defun org-remove-tabs (s &optional width)
+ "Replace tabulators in S with spaces.
+Assumes that s is a single line, starting in column 0."
+ (setq width (or width tab-width))
+ (while (string-match "\t" s)
+ (setq s (replace-match
+ (make-string
+ (- (* width (/ (+ (match-beginning 0) width) width))
+ (match-beginning 0)) ?\ )
+ t t s)))
+ s)
+
+(defun org-fix-indentation (line ind)
+ "Fix indentation in LINE.
+IND is a cons cell with target and minimum indentation.
+If the current indenation in LINE is smaller than the minimum,
+leave it alone. If it is larger than ind, set it to the target."
+ (let* ((l (org-remove-tabs line))
+ (i (org-get-indentation l))
+ (i1 (car ind)) (i2 (cdr ind)))
+ (if (>= i i2) (setq l (substring line i2)))
+ (if (> i1 0)
+ (concat (make-string i1 ?\ ) l)
+ l)))
+
(defun org-base-buffer (buffer)
"Return the base buffer of BUFFER, if it has one. Else return the buffer."
(if (not buffer)
@@ -14006,7 +13556,6 @@ which make use of the date at the cursor."
(setq column (current-column))))
((org-in-item-p)
(org-beginning-of-item)
-; (looking-at "[ \t]*\\(\\S-+\\)[ \t]*")
(looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?")
(setq bpos (match-beginning 1) tpos (match-end 0)
bcol (progn (goto-char bpos) (current-column))
@@ -14244,8 +13793,34 @@ beyond the end of the headline."
(org-set-tags nil t))
(t (kill-region (point) (point-at-eol)))))
+
(define-key org-mode-map "\C-k" 'org-kill-line)
+(defun org-yank ()
+ "Yank, and if the yanked text is a single subtree, fold it.
+In fact, if the yanked text is a sequence of subtrees, fold all of them."
+ (interactive)
+ (if org-yank-folded-subtrees
+ (let ((beg (point)) end)
+ (call-interactively 'yank)
+ (setq end (point))
+ (goto-char beg)
+ (when (and (bolp)
+ (org-kill-is-subtree-p))
+ (or (looking-at outline-regexp)
+ (re-search-forward (concat "^" outline-regexp) end t))
+ (while (and (< (point) end) (looking-at outline-regexp))
+ (hide-subtree)
+ (org-cycle-show-empty-lines 'folded)
+ (condition-case nil
+ (outline-forward-same-level 1)
+ (error (goto-char end)))))
+ (goto-char end)
+ (skip-chars-forward " \t\n\r"))
+ (call-interactively 'yank)))
+
+(define-key org-mode-map "\C-y" 'org-yank)
+
(defun org-invisible-p ()
"Check if point is at a character currently not visible."
;; Early versions of noutline don't have `outline-invisible-p'.
@@ -14358,6 +13933,35 @@ When ENTRY is non-nil, show the entire entry."
(save-excursion (outline-end-of-heading) (point))
flag))))
+(defun org-forward-same-level (arg)
+ "Move forward to the ARG'th subheading at same level as this one.
+Stop at the first and last subheadings of a superior heading.
+This is like outline-forward-same-level, but invisible headings are ok."
+ (interactive "p")
+ (outline-back-to-heading t)
+ (while (> arg 0)
+ (let ((point-to-move-to (save-excursion
+ (org-get-next-sibling))))
+ (if point-to-move-to
+ (progn
+ (goto-char point-to-move-to)
+ (setq arg (1- arg)))
+ (progn
+ (setq arg 0)
+ (error "No following same-level heading"))))))
+
+(defun org-get-next-sibling ()
+ "Move to next heading of the same level, and return point.
+If there is no such heading, return nil.
+This is like outline-next-sibling, but invisible headings are ok."
+ (let ((level (funcall outline-level)))
+ (outline-next-heading)
+ (while (and (not (eobp)) (> (funcall outline-level) level))
+ (outline-next-heading))
+ (if (or (eobp) (< (funcall outline-level) level))
+ nil
+ (point))))
+
(defun org-end-of-subtree (&optional invisible-OK to-heading)
;; This is an exact copy of the original function, but it uses
;; `org-back-to-heading', to make it work also in invisible
@@ -14469,7 +14073,8 @@ Show the heading too, if it is currently invisible."
(setq level (org-reduced-level (funcall outline-level)))
(when (<= level n)
(looking-at org-complex-heading-regexp)
- (setq head (org-match-string-no-properties 4)
+ (setq head (org-link-display-format
+ (org-match-string-no-properties 4))
m (org-imenu-new-marker))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (>= level last-level)
@@ -14486,6 +14091,17 @@ Show the heading too, if it is currently invisible."
(if (eq major-mode 'org-mode)
(org-show-context 'org-goto))))))
+(defun org-link-display-format (link)
+ "Replace a link with either the description, or the link target
+if no description is present"
+ (save-match-data
+ (if (string-match org-bracket-link-analytic-regexp link)
+ (replace-match (or (match-string 5 link)
+ (concat (match-string 1 link)
+ (match-string 3 link)))
+ nil nil link)
+ link)))
+
;; Speedbar support
(defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1)