From ff4be292b376c5a753c2da6a33ea291464820fae Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 7 Dec 2008 18:36:02 +0000 Subject: [PATCH] 2008-12-07 Carsten Dominik * org-id.el (org-id-locations-file): Wrap file name with `convert-standard-filename'. (org-id-files): New variable. (org-id-use-hash): New option. (org-id-update-id-locations): Also search in all files current listed in `org-id-files'. Convert the resulting alist to a hash if the user customation says so. (org-id-locations-save): Handle he case if `org-id-locations' is a hash. (org-id-locations-load): Convert the alist to a hash. (org-id-add-location): Handle the hast case. (kill-emacs-hook): Make sure id locations are saved when Emacs is exited. (org-id-hash-to-alist, org-id-alist-to-hash) (org-id-paste-tracker): New functions. 2008-12-07 Carsten Dominik * org-agenda.el (org-agenda-goto-calendar): Remove duplicate let bindings of calendar variables. * org-table.el (org-table-find-row-type): Renamed from `org-find-row-type'. (org-table-rewrite-old-row-references): Renamed from `org-rewrite-old-row-references'. (org-table-shift-refpart): Renamed from `org-shift-refpart'. (org-table-cleanup-narrow-column-properties): Renamed from `org-cleanup-narrow-column-properties'. 2008-12-07 Carsten Dominik * org-table.el (org-find-row-type): New arguments DESC and CLINE, for better error messages. (org-table-get-descriptor-line): Supply the new arguments to `org-find-row-type'. (org-table-error-on-row-ref-crossing-hline): New option. * org.el (org-target-link-regexp): Make buffer-local. (org-move-subtree-down): Fix bug with trees at beginning of buffer. 2008-12-07 Carsten Dominik * org-faces.el (org-set-tag-faces): New function. (org-tags-special-faces-re): New variable. * org.el (org-font-lock-add-tag-faces, org-get-tag-face): New functions. * org-faces.el (org-tag-faces): New option. (org-tag): Mention `org-tag-faces' in the docstring. 2008-12-07 Carsten Dominik * org-exp.el (org-export-html-style-default): Implement new quoting. * org-jsinfo.el (org-infojs-template): Implement new quoting. * org-w3m.el (w3m-minor-mode-hook): Also add the special copy command to the `w3m-minor-mode-map'. * org-archive.el (org-archive-to-archive-sibling): Protect `this-command' to avoid appending kills during archiving. * org-exp.el (org-export-with-priority): New variable. (org-export-add-options-to-plist): Use `org-export-plist-vars' instead of internal list of strings and properties. (org-print-icalendar-entries): Retrieve the location property with inheritance. 2008-12-07 Carsten Dominik * org-exp.el (org-export-with-todo-keywords): New option. (org-export-plist-vars): Include also the keys for the #+OPTIONS line. (org-default-export-plist, org-export-add-options-to-plist) (org-export-as-ascii, org-export-as-html): Use the new structure of `org-export-plist-vars'. * org.el (org-map-entries): Return all values. 2008-12-07 Carsten Dominik * org.el (org-matcher-time): Recognize more special values. * org-gnus.el (fboundp): Fix defvaralias for XEmacs. 2008-12-07 Carsten Dominik * org.el (org-tags-exclude-from-inheritance): New option. (org-tag-inherit-p, org-remove-uniherited-tags): Respect `org-tags-exclude-from-inheritance'. * org-agenda.el (org-agenda-show-inherited-tags): New option. (org-format-agenda-item): Add inherited tags to the agenda line string, and make sure that properties are kept when downcasing the tags list. (org-agenda-add-inherited-tags): New function. (org-downcase-keep-props): New function. * org.el (org-scan-tags): Mark inherited tags with a text property. (org-get-tags-at): Mark inherited tags with a text property. (org-add-prop-inherited): New function. * org-agenda.el (org-agenda-add-inherited-tags): New function. (org-agenda-show-inherited-tags): New option. 2008-12-07 Carsten Dominik * org.el (org-modules): Add org-w3m to the default modules. * org-table.el (orgtbl-self-insert-command): Make S-SPC work in orgtbl-mode. (orgtabl-create-or-convert-from-region): New command. * org-exp.el (org-export-as-ascii): Remove the handling of targets. (org-export-ascii-preprocess): Handle targets already in this function. 2008-12-07 Carsten Dominik * org-timer.el (org-timer-start-time): Define this variable. (org-timer-item): Make argument optional. * org-list.el (org-insert-item): Automatically insert a timer item if the current list is a timer list. * org-timer.el: New file. * org-publish.el (org-publish-org-index): Only exclude the index file in the main directory from being added to the site-map. (org-publish-get-project-from-filename): If the current project is a component, start publishing from the parent project. 2008-12-07 Carsten Dominik * org-table.el (orgtbl-ret): Fix RET at beginning-of-buffer. * org-publish.el (org-publish-org-index): Improve removal of temporary buffers. --- lisp/org/org-agenda.el | 64 +++++++--- lisp/org/org-archive.el | 4 +- lisp/org/org-attach.el | 6 +- lisp/org/org-bbdb.el | 10 +- lisp/org/org-bibtex.el | 2 +- lisp/org/org-clock.el | 17 +-- lisp/org/org-colview.el | 4 +- lisp/org/org-compat.el | 2 +- lisp/org/org-exp.el | 274 +++++++++++++++++++++++++------------------ lisp/org/org-export-latex.el | 9 +- lisp/org/org-faces.el | 33 +++++- lisp/org/org-gnus.el | 6 +- lisp/org/org-id.el | 264 +++++++++++++++++++++++++++++++---------- lisp/org/org-info.el | 2 +- lisp/org/org-irc.el | 2 +- lisp/org/org-jsinfo.el | 6 +- lisp/org/org-list.el | 58 +++++---- lisp/org/org-mac-message.el | 2 +- lisp/org/org-macs.el | 2 +- lisp/org/org-mew.el | 2 +- lisp/org/org-mhe.el | 2 +- lisp/org/org-mouse.el | 4 +- lisp/org/org-plot.el | 4 +- lisp/org/org-publish.el | 36 +++--- lisp/org/org-remember.el | 8 +- lisp/org/org-rmail.el | 2 +- lisp/org/org-table.el | 75 ++++++++---- lisp/org/org-vm.el | 2 +- lisp/org/org-wl.el | 2 +- lisp/org/org.el | 225 ++++++++++++++++++++++++++++------- 30 files changed, 777 insertions(+), 352 deletions(-) diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 743e38041bf..8e58fb6ac07 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -945,6 +945,10 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour." (integer :tag "Minutes") (const :tag "No default duration"))) +(defcustom org-agenda-show-inherited-tags t + "Non-nil means, show inherited tags in each agenda line." + :group 'org-agenda-line-format + :type 'boolean) (defcustom org-agenda-remove-tags nil "Non-nil means, remove the tags from the headline copy in the agenda. @@ -1298,7 +1302,7 @@ The following commands are available: ["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 + ["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 @@ -1907,7 +1911,7 @@ higher priority settings." (cond ((string-match "\\.html?\\'" file) (set-buffer (htmlize-buffer (current-buffer))) - + (when (and org-agenda-export-html-style (string-match "" "The default style specification for exported HTML files. Please use the variables `org-export-html-style' and @@ -821,57 +833,67 @@ or if they are only using it locally." (defvar org-current-export-dir nil) ; dynamically scoped parameter (defconst org-export-plist-vars - '((:link-up . org-export-html-link-up) - (:link-home . org-export-html-link-home) - (:language . org-export-default-language) - (:customtime . org-display-custom-times) - (:headline-levels . org-export-headline-levels) - (:section-numbers . org-export-with-section-numbers) - (:section-number-format . org-export-section-number-format) - (:table-of-contents . org-export-with-toc) - (:preserve-breaks . org-export-preserve-breaks) - (:archived-trees . org-export-with-archived-trees) - (:emphasize . org-export-with-emphasize) - (:sub-superscript . org-export-with-sub-superscripts) - (:special-strings . org-export-with-special-strings) - (:footnotes . org-export-with-footnotes) - (:drawers . org-export-with-drawers) - (:tags . org-export-with-tags) - (:TeX-macros . org-export-with-TeX-macros) - (:LaTeX-fragments . org-export-with-LaTeX-fragments) - (:skip-before-1st-heading . org-export-skip-text-before-1st-heading) - (: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-include-default . org-export-html-style-include-default) - (: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) - (:html-extension . org-export-html-extension) - (:html-table-tag . org-export-html-table-tag) - (:expand-quoted-html . org-export-html-expand) - (:timestamp . org-export-html-with-timestamp) - (:publishing-directory . org-export-publishing-directory) - (:preamble . org-export-html-preamble) - (:postamble . org-export-html-postamble) - (:auto-preamble . org-export-html-auto-preamble) - (:auto-postamble . org-export-html-auto-postamble) - (:author . user-full-name) - (:email . user-mail-address) - (:select-tags . org-export-select-tags) - (:exclude-tags . org-export-exclude-tags))) + '((:link-up nil org-export-html-link-up) + (:link-home nil org-export-html-link-home) + (:language nil org-export-default-language) + (:customtime nil org-display-custom-times) + (:headline-levels "H" org-export-headline-levels) + (:section-numbers "num" org-export-with-section-numbers) + (:section-number-format nil org-export-section-number-format) + (:table-of-contents "toc" org-export-with-toc) + (:preserve-breaks "\\n" org-export-preserve-breaks) + (:archived-trees nil org-export-with-archived-trees) + (:emphasize "*" org-export-with-emphasize) + (:sub-superscript "^" org-export-with-sub-superscripts) + (:special-strings "-" org-export-with-special-strings) + (:footnotes "f" org-export-with-footnotes) + (:drawers "d" org-export-with-drawers) + (:tags "tags" org-export-with-tags) + (:todo-keywords "todo" org-export-with-todo-keywords) + (:priority "pri" org-export-with-priority) + (:TeX-macros "TeX" org-export-with-TeX-macros) + (:LaTeX-fragments "LaTeX" org-export-with-LaTeX-fragments) + (:skip-before-1st-heading "skip" org-export-skip-text-before-1st-heading) + (:fixed-width ":" org-export-with-fixed-width) + (:timestamps "<" org-export-with-timestamps) + (:author-info "author" org-export-author-info) + (:creator-info "creator" org-export-creator-info) + (:time-stamp-file "timestamp" org-export-time-stamp-file) + (:tables "|" org-export-with-tables) + (:table-auto-headline nil org-export-highlight-first-table-line) + (:style-include-default nil org-export-html-style-include-default) + (:style nil org-export-html-style) + (:style-extra nil org-export-html-style-extra) + (:agenda-style nil org-agenda-export-html-style) + (:convert-org-links nil org-export-html-link-org-files-as-html) + (:inline-images nil org-export-html-inline-images) + (:html-extension nil org-export-html-extension) + (:html-table-tag nil org-export-html-table-tag) + (:expand-quoted-html "@" org-export-html-expand) + (:timestamp nil org-export-html-with-timestamp) + (:publishing-directory nil org-export-publishing-directory) + (:preamble nil org-export-html-preamble) + (:postamble nil org-export-html-postamble) + (:auto-preamble nil org-export-html-auto-preamble) + (:auto-postamble nil org-export-html-auto-postamble) + (:author nil user-full-name) + (:email nil user-mail-address) + (:select-tags nil org-export-select-tags) + (:exclude-tags nil org-export-exclude-tags)) + "List of properties that represent export/publishing variables. +Each element is a list of 3 items: +1. The property that is used internally, and also for org-publish-project-alist +2. The string that can be used in the OPTION lines to set this option, + or nil if this option cannot be changed in this way +3. The customization variable that sets the default for this option." + +) (defun org-default-export-plist () "Return the property list with default settings for the export variables." (let ((l org-export-plist-vars) rtn e) (while (setq e (pop l)) - (setq rtn (cons (car e) (cons (symbol-value (cdr e)) rtn)))) + (setq rtn (cons (car e) (cons (symbol-value (nth 2 e)) rtn)))) rtn)) (defvar org-export-inbuffer-options-extra nil @@ -964,35 +986,17 @@ modified) list.") "Parse an OPTONS line and set values in the property list P." (let (o) (when options - (let ((op '(("H" . :headline-levels) - ("num" . :section-numbers) - ("toc" . :table-of-contents) - ("\\n" . :preserve-breaks) - ("@" . :expand-quoted-html) - (":" . :fixed-width) - ("|" . :tables) - ("^" . :sub-superscript) - ("-" . :special-strings) - ("f" . :footnotes) - ("d" . :drawers) - ("tags" . :tags) - ("*" . :emphasize) - ("TeX" . :TeX-macros) - ("LaTeX" . :LaTeX-fragments) - ("skip" . :skip-before-1st-heading) - ("author" . :author-info) - ("creator" . :creator-info) - ("timestamp" . :time-stamp-file))) - o) + (let ((op org-export-plist-vars) a) (while (setq o (pop op)) - (if (string-match (concat (regexp-quote (car o)) - ":\\([^ \t\n\r;,.]*\\)") - options) - (setq p (plist-put p (cdr o) + (if (and (nth 1 o) + (string-match (concat (regexp-quote (nth 1 o)) + ":\\([^ \t\n\r;,.]*\\)") + options)) + (setq p (plist-put p (car o) (car (read-from-string (match-string 1 options)))))))))) p) - + (defun org-export-add-subtree-options (p pos) "Add options in subtree at position POS to property list P." (save-excursion @@ -1447,14 +1451,14 @@ on this string to produce the exported version." ;; The caller markes some stuff fo killing, stuff that has been ;; used to create the page title, for example. (org-export-kill-licensed-text) - + (let ((org-inhibit-startup t)) (org-mode)) (setq case-fold-search t) (untabify (point-min) (point-max)) - + ;; Handle include files (org-export-handle-include-files) - + ;; Get rid of excluded trees (org-export-handle-export-tags (plist-get parameters :select-tags) (plist-get parameters :exclude-tags)) @@ -1462,10 +1466,13 @@ on this string to produce the exported version." ;; Handle source code snippets (org-export-replace-src-segments) + ;; Find all headings and compute the targets for them + (setq target-alist (org-export-define-heading-targets target-alist)) + ;; Get rid of drawers (org-export-remove-or-extract-drawers drawers (plist-get parameters :drawers)) - + ;; Get the correct stuff before the first headline (when (plist-get parameters :skip-before-1st-heading) (goto-char (point-min)) @@ -1476,12 +1483,12 @@ on this string to produce the exported version." (when (plist-get parameters :add-text) (goto-char (point-min)) (insert (plist-get parameters :add-text) "\n")) - + ;; Get rid of archived trees (org-export-remove-archived-trees archived-trees) - - ;; Find all headings and compute the targets for them - (setq target-alist (org-export-define-heading-targets target-alist)) + + ;; Remove todo-keywords before exporting, if the user has requested so + (org-export-remove-headline-metadata parameters) ;; Find targets in comments and move them out of comments, ;; but mark them as targets that should be invisible @@ -1506,7 +1513,6 @@ on this string to produce the exported version." ;; Remove comment environment and comment subtrees (org-export-remove-comment-blocks-and-subtrees) - ;; Find matches for radio targets and turn them into internal links (org-export-mark-radio-links) @@ -1564,18 +1570,22 @@ on this string to produce the exported version." The new targets are added to TARGET-ALIST, which is also returned." (goto-char (point-min)) (org-init-section-numbers) - (let ((re (concat "^" org-outline-regexp)) + (let ((re (concat "^" org-outline-regexp + "\\| [ \t]*:ID:[ \t]*\\([^ \t\r\n]+\\)")) level target) (while (re-search-forward re nil t) - (setq level (org-reduced-level - (save-excursion (goto-char (point-at-bol)) - (org-outline-level)))) - (setq target (org-solidify-link-text - (format "sec-%s" (org-section-number level)))) - (push (cons target target) target-alist) - (add-text-properties - (point-at-bol) (point-at-eol) - (list 'target target)))) + (if (match-end 1) + (push (cons (org-match-string-no-properties 1) + target) target-alist) + (setq level (org-reduced-level + (save-excursion (goto-char (point-at-bol)) + (org-outline-level)))) + (setq target (org-solidify-link-text + (format "sec-%s" (org-section-number level)))) + (push (cons target target) target-alist) + (add-text-properties + (point-at-bol) (point-at-eol) + (list 'target target))))) target-alist) (defun org-export-handle-invisible-targets (target-alist) @@ -1604,9 +1614,11 @@ Mark them as invisible targets." target-alist) (defun org-export-target-internal-links (target-alist) - "Find all internal links and assign target to them. + "Find all internal links and assign targets to them. If a link has a fuzzy match (i.e. not a *dedicated* target match), -let the link point to the corresponding section." +let the link point to the corresponding section. +This function also handles the id links, if they have a match in +the current file." (goto-char (point-min)) (while (re-search-forward org-bracket-link-regexp nil t) (org-if-unprotected @@ -1618,6 +1630,8 @@ let the link point to the corresponding section." (target (cond ((cdr (assoc slink target-alist))) + ((and (string-match "^id:" link) + (cdr (assoc (substring link 3) target-alist)))) ((string-match org-link-types-re link) nil) ((or (file-name-absolute-p link) (string-match "^\\." link)) @@ -1735,6 +1749,24 @@ from the buffer." b (org-end-of-subtree t)) (if (> b a) (delete-region a b))))))) +(defun org-export-remove-headline-metadata (opts) + "Remove meta data from the headline, according to user options." + (let ((re org-complex-heading-regexp) + (todo (plist-get opts :todo-keywords)) + (tags (plist-get opts :tags)) + (pri (plist-get opts :priority)) + rpl) + (when (or (not todo) (not tags) (not pri)) + ;; OK, something needs to be removed + (setq rpl (concat "\\1" + (if todo " \\2" "") + (if pri " \\3" "") + " \\4" + (if tags " \\5" ""))) + (goto-char (point-min)) + (while (re-search-forward re nil t) + (replace-match rpl t nil))))) + (defun org-export-protect-quoted-subtrees () "Mark quoted subtrees with the protection property." (let ((re-quote (concat "^\\*+[ \t]+" org-quote-string "\\>"))) @@ -1905,7 +1937,7 @@ When it is nil, all comments will be removed." "]"))) (put-text-property 0 (length s) 'face 'org-link s) (replace-match s t t)))))) - + (defun org-export-concatenate-multiline-links () "Find multi-line links and put it all into a single line. This is to make sure that the line-processing export backends @@ -2071,7 +2103,7 @@ TYPE must be a string, any of: res))) (org-number-to-roman 1961) - + ;;; Include files @@ -2227,7 +2259,7 @@ underlined headlines. The default is 3." (goto-char rbeg) (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend))))) - (opt-plist (if subtree-p + (opt-plist (if subtree-p (org-export-add-subtree-options opt-plist rbeg) opt-plist)) (custom-times org-display-custom-times) @@ -2278,6 +2310,9 @@ underlined headlines. The default is 3." :skip-before-1st-heading (plist-get opt-plist :skip-before-1st-heading) :drawers (plist-get opt-plist :drawers) + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) + :todo-keywords (plist-get opt-plist :todo-keywords) :verbatim-multiline t :select-tags (plist-get opt-plist :select-tags) :exclude-tags (plist-get opt-plist :exclude-tags) @@ -2307,7 +2342,7 @@ underlined headlines. The default is 3." ;; create local variables for all options, to make sure all called ;; functions get the correct information (mapc (lambda (x) - (set (make-local-variable (cdr x)) + (set (make-local-variable (nth 2 x)) (plist-get opt-plist (car x)))) org-export-plist-vars) (org-set-local 'org-odd-levels-only odd) @@ -2397,10 +2432,7 @@ underlined headlines. The default is 3." (while (setq line (pop lines)) ;; Remove the quoted HTML tags. (setq line (org-html-expand-for-ascii line)) - ;; Remove targets - (while (string-match "<<]*>>>?[ \t]*\n?" line) - (setq line (replace-match "" t t line))) - ;; Replace internal links + ;; Replace links with the description when possible (while (string-match org-bracket-link-regexp line) (setq line (replace-match (if (match-end 3) "[\\3]" "[\\1]") @@ -2483,13 +2515,18 @@ underlined headlines. The default is 3." (defun org-export-ascii-preprocess () "Do extra work for ASCII export" + ;; Put quotes around verbatim text (goto-char (point-min)) (while (re-search-forward org-verbatim-re nil t) (goto-char (match-end 2)) (backward-delete-char 1) (insert "'") (goto-char (match-beginning 2)) (delete-char 1) (insert "`") - (goto-char (match-end 2)))) + (goto-char (match-end 2))) + (goto-char (point-min)) + ;; Remove target markers + (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) + (replace-match "\\1\\2"))) (defun org-search-todo-below (line lines level) "Search the subtree below LINE for any TODO entries." @@ -2643,7 +2680,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." #+EMAIL: %s #+DATE: %s #+LANGUAGE: %s -#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s d:%s tags:%s +#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s d:%s todo:%s pri:%s tags:%s %s #+EXPORT_SELECT_TAGS: %s #+EXPORT_EXCLUDE_TAGS: %s @@ -2678,6 +2715,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff." org-export-with-LaTeX-fragments org-export-skip-text-before-1st-heading org-export-with-drawers + org-export-with-todo-keywords + org-export-with-priority org-export-with-tags (if (featurep 'org-jsinfo) (org-infojs-options-inbuffer-template) "") (mapconcat 'identity org-export-select-tags " ") @@ -2871,7 +2910,7 @@ PUB-DIR is set, use this as the publishing directory." (goto-char rbeg) (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)))))) - (opt-plist (if subtree-p + (opt-plist (if subtree-p (org-export-add-subtree-options opt-plist rbeg) opt-plist)) ;; The following two are dynamically scoped into other @@ -2951,6 +2990,9 @@ PUB-DIR is set, use this as the publishing directory." :skip-before-1st-heading (plist-get opt-plist :skip-before-1st-heading) :drawers (plist-get opt-plist :drawers) + :todo-keywords (plist-get opt-plist :todo-keywords) + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) :archived-trees (plist-get opt-plist :archived-trees) :select-tags (plist-get opt-plist :select-tags) @@ -3002,7 +3044,7 @@ PUB-DIR is set, use this as the publishing directory." ;; create local variables for all options, to make sure all called ;; functions get the correct information (mapc (lambda (x) - (set (make-local-variable (cdr x)) + (set (make-local-variable (nth 2 x)) (plist-get opt-plist (car x)))) org-export-plist-vars) (setq umax (if arg (prefix-numeric-value arg) @@ -3259,7 +3301,7 @@ lang=\"%s\" xml:lang=\"%s\"> "" + "\"" attr ">" (org-export-html-format-desc desc) ""))) ((member type '("http" "https")) @@ -3272,7 +3314,7 @@ lang=\"%s\" xml:lang=\"%s\"> attr (concat attr " alt=\"" path "\"")) "/>")) (setq link (concat type ":" path)) - (setq rpl (concat "" (org-export-html-format-desc desc) @@ -3282,7 +3324,7 @@ lang=\"%s\" xml:lang=\"%s\"> (setq link (concat type ":" path)) (setq rpl (concat "" + "\"" attr ">" (org-export-html-format-desc desc) ""))) @@ -3460,7 +3502,7 @@ lang=\"%s\" xml:lang=\"%s\"> (insert (cond ((equal item-type "u") "
    \n
  • \n") ((equal item-type "o") "
      \n
    1. \n") - ((equal item-type "d") + ((equal item-type "d") (format "
      \n
      %s
      \n" item-tag)))) (push item-type local-list-type) (push ind local-list-indent) @@ -4356,7 +4398,7 @@ When COMBINE is non nil, add the category to each line." (and org-icalendar-include-body (org-get-entry))) t org-icalendar-include-body) location (org-icalendar-cleanup-string - (org-entry-get nil "LOCATION")) + (org-entry-get nil "LOCATION" 'selective)) uid (if org-icalendar-store-UID (org-id-get-create) (or (org-id-get) (org-id-new))) @@ -4450,7 +4492,7 @@ END:VEVENT\n" (insert sexp "\n")))) (princ (org-diary-to-ical-string sexp-buffer)) (kill-buffer sexp-buffer)) - + (when org-icalendar-include-todo (setq prefix "TODO-") (goto-char (point-min)) @@ -4478,7 +4520,7 @@ END:VEVENT\n" (and org-icalendar-include-body (org-get-entry))) t org-icalendar-include-body) location (org-icalendar-cleanup-string - (org-entry-get nil "LOCATION")) + (org-entry-get nil "LOCATION" 'selective)) due (and (member 'todo-due org-icalendar-use-deadline) (org-entry-get nil "DEADLINE")) start (and (member 'todo-start org-icalendar-use-scheduled) @@ -4501,7 +4543,7 @@ END:VEVENT\n" (setq pri org-default-priority)) (setq pri (floor (- 9 (* 8. (/ (float (- org-lowest-priority pri)) (- org-lowest-priority org-highest-priority)))))) - + (princ (format "BEGIN:VTODO UID: %s %s diff --git a/lisp/org/org-export-latex.el b/lisp/org/org-export-latex.el index be7d5e44ed4..12565cc33ff 100644 --- a/lisp/org/org-export-latex.el +++ b/lisp/org/org-export-latex.el @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-export-latex.el -;; Version: 6.13a +;; Version: 6.14 ;; Author: Bastien Guerry ;; Maintainer: Bastien Guerry ;; Keywords: org, wp, tex @@ -144,7 +144,7 @@ providing opening and closing strings for an environment that should represent the document section. The opening clause should have a %s to represent the section title." :group 'org-export-latex - :type '(repeat + :type '(repeat (list (string :tag "LaTeX class") (string :tag "LaTeX header") (repeat :tag "Levels" :inline t @@ -423,6 +423,9 @@ when PUB-DIR is set, use this as the publishing directory." region :emph-multiline t :for-LaTeX t :comments nil + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) + :todo-keywords (plist-get opt-plist :todo-keywords) :add-text (if (eq to-buffer 'string) nil text) :skip-before-1st-heading skip :select-tags (plist-get opt-plist :select-tags) @@ -1175,7 +1178,7 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." (goto-char (point-min)) (while (re-search-forward "^[ \t]*\\begin{\\([a-zA-Z]+\\)}" nil t) (let* ((start (progn (beginning-of-line) (point))) - (end (or (and (re-search-forward + (end (or (and (re-search-forward (concat "^[ \t]*\\end{" (match-string 1) "}" nil t) (point-at-eol))) (point-max)))) diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index 2ddcb9ee416..b6b7894b334 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -163,7 +163,7 @@ This is actually only part of the face definition for the text in column view. The following faces apply, with this priority. 1. The color of the reference face. This is normally the level fact that - is used in the outline. In agenda-mode, it will be the face of the + is used in the outline. In agenda-mode, it will be the face of the first character in the line. The color is explicitly retained to make sure that the column line still looks a bit like the structure line it is masking. @@ -269,7 +269,9 @@ column view defines special faces for each outline level. See the file (defface org-tag '((t (:bold t))) - "Face for tags." + "Default face for tags. +Note that the variable `org-tag-faces' can be used to overrule this face for +specific tags." :group 'org-faces) (defface org-todo ; font-lock-warning-face @@ -313,6 +315,31 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." (string :tag "keyword") (sexp :tag "face")))) +(defvar org-tags-special-faces-re nil) +(defun org-set-tag-faces (var value) + (set var value) + (if (not value) + (setq org-tags-special-faces-re nil) + (setq org-tags-special-faces-re + (concat ":\\(" (mapconcat 'car value "\\|") "\\):")))) + +(defcustom org-tag-faces nil + "Faces for specific tags. +This is a list of cons cells, with tags in the car and faces in the cdr. +The face can be a symbol, or a property list of attributes, +like (:foreground \"blue\" :weight bold :underline t). +If you set this variable through customize, it will immediately be effective +in new buffers and in modified lines. +If you set it with Lisp, a restart of Emacs is required to activate the +changes." + :group 'org-faces + :group 'org-tags + :set 'org-set-tag-faces + :type '(repeat + (cons + (string :tag "Tag") + (sexp :tag "Face")))) + (defface org-table ;; originally copied from font-lock-function-name-face (org-compatible-face nil '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index 8cc11f1eefa..1058b0d988c 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el @@ -6,7 +6,7 @@ ;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -39,8 +39,7 @@ ;; Customization variables (when (fboundp 'defvaralias) - (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links - "Deprecated name for `org-gnus-prefer-web-links'.")) + (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) (defcustom org-gnus-prefer-web-links nil "Non-nil means, `org-store-link' will create web links to Google groups. @@ -140,6 +139,7 @@ If `org-store-link' was called with a prefix arg the meaning of (setq desc (org-email-link-description) link (org-gnus-article-link group newsgroups message-id x-no-archive)) (org-add-link-props :link link :description desc) + (gnus-summary-toggle-header -1) link)))) (defun org-gnus-open (path) diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index 8fa5ff15ea5..143e0ee0c1e 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -1,10 +1,10 @@ -;;; org-id.el --- Global identifier for Org-mode entries +;;; org-id.el --- Global identifiers for Org-mode entries ;; Copyright (C) 2008 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -116,17 +116,42 @@ be added." :group 'org-id :type 'boolean) +(defcustom org-id-track-globally t + "Non-nil means, track ID's trhough files, so that links work globally. +This work by maintaining a hash table for ID's and writing this table +to disk when exiting Emacs. Because of this, it works best if you use +a single Emacs process, not many. + +When nil, ID's are not tracked. Links to ID's will still work within +a buffer, but not if the entry is located in another file. +ID's can still be used if the entry with the id is in the same file as +the link." + :group 'org-id + :type 'boolean) + (defcustom org-id-locations-file (convert-standard-filename - "~/.org-id-locations") - "The file for remembering the last ID number generated." + "~/.emacs.d/.org-id-locations") + "The file for remembering in which file an ID was defined. +This variable is only relevant when `org-id-track-globally' is set." :group 'org-id :type 'file) (defvar org-id-locations nil - "List of files with ID's in those files.") + "List of files with ID's in those files. +Depending on `org-id-use-hash' this can also be a hash table mapping ID's +to files.") + +(defvar org-id-files nil + "List of files that contain ID's.") (defcustom org-id-extra-files 'org-agenda-text-search-extra-files - "Files to be searched for ID's, besides the agenda files." + "Files to be searched for ID's, besides the agenda files. +When Org reparses files to remake the list of files and ID's it is tracking, +it will normally scan the agenda files, the archives related to agenda files, +any files that are listed as ID containing in the current register, and +any Org-mode files currently visited by Emacs. +You can list additional files here. +This variable is only relevant when `org-id-track-globally' is set." :group 'org-id :type '(choice @@ -134,6 +159,14 @@ be added." (repeat :tag "List of files" (file)))) +(defcustom org-id-search-archives t + "Non-nil means, search also the archive files of agenda files for entries. +This is a possibility to reduce overhead, but it measn that entries moved +to the archives can no longer be found by ID. +This variable is only relevant when `org-id-track-globally' is set." + :group 'org-id + :type 'boolean) + ;;; The API functions ;;;###autoload @@ -145,13 +178,13 @@ With optional argument FORCE, force the creation of a new ID." (when force (org-entry-put (point) "ID" nil)) (org-id-get (point) 'create)) - + ;;;###autoload (defun org-id-copy () "Copy the ID of the entry at point to the kill ring. Create an ID if necessary." (interactive) - (kill-new (org-id-get nil 'create))) + (kill-new (org-id-get nil 'create))) ;;;###autoload (defun org-id-get (&optional pom create prefix) @@ -180,10 +213,10 @@ headlines. When omitted, all headlines in all agenda files are eligible. It returns the ID of the entry. If necessary, the ID is created." (let* ((org-refile-targets (or targets '((nil . (:maxlevel . 10))))) - (org-refile-use-outline-path + (org-refile-use-outline-path (if (caar org-refile-targets) 'file t)) (spos (org-refile-get-location "Entry: ")) - (pom (and spos (move-marker (make-marker) (nth 3 spos) + (pom (and spos (move-marker (make-marker) (nth 3 spos) (get-file-buffer (nth 1 spos)))))) (prog1 (org-id-get pom 'create) (move-marker pom nil)))) @@ -202,14 +235,14 @@ It returns the ID of the entry. If necessary, the ID is created." (defun org-id-goto (id) "Switch to the buffer containing the entry with id ID. Move the cursor to that entry in that buffer." - (interactive) + (interactive "sID: ") (let ((m (org-id-find id 'marker))) (unless m (error "Cannot find entry with ID \"%s\"" id)) (switch-to-buffer (marker-buffer m)) (goto-char m) (move-marker m nil) - (org-show-context))) + (org-show-context))) ;;;###autoload (defun org-id-find (id &optional markerp) @@ -326,77 +359,153 @@ and time is the usual three-integer representation of time." ;; Storing ID locations (files) -(defun org-id-update-id-locations () +(defun org-id-update-id-locations (&optional files check) "Scan relevant files for ID's. -Store the relation between files and corresponding ID's." +Store the relation between files and corresponding ID's. +This will scan all agenda files, all associated archives, and all +files currently mentioned in `org-id-locations'. +When FILES is given, scan these files instead." (interactive) - (let ((files (append (org-agenda-files) - (if (symbolp org-id-extra-files) - (symbol-value org-id-extra-files) - org-id-extra-files))) - org-agenda-new-buffers - file ids reg found id) - (while (setq file (pop files)) - (setq ids nil) - (with-current-buffer (org-get-agenda-file-buffer file) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward "^[ \t]*:ID:[ \t]+\\(\\S-+\\)[ \t]*$" - nil t) - (setq id (org-match-string-no-properties 1)) - (if (member id found) - (error "Duplicate ID \"%s\"" id)) - (push id found) - (push id ids)) - (push (cons file ids) reg))))) - (org-release-buffers org-agenda-new-buffers) - (setq org-agenda-new-buffers nil) - (setq org-id-locations reg) - (org-id-locations-save))) + (if (not org-id-track-globally) + (error "Please turn on `org-id-track-globally' if you want to track id's.") + (let ((files + (or files + (append + ;; Agenda files and all associated archives + (org-agenda-files t org-id-search-archives) + ;; Explicit extra files + (if (symbolp org-id-extra-files) + (symbol-value org-id-extra-files) + org-id-extra-files) + ;; Files associated with live org-mode buffers + (delq nil + (mapcar (lambda (b) + (with-current-buffer b + (and (org-mode-p) (buffer-file-name)))) + (buffer-list))) + ;; All files known to have id's + org-id-files))) + org-agenda-new-buffers + file nfiles tfile ids reg found id seen (ndup 0)) + (setq nfiles (length files)) + (while (setq file (pop files)) + (message "Finding ID locations (%d/%d files): %s" + (- nfiles (length files)) nfiles file) + (setq tfile (file-truename file)) + (when (and (file-exists-p file) (not (member tfile seen))) + (push tfile seen) + (setq ids nil) + (with-current-buffer (org-get-agenda-file-buffer file) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*:ID:[ \t]+\\(\\S-+\\)[ \t]*$" + nil t) + (setq id (org-match-string-no-properties 1)) + (if (member id found) + (progn + (message "Duplicate ID \"%s\"" id) + (setq ndup (1+ ndup))) + (push id found) + (push id ids))) + (push (cons (abbreviate-file-name file) ids) reg)))))) + (org-release-buffers org-agenda-new-buffers) + (setq org-agenda-new-buffers nil) + (setq org-id-locations reg) + (setq org-id-files (mapcar 'car org-id-locations)) + (org-id-locations-save) ;; this function can also handle the alist form + ;; now convert to a hash + (setq org-id-locations (org-id-alist-to-hash org-id-locations)) + (if (> ndup 0) + (message "WARNING: %d duplicate ID's found, check *Messages* buffer" ndup) + (message "%d unique files scanned for ID's" (length org-id-files))) + org-id-locations))) (defun org-id-locations-save () "Save `org-id-locations' in `org-id-locations-file'." - (with-temp-file org-id-locations-file - (print org-id-locations (current-buffer)))) + (when org-id-track-globally + (let ((out (if (hash-table-p org-id-locations) + (org-id-hash-to-alist org-id-locations) + org-id-locations))) + (with-temp-file org-id-locations-file + (print out (current-buffer)))))) (defun org-id-locations-load () "Read the data from `org-id-locations-file'." (setq org-id-locations nil) - (with-temp-buffer - (condition-case nil - (progn - (insert-file-contents-literally org-id-locations-file) - (goto-char (point-min)) - (setq org-id-locations (read (current-buffer)))) - (error - (message "Could not read org-id-values from %s. Setting it to nil." - org-id-locations-file))))) + (when org-id-track-globally + (with-temp-buffer + (condition-case nil + (progn + (insert-file-contents-literally org-id-locations-file) + (goto-char (point-min)) + (setq org-id-locations (read (current-buffer)))) + (error + (message "Could not read org-id-values from %s. Setting it to nil." + org-id-locations-file)))) + (setq org-id-files (mapcar 'car org-id-locations)) + (setq org-id-locations (org-id-alist-to-hash org-id-locations)))) (defun org-id-add-location (id file) "Add the ID with location FILE to the database of ID loations." - (when (and id file) ; don't error when called from a buffer with no file + ;; Only if global tracking is on, and when the buffer has a file + (when (and org-id-track-globally id file) (unless org-id-locations (org-id-locations-load)) - (catch 'exit - (let ((locs org-id-locations) list) - (while (setq list (pop locs)) - (when (equal (file-truename file) (file-truename (car list))) - (setcdr list (cons id (cdr list))) - (throw 'exit t)))) - (push (list file id) org-id-locations)) - (org-id-locations-save))) + (puthash id (abbreviate-file-name file) org-id-locations) + (add-to-list 'org-id-files (abbreviate-file-name file)))) + +(add-hook 'kill-emacs-hook 'org-id-locations-save) + +(defun org-id-hash-to-alist (hash) + "Turn an org-id hash into an alist, so that it can be written to a file." + (let (res x) + (maphash + (lambda (k v) + (if (setq x (member v res)) + (push k (cdr x)) + (push (list v k) res))) + hash) + res)) + +(defun org-id-alist-to-hash (list) + "Turn an org-id location list into a hash table." + (let ((res (make-hash-table + :test 'equal + :size (apply '+ (mapcar 'length list)))) + f i) + (mapc + (lambda (x) + (setq f (car x)) + (mapc (lambda (i) (puthash i f res)) (cdr x))) + list) + res)) + +(defun org-id-paste-tracker (txt &optional buffer-or-file) + "Update any ID's in TXT and assign BUFFER-OR-FILE to them." + (when org-id-track-globally + (save-match-data + (setq buffer-or-file (or buffer-or-file (current-buffer))) + (when (bufferp buffer-or-file) + (setq buffer-or-file (or (buffer-base-buffer buffer-or-file) + buffer-or-file)) + (setq buffer-or-file (buffer-file-name buffer-or-file))) + (when buffer-or-file + (let ((fname (abbreviate-file-name buffer-or-file)) + (s 0)) + (while (string-match "^[ \t]*:ID:[ \t]+\\([^ \t\n\r]+\\)" txt s) + (setq s (match-end 0)) + (org-id-add-location (match-string 1 txt) fname))))))) ;; Finding entries with specified id (defun org-id-find-id-file (id) "Query the id database for the file in which this ID is located." (unless org-id-locations (org-id-locations-load)) - (catch 'found - (mapc (lambda (x) (if (member id (cdr x)) - (throw 'found (car x)))) - org-id-locations) - nil)) + (or (gethash id org-id-locations) + ;; ball back on current buffer + (buffer-file-name (or (buffer-base-buffer (current-buffer)) + (current-buffer))))) (defun org-id-find-id-in-file (id file &optional markerp) "Return the position of the entry ID in FILE. @@ -415,8 +524,35 @@ optional argument MARKERP, return the position as a new marker." (move-marker (make-marker) pos buf) (cons file pos)))))))) +;; id link type + +;; Calling the following function is hard-coded into `org-store-link', +;; so we do have to add it to `org-store-link-functions'. + +(defun org-id-store-link () + "Store a link to the current entry, using it's ID." + (interactive) + (let* ((link (org-make-link "id:" (org-id-get-create))) + (desc (save-excursion + (org-back-to-heading t) + (or (and (looking-at org-complex-heading-regexp) + (if (match-end 4) (match-string 4) (match-string 0))) + link)))) + (org-store-link-props :link link :description desc :type "id") + link)) + +(defun org-id-open (id) + "Go to the entry with id ID." + (org-mark-ring-push) + (switch-to-buffer-other-window (current-buffer)) + (org-id-goto id)) + +(org-add-link-type "id" 'org-id-open) + (provide 'org-id) ;;; org-id.el ends here ;; arch-tag: e5abaca4-e16f-4b25-832a-540cfb63a712 + + diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index 5891d70b122..bbd8fbb77a4 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index 8527d4a0a88..897f0c93ff8 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el index e8221f7fed3..5f5c0b06733 100644 --- a/lisp/org/org-jsinfo.el +++ b/lisp/org/org-jsinfo.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -106,10 +106,10 @@ means to use the maximum value consistent with other options." (defcustom org-infojs-template " " "The template for the export style additions when org-info.js is used. Option settings will replace the %MANAGER-OPTIONS cookie." diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index d554cb12562..324d56cae72 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -6,7 +6,7 @@ ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -45,6 +45,7 @@ (declare-function org-skip-whitespace "org" ()) (declare-function org-trim "org" (s)) (declare-function org-get-indentation "org" (&optional line)) +(declare-function org-timer-item "org-timer" (&optional arg)) (defgroup org-plain-lists nil "Options concerning plain lists in Org-mode." @@ -185,35 +186,42 @@ Return t when things worked, nil when we are not in an item." (descp (save-excursion (goto-char (match-beginning 0)) (beginning-of-line 1) (save-match-data - (looking-at "[ \t]*.*? ::")))) + (and (looking-at "[ \t]*\\(.*?\\) ::") + (match-string 1))))) + (timerp (and descp + (save-match-data + (string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$" + descp)))) (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*") (match-end 0))) (blank (cdr (assq 'plain-list-item org-blank-before-new-entry))) pos) (if descp (setq checkbox nil)) - (cond - ((and (org-at-item-p) (<= (point) eow)) - ;; before the bullet - (beginning-of-line 1) - (open-line (if blank 2 1))) - ((<= (point) eow) - (beginning-of-line 1)) - (t - (unless (org-get-alist-option org-M-RET-may-split-line 'item) - (end-of-line 1) - (delete-horizontal-space)) - (newline (if blank 2 1)))) - (insert bul - (if checkbox "[ ]" "") - (if descp (concat (if checkbox " " "") - (read-string "Term: ") " :: ") "")) - (just-one-space) - (setq pos (point)) - (end-of-line 1) - (unless (= (point) pos) (just-one-space) (backward-delete-char 1))) - (org-maybe-renumber-ordered-list) - (and checkbox (org-update-checkbox-count-maybe)) - t)) + (if timerp + (progn (org-timer-item) t) + (cond + ((and (org-at-item-p) (<= (point) eow)) + ;; before the bullet + (beginning-of-line 1) + (open-line (if blank 2 1))) + ((<= (point) eow) + (beginning-of-line 1)) + (t + (unless (org-get-alist-option org-M-RET-may-split-line 'item) + (end-of-line 1) + (delete-horizontal-space)) + (newline (if blank 2 1)))) + (insert bul + (if checkbox "[ ]" "") + (if descp (concat (if checkbox " " "") + (read-string "Term: ") " :: ") "")) + (just-one-space) + (setq pos (point)) + (end-of-line 1) + (unless (= (point) pos) (just-one-space) (backward-delete-char 1))) + (org-maybe-renumber-ordered-list) + (and checkbox (org-update-checkbox-count-maybe)) + t))) ;;; Checkboxes diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el index f0d6229e7bd..5b9d3c355c5 100644 --- a/lisp/org/org-mac-message.el +++ b/lisp/org/org-mac-message.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008 Free Software Foundation, Inc. ;; Author: John Wiegley -;; Version: 6.13a +;; Version: 6.14 ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 0950b6d63a8..db18eff00f0 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el index 61bfc2fc5c5..e5e226d68a9 100644 --- a/lisp/org/org-mew.el +++ b/lisp/org/org-mew.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index c51b60e6a26..9938f52c980 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el @@ -5,7 +5,7 @@ ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index 7ec3bbe7afa..1e622ef0fd4 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -177,7 +177,7 @@ Changing this variable requires a restart of Emacs to get activated." (const :tag "S-mouse-2 and drag-mouse-3 yank link" yank-link) (const :tag "Activate headline stars" activate-stars) (const :tag "Activate item bullets" activate-bullets) - (const :tag "Activate checkboxes" activate-checkboxes))) + (const :tag "Activate checkboxes" activate-checkboxes))) (defun org-mouse-re-search-line (regexp) "Search the current line for a given regular expression." diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 491035b7900..0fc781053b0 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -119,7 +119,7 @@ will be added. Returns the resulting property list." "Export TABLE to DATA-FILE in a format readable by gnuplot. Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." (with-temp-file - data-file + data-file (make-local-variable 'org-plot-timestamp-fmt) (setq org-plot-timestamp-fmt (or (plist-get params :timefmt) diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index 6e3d1af85dc..1bb96ed822d 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -4,7 +4,7 @@ ;; Author: David O'Toole ;; Maintainer: Bastien Guerry ;; Keywords: hypermedia, outlines, wp -;; Version: 6.13a +;; Version: 6.14 ;; This file is part of GNU Emacs. ;; @@ -263,7 +263,7 @@ index of files or summary page for a given project. generates a plain list of links to all files in the project. :index-style Can be `list' (index is just an itemized list - of the titles of the files involved) or + of the titles of the files involved) or `tree' (the directory structure of the source files is reflected in the index). Defaults to `tree'." @@ -276,7 +276,7 @@ When nil, do no timestamp checking and always publish all files." :group 'org-publish :type 'boolean) -(defcustom org-publish-timestamp-directory (convert-standard-filename +(defcustom org-publish-timestamp-directory (convert-standard-filename "~/.org-timestamps/") "Name of directory in which to store publishing timestamps." :group 'org-publish @@ -422,7 +422,7 @@ This splices all the components into the list." rest)) (push p rtn))) (nreverse (org-publish-delete-dups (delq nil rtn))))) - + (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir) "Set `org-publish-temp-files' with files from BASE-DIR directory. If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is @@ -461,7 +461,7 @@ matching filenames." ;; for skip-file and skip-dir? exclude-regexp exclude-regexp) (mapc (lambda (f) - (pushnew + (pushnew (expand-file-name (concat base-dir f)) org-publish-temp-files)) include-list) @@ -470,7 +470,10 @@ matching filenames." (defun org-publish-get-project-from-filename (filename) "Return the project FILENAME belongs." (let* ((project-name (cdr (assoc (expand-file-name filename) - org-publish-files-alist)))) + org-publish-files-alist)))) + (dolist (prj org-publish-project-alist) + (if (member project-name (plist-get (cdr prj) :components)) + (setq project-name (car prj)))) (assoc project-name org-publish-project-alist))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -619,20 +622,20 @@ Default for INDEX-FILENAME is 'index.org'." (concat "Index for project " (car project)))) (index-style (or (plist-get project-plist :index-style) 'tree)) - (index-buffer (find-buffer-visiting index-filename)) + (visiting (find-buffer-visiting index-filename)) (ifn (file-name-nondirectory index-filename)) - file) - ;; if buffer is already open, kill it to prevent error message - (if index-buffer - (kill-buffer index-buffer)) - (with-temp-buffer + file index-buffer) + (with-current-buffer (setq index-buffer + (or visiting (find-file index-filename))) + (erase-buffer) (insert (concat "#+TITLE: " index-title "\n\n")) (while (setq file (pop files)) (let ((fn (file-name-nondirectory file)) (link (file-relative-name file dir)) (oldlocal localdir)) ;; index shouldn't index itself - (unless (string= fn ifn) + (unless (equal (file-truename index-filename) + (file-truename file)) (if (eq index-style 'list) (message "Generating list-style index for %s" index-title) (message "Generating tree-style index for %s" index-title) @@ -662,10 +665,9 @@ Default for INDEX-FILENAME is 'index.org'." ;; This is common to 'flat and 'tree (insert (concat indent-str " + [[file:" link "][" (org-publish-find-title file) - "]]\n")) - ))) - (write-file index-filename) - (kill-buffer (current-buffer))))) + "]]\n"))))) + (save-buffer)) + (or visiting (kill-buffer index-buffer)))) (defun org-publish-find-title (file) "Find the title of file in project." diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index d9c2dd4cadf..54037736482 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -55,7 +55,7 @@ "Non-nil means, `C-c C-c' stores remember note without further prompts. It then uses the file and headline specified by the template or (if the template does not specify them) by the variables `org-default-notes-file' -and `org-remember-default-headline'. To force prompting anyway, use +and `org-remember-default-headline'. To force prompting anyway, use `C-u C-c C-c' to file the note. When this variable is nil, `C-c C-c' gives you the prompts, and @@ -349,7 +349,7 @@ to be run from that hook to function properly." ct)) (tpl (car entry)) (plist-p (if org-store-link-plist t nil)) - (file (if (and (nth 1 entry) + (file (if (and (nth 1 entry) (or (and (stringp (nth 1 entry)) (string-match "\\S-" (nth 1 entry))) (functionp (nth 1 entry)))) @@ -589,7 +589,7 @@ from that hook." (point))) (message "%s" (format - (substitute-command-keys + (substitute-command-keys "Restore window configuration with \\[jump-to-register] %c") remember-register))) diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index f6f9e791c03..ebdb1dd990a 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 5e8442cc224..8a223bc0d9b 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -244,6 +244,14 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line." :group 'org-table-calculation :type 'boolean) +(defcustom org-table-error-on-row-ref-crossing-hline t + "Non-nil means, a relative row reference that tries to cross a hline errors. +When nil, the reference will silently be to the field just next to the hline. +Coming from below, it will be the field below the hline, coming from +above, it will be the field above the hline." + :group 'org-table + :type 'boolean) + (defgroup org-table-import-export nil "Options concerning table import and export in Org-mode." :tag "Org Table Import Export" @@ -2114,7 +2122,7 @@ not overwrite the stored one." lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) (if (and lispp literal) (setq lispp 'literal)) ;; Check for old vertical references - (setq form (org-rewrite-old-row-references form)) + (setq form (org-table-rewrite-old-row-references form)) ;; Insert complex ranges (while (and (string-match org-table-range-regexp form) (> (length (match-string 0 form)) 1)) @@ -2288,26 +2296,32 @@ and TABLE is a vector with line types." (if (and (not hn) on (not odir)) (error "should never happen");;(aref org-table-dlines on) (if (and hn (> hn 0)) - (setq i (org-find-row-type table i 'hline (equal hdir "-") nil hn))) + (setq i (org-table-find-row-type table i 'hline (equal hdir "-") + nil hn cline desc))) (if on - (setq i (org-find-row-type table i 'dline (equal odir "-") rel on))) + (setq i (org-table-find-row-type table i 'dline (equal odir "-") + rel on cline desc))) (+ bline i))))) -(defun org-find-row-type (table i type backwards relative n) +(defun org-table-find-row-type (table i type backwards relative n cline desc) + "FIXME: Needs more documentation." (let ((l (length table))) (while (> n 0) (while (and (setq i (+ i (if backwards -1 1))) (>= i 0) (< i l) (not (eq (aref table i) type)) (if (and relative (eq (aref table i) 'hline)) - (progn (setq i (- i (if backwards -1 1)) n 1) nil) + (if org-table-error-on-row-ref-crossing-hline + (error "Row descriptor %s used in line %d crosses hline" desc cline) + (progn (setq i (- i (if backwards -1 1)) n 1) nil)) t))) (setq n (1- n))) (if (or (< i 0) (>= i l)) - (error "Row descriptor leads outside table") + (error "Row descriptor %s used in line %d leads outside table" + desc cline) i))) -(defun org-rewrite-old-row-references (s) +(defun org-table-rewrite-old-row-references (s) (if (string-match "&[-+0-9I]" s) (error "Formula contains old &row reference, please rewrite using @-syntax") s)) @@ -2746,10 +2760,10 @@ For example: 28 -> AB." (or (match-end n) (error "Cannot shift reference in this direction")) (goto-char (match-beginning n)) (and (looking-at (regexp-quote (match-string n))) - (replace-match (org-shift-refpart (match-string 0) decr hline) + (replace-match (org-table-shift-refpart (match-string 0) decr hline) t t))) -(defun org-shift-refpart (ref &optional decr hline) +(defun org-table-shift-refpart (ref &optional decr hline) "Shift a refrence part REF. If DECR is set, decrease the references row/column, else increase. If HLINE is set, this may be a hline reference, it certainly is not @@ -3238,7 +3252,7 @@ table editor in arbitrary modes.") (easy-menu-add orgtbl-mode-menu) (run-hooks 'orgtbl-mode-hook)) (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) - (org-cleanup-narrow-column-properties) + (org-table-cleanup-narrow-column-properties) (org-remove-from-invisibility-spec '(org-cwidth)) (remove-hook 'before-change-functions 'org-before-change-function t) (when (fboundp 'font-lock-remove-keywords) @@ -3247,7 +3261,7 @@ table editor in arbitrary modes.") (easy-menu-remove orgtbl-mode-menu) (force-mode-line-update 'all)))) -(defun org-cleanup-narrow-column-properties () +(defun org-table-cleanup-narrow-column-properties () "Remove all properties related to narrow-column invisibility." (let ((s 1)) (while (setq s (text-property-any s (point-max) @@ -3323,7 +3337,6 @@ to execute outside of tables." '("\C-c'" org-table-edit-formulas) '("\C-c`" org-table-edit-field) '("\C-c*" org-table-recalculate) - '("\C-c|" org-table-create-or-convert-from-region) '("\C-c^" org-table-sort-lines) '([(control ?#)] org-table-rotate-recalc-marks))) elt key fun cmd) @@ -3357,6 +3370,8 @@ to execute outside of tables." [(meta return)] "\M-\C-m")) (org-defkey orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c) + (org-defkey orgtbl-mode-map "\C-c|" 'orgtbl-create-or-convert-from-region) + (when orgtbl-optimized ;; If the user wants maximum table support, we need to hijack ;; some standard editing functions @@ -3367,6 +3382,9 @@ to execute outside of tables." (org-defkey orgtbl-mode-map "|" 'org-force-self-insert)) (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu" '("OrgTbl" + ["Create or convert" org-table-create-or-convert-from-region + :active (not (org-at-table-p)) :keys "C-c |" ] + "--" ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"] ["Next Field" org-cycle :active (org-at-table-p) :keys "TAB"] ["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"] @@ -3451,6 +3469,16 @@ With prefix arg, also recompute table." (t (let (orgtbl-mode) (call-interactively (key-binding "\C-c\C-c"))))))) +(defun orgtbl-create-or-convert-from-region (arg) + "Create table or convert region to table, if no conflicting binding. +This installs the table binding `C-c |', but only if there is no +conflicting binding to this key outside orgtbl-mode." + (interactive "P") + (let* (orgtbl-mode (cmd (key-binding "\C-c|"))) + (if cmd + (call-interactively cmd) + (call-interactively 'org-table-create-or-convert-from-region)))) + (defun orgtbl-tab (arg) "Justification and field motion for `orgtbl-mode'." (interactive "P") @@ -3461,8 +3489,10 @@ With prefix arg, also recompute table." (defun orgtbl-ret () "Justification and field motion for `orgtbl-mode'." (interactive) - (org-table-justify-field-maybe) - (org-table-next-row)) + (if (bobp) + (newline) + (org-table-justify-field-maybe) + (org-table-next-row))) (defun orgtbl-self-insert-command (N) "Like `self-insert-command', use overwrite-mode for whitespace in tables. @@ -3490,12 +3520,13 @@ overwritten, and the table is not marked as requiring realignment." (self-insert-command N)) (setq org-table-may-need-update t) (let (orgtbl-mode a) - (call-interactively - (key-binding - (or (and (listp function-key-map) - (setq a (assoc last-input-event function-key-map)) - (cdr a)) - (vector last-input-event))))))) + (call-interactively + (or (key-binding + (or (and (listp function-key-map) + (setq a (assoc last-input-event function-key-map)) + (cdr a)) + (vector last-input-event))) + 'self-insert-command))))) (defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$" "Regular expression matching exponentials as produced by calc.") @@ -3569,7 +3600,7 @@ 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 + (let* ((txt (or txt (buffer-substring-no-properties (org-table-begin) (org-table-end)))) (lines (org-split-string txt "[ \t]*\n[ \t]*"))) diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el index fb82ee46960..a152b0395ba 100644 --- a/lisp/org/org-vm.el +++ b/lisp/org/org-vm.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el index 0483e3c0d38..6fdf26960f6 100644 --- a/lisp/org/org-wl.el +++ b/lisp/org/org-wl.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org.el b/lisp/org/org.el index 340737be939..8171a0271f6 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.13a +;; Version: 6.14 ;; ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ ;;; Version -(defconst org-version "6.13a" +(defconst org-version "6.14" "The version number of the file org.el.") (defun org-version (&optional here) @@ -143,7 +143,7 @@ With prefix arg HERE, insert it at point." (let ((a (member 'org-infojs org-modules))) (and a (setcar a 'org-jsinfo)))) -(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-wl) +(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) "Modules that should always be loaded together with org.el. If a description starts with , the file is not part of Emacs and loading it will require that you have downloaded and properly installed @@ -172,6 +172,7 @@ to add the symbol `xyz', and the package must have a call to (const :tag " rmail: Links to RMAIL folders/messages" org-rmail) (const :tag " vm: Links to VM folders/messages" org-vm) (const :tag " wl: Links to Wanderlust folders/messages" org-wl) + (const :tag " w3m: Special cut/past from w3m to Org." org-w3m) (const :tag " mouse: Additional mouse support" org-mouse) (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) @@ -955,6 +956,40 @@ It should match if the message is from the user him/herself." :group 'org-link-store :type 'regexp) +(defcustom org-link-to-org-use-id 'create-if-interactive + "Non-nil means, storing a link to an Org file will use entry ID's. + +Note that before this variable is even considered, org-id must be loaded, +to please customize `org-modules' and turn it on. + +The variable can have the following values: + +t Create an ID if needed to make a link to the current entry. + +create-if-interactive + If `org-store-link' is called directly (interactively, as a user + command), do create an ID to support the link. But when doing the + job for remember, only use the ID if it already exists. The + purpose of this setting is to avoid proliferation of unwanted + ID's, just because you happen to be in an Org file when you + call `org-remember' that automatically and preemptively + creates a link. If you do want to get an ID link in a remember + template to an entry not having an ID, create it first by + explicitly creating a link to it, using `C-c C-l' first. + +use-existing + Use existing ID, do not create one. + +nil Never use an ID to make a link, instead link using a text search for + the headline text." + :group 'org-link-store + :type '(choice + (const :tag "Create ID to make link" t) + (const :tag "Create if string link interactively" + 'create-if-interactive) + (const :tag "Only use existing" 'use-existing) + (const :tag "Do not use ID to create link" nil))) + (defcustom org-context-in-file-links t "Non-nil means, file links from `org-store-link' contain context. A search string will be added to the file name with :: as separator and @@ -1881,13 +1916,16 @@ the tags are again aligned to `org-tags-column'." (defcustom org-use-tag-inheritance t "Non-nil means, tags in levels apply also for sublevels. When nil, only the tags directly given in a specific line apply there. -If this option is t, a match early-on in a tree can lead to a large -number of matches in the subtree. If you only want to see the first -match in a tree during a search, check out the variable -`org-tags-match-list-sublevels'. - This may also be a list of tags that should be inherited, or a regexp that -matches tags that should be inherited." +matches tags that should be inherited. Additional control is possible +with the variable `org-tags-exclude-from-inheritance' which gives an +explicit list of tags to be excluded from inheritance., even if the value of +`org-use-tag-inheritance' would select it for inheritance. + +If this option is t, a match early-on in a tree can lead to a large +number of matches in the subtree when constructing the agenda or creating +a sparse tree. If you only want to see the first match in a tree during +a search, check out the variable `org-tags-match-list-sublevels'." :group 'org-tags :type '(choice (const :tag "Not" nil) @@ -1895,9 +1933,18 @@ matches tags that should be inherited." (repeat :tag "Specific tags" (string :tag "Tag")) (regexp :tag "Tags matched by regexp"))) +(defcustom org-tags-exclude-from-inheritance nil + "List of tags that should never be inherited. +This is a way to exclude a few tags from inheritance. For way to do +the opposite, to actively allow inheritance for selected tags, +see the variable `org-use-tag-inheritance'." + :group 'org-tags + :type '(repeat (string :tag "Tag"))) + (defun org-tag-inherit-p (tag) "Check if TAG is one that should be inherited." (cond + ((member tag org-tags-exclude-from-inheritance) nil) ((eq org-use-tag-inheritance t) t) ((not org-use-tag-inheritance) nil) ((stringp org-use-tag-inheritance) @@ -1917,7 +1964,11 @@ inheritance off, you very likely want to turn this option on. As a special case, if the tag search is restricted to TODO items, the value of this variable is ignored and sublevels are always checked, to -make sure all corresponding TODO items find their way into the list." +make sure all corresponding TODO items find their way into the list. + +This variable is semi-obsolete and probably should always be true. It +is better to limit inheritance to certain tags using the variables +`org-use-tag-inheritanc'e and `org-tags-exclude-from-inheritance'." :group 'org-tags :type 'boolean) @@ -2353,9 +2404,9 @@ Use customize to modify this, or restart Emacs after changing it." :group 'org) (defcustom org-completion-use-ido nil - "Non-ni means, use ido completion wherever possible." + "Non-nil means, use ido completion wherever possible." :group 'org-completion - :type 'boolean) + :type 'boolean) (defcustom org-completion-fallback-command 'hippie-expand "The expansion command called by \\[org-complete] in normal context. @@ -2640,6 +2691,17 @@ If yes, offer to stop it and to save the buffer with the changes." (when (org-match-line "#\\+BEGIN: clocktable\\>") (org-clocktable-shift dir n))) +;; Autoload org-timer.el + +;(declare-function org-timer "org-timer") + +(eval-and-compile + (org-autoload + "org-timer" + '(org-timer-start org-timer org-timer-item + org-timer-change-times-in-region))) + + ;; Autoload archiving code ;; The stuff that is needed for cycling and tags has to be defined here. @@ -2778,11 +2840,12 @@ collapsed state." ;; Autoload ID code +(declare-function org-id-store-link "org-id") (org-autoload "org-id" '(org-id-get-create org-id-new org-id-copy org-id-get org-id-get-with-outline-path-completion org-id-get-with-outline-drilling - org-id-goto org-id-find)) + org-id-goto org-id-find org-id-store-link)) ;;; Variables for pre-computed regular expressions, all buffer local @@ -3693,6 +3756,7 @@ will be prompted for." (defvar org-target-link-regexp nil "Regular expression matching radio targets in plain text.") +(make-variable-buffer-local 'org-target-link-regexp) (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>" "Regular expression matching a link target.") (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>" @@ -3915,6 +3979,8 @@ between words." nil) ;; Priorities (list (concat "\\[#[A-Z0-9]\\]") '(0 'org-special-keyword t)) + ;; Tags + '(org-font-lock-add-tag-faces) ;; Special keywords (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) @@ -3974,6 +4040,22 @@ If KWD is a number, get the corresponding match group." (and (member kwd org-done-keywords) 'org-done) 'org-todo)) +(defun org-font-lock-add-tag-faces (limit) + "Add the special tag faces." + (when (and org-tag-faces org-tags-special-faces-re) + (while (re-search-forward org-tags-special-faces-re limit t) + (add-text-properties (match-beginning 1) (match-end 1) + (list 'face (org-get-tag-face 1) + 'font-lock-fontified t)) + (backward-char 1)))) + +(defun org-get-tag-face (kwd) + "Get the right face for a TODO keyword KWD. +If KWD is a number, get the corresponding match group." + (if (numberp kwd) (setq kwd (match-string kwd))) + (or (cdr (assoc kwd org-tag-faces)) + 'org-tag)) + (defun org-unfontify-region (beg end &optional maybe_loudly) "Remove fontification and activation overlays from links." (font-lock-default-unfontify-region beg end) @@ -5060,8 +5142,8 @@ is signaled in this case." (setq txt (buffer-substring beg end)) (org-save-markers-in-region beg end) (delete-region beg end) - (outline-flag-region (1- beg) beg nil) - (outline-flag-region (1- (point)) (point) nil) + (or (= beg (point-min)) (outline-flag-region (1- beg) beg nil)) + (or (bobp) (outline-flag-region (1- (point)) (point) nil)) (let ((bbb (point))) (insert-before-markers txt) (org-reinstall-markers-in-region bbb) @@ -5221,6 +5303,7 @@ the inserted text when done." (beginning-of-line 1) (unless for-yank (org-back-over-empty-lines)) (setq beg (point)) + (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) (insert-before-markers txt) (unless (string-match "\n\\'" txt) (insert "\n")) (setq newend (point)) @@ -6094,7 +6177,6 @@ type. For a simple example of an export function, see `org-bbdb.el'." (setcdr (assoc type org-link-protocols) (list follow export)) (push (list type follow export) org-link-protocols))) - ;;;###autoload (defun org-store-link (arg) "\\Store an org-link to the current location. @@ -6155,14 +6237,34 @@ For file links, arg negates `org-context-in-file-links'." link (org-make-link cpltxt))) ((and buffer-file-name (org-mode-p)) - ;; Just link to current headline - (setq cpltxt (concat "file:" - (abbreviate-file-name buffer-file-name))) - ;; Add a context search string - (when (org-xor org-context-in-file-links arg) - ;; Check if we are on a target - (if (org-in-regexp "<<\\(.*?\\)>>") - (setq cpltxt (concat cpltxt "::" (match-string 1))) + (cond + ((org-in-regexp "<<\\(.*?\\)>>") + (setq cpltxt + (concat "file:" + (abbreviate-file-name buffer-file-name) + "::" (match-string 1)) + link (org-make-link cpltxt))) + ((and (featurep 'org-id) + (or (eq org-link-to-org-use-id t) + (and (eq org-link-to-org-use-id 'create-if-interactive) + (interactive-p)) + (and org-link-to-org-use-id + (condition-case nil + (org-entry-get nil "ID") + (error nil))))) + ;; We can make a link using the ID. + (setq link (condition-case nil + (org-id-store-link) + (error + ;; probably before first headling, link to file only + (concat "file:" + (abbreviate-file-name buffer-file-name)))))) + (t + ;; Just link to current headline + (setq cpltxt (concat "file:" + (abbreviate-file-name buffer-file-name))) + ;; Add a context search string + (when (org-xor org-context-in-file-links arg) (setq txt (cond ((org-on-heading-p) nil) ((org-region-active-p) @@ -6174,10 +6276,10 @@ For file links, arg negates `org-context-in-file-links'." (condition-case nil (org-make-org-heading-search-string txt) (error ""))) - desc "NONE")))) - (if (string-match "::\\'" cpltxt) - (setq cpltxt (substring cpltxt 0 -2))) - (setq link (org-make-link cpltxt))) + desc "NONE"))) + (if (string-match "::\\'" cpltxt) + (setq cpltxt (substring cpltxt 0 -2))) + (setq link (org-make-link cpltxt))))) ((buffer-file-name (buffer-base-buffer)) ;; Just link to this file here. @@ -6889,7 +6991,7 @@ application the system uses for this file type." (format "Execute \"%s\" as elisp? " (org-add-props cmd nil 'face 'org-warning)))) - (message "%s => %s" cmd + (message "%s => %s" cmd (if (equal (string-to-char cmd) ?\() (eval (read cmd)) (call-interactively (read cmd)))) @@ -9026,8 +9128,14 @@ only lines with a TODO keyword are included in the output." ;; compile tags for current headline (setq tags-list (if org-use-tag-inheritance - (apply 'append (mapcar 'cdr tags-alist)) + (apply 'append (mapcar 'cdr (reverse tags-alist))) tags)) + (when org-use-tag-inheritance + (setcdr (car tags-alist) + (mapcar (lambda (x) + (setq x (copy-sequence x)) + (org-add-prop-inherited x)) + (cdar tags-alist)))) (when (and tags org-use-tag-inheritance (not (eq t org-use-tag-inheritance))) ;; selective inheritance, remove uninherited ones @@ -9083,15 +9191,22 @@ only lines with a TODO keyword are included in the output." (defun org-remove-uniherited-tags (tags) "Remove all tags that are not inherited from the list TAGS." (cond - ((eq org-use-tag-inheritance t) tags) + ((eq org-use-tag-inheritance t) + (if org-tags-exclude-from-inheritance + (org-delete-all org-tags-exclude-from-inheritance tags) + tags)) ((not org-use-tag-inheritance) nil) ((stringp org-use-tag-inheritance) (delq nil (mapcar - (lambda (x) (if (string-match org-use-tag-inheritance x) x nil)) + (lambda (x) + (if (and (string-match org-use-tag-inheritance x) + (not (member x org-tags-exclude-from-inheritance))) + x nil)) tags))) ((listp org-use-tag-inheritance) (delq nil (mapcar - (lambda (x) (if (member x org-use-tag-inheritance) x nil)) + (lambda (x) + (if (member x org-use-tag-inheritance) x nil)) tags))))) (defvar todo-only) ;; dynamically scoped @@ -9301,12 +9416,20 @@ epoch to the beginning of today (00:00)." (append '(0 0 0) (nthcdr 3 (decode-time)))))) (defun org-matcher-time (s) - (cond - ((string= s "") (float-time)) - ((string= s "") (org-time-today)) - ((string= s "") (+ 86400.0 (org-time-today))) - ((string= s "") (- (org-time-today) 86400.0)) - (t (org-2ft s)))) + "Interprete a time comparison value." + (save-match-data + (cond + ((string= s "") (float-time)) + ((string= s "") (org-time-today)) + ((string= s "") (+ 86400.0 (org-time-today))) + ((string= s "") (- (org-time-today) 86400.0)) + ((string-match "^<\\([-+][0-9]+\\)\\([dwmy]\\)>$" s) + (+ (org-time-today) + (* (string-to-number (match-string 1 s)) + (cdr (assoc (match-string 2 s) + '(("d" . 86400.0) ("w" . 604800.0) + ("m" . 2678400.0) ("y" . 31557600.0))))))) + (t (org-2ft s))))) (defun org-match-any-p (re list) "Does re match any element of list?" @@ -9348,6 +9471,8 @@ ignore inherited ones." (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$")) (setq ltags (org-split-string (org-match-string-no-properties 1) ":")) + (when parent + (setq ltags (mapcar 'org-add-prop-inherited ltags))) (setq tags (append (if parent (org-remove-uniherited-tags ltags) @@ -9360,6 +9485,10 @@ ignore inherited ones." (error nil))))) (append (org-remove-uniherited-tags org-file-tags) tags)))) +(defun org-add-prop-inherited (s) + (add-text-properties 0 (length s) '(inherited t) s) + s) + (defun org-toggle-tag (tag &optional onoff) "Toggle the tag TAG for the current line. If ONOFF is `on' or `off', don't toggle but set to this state." @@ -9842,7 +9971,7 @@ the scanner. The following items can be given here: (org-agenda-skip-function (car (org-delete-all '(comment archive) skip))) (org-tags-match-list-sublevels t) - matcher pos file + matcher pos file res org-todo-keywords-for-agenda org-done-keywords-for-agenda org-todo-keyword-alist-for-agenda @@ -9851,7 +9980,7 @@ the scanner. The following items can be given here: (cond ((eq match t) (setq matcher t)) ((eq match nil) (setq matcher t)) - (t (setq matcher (if match (org-make-tags-matcher match) t)))) + (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) (when (eq scope 'tree) (org-back-to-heading t) @@ -9884,7 +10013,8 @@ the scanner. The following items can be given here: (save-restriction (widen) (goto-char (point-min)) - (org-scan-tags func matcher)))))))) + (setq res (append res (org-scan-tags func matcher))))))) + res))) ;;;; Properties @@ -10484,6 +10614,7 @@ completion." IDENT can be a string, a symbol or a number, this function will search for the string representation of it. Return the position where this entry starts, or nil if there is no such entry." + (interactive "sID: ") (let ((id (cond ((stringp ident) ident) ((symbol-name ident) (symbol-name ident)) @@ -12418,6 +12549,10 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." (org-defkey org-mode-map "\C-c\C-xp" 'org-set-property) (org-defkey org-mode-map "\C-c\C-xi" 'org-insert-columns-dblock) +(org-defkey org-mode-map "\C-c\C-x." 'org-timer) +(org-defkey org-mode-map "\C-c\C-x-" 'org-timer-item) +(org-defkey org-mode-map "\C-c\C-x0" 'org-timer-start) + (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns) (when (featurep 'xemacs) @@ -13191,7 +13326,11 @@ See the individual commands for more information." :style radio :selected org-display-custom-times] "--" ["Goto Calendar" org-goto-calendar t] - ["Date from Calendar" org-date-from-calendar t]) + ["Date from Calendar" org-date-from-calendar t] + "--" + ["Start/restart timer" org-timer-start t] + ["Insert timer string" org-timer t] + ["Insert timer item" org-timer-item t]) ("Logging work" ["Clock in" org-clock-in t] ["Clock out" org-clock-out t] -- 2.11.4.GIT