Browse Source

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

Carsten Dominik 17 years ago
parent
commit
110b336275
6 changed files with 40 additions and 16 deletions
  1. 2 0
      Makefile
  2. 0 1
      contrib/README
  3. 2 0
      lisp/ChangeLog
  4. 7 4
      lisp/org-exp.el
  5. 18 11
      lisp/org-id.el
  6. 11 0
      lisp/org.el

+ 2 - 0
Makefile

@@ -73,6 +73,7 @@ LISPF      = 	org.el			\
 		org-export-latex.el	\
 		org-faces.el		\
 		org-gnus.el		\
+		org-id.el		\
 		org-info.el		\
 		org-jsinfo.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-faces.elc:                    lisp/org-macs.elc lisp/org-compat.elc
 lisp/org-gnus.elc:         lisp/org.elc
+lisp/org-id.elc:           lisp/org.elc
 lisp/org-info.elc:         lisp/org.elc
 lisp/org-jsinfo.elc:       lisp/org.elc lisp/org-exp.elc
 lisp/org-irc.elc:          lisp/org.elc

+ 0 - 1
contrib/README

@@ -16,7 +16,6 @@ org-depend.el        --- TODO dependencies for Org-mode
 org-elisp-symbol.el  --- Org links to emacs-lisp symbols
 org-eval.el          --- The <lisp> tag, adapted from Muse
 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-mairix.el 	     --- Hook mairix search into Org for different MUAs
 org-man.el 	     --- Support for links to manpages in Org-mode

+ 2 - 0
lisp/ChangeLog

@@ -1,5 +1,7 @@
 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.
 
 2008-05-14  Carsten Dominik  <dominik@science.uva.nl>

+ 7 - 4
lisp/org-exp.el

@@ -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))
 	      "DTSTART"))
 	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*")))
     (org-refresh-category-properties)
     (save-excursion
@@ -3722,6 +3722,9 @@ When COMBINE is non nil, add the category to each line."
 		      t org-icalendar-include-body)
 		location (org-icalendar-cleanup-string
 			  (org-entry-get nil "LOCATION"))
+		uid (if org-icalendar-force-UID
+			(org-id-get-create)
+		      (org-id-get))
 		category (org-get-category))
 	  (if (looking-at re2)
 	      (progn
@@ -3768,7 +3771,7 @@ When COMBINE is non nil, add the category to each line."
 %s
 %s%s
 SUMMARY:%s%s%s
-CATEGORIES:%s
+CATEGORIES:%s%s
 END:VEVENT\n"
 			   (org-ical-ts-to-string ts "DTSTART")
 			   (org-ical-ts-to-string ts2 "DTEND" inc)
@@ -3777,8 +3780,8 @@ END:VEVENT\n"
 			       (concat "\nDESCRIPTION: " desc) "")
 			   (if (and location (string-match "\\S-" location))
 			       (concat "\nLOCATION: " location) "")
-			   category)))))
-
+			   category
+			   (if uid (concat "\nUID: " uid) ""))))))
       (when (and org-icalendar-include-sexps
 		 (condition-case nil (require 'icalendar) (error nil))
 		 (fboundp 'icalendar-export-region))

+ 18 - 11
contrib/lisp/org-id.el → lisp/org-id.el

@@ -4,14 +4,14 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; 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
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; 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
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;;; Commentary:
@@ -36,11 +34,11 @@
 ;; guarantees globally unique identifiers, even if several people are
 ;; creating ID's at the same time in files that will eventually be used
 ;; 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:
 ;;
-;; org-id-create
+;; org-id-get-create
 ;;        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
 ;;        interactively, with prefix argument the creation of a new ID is
@@ -68,6 +66,8 @@
 
 (require 'org)
 
+(declare-function message-make-fqdn "message" ())
+
 ;;; Customization
 
 (defgroup org-id nil
@@ -112,7 +112,8 @@ RFC 2445 in combination with RFC 822."
 
 ;;; 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.
 If the entry already has an ID, just return it.
 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-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)))  
 
+;;;###autoload
 (defun org-id-get (&optional pom create prefix)
   "Get the ID property of the entry at point-or-marker POM.
 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)
      (t nil))))
 
+;;;###autoload
 (defun org-id-get-with-outline-path-completion (&optional targets)
   "Use outline-path-completion to retrieve the ID of an entry.
 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)
       (move-marker pom nil))))
 
+;;;###autoload
 (defun org-id-get-with-outline-drilling (&optional targets)
   "Use an outline-cycling interface to retrieve the ID of an entry.
 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)
       (move-marker pom nil))))
 
+;;;###autoload
 (defun org-id-goto (id)
   "Switch to the buffer containing the entry with id ID.
 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)
     (org-show-context)))    
 
+;;;###autoload
 (defun org-id-find (id &optional markerp)
   "Return the location of the entry with the id ID.
 The return value is a cons cell (file-name . position), or nil

+ 11 - 0
lisp/org.el

@@ -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 "   bibtex:            Links to BibTeX entries" org-bibtex)
 	(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 "   jsinfo:            Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo)
 	(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"
 		  (beg end))
+(declare-function org-update-mode-line "org-clock" ())
+(defvar org-clock-start-time)
 (defvar org-clock-marker (make-marker)
   "Marker recording the last clock-in.")
 
@@ -2581,6 +2584,14 @@ collapsed state."
    org-columns-compute org-agenda-columns org-columns-remove-overlays
    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
 
 (defvar org-drawer-regexp nil