summaryrefslogtreecommitdiff
path: root/lisp/org/org-protocol.el
diff options
context:
space:
mode:
authorCarsten Dominik <dominik@science.uva.nl>2009-11-20 20:54:05 +0000
committerCarsten Dominik <dominik@science.uva.nl>2009-11-20 20:54:05 +0000
commit5dec95551def9b6bf1891dd5e56505e9a1851f79 (patch)
tree194bb13f8c36dfc20c6e6a17253fbb481f4d430c /lisp/org/org-protocol.el
parenta9b76eec39a74a626f12a64522e2e8743fe0701b (diff)
downloademacs-5dec95551def9b6bf1891dd5e56505e9a1851f79.tar.gz
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.
Diffstat (limited to 'lisp/org/org-protocol.el')
-rw-r--r--lisp/org/org-protocol.el46
1 files changed, 39 insertions, 7 deletions
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index 0832bd1f59f..bb60d4ffec3 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -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 @@ Possible properties are:
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 @@ Example:
: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 @@ The location for a browser's bookmark should look like this:
(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 @@ most of the work."
"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 @@ project-plist is the CDR of an element in `org-publish-project-alist', reuse
(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