Moved org-id.el to the core. Can now force UIDs in iCalendar export.

This commit is contained in:
Carsten Dominik 2008-05-15 10:28:38 +02:00
parent 6ba68246c0
commit 110b336275
6 changed files with 40 additions and 16 deletions

View File

@ -73,6 +73,7 @@ LISPF = org.el \
org-export-latex.el \ org-export-latex.el \
org-faces.el \ org-faces.el \
org-gnus.el \ org-gnus.el \
org-id.el \
org-info.el \ org-info.el \
org-jsinfo.el \ org-jsinfo.el \
org-irc.el \ org-irc.el \
@ -290,6 +291,7 @@ lisp/org-exp.elc: lisp/org.elc lisp/org-agenda.elc
lisp/org-export-latex.elc: lisp/org.elc lisp/org-exp.elc lisp/org-export-latex.elc: lisp/org.elc lisp/org-exp.elc
lisp/org-faces.elc: lisp/org-macs.elc lisp/org-compat.elc lisp/org-faces.elc: lisp/org-macs.elc lisp/org-compat.elc
lisp/org-gnus.elc: lisp/org.elc lisp/org-gnus.elc: lisp/org.elc
lisp/org-id.elc: lisp/org.elc
lisp/org-info.elc: lisp/org.elc lisp/org-info.elc: lisp/org.elc
lisp/org-jsinfo.elc: lisp/org.elc lisp/org-exp.elc lisp/org-jsinfo.elc: lisp/org.elc lisp/org-exp.elc
lisp/org-irc.elc: lisp/org.elc lisp/org-irc.elc: lisp/org.elc

View File

@ -16,7 +16,6 @@ org-depend.el --- TODO dependencies for Org-mode
org-elisp-symbol.el --- Org links to emacs-lisp symbols org-elisp-symbol.el --- Org links to emacs-lisp symbols
org-eval.el --- The <lisp> tag, adapted from Muse org-eval.el --- The <lisp> tag, adapted from Muse
org-expiry.el --- expiry mechanism for Org entries org-expiry.el --- expiry mechanism for Org entries
org-id.el --- Global id's for identifying entries
org-interactive-query.el --- Interactive modification of tags query org-interactive-query.el --- Interactive modification of tags query
org-mairix.el --- Hook mairix search into Org for different MUAs org-mairix.el --- Hook mairix search into Org for different MUAs
org-man.el --- Support for links to manpages in Org-mode org-man.el --- Support for links to manpages in Org-mode

View File

@ -1,5 +1,7 @@
2008-05-15 Carsten Dominik <dominik@science.uva.nl> 2008-05-15 Carsten Dominik <dominik@science.uva.nl>
* org-id.el: New file, move from contrib to core.
* org-exp.el (org-icalendar-force-UID): New option. * org-exp.el (org-icalendar-force-UID): New option.
2008-05-14 Carsten Dominik <dominik@science.uva.nl> 2008-05-14 Carsten Dominik <dominik@science.uva.nl>

View File

@ -3694,7 +3694,7 @@ When COMBINE is non nil, add the category to each line."
(format-time-string (cdr org-time-stamp-formats) (current-time)) (format-time-string (cdr org-time-stamp-formats) (current-time))
"DTSTART")) "DTSTART"))
hd ts ts2 state status (inc t) pos b sexp rrule hd ts ts2 state status (inc t) pos b sexp rrule
scheduledp deadlinep tmp pri category entry location summary desc scheduledp deadlinep tmp pri category entry location summary desc uid
(sexp-buffer (get-buffer-create "*ical-tmp*"))) (sexp-buffer (get-buffer-create "*ical-tmp*")))
(org-refresh-category-properties) (org-refresh-category-properties)
(save-excursion (save-excursion
@ -3722,6 +3722,9 @@ When COMBINE is non nil, add the category to each line."
t org-icalendar-include-body) t org-icalendar-include-body)
location (org-icalendar-cleanup-string location (org-icalendar-cleanup-string
(org-entry-get nil "LOCATION")) (org-entry-get nil "LOCATION"))
uid (if org-icalendar-force-UID
(org-id-get-create)
(org-id-get))
category (org-get-category)) category (org-get-category))
(if (looking-at re2) (if (looking-at re2)
(progn (progn
@ -3768,7 +3771,7 @@ When COMBINE is non nil, add the category to each line."
%s %s
%s%s %s%s
SUMMARY:%s%s%s SUMMARY:%s%s%s
CATEGORIES:%s CATEGORIES:%s%s
END:VEVENT\n" END:VEVENT\n"
(org-ical-ts-to-string ts "DTSTART") (org-ical-ts-to-string ts "DTSTART")
(org-ical-ts-to-string ts2 "DTEND" inc) (org-ical-ts-to-string ts2 "DTEND" inc)
@ -3777,8 +3780,8 @@ END:VEVENT\n"
(concat "\nDESCRIPTION: " desc) "") (concat "\nDESCRIPTION: " desc) "")
(if (and location (string-match "\\S-" location)) (if (and location (string-match "\\S-" location))
(concat "\nLOCATION: " location) "") (concat "\nLOCATION: " location) "")
category))))) category
(if uid (concat "\nUID: " uid) ""))))))
(when (and org-icalendar-include-sexps (when (and org-icalendar-include-sexps
(condition-case nil (require 'icalendar) (error nil)) (condition-case nil (require 'icalendar) (error nil))
(fboundp 'icalendar-export-region)) (fboundp 'icalendar-export-region))

View File

@ -4,14 +4,14 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 0.02 ;; Version: 0.03
;; ;;
;; This file is not yet part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
;; GNU Emacs is free software; you can redistribute it and/or modify ;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option) ;; the Free Software Foundation, either version 3 of the License, or
;; any later version. ;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful, ;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -19,9 +19,7 @@
;; GNU General Public License for more details. ;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;;; Commentary: ;;; Commentary:
@ -36,11 +34,11 @@
;; guarantees globally unique identifiers, even if several people are ;; guarantees globally unique identifiers, even if several people are
;; creating ID's at the same time in files that will eventually be used ;; creating ID's at the same time in files that will eventually be used
;; together. Even higher security can be achieved by using different ;; together. Even higher security can be achieved by using different
;; values for each collaborator or file. ;; prefix values for each collaborator or file.
;; ;;
;; This file defines the following API: ;; This file defines the following API:
;; ;;
;; org-id-create ;; org-id-get-create
;; Create an ID for the entry at point if it does not yet have one. ;; Create an ID for the entry at point if it does not yet have one.
;; Returns the ID (old or new). This function can be used ;; Returns the ID (old or new). This function can be used
;; interactively, with prefix argument the creation of a new ID is ;; interactively, with prefix argument the creation of a new ID is
@ -68,6 +66,8 @@
(require 'org) (require 'org)
(declare-function message-make-fqdn "message" ())
;;; Customization ;;; Customization
(defgroup org-id nil (defgroup org-id nil
@ -112,7 +112,8 @@ RFC 2445 in combination with RFC 822."
;;; The API functions ;;; The API functions
(defun org-id-create (&optional force) ;;;###autoload
(defun org-id-get-create (&optional force)
"Create an ID for the current entry and return it. "Create an ID for the current entry and return it.
If the entry already has an ID, just return it. If the entry already has an ID, just return it.
With optional argument FORCE, force the creation of a new ID." With optional argument FORCE, force the creation of a new ID."
@ -121,12 +122,14 @@ With optional argument FORCE, force the creation of a new ID."
(org-entry-put (point) "ID" nil)) (org-entry-put (point) "ID" nil))
(org-id-get (point) 'create)) (org-id-get (point) 'create))
;;;###autoload
(defun org-id-copy () (defun org-id-copy ()
"Copy the ID of the entry at point to the kill ring. "Copy the ID of the entry at point to the kill ring.
Create an ID if necessary." Create an ID if necessary."
(interactive) (interactive)
(kill-new (org-id-get nil 'create))) (kill-new (org-id-get nil 'create)))
;;;###autoload
(defun org-id-get (&optional pom create prefix) (defun org-id-get (&optional pom create prefix)
"Get the ID property of the entry at point-or-marker POM. "Get the ID property of the entry at point-or-marker POM.
If POM is nil, refer to the entry at point. If POM is nil, refer to the entry at point.
@ -145,6 +148,7 @@ In any case, the ID of the entry is returned."
id) id)
(t nil)))) (t nil))))
;;;###autoload
(defun org-id-get-with-outline-path-completion (&optional targets) (defun org-id-get-with-outline-path-completion (&optional targets)
"Use outline-path-completion to retrieve the ID of an entry. "Use outline-path-completion to retrieve the ID of an entry.
TARGETS may be a setting for `org-refile-targets' to define the eligible TARGETS may be a setting for `org-refile-targets' to define the eligible
@ -160,6 +164,7 @@ It returns the ID of the entry. If necessary, the ID is created."
(prog1 (org-id-get pom 'create) (prog1 (org-id-get pom 'create)
(move-marker pom nil)))) (move-marker pom nil))))
;;;###autoload
(defun org-id-get-with-outline-drilling (&optional targets) (defun org-id-get-with-outline-drilling (&optional targets)
"Use an outline-cycling interface to retrieve the ID of an entry. "Use an outline-cycling interface to retrieve the ID of an entry.
This only finds entries in the current buffer, using `org-get-location'. This only finds entries in the current buffer, using `org-get-location'.
@ -169,6 +174,7 @@ It returns the ID of the entry. If necessary, the ID is created."
(prog1 (org-id-get pom 'create) (prog1 (org-id-get pom 'create)
(move-marker pom nil)))) (move-marker pom nil))))
;;;###autoload
(defun org-id-goto (id) (defun org-id-goto (id)
"Switch to the buffer containing the entry with id ID. "Switch to the buffer containing the entry with id ID.
Move the cursor to that entry in that buffer." Move the cursor to that entry in that buffer."
@ -181,6 +187,7 @@ Move the cursor to that entry in that buffer."
(move-marker m nil) (move-marker m nil)
(org-show-context))) (org-show-context)))
;;;###autoload
(defun org-id-find (id &optional markerp) (defun org-id-find (id &optional markerp)
"Return the location of the entry with the id ID. "Return the location of the entry with the id ID.
The return value is a cons cell (file-name . position), or nil The return value is a cons cell (file-name . position), or nil

View File

@ -161,6 +161,7 @@ to add the symbol `xyz', and the package must have a call to
(const :tag " bbdb: Links to BBDB entries" org-bbdb) (const :tag " bbdb: Links to BBDB entries" org-bbdb)
(const :tag " bibtex: Links to BibTeX entries" org-bibtex) (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
(const :tag " gnus: Links to GNUS folders/messages" org-gnus) (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
(const :tag " id: Global id's for identifying entries" org-id)
(const :tag " info: Links to Info nodes" org-info) (const :tag " info: Links to Info nodes" org-info)
(const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo) (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo)
(const :tag " irc: Links to IRC/ERC chat sessions" org-irc) (const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
@ -2382,6 +2383,8 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
(declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (declare-function org-clock-save-markers-for-cut-and-paste "org-clock"
(beg end)) (beg end))
(declare-function org-update-mode-line "org-clock" ())
(defvar org-clock-start-time)
(defvar org-clock-marker (make-marker) (defvar org-clock-marker (make-marker)
"Marker recording the last clock-in.") "Marker recording the last clock-in.")
@ -2581,6 +2584,14 @@ collapsed state."
org-columns-compute org-agenda-columns org-columns-remove-overlays org-columns-compute org-agenda-columns org-columns-remove-overlays
org-columns org-insert-columns-dblock)) org-columns org-insert-columns-dblock))
;; Autoload ID code
(org-autoload "org-id"
'(org-id-get-create 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))
;;; Variables for pre-computed regular expressions, all buffer local ;;; Variables for pre-computed regular expressions, all buffer local
(defvar org-drawer-regexp nil (defvar org-drawer-regexp nil