Mercurial > emacs
annotate lisp/org/org-mouse.el @ 109166:b70c159d9e1e
Prevent find-file from opening empty buffer when decryptin failed (bug#6568).
* epa-file.el (epa-file-error, epa-file--find-file-not-found-function)
(epa-file-insert-file-contents): Hack to prevent
find-file from opening empty buffer when decryptin failed
(bug#6568).
author | Daiki Ueno <ueno@unixuser.org> |
---|---|
date | Thu, 08 Jul 2010 10:02:24 +0900 |
parents | 594e81986a75 |
children | a150e8a14679 |
rev | line source |
---|---|
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1 ;;; org-mouse.el --- Better mouse support for org-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation |
93141
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: Piotr Zielinski <piotr dot zielinski at gmail dot com> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
7 ;; Version: 6.35i |
93141
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
25 ;;; Commentary: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
26 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
27 ;; Org-mouse provides mouse support for org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
28 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
29 ;; http://orgmode.org |
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 ;; Org-mouse implements the following features: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
32 ;; * following links with the left mouse button (in Emacs 22) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 ;; * subtree expansion/collapse (org-cycle) with the left mouse button |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 ;; * several context menus on the right mouse button: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
35 ;; + general text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 ;; + headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
37 ;; + timestamps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 ;; + priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
39 ;; + links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 ;; + tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 ;; * promoting/demoting/moving subtrees with mouse-3 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
42 ;; + if the drag starts and ends in the same line then promote/demote |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
43 ;; + otherwise move the subtree |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
44 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
45 ;; Use |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
46 ;; --- |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
47 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 ;; To use this package, put the following line in your .emacs: |
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 ;; (require 'org-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
51 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
52 |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
53 ;; FIXME: |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
54 ;; + deal with folding / unfolding issues |
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 ;; TODO (This list is only theoretical, if you'd like to have some |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
57 ;; feature implemented or a bug fix please send me an email, even if |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 ;; something similar appears in the list below. This will help me get |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
59 ;; the priorities right.): |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
60 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
61 ;; + org-store-link, insert link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
62 ;; + org tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
63 ;; + occur with the current word/tag (same menu item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
64 ;; + ctrl-c ctrl-c, for example, renumber the current list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
65 ;; + internal links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
66 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
67 ;; Please email the maintainer with new feature suggestions / bugs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
68 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
69 ;; History: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
70 ;; |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
71 ;; Since version 5.10: Changes are listed in the general org-mode docs. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
72 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
73 ;; Version 5.09 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
74 ;; + Version number synchronization with Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
75 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
76 ;; Version 0.25 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
77 ;; + made compatible with org-mode 4.70 (thanks to Carsten for the patch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
78 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
79 ;; Version 0.24 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
80 ;; + minor changes to the table menu |
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 ;; Version 0.23 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
83 ;; + preliminary support for tables and calculation marks |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
84 ;; + context menu support for org-agenda-undo & org-sort-entries |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
86 ;; Version 0.22 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
87 ;; + handles undo support for the agenda buffer (requires org-mode >=4.58) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
88 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
89 ;; Version 0.21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
90 ;; + selected text activates its context menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
91 ;; + shift-middleclick or right-drag inserts the text from the clipboard in the form of a link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
92 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 ;; Version 0.20 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
94 ;; + the new "TODO Status" submenu replaces the "Cycle TODO" menu item |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 ;; + the TODO menu can now list occurrences of a specific TODO keyword |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
96 ;; + #+STARTUP line is now recognized |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
98 ;; Version 0.19 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 ;; + added support for dragging URLs to the org-buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
100 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
101 ;; Version 0.18 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
102 ;; + added support for agenda blocks |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
103 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
104 ;; Version 0.17 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
105 ;; + toggle checkboxes with a single click |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
106 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 ;; Version 0.16 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 ;; + added support for checkboxes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
109 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 ;; Version 0.15 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
111 ;; + org-mode now works with the Agenda buffer as well |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
113 ;; Version 0.14 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
114 ;; + added a menu option that converts plain list items to outline items |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
115 ;; |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
116 ;; Version 0.13 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
117 ;; + "Insert Heading" now inserts a sibling heading if the point is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 ;; on "***" and a child heading otherwise |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
119 ;; |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
120 ;; Version 0.12 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 ;; + compatible with Emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 ;; + custom agenda commands added to the main menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
123 ;; + moving trees should now work between windows in the same frame |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
125 ;; Version 0.11 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
126 ;; + fixed org-mouse-at-link (thanks to Carsten) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
127 ;; + removed [follow-link] bindings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
128 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
129 ;; Version 0.10 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
130 ;; + added a menu option to remove highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
131 ;; + compatible with org-mode 4.21 now |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
132 ;; |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
133 ;; Version 0.08: |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
134 ;; + trees can be moved/promoted/demoted by dragging with the right |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
135 ;; mouse button (mouse-3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 ;; + small changes in the above function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
137 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
138 ;; Versions 0.01 -- 0.07: (I don't remember) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
139 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
140 (eval-when-compile (require 'cl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
141 (require 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
142 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
143 (defvar org-agenda-allow-remote-undo) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
144 (defvar org-agenda-undo-list) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
145 (defvar org-agenda-custom-commands) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
146 (declare-function org-agenda-change-all-lines "org-agenda" |
99866
57447f70a253
2008-11-24 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99849
diff
changeset
|
147 (newhead hdmarker &optional fixface just-this)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
148 (declare-function org-verify-change-for-undo "org-agenda" (l1 l2)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
149 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
150 (defvar org-mouse-plain-list-regexp "\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
151 "Regular expression that matches a plain list.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
152 (defvar org-mouse-direct t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
153 "Internal variable indicating whether the current action is direct. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
154 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
155 If t, then the current action has been invoked directly through the buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
156 it is intended to operate on. If nil, then the action has been invoked |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
157 indirectly, for example, through the agenda buffer.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
158 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
159 (defgroup org-mouse nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
160 "Mouse support for org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
161 :tag "Org Mouse" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
162 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
163 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
164 (defcustom org-mouse-punctuation ":" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
165 "Punctuation used when inserting text by drag and drop." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
166 :group 'org-mouse |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
167 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
168 |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
169 (defcustom org-mouse-features |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
170 '(context-menu yank-link activate-stars activate-bullets activate-checkboxes) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
171 "The features of org-mouse that should be activated. |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
172 Changing this variable requires a restart of Emacs to get activated." |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
173 :group 'org-mouse |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
174 :type '(set :greedy t |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
175 (const :tag "Mouse-3 shows context menu" context-menu) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
176 (const :tag "C-mouse-1 and mouse-3 move trees" move-tree) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
177 (const :tag "S-mouse-2 and drag-mouse-3 yank link" yank-link) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
178 (const :tag "Activate headline stars" activate-stars) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
179 (const :tag "Activate item bullets" activate-bullets) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
180 (const :tag "Activate checkboxes" activate-checkboxes))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
181 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
182 (defun org-mouse-re-search-line (regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
183 "Search the current line for a given regular expression." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
184 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
185 (re-search-forward regexp (point-at-eol) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
186 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 (defun org-mouse-end-headline () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
188 "Go to the end of current headline (ignoring tags)." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
189 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
190 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
191 (skip-chars-backward "\t ") |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
192 (when (org-looking-back ":[A-Za-z]+:") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
193 (skip-chars-backward ":A-Za-z") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
194 (skip-chars-backward "\t "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
195 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
196 (defvar org-mouse-context-menu-function nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
197 "Function to create the context menu. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
198 The value of this variable is the function invoked by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
199 `org-mouse-context-menu' as the context menu.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
200 (make-variable-buffer-local 'org-mouse-context-menu-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
201 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
202 (defun org-mouse-show-context-menu (event prefix) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
203 "Invoke the context menu. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
204 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 If the value of `org-mouse-context-menu-function' is a function, then |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
206 this function is called. Otherwise, the current major mode menu is used." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
207 (interactive "@e \nP") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 (if (and (= (event-click-count event) 1) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
209 (or (not mark-active) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
210 (sit-for (/ double-click-time 1000.0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
211 (progn |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
212 (select-window (posn-window (event-start event))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
213 (when (not (org-mouse-mark-active)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
214 (goto-char (posn-point (event-start event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
215 (when (not (eolp)) (save-excursion (run-hooks 'post-command-hook))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 (let ((redisplay-dont-pause t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
217 (sit-for 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
218 (if (functionp org-mouse-context-menu-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
219 (funcall org-mouse-context-menu-function event) |
101227
c515c8daae0f
(org-mouse-show-context-menu): Use mouse-menu-major-mode-map, if
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
220 (if (fboundp 'mouse-menu-major-mode-map) |
c515c8daae0f
(org-mouse-show-context-menu): Use mouse-menu-major-mode-map, if
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
221 (popup-menu (mouse-menu-major-mode-map) event prefix) |
101458
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101227
diff
changeset
|
222 (org-no-warnings ; don't warn about fallback, obsolete since 23.1 |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101227
diff
changeset
|
223 (mouse-major-mode-menu event prefix))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
224 (setq this-command 'mouse-save-then-kill) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
225 (mouse-save-then-kill event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
226 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
227 (defun org-mouse-line-position () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
228 "Returns `:beginning' or `:middle' or `:end', depending on the point position. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
229 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
230 If the point is at the end of the line, return `:end'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
231 If the point is separated from the beginning of the line only by white |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
232 space and *'s (`org-mouse-bolp'), return `:beginning'. Otherwise, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
233 return `:middle'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
234 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
235 ((eolp) :end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
236 ((org-mouse-bolp) :beginning) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
237 (t :middle))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
238 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
239 (defun org-mouse-empty-line () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
240 "Return non-nil iff the line contains only white space." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
241 (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
242 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
243 (defun org-mouse-next-heading () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
244 "Go to the next heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
245 If there is none, ensure that the point is at the beginning of an empty line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
246 (unless (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
247 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
248 (unless (org-mouse-empty-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
249 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
250 (newline)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
251 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
252 (defun org-mouse-insert-heading () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 "Insert a new heading, as `org-insert-heading'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
255 If the point is at the :beginning (`org-mouse-line-position') of the line, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
256 insert the new heading before the current line. Otherwise, insert it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
257 after the current heading." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
258 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
259 (case (org-mouse-line-position) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
260 (:beginning (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
261 (org-insert-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
262 (t (org-mouse-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
263 (org-insert-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
264 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
265 (defun org-mouse-timestamp-today (&optional shift units) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
266 "Change the timestamp into SHIFT UNITS in the future. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
267 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
268 For the acceptable UNITS, see `org-timestamp-change'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
269 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
270 (flet ((org-read-date (&rest rest) (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
271 (org-time-stamp nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
272 (when shift |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
273 (org-timestamp-change shift units))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
274 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
275 (defun org-mouse-keyword-menu (keywords function &optional selected itemformat) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
276 "A helper function. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
277 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
278 Returns a menu fragment consisting of KEYWORDS. When a keyword |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
279 is selected by the user, FUNCTION is called with the selected |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
280 keyword as the only argument. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
281 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
282 If SELECTED is nil, then all items are normal menu items. If |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
283 SELECTED is a function, then each item is a checkbox, which is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
284 enabled for a given keyword iff (funcall SELECTED keyword) return |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
285 non-nil. If SELECTED is neither nil nor a function, then the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
286 items are radio buttons. A radio button is enabled for the |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
287 keyword `equal' to SELECTED. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
288 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
289 ITEMFORMAT governs formatting of the elements of KEYWORDS. If it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
290 is a function, it is invoked with the keyword as the only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
291 argument. If it is a string, it is interpreted as the format |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
292 string to (format ITEMFORMAT keyword). If it is neither a string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
293 nor a function, elements of KEYWORDS are used directly. " |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
294 (mapcar |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
295 `(lambda (keyword) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
296 (vector (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
297 ((functionp ,itemformat) (funcall ,itemformat keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 ((stringp ,itemformat) (format ,itemformat keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
299 (t keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
300 (list 'funcall ,function keyword) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
301 :style (cond |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
302 ((null ,selected) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
303 ((functionp ,selected) 'toggle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
304 (t 'radio)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
305 :selected (if (functionp ,selected) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
306 (and (funcall ,selected keyword) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
307 (equal ,selected keyword)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
308 keywords)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
309 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
310 (defun org-mouse-remove-match-and-spaces () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
311 "Remove the match, make just one space around the point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
312 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
313 (replace-match "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
314 (just-one-space)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
315 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
316 (defvar rest) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
317 (defun org-mouse-replace-match-and-surround (newtext &optional fixedcase |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 literal string subexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
319 "The same as `replace-match', but surrounds the replacement with spaces." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
320 (apply 'replace-match rest) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 (save-excursion |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
322 (goto-char (match-beginning (or subexp 0))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
323 (just-one-space) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
324 (goto-char (match-end (or subexp 0))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
325 (just-one-space))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
326 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
327 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
328 (defun org-mouse-keyword-replace-menu (keywords &optional group itemformat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 nosurround) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
330 "A helper function. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
331 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
332 Returns a menu fragment consisting of KEYWORDS. When a keyword |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
333 is selected, group GROUP of the current match is replaced by the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
334 keyword. The method ensures that both ends of the replacement |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
335 are separated from the rest of the text in the buffer by |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
336 individual spaces (unless NOSURROUND is non-nil). |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
337 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
338 The final entry of the menu is always \"None\", which removes the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
339 match. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
340 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
341 ITEMFORMAT governs formatting of the elements of KEYWORDS. If it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
342 is a function, it is invoked with the keyword as the only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
343 argument. If it is a string, it is interpreted as the format |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
344 string to (format ITEMFORMAT keyword). If it is neither a string |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
345 nor a function, elements of KEYWORDS are used directly. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
346 " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
347 (setq group (or group 0)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
348 (let ((replace (org-mouse-match-closure |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
349 (if nosurround 'replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
350 'org-mouse-replace-match-and-surround)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
351 (append |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
352 (org-mouse-keyword-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
353 keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
354 `(lambda (keyword) (funcall ,replace keyword t t nil ,group)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
355 (match-string group) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
356 itemformat) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
357 `(["None" org-mouse-remove-match-and-spaces |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
358 :style radio |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
359 :selected ,(not (member (match-string group) keywords))])))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
360 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
361 (defun org-mouse-show-headlines () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
362 "Change the visibility of the current org buffer to only show headlines." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
363 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
364 (let ((this-command 'org-cycle) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
365 (last-command 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
366 (org-cycle-global-status nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
367 (org-cycle '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
368 (org-cycle '(4)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
369 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
370 (defun org-mouse-show-overview () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
371 "Change visibility of current org buffer to first-level headlines only." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
372 (interactive) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
373 (let ((org-cycle-global-status nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
374 (org-cycle '(4)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
375 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
376 (defun org-mouse-set-priority (priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
377 "Set the priority of the current headline to PRIORITY." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
378 (flet ((read-char-exclusive () priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
379 (org-priority))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
380 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
381 (defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
382 "Regular expression matching the priority indicator. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
383 Differs from `org-priority-regexp' in that it doesn't contain the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
384 leading '.*?'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
385 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
386 (defun org-mouse-get-priority (&optional default) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
387 "Return the priority of the current headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
388 DEFAULT is returned if no priority is given in the headline." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
389 (save-excursion |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
390 (if (org-mouse-re-search-line org-mouse-priority-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
391 (match-string 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
392 (when default (char-to-string org-default-priority))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
393 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
394 ;; (defun org-mouse-at-link () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
395 ;; (and (eq (get-text-property (point) 'face) 'org-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
396 ;; (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
397 ;; (goto-char (previous-single-property-change (point) 'face)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
398 ;; (or (looking-at org-bracket-link-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
399 ;; (looking-at org-angle-link-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
400 ;; (looking-at org-plain-link-re))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
401 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
402 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
403 (defun org-mouse-delete-timestamp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
404 "Deletes the current timestamp as well as the preceding keyword. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
405 SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
406 (when (or (org-at-date-range-p) (org-at-timestamp-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
407 (replace-match "") ; delete the timestamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
408 (skip-chars-backward " :A-Z") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
409 (when (looking-at " *[A-Z][A-Z]+:") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
410 (replace-match "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
411 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
412 (defun org-mouse-looking-at (regexp skipchars &optional movechars) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
413 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
414 (let ((point (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 (if (looking-at regexp) t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
416 (skip-chars-backward skipchars) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
417 (forward-char (or movechars 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
418 (when (looking-at regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
419 (> (match-end 0) point)))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
420 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
421 (defun org-mouse-priority-list () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
422 (loop for priority from ?A to org-lowest-priority |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
423 collect (char-to-string priority))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
424 |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
425 (defun org-mouse-todo-menu (state) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
426 "Create the menu with TODO keywords." |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
427 (append |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
428 (let ((kwds org-todo-keywords-1)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
429 (org-mouse-keyword-menu |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
430 kwds |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
431 `(lambda (kwd) (org-todo kwd)) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
432 (lambda (kwd) (equal state kwd)))))) |
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
433 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
434 (defun org-mouse-tag-menu () ;todo |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
435 "Create the tags menu" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
436 (append |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
437 (let ((tags (org-get-tags))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
438 (org-mouse-keyword-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
439 (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
440 `(lambda (tag) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
441 (org-mouse-set-tags |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
442 (sort (if (member tag (quote ,tags)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
443 (delete tag (quote ,tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
444 (cons tag (quote ,tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
445 'string-lessp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
446 `(lambda (tag) (member tag (quote ,tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
447 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
448 '("--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
449 ["Align Tags Here" (org-set-tags nil t) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
450 ["Align Tags in Buffer" (org-set-tags t t) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
451 ["Set Tags ..." (org-set-tags) t]))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
452 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
453 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
454 (defun org-mouse-set-tags (tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
455 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
456 ;; remove existing tags first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
457 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
458 (when (org-mouse-re-search-line ":\\(\\([A-Za-z_]+:\\)+\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
459 (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
460 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
461 ;; set new tags if any |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
462 (when tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
463 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
464 (insert " :" (mapconcat 'identity tags ":") ":") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
465 (org-set-tags nil t)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
466 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
467 (defun org-mouse-insert-checkbox () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
468 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
469 (and (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
470 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
471 (unless (org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
472 (delete-horizontal-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
473 (insert " [ ] ")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
474 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
475 (defun org-mouse-agenda-type (type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
476 (case type |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
477 ('tags "Tags: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
478 ('todo "TODO: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
479 ('tags-tree "Tags tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
480 ('todo-tree "TODO tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
481 ('occur-tree "Occur tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
482 (t "Agenda command ???"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
483 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
484 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
485 (defun org-mouse-list-options-menu (alloptions &optional function) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
486 (let ((options (save-match-data |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
487 (split-string (match-string-no-properties 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
488 (print options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
489 (loop for name in alloptions |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
490 collect |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
491 (vector name |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
492 `(progn |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
493 (replace-match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
494 (mapconcat 'identity |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
495 (sort (if (member ',name ',options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
496 (delete ',name ',options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
497 (cons ',name ',options)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
498 'string-lessp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
499 " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
500 nil nil nil 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
501 (when (functionp ',function) (funcall ',function))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
502 :style 'toggle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
503 :selected (and (member name options) t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
504 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
505 (defun org-mouse-clip-text (text maxlength) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
506 (if (> (length text) maxlength) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
507 (concat (substring text 0 (- maxlength 3)) "...") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
508 text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
509 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
510 (defun org-mouse-popup-global-menu () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
511 (popup-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
512 `("Main Menu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
513 ["Show Overview" org-mouse-show-overview t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
514 ["Show Headlines" org-mouse-show-headlines t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
515 ["Show All" show-all t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
516 ["Remove Highlights" org-remove-occur-highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
517 :visible org-occur-highlights] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
518 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
519 ["Check Deadlines" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
520 (if (functionp 'org-check-deadlines-and-todos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
521 (org-check-deadlines-and-todos org-deadline-warning-days) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
522 (org-check-deadlines org-deadline-warning-days)) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
523 ["Check TODOs" org-show-todo-tree t] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
524 ("Check Tags" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
525 ,@(org-mouse-keyword-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
526 (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
527 '(lambda (tag) (org-tags-sparse-tree nil tag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
528 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
529 ["Custom Tag ..." org-tags-sparse-tree t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
530 ["Check Phrase ..." org-occur] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
531 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
532 ["Display Agenda" org-agenda-list t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
533 ["Display Timeline" org-timeline t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
534 ["Display TODO List" org-todo-list t] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
535 ("Display Tags" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
536 ,@(org-mouse-keyword-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
537 (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
538 '(lambda (tag) (org-tags-view nil tag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
539 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
540 ["Custom Tag ..." org-tags-view t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
541 ["Display Calendar" org-goto-calendar t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
542 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
543 ,@(org-mouse-keyword-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
544 (mapcar 'car org-agenda-custom-commands) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
545 '(lambda (key) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
546 (eval `(flet ((read-char-exclusive () (string-to-char ,key))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
547 (org-agenda nil)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
548 nil |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
549 '(lambda (key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
550 (let ((entry (assoc key org-agenda-custom-commands))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
551 (org-mouse-clip-text |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
552 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
553 ((stringp (nth 1 entry)) (nth 1 entry)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
554 ((stringp (nth 2 entry)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
555 (concat (org-mouse-agenda-type (nth 1 entry)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
556 (nth 2 entry))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
557 (t "Agenda Command '%s'")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
558 30)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
559 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
560 ["Delete Blank Lines" delete-blank-lines |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
561 :visible (org-mouse-empty-line)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
562 ["Insert Checkbox" org-mouse-insert-checkbox |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
563 :visible (and (org-at-item-p) (not (org-at-item-checkbox-p)))] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
564 ["Insert Checkboxes" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
565 (org-mouse-for-each-item 'org-mouse-insert-checkbox) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
566 :visible (and (org-at-item-p) (not (org-at-item-checkbox-p)))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
567 ["Plain List to Outline" org-mouse-transform-to-outline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
568 :visible (org-at-item-p)]))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
569 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
570 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
571 (defun org-mouse-get-context (contextlist context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
572 (let ((contextdata (assq context contextlist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
573 (when contextdata |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
574 (save-excursion |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
575 (goto-char (second contextdata)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
576 (re-search-forward ".*" (third contextdata)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
577 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
578 (defun org-mouse-for-each-item (function) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
579 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
580 (ignore-errors |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
581 (while t (org-previous-item))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
582 (ignore-errors |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
583 (while t |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
584 (funcall function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
585 (org-next-item))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
586 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
587 (defun org-mouse-bolp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
588 "Returns true if there only spaces, tabs, and '*', between the beginning of line and the point" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
589 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
590 (skip-chars-backward " \t*") (bolp))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
591 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
592 (defun org-mouse-insert-item (text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
593 (case (org-mouse-line-position) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
594 (:beginning ; insert before |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
595 (beginning-of-line) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
596 (looking-at "[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
597 (open-line 1) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99717
diff
changeset
|
598 (org-indent-to-column (- (match-end 0) (match-beginning 0))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
599 (insert "+ ")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
600 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
601 (:middle ; insert after |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
602 (end-of-line) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
603 (newline t) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
604 (indent-relative) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
605 (insert "+ ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
606 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
607 (:end ; insert text here |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
608 (skip-chars-backward " \t") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
609 (kill-region (point) (point-at-eol)) |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
610 (unless (org-looking-back org-mouse-punctuation) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
611 (insert (concat org-mouse-punctuation " "))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
612 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
613 (insert text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
614 (beginning-of-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
615 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
616 (defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
617 (if (eq major-mode 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
618 (org-mouse-insert-item text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
619 ad-do-it)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
620 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
621 (defadvice dnd-open-file (around org-mouse-dnd-open-file activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
622 (if (eq major-mode 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
623 (org-mouse-insert-item uri) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
624 ad-do-it)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
625 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
626 (defun org-mouse-match-closure (function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
627 (let ((match (match-data t))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
628 `(lambda (&rest rest) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
629 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
630 (set-match-data ',match) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
631 (apply ',function rest))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
632 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
633 (defun org-mouse-match-todo-keyword () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
634 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
635 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
636 (if (looking-at outline-regexp) (goto-char (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
637 (or (looking-at (concat " +" org-todo-regexp " *")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
638 (looking-at " \\( *\\)")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
639 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
640 (defun org-mouse-yank-link (click) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
641 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
642 ;; Give temporary modes such as isearch a chance to turn off. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
643 (run-hooks 'mouse-leave-buffer-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
644 (mouse-set-point click) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
645 (setq mouse-selection-click-count 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
646 (delete-horizontal-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
647 (insert-for-yank (concat " [[" (current-kill 0) "]] "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
648 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
649 (defun org-mouse-context-menu (&optional event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
650 (let ((stamp-prefixes (list org-deadline-string org-scheduled-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
651 (contextlist (org-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
652 (flet ((get-context (context) (org-mouse-get-context contextlist context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
653 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
654 ((org-mouse-mark-active) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
655 (let ((region-string (buffer-substring (region-beginning) (region-end)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
656 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
657 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
658 ["Sparse Tree" (org-occur ',region-string)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
659 ["Find in Buffer" (occur ',region-string)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
660 ["Grep in Current Dir" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
661 (grep (format "grep -rnH -e '%s' *" ',region-string))] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
662 ["Grep in Parent Dir" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
663 (grep (format "grep -rnH -e '%s' ../*" ',region-string))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
664 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
665 ["Convert to Link" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
666 (progn (save-excursion (goto-char (region-beginning)) (insert "[[")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
667 (save-excursion (goto-char (region-end)) (insert "]]")))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
668 ["Insert Link Here" (org-mouse-yank-link ',event)])))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
669 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
670 ((save-excursion (beginning-of-line) (looking-at "#\\+STARTUP: \\(.*\\)")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
671 (popup-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
672 `(nil |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
673 ,@(org-mouse-list-options-menu (mapcar 'car org-startup-options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
674 'org-mode-restart)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
675 ((or (eolp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
676 (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") |
107863
594e81986a75
2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents:
106815
diff
changeset
|
677 (org-looking-back " \\|\t"))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
678 (org-mouse-popup-global-menu)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
679 ((get-context :checkbox) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
680 (popup-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
681 '(nil |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
682 ["Toggle" org-toggle-checkbox t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
683 ["Remove" org-mouse-remove-match-and-spaces t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
684 "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
685 ["All Clear" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
686 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
687 (when (save-excursion (org-at-item-checkbox-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
688 (replace-match "[ ]"))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
689 ["All Set" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
690 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
691 (when (save-excursion (org-at-item-checkbox-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
692 (replace-match "[X]"))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
693 ["All Toggle" (org-mouse-for-each-item 'org-toggle-checkbox) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
694 ["All Remove" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
695 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
696 (when (save-excursion (org-at-item-checkbox-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
697 (org-mouse-remove-match-and-spaces))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
698 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
699 ((and (org-mouse-looking-at "\\b\\w+" "a-zA-Z0-9_") |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
700 (member (match-string 0) org-todo-keywords-1)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
701 (popup-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
702 `(nil |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
703 ,@(org-mouse-todo-menu (match-string 0)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
704 "--" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
705 ["Check TODOs" org-show-todo-tree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
706 ["List all TODO keywords" org-todo-list t] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
707 [,(format "List only %s" (match-string 0)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
708 (org-todo-list (match-string 0)) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
709 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
710 ((and (org-mouse-looking-at "\\b[A-Z]+:" "A-Z") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
711 (member (match-string 0) stamp-prefixes)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
712 (popup-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
713 `(nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
714 ,@(org-mouse-keyword-replace-menu stamp-prefixes) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
715 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
716 ["Check Deadlines" org-check-deadlines t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
717 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
718 ((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z#") ; priority |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
719 (popup-menu `(nil ,@(org-mouse-keyword-replace-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
720 (org-mouse-priority-list) 1 "Priority %s" t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
721 ((get-context :link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
722 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
723 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
724 ["Open" org-open-at-point t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
725 ["Open in Emacs" (org-open-at-point t) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
726 "--" |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
727 ["Copy link" (org-kill-new (match-string 0))] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
728 ["Cut link" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
729 (progn |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
730 (kill-region (match-beginning 0) (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
731 (just-one-space))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
732 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
733 ["Grep for TODOs" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
734 (grep (format "grep -nH -i 'todo\\|fixme' %s*" (match-string 2)))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
735 ; ["Paste file link" ((insert "file:") (yank))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
736 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
737 ((org-mouse-looking-at ":\\([A-Za-z0-9_]+\\):" "A-Za-z0-9_" -1) ;tags |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
738 (popup-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
739 `(nil |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
740 [,(format "Display '%s'" (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
741 (org-tags-view nil ,(match-string 1))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
742 [,(format "Sparse Tree '%s'" (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
743 (org-tags-sparse-tree nil ,(match-string 1))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
744 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
745 ,@(org-mouse-tag-menu)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
746 ((org-at-timestamp-p) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
747 (popup-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
748 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
749 ["Show Day" org-open-at-point t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
750 ["Change Timestamp" org-time-stamp t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
751 ["Delete Timestamp" (org-mouse-delete-timestamp) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
752 ["Compute Time Range" org-evaluate-time-range (org-at-date-range-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
753 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
754 ["Set for Today" org-mouse-timestamp-today] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
755 ["Set for Tomorrow" (org-mouse-timestamp-today 1 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
756 ["Set in 1 Week" (org-mouse-timestamp-today 7 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
757 ["Set in 2 Weeks" (org-mouse-timestamp-today 14 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
758 ["Set in a Month" (org-mouse-timestamp-today 1 'month)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
759 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
760 ["+ 1 Day" (org-timestamp-change 1 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
761 ["+ 1 Week" (org-timestamp-change 7 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
762 ["+ 1 Month" (org-timestamp-change 1 'month)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
763 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
764 ["- 1 Day" (org-timestamp-change -1 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
765 ["- 1 Week" (org-timestamp-change -7 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
766 ["- 1 Month" (org-timestamp-change -1 'month)]))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
767 ((get-context :table-special) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
768 (let ((mdata (match-data))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
769 (incf (car mdata) 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
770 (store-match-data mdata)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
771 (message "match: %S" (match-string 0)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
772 (popup-menu `(nil ,@(org-mouse-keyword-replace-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
773 '(" " "!" "^" "_" "$" "#" "*" "'") 0 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
774 (lambda (mark) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
775 (case (string-to-char mark) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
776 (? "( ) Nothing Special") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
777 (?! "(!) Column Names") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
778 (?^ "(^) Field Names Above") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
779 (?_ "(^) Field Names Below") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
780 (?$ "($) Formula Parameters") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
781 (?# "(#) Recalculation: Auto") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
782 (?* "(*) Recalculation: Manual") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
783 (?' "(') Recalculation: None"))) t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
784 ((assq :table contextlist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
785 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
786 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
787 ["Align Table" org-ctrl-c-ctrl-c] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
788 ["Blank Field" org-table-blank-field] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
789 ["Edit Field" org-table-edit-field] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
790 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
791 ("Column" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
792 ["Move Column Left" org-metaleft] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
793 ["Move Column Right" org-metaright] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
794 ["Delete Column" org-shiftmetaleft] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
795 ["Insert Column" org-shiftmetaright] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
796 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
797 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :selected org-table-limit-column-width :style toggle]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
798 ("Row" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
799 ["Move Row Up" org-metaup] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
800 ["Move Row Down" org-metadown] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
801 ["Delete Row" org-shiftmetaup] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
802 ["Insert Row" org-shiftmetadown] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
803 ["Sort lines in region" org-table-sort-lines (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
804 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
805 ["Insert Hline" org-table-insert-hline]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
806 ("Rectangle" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
807 ["Copy Rectangle" org-copy-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
808 ["Cut Rectangle" org-cut-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
809 ["Paste Rectangle" org-paste-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
810 ["Fill Rectangle" org-table-wrap-region]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
811 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
812 ["Set Column Formula" org-table-eval-formula] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
813 ["Set Field Formula" (org-table-eval-formula '(4))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
814 ["Edit Formulas" org-table-edit-formulas] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
815 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
816 ["Recalculate Line" org-table-recalculate] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
817 ["Recalculate All" (org-table-recalculate '(4))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
818 ["Iterate All" (org-table-recalculate '(16))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
819 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
820 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
821 ["Sum Column/Rectangle" org-table-sum |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
822 :active (or (org-at-table-p) (org-region-active-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
823 ["Field Info" org-table-field-info] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
824 ["Debug Formulas" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
825 (setq org-table-formula-debug (not org-table-formula-debug)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
826 :style toggle :selected org-table-formula-debug] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
827 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
828 ((and (assq :headline contextlist) (not (eolp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
829 (let ((priority (org-mouse-get-priority t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
830 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
831 `("Headline Menu" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
832 ("Tags and Priorities" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
833 ,@(org-mouse-keyword-menu |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
834 (org-mouse-priority-list) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
835 '(lambda (keyword) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
836 (org-mouse-set-priority (string-to-char keyword))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
837 priority "Priority %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
838 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
839 ,@(org-mouse-tag-menu)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
840 ("TODO Status" |
104164
ac1a55cc2c38
2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101757
diff
changeset
|
841 ,@(org-mouse-todo-menu (org-get-todo-state))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
842 ["Show Tags" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
843 (with-current-buffer org-mouse-main-buffer (org-agenda-show-tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
844 :visible (not org-mouse-direct)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
845 ["Show Priority" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
846 (with-current-buffer org-mouse-main-buffer (org-agenda-show-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
847 :visible (not org-mouse-direct)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
848 ,@(if org-mouse-direct '("--") nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
849 ["New Heading" org-mouse-insert-heading :visible org-mouse-direct] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
850 ["Set Deadline" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
851 (progn (org-mouse-end-headline) (insert " ") (org-deadline)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
852 :active (not (save-excursion |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
853 (org-mouse-re-search-line org-deadline-regexp)))] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
854 ["Schedule Task" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
855 (progn (org-mouse-end-headline) (insert " ") (org-schedule)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
856 :active (not (save-excursion |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
857 (org-mouse-re-search-line org-scheduled-regexp)))] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
858 ["Insert Timestamp" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
859 (progn (org-mouse-end-headline) (insert " ") (org-time-stamp nil)) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
860 ; ["Timestamp (inactive)" org-time-stamp-inactive t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
861 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
862 ["Archive Subtree" org-archive-subtree] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
863 ["Cut Subtree" org-cut-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
864 ["Copy Subtree" org-copy-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
865 ["Paste Subtree" org-paste-special :visible org-mouse-direct] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
866 ("Sort Children" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
867 ["Alphabetically" (org-sort-entries nil ?a)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
868 ["Numerically" (org-sort-entries nil ?n)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
869 ["By Time/Date" (org-sort-entries nil ?t)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
870 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
871 ["Reverse Alphabetically" (org-sort-entries nil ?A)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
872 ["Reverse Numerically" (org-sort-entries nil ?N)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
873 ["Reverse By Time/Date" (org-sort-entries nil ?T)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
874 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
875 ["Move Trees" org-mouse-move-tree :active nil] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
876 )))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
877 (t |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
878 (org-mouse-popup-global-menu)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
879 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
880 ;; (defun org-mouse-at-regexp (regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
881 ;; (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
882 ;; (let ((point (point)) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
883 ;; (bol (progn (beginning-of-line) (point))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
884 ;; (eol (progn (end-of-line) (point)))) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
885 ;; (goto-char point) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
886 ;; (re-search-backward regexp bol 1) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
887 ;; (and (not (eolp)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
888 ;; (progn (forward-char) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
889 ;; (re-search-forward regexp eol t)) |
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
890 ;; (<= (match-beginning 0) point))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
891 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
892 (defun org-mouse-mark-active () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
893 (and mark-active transient-mark-mode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
894 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
895 (defun org-mouse-in-region-p (pos) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
896 (and (org-mouse-mark-active) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
897 (>= pos (region-beginning)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
898 (< pos (region-end)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
899 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
900 (defun org-mouse-down-mouse (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
901 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
902 (setq this-command last-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
903 (unless (and (= 1 (event-click-count event)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
904 (org-mouse-in-region-p (posn-point (event-start event)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
905 (mouse-drag-region event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
906 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
907 (add-hook 'org-mode-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
908 '(lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
909 (setq org-mouse-context-menu-function 'org-mouse-context-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
910 |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
911 (when (memq 'context-menu org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
912 (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
913 (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
914 (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
915 (when (memq 'context-menu org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
916 (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
917 (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
918 (when (memq 'yank-link org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
919 (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
920 (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link)) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
921 (when (memq 'move-tree org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
922 (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
923 (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
924 |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
925 (when (memq 'activate-stars org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
926 (font-lock-add-keywords |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
927 nil |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
928 `((,outline-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
929 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
930 'prepend)) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
931 t)) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
932 |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
933 (when (memq 'activate-bullets org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
934 (font-lock-add-keywords |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
935 nil |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
936 `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
937 (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
938 'prepend))) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
939 t)) |
99139
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
940 |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
941 (when (memq 'activate-checkboxes org-mouse-features) |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
942 (font-lock-add-keywords |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
943 nil |
8fa7ef477c04
2008-10-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
98644
diff
changeset
|
944 `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
945 (2 `(face bold keymap ,org-mouse-map mouse-face highlight) t))) |
100458
ba23e35d3eaf
2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100448
diff
changeset
|
946 t)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
947 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
948 (defadvice org-open-at-point (around org-mouse-open-at-point activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
949 (let ((context (org-context))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
950 (cond |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
951 ((assq :headline-stars context) (org-cycle)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
952 ((assq :checkbox context) (org-toggle-checkbox)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
953 ((assq :item-bullet context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
954 (let ((org-cycle-include-plain-lists t)) (org-cycle))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
955 (t ad-do-it)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
956 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
957 (defun org-mouse-move-tree-start (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
958 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
959 (message "Same line: promote/demote, (***):move before, (text): make a child")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
960 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
961 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
962 (defun org-mouse-make-marker (position) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
963 (with-current-buffer (window-buffer (posn-window position)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
964 (copy-marker (posn-point position)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
965 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
966 (defun org-mouse-move-tree (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
967 ;; todo: handle movements between different buffers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
968 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
969 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
970 (let* ((start (org-mouse-make-marker (event-start event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
971 (end (org-mouse-make-marker (event-end event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
972 (sbuf (marker-buffer start)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
973 (ebuf (marker-buffer end))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
974 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
975 (when (and sbuf ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
976 (set-buffer sbuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
977 (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
978 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
979 (if (and (eq sbuf ebuf) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
980 (equal |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
981 (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
982 (save-excursion (goto-char end) (org-back-to-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
983 ;; if the same line then promote/demote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
984 (if (>= end start) (org-demote-subtree) (org-promote-subtree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
985 ;; if different lines then move |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
986 (org-cut-subtree) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
987 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
988 (set-buffer ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
989 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
990 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
991 (when (and (eq sbuf ebuf) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
992 (equal |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
993 (point) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
994 (save-excursion (goto-char start) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
995 (org-back-to-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
996 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
997 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
998 (if (eobp) (newline) (forward-char))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
999 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1000 (when (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1001 (let ((level (- (match-end 0) (match-beginning 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1002 (when (> end (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1003 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1004 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1005 (if (eobp) (newline) (forward-char)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1006 (setq level (1+ level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1007 (org-paste-subtree level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1008 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1009 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1010 (when (bolp) (delete-char -1)))))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1011 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1012 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1013 (defun org-mouse-transform-to-outline () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1014 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1015 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1016 (let ((minlevel 1000) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1017 (replace-text (concat (match-string 0) "* "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1018 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1019 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1020 (while (not (or (eobp) (looking-at outline-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1021 (when (looking-at org-mouse-plain-list-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1022 (setq minlevel (min minlevel (- (match-end 1) (match-beginning 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1023 (forward-line))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1024 (while (not (or (eobp) (looking-at outline-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1025 (when (and (looking-at org-mouse-plain-list-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1026 (eq minlevel (- (match-end 1) (match-beginning 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1027 (replace-match replace-text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1028 (forward-line)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1029 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1030 (defvar _cmd) ;dynamically scoped from `org-with-remote-undo'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1031 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1032 (defun org-mouse-do-remotely (command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1033 ; (org-agenda-check-no-diary) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1034 (when (get-text-property (point) 'org-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1035 (let* ((anticol (- (point-at-eol) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1036 (marker (get-text-property (point) 'org-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1037 (buffer (marker-buffer marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1038 (pos (marker-position marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1039 (hdmarker (get-text-property (point) 'org-hd-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1040 (buffer-read-only nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1041 (newhead "--- removed ---") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1042 (org-mouse-direct nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1043 (org-mouse-main-buffer (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1044 (when (eq (with-current-buffer buffer major-mode) 'org-mode) |
105865
131bccfc4f5d
* org.el (org-version, org-get-refile-targets, org-refile)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105341
diff
changeset
|
1045 (let ((endmarker (with-current-buffer buffer |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1046 (outline-end-of-subtree) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1047 (forward-char 1) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1048 (copy-marker (point))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1049 (org-with-remote-undo buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1050 (with-current-buffer buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1051 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1052 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1053 (org-show-hidden-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1054 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1055 (and (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1056 (org-flag-heading nil))) ; show the next heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1057 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1058 (setq marker (copy-marker (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1059 (goto-char (max (point-at-bol) (- (point-at-eol) anticol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1060 (funcall command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1061 (message "_cmd: %S" _cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1062 (message "this-command: %S" this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1063 (unless (eq (marker-position marker) (marker-position endmarker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1064 (setq newhead (org-get-heading)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1065 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1066 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1067 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1068 (org-agenda-change-all-lines newhead hdmarker 'fixface)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1069 t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1070 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1071 (defun org-mouse-agenda-context-menu (&optional event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1072 (or (org-mouse-do-remotely 'org-mouse-context-menu) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1073 (popup-menu |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1074 '("Agenda" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1075 ("Agenda Files") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1076 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1077 ["Undo" (progn (message "last command: %S" last-command) (setq this-command 'org-agenda-undo) (org-agenda-undo)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1078 :visible (if (eq last-command 'org-agenda-undo) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1079 org-agenda-pending-undo-list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1080 org-agenda-undo-list)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1081 ["Rebuild Buffer" org-agenda-redo t] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1082 ["New Diary Entry" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1083 org-agenda-diary-entry (org-agenda-check-type nil 'agenda 'timeline) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1084 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1085 ["Goto Today" org-agenda-goto-today |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1086 (org-agenda-check-type nil 'agenda 'timeline) t] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1087 ["Display Calendar" org-agenda-goto-calendar |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1088 (org-agenda-check-type nil 'agenda 'timeline) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1089 ("Calendar Commands" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1090 ["Phases of the Moon" org-agenda-phases-of-moon |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1091 (org-agenda-check-type nil 'agenda 'timeline)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1092 ["Sunrise/Sunset" org-agenda-sunrise-sunset |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1093 (org-agenda-check-type nil 'agenda 'timeline)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1094 ["Holidays" org-agenda-holidays |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1095 (org-agenda-check-type nil 'agenda 'timeline)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1096 ["Convert" org-agenda-convert-date |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1097 (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1098 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1099 ["Create iCalendar file" org-export-icalendar-combine-agenda-files t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1100 "--" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1101 ["Day View" org-agenda-day-view |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1102 :active (org-agenda-check-type nil 'agenda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1103 :style radio :selected (equal org-agenda-ndays 1)] |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1104 ["Week View" org-agenda-week-view |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1105 :active (org-agenda-check-type nil 'agenda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1106 :style radio :selected (equal org-agenda-ndays 7)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1107 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1108 ["Show Logbook entries" org-agenda-log-mode |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1109 :style toggle :selected org-agenda-show-log |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1110 :active (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1111 ["Include Diary" org-agenda-toggle-diary |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1112 :style toggle :selected org-agenda-include-diary |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1113 :active (org-agenda-check-type nil 'agenda)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1114 ["Use Time Grid" org-agenda-toggle-time-grid |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1115 :style toggle :selected org-agenda-use-time-grid |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1116 :active (org-agenda-check-type nil 'agenda)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1117 ["Follow Mode" org-agenda-follow-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1118 :style toggle :selected org-agenda-follow-mode] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1119 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1120 ["Quit" org-agenda-quit t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1121 ["Exit and Release Buffers" org-agenda-exit t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1122 )))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1123 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1124 (defun org-mouse-get-gesture (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1125 (let ((startxy (posn-x-y (event-start event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1126 (endxy (posn-x-y (event-end event)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1127 (if (< (car startxy) (car endxy)) :right :left))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1128 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1129 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1130 ; (setq org-agenda-mode-hook nil) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1131 (add-hook 'org-agenda-mode-hook |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1132 '(lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1133 (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1134 (define-key org-agenda-mode-map |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93141
diff
changeset
|
1135 (if (featurep 'xemacs) [button3] [mouse-3]) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1136 'org-mouse-show-context-menu) |
105973
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1137 (define-key org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1138 (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1139 (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later) |
b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
105865
diff
changeset
|
1140 (define-key org-agenda-mode-map [drag-mouse-3] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1141 '(lambda (event) (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1142 (case (org-mouse-get-gesture event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1143 (:left (org-agenda-earlier 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1144 (:right (org-agenda-later 1))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1145 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1146 (provide 'org-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1147 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1148 ;; arch-tag: ff1ae557-3529-41a3-95c6-baaebdcc280f |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94676
diff
changeset
|
1149 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94676
diff
changeset
|
1150 ;;; org-mouse.el ends-here |