comparison lisp/org/org-protocol.el @ 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 b92e7ae35c75
children 1d1d5d9bd884
comparison
equal deleted inserted replaced
106167:c898329ba7ba 106168:83924fb4f59c
7 ;; Author: Daniel M German <dmg AT uvic DOT org> 7 ;; Author: Daniel M German <dmg AT uvic DOT org>
8 ;; Author: Sebastian Rose <sebastian_rose AT gmx DOT de> 8 ;; Author: Sebastian Rose <sebastian_rose AT gmx DOT de>
9 ;; Author: Ross Patterson <me AT rpatterson DOT net> 9 ;; Author: Ross Patterson <me AT rpatterson DOT net>
10 ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> 10 ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
11 ;; Keywords: org, emacsclient, wp 11 ;; Keywords: org, emacsclient, wp
12 ;; Version: 6.33c 12 ;; Version: 6.33x
13 13
14 ;; This file is part of GNU Emacs. 14 ;; This file is part of GNU Emacs.
15 ;; 15 ;;
16 ;; GNU Emacs is free software: you can redistribute it and/or modify 16 ;; GNU Emacs is free software: you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by 17 ;; it under the terms of the GNU General Public License as published by
183 :working-suffix - the replacement for online-suffix 183 :working-suffix - the replacement for online-suffix
184 :base-url - the base URL, e.g. http://www.example.com/project/ 184 :base-url - the base URL, e.g. http://www.example.com/project/
185 Last slash required. 185 Last slash required.
186 :working-directory - the local working directory. This is, what base-url will 186 :working-directory - the local working directory. This is, what base-url will
187 be replaced with. 187 be replaced with.
188 :redirects - A list of cons cells, each of which maps a regular
189 expression to match to a path relative to :working-directory.
188 190
189 Example: 191 Example:
190 192
191 (setq org-protocol-project-alist 193 (setq org-protocol-project-alist
192 '((\"http://orgmode.org/worg/\" 194 '((\"http://orgmode.org/worg/\"
196 :working-directory \"/home/user/org/Worg/\") 198 :working-directory \"/home/user/org/Worg/\")
197 (\"http://localhost/org-notes/\" 199 (\"http://localhost/org-notes/\"
198 :online-suffix \".html\" 200 :online-suffix \".html\"
199 :working-suffix \".org\" 201 :working-suffix \".org\"
200 :base-url \"http://localhost/org/\" 202 :base-url \"http://localhost/org/\"
201 :working-directory \"/home/user/org/\"))) 203 :working-directory \"/home/user/org/\"
204 :rewrites ((\"org/?$\" . \"index.php\")))))
205
206 The last line tells `org-protocol-open-source' to open
207 /home/user/org/index.php, if the URL cannot be mapped to an existing
208 file, and ends with either \"org\" or \"org/\".
202 209
203 Consider using the interactive functions `org-protocol-create' and 210 Consider using the interactive functions `org-protocol-create' and
204 `org-protocol-create-for-org' to help you filling this variable with valid contents." 211 `org-protocol-create-for-org' to help you filling this variable with valid contents."
205 :group 'org-protocol 212 :group 'org-protocol
206 :type 'alist) 213 :type 'alist)
502 509
503 (when (string-match wsearch f) 510 (when (string-match wsearch f)
504 (let* ((wdir (plist-get (cdr prolist) :working-directory)) 511 (let* ((wdir (plist-get (cdr prolist) :working-directory))
505 (strip-suffix (plist-get (cdr prolist) :online-suffix)) 512 (strip-suffix (plist-get (cdr prolist) :online-suffix))
506 (add-suffix (plist-get (cdr prolist) :working-suffix)) 513 (add-suffix (plist-get (cdr prolist) :working-suffix))
507 (start-pos (+ (string-match wsearch f) (length base-url))) 514 ;; Strip "[?#].*$" if `f' is a redirect with another
515 ;; ending than strip-suffix here:
516 (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f)))
517 (start-pos (+ (string-match wsearch f1) (length base-url)))
508 (end-pos (string-match 518 (end-pos (string-match
509 (concat (regexp-quote strip-suffix) "\\([?#].*\\)?$") f)) 519 (regexp-quote strip-suffix) f1))
510 (the-file (concat wdir (substring f start-pos end-pos) add-suffix))) 520 ;; We have to compare redirects without suffix below:
521 (f2 (concat wdir (substring f1 start-pos end-pos)))
522 (the-file (concat f2 add-suffix)))
523
524 ;; Note: the-file may still contain `%C3' et al here because browsers
525 ;; tend to encode `&auml;' in URLs to `%25C3' - `%25' being `%'.
526 ;; So the results may vary.
527
528 ;; -- start redirects --
529 (unless (file-exists-p the-file)
530 (message "File %s does not exist.\nTesting for rewritten URLs." the-file)
531 (let ((rewrites (plist-get (cdr prolist) :rewrites)))
532 (when rewrites
533 (message "Rewrites found: %S" rewrites)
534 (mapc
535 (lambda (rewrite)
536 "Try to match a rewritten URL and map it to a real file."
537 ;; Compare redirects without suffix:
538 (if (string-match (car rewrite) f2)
539 (throw 'result (concat wdir (cdr rewrite)))))
540 rewrites))))
541 ;; -- end of redirects --
542
511 (if (file-readable-p the-file) 543 (if (file-readable-p the-file)
512 (throw 'result the-file)) 544 (throw 'result the-file))
513 (if (file-exists-p the-file) 545 (if (file-exists-p the-file)
514 (message "%s: permission denied!" the-file) 546 (message "%s: permission denied!" the-file)
515 (message "%s: no such file or directory." the-file)))))) 547 (message "%s: no such file or directory." the-file))))))
594 626
595 (defun org-protocol-create(&optional project-plist) 627 (defun org-protocol-create(&optional project-plist)
596 "Create a new org-protocol project interactively. 628 "Create a new org-protocol project interactively.
597 An org-protocol project is an entry in `org-protocol-project-alist' 629 An org-protocol project is an entry in `org-protocol-project-alist'
598 which is used by `org-protocol-open-source'. 630 which is used by `org-protocol-open-source'.
599 Optionally use project-plist to initialize the defaults for this worglet. If 631 Optionally use project-plist to initialize the defaults for this project. If
600 project-plist is the CDR of an element in `org-publish-project-alist', reuse 632 project-plist is the CDR of an element in `org-publish-project-alist', reuse
601 :base-directory, :html-extension and :base-extension." 633 :base-directory, :html-extension and :base-extension."
602 (interactive) 634 (interactive)
603 (let ((working-dir (expand-file-name(or (plist-get project-plist :base-directory) default-directory))) 635 (let ((working-dir (expand-file-name(or (plist-get project-plist :base-directory) default-directory)))
604 (base-url "http://orgmode.org/worg/") 636 (base-url "http://orgmode.org/worg/")
630 (setq working-suffix 662 (setq working-suffix
631 (read-string 663 (read-string
632 (concat "Extension of editable files ("working-suffix"): ") 664 (concat "Extension of editable files ("working-suffix"): ")
633 working-suffix nil working-suffix t)) 665 working-suffix nil working-suffix t))
634 666
635 (when (yes-or-no-p "Save the new worglet to your init file? ") 667 (when (yes-or-no-p "Save the new org-protocol-project to your init file? ")
636 (setq org-protocol-project-alist 668 (setq org-protocol-project-alist
637 (cons `(,base-url . (:base-url ,base-url 669 (cons `(,base-url . (:base-url ,base-url
638 :working-directory ,working-dir 670 :working-directory ,working-dir
639 :online-suffix ,strip-suffix 671 :online-suffix ,strip-suffix
640 :working-suffix ,working-suffix)) 672 :working-suffix ,working-suffix))