Mercurial > emacs
annotate lisp/org/org-mouse.el @ 93552:b3998548dbfa
* simple.el (deactivate-mark): When the mark is temporarily
active, restore the original value of transient-mark-mode.
(set-mark-command): First deactivate the mark if was temporarily
active.
(exchange-point-and-mark): Reactivate the mark if it was
temporarily active.
(handle-shift-selection): New fun.
(transient-mark-mode): Move var documentation here from buffer.c.
(next-line, previous-line, backward-word, move-end-of-line)
(move-beginning-of-line, forward-to-indentation)
(backward-to-indentation, back-to-indentation)
(beginning-of-buffer, end-of-buffer): Add ^ interactive spec.
* mouse.el (mouse-set-region-1): Save the old value of
transient-mark-mode.
(mouse-drag-track): Ignore the now-obsolete value `identity' for
transient-mark-mode.
* textmodes/paragraphs.el (forward-paragraph)
(backward-paragraph, forward-sentence, backward-sentence): Add ^
interactive spec.
* emulation/cua-base.el (cua-mode): Turn off shift-select-mode.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 02 Apr 2008 20:17:41 +0000 |
parents | dda2c82177dc |
children | d86cb59eea9f |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation |
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> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7 ;; Version: 5.23 |
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 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14 ;; any later version. |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 ;; Boston, MA 02110-1301, USA. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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 ;;; Commentary: |
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 ;; 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
|
30 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
31 ;; http://orgmode.org |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
32 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 ;; Org-mouse implements the following features: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 ;; * 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
|
35 ;; * 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
|
36 ;; * 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
|
37 ;; + general text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 ;; + headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
39 ;; + timestamps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 ;; + priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 ;; + links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
42 ;; + tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
43 ;; * promoting/demoting/moving subtrees with mouse-3 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
44 ;; + if the drag starts and ends in the same line then promote/demote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
45 ;; + otherwise move the subtree |
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 ;; Use |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 ;; --- |
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 ;; 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
|
51 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
52 ;; (require 'org-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
53 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
54 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
55 ;; Fixme: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
56 ;; + deal with folding / unfolding issues |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
57 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 ;; 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
|
59 ;; 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
|
60 ;; 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
|
61 ;; the priorities right.): |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
62 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
63 ;; + org-store-link, insert link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
64 ;; + org tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
65 ;; + 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
|
66 ;; + 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
|
67 ;; + internal links |
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 ;; 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
|
70 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
71 ;; History: |
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 ;; SInce version 5.10: Changes are listed in the general org-mode docs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
74 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
75 ;; Version 5.09 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
76 ;; + Version number synchronization with Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
77 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
78 ;; Version 0.25 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
79 ;; + 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
|
80 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
81 ;; Version 0.24 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
82 ;; + minor changes to the table menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
83 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
84 ;; Version 0.23 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 ;; + preliminary support for tables and calculation marks |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
86 ;; + 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
|
87 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
88 ;; Version 0.22 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
89 ;; + 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
|
90 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
91 ;; Version 0.21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
92 ;; + selected text activates its context menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 ;; + 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
|
94 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 ;; Version 0.20 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
96 ;; + the new "TODO Status" submenu replaces the "Cycle TODO" menu item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 ;; + 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
|
98 ;; + #+STARTUP line is now recognized |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
100 ;; Version 0.19 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
101 ;; + 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
|
102 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
103 ;; Version 0.18 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
104 ;; + added support for agenda blocks |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
105 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
106 ;; Version 0.17 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 ;; + toggle checkboxes with a single click |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
109 ;; Version 0.16 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 ;; + added support for checkboxes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
111 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 ;; Version 0.15 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
113 ;; + 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
|
114 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
115 ;; Version 0.14 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
116 ;; + 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
|
117 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 ;; Version 0.13 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
119 ;; + "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
|
120 ;; on "***" and a child heading otherwise |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 ;; Version 0.12 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
123 ;; + compatible with Emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 ;; + 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
|
125 ;; + 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
|
126 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
127 ;; Version 0.11 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
128 ;; + 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
|
129 ;; + removed [follow-link] bindings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
130 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
131 ;; Version 0.10 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
132 ;; + added a menu option to remove highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
133 ;; + compatible with org-mode 4.21 now |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
134 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
135 ;; Version 0.08: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 ;; + 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
|
137 ;; mouse button (mouse-3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
138 ;; + small changes in the above function |
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 ;; 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
|
141 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
142 (eval-when-compile (require 'cl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
143 (require 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
144 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
145 (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
|
146 "Regular expression that matches a plain list.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
147 (defvar org-mouse-direct t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
148 "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
|
149 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
150 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
|
151 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
|
152 indirectly, for example, through the agenda buffer.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
153 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
154 (defgroup org-mouse nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
155 "Mouse support for org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
156 :tag "Org Mouse" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
157 :group 'org) |
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 (defcustom org-mouse-punctuation ":" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
160 "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
|
161 :group 'org-mouse |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
162 :type 'string) |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
165 (defun org-mouse-re-search-line (regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
166 "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
|
167 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
168 (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
|
169 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
170 (defun org-mouse-end-headline () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
171 "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
|
172 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
173 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
174 (skip-chars-backward "\t ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
175 (when (looking-back ":[A-Za-z]+:") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
176 (skip-chars-backward ":A-Za-z") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
177 (skip-chars-backward "\t "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
178 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
179 (defvar org-mouse-context-menu-function nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
180 "Function to create the context menu. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
181 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
|
182 `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
|
183 (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
|
184 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
185 (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
|
186 "Invoke the context menu. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
188 If the value of `org-mouse-context-menu-function' is a function, then |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
189 this function is called. Otherwise, the current major mode menu is used." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
190 (interactive "@e \nP") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
191 (if (and (= (event-click-count event) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
192 (or (not mark-active) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
193 (sit-for (/ double-click-time 1000.0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
194 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
195 (select-window (posn-window (event-start event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
196 (when (not (org-mouse-mark-active)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
197 (goto-char (posn-point (event-start event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
198 (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
|
199 (let ((redisplay-dont-pause t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
200 (sit-for 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
201 (if (functionp org-mouse-context-menu-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
202 (funcall org-mouse-context-menu-function event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
203 (mouse-major-mode-menu event prefix))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
204 (setq this-command 'mouse-save-then-kill) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 (mouse-save-then-kill event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
206 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
207 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 (defun org-mouse-line-position () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
209 "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
|
210 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 return `:middle'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
215 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 ((eolp) :end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
217 ((org-mouse-bolp) :beginning) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
218 (t :middle))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
219 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
220 (defun org-mouse-empty-line () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
221 "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
|
222 (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
|
223 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
224 (defun org-mouse-next-heading () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
225 "Go to the next heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
226 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
|
227 (unless (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
228 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
229 (unless (org-mouse-empty-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
230 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
231 (newline)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
232 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
233 (defun org-mouse-insert-heading () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
234 "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
|
235 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
236 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
|
237 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
|
238 after the current heading." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
239 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
240 (case (org-mouse-line-position) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
241 (:beginning (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
242 (org-insert-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
243 (t (org-mouse-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
244 (org-insert-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
245 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
246 (defun org-mouse-timestamp-today (&optional shift units) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
247 "Change the timestamp into SHIFT UNITS in the future. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
248 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
249 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
|
250 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
251 (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
|
252 (org-time-stamp nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 (when shift |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 (org-timestamp-change shift units))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
255 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
256 (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
|
257 "A helper function. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
258 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
259 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
|
260 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
|
261 keyword as the only argument. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
262 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
263 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
|
264 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
|
265 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
|
266 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
|
267 items are radio buttons. A radio button is enabled for the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
268 keyword `equal' to SELECTED. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
269 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 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
|
274 nor a function, elements of KEYWORDS are used directly. " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
275 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
276 `(lambda (keyword) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
277 (vector (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
278 ((functionp ,itemformat) (funcall ,itemformat keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
279 ((stringp ,itemformat) (format ,itemformat keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
280 (t keyword)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
281 (list 'funcall ,function keyword) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
282 :style (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
283 ((null ,selected) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
284 ((functionp ,selected) 'toggle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
285 (t 'radio)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
286 :selected (if (functionp ,selected) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
287 (and (funcall ,selected keyword) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
288 (equal ,selected keyword)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
289 keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
290 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
291 (defun org-mouse-remove-match-and-spaces () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
292 "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
|
293 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
294 (replace-match "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
295 (just-one-space)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
296 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
297 (defvar rest) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 (defun org-mouse-replace-match-and-surround (newtext &optional fixedcase |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
299 literal string subexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
300 "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
|
301 (apply 'replace-match rest) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
302 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
303 (goto-char (match-beginning (or subexp 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
304 (just-one-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
305 (goto-char (match-end (or subexp 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
306 (just-one-space))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
307 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
308 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
309 (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
|
310 nosurround) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
311 "A helper function. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
312 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
313 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
|
314 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
|
315 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
|
316 are separated from the rest of the text in the buffer by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
317 individual spaces (unless NOSURROND is non-nil). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
319 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
|
320 match. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
322 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
|
323 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
|
324 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
|
325 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
|
326 nor a function, elements of KEYWORDS are used directly. |
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 (setq group (or group 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 (let ((replace (org-mouse-match-closure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
330 (if nosurround 'replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
331 'org-mouse-replace-match-and-surround)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
332 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
333 (org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
334 keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
335 `(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
|
336 (match-string group) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
337 itemformat) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
338 `(["None" org-mouse-remove-match-and-spaces |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
339 :style radio |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
340 :selected ,(not (member (match-string group) keywords))])))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
341 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
342 (defun org-mouse-show-headlines () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
343 "Change the visibility of the current org buffer to only show headlines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
344 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
345 (let ((this-command 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
346 (last-command 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
347 (org-cycle-global-status nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
348 (org-cycle '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
349 (org-cycle '(4)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
350 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
351 (defun org-mouse-show-overview () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
352 "Change visibility of current org buffer to first-level headlines only." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
353 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
354 (let ((org-cycle-global-status nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
355 (org-cycle '(4)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
356 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
357 (defun org-mouse-set-priority (priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
358 "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
|
359 (flet ((read-char-exclusive () priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
360 (org-priority))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
361 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
362 (defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
363 "Regular expression matching the priority indicator. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
364 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
|
365 leading '.*?'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
366 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
367 (defun org-mouse-get-priority (&optional default) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
368 "Return the priority of the current headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
369 DEFAULT is returned if no priority is given in the headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
370 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
371 (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
|
372 (match-string 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
373 (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
|
374 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
375 ;; (defun org-mouse-at-link () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
376 ;; (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
|
377 ;; (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
378 ;; (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
|
379 ;; (or (looking-at org-bracket-link-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
380 ;; (looking-at org-angle-link-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
381 ;; (looking-at org-plain-link-re))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
382 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
383 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
384 (defun org-mouse-delete-timestamp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
385 "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
|
386 SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
387 (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
|
388 (replace-match "") ; delete the timestamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
389 (skip-chars-backward " :A-Z") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
390 (when (looking-at " *[A-Z][A-Z]+:") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
391 (replace-match "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
392 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
393 (defun org-mouse-looking-at (regexp skipchars &optional movechars) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
394 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
395 (let ((point (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
396 (if (looking-at regexp) t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
397 (skip-chars-backward skipchars) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
398 (forward-char (or movechars 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
399 (when (looking-at regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
400 (> (match-end 0) point)))))) |
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 (defun org-mouse-priority-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
403 (loop for priority from ?A to org-lowest-priority |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
404 collect (char-to-string priority))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
405 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
406 (defun org-mouse-tag-menu () ;todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
407 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
408 (let ((tags (org-split-string (org-get-tags) ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
409 (org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
410 (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
|
411 `(lambda (tag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
412 (org-mouse-set-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
413 (sort (if (member tag (quote ,tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
414 (delete tag (quote ,tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 (cons tag (quote ,tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
416 'string-lessp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
417 `(lambda (tag) (member tag (quote ,tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
418 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
419 '("--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
420 ["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
|
421 ["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
|
422 ["Set Tags ..." (org-set-tags) t]))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
423 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
424 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
425 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
426 (defun org-mouse-set-tags (tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
427 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
428 ;; remove existing tags first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
429 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
430 (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
|
431 (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
432 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
433 ;; set new tags if any |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
434 (when tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
435 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
436 (insert " :" (mapconcat 'identity tags ":") ":") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
437 (org-set-tags nil t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
438 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
439 (defun org-mouse-insert-checkbox () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
440 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
441 (and (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
442 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
443 (unless (org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
444 (delete-horizontal-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
445 (insert " [ ] ")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
446 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
447 (defun org-mouse-agenda-type (type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
448 (case type |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
449 ('tags "Tags: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
450 ('todo "TODO: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
451 ('tags-tree "Tags tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
452 ('todo-tree "TODO tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
453 ('occur-tree "Occur tree: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
454 (t "Agenda command ???"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
455 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
456 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
457 (defun org-mouse-list-options-menu (alloptions &optional function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
458 (let ((options (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
459 (split-string (match-string-no-properties 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
460 (print options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
461 (loop for name in alloptions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
462 collect |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
463 (vector name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
464 `(progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
465 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
466 (mapconcat 'identity |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
467 (sort (if (member ',name ',options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
468 (delete ',name ',options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
469 (cons ',name ',options)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
470 'string-lessp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
471 " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
472 nil nil nil 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
473 (when (functionp ',function) (funcall ',function))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
474 :style 'toggle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
475 :selected (and (member name options) t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
476 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
477 (defun org-mouse-clip-text (text maxlength) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
478 (if (> (length text) maxlength) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
479 (concat (substring text 0 (- maxlength 3)) "...") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
480 text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
481 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
482 (defun org-mouse-popup-global-menu () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
483 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
484 `("Main Menu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
485 ["Show Overview" org-mouse-show-overview t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
486 ["Show Headlines" org-mouse-show-headlines t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
487 ["Show All" show-all t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
488 ["Remove Highlights" org-remove-occur-highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
489 :visible org-occur-highlights] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
490 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
491 ["Check Deadlines" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
492 (if (functionp 'org-check-deadlines-and-todos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
493 (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
|
494 (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
|
495 ["Check TODOs" org-show-todo-tree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
496 ("Check Tags" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
497 ,@(org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
498 (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
|
499 '(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
|
500 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
501 ["Custom Tag ..." org-tags-sparse-tree t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
502 ["Check Phrase ..." org-occur] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
503 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
504 ["Display Agenda" org-agenda-list t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
505 ["Display Timeline" org-timeline t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
506 ["Display TODO List" org-todo-list t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
507 ("Display Tags" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
508 ,@(org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
509 (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
|
510 '(lambda (tag) (org-tags-view nil tag))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
511 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
512 ["Custom Tag ..." org-tags-view t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
513 ["Display Calendar" org-goto-calendar t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
514 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
515 ,@(org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
516 (mapcar 'car org-agenda-custom-commands) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
517 '(lambda (key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
518 (eval `(flet ((read-char-exclusive () (string-to-char ,key))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
519 (org-agenda nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
520 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
521 '(lambda (key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
522 (let ((entry (assoc key org-agenda-custom-commands))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
523 (org-mouse-clip-text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
524 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
525 ((stringp (nth 1 entry)) (nth 1 entry)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
526 ((stringp (nth 2 entry)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
527 (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
|
528 (nth 2 entry))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
529 (t "Agenda Command '%s'")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
530 30)))) |
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 ["Delete Blank Lines" delete-blank-lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
533 :visible (org-mouse-empty-line)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
534 ["Insert Checkbox" org-mouse-insert-checkbox |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
535 :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
|
536 ["Insert Checkboxes" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
537 (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
|
538 :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
|
539 ["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
|
540 :visible (org-at-item-p)]))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
541 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
542 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
543 (defun org-mouse-get-context (contextlist context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
544 (let ((contextdata (assq context contextlist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
545 (when contextdata |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
546 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
547 (goto-char (second contextdata)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
548 (re-search-forward ".*" (third contextdata)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
549 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
550 (defun org-mouse-for-each-item (function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
551 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
552 (ignore-errors |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
553 (while t (org-previous-item))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
554 (ignore-errors |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
555 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
556 (funcall function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
557 (org-next-item))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
558 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
559 (defun org-mouse-bolp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
560 "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
|
561 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
562 (skip-chars-backward " \t*") (bolp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
563 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
564 (defun org-mouse-insert-item (text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
565 (case (org-mouse-line-position) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
566 (:beginning ; insert before |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
567 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
568 (looking-at "[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
569 (open-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
570 (indent-to (- (match-end 0) (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
571 (insert "+ ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
572 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
573 (:middle ; insert after |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
574 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
575 (newline t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
576 (indent-relative) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
577 (insert "+ ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
578 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
579 (:end ; insert text here |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
580 (skip-chars-backward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
581 (kill-region (point) (point-at-eol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
582 (unless (looking-back org-mouse-punctuation) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
583 (insert (concat org-mouse-punctuation " "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
584 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
585 (insert text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
586 (beginning-of-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
587 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
588 (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
|
589 (if (eq major-mode 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
590 (org-mouse-insert-item text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
591 ad-do-it)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
592 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
593 (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
|
594 (if (eq major-mode 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
595 (org-mouse-insert-item uri) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
596 ad-do-it)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
597 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
598 (defun org-mouse-match-closure (function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
599 (let ((match (match-data t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
600 `(lambda (&rest rest) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
601 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
602 (set-match-data ',match) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
603 (apply ',function rest))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
604 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
605 (defun org-mouse-todo-keywords () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
606 (if (boundp 'org-todo-keywords-1) org-todo-keywords-1 org-todo-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
607 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
608 (defun org-mouse-match-todo-keyword () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
609 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
610 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
611 (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
|
612 (or (looking-at (concat " +" org-todo-regexp " *")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
613 (looking-at " \\( *\\)")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
614 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
615 (defun org-mouse-yank-link (click) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
616 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
617 ;; 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
|
618 (run-hooks 'mouse-leave-buffer-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
619 (mouse-set-point click) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
620 (setq mouse-selection-click-count 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
621 (delete-horizontal-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
622 (insert-for-yank (concat " [[" (current-kill 0) "]] "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
623 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
624 (defun org-mouse-context-menu (&optional event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
625 (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
|
626 (contextlist (org-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
627 (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
|
628 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
629 ((org-mouse-mark-active) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
630 (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
|
631 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
632 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
633 ["Sparse Tree" (org-occur ',region-string)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
634 ["Find in Buffer" (occur ',region-string)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
635 ["Grep in Current Dir" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
636 (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
|
637 ["Grep in Parent Dir" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
638 (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
|
639 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
640 ["Convert to Link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
641 (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
|
642 (save-excursion (goto-char (region-end)) (insert "]]")))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
643 ["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
|
644 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
645 ((save-excursion (beginning-of-line) (looking-at "#\\+STARTUP: \\(.*\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
646 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
647 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
648 ,@(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
|
649 'org-mode-restart)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
650 ((or (eolp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
651 (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
652 (looking-back " \\|\t"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
653 (org-mouse-popup-global-menu)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
654 ((get-context :checkbox) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
655 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
656 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
657 ["Toggle" org-toggle-checkbox t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
658 ["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
|
659 "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
660 ["All Clear" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
661 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
662 (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
|
663 (replace-match "[ ]"))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
664 ["All Set" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
665 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
666 (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
|
667 (replace-match "[X]"))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
668 ["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
|
669 ["All Remove" (org-mouse-for-each-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
670 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
671 (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
|
672 (org-mouse-remove-match-and-spaces))))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
673 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
674 ((and (org-mouse-looking-at "\\b\\w+" "a-zA-Z0-9_") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
675 (member (match-string 0) (org-mouse-todo-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
676 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
677 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
678 ,@(org-mouse-keyword-replace-menu (org-mouse-todo-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
679 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
680 ["Check TODOs" org-show-todo-tree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
681 ["List all TODO keywords" org-todo-list t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
682 [,(format "List only %s" (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
683 (org-todo-list (match-string 0)) 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 ((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
|
686 (member (match-string 0) stamp-prefixes)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
687 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
688 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
689 ,@(org-mouse-keyword-replace-menu stamp-prefixes) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
690 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
691 ["Check Deadlines" org-check-deadlines t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
692 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
693 ((org-mouse-looking-at org-mouse-priority-regexp "[]A-Z#") ; priority |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
694 (popup-menu `(nil ,@(org-mouse-keyword-replace-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
695 (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
|
696 ((get-context :link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
697 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
698 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
699 ["Open" org-open-at-point t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
700 ["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
|
701 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
702 ["Copy link" (kill-new (match-string 0))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
703 ["Cut link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
704 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
705 (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
|
706 (just-one-space))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
707 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
708 ["Grep for TODOs" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
709 (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
|
710 ; ["Paste file link" ((insert "file:") (yank))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
711 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
712 ((org-mouse-looking-at ":\\([A-Za-z0-9_]+\\):" "A-Za-z0-9_" -1) ;tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
713 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
714 `(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
715 [,(format "Display '%s'" (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
716 (org-tags-view nil ,(match-string 1))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
717 [,(format "Sparse Tree '%s'" (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
718 (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
|
719 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
720 ,@(org-mouse-tag-menu)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
721 ((org-at-timestamp-p) |
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 ["Show Day" org-open-at-point t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
725 ["Change Timestamp" org-time-stamp t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
726 ["Delete Timestamp" (org-mouse-delete-timestamp) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
727 ["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
|
728 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
729 ["Set for Today" org-mouse-timestamp-today] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
730 ["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
|
731 ["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
|
732 ["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
|
733 ["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
|
734 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
735 ["+ 1 Day" (org-timestamp-change 1 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
736 ["+ 1 Week" (org-timestamp-change 7 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
737 ["+ 1 Month" (org-timestamp-change 1 'month)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
738 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
739 ["- 1 Day" (org-timestamp-change -1 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
740 ["- 1 Week" (org-timestamp-change -7 'day)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
741 ["- 1 Month" (org-timestamp-change -1 'month)]))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
742 ((get-context :table-special) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
743 (let ((mdata (match-data))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
744 (incf (car mdata) 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
745 (store-match-data mdata)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
746 (message "match: %S" (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
747 (popup-menu `(nil ,@(org-mouse-keyword-replace-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
748 '(" " "!" "^" "_" "$" "#" "*" "'") 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
749 (lambda (mark) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
750 (case (string-to-char mark) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
751 (? "( ) Nothing Special") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
752 (?! "(!) Column Names") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
753 (?^ "(^) Field Names Above") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
754 (?_ "(^) Field Names Below") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
755 (?$ "($) Formula Parameters") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
756 (?# "(#) Recalculation: Auto") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
757 (?* "(*) Recalculation: Manual") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
758 (?' "(') Recalculation: None"))) t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
759 ((assq :table contextlist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
760 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
761 '(nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
762 ["Align Table" org-ctrl-c-ctrl-c] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
763 ["Blank Field" org-table-blank-field] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
764 ["Edit Field" org-table-edit-field] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
765 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
766 ("Column" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
767 ["Move Column Left" org-metaleft] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
768 ["Move Column Right" org-metaright] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
769 ["Delete Column" org-shiftmetaleft] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
770 ["Insert Column" org-shiftmetaright] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
771 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
772 ["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
|
773 ("Row" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
774 ["Move Row Up" org-metaup] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
775 ["Move Row Down" org-metadown] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
776 ["Delete Row" org-shiftmetaup] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
777 ["Insert Row" org-shiftmetadown] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
778 ["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
|
779 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
780 ["Insert Hline" org-table-insert-hline]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
781 ("Rectangle" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
782 ["Copy Rectangle" org-copy-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
783 ["Cut Rectangle" org-cut-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
784 ["Paste Rectangle" org-paste-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
785 ["Fill Rectangle" org-table-wrap-region]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
786 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
787 ["Set Column Formula" org-table-eval-formula] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
788 ["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
|
789 ["Edit Formulas" org-table-edit-formulas] |
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 ["Recalculate Line" org-table-recalculate] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
792 ["Recalculate All" (org-table-recalculate '(4))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
793 ["Iterate All" (org-table-recalculate '(16))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
794 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
795 ["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
|
796 ["Sum Column/Rectangle" org-table-sum |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
797 :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
|
798 ["Field Info" org-table-field-info] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
799 ["Debug Formulas" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
800 (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
|
801 :style toggle :selected org-table-formula-debug] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
802 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
803 ((and (assq :headline contextlist) (not (eolp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
804 (let ((priority (org-mouse-get-priority t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
805 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
806 `("Headline Menu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
807 ("Tags and Priorities" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
808 ,@(org-mouse-keyword-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
809 (org-mouse-priority-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
810 '(lambda (keyword) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
811 (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
|
812 priority "Priority %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
813 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
814 ,@(org-mouse-tag-menu)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
815 ("TODO Status" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
816 ,@(progn (org-mouse-match-todo-keyword) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
817 (org-mouse-keyword-replace-menu (org-mouse-todo-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
818 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
819 ["Show Tags" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
820 (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
|
821 :visible (not org-mouse-direct)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
822 ["Show Priority" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
823 (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
|
824 :visible (not org-mouse-direct)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
825 ,@(if org-mouse-direct '("--") nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
826 ["New Heading" org-mouse-insert-heading :visible org-mouse-direct] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
827 ["Set Deadline" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
828 (progn (org-mouse-end-headline) (insert " ") (org-deadline)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
829 :active (not (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
830 (org-mouse-re-search-line org-deadline-regexp)))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
831 ["Schedule Task" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
832 (progn (org-mouse-end-headline) (insert " ") (org-schedule)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
833 :active (not (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
834 (org-mouse-re-search-line org-scheduled-regexp)))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
835 ["Insert Timestamp" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
836 (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
|
837 ; ["Timestamp (inactive)" org-time-stamp-inactive t] |
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 ["Archive Subtree" org-archive-subtree] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
840 ["Cut Subtree" org-cut-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
841 ["Copy Subtree" org-copy-special] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
842 ["Paste Subtree" org-paste-special :visible org-mouse-direct] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
843 ("Sort Children" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
844 ["Alphabetically" (org-sort-entries nil ?a)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
845 ["Numerically" (org-sort-entries nil ?n)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
846 ["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
|
847 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
848 ["Reverse Alphabetically" (org-sort-entries nil ?A)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
849 ["Reverse Numerically" (org-sort-entries nil ?N)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
850 ["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
|
851 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
852 ["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
|
853 )))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
854 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
855 (org-mouse-popup-global-menu)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
856 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
857 ;; (defun org-mouse-at-regexp (regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
858 ;; (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
859 ;; (let ((point (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
860 ;; (bol (progn (beginning-of-line) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
861 ;; (eol (progn (end-of-line) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
862 ;; (goto-char point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
863 ;; (re-search-backward regexp bol 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
864 ;; (and (not (eolp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
865 ;; (progn (forward-char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
866 ;; (re-search-forward regexp eol t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
867 ;; (<= (match-beginning 0) point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
868 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
869 (defun org-mouse-mark-active () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
870 (and mark-active transient-mark-mode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
871 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
872 (defun org-mouse-in-region-p (pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
873 (and (org-mouse-mark-active) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
874 (>= pos (region-beginning)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
875 (< pos (region-end)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
876 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
877 (defun org-mouse-down-mouse (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
878 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
879 (setq this-command last-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
880 (unless (and (= 1 (event-click-count event)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
881 (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
|
882 (mouse-drag-region event))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
883 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
884 (add-hook 'org-mode-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
885 '(lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
886 (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
|
887 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
888 ; (define-key org-mouse-map [follow-link] 'mouse-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
889 (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
890 (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
891 (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
892 (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
893 (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
894 (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
895 (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
896 (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
897 (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
898 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
899 (font-lock-add-keywords nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
900 `((,outline-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
901 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
902 'prepend) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
903 ("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
904 (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) 'prepend)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
905 ("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
906 (2 `(face bold keymap ,org-mouse-map mouse-face highlight) t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
907 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
908 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
909 (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
|
910 (let ((context (org-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
911 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
912 ((assq :headline-stars context) (org-cycle)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
913 ((assq :checkbox context) (org-toggle-checkbox)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
914 ((assq :item-bullet context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
915 (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
|
916 (t ad-do-it)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
917 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
918 (defun org-mouse-move-tree-start (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
919 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
920 (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
|
921 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
922 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
923 (defun org-mouse-make-marker (position) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
924 (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
|
925 (copy-marker (posn-point position)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
926 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
927 (defun org-mouse-move-tree (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
928 ;; todo: handle movements between different buffers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
929 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
930 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
931 (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
|
932 (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
|
933 (sbuf (marker-buffer start)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
934 (ebuf (marker-buffer end))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
935 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
936 (when (and sbuf ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
937 (set-buffer sbuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
938 (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
939 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
940 (if (and (eq sbuf ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
941 (equal |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
942 (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
943 (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
|
944 ;; if the same line then promote/demote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
945 (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
|
946 ;; if different lines then move |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
947 (org-cut-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
948 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
949 (set-buffer ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
950 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
951 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
952 (when (and (eq sbuf ebuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
953 (equal |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
954 (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
955 (save-excursion (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
956 (org-back-to-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
957 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
958 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
959 (if (eobp) (newline) (forward-char))) |
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 (when (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
962 (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
|
963 (when (> end (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
964 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
965 (end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
966 (if (eobp) (newline) (forward-char)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
967 (setq level (1+ level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
968 (org-paste-subtree level) |
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 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
971 (when (bolp) (delete-char -1)))))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
972 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
973 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
974 (defun org-mouse-transform-to-outline () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
975 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
976 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
977 (let ((minlevel 1000) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
978 (replace-text (concat (match-string 0) "* "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
979 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
980 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
981 (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
|
982 (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
|
983 (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
|
984 (forward-line))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
985 (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
|
986 (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
|
987 (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
|
988 (replace-match replace-text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
989 (forward-line)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
990 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
991 (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
|
992 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
993 (defun org-mouse-do-remotely (command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
994 ; (org-agenda-check-no-diary) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
995 (when (get-text-property (point) 'org-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
996 (let* ((anticol (- (point-at-eol) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
997 (marker (get-text-property (point) 'org-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
998 (buffer (marker-buffer marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
999 (pos (marker-position marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1000 (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
|
1001 (buffer-read-only nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1002 (newhead "--- removed ---") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1003 (org-mouse-direct nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1004 (org-mouse-main-buffer (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1005 (when (eq (with-current-buffer buffer major-mode) 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1006 (let ((endmarker (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1007 (set-buffer buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1008 (outline-end-of-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1009 (forward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1010 (copy-marker (point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1011 (org-with-remote-undo buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1012 (with-current-buffer buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1013 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1014 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1015 (org-show-hidden-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1016 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1017 (and (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1018 (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
|
1019 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1020 (setq marker (copy-marker (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1021 (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
|
1022 (funcall command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1023 (message "_cmd: %S" _cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1024 (message "this-command: %S" this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1025 (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
|
1026 (setq newhead (org-get-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1027 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1028 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1029 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1030 (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
|
1031 t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1032 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1033 (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
|
1034 (or (org-mouse-do-remotely 'org-mouse-context-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1035 (popup-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1036 '("Agenda" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1037 ("Agenda Files") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1038 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1039 ["Undo" (progn (message "last command: %S" last-command) (setq this-command 'org-agenda-undo) (org-agenda-undo)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1040 :visible (if (eq last-command 'org-agenda-undo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1041 org-agenda-pending-undo-list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1042 org-agenda-undo-list)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1043 ["Rebuild Buffer" org-agenda-redo t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1044 ["New Diary Entry" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1045 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
|
1046 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1047 ["Goto Today" org-agenda-goto-today |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1048 (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
|
1049 ["Display Calendar" org-agenda-goto-calendar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1050 (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
|
1051 ("Calendar Commands" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1052 ["Phases of the Moon" org-agenda-phases-of-moon |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1053 (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1054 ["Sunrise/Sunset" org-agenda-sunrise-sunset |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1055 (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1056 ["Holidays" org-agenda-holidays |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1057 (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1058 ["Convert" org-agenda-convert-date |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1059 (org-agenda-check-type nil 'agenda 'timeline)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1060 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1061 ["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
|
1062 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1063 ["Day View" org-agenda-day-view |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1064 :active (org-agenda-check-type nil 'agenda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1065 :style radio :selected (equal org-agenda-ndays 1)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1066 ["Week View" org-agenda-week-view |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1067 :active (org-agenda-check-type nil 'agenda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1068 :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
|
1069 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1070 ["Show Logbook entries" org-agenda-log-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1071 :style toggle :selected org-agenda-show-log |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1072 :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
|
1073 ["Include Diary" org-agenda-toggle-diary |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1074 :style toggle :selected org-agenda-include-diary |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1075 :active (org-agenda-check-type nil 'agenda)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1076 ["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
|
1077 :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
|
1078 :active (org-agenda-check-type nil 'agenda)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1079 ["Follow Mode" org-agenda-follow-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1080 :style toggle :selected org-agenda-follow-mode] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1081 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1082 ["Quit" org-agenda-quit t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1083 ["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
|
1084 )))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1085 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1086 (defun org-mouse-get-gesture (event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1087 (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
|
1088 (endxy (posn-x-y (event-end event)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1089 (if (< (car startxy) (car endxy)) :right :left))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1090 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1091 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1092 ; (setq org-agenda-mode-hook nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1093 (add-hook 'org-agenda-mode-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1094 '(lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1095 (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1096 (define-key org-agenda-keymap |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1097 (if (featurep 'xemacs) [button3] [mouse-3]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1098 'org-mouse-show-context-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1099 (define-key org-agenda-keymap [down-mouse-3] 'org-mouse-move-tree-start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1100 (define-key org-agenda-keymap [C-mouse-4] 'org-agenda-earlier) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1101 (define-key org-agenda-keymap [C-mouse-5] 'org-agenda-later) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1102 (define-key org-agenda-keymap [drag-mouse-3] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1103 '(lambda (event) (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1104 (case (org-mouse-get-gesture event) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1105 (:left (org-agenda-earlier 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1106 (:right (org-agenda-later 1))))))) |
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 (provide 'org-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1109 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1110 ;; arch-tag: ff1ae557-3529-41a3-95c6-baaebdcc280f |