Commit 93b62de8 authored by Carsten Dominik's avatar Carsten Dominik
Browse files

2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>

	* org.el (org-yank): Make any prefix force normal yanking.
	Suppress folding if text would be swallowed into a folded
	subtree.
	(org-yank-folded-subtrees, org-yank): Docstring updates.

	* org-agenda.el (org-agenda-compare-effort): Treat no effort
	defined as 0.

	* org-exp.el (org-export-language-setup): Add Catalan and
	Esperanto language entries.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org.el (org-refile): Allow refiling of entire regions.

	* org-clock.el (org-clock-time%): New function.

	* org.el (org-entry-get, org-entry-delete): Use safer regexps to
	retrieve property values.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org-agenda.el (org-agenda-list): Handle the value `only' of
	org-agenda-show-log'.
	(org-agenda-log-mode): Interpret a double prefix arg.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org-exp.el (org-export-html-footnotes-section): New variable.
	(org-export-as-html): Use `org-export-html-footnotes-section' to
	insert the footnotes.
	(org-export-language-setup): Add "Footnotes" to language words.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org.el (org-yank): Fix bug when not inserting a subtree.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org-vm.el (org-vm-follow-link): Call `vm-preview-current-message'
	instead of `vm-beginning-of-message'.

	* org.el (org-make-link-regexps): Make sure that links to gnus can
	contain brackets.

2008-11-12  Carsten Dominik  <carsten.dominik@gmail.com>

	* org-attach.el (org-attach-dir): Remove duplicate ID creation
	code.

	* org-id.el (org-id-new): Use `org-trim' to extract the uuid from
	shell output.

	* org.el (org-link-abbrev-alist): Improve customization type.

	* org-attach.el (org-attach-expand-link, org-attach-expand): New
	functions.

	* org-agenda.el (org-agenda-get-progress): Renamed from
	`org-get-closed'.  Implement searching for state changes as well.
	(org-agenda-log-mode-items): New option.
	(org-agenda-log-mode): New option prefix argument, interpreted as
	request to show all possible progress info.
	(org-agenda-get-day-entries): Call `org-get-progress' instead of
	`org-get-closed'.
	(org-agenda-set-mode-name): Handle the more complex log mode
	settings.
	(org-get-closed): New alias, pointing to `org-get-progress'.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-file-apps-defaults-gnu)
	(org-file-apps-defaults-macosx)
	(org-file-apps-defaults-windowsnt): Add an entry defining the
	system command.
	(org-file-apps): Allow `system' as key and value.
	(org-open-at-point): Explain the effect of a double prefix arg.
	(org-open-file): If the argument `in-emacs' is (16),
	i.e. corresponding to a double prefix argument, try to open the
	file externally.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-insert-link): Abbreviate absolute files names in
	links.  Also, fix a bug in which the double C-u prefix would not
	be honored.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-insert-heading): If buffer does not end with a
	newline, add one if necessary to insert headline correctly.

	* org-exp.el (org-export-as-html): Make sure that <hr/> is between
	paragraphs, not inside.

	* org.el (org-todo): Quote
	`org-agenda-headline-snapshot-before-repeat'.

	* org-exp.el (org-export-as-html): Fully process link descriptions.
	(org-export-html-format-desc): New function.
	(org-export-as-html): Collect footnotes into the correct basket.
	(org-html-protect): No longer protect quotations marks here, this
	goes wrong.

	* org-agenda.el (org-agenda-remove-marked-text): Bind variable
	BEG.

	* org-compat.el (org-fit-window-to-buffer): New function (not
	really, a preliminary and incomplete version was present earlier,
	but not used).

	* org.el (org-fast-todo-selection, org-fast-tag-selection): Use
	`org-fit-window-to-buffer'.

	* org-exp.el (org-export): Use `org-fit-window-to-buffer'.

	* org-agenda.el (org-agenda-get-restriction-and-command)
	(org-fit-agenda-window, org-agenda-convert-date): Use
	`org-fit-window-to-buffer'.

	* org-exp.el (org-export-as-html): Process href links through
	`org-export-html-format-href'.
	(org-export-html-format-href): New function.

	* org-agenda.el (org-agenda-todo): Update only the current
	headline if this is a repeated TODO, marked done for today.
	(org-agenda-change-all-lines): New argument JUST-THIS, to change
	only the current line.

	* org.el (org-todo): Take a snapshot of the headline if the
	repeater might change it.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org-publish.el (org-publish-find-title): Remove buffers visited
	only for extracting the title.

	* org-exp.el (org-export-html-style)
	(org-export-html-style-default): Mark style definitions as
	unparsed CDATA.

	* org-publish.el (org-publish-validate-link): Function
	re-introduced.

2008-11-12  Charles Sebold  <csebold@gmail.com>

	* org-plot.el (org-plot/add-options-to-plist): Supports timefmt
	property.
	(org-plot-quote-timestamp-field): New function.
	(org-plot-quote-tsv-field): Call timestamp field function when
	necessary rather than just quoting as a string.
	(org-plot/gnuplot-to-data): Pass in timefmt property.
	(org-plot/gnuplot-script): Supports timefmt property.
	(org-plot/gnuplot): Checks for timestamp column before checking
	for text index column.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-insert-heading): Improve behavior with hidden subtrees.

	* org-publish.el (org-publish-org-index): Create a section in the
	index file.
	(org-publish-org-index): Stop linking to directories.

	* org.el (org-emphasis-alist): Use span instead of <u> to
	underline text.

	* org-exp.el (org-export-as-html): Make sure <p> is closed before
	<pre> sections.

2008-11-12  Sebastian Rose  <sebastian_rose@gmx.de>

	* org-jsinfo.el (org-infojs-template): Remove language attribute
	from script tag.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org-agenda.el (org-agenda-remove-marked-text): New function.
	(org-agenda-mark-filtered-text)
	(org-agenda-unmark-filtered-text): New functions.
	(org-write-agenda): Remove fltered text.

	* org.el (org-make-tags-matcher): Give access to TODO "property"
	without speed penalty.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-link-frame-setup): Add `org-gnus-no-new-news' as an
	option.
	(org-store-link-props): Make sure adding to the plist works
	correctly.

	* org-gnus.el (org-gnus-no-new-news): New function.
	(org-gnus-follow-link): Allow the article ID to be a message-id,
	in addition to allowing article numbers.  Message IDs make much
	more roubust links.
	(org-gnus-store-link): Use message-id to create link.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el (org-emphasize): Reverse the selection array.
	(org-emphasis-alist): Set <code> tags for the verbatim
	environment.

	* org-remember.el (org-remember-handler): Fix bug with
	prefix-related changing of the note storage target.

	* org-exp.el (org-print-icalendar-entries): Make the exported
	priorities compatible with RFC 2445.

	* org-clock.el (org-clock-save): Insert time stamp without
	dependence on time-stamp.el.

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org.el ("saveplace"): If saveplace puts point into an invisible
	location, make it visible.
	(org-make-tags-matcher): Allow inactive time stamps in time
	comparisons.
	(org-yank-adjusted-subtrees): New option.
	(org-yank): Incorporate adjusting trees.
	(org-paste-subtree): New argument FOR-YANK which will cause
	insertion at point without backing up over white lines, and leave
	point at the end of the inserted text.  Also if the cursor is
	at the beginning of a headline, use the same level or the inserted
	tree.

	* org-publish.el (org-publish-get-base-files-1): Deal correctly
	with broken symlinks

2008-11-12  Carsten Dominik  <dominik@science.uva.nl>

	* org-exp.el (org-export-select-tags, org-get-current-options):
	Fix typo.
parent fb8df73b
......@@ -6,7 +6,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.10c
;; Version: 6.12a
;;
;; This file is part of GNU Emacs.
;;
......@@ -389,7 +389,7 @@ or `C-c a #' to produce the list."
(defcustom org-agenda-filter-effort-default-operator "<"
"The default operator for effort estimate filtering.
If you select an effort estimate limit with first pressing an operator,
If you select an effort estimate limit without first pressing an operator,
this one will be used."
:group 'org-agenda-custom-commands
:type '(choice (const :tag "less or equal" "<")
......@@ -409,7 +409,7 @@ 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.
"Non-nil means, skip trees that start with the COMMENT keyword.
When nil, these trees are also scand by agenda commands."
:group 'org-agenda-skip
:type 'boolean)
......@@ -650,6 +650,16 @@ given here."
:group 'org-agenda-daily/weekly
:type 'number)
(defcustom org-agenda-log-mode-items '(closed clock)
"List of items that should be shown in agenda log mode.
This list may contain the following symbols:
closed Show entries that have been closed on that day.
clock Show entries that have received clocked time on that day.
state Show all logged state changes."
:group 'org-agenda-daily/weekly
:type '(set :greedy t (const closed) (const clock) (const state)))
(defcustom org-agenda-start-with-clockreport-mode nil
"The initial value of clockreport-mode in a newly created agenda window."
:group 'org-agenda-startup
......@@ -1585,12 +1595,11 @@ s Search for keywords C Configure custom agenda commands
"Prefix key"))))
prefixes))
(goto-char (point-min))
(when (fboundp 'fit-window-to-buffer)
(if second-time
(if (not (pos-visible-in-window-p (point-max)))
(fit-window-to-buffer))
(setq second-time t)
(fit-window-to-buffer)))
(if second-time
(if (not (pos-visible-in-window-p (point-max)))
(org-fit-window-to-buffer))
(setq second-time t)
(org-fit-window-to-buffer))
(message "Press key for agenda command%s:"
(if (or restrict-ok org-agenda-overriding-restriction)
(if org-agenda-overriding-restriction
......@@ -1870,40 +1879,79 @@ higher priority settings."
(org-let (if nosettings nil org-agenda-exporter-settings)
'(save-excursion
(save-window-excursion
(cond
((string-match "\\.html?\\'" file)
(set-buffer (htmlize-buffer (current-buffer)))
(when (and org-agenda-export-html-style
(string-match "<style>" org-agenda-export-html-style))
;; replace <style> section with org-agenda-export-html-style
(goto-char (point-min))
(kill-region (- (search-forward "<style") 6)
(search-forward "</style>"))
(insert org-agenda-export-html-style))
(write-file file)
(kill-buffer (current-buffer))
(message "HTML written to %s" file))
((string-match "\\.ps\\'" file)
(ps-print-buffer-with-faces file)
(message "Postscript written to %s" file))
((string-match "\\.ics\\'" file)
(let ((org-agenda-marker-table
(org-create-marker-find-array
(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 nil 'ifmode))))
(t
(let ((bs (buffer-string)))
(find-file file)
(erase-buffer)
(org-agenda-mark-filtered-text)
(let ((bs (copy-sequence (buffer-string))) beg)
(org-agenda-unmark-filtered-text)
(with-temp-buffer
(insert bs)
(save-buffer 0)
(kill-buffer (current-buffer))
(message "Plain text written to %s" file))))))
(org-agenda-remove-marked-text 'org-filtered)
(while (setq beg (text-property-any (point-min) (point-max)
'org-filtered t))
(delete-region
beg (or (next-single-property-change beg 'org-filtered)
(point-max))))
(cond
((string-match "\\.html?\\'" file)
(set-buffer (htmlize-buffer (current-buffer)))
(when (and org-agenda-export-html-style
(string-match "<style>" org-agenda-export-html-style))
;; replace <style> section with org-agenda-export-html-style
(goto-char (point-min))
(kill-region (- (search-forward "<style") 6)
(search-forward "</style>"))
(insert org-agenda-export-html-style))
(write-file file)
(kill-buffer (current-buffer))
(message "HTML written to %s" file))
((string-match "\\.ps\\'" file)
(ps-print-buffer-with-faces file)
(message "Postscript written to %s" file))
((string-match "\\.ics\\'" file)
(let ((org-agenda-marker-table
(org-create-marker-find-array
(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 nil 'ifmode))))
(t
(let ((bs (buffer-string)))
(find-file file)
(erase-buffer)
(insert bs)
(save-buffer 0)
(kill-buffer (current-buffer))
(message "Plain text written to %s" file))))))))
(set-buffer org-agenda-buffer-name)))
(defvar org-agenda-filter-overlays nil)
(defun org-agenda-mark-filtered-text ()
"Mark all text hidden by filtering with a text property."
(let ((inhibit-read-only t))
(mapc
(lambda (o)
(when (equal (org-overlay-buffer o) (current-buffer))
(put-text-property
(org-overlay-start o) (org-overlay-end o)
'org-filtered t)))
org-agenda-filter-overlays)))
(defun org-agenda-unmark-filtered-text ()
"Remove the filtering text property."
(let ((inhibit-read-only t))
(remove-text-properties (point-min) (point-max) '(org-filtered t))))
(defun org-agenda-remove-marked-text (property &optional value)
"Delete all text marked with VALUE of PROPERTY.
VALUE defaults to t."
(let (beg)
(setq value (or value t))
(while (setq beg (text-property-any (point-min) (point-max)
property value))
(delete-region
beg (or (next-single-property-change beg 'org-filtered)
(point-max))))))
(defun org-agenda-collect-markers ()
"Collect the markers pointing to entries in the agenda buffer."
......@@ -1952,7 +2000,7 @@ higher priority settings."
"Fit the window to the buffer size."
(and (memq org-agenda-window-setup '(reorganize-frame))
(fboundp 'fit-window-to-buffer)
(fit-window-to-buffer
(org-fit-window-to-buffer
nil
(floor (* (frame-height) (cdr org-agenda-window-frame-fractions)))
(floor (* (frame-height) (car org-agenda-window-frame-fractions))))))
......@@ -2378,13 +2426,18 @@ given in `org-agenda-start-on-weekday'."
(while (setq file (pop files))
(catch 'nextfile
(org-check-agenda-file file)
(if org-agenda-show-log
(setq rtn (org-agenda-get-day-entries
file date
:deadline :scheduled :timestamp :sexp :closed))
(cond
((eq org-agenda-show-log 'only)
(setq rtn (org-agenda-get-day-entries
file date :closed)))
(org-agenda-show-log
(setq rtn (org-agenda-get-day-entries
file date
:deadline :scheduled :timestamp :sexp :closed)))
(t
(setq rtn (org-agenda-get-day-entries
file date
:deadline :scheduled :sexp :timestamp)))
:deadline :scheduled :sexp :timestamp))))
(setq rtnall (append rtnall rtn))))
(if org-agenda-include-diary
(progn
......@@ -3127,7 +3180,7 @@ the documentation of `org-diary'."
(setq rtn (org-agenda-get-scheduled))
(setq results (append results rtn)))
((eq arg :closed)
(setq rtn (org-agenda-get-closed))
(setq rtn (org-agenda-get-progress))
(setq results (append results rtn)))
((eq arg :deadline)
(setq rtn (org-agenda-get-deadlines))
......@@ -3331,7 +3384,8 @@ the documentation of `org-diary'."
(push txt ee))))
(nreverse ee)))
(defun org-agenda-get-closed ()
(defalias 'org-get-closed 'org-get-progress)
(defun org-agenda-get-progress ()
"Return the logged TODO entries for agenda display."
(let* ((props (list 'mouse-face 'highlight
'org-not-done-regexp org-not-done-regexp
......@@ -3341,8 +3395,20 @@ the documentation of `org-diary'."
'help-echo
(format "mouse-2 or RET jump to org file %s"
(abbreviate-file-name buffer-file-name))))
(items (if (consp org-agenda-show-log)
org-agenda-show-log
org-agenda-log-mode-items))
(parts
(delq nil
(list
(if (memq 'closed items) (concat "\\<" org-closed-string))
(if (memq 'clock items) (concat "\\<" org-clock-string))
(if (memq 'state items) "- State \"\\([a-zA-Z0-9]+\\)\""))))
(parts-re (if parts (mapconcat 'identity parts "\\|")
(error "`org-agenda-log-mode-items' is empty")))
(regexp (concat
"\\<\\(" org-closed-string "\\|" org-clock-string "\\) *\\["
"\\(" parts-re "\\)"
" *\\["
(regexp-quote
(substring
(format-time-string
......@@ -3350,7 +3416,7 @@ the documentation of `org-diary'."
(apply 'encode-time ; DATE bound by calendar
(list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
1 11))))
marker hdmarker priority category tags closedp
marker hdmarker priority category tags closedp statep state
ee txt timestr rest clocked)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
......@@ -3358,6 +3424,8 @@ the documentation of `org-diary'."
(org-agenda-skip)
(setq marker (org-agenda-new-marker (match-beginning 0))
closedp (equal (match-string 1) org-closed-string)
statep (equal (string-to-char (match-string 1)) ?-)
state (and statep (match-string 2))
category (org-get-category (match-beginning 0))
timestr (buffer-substring (match-beginning 0) (point-at-eol))
;; donep (org-entry-is-done-p)
......@@ -3366,7 +3434,7 @@ the documentation of `org-diary'."
;; substring should only run to end of time stamp
(setq rest (substring timestr (match-end 0))
timestr (substring timestr 0 (match-end 0)))
(if (and (not closedp)
(if (and (not closedp) (not statep)
(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) "]"))
......@@ -3380,8 +3448,10 @@ the documentation of `org-diary'."
tags (org-get-tags-at))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq txt (org-format-agenda-item
(if closedp "Closed: "
(concat "Clocked: (" clocked ")"))
(cond
(closedp "Closed: ")
(statep (concat "State: (" state ")"))
(t (concat "Clocked: (" clocked ")")))
(match-string 1) category tags timestr)))
(setq txt org-agenda-no-heading-message))
(setq priority 100000)
......@@ -4238,7 +4308,7 @@ E looks line \"+<2:25\"."
If the line does not have an effort defined, return nil."
(let ((eff (get-text-property (point) 'effort-minutes)))
(if (not eff)
nil ; we don't have an effort defined
0 ; we don't have an effort defined, treat as 0
(funcall op eff value))))
(defun org-agenda-filter-apply (filter)
......@@ -4258,8 +4328,6 @@ If the line does not have an effort defined, return nil."
(beginning-of-line 2))
(beginning-of-line 2))))))
(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)))
......@@ -4565,11 +4633,18 @@ so that the date SD will be in that range."
(message "Clocktable mode is %s"
(if org-agenda-clockreport-mode "on" "off")))
(defun org-agenda-log-mode ()
"Toggle log mode in an agenda buffer."
(interactive)
(defun org-agenda-log-mode (&optional special)
"Toggle log mode in an agenda buffer.
With argument SPECIAL, show all possible log items, not only the ones
configured in `org-agenda-log-mode-items'.
With a double `C-u' prefix arg, show *only* log items, nothing else."
(interactive "P")
(org-agenda-check-type t 'agenda 'timeline)
(setq org-agenda-show-log (not org-agenda-show-log))
(setq org-agenda-show-log
(if (equal special '(16))
'only
(if special '(closed clock state)
(not org-agenda-show-log))))
(org-agenda-set-mode-name)
(org-agenda-redo)
(message "Log mode is %s"
......@@ -4622,7 +4697,8 @@ so that the date SD will be in that range."
(if org-agenda-follow-mode " Follow" "")
(if org-agenda-include-diary " Diary" "")
(if org-agenda-use-time-grid " Grid" "")
(if org-agenda-show-log " Log" "")
(if (consp org-agenda-show-log) " LogAll"
(if org-agenda-show-log " Log" ""))
(if org-agenda-filter
(concat " {" (mapconcat 'identity org-agenda-filter "") "}")
"")
......@@ -4890,8 +4966,10 @@ the same tree node, and the headline of the tree node in the Org-mode file."
(buffer (marker-buffer marker))
(pos (marker-position marker))
(hdmarker (get-text-property (point) 'org-hd-marker))
(todayp (equal (get-text-property (point) 'day)
(time-to-days (current-time))))
(inhibit-read-only t)
newhead)
org-agenda-headline-snapshot-before-repeat newhead just-one)
(org-with-remote-undo buffer
(with-current-buffer buffer
(widen)
......@@ -4903,12 +4981,19 @@ the same tree node, and the headline of the tree node in the Org-mode file."
(org-todo arg)
(and (bolp) (forward-char 1))
(setq newhead (org-get-heading))
(when (and (org-bound-and-true-p
org-agenda-headline-snapshot-before-repeat)
(not (equal org-agenda-headline-snapshot-before-repeat
newhead))
todayp)
(setq newhead org-agenda-headline-snapshot-before-repeat
just-one t))
(save-excursion
(org-back-to-heading)
(move-marker org-last-heading-marker (point))))
(beginning-of-line 1)
(save-excursion
(org-agenda-change-all-lines newhead hdmarker 'fixface))
(org-agenda-change-all-lines newhead hdmarker 'fixface just-one))
(org-move-to-column col))))
(defun org-agenda-add-note (&optional arg)
......@@ -4930,7 +5015,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
(org-flag-heading nil))) ; show the next heading
(org-add-note))))
(defun org-agenda-change-all-lines (newhead hdmarker &optional fixface)
(defun org-agenda-change-all-lines (newhead hdmarker &optional fixface just-this)
"Change all lines in the agenda buffer which match HDMARKER.
The new content of the line will be NEWHEAD (as modified by
`org-format-agenda-item'). HDMARKER is checked with
......@@ -4938,6 +5023,7 @@ The new content of the line will be NEWHEAD (as modified by
If FIXFACE is non-nil, the face of each item is modified acording to
the new TODO state."
(let* ((inhibit-read-only t)
(line (org-current-line))
props m pl undone-face done-face finish new dotime cat tags)
(save-excursion
(goto-char (point-max))
......@@ -4945,6 +5031,7 @@ the new TODO state."
(while (not finish)
(setq finish (bobp))
(when (and (setq m (get-text-property (point) 'org-hd-marker))
(or (not just-this) (= (org-current-line) line))
(equal m hdmarker))
(setq props (text-properties-at (point))
dotime (get-text-property (point) 'dotime)
......@@ -5450,8 +5537,7 @@ This is a command that has to be installed in `calendar-mode-map'."
"Chinese: " (calendar-chinese-date-string date) "\n"))
(with-output-to-temp-buffer "*Dates*"
(princ s))
(if (fboundp 'fit-window-to-buffer)
(fit-window-to-buffer (get-buffer-window "*Dates*")))))
(org-fit-window-to-buffer (get-buffer-window "*Dates*"))))
;;; Appointment reminders
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.10c
;; Version: 6.12a
;;
;; This file is part of GNU Emacs.
;;
......
......@@ -4,7 +4,7 @@
;; Author: John Wiegley <johnw@newartisans.com>
;; Keywords: org data task
;; Version: 6.10c
;; Version: 6.12a
;; This file is part of GNU Emacs.
;;
......@@ -125,7 +125,7 @@ F Like \"f\", but force using dired in Emacs.
d Delete one attachment, you will be prompted for a file name.
D Delete all of a task's attachments. A safer way is
to open the directory in dired and delete from there.")))
(shrink-window-if-larger-than-buffer (get-buffer-window "*Org Attach*"))
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
(message "Select command: [acmlzoOfFdD]")
(setq c (read-char-exclusive))
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
......@@ -156,11 +156,7 @@ the directory and the corresponding ID will be created."
(let ((uuid (org-id-get (point) create-if-not-exists-p)))
(when (or uuid create-if-not-exists-p)
(unless uuid
(let ((uuid-string (shell-command-to-string "uuidgen")))
(setf uuid-string
(substring uuid-string 0 (1- (length uuid-string))))
(org-entry-put (point) "ID" uuid-string)
(setf uuid uuid-string)))
(error "ID retrieval/creation failed"))
(let ((attach-dir (expand-file-name
(format "%s/%s"
(substring uuid 0 2)
......@@ -334,6 +330,17 @@ See `org-attach-open'."
(interactive)
(org-attach-open 'in-emacs))
(defun org-attach-expand (file)
"Return the full path to the current entry's attachment file FILE.
Basically, this adds the path to the attachment directory."
(expand-file-name file (org-attach-dir)))
(defun org-attach-expand-link (file)
"Return a file link pointing to the current entry's attachment file FILE.
Basically, this adds the path to the attachment directory, and a \"file:\"
prefix."
(concat "file:" (org-attach-expand file)))
(provide 'org-attach)
;; arch-tag: fce93c2e-fe07-4fa3-a905-e10dcc7a6248
......
......@@ -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.10c
;; Version: 6.12a
;;
;; This file is part of GNU Emacs.
;;
......
......@@ -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.10c
;; Version: 6.12a
;;
;; This file is part of GNU Emacs.
;;
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.10c
;; Version: 6.12a
;;
;; This file is part of GNU Emacs.
;;
......@@ -33,6 +33,7 @@
(require 'calendar))
(declare-function calendar-absolute-from-iso "cal-iso" (&optional date))
(defvar org-time-stamp-formats)
(defgroup org-clock nil
"Options concerning clocking working time in Org-mode."
......@@ -95,6 +96,34 @@ The function is called with point at the beginning of the headline."
:group 'org-clock
:type 'integer)
(defcustom org-clock-in-resume nil
"If non-nil, when clocking into a task with a clock entry which
has not been closed, resume the clock from that point"
:group 'org-clock
:type 'boolean)
(defcustom org-clock-persist nil
"When non-nil, save the running clock when emacs is closed, and
resume it next time emacs is started."
:group 'org-clock
:type 'boolean)
(defcustom org-clock-persist-file "~/.emacs.d/org-clock-save.el"
"File to save clock data to"
:group 'org-clock
:type 'string)
(defcustom org-clock-persist-query-save nil
"When non-nil, ask before saving the current clock on exit"
:group 'org-clock
:type 'boolean)
(defcustom org-clock-persist-query-resume t
"When non-nil, ask before resuming any stored clock during
load."
:group 'org-clock
:type 'boolean)
;;; The clock for measuring work time.
(defvar org-mode-line-string "")
......@@ -175,9 +204,7 @@ of a different task.")
(+ i (- ?A 10))) m))
(push s sel-list)))
org-clock-history)
(if (fboundp 'fit-window-to-buffer)
(fit-window-to-buffer)
(shrink-window-if-larger-than-buffer))
(org-fit-window-to-buffer)
(message (or prompt "Select task for clocking:"))
(setq rpl (read-char-exclusive))
(cond
......@@ -291,12 +318,21 @@ the clocking selection, associated with the letter `d'."
(t "???")))
(setq org-clock-heading (org-propertize org-clock-heading 'face nil))
(org-clock-find-position)
(insert "\n") (backward-char 1)
(org-indent-line-function)
(insert org-clock-string " ")
(setq org-clock-start-time (current-time))
(setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive))
(if (and org-clock-in-resume
(looking-at (concat "^[ \\t]* " org-clock-string
" \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"
" +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\]$")))
(progn (message "Matched %s" (match-string 1))
(setq ts (concat "[" (match-string 1) "]"))
(goto-char (match-end 1))
(setq org-clock-start-time
(apply 'encode-time (org-parse-time-string (match-string 1)))))
(progn
(insert "\n") (backward-char 1)
(org-indent-line-function)
(insert org-clock-string " ")
(setq org-clock-start-time (current-time))
(setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive))))
(move-marker org-clock-marker (point) (buffer-base-buffer))
(or global-mode-string (setq global-mode-string '("")))
(or (memq 'org-mode-line-string global-mode-string)
......@@ -783,7 +819,7 @@ the currently selected interval size."
(te (plist-get params :tend))
(block (plist-get params :block))
(link (plist-get params :link))
ipos time p level hlc hdl
ipos time p level hlc hdl content recalc formula pcol
cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list)
(setq org-clock-file-total-minutes nil)
(when step
......@@ -923,9 +959,37 @@ the currently selected interval size."
'identity (delq nil tbl)
(if scope-is-list "\n|-\n" "\n")))
(backward-delete-char 1)
(if (setq formula (plist-get params :formula))
(cond
((eq formula '%)
(setq pcol (+ (if scope-is-list 1 0) maxlevel 3))
(insert
(format
"\n#+TBLFM: $%d='(org-clock-time%% @%d$%d $%d..$%d);%%.1f"
pcol
2
(+ 3 (if scope-is-list 1 0))
(+ (if scope-is-list 1 0) 3)
(1- pcol)))
(setq recalc t))
((stringp formula)
(insert "\n#+TBLFM: " formula)
(setq recalc t))
(t (error "invalid formula in clocktable")))
;; Should we rescue an old formula?
(when (stringp (setq content (plist-get params :content)))
(when (string-match "^\\(#\\+TBLFM:.*\\)" content)
(setq recalc t)
(insert "\n" (match-string 1 (plist-get params :content)))
(beginning-of-line 0))))
(goto-char ipos)
(skip-chars-forward "^|")
(org-table-align)
(when recalc
(if (eq formula '%)
(save-excursion (org-table-goto-column pcol nil 'force)
(insert "%")))
(org-table-recalculate 'all))
(when rm-file-column
(forward-char 1)
(org-table-delete-column)))))))
......@@ -962,7 +1026,6 @@ the currently selected interval size."
(re-search-forward "#\\+END:")
(end-of-line 0))))
(defun org-clocktable-add-file (file table)
(if table
(let ((lines (org-split-string table "\n"))
......@@ -975,6 +1038,102 @@ the currently selected interval size."
lines)
"\n"))))
(defun org-clock-time% (total &rest strings)
"Compute a time fraction in percent.
TOTAL s a time string like 10:21 specifying the total times.
STRINGS is a list of strings that should be checked for a time.
The first string that does have a time will be used.
This function is made for clock tables."
(let ((re "\\([0-9]+\\):\\([0-9]+\\)")
tot s)
(save-match-data
(catch 'exit
(if (not (string-match re total))
(throw 'exit 0.)
(setq tot (+ (string-to-number (match-string 2 total))
(* 60 (string-to-number (match-string 1 total)))))
(if (= tot 0.) (throw 'exit 0.)))
(while (setq s (pop strings))
(if (string-match "\\([0-9]+\\):\\([0-9]+\\)" s)
(throw 'exit
(/ (* 100.0 (+ (string-to-number (match-string 2 s))
(* 60 (string-to-number (match-string 1 s)))))
tot))))