Mercurial > emacs
changeset 96975:60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-region-as-html, org-export-as-html): Make
sure that calls from `org-export-region-as-html' do not do the
special check for a subtree.
* org-agenda.el (org-batch-store-agenda-views): Fix parsing bug.
* org.el (org-open-file): Use
`org-open-directory-means-index-dot-org'.
(org-open-directory-means-index-dot-org): New option.
* org.el (org-make-link-string): Remove link attributes from
description.
(org-open-at-point): Remove link attributes bevore using the path.
* org-exp.el (org-export-as-html): Handle link attributes.
* org.el (org-extract-attributes, org-attributes-to-string): New functions.
* org-table.el (org-table-to-lisp): New function.
* org.el (org-narrow-to-subtree): Do not include the final newline
into the narrowed region.
* org-agenda.el (org-agenda-custom-commands-local-options): Fixed
bug with user-define skipping condition.
* org-agenda.el (org-agenda-get-restriction-and-command): Fixed typo.
* org-exp.el (org-export-html-style-default): Automatic overflow
handling for pre fields.
(org-export-as-ascii, org-export-as-html): Change default format
for time stamp.
* org-table.el (org-table-export): Offer completion for translator
functions, and do not require a heading above the table.
* org.el (org-renumber-ordered-list, org-beginning-of-item-list):
Cater for the case of a list starting in the first line of the
buffer.
* org-publish.el (org-publish-find-title): Bug fix.
(org-publish-org-index): Implement new :index-style option.
* org-publish.el (org-publish-timestamp-filename): Use
SHA1-encoded file names in the timestamp directory.
* org-publish.el (org-publish-needed-p): Be verbose about files
published and files skipped.
* org-exp.el (org-export-preprocess-string): Swap link
normalization and inernal link targeting.
* org-publish.el (org-publish-needed-p): Create timestamp
directory when it does not exist.
* org-clock.el (org-clock-out-when-done): Doc fix.
* org.el (org-agenda-skip-unavailable-files): Doc fix.
* org-exp.el (org-export-remove-comment-blocks-and-subtrees):
Ignore case when searching for the COMMENT cookie at export time.
* org-exp.el (org-get-file-contents)
(org-get-and-remove-property): New functions.
(org-export-handle-include-files): Handle the new prefix options.
(org-export-as-html): Fix the verse environment.
* org.el (org-time=, org-time<, org-time<=, org-time>)
(org-time>=, org-time<>, org-2ft): New functions.
(org-op-to-function): Also provide for the time testing fucntions.
* org-exp.el (org-export-html-style-default): New constant.
* org-exp.el (org-export-html-style-extra): New variable.
(org-export-splice-style): New function.
* org-exp.el (org-export-plist-vars, org-export-as-html):
Implement `org-export-creator-info'.
(org-export-creator-info): New option.
* org.el (org-clock-drawer-start-re, org-clock-drawer-end-re)
(org-property-drawer-re, org-clock-drawer-re): New constants.
* org-exp.el (org-icalendar-use-deadline)
(org-icalendar-use-scheduled): New options.
(org-icalendar-include-todo): Default changed to t.
(org-print-icalendar-entries): Implement better utilization of
scheduling and deadline time stamps.
(org-export-target-internal-links, org-export-as-html): Allow file
lines without the "file:" prefix if the file path is an absolute
path or starts with ".".
* org-clock.el (org-clocktable-shift): Also undertand yesterday,
lastweek etc.
(org-clock-special-range): Also undertand yesterday, lastweek etc.
* org.el (org-agenda-skip-archived-trees): Docstring now
discourages using this.
(org-scan-tags): Check for org-agenda-archives-mode.
(org-map-entries): Make sure org-agenda-archives-mode is nil.
(org-agenda-files): Functionality of second arg changed.
* org-agenda.el (org-agenda-archives-mode): New variable
(org-write-agenda, org-prepare-agenda, org-agenda-list)
(org-search-view, org-todo-list, org-tags-view)
(org-agenda-list-stuck-projects): Call `org-agenda-files' with
`ifmode' argument.
(org-agenda-quit): Reset the archives mode.
(org-agenda-archives-mode): New command.
(org-agenda-set-mode-name): Include archives info.
* org.el (org-paste-subtree): Make sure the yanked headline is
visible if it was yanked at a visible point.
(org-move-item-up): Fix the bug with moving white space at the end
of the item.
(org-show-empty-lines-in-parent): New function.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Thu, 24 Jul 2008 13:59:56 +0000 |
parents | fa6516860909 |
children | 86e1b62bcc3e |
files | lisp/org/ChangeLog lisp/org/org-agenda.el lisp/org/org-archive.el lisp/org/org-bbdb.el lisp/org/org-bibtex.el lisp/org/org-clock.el lisp/org/org-colview.el lisp/org/org-compat.el lisp/org/org-exp.el lisp/org/org-export-latex.el lisp/org/org-faces.el lisp/org/org-gnus.el lisp/org/org-id.el lisp/org/org-info.el lisp/org/org-irc.el lisp/org/org-jsinfo.el lisp/org/org-mac-message.el lisp/org/org-macs.el lisp/org/org-mew.el lisp/org/org-mhe.el lisp/org/org-mouse.el lisp/org/org-publish.el lisp/org/org-remember.el lisp/org/org-rmail.el lisp/org/org-table.el lisp/org/org-vm.el lisp/org/org-wl.el lisp/org/org.el |
diffstat | 28 files changed, 740 insertions(+), 261 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/org/ChangeLog Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/ChangeLog Thu Jul 24 13:59:56 2008 +0000 @@ -1,3 +1,122 @@ +2008-07-24 Carsten Dominik <dominik@science.uva.nl> + + * org-exp.el (org-export-region-as-html, org-export-as-html): Make + sure that calls from `org-export-region-as-html' do not do the + special check for a subtree. + + * org-agenda.el (org-batch-store-agenda-views): Fix parsing bug. + + * org.el (org-open-file): Use + `org-open-directory-means-index-dot-org'. + (org-open-directory-means-index-dot-org): New option. + + * org.el (org-make-link-string): Remove link attributes from + description. + (org-open-at-point): Remove link attributes bevore using the path. + + * org-exp.el (org-export-as-html): Handle link attributes. + + * org.el (org-extract-attributes, org-attributes-to-string): New functions. + + * org-table.el (org-table-to-lisp): New function. + + * org.el (org-narrow-to-subtree): Do not include the final newline + into the narrowed region. + + * org-agenda.el (org-agenda-custom-commands-local-options): Fixed + bug with user-define skipping condition. + + * org-agenda.el (org-agenda-get-restriction-and-command): Fixed typo. + + * org-exp.el (org-export-html-style-default): Automatic overflow + handling for pre fields. + (org-export-as-ascii, org-export-as-html): Change default format + for time stamp. + + * org-table.el (org-table-export): Offer completion for translator + functions, and do not require a heading above the table. + + * org.el (org-renumber-ordered-list, org-beginning-of-item-list): + Cater for the case of a list starting in the first line of the + buffer. + + * org-publish.el (org-publish-find-title): Bug fix. + (org-publish-org-index): Implement new :index-style option. + + * org-publish.el (org-publish-timestamp-filename): Use + SHA1-encoded file names in the timestamp directory. + + * org-publish.el (org-publish-needed-p): Be verbose about files + published and files skipped. + + * org-exp.el (org-export-preprocess-string): Swap link + normalization and inernal link targeting. + + * org-publish.el (org-publish-needed-p): Create timestamp + directory when it does not exist. + + * org-clock.el (org-clock-out-when-done): Doc fix. + + * org.el (org-agenda-skip-unavailable-files): Doc fix. + + * org-exp.el (org-export-remove-comment-blocks-and-subtrees): + Ignore case when searching for the COMMENT cookie at export time. + + * org-exp.el (org-get-file-contents) + (org-get-and-remove-property): New functions. + (org-export-handle-include-files): Handle the new prefix options. + (org-export-as-html): Fix the verse environment. + + * org.el (org-time=, org-time<, org-time<=, org-time>) + (org-time>=, org-time<>, org-2ft): New functions. + (org-op-to-function): Also provide for the time testing fucntions. + + * org-exp.el (org-export-html-style-default): New constant. + + * org-exp.el (org-export-html-style-extra): New variable. + (org-export-splice-style): New function. + + * org-exp.el (org-export-plist-vars, org-export-as-html): + Implement `org-export-creator-info'. + (org-export-creator-info): New option. + + * org.el (org-clock-drawer-start-re, org-clock-drawer-end-re) + (org-property-drawer-re, org-clock-drawer-re): New constants. + + * org-exp.el (org-icalendar-use-deadline) + (org-icalendar-use-scheduled): New options. + (org-icalendar-include-todo): Default changed to t. + (org-print-icalendar-entries): Implement better utilization of + scheduling and deadline time stamps. + (org-export-target-internal-links, org-export-as-html): Allow file + lines without the "file:" prefix if the file path is an absolute + path or starts with ".". + + * org-clock.el (org-clocktable-shift): Also undertand yesterday, + lastweek etc. + (org-clock-special-range): Also undertand yesterday, lastweek etc. + + * org.el (org-agenda-skip-archived-trees): Docstring now + discourages using this. + (org-scan-tags): Check for org-agenda-archives-mode. + (org-map-entries): Make sure org-agenda-archives-mode is nil. + (org-agenda-files): Functionality of second arg changed. + + * org-agenda.el (org-agenda-archives-mode): New variable + (org-write-agenda, org-prepare-agenda, org-agenda-list) + (org-search-view, org-todo-list, org-tags-view) + (org-agenda-list-stuck-projects): Call `org-agenda-files' with + `ifmode' argument. + (org-agenda-quit): Reset the archives mode. + (org-agenda-archives-mode): New command. + (org-agenda-set-mode-name): Include archives info. + + * org.el (org-paste-subtree): Make sure the yanked headline is + visible if it was yanked at a visible point. + (org-move-item-up): Fix the bug with moving white space at the end + of the item. + (org-show-empty-lines-in-parent): New function. + 2008-07-19 Juri Linkov <juri@jurta.org> * org.el (narrow-map): Bind `org-narrow-to-subtree' to "s" on the
--- a/lisp/org/org-agenda.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-agenda.el Thu Jul 24 13:59:56 2008 +0000 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -211,9 +211,8 @@ (const :tag "no deadline" 'notdeadline)))))) (list :tag "Non-standard skipping condition" :value (org-agenda-skip-function) - (list - (const org-agenda-skip-function) - (sexp :tag "Function or form (quoted!)"))))) + (const org-agenda-skip-function) + (sexp :tag "Function or form (quoted!)")))) "Selection of examples for agenda command settings. This will be spliced into the custom type of `org-agenda-custom-commands'.") @@ -392,6 +391,13 @@ :tag "Org Agenda Skip" :group 'org-agenda) +(defvar org-agenda-archives-mode nil + "Non-nil means, the agenda will include archived items. +If this is the symbol `trees', trees in the selected agenda scope +that are marked with the ARCHIVE tag will be included anyway. When this is +t, also all archive files associated with the current selection of agenda +files will be included.") + (defcustom org-agenda-skip-comment-trees t "Non-nil means, skip trees that start with teh COMMENT keyword. When nil, these trees are also scand by agenda commands." @@ -1105,6 +1111,7 @@ (org-defkey org-agenda-mode-map "f" 'org-agenda-follow-mode) (org-defkey org-agenda-mode-map "R" 'org-agenda-clockreport-mode) (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode) +(org-defkey org-agenda-mode-map "v" 'org-agenda-archives-mode) (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary) (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid) (org-defkey org-agenda-mode-map "r" 'org-agenda-redo) @@ -1234,14 +1241,25 @@ ["Year View" org-agenda-year-view :active (org-agenda-check-type nil 'agenda) :style radio :selected (member org-agenda-ndays '(365 366))] "--" - ["Show Logbook entries" org-agenda-log-mode - :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)] + ["Include Diary" org-agenda-toggle-diary + :style toggle :selected org-agenda-include-diary + :active (org-agenda-check-type nil 'agenda)] + ["Use Time Grid" org-agenda-toggle-time-grid + :style toggle :selected org-agenda-use-time-grid + :active (org-agenda-check-type nil 'agenda)] + "--" ["Show clock report" org-agenda-clockreport-mode - :style toggle :selected org-agenda-clockreport-mode :active (org-agenda-check-type nil 'agenda)] - ["Include Diary" org-agenda-toggle-diary - :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)] - ["Use Time Grid" org-agenda-toggle-time-grid - :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)]) + :style toggle :selected org-agenda-clockreport-mode + :active (org-agenda-check-type nil 'agenda)] + "--" + ["Show Logbook entries" org-agenda-log-mode + :style toggle :selected org-agenda-show-log + :active (org-agenda-check-type nil 'agenda 'timeline)] + ["Include archived trees" org-agenda-archives-mode + :style toggle :selected org-agenda-archives-mode :active t] + ["Include archive files" (org-agenda-archives-mode t) + :style toggle :selected (eq org-agenda-archives-mode t) :active t + :keys "C-u v"]) ["Write view to file" org-write-agenda t] ["Rebuild buffer" org-agenda-redo t] ["Save all Org-mode Buffers" org-save-all-org-buffers t] @@ -1475,7 +1493,7 @@ (insert (eval-when-compile (let ((header " -Press key for an agenda command: < Buffer,subtree/region restriction +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 @@ -1790,7 +1808,7 @@ (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) (pop-up-frames nil) (dir default-directory) - pars cmd thiscmdkey files opts) + pars cmd thiscmdkey files opts cmd-or-set) (while parameters (push (list (pop parameters) (if parameters (pop parameters))) pars)) (setq pars (reverse pars)) @@ -1798,8 +1816,9 @@ (while cmds (setq cmd (pop cmds) thiscmdkey (car cmd) - opts (nth 4 cmd) - files (nth 5 cmd)) + cmd-or-set (nth 2 cmd) + opts (nth (if (listp cmd-or-set) 3 4) cmd) + files (nth (if (listp cmd-or-set) 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files (eval (list 'let (append org-agenda-exporter-settings opts pars) @@ -1855,7 +1874,8 @@ (org-agenda-collect-markers))) (org-icalendar-verify-function 'org-check-agenda-marker-table) (org-combined-agenda-icalendar-file file)) - (apply 'org-export-icalendar 'combine (org-agenda-files)))) + (apply 'org-export-icalendar 'combine + (org-agenda-files nil 'ifmode)))) (t (let ((bs (buffer-string))) (find-file file) @@ -1937,7 +1957,7 @@ (org-agenda-reset-markers) (setq org-agenda-contributing-files nil) (setq org-agenda-columns-active nil) - (org-prepare-agenda-buffers (org-agenda-files)) + (org-prepare-agenda-buffers (org-agenda-files nil 'ifmode)) (setq org-todo-keywords-for-agenda (org-uniquify org-todo-keywords-for-agenda)) (setq org-done-keywords-for-agenda @@ -2032,7 +2052,7 @@ Also moves point to the end of the skipped region, so that search can continue from there." (let ((p (point-at-bol)) to fp) - (and org-agenda-skip-archived-trees + (and org-agenda-skip-archived-trees (not org-agenda-archives-mode) (get-text-property p :org-archived) (org-end-of-subtree t) (throw :skip t)) @@ -2255,7 +2275,7 @@ (let* ((org-agenda-start-on-weekday (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays))) org-agenda-start-on-weekday nil)) - (thefiles (org-agenda-files)) + (thefiles (org-agenda-files nil 'ifmode)) (files thefiles) (today (time-to-days (time-subtract (current-time) @@ -2373,7 +2393,7 @@ (put-text-property s (1- (point)) 'day d) (put-text-property s (1- (point)) 'org-day-cnt day-cnt)))) (when (and org-agenda-clockreport-mode clocktable-start) - (let ((org-agenda-files (org-agenda-files)) + (let ((org-agenda-files (org-agenda-files nil 'ifmode)) ;; the above line is to ensure the restricted range! (p org-agenda-clockreport-parameter-plist) tbl) @@ -2502,7 +2522,7 @@ (setq regexp (pop regexps+)) (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?" regexp)))) - (setq files (org-agenda-files)) + (setq files (org-agenda-files nil 'ifmode)) (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) (pop org-agenda-text-search-extra-files) (setq files (org-add-archive-files files))) @@ -2633,7 +2653,7 @@ (org-set-local 'org-last-arg arg) (setq org-agenda-redo-command '(org-todo-list (or current-prefix-arg org-last-arg))) - (setq files (org-agenda-files) + (setq files (org-agenda-files nil 'ifmode) rtnall nil) (while (setq file (pop files)) (catch 'nextfile @@ -2690,7 +2710,7 @@ (setq org-agenda-redo-command (list 'org-tags-view (list 'quote todo-only) (list 'if 'current-prefix-arg nil 'org-agenda-query-string))) - (setq files (org-agenda-files) + (setq files (org-agenda-files nil 'ifmode) rtnall nil) (while (setq file (pop files)) (catch 'nextfile @@ -2827,7 +2847,8 @@ (todo (nth 1 org-stuck-projects)) (todo-wds (if (member "*" todo) (progn - (org-prepare-agenda-buffers (org-agenda-files)) + (org-prepare-agenda-buffers (org-agenda-files + nil 'ifmode)) (org-delete-all org-done-keywords-for-agenda (copy-sequence org-todo-keywords-for-agenda))) @@ -4002,7 +4023,8 @@ (if (not (one-window-p)) (delete-window)) (kill-buffer buf) (org-agenda-reset-markers) - (org-columns-remove-overlays)) + (org-columns-remove-overlays) + (setq org-agenda-archives-mode nil)) ;; Maybe restore the pre-agenda window configuration. (and org-agenda-restore-windows-after-quit (not (eq org-agenda-window-setup 'other-frame)) @@ -4340,6 +4362,24 @@ (message "Log mode is %s" (if org-agenda-show-log "on" "off"))) +(defun org-agenda-archives-mode (&optional with-files) + "Toggle log mode in an agenda buffer." + (interactive "P") + (setq org-agenda-archives-mode + (if with-files t (if org-agenda-archives-mode nil 'trees))) + (org-agenda-set-mode-name) + (org-agenda-redo) + (message + "%s" + (cond + ((eq org-agenda-archives-mode nil) + "No archives are included") + ((eq org-agenda-archives-mode 'trees) + (format "Trees with :%s: tag are included" org-archive-tag)) + ((eq org-agenda-archives-mode t) + (format "Trees with :%s: tag and all active archive files are included" + org-archive-tag))))) + (defun org-agenda-toggle-diary () "Toggle diary inclusion in an agenda buffer." (interactive) @@ -4370,6 +4410,11 @@ (if org-agenda-include-diary " Diary" "") (if org-agenda-use-time-grid " Grid" "") (if org-agenda-show-log " Log" "") + (if org-agenda-archives-mode + (if (eq org-agenda-archives-mode t) + " Archives" + (format " :%s:" org-archive-tag)) + "") (if org-agenda-clockreport-mode " Clock" ""))) (force-mode-line-update))
--- a/lisp/org/org-archive.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-archive.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-bbdb.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-bbdb.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-bibtex.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-bibtex.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-clock.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-clock.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -54,8 +54,8 @@ (integer :tag "When at least N clock entries"))) (defcustom org-clock-out-when-done t - "When t, the clock will be stopped when the relevant entry is marked DONE. -When nil, clock will keep running until stopped explicitly with + "When non-nil, the clock will be stopped when the relevant entry is marked DONE. +A nil value means, clock will keep running until stopped explicitly with `C-c C-x C-o', or until the clock is started in a different item." :group 'org-clock :type 'boolean) @@ -136,7 +136,7 @@ "Select a task that recently was associated with clocking." (interactive) (let (sel-list rpl file task (i 0) s) - (save-window-excursion + (save-window-excursion (org-switch-to-buffer-other-window (get-buffer-create "*Clock Task Select*")) (erase-buffer) @@ -190,7 +190,7 @@ (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))) @@ -207,7 +207,7 @@ (defun org-clock-in (&optional select) "Start the clock on the current item. If necessary, clock-out of the currently active clock. -With prefix arg SELECT, offer a list of recently clocked ta sks to +With prefix arg SELECT, offer a list of recently clocked tasks to clock into. When SELECT is `C-u C-u', clock into the current task and mark is as the default task, a special task that will always be offered in the clocking selection, associated with the letter `d'." @@ -226,13 +226,13 @@ (marker-position org-clock-marker) (marker-buffer org-clock-marker)) (org-clock-out t)) - + (when (equal select '(16)) ;; Mark as default clocking task (save-excursion (org-back-to-heading t) (move-marker org-clock-default-task (point)))) - + (setq target-pos (point)) ;; we want to clock in at this location (save-excursion (when (and selected-task (marker-buffer selected-task)) @@ -261,7 +261,7 @@ (setq org-clock-heading "???"))) (setq org-clock-heading (propertize org-clock-heading 'face nil)) (org-clock-find-position) - + (insert "\n") (backward-char 1) (indent-relative) (insert org-clock-string " ") @@ -638,7 +638,7 @@ ((string-match "\\([-+][0-9]+\\)$" skey) (setq shift (string-to-number (match-string 1 skey)) key (intern (substring skey 0 (match-beginning 1)))))) - (unless shift + (when (= shift 0) (cond ((eq key 'yesterday) (setq key 'today shift -1)) ((eq key 'lastweek) (setq key 'week shift -1)) ((eq key 'lastmonth) (setq key 'month shift -1)) @@ -690,6 +690,11 @@ (s (match-string 1)) block shift ins y mw d date wp m) (cond + ((equal s "yesterday") (setq s "today-1")) + ((equal s "lastweek") (setq s "thisweek-1")) + ((equal s "lastmonth") (setq s "thismonth-1")) + ((equal s "lastyear") (setq s "thisyear-1"))) + (cond ((string-match "^\\(today\\|thisweek\\|thismonth\\|thisyear\\)\\([-+][0-9]+\\)?$" s) (setq block (match-string 1 s) shift (if (match-end 2) @@ -735,9 +740,9 @@ (ins (make-marker)) (total-time nil) (scope (plist-get params :scope)) - (tostring (plist-get params :tostring)) - (multifile (plist-get params :multifile)) - (header (plist-get params :header)) + (tostring (plist-get params :tostring)) + (multifile (plist-get params :multifile)) + (header (plist-get params :header)) (maxlevel (or (plist-get params :maxlevel) 3)) (step (plist-get params :step)) (emph (plist-get params :emphasize))
--- a/lisp/org/org-colview.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-colview.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -1013,13 +1013,13 @@ (let* ((title (mapcar 'cadr org-columns-current-fmt-compiled)) (n (length title)) row tbl) (goto-char (point-min)) - (while (and (re-search-forward "^\\(\\*+\\) " nil t) - (or (null maxlevel) - (>= maxlevel - (if org-odd-levels-only - (/ (1+ (length (match-string 1))) 2) - (length (match-string 1)))))) - (when (get-char-property (match-beginning 0) 'org-columns-key) + (while (re-search-forward "^\\(\\*+\\) " nil t) + (when (and (or (null maxlevel) + (>= maxlevel + (if org-odd-levels-only + (/ (1+ (length (match-string 1))) 2) + (length (match-string 1))))) + (get-char-property (match-beginning 0) 'org-columns-key)) (setq row nil) (loop for i from 0 to (1- n) do (push (or (get-char-property (+ (match-beginning 0) i) 'org-columns-value-modified)
--- a/lisp/org/org-compat.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-compat.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-exp.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-exp.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -209,6 +209,12 @@ :group 'org-export-general :type 'boolean) +(defcustom org-export-creator-info t + "Non-nil means, the postamle should contain a creator sentence. +This sentence is \"HTML generated by org-mode XX in emacs XXX\"." + :group 'org-export-general + :type 'boolean) + (defcustom org-export-time-stamp-file t "Non-nil means, insert a time stamp into the exported file. The time stamp shows when the file was created. @@ -466,57 +472,69 @@ :group 'org-export-html :type '(string :tag "File or URL")) -(defcustom org-export-html-style +(defconst org-export-html-style-default "<style type=\"text/css\"> - html { - font-family: Times, serif; - font-size: 12pt; - } - .title { text-align: center; } - .todo { color: red; } - .done { color: green; } + html { font-family: Times, serif; font-size: 12pt; } + .title { text-align: center; } + .todo { color: red; } + .done { color: green; } + .tag { background-color:lightblue; font-weight:normal } + .target { } .timestamp { color: grey } .timestamp-kwd { color: CadetBlue } - .tag { background-color:lightblue; font-weight:normal } - .target { } + p.verse { margin-left: 3% } pre { border: 1pt solid #AEBDCC; background-color: #F3F5F7; padding: 5pt; font-family: courier, monospace; font-size: 90%; + overflow:auto; } table { border-collapse: collapse; } - td, th { - vertical-align: top; - <!--border: 1pt solid #ADB9CC;--> - } + td, th { vertical-align: top; } dt { font-weight: bold; } </style>" "The default style specification for exported HTML files. -Since there are different ways of setting style information, this variable -needs to contain the full HTML structure to provide a style, including the -surrounding HTML tags. The style specifications should include definitions -for new classes todo, done, title, and deadline. For example, valid values -would be: +Please use the variables `org-export-html-style' and +`org-export-html-style-extra' to add to this style.") + +(defcustom org-export-html-style "" + "Org-wide style definitions for exported HTML files. + +This variable needs to contain the full HTML structure to provide a style, +including the surrounding HTML tags. If you set the value of this variable, +you should consider to include definitions for the following classes: + title, todo, done, timestamp, timestamp-kwd, tag, target. + +For example, a valid value would be: <style type=\"text/css\"> p { font-weight: normal; color: gray; } h1 { color: black; } .title { text-align: center; } - .todo, .deadline { color: red; } + .todo, .timestamp-kwd { color: red; } .done { color: green; } </style> -or, if you want to keep the style in a file, +If you'd like to refer to en external style file, use something like <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\"> As the value of this option simply gets inserted into the HTML <head> header, -you can \"misuse\" it to add arbitrary text to the header." +you can \"misuse\" it to add arbitrary text to the header. +See also the variable `org-export-html-style-extra'." :group 'org-export-html :type 'string) +(defcustom org-export-html-style-extra "" + "Additional style information for HTML export. +The value of this variable is inserted into the HTML buffer right after +the value of `org-export-html-style'. Use this variable for per-file +settings of style information, and do not forget to surround the style +settings with <style>...</style> tags." + :group 'org-export-html + :type 'string) (defcustom org-export-html-title-format "<h1 class=\"title\">%s</h1>\n" "Format for typesetting the document title in HTML export." @@ -625,6 +643,46 @@ :group 'org-export-icalendar :type 'file) +(defcustom org-icalendar-combined-name "OrgMode" + "Calendar name for the combined iCalendar representing all agenda files." + :group 'org-export-icalendar + :type 'string) + +(defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) + "Contexts where iCalendar export should use a deadline time stamp. +This is a list with several symbols in it. Valid symbol are: + +event-if-todo Deadlines in TODO entries become calendar events. +event-if-not-todo Deadlines in non-TODO entries become calendar events. +todo-due Use deadlines in TODO entries as due-dates" + :group 'org-export-icalendar + :type '(set :greedy t + (const :tag "Deadlines in non-TODO entries become events" + event-if-not-todo) + (const :tag "Deadline in TODO entries become events" + event-if-todo) + (const :tag "Deadlines in TODO entries become due-dates" + todo-due))) + +(defcustom org-icalendar-use-scheduled '(todo-start) + "Contexts where iCalendar export should use a scheduling time stamp. +This is a list with several symbols in it. Valid symbol are: + +event-if-todo Scheduling time stamps in TODO entries become an event. +event-if-not-todo Scheduling time stamps in non-TODO entries become an event. +todo-start Scheduling time stamps in TODO entries become start date. + Some calendar applications show TODO entries only after + that date." + :group 'org-export-icalendar + :type '(set :greedy t + (const :tag + "SCHEDULED timestamps in non-TODO entries become events" + event-if-not-todo) + (const :tag "SCHEDULED timestamps in TODO entries become events" + event-if-todo) + (const :tag "SCHEDULED in TODO entries become start date" + todo-start))) + (defcustom org-icalendar-include-todo nil "Non-nil means, export to iCalendar files should also cover TODO items." :group 'org-export-icalendar @@ -650,11 +708,6 @@ (const :tag "Everything" t) (integer :tag "Max characters"))) -(defcustom org-icalendar-combined-name "OrgMode" - "Calendar name for the combined iCalendar representing all agenda files." - :group 'org-export-icalendar - :type 'string) - (defcustom org-icalendar-store-UID nil "Non-nil means, store any created UIDs in properties. The iCalendar standard requires that all entries have a unique identifyer. @@ -709,10 +762,12 @@ (:fixed-width . org-export-with-fixed-width) (:timestamps . org-export-with-timestamps) (:author-info . org-export-author-info) + (:creator-info . org-export-creator-info) (:time-stamp-file . org-export-time-stamp-file) (:tables . org-export-with-tables) (:table-auto-headline . org-export-highlight-first-table-line) (:style . org-export-html-style) + (:style-extra . org-export-html-style-extra) (:agenda-style . org-agenda-export-html-style) (:convert-org-links . org-export-html-link-org-files-as-html) (:inline-images . org-export-html-inline-images) @@ -1361,15 +1416,15 @@ ;; 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) - ;; Normalize links: Convert angle and plain links into bracket links - ;; and expand link abbreviations - (org-export-normalize-links) - ;; Find multiline emphasis and put them into single line (when (plist-get parameters :emph-multiline) (org-export-concatenate-multiline-emphasis)) @@ -1380,10 +1435,12 @@ (defun org-export-kill-licensed-text () "Remove all text that is marked with a :org-license-to-kill property." - (let (p) + (let (p q) (while (setq p (text-property-any (point-min) (point-max) :org-license-to-kill t)) - (delete-region p (next-single-property-change p :org-license-to-kill))))) + (delete-region + p (or (next-single-property-change p :org-license-to-kill) + (point-max)))))) (defun org-export-define-heading-targets (target-alist) "Find all headings and define the targets for them. @@ -1437,20 +1494,25 @@ (slink (org-solidify-link-text link)) found props pos (target - (or (cdr (assoc slink target-alist)) - (save-excursion - (unless (string-match org-link-types-re link) - (setq found (condition-case nil (org-link-search link) - (error nil))) - (when (and found - (or (org-on-heading-p) - (not (eq found 'dedicated)))) - (or (get-text-property (point) 'target) - (get-text-property - (max (point-min) - (1- (previous-single-property-change - (point) 'target))) - 'target)))))))) + (cond + ((cdr (assoc slink target-alist))) + ((string-match org-link-types-re link) nil) + ((or (file-name-absolute-p link) + (string-match "^\\." link)) + nil) + (t + (save-excursion + (setq found (condition-case nil (org-link-search link) + (error nil))) + (when (and found + (or (org-on-heading-p) + (not (eq found 'dedicated)))) + (or (get-text-property (point) 'target) + (get-text-property + (max (point-min) + (1- (previous-single-property-change + (point) 'target))) + 'target)))))))) (when target (set-match-data md) (goto-char (match-beginning 1)) @@ -1577,7 +1639,8 @@ (defun org-export-remove-comment-blocks-and-subtrees () "Remove the comment environment, and also commented subtrees." - (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>"))) + (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) + (case-fold-search nil)) ;; Remove comment environment (goto-char (point-min)) (while (re-search-forward @@ -1653,6 +1716,7 @@ (replace-match s t t)))) (goto-char (point-min)) (while (re-search-forward org-bracket-link-regexp nil t) + (goto-char (1- (match-end 0))) (org-if-unprotected (let* ((xx (save-match-data (org-link-expand-abbrev (match-string 1)))) @@ -1835,10 +1899,12 @@ (defun org-export-handle-include-files () "Include the contents of include files, with proper formatting." (let ((case-fold-search t) - params file markup lang start end) + params file markup lang start end prefix prefix1) (goto-char (point-min)) (while (re-search-forward "^#\\+INCLUDE:?[ \t]+\\(.*\\)" nil t) (setq params (read (concat "(" (match-string 1) ")")) + prefix (org-get-and-remove-property 'params :prefix) + prefix1 (org-get-and-remove-property 'params :prefix1) file (org-symname-or-string (pop params)) markup (org-symname-or-string (pop params)) lang (org-symname-or-string (pop params))) @@ -1854,17 +1920,45 @@ (setq start (format "#+begin_%s\n" markup) end (format "#+end_%s" markup)))) (insert (or start "")) - (forward-char (nth 1 (insert-file-contents (expand-file-name file)))) + (insert (org-get-file-contents (expand-file-name file) prefix prefix1)) (or (bolp) (newline)) (insert (or end "")))))) +(defun org-get-file-contents (file &optional prefix prefix1) + "Get the contents of FILE and return them as a string. +If PREFIX is a string, prepend it to each line. If PREFIX1 +is a string, prepend it to the first line instead of PREFIX." + (with-temp-buffer + (insert-file-contents file) + (when (or prefix prefix1) + (goto-char (point-min)) + (while (not (eobp)) + (insert (or prefix1 prefix)) + (setq prefix1 nil) + (beginning-of-line 2))) + (buffer-string))) + +(defun org-get-and-remove-property (listvar prop) + "Check if the value of LISTVAR contains PROP as a property. +If yes, return the value of that property (i.e. the element following +in the list) and remove property and value from the list in LISTVAR." + (let ((list (symbol-value listvar)) m v) + (when (setq m (member prop list)) + (setq v (nth 1 m)) + (if (equal (car list) prop) + (set listvar (cddr list)) + (setcdr (nthcdr (- (length list) (length m) 1) list) + (cddr m)) + (set listvar list))) + v)) + (defun org-symname-or-string (s) (if (symbolp s) (if s (symbol-name s) s) s)) ;;; Fontification of code -;; Currently only for th HTML backend, but who knows.... +;; Currently only for the HTML backend, but who knows.... (defun org-export-replace-src-segments () "Replace source code segments with special code for export." (let ((case-fold-search t) @@ -1915,8 +2009,9 @@ (org-export-htmlize-region-for-paste (point-min) (point-max))))) (if (string-match "<pre\\([^>]*\\)>\n?" htmltext) - (setq htmltext (replace-match "<pre class=\"src\">" - t t htmltext))) + (setq htmltext (replace-match + (format "<pre class=\"src src-%s\">" lang) + t t htmltext))) (concat "#+BEGIN_HTML\n" htmltext "\n#+END_HTML\n")))) (t ;; This is not HTML, so just make it an example. @@ -2053,7 +2148,7 @@ ((and date (string-match "%" date)) (setq date (format-time-string date))) (date) - (t (setq date (format-time-string "%Y/%m/%d %X")))) + (t (setq date (format-time-string "%Y-%m-%d %T %Z")))) (if (and date org-export-time-stamp-file) (insert (concat (nth 2 lang-words) ": " date"\n"))) @@ -2516,12 +2611,13 @@ (when (interactive-p) (setq buffer "*Org HTML Export*")) (let ((transient-mark-mode t) (zmacs-regions t) - rtn) + ext-plist rtn) + (setq ext-plist (plist-put ext-plist :ignore-subree-p t)) (goto-char end) (set-mark (point)) ;; to activate the region (goto-char beg) (setq rtn (org-export-as-html - nil nil nil + nil nil ext-plist buffer body-only)) (if (fboundp 'deactivate-mark) (deactivate-mark)) (if (and (interactive-p) (bufferp rtn)) @@ -2568,7 +2664,9 @@ ext-plist (org-infile-export-plist)))) - (style (plist-get opt-plist :style)) + (style (concat org-export-html-style-default + (plist-get opt-plist :style) + (plist-get opt-plist :style-extra))) (html-extension (plist-get opt-plist :html-extension)) (link-validate (plist-get opt-plist :link-validation-function)) valid thetoc have-headings first-heading-pos @@ -2577,11 +2675,13 @@ (rbeg (and region-p (region-beginning))) (rend (and region-p (region-end))) (subtree-p - (when region-p - (save-excursion - (goto-char rbeg) - (and (org-at-heading-p) - (>= (org-end-of-subtree t t) rend))))) + (if (plist-get opt-plist :ignore-subree-p) + nil + (when region-p + (save-excursion + (goto-char rbeg) + (and (org-at-heading-p) + (>= (org-end-of-subtree t t) rend)))))) (opt-plist (if subtree-p (org-export-add-subtree-options opt-plist rbeg) opt-plist)) @@ -2629,6 +2729,7 @@ (quote-re (concat "^\\(\\*+\\)\\([ \t]+" org-quote-string "\\>\\)")) (inquote nil) (infixed nil) + (inverse nil) (in-local-list nil) (local-list-type nil) (local-list-indent nil) @@ -2671,7 +2772,7 @@ table-open type table-buffer table-orig-buffer ind item-type starter didclose - rpl path desc descp desc1 desc2 link + rpl path attr desc descp desc1 desc2 link snumber fnc item-tag ) @@ -2690,7 +2791,7 @@ ((and date (string-match "%" date)) (setq date (format-time-string date))) (date) - (t (setq date (format-time-string "%Y/%m/%d %X")))) + (t (setq date (format-time-string "%Y-%m-%d %T %Z")))) ;; Get the language-dependent settings (setq lang-words (or (assoc language org-export-language-setup) @@ -2836,12 +2937,12 @@ (insert (org-html-protect line) "\n") (throw 'nextline nil)) - ;; verbatim lines + ;; Fixed-width, verbatim lines (examples) (when (and org-export-with-fixed-width (string-match "^[ \t]*:\\(.*\\)" line)) (when (not infixed) (setq infixed t) - (insert "<pre>\n")) + (insert "<pre class=\"example\">\n")) (insert (org-html-protect (match-string 1 line)) "\n") (when (or (not lines) (not (string-match "^[ \t]*\\(:.*\\)" @@ -2879,11 +2980,20 @@ (insert "</p>\n</blockquote>\n") (throw 'nextline nil)) (when (equal "ORG-VERSE-START" line) - (insert "<verse>\n<p>\n") + (insert "\n<p class=\"verse\">\n") + (setq inverse t) (throw 'nextline nil)) (when (equal "ORG-VERSE-END" line) - (insert "</p>\n</verse>\n") + (insert "</p>\n") + (setq inverse nil) (throw 'nextline nil)) + (when inverse + (setq 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 " \\\\"))) ;; make targets to anchors (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line) @@ -2919,8 +3029,18 @@ (setq start 0) (while (string-match org-bracket-link-analytic-regexp line start) (setq start (match-beginning 0)) - (setq type (if (match-end 2) (match-string 2 line) "internal")) - (setq path (match-string 3 line)) + (setq path (save-match-data (org-link-unescape + (match-string 3 line)))) + (setq type (cond + ((match-end 2) (match-string 2 line)) + ((save-match-data + (or (file-name-absolute-p path) + (string-match "^\\.\\.?/" path))) + "file") + (t "internal"))) + (setq path (org-extract-attributes path)) + (setq attr (org-attributes-to-string + (get-text-property 0 'org-attributes path))) (setq desc1 (if (match-end 5) (match-string 5 line)) desc2 (if (match-end 2) (concat type ":" path) path) descp (and desc1 (not (equal desc1 desc2))) @@ -2939,19 +3059,27 @@ "<a href=\"#" (org-solidify-link-text (save-match-data (org-link-unescape path)) nil) - "\">" desc "</a>"))) + "\"" attr ">" desc "</a>"))) ((member type '("http" "https")) ;; standard URL, just check if we need to inline an image (if (and (or (eq t org-export-html-inline-images) (and org-export-html-inline-images (not descp))) (org-file-image-p path)) - (setq rpl (concat "<img src=\"" type ":" path "\"/>")) + (setq rpl (concat "<img src=\"" type ":" path "\"" attr "/>")) (setq link (concat type ":" path)) - (setq rpl (concat "<a href=\"" link "\">" desc "</a>")))) + (setq rpl (concat "<a href=\"" link "\"" attr ">" + desc "</a>")))) ((member type '("ftp" "mailto" "news")) ;; standard URL (setq link (concat type ":" path)) (setq rpl (concat "<a href=\"" link "\">" desc "</a>"))) + + ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) + ;; The link protocol has a function for format the link + (setq rpl + (save-match-data + (funcall fnc (org-link-unescape path) desc1 'html)))) + ((string= type "file") ;; FILE link (let* ((filename path) @@ -2988,15 +3116,11 @@ (or (eq t org-export-html-inline-images) (and org-export-html-inline-images (not descp)))) - (concat "<img src=\"" thefile "\"/>") - (concat "<a href=\"" thefile "\">" desc "</a>"))) + (concat "<img src=\"" thefile "\"" attr "/>") + (concat "<a href=\"" thefile "\"" attr ">" + desc "</a>"))) (if (not valid) (setq rpl desc)))) - ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) - (setq rpl - (save-match-data - (funcall fnc (org-link-unescape path) desc1 'html)))) - (t ;; just publish the path, as default (setq rpl (concat "<i><" type ":" @@ -3199,8 +3323,9 @@ (insert "<p class=\"date\"> " (nth 2 lang-words) ": " date "</p>\n")) - (insert (format "<p>HTML generated by org-mode %s in emacs %s<\p>\n" - org-version emacs-major-version)) + (when org-export-creator-info + (insert (format "<p>HTML generated by org-mode %s in emacs %s<\p>\n" + org-version emacs-major-version))) (insert "</div>")) (if org-export-html-with-timestamp @@ -3256,6 +3381,7 @@ (kill-buffer (current-buffer))) (current-buffer))))) + (defvar org-table-colgroup-info nil) (defun org-format-table-ascii (lines) "Format a table for ascii export." @@ -3516,6 +3642,16 @@ (set-buffer " org-tmp2 ") (buffer-substring (point-min) (point-max)))) +(defun org-export-splice-style (style extra) + "Splice EXTRA into STYLE, just before \"</style>\"." + (if (and (stringp extra) + (string-match "\\S-" extra) + (string-match "</style>" style)) + (concat (substring style 0 (match-beginning 0)) + "\n" extra "\n" + (substring style (match-beginning 0))) + style)) + (defun org-html-handle-time-stamps (s) "Format time stamps in string S, or remove them." (catch 'exit @@ -3932,7 +4068,7 @@ (format-time-string (cdr org-time-stamp-formats) (current-time)) "DTSTART")) hd ts ts2 state status (inc t) pos b sexp rrule - scheduledp deadlinep prefix + scheduledp deadlinep todo prefix due start tmp pri category entry location summary desc uid (sexp-buffer (get-buffer-create "*ical-tmp*"))) (org-refresh-category-properties) @@ -3981,8 +4117,21 @@ ts) deadlinep (string-match org-deadline-regexp tmp) scheduledp (string-match org-scheduled-regexp tmp) + todo (org-get-todo-state) ;; donep (org-entry-is-done-p) )) + (when (and + deadlinep + (if todo + (not (memq 'event-if-todo org-icalendar-use-deadline)) + (not (memq 'event-if-not-todo org-icalendar-use-deadline)))) + (throw :skip t)) + (when (and + scheduledp + (if todo + (not (memq 'event-if-todo org-icalendar-use-scheduled)) + (not (memq 'event-if-not-todo org-icalendar-use-scheduled)))) + (throw :skip t)) (setq prefix (if deadlinep "DL-" (if scheduledp "SC-" "TS-"))) (if (or (string-match org-tr-regexp hd) (string-match org-ts-regexp hd)) @@ -4070,9 +4219,16 @@ t org-icalendar-include-body) location (org-icalendar-cleanup-string (org-entry-get nil "LOCATION")) + due (and (member 'todo-due org-icalendar-use-deadline) + (org-entry-get nil "DEADLINE")) + start (and (member 'todo-start org-icalendar-use-scheduled) + (org-entry-get nil "SCHEDULED")) uid (if org-icalendar-store-UID (org-id-get-create) (or (org-id-get) (org-id-new)))) + (and due (setq due (org-ical-ts-to-string due "DUE"))) + (and start (setq start (org-ical-ts-to-string start "DTSTART"))) + (if (string-match org-bracket-link-regexp hd) (setq hd (replace-match (if (match-end 3) (match-string 3 hd) (match-string 1 hd)) @@ -4088,19 +4244,20 @@ (princ (format "BEGIN:VTODO UID: %s %s -SUMMARY:%s%s%s +SUMMARY:%s%s%s%s CATEGORIES:%s SEQUENCE:1 PRIORITY:%d STATUS:%s END:VTODO\n" (concat prefix uid) - dts + (or start dts) (or summary hd) (if (and location (string-match "\\S-" location)) (concat "\nLOCATION: " location) "") (if (and desc (string-match "\\S-" desc)) (concat "\nDESCRIPTION: " desc) "") + (if due (concat "\n" due) "") category pri status))))))))) @@ -4269,4 +4426,3 @@ ;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 ;;; org-exp.el ends here -
--- a/lisp/org/org-export-latex.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-export-latex.el Thu Jul 24 13:59:56 2008 +0000 @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-export-latex.el -;; Version: 6.05a +;; Version: 6.06a ;; Author: Bastien Guerry <bzg AT altern DOT org> ;; Maintainer: Bastien Guerry <bzg AT altern DOT org> ;; Keywords: org, wp, tex @@ -762,11 +762,22 @@ (replace-match "") (replace-match (format "\\texttt{%s}" (match-string 0)) t t))) ;; convert tags - (when (re-search-forward "\\(:[a-zA-Z0-9]+\\)+:" nil t) + (when (re-search-forward "\\(:[a-zA-Z0-9_@]+\\)+:" nil t) (if (or (not org-export-with-tags) (plist-get remove-list :tags)) (replace-match "") - (replace-match (format "\\texttt{%s}" (match-string 0)) t t))))) + (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) (defun org-export-latex-fontify-headline (string) "Fontify special words in string." @@ -777,10 +788,10 @@ (goto-char (point-min)) (when (plist-get org-export-latex-options-plist :emphasize) (org-export-latex-fontify)) + (org-export-latex-keywords-maybe + org-export-latex-remove-from-headlines) (org-export-latex-special-chars (plist-get org-export-latex-options-plist :sub-superscript)) - (org-export-latex-keywords-maybe - org-export-latex-remove-from-headlines) (org-export-latex-links) (org-trim (buffer-substring-no-properties (point-min) (point-max))))) @@ -1051,7 +1062,7 @@ (let* ((re-radio org-export-latex-all-targets-re) (remove (list (match-beginning 0) (match-end 0))) (type (match-string 2)) - (raw-path (match-string 3)) + (raw-path (org-extract-attributes (match-string 3))) (full-raw-path (concat (match-string 1) raw-path)) (desc (match-string 5)) imgp radiop
--- a/lisp/org/org-faces.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-faces.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-gnus.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-gnus.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-id.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-id.el Thu Jul 24 13:59:56 2008 +0000 @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-info.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-info.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-irc.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-irc.el Thu Jul 24 13:59:56 2008 +0000 @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson <emacs@shellarchive.co.uk> ;; Keywords: erc, irc, link, org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-jsinfo.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-jsinfo.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-mac-message.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-mac-message.el Thu Jul 24 13:59:56 2008 +0000 @@ -3,7 +3,7 @@ ;; Copyright (C) 2008 Free Software Foundation, Inc. ;; Author: John Wiegley <johnw@gnu.org> -;; Version: 6.05a +;; Version: 6.06a ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs.
--- a/lisp/org/org-macs.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-macs.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-mew.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-mew.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; This file is part of GNU Emacs.
--- a/lisp/org/org-mhe.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-mhe.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-mouse.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-mouse.el Thu Jul 24 13:59:56 2008 +0000 @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-publish.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-publish.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; This file is part of GNU Emacs. ;; @@ -263,7 +263,12 @@ :index-function Plugin function to use for generation of index. Defaults to `org-publish-org-index', which generates a plain list of links to all files - in the project." + in the project. + :index-style Can be `list' (index is just an itemized list + of the titles of the files involved) or + `tree' (the directory structure of the source + files is reflected in the index). Defaults to + `tree'." :group 'org-publish :type 'alist) @@ -297,24 +302,29 @@ (defun org-publish-timestamp-filename (filename) "Return path to timestamp file for filename FILENAME." - (while (string-match - (if (eq system-type 'windows-nt) "~\\|/\\|:" "~\\|/") filename) - (setq filename (replace-match "_" nil t filename))) - (concat org-publish-timestamp-directory filename ".timestamp")) + (concat (file-name-as-directory org-publish-timestamp-directory) + "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename)))) (defun org-publish-needed-p (filename) "Return `t' if FILENAME should be published." - (if org-publish-use-timestamps-flag - (if (file-exists-p org-publish-timestamp-directory) - ;; first handle possible wrong timestamp directory - (if (not (file-directory-p org-publish-timestamp-directory)) - (error "Org publish timestamp: %s is not a directory" - org-publish-timestamp-directory) - ;; there is a timestamp, check if FILENAME is newer - (file-newer-than-file-p - filename (org-publish-timestamp-filename filename)))) - ;; don't use timestamps, always return t - t)) + (let ((rtn + (if org-publish-use-timestamps-flag + (if (file-exists-p org-publish-timestamp-directory) + ;; first handle possible wrong timestamp directory + (if (not (file-directory-p org-publish-timestamp-directory)) + (error "Org publish timestamp: %s is not a directory" + org-publish-timestamp-directory) + ;; there is a timestamp, check if FILENAME is newer + (file-newer-than-file-p + filename (org-publish-timestamp-filename filename))) + (make-directory org-publish-timestamp-directory) + t) + ;; don't use timestamps, always return t + t))) + (if rtn + (message "Publishing file %s" filename) + (message "Skipping unmodified file %s" filename)) + rtn)) (defun org-publish-update-timestamp (filename) "Update publishing timestamp for file FILENAME. @@ -602,6 +612,8 @@ (index-filename (concat dir (or index-filename "index.org"))) (index-title (or (plist-get project-plist :index-title) (concat "Index for project " (car project)))) + (index-style (or (plist-get project-plist :index-style) + 'tree)) (index-buffer (find-buffer-visiting index-filename)) (ifn (file-name-nondirectory index-filename)) file) @@ -616,25 +628,32 @@ (oldlocal localdir)) ;; index shouldn't index itself (unless (string= fn ifn) - (setq localdir (concat (file-name-as-directory dir) - (file-name-directory link))) - (unless (string= localdir oldlocal) - (if (string= localdir dir) - (setq indent-str (make-string 2 ?\ )) - (let ((subdirs - (split-string - (directory-file-name - (file-name-directory - (file-relative-name localdir dir))) "/")) - (subdir "")) - (setq indent-str (make-string 2 ?\ )) - (dolist (d subdirs) - (setq subdir (concat subdir d "/")) - (insert (concat indent-str " + [[file:" subdir "][" d "/]]\n")) - (setq indent-str (make-string (+ (length indent-str) 2) ?\ )))))) + (if (eq index-style 'list) + (message "Generating list-style index for %s" index-title) + (message "Generating tree-style index for %s" index-title) + (setq localdir (concat (file-name-as-directory dir) + (file-name-directory link))) + (unless (string= localdir oldlocal) + (if (string= localdir dir) + (setq indent-str (make-string 2 ?\ )) + (let ((subdirs + (split-string + (directory-file-name + (file-name-directory + (file-relative-name localdir dir))) "/")) + (subdir "")) + (setq indent-str (make-string 2 ?\ )) + (dolist (d subdirs) + (setq subdir (concat subdir d "/")) + (insert (concat indent-str " + [[file:" + subdir "][" d "/]]\n")) + (setq indent-str (make-string + (+ (length indent-str) 2) ?\ ))))))) + ;; This is common to 'flat and 'tree (insert (concat indent-str " + [[file:" link "][" - (file-name-sans-extension fn) - "]]\n"))))) + (org-publish-find-title file) + "]]\n")) + ))) (write-file index-filename) (kill-buffer (current-buffer))))) @@ -648,7 +667,8 @@ (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension file))))) + (file-name-nondirectory (file-name-sans-extension file)))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interactive publishing functions
--- a/lisp/org/org-remember.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-remember.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-rmail.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-rmail.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-table.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-table.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -445,8 +445,14 @@ (let* ((beg (org-table-begin)) (end (org-table-end)) (txt (buffer-substring-no-properties beg end)) - (file (or file (org-entry-get beg "TABLE_EXPORT_FILE" t))) - (format (or format (org-entry-get beg "TABLE_EXPORT_FORMAT" t))) + (file (or file + (condition-case nil + (org-entry-get beg "TABLE_EXPORT_FILE" t) + (error nil)))) + (format (or format + (condition-case nil + (org-entry-get beg "TABLE_EXPORT_FORMAT" t) + (error nil)))) buf deffmt-readable) (unless file (setq file (read-file-name "Export table to: ")) @@ -464,8 +470,13 @@ (setq deffmt-readable (replace-match "\\t" t t deffmt-readable))) (while (string-match "\n" deffmt-readable) (setq deffmt-readable (replace-match "\\n" t t deffmt-readable))) - (setq format (read-string "Format: " deffmt-readable))) - + (setq format (org-completing-read + "Format: " + '("orgtbl-to-tsv" "orgtbl-to-csv" + "orgtbl-to-latex" "orgtbl-to-html" + "orgtbl-to-generic" "orgtbl-to-texinfo" + "orgtbl-to-orgtbl") nil nil + deffmt-readable))) (if (string-match "\\([^ \t\r\n]+\\)\\( +.*\\)?" format) (let* ((transform (intern (match-string 1 format))) (params (if (match-end 2) @@ -1864,7 +1875,7 @@ (string-match "^[a-zA-Z][a-zA-Z0-9]*$" field)) (push (cons field v) org-table-local-parameters) (push (list field line col) org-table-named-field-locations)))) - ;; Analyze the line types + ;; Analyse the line types (goto-char beg) (setq org-table-current-begin-line (org-current-line) org-table-current-begin-pos (point) @@ -3541,6 +3552,26 @@ (delete-region beg (point)))) (insert txt "\n"))) +(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' +for a horizontal separator line, or a list of field values as strings. +The table is taken from the parameter TXT, or from the buffer at point." + (unless txt + (unless (org-at-table-p) + (error "No table at point"))) + (let* ((txt (or txt + (buffer-substring-no-properties (org-table-begin) + (org-table-end)))) + (lines (org-split-string txt "[ \t]*\n[ \t]*"))) + + (mapcar + (lambda (x) + (if (string-match org-table-hline-regexp x) + 'hline + (org-split-string (org-trim x) "\\s-*|\\s-*"))) + lines))) + (defun orgtbl-send-table (&optional maybe) "Send a tranformed version of this table to the receiver position. With argument MAYBE, fail quietly if no transformation is defined for
--- a/lisp/org/org-vm.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-vm.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org-wl.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org-wl.el Thu Jul 24 13:59:56 2008 +0000 @@ -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.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;;
--- a/lisp/org/org.el Thu Jul 24 13:00:20 2008 +0000 +++ b/lisp/org/org.el Thu Jul 24 13:59:56 2008 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.05a +;; Version: 6.06a ;; ;; This file is part of GNU Emacs. ;; @@ -91,7 +91,7 @@ ;;; Version -(defconst org-version "6.05a" +(defconst org-version "6.06a" "The version number of the file org.el.") (defun org-version (&optional here) @@ -1062,6 +1062,13 @@ :group 'org-link-follow :type 'boolean) +(defcustom org-open-directory-means-index-dot-org nil + "Non-nil means, a link to a directory really means to index.org. +When nil, following a directory link will run dired or open a finder/explorer +window on that directory." + :group 'org-link-follow + :type 'boolean) + (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s") "Function and arguments to call for following mailto links. This is a list with the first element being a lisp function, and the @@ -2573,7 +2580,9 @@ (defcustom org-agenda-skip-archived-trees t "Non-nil means, the agenda will skip any items located in archived trees. -An archived tree is a tree marked with the tag ARCHIVE." +An archived tree is a tree marked with the tag ARCHIVE. The use of this +variable is no longer recommended, you should leave it at the value t. +Instead, use the key `v' to cycle the archives-mode in the agenda." :group 'org-archive :group 'org-agenda-skip :type 'boolean) @@ -4206,6 +4215,12 @@ (= (match-end 0) (point-max))) (outline-flag-region (point) (match-end 0) nil)))) +(defun org-show-empty-lines-in-parent () + "Move to the parent and re-show empty lines before visible headlines." + (save-excursion + (let ((context (if (org-up-heading-safe) 'children 'overview))) + (org-cycle-show-empty-lines context)))) + (defun org-cycle-hide-drawers (state) "Re-hide all drawers after a visibility state change." (when (and (org-mode-p) @@ -4895,6 +4910,7 @@ (insert (make-string (- ne-ins ne-beg) ?\n))) (move-marker ins-point nil) (org-compact-display-after-subtree-move) + (org-show-empty-lines-in-parent) (unless folded (org-show-entry) (show-children) @@ -4974,7 +4990,8 @@ (error "%s" (substitute-command-keys "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) - (let* ((txt (or tree (and kill-ring (current-kill 0)))) + (let* ((visp (not (org-invisible-p))) + (txt (or tree (and kill-ring (current-kill 0)))) (^re (concat "^\\(" outline-regexp "\\)")) (re (concat "\\(" outline-regexp "\\)")) (^re_ (concat "\\(\\*+\\)[ \t]*")) @@ -5028,6 +5045,8 @@ (goto-char beg) (skip-chars-forward " \t\n\r") (setq beg (point)) + (if (and (org-invisible-p) visp) + (save-excursion (outline-show-heading))) ;; Shift if necessary (unless (= shift 0) (save-restriction @@ -5109,7 +5128,7 @@ (save-match-data (narrow-to-region (progn (org-back-to-heading) (point)) - (progn (org-end-of-subtree t t) (point)))))) + (progn (org-end-of-subtree t) (point)))))) ;;; Outline Sorting @@ -5908,6 +5927,7 @@ (setq beg (point))) (goto-char beg0) (org-end-of-item) + (org-back-over-empty-lines) (setq end (point)) (goto-char beg0) (catch 'exit @@ -5923,7 +5943,7 @@ (throw 'exit t))))) (condition-case nil (org-beginning-of-item) - (error (goto-char beg) + (error (goto-char beg0) (error "Cannot move this item further up"))) (setq ind1 (org-get-indentation)) (if (and (org-at-item-p) (= ind ind1)) @@ -6021,9 +6041,10 @@ (buffer-substring (point-at-bol) (match-beginning 3)))) ;; (term (substring (match-string 3) -1)) ind1 (n (1- arg)) - fmt) + fmt bob) ;; 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) @@ -6031,7 +6052,7 @@ (catch 'exit (while t (catch 'next - (beginning-of-line 2) + (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)) @@ -6097,7 +6118,8 @@ (if (or (< ind1 ind) (and (= ind1 ind) (not (org-at-item-p))) - (bobp)) + (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))) @@ -6733,7 +6755,7 @@ (setq description nil)) (when (and (not description) (not (equal link (org-link-escape link)))) - (setq description link)) + (setq description (org-extract-attributes link))) (concat "[[" (org-link-escape link) "]" (if description (concat "[" description "]") "") "]")) @@ -7006,6 +7028,27 @@ (org-defkey minibuffer-local-completion-map " " 'self-insert-command) (apply 'completing-read args))) +(defun org-extract-attributes (s) + "Extract the attributes cookie from a string and set as text property." + (let (a attr (start 0)) + (save-match-data + (when (string-match "{{\\([^}]+\\)}}$" s) + (setq a (match-string 1 s) s (substring s 0 (match-beginning 0))) + (while (string-match "\\([a-zA-Z]+\\)=\"\\([^\"]*\\)\"" a start) + (setq key (match-string 1 a) value (match-string 2 a) + start (match-end 0) + attr (plist-put attr (intern key) value)))) + (org-add-props s nil 'org-attributes attr)) + s)) + +(defun org-attributes-to-string (plist) + "Format a property list into an HTML attribute list." + (let ((s "") key value) + (while plist + (setq key (pop plist) value (pop plist)) + (setq s (concat s " "(symbol-name key) "=\"" value "\""))) + s)) + ;;; Opening/following a link (defvar org-link-search-failed nil) @@ -7106,13 +7149,18 @@ (save-excursion (skip-chars-forward "^]\n\r") (when (org-in-regexp org-bracket-link-regexp) - (setq link (org-link-unescape (org-match-string-no-properties 1))) + (setq link (org-extract-attributes + (org-link-unescape (org-match-string-no-properties 1)))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) - (if (string-match org-link-re-with-space2 link) - (setq type (match-string 1 link) path (match-string 2 link)) - (setq type "thisfile" path link)) + (cond + ((or (file-name-absolute-p link) + (string-match "^\\.\\.?/" link)) + (setq type "file" path link)) + ((string-match org-link-re-with-space2 link) + (setq type (match-string 1 link) path (match-string 2 link))) + (t (setq type "thisfile" path link))) (throw 'match t))) (when (get-text-property (point) 'org-linked-text) @@ -7530,6 +7578,9 @@ (apps (append org-file-apps (org-default-apps))) (remp (and (assq 'remote apps) (org-file-remote-p file))) (dirp (if remp nil (file-directory-p file))) + (file (if (and dirp org-open-directory-means-index-dot-org) + (concat (file-name-as-directory file) "index.org") + file)) (dfile (downcase file)) (old-buffer (current-buffer)) (old-pos (point)) @@ -8586,7 +8637,7 @@ nil))) (defun org-get-repeat () - "Check if tere is a deadline/schedule with repeater in this entry." + "Check if there is a deadline/schedule with repeater in this entry." (save-match-data (save-excursion (org-back-to-heading t) @@ -9196,6 +9247,7 @@ ;;;; Tags +(defvar org-agenda-archives-mode) (defun org-scan-tags (action matcher &optional todo-only) "Scan headline tags with inheritance and produce output ACTION. @@ -9211,9 +9263,9 @@ (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") (org-re "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$"))) - (props (list 'face nil + (props (list 'face 'default 'done-face 'org-done - 'undone-face nil + 'undone-face 'default 'mouse-face 'highlight 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp @@ -9265,8 +9317,11 @@ (org-remove-uniherited-tags (cdar tags-alist)))) (when (and (or (not todo-only) (member todo org-not-done-keywords)) (eval matcher) - (or (not org-agenda-skip-archived-trees) - (not (member org-archive-tag tags-list)))) + (or + (not (member org-archive-tag tags-list)) + ;; we have an archive tag, should we use this anyway? + (or (not org-agenda-skip-archived-trees) + (and (eq action 'agenda) org-agenda-archives-mode)))) (unless (eq action 'sparse-tree) (org-agenda-skip)) ;; select this headline @@ -9420,8 +9475,10 @@ cat-p (equal pn "CATEGORY") re-p (equal (string-to-char pv) ?{) str-p (equal (string-to-char pv) ?\") + time-p (save-match-data (string-match "^\"<.*>\"$" pv)) pv (if (or re-p str-p) (substring pv 1 -1) pv)) - (setq po (org-op-to-function po str-p)) + (if time-p (setq pv (org-matcher-time pv))) + (setq po (org-op-to-function po (if time-p 'time str-p))) (if (equal pn "CATEGORY") (setq gv '(get-text-property (point) 'org-category)) (setq gv `(org-cached-entry-get nil ,pn))) @@ -9476,21 +9533,46 @@ (cons match0 matcher))) (defun org-op-to-function (op &optional stringp) + "Turn an operator into the appropriate function." (setq op (cond - ((equal op "<" ) '(< string< )) - ((equal op ">" ) '(> org-string> )) - ((member op '("<=" "=<")) '(<= org-string<= )) - ((member op '(">=" "=>")) '(>= org-string>= )) - ((member op '("=" "==")) '(= string= )) - ((member op '("<>" "!=")) '(org<> org-string<> )))) - (nth (if stringp 1 0) op)) + ((equal op "<" ) '(< string< org-time<)) + ((equal op ">" ) '(> org-string> org-time>)) + ((member op '("<=" "=<")) '(<= org-string<= org-time<=)) + ((member op '(">=" "=>")) '(>= org-string>= org-time>=)) + ((member op '("=" "==")) '(= string= org-time=)) + ((member op '("<>" "!=")) '(org<> org-string<> org-time<>)))) + (nth (if (eq stringp 'time) 2 (if stringp 1 0)) op)) (defun org<> (a b) (not (= a b))) (defun org-string<= (a b) (or (string= a b) (string< a b))) (defun org-string>= (a b) (not (string< a b))) (defun org-string> (a b) (and (not (string= a b)) (not (string< a b)))) (defun org-string<> (a b) (not (string= a b))) +(defun org-time= (a b) (= (org-2ft a) (org-2ft b))) +(defun org-time< (a b) (< (org-2ft a) (org-2ft b))) +(defun org-time<= (a b) (<= (org-2ft a) (org-2ft b))) +(defun org-time> (a b) (> (org-2ft a) (org-2ft b))) +(defun org-time>= (a b) (>= (org-2ft a) (org-2ft b))) +(defun org-time<> (a b) (org<> (org-2ft a) (org-2ft b))) +(defun org-2ft (s) + "Convert S to a floating point time. +If S is already a number, just return it. If it is a string, parse +it as a time string and apply `float-time' to it. f S is nil, just return 0." + (cond + ((numberp s) s) + ((stringp s) + (condition-case nil + (float-time (apply 'encode-time (org-parse-time-string s))) + (error 0.))) + (t 0.))) + +(defun org-matcher-time (s) + (cond + ((equal s "<now>") (float-time)) + ((equal s "<today>") + (float-time (append '(0 0 0) (nthcdr 3 (decode-time))))) + (t (org-2ft s)))) (defun org-match-any-p (re list) "Does re match any element of list?" @@ -9998,7 +10080,8 @@ the the function returns t, FUNC will not be called for that entry and search will continue from the point where the function leaves it." - (let* ((org-agenda-skip-archived-trees (memq 'archive skip)) + (let* ((org-agenda-archives-mode nil) ; just to make sure + (org-agenda-skip-archived-trees (memq 'archive skip)) (org-agenda-skip-comment-trees (memq 'comment skip)) (org-agenda-skip-function (car (org-delete-all '(comment archive) skip))) @@ -10009,12 +10092,12 @@ ((eq match t) (setq matcher t)) ((eq match nil) (setq matcher t)) (t (setq matcher (if match (org-make-tags-matcher match) t)))) - + (when (eq scope 'tree) (org-back-to-heading t) (org-narrow-to-subtree) (setq scope nil)) - + (if (not scope) (progn (org-prepare-agenda-buffers @@ -10069,6 +10152,22 @@ (defconst org-property-end-re "^[ \t]*:END:[ \t]*$" "Regular expression matching the first line of a property drawer.") +(defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" + "Regular expression matching the first line of a property drawer.") + +(defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$" + "Regular expression matching the first line of a property drawer.") + +(defconst org-property-drawer-re + (concat "\\(" org-property-start-re "\\)[^\000]*\\(" + org-property-end-re "\\)\n?") + "Matches an entire property drawer.") + +(defconst org-clock-drawer-re + (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*\\(" + org-property-end-re "\\)\n?") + "Matches an entire clock drawer.") + (defun org-property-action () "Do an action on properties." (interactive) @@ -11475,7 +11574,7 @@ date2 (list m d (+ y1 (* (if (< n1 cday) 1 -1) dn))) n2 (calendar-absolute-from-gregorian date2))) ((eq dw 'month) - ;; approx number of month between the tow dates + ;; approx number of month between the two dates (setq nmonths (floor (/ (- cday sday) 30.436875))) ;; How often does dn fit in there? (setq d (nth 1 start) m (car start) y (nth 2 start) @@ -11489,12 +11588,11 @@ (setq m2 (+ m dn) y2 y) (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12))) (setq n2 (calendar-absolute-from-gregorian (list m2 d y2))) - (while (< n2 cday) + (while (<= n2 cday) (setq n1 n2 m m2 y y2) (setq m2 (+ m dn) y2 y) (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12))) (setq n2 (calendar-absolute-from-gregorian (list m2 d y2)))))) - (if show-all (cond ((eq prefer 'past) n1) @@ -11828,14 +11926,13 @@ (buffer-list))) (delete nil blist))) -(defun org-agenda-files (&optional unrestricted ext) +(defun org-agenda-files (&optional unrestricted archives) "Get the list of agenda files. Optional UNRESTRICTED means return the full list even if a restriction is currently in place. -When EXT is non-nil, try to add all files that are created by adding EXT -to the file nemes. Basically, this is a way to add the archive files -to the list, by setting EXT to \"_archive\" If EXT is non-nil, but not -a string, \"_archive\" will be used." +When ARCHIVES is t, include all archive files hat are really being +used by the agenda files. If ARCHIVE is `ifmode', do this only if +`org-agenda-archives-mode' is t." (let ((files (cond ((and (not unrestricted) (get 'org-agenda-files 'org-restrict))) @@ -11855,16 +11952,9 @@ (lambda (file) (and (file-readable-p file) file))) files)))) - (when ext - (setq ext (if (and (stringp ext) (string-match "\\S-" ext)) - ext "_archive")) - (setq files (apply 'append - (mapcar - (lambda (f) - (if (file-exists-p (concat f ext)) - (list f (concat f ext)) - (list f))) - files)))) + (when (or (eq archives t) + (and (eq archives 'ifmode) (eq org-agenda-archives-mode t))) + (setq files (org-add-archive-files files))) files)) (defun org-edit-agenda-file-list () @@ -12327,13 +12417,15 @@ (cd dir)) (if (not (file-exists-p dvifile)) (progn (message "Failed to create dvi file from %s" texfile) nil) - (call-process "dvipng" nil nil nil - "-E" "-fg" fg "-bg" bg - "-D" dpi - ;;"-x" scale "-y" scale - "-T" "tight" - "-o" pngfile - dvifile) + (condition-case nil + (call-process "dvipng" nil nil nil + "-E" "-fg" fg "-bg" bg + "-D" dpi + ;;"-x" scale "-y" scale + "-T" "tight" + "-o" pngfile + dvifile) + (error nil)) (if (not (file-exists-p pngfile)) (progn (message "Failed to create png file from %s" texfile) nil) ;; Use the requested file name and clean up @@ -12427,7 +12519,9 @@ (org-defkey org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. (org-defkey org-mode-map "\C-c\C-r" 'org-reveal) -(org-defkey narrow-map "s" 'org-narrow-to-subtree) +(if (boundp 'narrow-map) + (org-defkey narrow-map "s" 'org-narrow-to-subtree) + (org-defkey org-mode-map "\C-xns" 'org-narrow-to-subtree)) (org-defkey org-mode-map "\C-c$" 'org-archive-subtree) (org-defkey org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree) (org-defkey org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag) @@ -13220,9 +13314,6 @@ ["Cycling opens ARCHIVE trees" (setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees)) :style toggle :selected org-cycle-open-archived-trees] - ["Agenda includes ARCHIVE trees" - (setq org-agenda-skip-archived-trees (not org-agenda-skip-archived-trees)) - :style toggle :selected (not org-agenda-skip-archived-trees)] "--" ["Move Subtree to Archive" org-advertized-archive-subtree t] ; ["Check and Move Children" (org-archive-subtree '(4)) @@ -14390,7 +14481,9 @@ (eval-after-load "imenu" '(progn (add-hook 'imenu-after-jump-hook - (lambda () (org-show-context 'org-goto))))) + (lambda () + (if (eq major-mode 'org-mode) + (org-show-context 'org-goto)))))) ;; Speedbar support @@ -14513,4 +14606,3 @@ ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd ;;; org.el ends here -