annotate lisp/org/org-mac-message.el @ 100448:cea079b68b76

2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-refile): Avoid refiling to within the region to be refiled. * org-export-latex.el (org-export-latex-special-chars): Replace special characters also in tables. * org-agenda.el (org-agenda-change-all-lines): New argument FORCE-TAGS. (org-agenda-set-tags): Cet the new tags and pas them to `org-format-agenda-item'. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-export-latex.el (org-export-latex-classes): Add longable as a default package to all classes. (org-export-latex-tables): Handle the longtable attribute and the align attribute. * org-table.el (orgtbl-to-generic): Handle tables that start with a hline. * org-export-latex.el (org-export-latex-emphasis-alist): Switch to \verb for colde-like snippets. (org-export-as-latex): Fix issues with region export. * org.el (org-up-heading-safe): Speed up function by using a direct regexp search. (org-olpa): New variable. (org-get-outline-path): Speed-up path constructions in cases where this is possible because the entire hierarchy is scanned anyway. (org-refile-get-location): Don't compare the truenames of files, this is too slow. (org-goto-max-level): New option. (org-goto): Use `org-goto-max-level'. 2008-12-16 Tassilo Horn <tassilo@member.fsf.org> * org-gnus.el (org-gnus-article-link, org-gnus-article-link): Strip angle brackets from message-ids in the former and don't do it in the latter. (org-gnus-follow-link): Open summary reliable, even if the last messages were deleted, and handle empty groups, too. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-export-latex.el (org-export-latex-emphasis-alist): Use \verb instead of \texttt for the =...= and ~===~ emphasis environments. (org-export-as-latex): Remove any old :org-license-to-kill text properties. (org-export-as-latex): Pass RBEG to `org-export-latex-first-lines'. (org-export-latex-make-header): Add some hard space after the table of contents. (org-export-latex-first-lines): Accept RBEG argument. Mark exported text so that it will be excuded in further steps. * org-table.el (org-table-get-specials): Make @0 reference the last line in a table. (org-table-recalculate): Improve docstring. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-log-done): Fix docstring. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-html-format-image): Fix bugs. * org-export-latex.el (org-export-latex-tables) (org-export-latex-links): Implement attribute, label, and caption handling. * org-exp.el (org-export-html-style-default): Add style definitions for the figure div. (org-export-preprocess-string, org-export-as-html): Implement attribute, label, and caption handling. (org-export-attach-captions-and-attributes): New function. (org-export-html-format-image): New function. (org-format-org-table-html): Implement attribute, label, and caption handling. * org.el (org-find-text-property-in-string): New function. (org-extract-attributes): Use the property org-attr instead of org-attrobutes, because this property is now set with the #+ATTR lines. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-compat.el (org-substring-no-properties): Fix for XEmacs, for the case that FROM is nil. * org.el (org-before-first-heading-p): New function. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-html): Do not add a space before enforces line breaks. (org-export-as-html): Close paragraph before blockquote and verse tags. 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> * org-id.el (org-id-locations-file): Wrap file name with `convert-standard-filename'. (org-id-files): New variable. (org-id-use-hash): New option. (org-id-update-id-locations): Also search in all files current listed in `org-id-files'. Convert the resulting alist to a hash if the user customation says so. (org-id-locations-save): Handle he case if `org-id-locations' is a hash. (org-id-locations-load): Convert the alist to a hash. (org-id-add-location): Handle the hast case. (kill-emacs-hook): Make sure id locations are saved when Emacs is exited. (org-id-hash-to-alist, org-id-alist-to-hash) (org-id-paste-tracker): New functions.
author Carsten Dominik <dominik@science.uva.nl>
date Tue, 16 Dec 2008 13:28:37 +0000
parents c851df8e004e
children ba23e35d3eaf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
94414
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
1 ;;; org-mac-message.el --- Support for links to Apple Mail messages from within Org-mode
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
3 ;; Copyright (C) 2008 Free Software Foundation, Inc.
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5 ;; Author: John Wiegley <johnw@gnu.org>
100448
cea079b68b76 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100267
diff changeset
6 ;; Version: 6.15a
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
7 ;; Keywords: outlines, hypermedia, calendar, wp
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
8
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
10
94676
ba3167bc4143 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94414
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94676
ba3167bc4143 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94414
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
ba3167bc4143 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94414
diff changeset
14 ;; (at your option) any later version.
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
15
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
19 ;; GNU General Public License for more details.
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
20
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94676
ba3167bc4143 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94414
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
23
94414
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
24 ;;; Commentary:
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
25 ;; This file implements links to Apple Mail messages from within Org-mode.
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
26 ;; Org-mode does not load this module by default - if you would actually like
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
27 ;; this to happen then configure the variable `org-modules'.
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
28
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
29 ;;; Code:
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
30
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
31 (require 'org)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
32
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
33 (org-add-link-type "message" 'org-mac-message-open)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
34
97419
62b35141dda8 (do-applescript): Fix declaration.
Glenn Morris <rgm@gnu.org>
parents: 97027
diff changeset
35 ;; In mac.c, removed in Emacs 23.
97420
7ce04d4bafc3 Fix previous change.
Glenn Morris <rgm@gnu.org>
parents: 97419
diff changeset
36 (declare-function do-applescript "org-mac-message" (script))
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
37 (unless (fboundp 'do-applescript)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
38 ;; Need to fake this using shell-command-to-string
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
39 (defun do-applescript (script)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
40 (let (start cmd return)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
41 (while (string-match "\n" script)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
42 (setq script (replace-match "\r" t t script)))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
43 (while (string-match "'" script start)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
44 (setq start (+ 2 (match-beginning 0))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
45 script (replace-match "\\'" t t script)))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
46 (setq cmd (concat "osascript -e '" script "'"))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
47 (setq return (shell-command-to-string cmd))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
48 (concat "\"" (org-trim return) "\""))))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
49
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
50 (defun org-mac-message-open (message-id)
94414
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
51 "Visit the message with the given MESSAGE-ID.
d86cb59eea9f 2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 93141
diff changeset
52 This will use the command `open' with the message URL."
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
53 (start-process (concat "open message:" message-id) nil
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
54 "open" (concat "message://<" (substring message-id 2) ">")))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
55
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
56 (defun org-mac-message-insert-link ()
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
57 "Insert a link to the messages currently selected in Apple Mail.
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
58 This will use applescript to get the message-id and the subject of the
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
59 active mail in AppleMail and make a link out of it."
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
60 (interactive)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
61 (insert (org-mac-message-get-link)))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
62
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
63 (defun org-mac-message-get-link ()
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
64 "Insert a link to the messages currently selected in Apple Mail.
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
65 This will use applescript to get the message-id and the subject of the
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
66 active mail in AppleMail and make a link out of it."
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
67 (let ((subject (do-applescript "tell application \"Mail\"
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
68 set theMessages to selection
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
69 subject of beginning of theMessages
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
70 end tell"))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
71 (message-id (do-applescript "tell application \"Mail\"
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
72 set theMessages to selection
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
73 message id of beginning of theMessages
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
74 end tell")))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
75 (org-make-link-string
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
76 (concat "message://"
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
77 (substring message-id 1 (1- (length message-id))))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
78 (substring subject 1 (1- (length subject))))))
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
79
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
80 (provide 'org-mac-message)
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
81
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
82 ;; arch-tag: 3806d0c1-abe1-4db6-9c31-f3ed7d4a9b32
96044
c1ef445563bb 2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 94676
diff changeset
83
93141
dda2c82177dc Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
84 ;;; org-mac-message.el ends here