Commit ff4be292 authored by Carsten Dominik's avatar Carsten Dominik
Browse files

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

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* org.el (org-matcher-time): Recognize more special values.

	* org-gnus.el (fboundp): Fix defvaralias for XEmacs.

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

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* org-table.el (orgtbl-ret): Fix RET at beginning-of-buffer.

	* org-publish.el (org-publish-org-index): Improve removal of
	temporary buffers.
parent 243de2b4
......@@ -6,7 +6,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; 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 "<style>" org-agenda-export-html-style))
;; replace <style> section with org-agenda-export-html-style
......@@ -2978,7 +2982,7 @@ MATCH is being ignored."
"Get the (Emacs Calendar) diary entries for DATE."
(require 'diary-lib)
(let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*")
(fancy-diary-buffer diary-fancy-buffer)
(fancy-diary-buffer diary-fancy-buffer)
(diary-display-hook '(fancy-diary-display))
(diary-display-function 'fancy-diary-display)
(pop-up-frames nil)
......@@ -3412,7 +3416,7 @@ the documentation of `org-diary'."
(items (if (consp org-agenda-show-log)
org-agenda-show-log
org-agenda-log-mode-items))
(parts
(parts
(delq nil
(list
(if (memq 'closed items) (concat "\\<" org-closed-string))
......@@ -3737,6 +3741,9 @@ Any match of REMOVE-RE will be removed from TXT."
(save-match-data
;; Diary entries sometimes have extra whitespace at the beginning
(if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt)))
(when org-agenda-show-inherited-tags
;; Fix the tags part in txt
(setq txt (org-agenda-add-inherited-tags txt tags)))
(let* ((category (or category
org-category
(if buffer-file-name
......@@ -3836,7 +3843,8 @@ Any match of REMOVE-RE will be removed from TXT."
;; And finally add the text properties
(org-add-props rtn nil
'org-category (downcase category) 'tags (mapcar 'downcase tags)
'org-category (downcase category)
'tags (mapcar 'org-downcase-keep-props tags)
'org-highest-priority org-highest-priority
'org-lowest-priority org-lowest-priority
'prefix-length (- (length rtn) (length txt))
......@@ -3849,6 +3857,34 @@ Any match of REMOVE-RE will be removed from TXT."
'extra extra
'dotime dotime))))
(defun org-agenda-add-inherited-tags (txt tags)
"Remove tags string from TXT, and add complete list of tags.
The new list includes inherited tags. If any inherited tags are present,
a double colon separates inherited tags from local tags."
(if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
(setq txt (substring txt 0 (match-beginning 0))))
(when tags
(let ((have-i (get-text-property 0 'inherited (car tags)))
i)
(setq txt (concat txt " :"
(mapconcat
(lambda (x)
(setq i (get-text-property 0 'inherited x))
(if (and have-i (not i))
(progn
(setq have-i nil)
(concat ":" x))
x))
tags ":")
(if have-i "::" ":")))))
txt)
(defun org-downcase-keep-props (s)
(let ((props (text-properties-at 0 s)))
(setq s (downcase s))
(add-text-properties 0 (length s) props s)
s))
(defvar org-agenda-sorting-strategy) ;; because the def is in a let form
(defvar org-agenda-sorting-strategy-selected nil)
......@@ -4024,7 +4060,7 @@ HH:MM."
(tb (or (get-text-property 1 'todo-state b) ""))
(la (- (length (member ta org-todo-keywords-for-agenda))))
(lb (- (length (member tb org-todo-keywords-for-agenda))))
(donepa (member ta org-done-keywords-for-agenda))
(donepa (member ta org-done-keywords-for-agenda))
(donepb (member tb org-done-keywords-for-agenda)))
(cond ((and donepa (not donepb)) -1)
((and (not donepa) donepb) +1)
......@@ -4228,7 +4264,7 @@ used to narrow the search - the interactive user can also press `-' or `+'
to switch to narrowing."
(interactive "P")
(let* ((alist org-tag-alist-for-agenda)
(tag-chars (mapconcat
(tag-chars (mapconcat
(lambda (x) (if (cdr x) (char-to-string (cdr x)) ""))
alist ""))
(efforts (org-split-string
......@@ -4241,7 +4277,7 @@ to switch to narrowing."
(current org-agenda-filter)
char a n tag tags)
(unless char
(message
(message
"%s by tag [%s ], [TAB], [/]:off, [+-]:narrow, [>=<]:effort: "
(if narrow "Narrow" "Filter") tag-chars)
(setq char (read-char)))
......@@ -4249,7 +4285,7 @@ to switch to narrowing."
;; Narrowing down
(cond ((equal char ?-) (setq strip t narrow t))
((equal char ?+) (setq strip nil narrow t)))
(message
(message
"Narrow by tag [%s ], [TAB], [/]:off, [>=<]:effort: " tag-chars)
(setq char (read-char)))
(when (member char '(?< ?> ?=))
......@@ -5101,7 +5137,9 @@ the new TODO state."
(goto-char (match-beginning 1))
(insert (org-add-props
(make-string (max 1 (- c (current-column))) ?\ )
(text-properties-at (point))))))))
(text-properties-at (point)))))
(goto-char (point-min))
(org-font-lock-add-tag-faces (point-max)))))
(defun org-agenda-priority-up ()
"Increase the priority of line at point, also in Org-mode file."
......@@ -5369,7 +5407,7 @@ The cursor may be at a date in the calendar, or in the Org agenda."
(widen)
(goto-char org-agenda-action-marker)
(eval form))))))))
(defun org-agenda-clock-in (&optional arg)
"Start the clock on the currently selected item."
(interactive "P")
......@@ -5512,8 +5550,6 @@ argument, latitude and longitude will be prompted for."
(calendar-view-holidays-initially-flag nil)
(calendar-view-diary-initially-flag nil)
(view-calendar-holidays-initially nil)
(calendar-view-diary-initially-flag nil)
(calendar-view-holidays-initially-flag nil)
(view-diary-entries-initially nil))
(calendar)
(calendar-goto-date date)))
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.13a
;; Version: 6.14
;;
;; This file is part of GNU Emacs.
;;
......@@ -345,7 +345,7 @@ sibling does not exist, it will be created at the end of the subtree."
(org-end-of-subtree t t)
(save-excursion
(goto-char pos)
(org-cut-subtree))
(let ((this-command this-command)) (org-cut-subtree)))
(org-paste-subtree (org-get-valid-level level 1))
(org-set-property
"ARCHIVE_TIME"
......
......@@ -4,7 +4,7 @@
;; Author: John Wiegley <johnw@newartisans.com>
;; Keywords: org data task
;; Version: 6.13a
;; Version: 6.14
;; This file is part of GNU Emacs.
;;
......@@ -181,7 +181,7 @@ This checks for the existence of a \".git\" directory in that directory."
" git add .; "
" git ls-files --deleted -z | xargs -0 git rm; "
" git commit -m 'Synchronized attachments')")))))
(defun org-attach-tag (&optional off)
"Turn the autotag on or (if OFF is set) off."
(when org-attach-auto-tag
......@@ -266,7 +266,7 @@ A safer way is to open the directory in dired and delete from there."
(when org-attach-file-list-property
(org-entry-delete (point) org-attach-file-list-property))
(let ((attach-dir (org-attach-dir)))
(when
(when
(and attach-dir
(or force
(y-or-n-p "Are you sure you want to remove all attachments of this entry? ")))
......
......@@ -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.13a
;; Version: 6.14
;;
;; This file is part of GNU Emacs.
;;
......@@ -259,8 +259,8 @@ The anniversaries are assumed to be stored `org-bbdb-anniversary-field'."
(multiple-value-bind (m d y)
(funcall org-bbdb-extract-date-fun (car split))
(setq tmp (gethash (list m d) org-bbdb-anniv-hash))
(puthash (list m d) (cons (list y
(bbdb-record-name rec)
(puthash (list m d) (cons (list y
(bbdb-record-name rec)
(cadr split))
tmp)
org-bbdb-anniv-hash))))))
......@@ -292,7 +292,7 @@ This is used by Org to re-create the anniversary hash table."
(annivs (gethash (list m d) org-bbdb-anniv-hash))
(text ())
split class form rec recs)
;; we don't want to miss people born on Feb. 29th
(when (and (= m 3) (= d 1)
(not (null (gethash (list 2 29) org-bbdb-anniv-hash)))
......@@ -303,7 +303,7 @@ This is used by Org to re-create the anniversary hash table."
(when annivs
(while (setq rec (pop annivs))
(when rec
(when rec
(let* ((class (or (nth 2 rec)
org-bbdb-default-anniversary-format))
(form (or (cdr (assoc class
......
......@@ -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.13a
;; Version: 6.14
;;
;; 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.13a
;; Version: 6.14
;;
;; This file is part of GNU Emacs.
;;
......@@ -118,7 +118,8 @@ be visited."
(const :tag "Clock and history" t)
(const :tag "No persistence" nil)))
(defcustom org-clock-persist-file "~/.emacs.d/org-clock-save.el"
(defcustom org-clock-persist-file (convert-standard-filename
"~/.emacs.d/org-clock-save.el")
"File to save clock data to"
:group 'org-clock
:type 'string)
......@@ -187,7 +188,7 @@ of a different task.")
"Select a task that recently was associated with clocking."
(interactive)
(let (sel-list rpl file task (i 0) s)
(save-window-excursion
(save-window-excursion
(org-switch-to-buffer-other-window
(get-buffer-create "*Clock Task Select*"))
(erase-buffer)
......@@ -285,13 +286,13 @@ the clocking selection, associated with the letter `d'."
(marker-position org-clock-marker)
(marker-buffer org-clock-marker))
(org-clock-out t))
(when (equal select '(16))
;; Mark as default clocking task
(save-excursion
(org-back-to-heading t)
(move-marker org-clock-default-task (point))))
(setq target-pos (point)) ;; we want to clock in at this location
(save-excursion
(when (and selected-task (marker-buffer selected-task))
......@@ -991,8 +992,8 @@ the currently selected interval size."
(cond
((eq formula '%)
(setq pcol (+ (if scope-is-list 1 0) maxlevel 3))
(insert
(format
(insert
(format
"\n#+TBLFM: $%d='(org-clock-time%% @%d$%d $%d..$%d);%%.1f"
pcol
2
......@@ -1160,7 +1161,7 @@ a stored clock"
(when (and resume-clock org-clock-persist
(file-exists-p (car resume-clock))
(or (not org-clock-persist-query-resume)
(y-or-n-p
(y-or-n-p
(concat
"Resume clock ("
(with-current-buffer (find-file (car resume-clock))
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.13a
;; Version: 6.14
;;
;; This file is part of GNU Emacs.
;;
......@@ -220,7 +220,7 @@ This is the compiled version of the format.")
(defun org-columns-add-ellipses (string width)
"Truncate STRING with WIDTH characters, with ellipses."
(cond
(cond
((<= (length string) width) string)
((<= width (length org-columns-ellipses))
(substring org-columns-ellipses 0 width))
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
;; Version: 6.13a
;; Version: 6.14
;;
;; This file is part of GNU Emacs.
;;
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
;;
;; Emacs Lisp Archive Entry
;; Filename: org-export-latex.el
;; Version: 6.13a
;; Version: 6.14
;; Author: Bastien Guerry <bzg AT altern DOT org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; 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))))
......
......@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; 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"))
......
......@@ -6,7 +6,7 @@
;; Tassilo Horn <tassilo at member dot fsf dot org>
;; 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)
......
;;; 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 <carsten at orgmode dot org>
;; 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.")