changeset 106168:83924fb4f59c

2009-11-20 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-diary-entry-in-org-file): Rebuild agenda after adding new entry. * org-datetree.el (org-datetree-find-day-create): Fix regular expression. * org.el (org-display-outline-path): Use a format specifier for message, to avoid problems with heading containing `%'. * org-agenda.el (org-agenda-hide-tags-regexp): New option. (org-format-agenda-item): Call `org-agenda-fix-displayed-tags'. (org-agenda-fix-displayed-tags): New function. (org-agenda-do-context-action): Just call `org-display-outline-path', without piping the result through `message'. * org-latex.el (org-export-latex-preprocess): Protect secondary footnote references. * org-indent.el (org-indent-initialize): Avoid empty strings as line prefixes. * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure hat checking for the mark does not throw an error. (org-agenda-diary-entry-in-org-file): Catch the case that there is not `day' text property in the cursor line. * org.el (org-sort-entries-or-items): Make sure that the final entry has a newline before doing the sorting. * org-agenda.el (org-agenda-diary-entry-in-org-file): Get the text property at the beginning of the line. * org.el (org-make-link-string): Don't allow a description with only white space. * org-agenda.el (org-agenda-insert-diary-strategy): New variable. (org-agenda-insert-diary-as-top-level): New function. (org-agenda-add-entry-to-org-agenda-diary-file): Call `org-agenda-insert-diary-as-top-level'. * org.el (org-occur-in-agenda-files): Make sure none of the buffers is narrowed. (org-activate-plain-links): Add the face property here. (org-set-font-lock-defaults): Do not add the face to plain links, the activator function does this. * org-habit.el (org-is-habit-p): Add doc string. * org-archive.el (org-archive-subtree-default-with-confirmation): Autoload. * org-latex.el (org-export-latex-fontify): Fix regexp to make char after match optional (happens at the end of a line...). * org.el (org-fontify-meta-lines-and-blocks): Apply special faces for special blocks. * org-faces.el (org-copy-face): Set lisp indentation. (org-quote, org-verse): New faces. * org-agenda.el (org-agenda-remove-date): Remove variable. * org-freemind.el (org-freemind-escape-str-from-org): Fix encoding. * org-html.el (org-export-as-html): Move the home/up link into the content div. * org.el (org-export-latex-packages-alist): Option definition moved here from org-latex.el. * org-html.el (org-export-html-home/up-format): Add an ID to the up/home div. * org-wl.el (org-wl-store-link): Handle the case that `wl-use-petname' is set. * org.el (org-set-effort): Improve prompt. (org-get-outline-path): Widen to get full path. (org-compact-display-after-subtree-move): Function removed. 2009-11-20 Eric Schulte <schulte.eric@gmail.com> * org-exp-blocks.el (org-export-blocks-format-ditaa): Use sha1 hash keys to cache and re-use images generated by the org-exp-blocks interface to ditaa and dot. * org.el (org-format-latex): Latex images are now saved to files named by the sha1 hash of the latex source text avoiding regeneration of identical images.
author Carsten Dominik <dominik@science.uva.nl>
date Fri, 20 Nov 2009 20:50:32 +0000
parents c898329ba7ba
children d8676d1a7b94
files lisp/org/ChangeLog lisp/org/org-agenda.el lisp/org/org-archive.el lisp/org/org-ascii.el lisp/org/org-attach.el lisp/org/org-bbdb.el lisp/org/org-bibtex.el lisp/org/org-clock.el lisp/org/org-colview.el lisp/org/org-compat.el lisp/org/org-crypt.el lisp/org/org-datetree.el lisp/org/org-docbook.el lisp/org/org-exp-blocks.el lisp/org/org-exp.el lisp/org/org-faces.el lisp/org/org-feed.el lisp/org/org-footnote.el lisp/org/org-freemind.el lisp/org/org-gnus.el lisp/org/org-habit.el lisp/org/org-html.el lisp/org/org-icalendar.el lisp/org/org-id.el lisp/org/org-indent.el lisp/org/org-info.el lisp/org/org-inlinetask.el lisp/org/org-irc.el lisp/org/org-jsinfo.el lisp/org/org-latex.el lisp/org/org-list.el lisp/org/org-mac-message.el lisp/org/org-macs.el lisp/org/org-mew.el lisp/org/org-mhe.el lisp/org/org-mobile.el lisp/org/org-mouse.el lisp/org/org-plot.el lisp/org/org-protocol.el lisp/org/org-publish.el lisp/org/org-remember.el lisp/org/org-rmail.el lisp/org/org-src.el lisp/org/org-table.el lisp/org/org-timer.el lisp/org/org-vm.el lisp/org/org-w3m.el lisp/org/org-wl.el lisp/org/org-xoxo.el lisp/org/org.el
diffstat 50 files changed, 422 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/org/ChangeLog	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/ChangeLog	Fri Nov 20 20:50:32 2009 +0000
@@ -1,3 +1,96 @@
+2009-11-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-diary-entry-in-org-file): Rebuild
+	agenda after adding new entry.
+
+	* org-datetree.el (org-datetree-find-day-create): Fix regular
+	expression.
+
+	* org.el (org-display-outline-path): Use a format specifier for
+	message, to avoid problems with heading containing `%'.
+
+	* org-agenda.el (org-agenda-hide-tags-regexp): New option.
+	(org-format-agenda-item): Call `org-agenda-fix-displayed-tags'.
+	(org-agenda-fix-displayed-tags): New function.
+	(org-agenda-do-context-action): Just call
+	`org-display-outline-path', without piping the result through
+	`message'.
+
+	* org-latex.el (org-export-latex-preprocess): Protect secondary
+	footnote references.
+
+	* org-indent.el (org-indent-initialize): Avoid empty strings as
+	line prefixes.
+
+	* org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure
+	hat checking for the mark does not throw an error.
+	(org-agenda-diary-entry-in-org-file): Catch the case that there is
+	not `day' text property in the cursor line.
+
+	* org.el (org-sort-entries-or-items): Make sure that the final
+	entry has a newline before doing the sorting.
+
+	* org-agenda.el (org-agenda-diary-entry-in-org-file): Get the text
+	property at the beginning of the line.
+
+	* org.el (org-make-link-string): Don't allow a description with
+	only white space.
+
+	* org-agenda.el (org-agenda-insert-diary-strategy): New variable.
+	(org-agenda-insert-diary-as-top-level): New function.
+	(org-agenda-add-entry-to-org-agenda-diary-file): Call
+	`org-agenda-insert-diary-as-top-level'.
+
+	* org.el (org-occur-in-agenda-files): Make sure none of the
+	buffers is narrowed.
+	(org-activate-plain-links): Add the face property here.
+	(org-set-font-lock-defaults): Do not add the face to plain links,
+	the activator function does this.
+
+	* org-habit.el (org-is-habit-p): Add doc string.
+
+	* org-archive.el (org-archive-subtree-default-with-confirmation):
+	Autoload.
+
+	* org-latex.el (org-export-latex-fontify): Fix regexp to make char
+	after match optional (happens at the end of a line...).
+
+	* org.el (org-fontify-meta-lines-and-blocks): Apply special faces
+	for special blocks.
+
+	* org-faces.el (org-copy-face): Set lisp indentation.
+	(org-quote, org-verse): New faces.
+
+	* org-agenda.el (org-agenda-remove-date): Remove variable.
+
+	* org-freemind.el (org-freemind-escape-str-from-org): Fix encoding.
+
+	* org-html.el (org-export-as-html): Move the home/up link into
+	the content div.
+
+	* org.el (org-export-latex-packages-alist): Option definition
+	moved here from org-latex.el.
+
+	* org-html.el (org-export-html-home/up-format): Add an ID to the
+	up/home div.
+
+	* org-wl.el (org-wl-store-link): Handle the case that
+	`wl-use-petname' is set.
+
+	* org.el (org-set-effort): Improve prompt.
+	(org-get-outline-path): Widen to get full path.
+	(org-compact-display-after-subtree-move): Function removed.
+
+2009-11-20  Eric Schulte  <schulte.eric@gmail.com>
+
+	* org-exp-blocks.el (org-export-blocks-format-ditaa): Use sha1
+	hash keys to cache and re-use images generated by the
+	org-exp-blocks interface to ditaa and dot.
+
+	* org.el (org-format-latex): Latex images are now saved to files
+	named by the sha1 hash of the latex source text avoiding
+	regeneration of identical images.
+
 2009-11-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-latex.el (org-export-as-latex): Add the :drawers property.
--- a/lisp/org/org-agenda.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-agenda.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -1208,6 +1208,16 @@
   :group 'org-agenda-line-format
   :type 'boolean)
 
+(defcustom org-agenda-hide-tags-regexp nil
+  "Regular expression used to filter away specific tags in agenda views.
+This means that these tags will be present, but not be shown in the agenda
+line.  Secondayt filltering will still work on the hidden tags.
+Nil means don't hide any tags."
+  :group 'org-agenda-line-format
+  :type '(choice
+	  (const  :tag "Hide none" nil)
+	  (string :tag "Regexp   ")))
+
 (defcustom org-agenda-remove-tags nil
   "Non-nil means, remove the tags from the headline copy in the agenda.
 When this is the symbol `prefix', only remove tags when
@@ -2970,7 +2980,6 @@
 (defvar org-starting-day nil) ; local variable in the agenda buffer
 (defvar org-agenda-span nil) ; local variable in the agenda buffer
 (defvar org-include-all-loc nil) ; local variable
-(defvar org-agenda-remove-date nil) ; dynamically scoped FIXME: not used???
 
 ;;;###autoload
 (defun org-agenda-list (&optional include-all start-day ndays)
@@ -4513,9 +4522,12 @@
   (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)))
+
+    ;; Fix the tags part in txt
+    (setq txt (org-agenda-fix-displayed-tags
+	       txt tags
+	       org-agenda-show-inherited-tags
+	       org-agenda-hide-tags-regexp))
     (let* ((category (or category
 			 org-category
 			 (if buffer-file-name
@@ -4646,27 +4658,37 @@
 	'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-agenda-fix-displayed-tags (txt tags add-inherited hide-re)
+  "Remove tags string from TXT, and add a modified list of tags.
+The modified list may contain inherited tags, and tags matched by
+`org-agenda-hide-tags-regexp' will be removed."
+  (when (or add-inherited hide-re)
+    (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
+	(setq txt (substring txt 0 (match-beginning 0))))
+    (when tags
+      (setq tags
+	    (delq nil
+		  (mapcar (lambda (tg)
+			    (if (or (and hide-re (string-match hide-re tg))
+				    (and (not add-inherited)
+					 (get-text-property 0 'inherited tg)))
+				nil
+			      tg))
+			  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)))
@@ -5693,8 +5715,8 @@
     (if (and org-agenda-follow-mode m)
 	(org-agenda-show))
     (if (and m org-agenda-show-outline-path)
-	(message (org-with-point-at m
-		   (org-display-outline-path t))))))
+	(org-with-point-at m
+	  (org-display-outline-path t)))))
 
 (defun org-agenda-show-priority ()
   "Show the priority of the current item.
@@ -6662,32 +6684,38 @@
 
 (defun org-agenda-diary-entry-in-org-file ()
   "Make a diary entry in the file `org-agenda-diary-file'."
-  (let (d1 d2 char (text ""))
+  (let (d1 d2 char (text "") dp1 dp2)
     (if (equal (buffer-name) "*Calendar*")
 	(setq d1 (calendar-cursor-to-date t)
 	      d2 (car calendar-mark-ring))
-      (setq d1 (calendar-gregorian-from-absolute
-		(get-text-property (point) 'day))
-	    d2 (and (mark) (get-text-property (mark) 'day)
-		    (calendar-gregorian-from-absolute
-		     (get-text-property (mark) 'day)))))
+      (setq dp1 (get-text-property (point-at-bol) 'day))
+      (unless dp1 (error "No date defined in current line"))
+      (setq d1 (calendar-gregorian-from-absolute dp1)
+	    d2 (and (ignore-errors (mark))
+		    (save-excursion
+		      (goto-char (mark))
+		      (setq dp2 (get-text-property (point-at-bol) 'day)))
+		    (calendar-gregorian-from-absolute dp2))))
     (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
     (setq char (read-char-exclusive))
     (cond
      ((equal char ?d)
       (setq text (read-string "Day entry: "))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'day text d1)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?a)
       (setq d1 (list (car d1) (nth 1 d1)
 		     (read-number (format "Reference year [%d]: " (nth 2 d1))
 				  (nth 2 d1))))
       (setq text (read-string "Anniversary (use %d to show years): "))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'anniversary text d1)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?b)
       (setq text (read-string "Block entry: "))
       (unless (and d1 d2 (not (equal d1 d2)))
 	(error "No block of days selected"))
-      (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2))
+      (org-agenda-add-entry-to-org-agenda-diary-file 'block text d1 d2)
+      (and (equal (buffer-name) org-agenda-buffer-name) (org-agenda-redo)))
      ((equal char ?j)
       (org-switch-to-buffer-other-window
        (find-file-noselect org-agenda-diary-file))
@@ -6695,6 +6723,17 @@
       (org-reveal t))
      (t (error "Invalid selection character `%c'" char)))))
 
+(defcustom org-agenda-insert-diary-strategy 'date-tree
+  "Where in `org-agenda-diary-file' should new entries be added?
+Valid values:
+
+date-tree    in the date tree, as child of the date
+top-level    as top-level entries at the end of the file."
+  :group 'org-agenda
+  :type '(choice
+	  (const :tag "in a date tree" date-tree)
+	  (const :tag "as top level at end of file" top-level)))
+
 (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
   "Add a diary entry with TYPE to `org-agenda-diary-file'.
 If TEXT is not empty, it will become the headline of the new entry, and
@@ -6729,9 +6768,11 @@
 	(insert (format "%%%%(diary-anniversary %s) %s"
 			(calendar-date-string d1 nil t) text))))
      ((eq type 'day)
-      (require 'org-datetree)
-      (org-datetree-find-date-create d1)
-      (org-agenda-insert-diary-make-new-entry text)
+      (if (eq org-agenda-insert-diary-strategy 'top-level)
+	  (org-agenda-insert-diary-as-top-level text)
+	(require 'org-datetree)
+	(org-datetree-find-date-create d1)
+	(org-agenda-insert-diary-make-new-entry text))
       (org-insert-time-stamp (org-time-from-absolute
 			      (calendar-absolute-from-gregorian d1)))
       (end-of-line 0))
@@ -6739,9 +6780,11 @@
       (if (> (calendar-absolute-from-gregorian d1)
 	     (calendar-absolute-from-gregorian d2))
 	  (setq d1 (prog1 d2 (setq d2 d1))))
-      (require 'org-datetree)
-      (org-datetree-find-date-create d1)
-      (org-agenda-insert-diary-make-new-entry text)
+      (if (eq org-agenda-insert-diary-strategy 'top-level)
+	  (org-agenda-insert-diary-as-top-level text)
+	(require 'org-datetree)
+	(org-datetree-find-date-create d1)
+	(org-agenda-insert-diary-make-new-entry text))
       (org-insert-time-stamp (org-time-from-absolute
 			      (calendar-absolute-from-gregorian d1)))
       (insert "--")
@@ -6757,6 +6800,16 @@
       (org-reveal t)
       (message "Please finish entry here"))))
 
+(defun org-agenda-insert-diary-as-top-level (text)
+  "Make new entry as a top-level entry at the end of the file.
+Add TEXT as headline, and position the cursor in the second line so that
+a timestamp can be added there."
+  (widen)
+  (goto-char (point-max))
+  (or (bolp) (insert "\n"))
+  (insert "* " text "\n")
+  (if org-adapt-indentation (org-indent-to-column 2)))
+
 (defun org-agenda-insert-diary-make-new-entry (text)
   "Make new entry as last child of current entry.
 Add TEXT as headline, and position the cursor in the second line so that
--- a/lisp/org/org-archive.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-archive.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -443,6 +443,7 @@
   (interactive)
   (call-interactively org-archive-default-command))
 
+;;;###autoload
 (defun org-archive-subtree-default-with-confirmation ()
   "Archive the current subtree with the default command.
 This command is set with the variable `org-archive-default-command'."
--- a/lisp/org/org-ascii.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-ascii.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-attach.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-attach.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Keywords: org data task
-;; Version: 6.33c
+;; Version: 6.33x
 
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-bbdb.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-bbdb.el	Fri Nov 20 20:50:32 2009 +0000
@@ -7,7 +7,7 @@
 ;;         Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-bibtex.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-bibtex.el	Fri Nov 20 20:50:32 2009 +0000
@@ -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.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-clock.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-clock.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-colview.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-colview.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-compat.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-compat.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-crypt.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-crypt.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-crypt.el
-;; Version: 6.33c
+;; Version: 6.33x
 ;; Keywords: org-mode
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: Peter Jones <pjones@pmade.com>
--- a/lisp/org/org-datetree.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-datetree.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -101,7 +101,7 @@
 
 (defun org-datetree-find-day-create (year month day)
   (org-narrow-to-subtree)
-  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([01][0-9]\\)[ \t\n]" year month))
+  (let ((re (format "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\)[ \t\n]" year month))
 	match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
--- a/lisp/org/org-docbook.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-docbook.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-docbook.el
-;; Version: 6.33c
+;; Version: 6.33x
 ;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Keywords: org, wp, docbook
--- a/lisp/org/org-exp-blocks.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-exp-blocks.el	Fri Nov 20 20:50:32 2009 +0000
@@ -217,9 +217,15 @@
 element of headers, any additional elements of headers will be
 passed to the ditaa utility as command line arguments."
   (message "ditaa-formatting...")
-  (let ((out-file (if headers (car headers)))
-	(args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
-	(data-file (make-temp-file "org-ditaa")))
+  (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
+         (data-file (make-temp-file "org-ditaa"))
+         (hash (sha1 (prin1-to-string (list body args))))
+         (raw-out-file (if headers (car headers)))
+         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+                             (cons (match-string 1 raw-out-file)
+                                   (match-string 2 raw-out-file))
+                           (cons raw-out-file "png")))
+         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (unless (file-exists-p org-ditaa-jar-path)
       (error (format "Could not find ditaa.jar at %s" org-ditaa-jar-path)))
     (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body)
@@ -229,9 +235,21 @@
 			    "\n")))
     (cond
      ((or htmlp latexp docbookp)
-      (with-temp-file data-file (insert body))
-      (message (concat "java -jar " org-ditaa-jar-path " " args " " data-file " " out-file))
-      (shell-command (concat "java -jar " org-ditaa-jar-path " " args " " data-file " " out-file))
+      (unless (file-exists-p out-file)
+        (mapc ;; remove old hashed versions of this file
+         (lambda (file)
+           (when (and (string-match (concat (regexp-quote (car out-file-parts))
+                                            "_\\([[:alnum:]]+\\)\\."
+                                            (regexp-quote (cdr out-file-parts)))
+                                    file)
+                      (= (length (match-string 1 out-file)) 40))
+             (delete-file (expand-file-name file
+                                            (file-name-directory out-file)))))
+         (directory-files (or (file-name-directory out-file)
+                              default-directory)))
+        (with-temp-file data-file (insert body))
+        (message (concat "java -jar " org-ditaa-jar-path " " args " " data-file " " out-file))
+        (shell-command (concat "java -jar " org-ditaa-jar-path " " args " " data-file " " out-file)))
       (format "\n[[file:%s]]\n" out-file))
      (t (concat
 	 "\n#+BEGIN_EXAMPLE\n"
@@ -259,14 +277,32 @@
 }
 #+end_dot"
   (message "dot-formatting...")
-  (let ((out-file (if headers (car headers)))
-	(args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
-	(data-file (make-temp-file "org-ditaa")))
+  (let* ((args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
+         (data-file (make-temp-file "org-ditaa"))
+         (hash (sha1 (prin1-to-string (list body args))))
+         (raw-out-file (if headers (car headers)))
+         (out-file-parts (if (string-match "\\(.+\\)\\.\\([^\\.]+\\)$" raw-out-file)
+                             (cons (match-string 1 raw-out-file)
+                                   (match-string 2 raw-out-file))
+                           (cons raw-out-file "png")))
+         (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (cond
      ((or htmlp latexp docbookp)
-      (with-temp-file data-file (insert body))
-      (message (concat "dot " data-file " " args " -o " out-file))
-      (shell-command (concat "dot " data-file " " args " -o " out-file))
+      (unless (file-exists-p out-file)
+        (mapc ;; remove old hashed versions of this file
+         (lambda (file)
+           (when (and (string-match (concat (regexp-quote (car out-file-parts))
+                                            "_\\([[:alnum:]]+\\)\\."
+                                            (regexp-quote (cdr out-file-parts)))
+                                    file)
+                      (= (length (match-string 1 out-file)) 40))
+             (delete-file (expand-file-name file
+                                            (file-name-directory out-file)))))
+         (directory-files (or (file-name-directory out-file)
+                              default-directory)))
+        (with-temp-file data-file (insert body))
+        (message (concat "dot " data-file " " args " -o " out-file))
+        (shell-command (concat "dot " data-file " " args " -o " out-file)))
       (format "\n[[file:%s]]\n" out-file))
      (t (concat
 	 "\n#+BEGIN_EXAMPLE\n"
--- a/lisp/org/org-exp.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-exp.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-faces.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-faces.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -44,6 +44,7 @@
       (copy-face old-face new-face)
       (if (fboundp 'set-face-doc-string)
 	  (set-face-doc-string new-face docstring)))))
+(put 'org-copy-face 'lisp-indent-function 2)
 
 (defgroup org-faces nil
   "Faces in Org-mode."
@@ -468,6 +469,11 @@
   :group 'org-faces
   :version "22.1")
 
+(org-copy-face 'org-block 'org-quote
+   "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks.")
+(org-copy-face 'org-block 'org-verse
+   "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.")
+
 (defface org-clock-overlay ;; copied from secondary-selection
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light))
--- a/lisp/org/org-feed.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-feed.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-footnote.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-footnote.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-freemind.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-freemind.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -240,7 +240,7 @@
                       ;; file is utf-8:
                       ;;
                       ;; (format "&#x%x;" (- cc ;; ?\x800))
-                      (char-to-string cc)
+		      (format "&#x%x" (encode-char cc 'ucs))
                       ))))
     fm-str))
 
--- a/lisp/org/org-gnus.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-gnus.el	Fri Nov 20 20:50:32 2009 +0000
@@ -7,7 +7,7 @@
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-habit.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-habit.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -128,6 +128,7 @@
     (error "Invalid duration string: %s" ts)))
 
 (defun org-is-habit-p (&optional pom)
+  "Is the task at POM or point a habit?"
   (string= "habit" (org-entry-get (or pom (point)) "STYLE")))
 
 (defun org-habit-parse-todo (&optional pom)
--- a/lisp/org/org-html.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-html.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -229,7 +229,7 @@
   :type 'string)
 
 (defcustom org-export-html-home/up-format
-  "<div style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
+  "<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
  <a accesskey=\"h\" href=\"%s\"> UP </a>
  |
  <a accesskey=\"H\" href=\"%s\"> HOME </a>
@@ -753,7 +753,6 @@
 <html xmlns=\"http://www.w3.org/1999/xhtml\"
 lang=\"%s\" xml:lang=\"%s\">
 <head>
-%s
 <title>%s</title>
 <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
 <meta name=\"generator\" content=\"Org-mode\"/>
@@ -765,6 +764,7 @@
 </head>
 <body>
 <div id=\"content\">
+%s
 "
 		 (format
 		  (or (and (stringp org-export-html-xml-declaration)
@@ -775,17 +775,17 @@
 		      "")
 		  (or charset "iso-8859-1"))
 		 language language
+		 (org-html-expand title)
+		 (or charset "iso-8859-1")
+		 date author description keywords
+		 style
 		 (if (or link-up link-home)
 		     (concat
 		      (format org-export-html-home/up-format
 			      (or link-up link-home)
 			      (or link-home link-up))
 		      "\n")
-		   "")
-		 (org-html-expand title)
-		 (or charset "iso-8859-1")
-		 date author description keywords
-		 style))
+		   "")))
 
         (org-export-html-insert-plist-item opt-plist :preamble opt-plist)
 
--- a/lisp/org/org-icalendar.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-icalendar.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-id.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-id.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-indent.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-indent.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -106,8 +106,8 @@
   ;; Initialize the indentation and star vectors
   (setq org-indent-strings (make-vector (1+ org-indent-max) nil))
   (setq org-indent-stars (make-vector (1+ org-indent-max) nil))
-  (aset org-indent-strings 0 "")
-  (aset org-indent-stars 0 "")
+  (aset org-indent-strings 0 nil)
+  (aset org-indent-stars 0 nil)
   (loop for i from 1 to org-indent-max do
 	(aset org-indent-strings i
 	      (org-add-props
--- a/lisp/org/org-info.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-info.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-inlinetask.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-inlinetask.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/org/org-irc.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-irc.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Philip Jackson <emacs@shellarchive.co.uk>
 ;; Keywords: erc, irc, link, org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-jsinfo.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-jsinfo.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-latex.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-latex.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-latex.el
-;; Version: 6.33c
+;; Version: 6.33x
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;; Keywords: org, wp, tex
@@ -256,15 +256,6 @@
   :group 'org-export-latex
   :type 'boolean)
 
-(defcustom org-export-latex-packages-alist nil
-  "Alist of packages to be inserted in the header.
-Each cell is of the format \( \"option\" . \"package\" \)."
-  :group 'org-export-latex
-  :type '(repeat
-	  (list
-	   (string :tag "option")
-	   (string :tag "package"))))
-
 (defcustom org-export-latex-low-levels 'itemize
   "How to convert sections below the current level of sectioning.
 This is specified by the `org-export-headline-levels' option or the
@@ -1465,7 +1456,7 @@
   "Convert fontification to LaTeX."
   (goto-char (point-min))
   (while (re-search-forward org-emph-re nil t)
-    ;; The match goes one char after the *string*
+    ;; The match goes one char after the *string*, except at the end of a line
     (let ((emph (assoc (match-string 3)
 		       org-export-latex-emphasis-alist))
 	  (beg (match-beginning 0))
@@ -1491,7 +1482,7 @@
 	(if (caddr emph)
 	    (setq rpl (org-export-latex-protect-string rpl))
 	  (save-match-data
-	    (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).\\'" rpl)
+	    (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
 		(progn
 		  (add-text-properties (match-beginning 1) (match-end 1)
 				       '(org-protected t) rpl)
@@ -1824,7 +1815,8 @@
 	   (save-excursion
 	     (if (not (re-search-forward (concat "^" (regexp-quote foot-prefix))
 					 nil t))
-		 (replace-match "$^{\\1}$")
+		 (replace-match (org-export-latex-protect-string
+				 (concat "$^{" (match-string 1) "}$")))
 	       (replace-match "")
 	       (let ((end (save-excursion
 			    (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
--- a/lisp/org/org-list.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-list.el	Fri Nov 20 20:50:32 2009 +0000
@@ -7,7 +7,7 @@
 ;;	   Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-mac-message.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-mac-message.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <johnw@gnu.org>
 ;;         Christopher Suckling <suckling at gmail dot com>
 
-;; Version: 6.33c
+;; Version: 6.33x
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
--- a/lisp/org/org-macs.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-macs.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-mew.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-mew.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/org/org-mhe.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-mhe.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-mobile.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-mobile.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-mouse.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-mouse.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-plot.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-plot.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Keywords: tables, plotting
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-protocol.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-protocol.el	Fri Nov 20 20:50:32 2009 +0000
@@ -9,7 +9,7 @@
 ;; Author: Ross Patterson <me AT rpatterson DOT net>
 ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
 ;; Keywords: org, emacsclient, wp
-;; Version: 6.33c
+;; Version: 6.33x
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -185,6 +185,8 @@
                        Last slash required.
   :working-directory - the local working directory. This is, what base-url will
                        be replaced with.
+  :redirects         - A list of cons cells, each of which maps a regular
+                       expression to match to a path relative to :working-directory.
 
 Example:
 
@@ -198,7 +200,12 @@
           :online-suffix \".html\"
           :working-suffix \".org\"
           :base-url \"http://localhost/org/\"
-          :working-directory \"/home/user/org/\")))
+          :working-directory \"/home/user/org/\"
+          :rewrites ((\"org/?$\" . \"index.php\")))))
+
+   The last line tells `org-protocol-open-source' to open
+   /home/user/org/index.php, if the URL cannot be mapped to an existing
+   file, and ends with either \"org\" or \"org/\".
 
 Consider using the interactive functions `org-protocol-create' and
 `org-protocol-create-for-org' to help you filling this variable with valid contents."
@@ -504,10 +511,35 @@
             (let* ((wdir (plist-get (cdr prolist) :working-directory))
                    (strip-suffix (plist-get (cdr prolist) :online-suffix))
                    (add-suffix (plist-get (cdr prolist) :working-suffix))
-                   (start-pos (+ (string-match wsearch f) (length base-url)))
+		   ;; Strip "[?#].*$" if `f' is a redirect with another
+		   ;; ending than strip-suffix here:
+		   (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f)))
+                   (start-pos (+ (string-match wsearch f1) (length base-url)))
                    (end-pos (string-match
-                             (concat (regexp-quote strip-suffix) "\\([?#].*\\)?$") f))
-                   (the-file (concat wdir (substring f start-pos end-pos) add-suffix)))
+			     (regexp-quote strip-suffix) f1))
+		   ;; We have to compare redirects without suffix below:
+		   (f2 (concat wdir (substring f1 start-pos end-pos)))
+                   (the-file (concat f2 add-suffix)))
+
+	      ;; Note: the-file may still contain `%C3' et al here because browsers
+	      ;; tend to encode `&auml;' in URLs to `%25C3' - `%25' being `%'.
+	      ;; So the results may vary.
+
+	      ;; -- start redirects --
+	      (unless (file-exists-p the-file)
+		(message "File %s does not exist.\nTesting for rewritten URLs." the-file)
+		(let ((rewrites (plist-get (cdr prolist) :rewrites)))
+		  (when rewrites
+		    (message "Rewrites found: %S" rewrites)
+		    (mapc
+		     (lambda (rewrite)
+		       "Try to match a rewritten URL and map it to a real file."
+		       ;; Compare redirects without suffix:
+		       (if (string-match (car rewrite) f2)
+			   (throw 'result (concat wdir (cdr rewrite)))))
+		     rewrites))))
+	      ;; -- end of redirects --
+
               (if (file-readable-p the-file)
                   (throw 'result the-file))
               (if (file-exists-p the-file)
@@ -596,7 +628,7 @@
   "Create a new org-protocol project interactively.
 An org-protocol project is an entry in `org-protocol-project-alist'
 which is used by `org-protocol-open-source'.
-Optionally use project-plist to initialize the defaults for this worglet. If
+Optionally use project-plist to initialize the defaults for this project. If
 project-plist is the CDR of an element in `org-publish-project-alist', reuse
 :base-directory, :html-extension and :base-extension."
   (interactive)
@@ -632,7 +664,7 @@
            (concat "Extension of editable files ("working-suffix"): ")
                    working-suffix nil working-suffix t))
 
-    (when (yes-or-no-p "Save the new worglet to your init file? ")
+    (when (yes-or-no-p "Save the new org-protocol-project to your init file? ")
       (setq org-protocol-project-alist
             (cons `(,base-url . (:base-url ,base-url
                                  :working-directory ,working-dir
--- a/lisp/org/org-publish.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-publish.el	Fri Nov 20 20:50:32 2009 +0000
@@ -4,7 +4,7 @@
 ;; Author: David O'Toole <dto@gnu.org>
 ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.33c
+;; Version: 6.33x
 
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-remember.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-remember.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-rmail.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-rmail.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-src.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-src.el	Fri Nov 20 20:50:32 2009 +0000
@@ -8,7 +8,7 @@
 ;;         Dan Davison <davison at stats dot ox dot ac dot uk>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-table.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-table.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-timer.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-timer.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-vm.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-vm.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-w3m.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-w3m.el	Fri Nov 20 20:50:32 2009 +0000
@@ -5,7 +5,7 @@
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org-wl.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-wl.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -91,7 +91,11 @@
 		 wl-summary-buffer-elmo-folder msgnum)
 	      (elmo-msgdb-overview-get-entity
 	       msgnum (wl-summary-buffer-msgdb))))
-	   (from (wl-summary-line-from))
+	   (from (let ((from-field (elmo-message-entity-field wl-message-entity
+							      'from)))
+		   (if (listp from-field)
+		       (car from-field)
+		     from-field)))
 	   (to (let ((to-field (elmo-message-entity-field wl-message-entity
 							  'to)))
 		 (if (listp to-field)
--- a/lisp/org/org-xoxo.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org-xoxo.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
--- a/lisp/org/org.el	Fri Nov 20 18:09:29 2009 +0000
+++ b/lisp/org/org.el	Fri Nov 20 20:50:32 2009 +0000
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33c
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -95,7 +95,7 @@
 
 ;;; Version
 
-(defconst org-version "6.33c"
+(defconst org-version "6.33x"
   "The version number of the file org.el.")
 
 (defun org-version (&optional here)
@@ -2858,6 +2858,17 @@
   :group 'org-latex
   :type 'string)
 
+;; The following variable is defined here because is it also used
+;; when formatting latex fragments.  Originally it was part of the
+;; LaTeX exporter, which is why the name includes "export".
+(defcustom org-export-latex-packages-alist nil
+  "Alist of packages to be inserted in the header.
+Each cell is of the format \( \"option\" . \"package\" \)."
+  :group 'org-export-latex
+  :type '(repeat
+	  (list
+	   (string :tag "option")
+	   (string :tag "package"))))
 
 (defgroup org-font-lock nil
   "Font-lock settings for highlighting in Org-mode."
@@ -3550,7 +3561,9 @@
 (eval-and-compile
   (org-autoload "org-archive"
    '(org-add-archive-files org-archive-subtree
-     org-archive-to-archive-sibling org-toggle-archive-tag)))
+     org-archive-to-archive-sibling org-toggle-archive-tag
+     org-archive-subtree-default
+     org-archive-subtree-default-with-confirmation)))
 
 ;; Autoload Column View Code
 
@@ -4507,6 +4520,7 @@
 		nil
 	      (add-text-properties (match-beginning 0) (match-end 0)
 				   (list 'mouse-face 'highlight
+					 'face 'org-link
 					 'keymap org-mouse-map))
 	      (org-rear-nonsticky-at (match-end 0)))
 	    t)))))
@@ -4529,7 +4543,7 @@
 	      (beg1 (line-beginning-position 2))
 	      (dc1 (downcase (match-string 2)))
 	      (dc3 (downcase (match-string 3)))
-	      end end1 quoting)
+	      end end1 quoting block-type)
 	  (cond
 	   ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
 	    ;; a single line of backend-specific content
@@ -4543,8 +4557,8 @@
 	    t)
 	   ((and (match-end 4) (equal dc3 "begin"))
 	    ;; Truely a block
-	    (setq quoting (member (downcase (match-string 5))
-				  org-protecting-blocks))
+	    (setq block-type (downcase (match-string 5))
+		  quoting (member block-type org-protecting-blocks))
 	    (when (re-search-forward
 		   (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
 		   nil t)  ;; on purpose, we look further than LIMIT
@@ -4557,8 +4571,13 @@
 	       '(font-lock-fontified t font-lock-multiline t))
 	      (add-text-properties beg beg1 '(face org-meta-line))
 	      (add-text-properties end1 end '(face org-meta-line))
-	      (when quoting
+	      (cond
+	       (quoting
 		(add-text-properties beg1 end1 '(face org-block)))
+	       ((string= block-type "quote")
+		(add-text-properties beg1 end1 '(face org-quote)))
+	       ((string= block-type "verse")
+		(add-text-properties beg1 end1 '(face org-verse))))
 	      t))
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented
@@ -4887,7 +4906,7 @@
 	   ;; Links
 	   (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
 	   (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
-	   (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
+	   (if (memq 'plain lk) '(org-activate-plain-links))
 	   (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
 	   (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
 	   (if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
@@ -5413,19 +5432,6 @@
      ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
      ((eq state 'subtree)  (or (org-subtree-end-visible-p) (recenter 1))))))
 
-;; FIXME: no longer in use
-(defun org-compact-display-after-subtree-move ()
-  "Show a compacter version of the tree of the entry's parent."
-  (save-excursion
-    (if (org-up-heading-safe)
-	(progn
-	  (hide-subtree)
-	  (show-entry)
-	  (show-children)
-	  (org-cycle-show-empty-lines 'children)
-	  (org-cycle-hide-drawers 'children))
-      (org-overview))))
-
 (defun org-remove-empty-overlays-at (pos)
   "Remove outline overlays that do not contain non-white stuff."
   (mapc
@@ -6855,7 +6861,9 @@
      ((org-at-item-p)
       ;; we will sort this plain list
       (org-beginning-of-item-list) (setq start (point))
-      (org-end-of-item-list) (setq end (point))
+      (org-end-of-item-list)
+      (or (bolp) (insert "\n"))
+      (setq end (point))
       (goto-char start)
       (setq plain-list-p t
 	    what "plain list"))
@@ -6865,6 +6873,7 @@
       (org-back-to-heading)
       (setq start (point)
 	    end (progn (org-end-of-subtree t t)
+		       (or (bolp) (insert "\n"))
 		       (org-back-over-empty-lines)
 		       (point))
 	    what "children")
@@ -6875,7 +6884,15 @@
       ;; we will sort the top-level entries in this file
       (goto-char (point-min))
       (or (org-on-heading-p) (outline-next-heading))
-      (setq start (point) end (point-max) what "top-level")
+      (setq start (point))
+      (goto-char (point-max))
+      (beginning-of-line 1)
+      (when (looking-at ".*?\\S-")
+	;; File ends in a non-white line
+	(end-of-line 1)
+	(insert "\n"))
+      (setq end (point-max))
+      (setq what "top-level")
       (goto-char start)
       (show-all)))
 
@@ -7703,6 +7720,10 @@
   "Make a link with brackets, consisting of LINK and DESCRIPTION."
   (unless (string-match "\\S-" link)
     (error "Empty link"))
+  (when (and description
+	     (stringp description)
+	     (not (string-match "\\S-" description)))
+    (setq description nil))
   (when (stringp description)
     ;; Remove brackets from the description, they are fatal.
     (while (string-match "\\[" description)
@@ -9006,10 +9027,12 @@
 	  (aset org-olpa level heading)))
     (let (rtn)
       (save-excursion
-	(while (org-up-heading-safe)
-	  (when (looking-at org-complex-heading-regexp)
-	    (push (org-match-string-no-properties 4) rtn)))
-	rtn))))
+	(save-restriction
+	  (widen)
+	  (while (org-up-heading-safe)
+	    (when (looking-at org-complex-heading-regexp)
+	      (push (org-match-string-no-properties 4) rtn)))
+	  rtn)))))
 
 (defun org-format-outline-path (path &optional width prefix)
   "Format the outlie path PATH for display.
@@ -9059,7 +9082,8 @@
 				     (org-back-to-heading t)
 				     (if (looking-at org-complex-heading-regexp)
 					 (list (match-string 4)))))))
-    (message (org-format-outline-path
+    (message "%s"
+	     (org-format-outline-path
 	      path
 	      (1- (frame-width))
 	      (and file bfn (concat (file-name-nondirectory bfn) "/"))))))
@@ -12219,11 +12243,11 @@
 		  (if (equal rpl 0) (setq rpl 10))
 		  (if (and (> rpl 0) (<= rpl (length allowed)))
 		      (car (nth (1- rpl) allowed))
-		    (org-completing-read "Value: " allowed nil))))
+		    (org-completing-read "Effort: " allowed nil))))
 	       (t
 		(let (org-completion-use-ido org-completion-use-iswitchb)
 		  (org-completing-read
-		   (concat "Value " (if (and cur (string-match "\\S-" cur))
+		   (concat "Effort " (if (and cur (string-match "\\S-" cur))
 					(concat "[" cur "]") "")
 			   ": ")
 		   existing nil nil "" nil cur))))))
@@ -13122,7 +13146,7 @@
             deltadef (nth 2 delta)))
 
     ;; Check if there is an iso week date in there
-    ;; If yes, sore the info and postpone interpreting it until the rest
+    ;; If yes, store the info and postpone interpreting it until the rest
     ;; of the parsing is done
     (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans)
       (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans))))
@@ -14561,15 +14585,9 @@
 	 (opt org-format-latex-options)
 	 (matchers (plist-get opt :matchers))
 	 (re-list org-latex-regexps)
-	 (cnt 0) txt link beg end re e checkdir
+	 (cnt 0) txt hash link beg end re e checkdir
 	 executables-checked
 	 m n block linkfile movefile ov)
-    ;; Check if there are old images files with this prefix, and remove them
-    (when (file-directory-p todir)
-      (mapc 'delete-file
-	    (directory-files
-	     todir 'full
-	     (concat (regexp-quote prefixnodir) "_[0-9]+\\.png$"))))
     ;; Check the different regular expressions
     (while (setq e (pop re-list))
       (setq m (car e) re (nth 1 e) n (nth 2 e)
@@ -14587,9 +14605,15 @@
 	    (setq txt (match-string n)
 		  beg (match-beginning n) end (match-end n)
 		  cnt (1+ cnt)
-		  linkfile (format "%s_%04d.png" prefix cnt)
-		  movefile (format "%s_%04d.png" absprefix cnt)
 		  link (concat block "[[file:" linkfile "]]" block))
+	    (let (print-length print-level) ; make sure full list is printed
+	      (setq hash (sha1 (prin1-to-string
+				(list org-format-latex-header
+				      org-export-latex-packages-alist
+				      org-format-latex-options
+				      forbuffer txt)))
+		    linkfile (format "%s_%s.png" prefix hash)
+		    movefile (format "%s_%s.png" absprefix hash)))
 	    (if msg (message msg cnt))
 	    (goto-char beg)
 	    (unless checkdir ; make sure the directory exists
@@ -14603,8 +14627,9 @@
 	       "dvipng" "needed to convert LaTeX fragments to images")
 	      (setq executables-checked t))
 
-	    (org-create-formula-image
-	     txt movefile opt forbuffer)
+            (unless (file-exists-p movefile)
+              (org-create-formula-image
+               txt movefile opt forbuffer))
 	    (if overlays
 		(progn
 		  (mapc (lambda (o)
@@ -14628,7 +14653,6 @@
 	      (delete-region beg end)
 	      (insert link))))))))
 
-(defvar org-export-latex-packages-alist) ;; defined in org-latex.el
 ;; This function borrows from Ganesh Swami's latex2png.el
 (defun org-create-formula-image (string tofile options buffer)
   "This calls dvipng."
@@ -14936,7 +14960,6 @@
     ("Agenda Views etc")
     ("v" . org-agenda)
     ("/" . org-sparse-tree)
-    ("/" . org-sparse-tree)
     ("Misc")
     ("o" . org-open-at-point)
     ("?" . org-speed-command-help)
@@ -16656,7 +16679,12 @@
 	(add-to-list 'files f 'append)
 	(add-to-list 'tnames (file-truename f) 'append)))
     (multi-occur
-     (mapcar (lambda (x) (or (get-file-buffer x) (find-file-noselect x))) files)
+     (mapcar (lambda (x)
+	       (with-current-buffer
+		   (or (get-file-buffer x) (find-file-noselect x))
+		 (widen)
+		 (current-buffer)))
+	     files)
      regexp)))
 
 (if (boundp 'occur-mode-find-occurrence-hook)