Mercurial > emacs
annotate lisp/org/org.el @ 97384:60d1b6f5616e
*** empty log message ***
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 10 Aug 2008 00:59:33 +0000 |
parents | adc2dffbdfc3 |
children | 11deca4a880b |
rev | line source |
---|---|
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1 ;;; org.el --- Outline-based notes management and organizer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2 ;; Carstens outline-mode for keeping track of everything. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6 ;; Keywords: outlines, hypermedia, calendar, wp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7 ;; Homepage: http://orgmode.org |
97027
adc2dffbdfc3
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96975
diff
changeset
|
8 ;; Version: 6.06b |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11 ;; |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94457
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94457
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94457
diff
changeset
|
15 ;; (at your option) any later version. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
16 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 ;; GNU General Public License for more details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94457
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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 ;;; Commentary: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
27 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
28 ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
29 ;; project planning with a fast and effective plain-text system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
30 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
31 ;; Org-mode develops organizational tasks around NOTES files that contain |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
32 ;; information about projects as plain text. Org-mode is implemented on |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 ;; top of outline-mode, which makes it possible to keep the content of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 ;; large files well structured. Visibility cycling and structure editing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
35 ;; help to work with the tree. Tables are easily created with a built-in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 ;; table editor. Org-mode supports ToDo items, deadlines, time stamps, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
37 ;; and scheduling. It dynamically compiles entries into an agenda that |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 ;; utilizes and smoothly integrates much of the Emacs calendar and diary. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
39 ;; Plain text URL-like links connect to websites, emails, Usenet |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 ;; messages, BBDB entries, and any files related to the projects. For |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 ;; printing and sharing of notes, an Org-mode file can be exported as a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
42 ;; structured ASCII file, as HTML, or (todo and agenda items only) as an |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
43 ;; iCalendar file. It can also serve as a publishing tool for a set of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
44 ;; linked webpages. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
45 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
46 ;; Installation and Activation |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
47 ;; --------------------------- |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 ;; See the corresponding sections in the manual at |
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 ;; http://orgmode.org/org.html#Installation |
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 ;; Documentation |
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 ;; The documentation of Org-mode can be found in the TeXInfo file. The |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
55 ;; distribution also contains a PDF version of it. At the homepage of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
56 ;; Org-mode, you can read the same text online as HTML. There is also an |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
57 ;; excellent reference card made by Philip Rooke. This card can be found |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 ;; in the etc/ directory of Emacs 22. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
59 ;; |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
60 ;; A list of recent changes can be found at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
61 ;; http://orgmode.org/Changes.html |
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 ;;; Code: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
64 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
65 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
66 (defvar org-table-formula-constants-local nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
67 "Local version of `org-table-formula-constants'.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
68 (make-variable-buffer-local 'org-table-formula-constants-local) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
69 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
70 ;;;; Require other packages |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
71 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
72 (eval-when-compile |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
73 (require 'cl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
74 (require 'gnus-sum) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
75 (require 'calendar)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
76 ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
77 ;; the file noutline.el being loaded. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
78 (if (featurep 'xemacs) (condition-case nil (require 'noutline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
79 ;; We require noutline, which might be provided in outline.el |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
80 (require 'outline) (require 'noutline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
81 ;; Other stuff we need. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
82 (require 'time-date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
83 (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
84 (require 'easymenu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
85 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
86 (require 'org-macs) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
87 (require 'org-compat) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
88 (require 'org-faces) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
89 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
90 ;;;; Customization variables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
91 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
92 ;;; Version |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
93 |
97027
adc2dffbdfc3
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96975
diff
changeset
|
94 (defconst org-version "6.06b" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
95 "The version number of the file org.el.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
96 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
97 (defun org-version (&optional here) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
98 "Show the org-mode version in the echo area. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
99 With prefix arg HERE, insert it at point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
100 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
101 (let ((version (format "Org-mode version %s" org-version))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
102 (message version) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
103 (if here |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
104 (insert version)))) |
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 ;;; Compatibility constants |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 ;;; The custom variables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
109 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
110 (defgroup org nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
111 "Outline-based notes management and organizer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
112 :tag "Org" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
113 :group 'outlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
114 :group 'hypermedia |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
115 :group 'calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
116 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
117 (defcustom org-load-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
118 "Hook that is run after org.el has been loaded." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
119 :group 'org |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
120 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
122 (defvar org-modules) ; defined below |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
123 (defvar org-modules-loaded nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
124 "Have the modules been loaded already?") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
125 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
126 (defun org-load-modules-maybe (&optional force) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
127 "Load all extensions listed in `org-default-extensions'." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
128 (when (or force (not org-modules-loaded)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
129 (mapc (lambda (ext) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
130 (condition-case nil (require ext) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
131 (error (message "Problems while trying to load feature `%s'" ext)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
132 org-modules) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
133 (setq org-modules-loaded t))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
134 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
135 (defun org-set-modules (var value) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
136 "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
137 (set var value) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
138 (when (featurep 'org) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
139 (org-load-modules-maybe 'force))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
140 |
94876
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
141 (when (org-bound-and-true-p org-modules) |
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
142 (let ((a (member 'org-infojs org-modules))) |
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
143 (and a (setcar a 'org-jsinfo)))) |
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
144 |
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
145 (defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-wl) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
146 "Modules that should always be loaded together with org.el. |
94764
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
147 If a description starts with <C>, the file is not part of Emacs |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
148 and loading it will require that you have downloaded and properly installed |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
149 the org-mode distribution. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
150 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
151 You can also use this system to load external packages (i.e. neither Org |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
152 core modules, not modules from the CONTRIB directory). Just add symbols |
94764
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
153 to the end of the list. If the package is called org-xyz.el, then you need |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
154 to add the symbol `xyz', and the package must have a call to |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
155 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
156 (provide 'org-xyz)" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
157 :group 'org |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
158 :set 'org-set-modules |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
159 :type |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
160 '(set :greedy t |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
161 (const :tag " bbdb: Links to BBDB entries" org-bbdb) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
162 (const :tag " bibtex: Links to BibTeX entries" org-bibtex) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
163 (const :tag " gnus: Links to GNUS folders/messages" org-gnus) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
164 (const :tag " id: Global id's for identifying entries" org-id) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
165 (const :tag " info: Links to Info nodes" org-info) |
94876
ee90761f44b6
* org/org.el (org-modules): Repair problems with loading
Carsten Dominik <dominik@science.uva.nl>
parents:
94764
diff
changeset
|
166 (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
167 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
168 (const :tag " mac-message: Links to messages in Apple Mail" org-mac-message) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
169 (const :tag " mew Links to Mew folders/messages" org-mew) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
170 (const :tag " mhe: Links to MHE folders/messages" org-mhe) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
171 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
172 (const :tag " vm: Links to VM folders/messages" org-vm) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
173 (const :tag " wl: Links to Wanderlust folders/messages" org-wl) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
174 (const :tag " mouse: Additional mouse support" org-mouse) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
175 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
176 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
177 (const :tag "C annotation-helper: Call Remeber directly from Browser" org-annotation-helper) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
178 (const :tag "C bookmark: Org links to bookmarks" org-bookmark) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
179 (const :tag "C depend: TODO dependencies for Org-mode" org-depend) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
180 (const :tag "C elisp-symbol: Org links to emacs-lisp symbols" org-elisp-symbol) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
181 (const :tag "C eval: Include command output as text" org-eval) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
182 (const :tag "C expiry: Expiry mechanism for Org entries" org-expiry) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
183 (const :tag "C id: Global id's for identifying entries" org-id) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
184 (const :tag "C interactive-query: Interactive modification of tags query" org-interactive-query) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
185 (const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
186 (const :tag "C man: Support for links to manpages in Org-mode" org-man) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
187 (const :tag "C mtags: Support for muse-like tags" org-mtags) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
188 (const :tag "C panel: Simple routines for us with bad memory" org-panel) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
189 (const :tag "C registry: A registry for Org links" org-registry) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
190 (const :tag "C org2rem: Convert org appointments into reminders" org2rem) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
191 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
192 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
193 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
194 (repeat :tag "External packages" :inline t (symbol :tag "Package")))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
195 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
196 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
197 (defgroup org-startup nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
198 "Options concerning startup of Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
199 :tag "Org Startup" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
200 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
201 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
202 (defcustom org-startup-folded t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
203 "Non-nil means, entering Org-mode will switch to OVERVIEW. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
204 This can also be configured on a per-file basis by adding one of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
205 the following lines anywhere in the buffer: |
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 #+STARTUP: fold |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
208 #+STARTUP: nofold |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
209 #+STARTUP: content" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
210 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
211 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
212 (const :tag "nofold: show all" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
213 (const :tag "fold: overview" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
214 (const :tag "content: all headlines" content))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
215 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
216 (defcustom org-startup-truncated t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
217 "Non-nil means, entering Org-mode will set `truncate-lines'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
218 This is useful since some lines containing links can be very long and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
219 uninteresting. Also tables look terrible when wrapped." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
220 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
221 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
222 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
223 (defcustom org-startup-indented nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
224 "Non-nil means, turn on `org-indent-mode' on startup. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
225 This can also be configured on a per-file basis by adding one of |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
226 the following lines anywhere in the buffer: |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
227 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
228 #+STARTUP: localindent |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
229 #+STARTUP: indent |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
230 #+STARTUP: noindent" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
231 :group 'org-structure |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
232 :type '(choice |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
233 (const :tag "Not" nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
234 (const :tag "Locally" local) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
235 (const :tag "Globally (slow on startup in large files)" t))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
236 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
237 (defcustom org-startup-align-all-tables nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
238 "Non-nil means, align all tables when visiting a file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
239 This is useful when the column width in tables is forced with <N> cookies |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
240 in table fields. Such tables will look correct only after the first re-align. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
241 This can also be configured on a per-file basis by adding one of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
242 the following lines anywhere in the buffer: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
243 #+STARTUP: align |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
244 #+STARTUP: noalign" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
245 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
246 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
247 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
248 (defcustom org-insert-mode-line-in-empty-file nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
249 "Non-nil means insert the first line setting Org-mode in empty files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
250 When the function `org-mode' is called interactively in an empty file, this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
251 normally means that the file name does not automatically trigger Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
252 To ensure that the file will always be in Org-mode in the future, a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
253 line enforcing Org-mode will be inserted into the buffer, if this option |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
254 has been set." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
255 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
256 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
257 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
258 (defcustom org-replace-disputed-keys nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
259 "Non-nil means use alternative key bindings for some keys. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
260 Org-mode uses S-<cursor> keys for changing timestamps and priorities. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
261 These keys are also used by other packages like `CUA-mode' or `windmove.el'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
262 If you want to use Org-mode together with one of these other modes, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
263 or more generally if you would like to move some Org-mode commands to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
264 other keys, set this variable and configure the keys with the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
265 `org-disputed-keys'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
266 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
267 This option is only relevant at load-time of Org-mode, and must be set |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
268 *before* org.el is loaded. Changing it requires a restart of Emacs to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
269 become effective." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
270 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
271 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
272 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
273 (if (fboundp 'defvaralias) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
274 (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
275 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
276 (defcustom org-disputed-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
277 '(([(shift up)] . [(meta p)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
278 ([(shift down)] . [(meta n)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
279 ([(shift left)] . [(meta -)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
280 ([(shift right)] . [(meta +)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
281 ([(control shift right)] . [(meta shift +)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
282 ([(control shift left)] . [(meta shift -)])) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
283 "Keys for which Org-mode and other modes compete. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
284 This is an alist, cars are the default keys, second element specifies |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
285 the alternative to use when `org-replace-disputed-keys' is t. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
286 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
287 Keys can be specified in any syntax supported by `define-key'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
288 The value of this option takes effect only at Org-mode's startup, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
289 therefore you'll have to restart Emacs to apply it after changing." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
290 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
291 :type 'alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
292 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
293 (defun org-key (key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
294 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
295 Or return the original if not disputed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
296 (if org-replace-disputed-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
297 (let* ((nkey (key-description key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
298 (x (org-find-if (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
299 (equal (key-description (car x)) nkey)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
300 org-disputed-keys))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
301 (if x (cdr x) key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
302 key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
303 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
304 (defun org-find-if (predicate seq) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
305 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
306 (while seq |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
307 (if (funcall predicate (car seq)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
308 (throw 'exit (car seq)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
309 (pop seq))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
310 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
311 (defun org-defkey (keymap key def) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
312 "Define a key, possibly translated, as returned by `org-key'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
313 (define-key keymap (org-key key) def)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
314 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
315 (defcustom org-ellipsis nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
316 "The ellipsis to use in the Org-mode outline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
317 When nil, just use the standard three dots. When a string, use that instead, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
318 When a face, use the standart 3 dots, but with the specified face. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
319 The change affects only Org-mode (which will then use its own display table). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
320 Changing this requires executing `M-x org-mode' in a buffer to become |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
321 effective." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
322 :group 'org-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
323 :type '(choice (const :tag "Default" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
324 (face :tag "Face" :value org-warning) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
325 (string :tag "String" :value "...#"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
326 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
327 (defvar org-display-table nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
328 "The display table for org-mode, in case `org-ellipsis' is non-nil.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
329 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
330 (defgroup org-keywords nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
331 "Keywords in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
332 :tag "Org Keywords" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
333 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
334 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
335 (defcustom org-deadline-string "DEADLINE:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
336 "String to mark deadline entries. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
337 A deadline is this string, followed by a time stamp. Should be a word, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
338 terminated by a colon. You can insert a schedule keyword and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
339 a timestamp with \\[org-deadline]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
340 Changes become only effective after restarting Emacs." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
341 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
342 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
343 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
344 (defcustom org-scheduled-string "SCHEDULED:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
345 "String to mark scheduled TODO entries. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
346 A schedule is this string, followed by a time stamp. Should be a word, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
347 terminated by a colon. You can insert a schedule keyword and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
348 a timestamp with \\[org-schedule]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
349 Changes become only effective after restarting Emacs." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
350 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
351 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
352 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
353 (defcustom org-closed-string "CLOSED:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
354 "String used as the prefix for timestamps logging closing a TODO entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
355 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
356 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
357 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
358 (defcustom org-clock-string "CLOCK:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
359 "String used as prefix for timestamps clocking work hours on an item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
360 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
361 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
362 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
363 (defcustom org-comment-string "COMMENT" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
364 "Entries starting with this keyword will never be exported. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
365 An entry can be toggled between COMMENT and normal with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
366 \\[org-toggle-comment]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
367 Changes become only effective after restarting Emacs." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
368 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
369 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
370 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
371 (defcustom org-quote-string "QUOTE" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
372 "Entries starting with this keyword will be exported in fixed-width font. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
373 Quoting applies only to the text in the entry following the headline, and does |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
374 not extend beyond the next headline, even if that is lower level. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
375 An entry can be toggled between QUOTE and normal with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
376 \\[org-toggle-fixed-width-section]." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
377 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
378 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
379 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
380 (defconst org-repeat-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
381 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*\\([.+]?\\+[0-9]+[dwmy]\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
382 "Regular expression for specifying repeated events. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
383 After a match, group 1 contains the repeat expression.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
384 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
385 (defgroup org-structure nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
386 "Options concerning the general structure of Org-mode files." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
387 :tag "Org Structure" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
388 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
389 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
390 (defgroup org-reveal-location nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
391 "Options about how to make context of a location visible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
392 :tag "Org Reveal Location" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
393 :group 'org-structure) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
394 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
395 (defconst org-context-choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
396 '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
397 (const :tag "Always" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
398 (const :tag "Never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
399 (repeat :greedy t :tag "Individual contexts" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
400 (cons |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
401 (choice :tag "Context" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
402 (const agenda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
403 (const org-goto) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
404 (const occur-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
405 (const tags-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
406 (const link-search) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
407 (const mark-goto) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
408 (const bookmark-jump) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
409 (const isearch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
410 (const default)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
411 (boolean)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
412 "Contexts for the reveal options.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
413 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
414 (defcustom org-show-hierarchy-above '((default . t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
415 "Non-nil means, show full hierarchy when revealing a location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
416 Org-mode often shows locations in an org-mode file which might have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
417 been invisible before. When this is set, the hierarchy of headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
418 above the exposed location is shown. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
419 Turning this off for example for sparse trees makes them very compact. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
420 Instead of t, this can also be an alist specifying this option for different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
421 contexts. Valid contexts are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
422 agenda when exposing an entry from the agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
423 org-goto when using the command `org-goto' on key C-c C-j |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
424 occur-tree when using the command `org-occur' on key C-c / |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
425 tags-tree when constructing a sparse tree based on tags matches |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
426 link-search when exposing search matches associated with a link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
427 mark-goto when exposing the jump goal of a mark |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
428 bookmark-jump when exposing a bookmark location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
429 isearch when exiting from an incremental search |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
430 default default for all contexts not set explicitly" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
431 :group 'org-reveal-location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
432 :type org-context-choice) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
433 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
434 (defcustom org-show-following-heading '((default . nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
435 "Non-nil means, show following heading when revealing a location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
436 Org-mode often shows locations in an org-mode file which might have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
437 been invisible before. When this is set, the heading following the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
438 match is shown. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
439 Turning this off for example for sparse trees makes them very compact, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
440 but makes it harder to edit the location of the match. In such a case, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
441 use the command \\[org-reveal] to show more context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
442 Instead of t, this can also be an alist specifying this option for different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
443 contexts. See `org-show-hierarchy-above' for valid contexts." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
444 :group 'org-reveal-location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
445 :type org-context-choice) |
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 (defcustom org-show-siblings '((default . nil) (isearch t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
448 "Non-nil means, show all sibling heading when revealing a location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
449 Org-mode often shows locations in an org-mode file which might have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
450 been invisible before. When this is set, the sibling of the current entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
451 heading are all made visible. If `org-show-hierarchy-above' is t, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
452 the same happens on each level of the hierarchy above the current entry. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
453 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
454 By default this is on for the isearch context, off for all other contexts. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
455 Turning this off for example for sparse trees makes them very compact, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
456 but makes it harder to edit the location of the match. In such a case, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
457 use the command \\[org-reveal] to show more context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
458 Instead of t, this can also be an alist specifying this option for different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
459 contexts. See `org-show-hierarchy-above' for valid contexts." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
460 :group 'org-reveal-location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
461 :type org-context-choice) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
462 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
463 (defcustom org-show-entry-below '((default . nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
464 "Non-nil means, show the entry below a headline when revealing a location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
465 Org-mode often shows locations in an org-mode file which might have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
466 been invisible before. When this is set, the text below the headline that is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
467 exposed is also shown. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
468 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
469 By default this is off for all contexts. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
470 Instead of t, this can also be an alist specifying this option for different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
471 contexts. See `org-show-hierarchy-above' for valid contexts." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
472 :group 'org-reveal-location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
473 :type org-context-choice) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
474 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
475 (defcustom org-indirect-buffer-display 'other-window |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
476 "How should indirect tree buffers be displayed? |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
477 This applies to indirect buffers created with the commands |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
478 \\[org-tree-to-indirect-buffer] and \\[org-agenda-tree-to-indirect-buffer]. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
479 Valid values are: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
480 current-window Display in the current window |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
481 other-window Just display in another window. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
482 dedicated-frame Create one new frame, and re-use it each time. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
483 new-frame Make a new frame each time. Note that in this case |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
484 previously-made indirect buffers are kept, and you need to |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
485 kill these buffers yourself." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
486 :group 'org-structure |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
487 :group 'org-agenda-windows |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
488 :type '(choice |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
489 (const :tag "In current window" current-window) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
490 (const :tag "In current frame, other window" other-window) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
491 (const :tag "Each time a new frame" new-frame) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
492 (const :tag "One dedicated frame" dedicated-frame))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
493 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
494 (defgroup org-cycle nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
495 "Options concerning visibility cycling in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
496 :tag "Org Cycle" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
497 :group 'org-structure) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
498 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
499 (defcustom org-drawers '("PROPERTIES" "CLOCK") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
500 "Names of drawers. Drawers are not opened by cycling on the headline above. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
501 Drawers only open with a TAB on the drawer line itself. A drawer looks like |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
502 this: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
503 :DRAWERNAME: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
504 ..... |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
505 :END: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
506 The drawer \"PROPERTIES\" is special for capturing properties through |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
507 the property API. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
508 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
509 Drawers can be defined on the per-file basis with a line like: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
510 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
511 #+DRAWERS: HIDDEN STATE PROPERTIES" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
512 :group 'org-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
513 :type '(repeat (string :tag "Drawer Name"))) |
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 (defcustom org-cycle-global-at-bob nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
516 "Cycle globally if cursor is at beginning of buffer and not at a headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
517 This makes it possible to do global cycling without having to use S-TAB or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
518 C-u TAB. For this special case to work, the first line of the buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
519 must not be a headline - it may be empty ot some other text. When used in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
520 this way, `org-cycle-hook' is disables temporarily, to make sure the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
521 cursor stays at the beginning of the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
522 When this option is nil, don't do anything special at the beginning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
523 of the buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
524 :group 'org-cycle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
525 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
526 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
527 (defcustom org-cycle-emulate-tab t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
528 "Where should `org-cycle' emulate TAB. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
529 nil Never |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
530 white Only in completely white lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
531 whitestart Only at the beginning of lines, before the first non-white char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
532 t Everywhere except in headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
533 exc-hl-bol Everywhere except at the start of a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
534 If TAB is used in a place where it does not emulate TAB, the current subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
535 visibility is cycled." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
536 :group 'org-cycle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
537 :type '(choice (const :tag "Never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
538 (const :tag "Only in completely white lines" white) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
539 (const :tag "Before first char in a line" whitestart) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
540 (const :tag "Everywhere except in headlines" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
541 (const :tag "Everywhere except at bol in headlines" exc-hl-bol) |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
544 (defcustom org-cycle-separator-lines 2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
545 "Number of empty lines needed to keep an empty line between collapsed trees. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
546 If you leave an empty line between the end of a subtree and the following |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
547 headline, this empty line is hidden when the subtree is folded. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
548 Org-mode will leave (exactly) one empty line visible if the number of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
549 empty lines is equal or larger to the number given in this variable. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
550 So the default 2 means, at least 2 empty lines after the end of a subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
551 are needed to produce free space between a collapsed subtree and the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
552 following headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
553 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
554 Special case: when 0, never leave empty lines in collapsed view." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
555 :group 'org-cycle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
556 :type 'integer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
557 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
558 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
559 org-cycle-hide-drawers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
560 org-cycle-show-empty-lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
561 org-optimize-window-after-visibility-change) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
562 "Hook that is run after `org-cycle' has changed the buffer visibility. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
563 The function(s) in this hook must accept a single argument which indicates |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
564 the new state that was set by the most recent `org-cycle' command. The |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
565 argument is a symbol. After a global state change, it can have the values |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
566 `overview', `content', or `all'. After a local state change, it can have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
567 the values `folded', `children', or `subtree'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
568 :group 'org-cycle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
569 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
570 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
571 (defgroup org-edit-structure nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
572 "Options concerning structure editing in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
573 :tag "Org Edit Structure" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
574 :group 'org-structure) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
575 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
576 (defcustom org-odd-levels-only nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
577 "Non-nil means, skip even levels and only use odd levels for the outline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
578 This has the effect that two stars are being added/taken away in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
579 promotion/demotion commands. It also influences how levels are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
580 handled by the exporters. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
581 Changing it requires restart of `font-lock-mode' to become effective |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
582 for fontification also in regions already fontified. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
583 You may also set this on a per-file basis by adding one of the following |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
584 lines to the buffer: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
585 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
586 #+STARTUP: odd |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
587 #+STARTUP: oddeven" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
588 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
589 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
590 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
591 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
592 (defcustom org-adapt-indentation t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
593 "Non-nil means, adapt indentation when promoting and demoting. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
594 When this is set and the *entire* text in an entry is indented, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
595 indentation is increased by one space in a demotion command, and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
596 decreased by one in a promotion command. If any line in the entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
597 body starts at column 0, indentation is not changed at all." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
598 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
599 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
600 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
601 (defcustom org-special-ctrl-a/e nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
602 "Non-nil means `C-a' and `C-e' behave specially in headlines and items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
603 When t, `C-a' will bring back the cursor to the beginning of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
604 headline text, i.e. after the stars and after a possible TODO keyword. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
605 In an item, this will be the position after the bullet. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
606 When the cursor is already at that position, another `C-a' will bring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
607 it to the beginning of the line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
608 `C-e' will jump to the end of the headline, ignoring the presence of tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
609 in the headline. A second `C-e' will then jump to the true end of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
610 line, after any tags. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
611 When set to the symbol `reversed', the first `C-a' or `C-e' works normally, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
612 and only a directly following, identical keypress will bring the cursor |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
613 to the special positions." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
614 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
615 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
616 (const :tag "off" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
617 (const :tag "after bullet first" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
618 (const :tag "border first" reversed))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
619 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
620 (if (fboundp 'defvaralias) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
621 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
622 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
623 (defcustom org-special-ctrl-k nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
624 "Non-nil means `C-k' will behave specially in headlines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
625 When nil, `C-k' will call the default `kill-line' command. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
626 When t, the following will happen while the cursor is in the headline: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
627 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
628 - When the cursor is at the beginning of a headline, kill the entire |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
629 line and possible the folded subtree below the line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
630 - When in the middle of the headline text, kill the headline up to the tags. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
631 - When after the headline text, kill the tags." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
632 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
633 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
634 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
635 (defcustom org-M-RET-may-split-line '((default . t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
636 "Non-nil means, M-RET will split the line at the cursor position. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
637 When nil, it will go to the end of the line before making a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
638 new line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
639 You may also set this option in a different way for different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
640 contexts. Valid contexts are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
641 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
642 headline when creating a new headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
643 item when creating a new item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
644 table in a table field |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
645 default the value to be used for all contexts not explicitly |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
646 customized" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
647 :group 'org-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
648 :group 'org-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
649 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
650 (const :tag "Always" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
651 (const :tag "Never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
652 (repeat :greedy t :tag "Individual contexts" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
653 (cons |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
654 (choice :tag "Context" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
655 (const headline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
656 (const item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
657 (const table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
658 (const default)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
659 (boolean))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
660 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
661 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
662 (defcustom org-blank-before-new-entry '((heading . nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
663 (plain-list-item . nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
664 "Should `org-insert-heading' leave a blank line before new heading/item? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
665 The value is an alist, with `heading' and `plain-list-item' as car, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
666 and a boolean flag as cdr." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
667 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
668 :type '(list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
669 (cons (const heading) (boolean)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
670 (cons (const plain-list-item) (boolean)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
671 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
672 (defcustom org-insert-heading-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
673 "Hook being run after inserting a new heading." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
674 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
675 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
676 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
677 (defcustom org-enable-fixed-width-editor t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
678 "Non-nil means, lines starting with \":\" are treated as fixed-width. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
679 This currently only means, they are never auto-wrapped. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
680 When nil, such lines will be treated like ordinary lines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
681 See also the QUOTE keyword." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
682 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
683 :type 'boolean) |
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 (defcustom org-goto-auto-isearch t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
686 "Non-nil means, typing characters in org-goto starts incremental search." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
687 :group 'org-edit-structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
688 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
689 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
690 (defgroup org-sparse-trees nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
691 "Options concerning sparse trees in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
692 :tag "Org Sparse Trees" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
693 :group 'org-structure) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
694 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
695 (defcustom org-highlight-sparse-tree-matches t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
696 "Non-nil means, highlight all matches that define a sparse tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
697 The highlights will automatically disappear the next time the buffer is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
698 changed by an edit command." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
699 :group 'org-sparse-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
700 :type 'boolean) |
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 (defcustom org-remove-highlights-with-change t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
703 "Non-nil means, any change to the buffer will remove temporary highlights. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
704 Such highlights are created by `org-occur' and `org-clock-display'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
705 When nil, `C-c C-c needs to be used to get rid of the highlights. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
706 The highlights created by `org-preview-latex-fragment' always need |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
707 `C-c C-c' to be removed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
708 :group 'org-sparse-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
709 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
710 :type 'boolean) |
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 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
713 (defcustom org-occur-hook '(org-first-headline-recenter) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
714 "Hook that is run after `org-occur' has constructed a sparse tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
715 This can be used to recenter the window to show as much of the structure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
716 as possible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
717 :group 'org-sparse-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
718 :type 'hook) |
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 (defgroup org-plain-lists nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
721 "Options concerning plain lists in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
722 :tag "Org Plain lists" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
723 :group 'org-structure) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
724 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
725 (defcustom org-cycle-include-plain-lists nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
726 "Non-nil means, include plain lists into visibility cycling. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
727 This means that during cycling, plain list items will *temporarily* be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
728 interpreted as outline headlines with a level given by 1000+i where i is the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
729 indentation of the bullet. In all other operations, plain list items are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
730 not seen as headlines. For example, you cannot assign a TODO keyword to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
731 such an item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
732 :group 'org-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
733 :type 'boolean) |
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 (defcustom org-plain-list-ordered-item-terminator t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
736 "The character that makes a line with leading number an ordered list item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
737 Valid values are ?. and ?\). To get both terminators, use t. While |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
738 ?. may look nicer, it creates the danger that a line with leading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
739 number may be incorrectly interpreted as an item. ?\) therefore is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
740 the safe choice." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
741 :group 'org-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
742 :type '(choice (const :tag "dot like in \"2.\"" ?.) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
743 (const :tag "paren like in \"2)\"" ?\)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
744 (const :tab "both" t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
745 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
746 (defcustom org-empty-line-terminates-plain-lists nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
747 "Non-nil means, an empty line ends all plain list levels. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
748 When nil, empty lines are part of the preceeding item." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
749 :group 'org-plain-lists |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
750 :type 'boolean) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
751 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
752 (defcustom org-auto-renumber-ordered-lists t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
753 "Non-nil means, automatically renumber ordered plain lists. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
754 Renumbering happens when the sequence have been changed with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
755 \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
756 use \\[org-ctrl-c-ctrl-c] to trigger renumbering." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
757 :group 'org-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
758 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
759 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
760 (defcustom org-provide-checkbox-statistics t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
761 "Non-nil means, update checkbox statistics after insert and toggle. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
762 When this is set, checkbox statistics is updated each time you either insert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
763 a new checkbox with \\[org-insert-todo-heading] or toggle a checkbox |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
764 with \\[org-ctrl-c-ctrl-c\\]." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
765 :group 'org-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
766 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
767 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
768 (defcustom org-description-max-indent 20 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
769 "Maximum indentation for the second line of a description list. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
770 When the indentation would be larger than this, it will become |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
771 5 characters instead." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
772 :group 'org-plain-lists |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
773 :type 'integer) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
774 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
775 (defgroup org-imenu-and-speedbar nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
776 "Options concerning imenu and speedbar in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
777 :tag "Org Imenu and Speedbar" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
778 :group 'org-structure) |
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 (defcustom org-imenu-depth 2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
781 "The maximum level for Imenu access to Org-mode headlines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
782 This also applied for speedbar access." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
783 :group 'org-imenu-and-speedbar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
784 :type 'number) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
785 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
786 (defgroup org-table nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
787 "Options concerning tables in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
788 :tag "Org Table" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
789 :group 'org) |
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 (defcustom org-enable-table-editor 'optimized |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
792 "Non-nil means, lines starting with \"|\" are handled by the table editor. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
793 When nil, such lines will be treated like ordinary lines. |
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 When equal to the symbol `optimized', the table editor will be optimized to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
796 do the following: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
797 - Automatic overwrite mode in front of whitespace in table fields. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
798 This makes the structure of the table stay in tact as long as the edited |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
799 field does not exceed the column width. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
800 - Minimize the number of realigns. Normally, the table is aligned each time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
801 TAB or RET are pressed to move to another field. With optimization this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
802 happens only if changes to a field might have changed the column width. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
803 Optimization requires replacing the functions `self-insert-command', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
804 `delete-char', and `backward-delete-char' in Org-mode buffers, with a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
805 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
806 very good at guessing when a re-align will be necessary, but you can always |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
807 force one with \\[org-ctrl-c-ctrl-c]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
808 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
809 If you would like to use the optimized version in Org-mode, but the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
810 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
811 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
812 This variable can be used to turn on and off the table editor during a session, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
813 but in order to toggle optimization, a restart is required. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
814 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
815 See also the variable `org-table-auto-blank-field'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
816 :group 'org-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
817 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
818 (const :tag "off" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
819 (const :tag "on" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
820 (const :tag "on, optimized" optimized))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
821 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
822 (defcustom org-table-tab-recognizes-table.el t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
823 "Non-nil means, TAB will automatically notice a table.el table. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
824 When it sees such a table, it moves point into it and - if necessary - |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
825 calls `table-recognize-table'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
826 :group 'org-table-editing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
827 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
828 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
829 (defgroup org-link nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
830 "Options concerning links in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
831 :tag "Org Link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
832 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
833 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
834 (defvar org-link-abbrev-alist-local nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
835 "Buffer-local version of `org-link-abbrev-alist', which see. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
836 The value of this is taken from the #+LINK lines.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
837 (make-variable-buffer-local 'org-link-abbrev-alist-local) |
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 (defcustom org-link-abbrev-alist nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
840 "Alist of link abbreviations. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
841 The car of each element is a string, to be replaced at the start of a link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
842 The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
843 links in Org-mode buffers can have an optional tag after a double colon, e.g. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
844 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
845 [[linkkey:tag][description]] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
846 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
847 If REPLACE is a string, the tag will simply be appended to create the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
848 If the string contains \"%s\", the tag will be inserted there. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
849 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
850 REPLACE may also be a function that will be called with the tag as the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
851 only argument to create the link, which should be returned as a string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
852 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
853 See the manual for examples." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
854 :group 'org-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
855 :type 'alist) |
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 (defcustom org-descriptive-links t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
858 "Non-nil means, hide link part and only show description of bracket links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
859 Bracket links are like [[link][descritpion]]. This variable sets the initial |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
860 state in new org-mode buffers. The setting can then be toggled on a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
861 per-buffer basis from the Org->Hyperlinks menu." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
862 :group 'org-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
863 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
864 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
865 (defcustom org-link-file-path-type 'adaptive |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
866 "How the path name in file links should be stored. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
867 Valid values are: |
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 relative Relative to the current directory, i.e. the directory of the file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
870 into which the link is being inserted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
871 absolute Absolute path, if possible with ~ for home directory. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
872 noabbrev Absolute path, no abbreviation of home directory. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
873 adaptive Use relative path for files in the current directory and sub- |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
874 directories of it. For other files, use an absolute path." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
875 :group 'org-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
876 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
877 (const relative) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
878 (const absolute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
879 (const noabbrev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
880 (const adaptive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
881 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
882 (defcustom org-activate-links '(bracket angle plain radio tag date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
883 "Types of links that should be activated in Org-mode files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
884 This is a list of symbols, each leading to the activation of a certain link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
885 type. In principle, it does not hurt to turn on most link types - there may |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
886 be a small gain when turning off unused link types. The types are: |
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 bracket The recommended [[link][description]] or [[link]] links with hiding. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
889 angular Links in angular brackes that may contain whitespace like |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
890 <bbdb:Carsten Dominik>. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
891 plain Plain links in normal text, no whitespace, like http://google.com. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
892 radio Text that is matched by a radio target, see manual for details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
893 tag Tag settings in a headline (link to tag search). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
894 date Time stamps (link to calendar). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
895 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
896 Changing this variable requires a restart of Emacs to become effective." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
897 :group 'org-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
898 :type '(set (const :tag "Double bracket links (new style)" bracket) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
899 (const :tag "Angular bracket links (old style)" angular) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
900 (const :tag "Plain text links" plain) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
901 (const :tag "Radio target matches" radio) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
902 (const :tag "Tags" tag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
903 (const :tag "Timestamps" date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
904 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
905 (defcustom org-make-link-description-function nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
906 "Function to use to generate link descriptions from links. If |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
907 nil the link location will be used. This function must take two |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
908 parameters; the first is the link and the second the description |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
909 org-insert-link has generated, and should return the description |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
910 to use." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
911 :group 'org-link |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
912 :type 'function) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
913 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
914 (defgroup org-link-store nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
915 "Options concerning storing links in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
916 :tag "Org Store Link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
917 :group 'org-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
918 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
919 (defcustom org-email-link-description-format "Email %c: %.30s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
920 "Format of the description part of a link to an email or usenet message. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
921 The following %-excapes will be replaced by corresponding information: |
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 %F full \"From\" field |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
924 %f name, taken from \"From\" field, address if no name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
925 %T full \"To\" field |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
926 %t first name in \"To\" field, address if no name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
927 %c correspondent. Unually \"from NAME\", but if you sent it yourself, it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
928 will be \"to NAME\". See also the variable `org-from-is-user-regexp'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
929 %s subject |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
930 %m message-id. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
931 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
932 You may use normal field width specification between the % and the letter. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
933 This is for example useful to limit the length of the subject. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
934 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
935 Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\"" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
936 :group 'org-link-store |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
937 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
938 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
939 (defcustom org-from-is-user-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
940 (let (r1 r2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
941 (when (and user-mail-address (not (string= user-mail-address ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
942 (setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
943 (when (and user-full-name (not (string= user-full-name ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
944 (setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
945 (if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
946 "Regexp mached against the \"From:\" header of an email or usenet message. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
947 It should match if the message is from the user him/herself." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
948 :group 'org-link-store |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
949 :type 'regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
950 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
951 (defcustom org-context-in-file-links t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
952 "Non-nil means, file links from `org-store-link' contain context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
953 A search string will be added to the file name with :: as separator and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
954 used to find the context when the link is activated by the command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
955 `org-open-at-point'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
956 Using a prefix arg to the command \\[org-store-link] (`org-store-link') |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
957 negates this setting for the duration of the command." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
958 :group 'org-link-store |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
959 :type 'boolean) |
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 (defcustom org-keep-stored-link-after-insertion nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
962 "Non-nil means, keep link in list for entire session. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
963 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
964 The command `org-store-link' adds a link pointing to the current |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
965 location to an internal list. These links accumulate during a session. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
966 The command `org-insert-link' can be used to insert links into any |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
967 Org-mode file (offering completion for all stored links). When this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
968 option is nil, every link which has been inserted once using \\[org-insert-link] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
969 will be removed from the list, to make completing the unused links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
970 more efficient." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
971 :group 'org-link-store |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
972 :type 'boolean) |
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 (defgroup org-link-follow nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
975 "Options concerning following links in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
976 :tag "Org Follow Link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
977 :group 'org-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
978 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
979 (defcustom org-follow-link-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
980 "Hook that is run after a link has been followed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
981 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
982 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
983 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
984 (defcustom org-tab-follows-link nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
985 "Non-nil means, on links TAB will follow the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
986 Needs to be set before org.el is loaded." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
987 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
988 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
989 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
990 (defcustom org-return-follows-link nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
991 "Non-nil means, on links RET will follow the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
992 Needs to be set before org.el is loaded." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
993 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
994 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
995 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
996 (defcustom org-mouse-1-follows-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
997 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
998 "Non-nil means, mouse-1 on a link will follow the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
999 A longer mouse click will still set point. Does not work on XEmacs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1000 Needs to be set before org.el is loaded." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1001 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1002 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1003 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1004 (defcustom org-mark-ring-length 4 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1005 "Number of different positions to be recorded in the ring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1006 Changing this requires a restart of Emacs to work correctly." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1007 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1008 :type 'interger) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1009 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1010 (defcustom org-link-frame-setup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1011 '((vm . vm-visit-folder-other-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1012 (gnus . gnus-other-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1013 (file . find-file-other-window)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1014 "Setup the frame configuration for following links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1015 When following a link with Emacs, it may often be useful to display |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1016 this link in another window or frame. This variable can be used to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1017 set this up for the different types of links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1018 For VM, use any of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1019 `vm-visit-folder' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1020 `vm-visit-folder-other-frame' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1021 For Gnus, use any of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1022 `gnus' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1023 `gnus-other-frame' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1024 For FILE, use any of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1025 `find-file' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1026 `find-file-other-window' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1027 `find-file-other-frame' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1028 For the calendar, use the variable `calendar-setup'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1029 For BBDB, it is currently only possible to display the matches in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1030 another window." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1031 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1032 :type '(list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1033 (cons (const vm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1034 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1035 (const vm-visit-folder) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1036 (const vm-visit-folder-other-window) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1037 (const vm-visit-folder-other-frame))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1038 (cons (const gnus) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1039 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1040 (const gnus) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1041 (const gnus-other-frame))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1042 (cons (const file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1043 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1044 (const find-file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1045 (const find-file-other-window) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1046 (const find-file-other-frame))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1047 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1048 (defcustom org-display-internal-link-with-indirect-buffer nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1049 "Non-nil means, use indirect buffer to display infile links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1050 Activating internal links (from one location in a file to another location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1051 in the same file) normally just jumps to the location. When the link is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1052 activated with a C-u prefix (or with mouse-3), the link is displayed in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1053 another window. When this option is set, the other window actually displays |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1054 an indirect buffer clone of the current buffer, to avoid any visibility |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1055 changes to the current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1056 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1057 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1058 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1059 (defcustom org-open-non-existing-files nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1060 "Non-nil means, `org-open-file' will open non-existing files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1061 When nil, an error will be generated." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1062 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1063 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1064 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1065 (defcustom org-open-directory-means-index-dot-org nil |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1066 "Non-nil means, a link to a directory really means to index.org. |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1067 When nil, following a directory link will run dired or open a finder/explorer |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1068 window on that directory." |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1069 :group 'org-link-follow |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1070 :type 'boolean) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
1071 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1072 (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1073 "Function and arguments to call for following mailto links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1074 This is a list with the first element being a lisp function, and the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1075 remaining elements being arguments to the function. In string arguments, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1076 %a will be replaced by the address, and %s will be replaced by the subject |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1077 if one was given like in <mailto:arthur@galaxy.org::this subject>." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1078 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1079 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1080 (const :tag "browse-url" (browse-url-mail "mailto:%a?subject=%s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1081 (const :tag "compose-mail" (compose-mail "%a" "%s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1082 (const :tag "message-mail" (message-mail "%a" "%s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1083 (cons :tag "other" (function) (repeat :tag "argument" sexp)))) |
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 (defcustom org-confirm-shell-link-function 'yes-or-no-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1086 "Non-nil means, ask for confirmation before executing shell links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1087 Shell links can be dangerous: just think about a link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1088 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1089 [[shell:rm -rf ~/*][Google Search]] |
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 This link would show up in your Org-mode document as \"Google Search\", |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1092 but really it would remove your entire home directory. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1093 Therefore we advise against setting this variable to nil. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1094 Just change it to `y-or-n-p' of you want to confirm with a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1095 single keystroke rather than having to type \"yes\"." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1096 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1097 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1098 (const :tag "with yes-or-no (safer)" yes-or-no-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1099 (const :tag "with y-or-n (faster)" y-or-n-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1100 (const :tag "no confirmation (dangerous)" nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1101 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1102 (defcustom org-confirm-elisp-link-function 'yes-or-no-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1103 "Non-nil means, ask for confirmation before executing Emacs Lisp links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1104 Elisp links can be dangerous: just think about a link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1105 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1106 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] |
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 This link would show up in your Org-mode document as \"Google Search\", |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1109 but really it would remove your entire home directory. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1110 Therefore we advise against setting this variable to nil. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1111 Just change it to `y-or-n-p' of you want to confirm with a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1112 single keystroke rather than having to type \"yes\"." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1113 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1114 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1115 (const :tag "with yes-or-no (safer)" yes-or-no-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1116 (const :tag "with y-or-n (faster)" y-or-n-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1117 (const :tag "no confirmation (dangerous)" nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1118 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1119 (defconst org-file-apps-defaults-gnu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1120 '((remote . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1121 (t . mailcap)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1122 "Default file applications on a UNIX or GNU/Linux system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1123 See `org-file-apps'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1124 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1125 (defconst org-file-apps-defaults-macosx |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1126 '((remote . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1127 (t . "open %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1128 ("ps" . "gv %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1129 ("ps.gz" . "gv %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1130 ("eps" . "gv %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1131 ("eps.gz" . "gv %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1132 ("dvi" . "xdvi %s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1133 ("fig" . "xfig %s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1134 "Default file applications on a MacOS X system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1135 The system \"open\" is known as a default, but we use X11 applications |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1136 for some files for which the OS does not have a good default. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1137 See `org-file-apps'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1138 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1139 (defconst org-file-apps-defaults-windowsnt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1140 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1141 '(remote . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1142 (cons t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1143 (list (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1144 'mswindows-shell-execute |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1145 'w32-shell-execute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1146 "open" 'file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1147 "Default file applications on a Windows NT system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1148 The system \"open\" is used for most files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1149 See `org-file-apps'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1150 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1151 (defcustom org-file-apps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1152 '( |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1153 ("txt" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1154 ("tex" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1155 ("ltx" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1156 ("org" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1157 ("el" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1158 ("bib" . emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1159 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1160 "External applications for opening `file:path' items in a document. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1161 Org-mode uses system defaults for different file types, but |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1162 you can use this variable to set the application for a given file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1163 extension. The entries in this list are cons cells where the car identifies |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1164 files and the cdr the corresponding command. Possible values for the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1165 file identifier are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1166 \"ext\" A string identifying an extension |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1167 `directory' Matches a directory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1168 `remote' Matches a remote file, accessible through tramp or efs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1169 Remote files most likely should be visited through Emacs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1170 because external applications cannot handle such paths. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1171 t Default for all remaining files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1172 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1173 Possible values for the command are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1174 `emacs' The file will be visited by the current Emacs process. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1175 `default' Use the default application for this file type. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1176 string A command to be executed by a shell; %s will be replaced |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1177 by the path to the file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1178 sexp A Lisp form which will be evaluated. The file path will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1179 be available in the Lisp variable `file'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1180 For more examples, see the system specific constants |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1181 `org-file-apps-defaults-macosx' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1182 `org-file-apps-defaults-windowsnt' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1183 `org-file-apps-defaults-gnu'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1184 :group 'org-link-follow |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1185 :type '(repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1186 (cons (choice :value "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1187 (string :tag "Extension") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1188 (const :tag "Default for unrecognized files" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1189 (const :tag "Remote file" remote) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1190 (const :tag "Links to a directory" directory)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1191 (choice :value "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1192 (const :tag "Visit with Emacs" emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1193 (const :tag "Use system default" default) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1194 (string :tag "Command") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1195 (sexp :tag "Lisp form"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1196 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1197 (defgroup org-refile nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1198 "Options concerning refiling entries in Org-mode." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1199 :tag "Org Remember" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1200 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1201 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1202 (defcustom org-directory "~/org" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1203 "Directory with org files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1204 This directory will be used as default to prompt for org files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1205 Used by the hooks for remember.el." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1206 :group 'org-refile |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1207 :group 'org-remember |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1208 :type 'directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1209 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1210 (defcustom org-default-notes-file "~/.notes" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1211 "Default target for storing notes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1212 Used by the hooks for remember.el. This can be a string, or nil to mean |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1213 the value of `remember-data-file'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1214 You can set this on a per-template basis with the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1215 `org-remember-templates'." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1216 :group 'org-refile |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1217 :group 'org-remember |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1218 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1219 (const :tag "Default from remember-data-file" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1220 file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1221 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1222 (defcustom org-goto-interface 'outline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1223 "The default interface to be used for `org-goto'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1224 Allowed vaues are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1225 outline The interface shows an outline of the relevant file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1226 and the correct heading is found by moving through |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1227 the outline or by searching with incremental search. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1228 outline-path-completion Headlines in the current buffer are offered via |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1229 completion." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1230 :group 'org-refile |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1231 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1232 (const :tag "Outline" outline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1233 (const :tag "Outline-path-completion" outline-path-completion))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1234 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1235 (defcustom org-reverse-note-order nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1236 "Non-nil means, store new notes at the beginning of a file or entry. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1237 When nil, new notes will be filed to the end of a file or entry. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1238 This can also be a list with cons cells of regular expressions that |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1239 are matched against file names, and values." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1240 :group 'org-remember |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1241 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1242 (const :tag "Reverse always" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1243 (const :tag "Reverse never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1244 (repeat :tag "By file name regexp" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1245 (cons regexp boolean)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1246 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1247 (defcustom org-refile-targets nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1248 "Targets for refiling entries with \\[org-refile]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1249 This is list of cons cells. Each cell contains: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1250 - a specification of the files to be considered, either a list of files, |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1251 or a symbol whose function or variable value will be used to retrieve |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1252 a file name or a list of file names. Nil means, refile to a different |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1253 heading in the current buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1254 - A specification of how to find candidate refile targets. This may be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1255 any of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1256 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1257 This tag has to be present in all target headlines, inheritance will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1258 not be considered. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1259 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1260 todo keyword. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1261 - a cons cell (:regexp . \"REGEXP\") with a regular expression matching |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1262 headlines that are refiling targets. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1263 - a cons cell (:level . N). Any headline of level N is considered a target. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1264 - a cons cell (:maxlevel . N). Any headline with level <= N is a target." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1265 :group 'org-remember |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1266 :type '(repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1267 (cons |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1268 (choice :value org-agenda-files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1269 (const :tag "All agenda files" org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1270 (const :tag "Current buffer" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1271 (function) (variable) (file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1272 (choice :tag "Identify target headline by" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1273 (cons :tag "Specific tag" (const :tag) (string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1274 (cons :tag "TODO keyword" (const :todo) (string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1275 (cons :tag "Regular expression" (const :regexp) (regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1276 (cons :tag "Level number" (const :level) (integer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1277 (cons :tag "Max Level number" (const :maxlevel) (integer)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1278 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1279 (defcustom org-refile-use-outline-path nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1280 "Non-nil means, provide refile targets as paths. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1281 So a level 3 headline will be available as level1/level2/level3. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1282 When the value is `file', also include the file name (without directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1283 into the path. When `full-file-path', include the full file path." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1284 :group 'org-remember |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1285 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1286 (const :tag "Not" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1287 (const :tag "Yes" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1288 (const :tag "Start with file name" file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1289 (const :tag "Start with full file path" full-file-path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1290 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1291 (defgroup org-todo nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1292 "Options concerning TODO items in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1293 :tag "Org TODO" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1294 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1295 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1296 (defgroup org-progress nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1297 "Options concerning Progress logging in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1298 :tag "Org Progress" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1299 :group 'org-time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1300 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1301 (defcustom org-todo-keywords '((sequence "TODO" "DONE")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1302 "List of TODO entry keyword sequences and their interpretation. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1303 \\<org-mode-map>This is a list of sequences. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1304 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1305 Each sequence starts with a symbol, either `sequence' or `type', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1306 indicating if the keywords should be interpreted as a sequence of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1307 action steps, or as different types of TODO items. The first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1308 keywords are states requiring action - these states will select a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1309 for inclusion into the global TODO list Org-mode produces. If one of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1310 the \"keywords\" is the vertical bat \"|\" the remaining keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1311 signify that no further action is necessary. If \"|\" is not found, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1312 the last keyword is treated as the only DONE state of the sequence. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1313 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1314 The command \\[org-todo] cycles an entry through these states, and one |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1315 additional state where no keyword is present. For details about this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1316 cycling, see the manual. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1317 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1318 TODO keywords and interpretation can also be set on a per-file basis with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1319 the special #+SEQ_TODO and #+TYP_TODO lines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1320 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1321 Each keyword can optionally specify a character for fast state selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1322 \(in combination with the variable `org-use-fast-todo-selection') |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1323 and specifiers for state change logging, using the same syntax |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1324 that is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1325 that the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1326 indicates to record a time stamp each time this state is selected. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1327 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1328 Each keyword may also specify if a timestamp or a note should be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1329 recorded when entering or leaving the state, by adding additional |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1330 characters in the parenthesis after the keyword. This looks like this: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1331 \"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1332 record only the time of the state change. With X and Y being either |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1333 \"@\" or \"!\", \"X/Y\" means use X when entering the state, and use |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1334 Y when leaving the state if and only if the *target* state does not |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1335 define X. You may omit any of the fast-selection key or X or /Y, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1336 so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1337 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1338 For backward compatibility, this variable may also be just a list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1339 of keywords - in this case the interptetation (sequence or type) will be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1340 taken from the (otherwise obsolete) variable `org-todo-interpretation'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1341 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1342 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1343 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1344 (repeat :tag "Old syntax, just keywords" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1345 (string :tag "Keyword")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1346 (repeat :tag "New syntax" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1347 (cons |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1348 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1349 :tag "Interpretation" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1350 (const :tag "Sequence (cycling hits every state)" sequence) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1351 (const :tag "Type (cycling directly to DONE)" type)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1352 (repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1353 (string :tag "Keyword")))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1354 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1355 (defvar org-todo-keywords-1 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1356 "All TODO and DONE keywords active in a buffer.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1357 (make-variable-buffer-local 'org-todo-keywords-1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1358 (defvar org-todo-keywords-for-agenda nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1359 (defvar org-done-keywords-for-agenda nil) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1360 (defvar org-agenda-contributing-files nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1361 (defvar org-not-done-keywords nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1362 (make-variable-buffer-local 'org-not-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1363 (defvar org-done-keywords nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1364 (make-variable-buffer-local 'org-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1365 (defvar org-todo-heads nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1366 (make-variable-buffer-local 'org-todo-heads) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1367 (defvar org-todo-sets nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1368 (make-variable-buffer-local 'org-todo-sets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1369 (defvar org-todo-log-states nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1370 (make-variable-buffer-local 'org-todo-log-states) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1371 (defvar org-todo-kwd-alist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1372 (make-variable-buffer-local 'org-todo-kwd-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1373 (defvar org-todo-key-alist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1374 (make-variable-buffer-local 'org-todo-key-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1375 (defvar org-todo-key-trigger nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1376 (make-variable-buffer-local 'org-todo-key-trigger) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1377 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1378 (defcustom org-todo-interpretation 'sequence |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1379 "Controls how TODO keywords are interpreted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1380 This variable is in principle obsolete and is only used for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1381 backward compatibility, if the interpretation of todo keywords is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1382 not given already in `org-todo-keywords'. See that variable for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1383 more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1384 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1385 :group 'org-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1386 :type '(choice (const sequence) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1387 (const type))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1388 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1389 (defcustom org-use-fast-todo-selection 'prefix |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1390 "Non-nil means, use the fast todo selection scheme with C-c C-t. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1391 This variable describes if and under what circumstances the cycling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1392 mechanism for TODO keywords will be replaced by a single-key, direct |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1393 selection scheme. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1394 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1395 When nil, fast selection is never used. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1396 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1397 When the symbol `prefix', it will be used when `org-todo' is called with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1398 a prefix argument, i.e. `C-u C-c C-t' in an Org-mode buffer, and `C-u t' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1399 in an agenda buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1400 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1401 When t, fast selection is used by default. In this case, the prefix |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1402 argument forces cycling instead. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1403 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1404 In all cases, the special interface is only used if access keys have actually |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1405 been assigned by the user, i.e. if keywords in the configuration are followed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1406 by a letter in parenthesis, like TODO(t)." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1407 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1408 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1409 (const :tag "Never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1410 (const :tag "By default" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1411 (const :tag "Only with C-u C-c C-t" prefix))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1412 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1413 (defcustom org-provide-todo-statistics t |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1414 "Non-nil means, update todo statistics after insert and toggle. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1415 When this is set, todo statistics is updated in the parent of the current |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1416 entry each time a todo state is changed." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1417 :group 'org-todo |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1418 :type 'boolean) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1419 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1420 (defcustom org-after-todo-state-change-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1421 "Hook which is run after the state of a TODO item was changed. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1422 The new state (a string with a TODO keyword, or nil) is available in the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1423 Lisp variable `state'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1424 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1425 :type 'hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1426 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1427 (defcustom org-log-done nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1428 "Non-nil means, record a CLOSED timestamp when moving an entry to DONE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1429 When equal to the list (done), also prompt for a closing note. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1430 This can also be configured on a per-file basis by adding one of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1431 the following lines anywhere in the buffer: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1432 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1433 #+STARTUP: logdone |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1434 #+STARTUP: lognotedone |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1435 #+STARTUP: nologdone" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1436 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1437 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1438 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1439 (const :tag "No logging" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1440 (const :tag "Record CLOSED timestamp" time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1441 (const :tag "Record CLOSED timestamp with closing note." note))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1442 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1443 ;; Normalize old uses of org-log-done. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1444 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1445 ((eq org-log-done t) (setq org-log-done 'time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1446 ((and (listp org-log-done) (memq 'done org-log-done)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1447 (setq org-log-done 'note))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1448 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1449 (defcustom org-log-note-clock-out nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1450 "Non-nil means, recored a note when clocking out of an item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1451 This can also be configured on a per-file basis by adding one of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1452 the following lines anywhere in the buffer: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1453 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1454 #+STARTUP: lognoteclock-out |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1455 #+STARTUP: nolognoteclock-out" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1456 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1457 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1458 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1459 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1460 (defcustom org-log-done-with-time t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1461 "Non-nil means, the CLOSED time stamp will contain date and time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1462 When nil, only the date will be recorded." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1463 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1464 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1465 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1466 (defcustom org-log-note-headings |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1467 '((done . "CLOSING NOTE %t") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1468 (state . "State %-12s %t") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1469 (note . "Note taken on %t") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1470 (clock-out . "")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1471 "Headings for notes added to entries. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1472 The value is an alist, with the car being a symbol indicating the note |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1473 context, and the cdr is the heading to be used. The heading may also be the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1474 empty string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1475 %t in the heading will be replaced by a time stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1476 %s will be replaced by the new TODO state, in double quotes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1477 %u will be replaced by the user name. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1478 %U will be replaced by the full user name." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1479 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1480 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1481 :type '(list :greedy t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1482 (cons (const :tag "Heading when closing an item" done) string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1483 (cons (const :tag |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1484 "Heading when changing todo state (todo sequence only)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1485 state) string) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1486 (cons (const :tag "Heading when just taking a note" note) string) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1487 (cons (const :tag "Heading when clocking out" clock-out) string))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1488 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1489 (unless (assq 'note org-log-note-headings) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1490 (push '(note . "%t") org-log-note-headings)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1491 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1492 (defcustom org-log-states-order-reversed t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1493 "Non-nil means, the latest state change note will be directly after heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1494 When nil, the notes will be orderer according to time." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1495 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1496 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1497 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1498 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1499 (defcustom org-log-repeat 'time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1500 "Non-nil means, record moving through the DONE state when triggering repeat. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1501 An auto-repeating tasks is immediately switched back to TODO when marked |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1502 done. If you are not logging state changes (by adding \"@\" or \"!\" to |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1503 the TODO keyword definition, or recording a closing note by setting |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1504 `org-log-done', there will be no record of the task moving through DONE. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1505 This variable forces taking a note anyway. Possible values are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1506 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1507 nil Don't force a record |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1508 time Record a time stamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1509 note Record a note |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1510 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1511 This option can also be set with on a per-file-basis with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1512 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1513 #+STARTUP: logrepeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1514 #+STARTUP: lognoterepeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1515 #+STARTUP: nologrepeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1516 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1517 You can have local logging settings for a subtree by setting the LOGGING |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1518 property to one or more of these keywords." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1519 :group 'org-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1520 :group 'org-progress |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1521 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1522 (const :tag "Don't force a record" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1523 (const :tag "Force recording the DONE state" time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1524 (const :tag "Force recording a note with the DONE state" note))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1525 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1526 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1527 (defgroup org-priorities nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1528 "Priorities in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1529 :tag "Org Priorities" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1530 :group 'org-todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1531 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1532 (defcustom org-highest-priority ?A |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1533 "The highest priority of TODO items. A character like ?A, ?B etc. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1534 Must have a smaller ASCII number than `org-lowest-priority'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1535 :group 'org-priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1536 :type 'character) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1537 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1538 (defcustom org-lowest-priority ?C |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1539 "The lowest priority of TODO items. A character like ?A, ?B etc. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1540 Must have a larger ASCII number than `org-highest-priority'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1541 :group 'org-priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1542 :type 'character) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1543 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1544 (defcustom org-default-priority ?B |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1545 "The default priority of TODO items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1546 This is the priority an item get if no explicit priority is given." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1547 :group 'org-priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1548 :type 'character) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1549 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1550 (defcustom org-priority-start-cycle-with-default t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1551 "Non-nil means, start with default priority when starting to cycle. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1552 When this is nil, the first step in the cycle will be (depending on the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1553 command used) one higher or lower that the default priority." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1554 :group 'org-priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1555 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1556 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1557 (defgroup org-time nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1558 "Options concerning time stamps and deadlines in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1559 :tag "Org Time" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1560 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1561 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1562 (defcustom org-insert-labeled-timestamps-at-point nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1563 "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1564 When nil, these labeled time stamps are forces into the second line of an |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1565 entry, just after the headline. When scheduling from the global TODO list, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1566 the time stamp will always be forced into the second line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1567 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1568 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1569 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1570 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1571 "Formats for `format-time-string' which are used for time stamps. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1572 It is not recommended to change this constant.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1573 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1574 (defcustom org-time-stamp-rounding-minutes '(0 5) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1575 "Number of minutes to round time stamps to. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1576 These are two values, the first applies when first creating a time stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1577 The second applies when changing it with the commands `S-up' and `S-down'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1578 When changing the time stamp, this means that it will change in steps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1579 of N minutes, as given by the second value. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1580 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1581 When a setting is 0 or 1, insert the time unmodified. Useful rounding |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1582 numbers should be factors of 60, so for example 5, 10, 15. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1583 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1584 When this is larger than 1, you can still force an exact time-stamp by using |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1585 a double prefix argument to a time-stamp command like `C-c .' or `C-c !', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1586 and by using a prefix arg to `S-up/down' to specify the exact number |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1587 of minutes to shift." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1588 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1589 :get '(lambda (var) ; Make sure all entries have 5 elements |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1590 (if (integerp (default-value var)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1591 (list (default-value var) 5) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1592 (default-value var))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1593 :type '(list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1594 (integer :tag "when inserting times") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1595 (integer :tag "when modifying times"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1596 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1597 ;; Normalize old customizations of this variable. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1598 (when (integerp org-time-stamp-rounding-minutes) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1599 (setq org-time-stamp-rounding-minutes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1600 (list org-time-stamp-rounding-minutes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1601 org-time-stamp-rounding-minutes))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1602 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1603 (defcustom org-display-custom-times nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1604 "Non-nil means, overlay custom formats over all time stamps. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1605 The formats are defined through the variable `org-time-stamp-custom-formats'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1606 To turn this on on a per-file basis, insert anywhere in the file: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1607 #+STARTUP: customtime" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1608 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1609 :set 'set-default |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1610 :type 'sexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1611 (make-variable-buffer-local 'org-display-custom-times) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1612 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1613 (defcustom org-time-stamp-custom-formats |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1614 '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1615 "Custom formats for time stamps. See `format-time-string' for the syntax. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1616 These are overlayed over the default ISO format if the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1617 `org-display-custom-times' is set. Time like %H:%M should be at the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1618 end of the second format." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1619 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1620 :type 'sexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1621 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1622 (defun org-time-stamp-format (&optional long inactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1623 "Get the right format for a time string." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1624 (let ((f (if long (cdr org-time-stamp-formats) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1625 (car org-time-stamp-formats)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1626 (if inactive |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1627 (concat "[" (substring f 1 -1) "]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1628 f))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1629 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1630 (defcustom org-time-clocksum-format "%d:%02d" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1631 "The format string used when creating CLOCKSUM lines, or when |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1632 org-mode generates a time duration." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1633 :group 'org-time |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1634 :type 'string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1635 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1636 (defcustom org-deadline-warning-days 14 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1637 "No. of days before expiration during which a deadline becomes active. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1638 This variable governs the display in sparse trees and in the agenda. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1639 When 0 or negative, it means use this number (the absolute value of it) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1640 even if a deadline has a different individual lead time specified." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1641 :group 'org-time |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1642 :group 'org-agenda-daily/weekly |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1643 :type 'number) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1644 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1645 (defcustom org-read-date-prefer-future t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1646 "Non-nil means, assume future for incomplete date input from user. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1647 This affects the following situations: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1648 1. The user gives a day, but no month. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1649 For example, if today is the 15th, and you enter \"3\", Org-mode will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1650 read this as the third of *next* month. However, if you enter \"17\", |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1651 it will be considered as *this* month. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1652 2. The user gives a month but not a year. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1653 For example, if it is april and you enter \"feb 2\", this will be read |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1654 as feb 2, *next* year. \"May 5\", however, will be this year. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1655 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1656 Currently this does not work for ISO week specifications. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1657 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1658 When this option is nil, the current month and year will always be used |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1659 as defaults." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1660 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1661 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1662 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1663 (defcustom org-read-date-display-live t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1664 "Non-nil means, display current interpretation of date prompt live. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1665 This display will be in an overlay, in the minibuffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1666 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1667 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1668 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1669 (defcustom org-read-date-popup-calendar t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1670 "Non-nil means, pop up a calendar when prompting for a date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1671 In the calendar, the date can be selected with mouse-1. However, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1672 minibuffer will also be active, and you can simply enter the date as well. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1673 When nil, only the minibuffer will be available." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1674 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1675 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1676 (if (fboundp 'defvaralias) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1677 (defvaralias 'org-popup-calendar-for-date-prompt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1678 'org-read-date-popup-calendar)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1679 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1680 (defcustom org-extend-today-until 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1681 "The hour when your day really ends. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1682 This has influence for the following applications: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1683 - When switching the agenda to \"today\". It it is still earlier than |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1684 the time given here, the day recognized as TODAY is actually yesterday. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1685 - When a date is read from the user and it is still before the time given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1686 here, the current date and time will be assumed to be yesterday, 23:59. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1687 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1688 FIXME: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1689 IMPORTANT: This is still a very experimental feature, it may disappear |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1690 again or it may be extended to mean more things." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1691 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1692 :type 'number) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1693 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1694 (defcustom org-edit-timestamp-down-means-later nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1695 "Non-nil means, S-down will increase the time in a time stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1696 When nil, S-up will increase." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1697 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1698 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1699 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1700 (defcustom org-calendar-follow-timestamp-change t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1701 "Non-nil means, make the calendar window follow timestamp changes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1702 When a timestamp is modified and the calendar window is visible, it will be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1703 moved to the new date." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1704 :group 'org-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1705 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1706 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1707 (defgroup org-tags nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1708 "Options concerning tags in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1709 :tag "Org Tags" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1710 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1711 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1712 (defcustom org-tag-alist nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1713 "List of tags allowed in Org-mode files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1714 When this list is nil, Org-mode will base TAG input on what is already in the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1715 buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1716 The value of this variable is an alist, the car of each entry must be a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1717 keyword as a string, the cdr may be a character that is used to select |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1718 that tag through the fast-tag-selection interface. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1719 See the manual for details." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1720 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1721 :type '(repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1722 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1723 (cons (string :tag "Tag name") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1724 (character :tag "Access char")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1725 (const :tag "Start radio group" (:startgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1726 (const :tag "End radio group" (:endgroup))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1727 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1728 (defvar org-file-tags nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1729 "List of tags that can be inherited by all entries in the file. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1730 The tags will be inherited if the variable `org-use-tag-inheritance' |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1731 says they should be. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1732 This variable is populated from #+TAG lines.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1733 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1734 (defcustom org-use-fast-tag-selection 'auto |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1735 "Non-nil means, use fast tag selection scheme. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1736 This is a special interface to select and deselect tags with single keys. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1737 When nil, fast selection is never used. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1738 When the symbol `auto', fast selection is used if and only if selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1739 characters for tags have been configured, either through the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1740 `org-tag-alist' or through a #+TAGS line in the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1741 When t, fast selection is always used and selection keys are assigned |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1742 automatically if necessary." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1743 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1744 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1745 (const :tag "Always" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1746 (const :tag "Never" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1747 (const :tag "When selection characters are configured" 'auto))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1748 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1749 (defcustom org-fast-tag-selection-single-key nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1750 "Non-nil means, fast tag selection exits after first change. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1751 When nil, you have to press RET to exit it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1752 During fast tag selection, you can toggle this flag with `C-c'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1753 This variable can also have the value `expert'. In this case, the window |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1754 displaying the tags menu is not even shown, until you press C-c again." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1755 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1756 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1757 (const :tag "No" nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1758 (const :tag "Yes" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1759 (const :tag "Expert" expert))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1760 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1761 (defvar org-fast-tag-selection-include-todo nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1762 "Non-nil means, fast tags selection interface will also offer TODO states. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1763 This is an undocumented feature, you should not rely on it.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1764 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1765 (defcustom org-tags-column (if (featurep 'xemacs) -79 -80) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1766 "The column to which tags should be indented in a headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1767 If this number is positive, it specifies the column. If it is negative, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1768 it means that the tags should be flushright to that column. For example, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1769 -80 works well for a normal 80 character screen." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1770 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1771 :type 'integer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1772 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1773 (defcustom org-auto-align-tags t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1774 "Non-nil means, realign tags after pro/demotion of TODO state change. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1775 These operations change the length of a headline and therefore shift |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1776 the tags around. With this options turned on, after each such operation |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1777 the tags are again aligned to `org-tags-column'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1778 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1779 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1780 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1781 (defcustom org-use-tag-inheritance t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1782 "Non-nil means, tags in levels apply also for sublevels. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1783 When nil, only the tags directly given in a specific line apply there. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1784 If this option is t, a match early-on in a tree can lead to a large |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1785 number of matches in the subtree. If you only want to see the first |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1786 match in a tree during a search, check out the variable |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1787 `org-tags-match-list-sublevels'. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1788 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1789 This may also be a list of tags that should be inherited, or a regexp that |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1790 matches tags that should be inherited." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1791 :group 'org-tags |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1792 :type '(choice |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1793 (const :tag "Not" nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1794 (const :tag "Always" t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1795 (repeat :tag "Specific tags" (string :tag "Tag")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1796 (regexp :tag "Tags matched by regexp"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1797 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1798 (defun org-tag-inherit-p (tag) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1799 "Check if TAG is one that should be inherited." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1800 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1801 ((eq org-use-tag-inheritance t) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1802 ((not org-use-tag-inheritance) nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1803 ((stringp org-use-tag-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1804 (string-match org-use-tag-inheritance tag)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1805 ((listp org-use-tag-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1806 (member tag org-use-tag-inheritance)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1807 (t (error "Invalid setting of `org-use-tag-inheritance'")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1808 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1809 (defcustom org-tags-match-list-sublevels t |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1810 "Non-nil means list also sublevels of headlines matching tag search. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1811 Because of tag inheritance (see variable `org-use-tag-inheritance'), |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1812 the sublevels of a headline matching a tag search often also match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1813 the same search. Listing all of them can create very long lists. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1814 Setting this variable to nil causes subtrees of a match to be skipped. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1815 This option is off by default, because inheritance in on. If you turn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1816 inheritance off, you very likely want to turn this option on. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1817 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1818 As a special case, if the tag search is restricted to TODO items, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1819 value of this variable is ignored and sublevels are always checked, to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1820 make sure all corresponding TODO items find their way into the list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1821 :group 'org-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1822 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1823 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1824 (defvar org-tags-history nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1825 "History of minibuffer reads for tags.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1826 (defvar org-last-tags-completion-table nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1827 "The last used completion table for tags.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1828 (defvar org-after-tags-change-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1829 "Hook that is run after the tags in a line have changed.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1830 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1831 (defgroup org-properties nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1832 "Options concerning properties in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1833 :tag "Org Properties" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1834 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1835 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1836 (defcustom org-property-format "%-10s %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1837 "How property key/value pairs should be formatted by `indent-line'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1838 When `indent-line' hits a property definition, it will format the line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1839 according to this format, mainly to make sure that the values are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1840 lined-up with respect to each other." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1841 :group 'org-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1842 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1843 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1844 (defcustom org-use-property-inheritance nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1845 "Non-nil means, properties apply also for sublevels. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1846 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1847 This setting is chiefly used during property searches. Turning it on can |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1848 cause significant overhead when doing a search, which is why it is not |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1849 on by default. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1850 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1851 When nil, only the properties directly given in the current entry count. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1852 When t, every property is inherited. The value may also be a list of |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1853 properties that should have inheritance, or a regular expression matching |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1854 properties that should be inherited. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1855 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1856 However, note that some special properties use inheritance under special |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1857 circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1858 and the properties ending in \"_ALL\" when they are used as descriptor |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1859 for valid values of a property. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1860 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1861 Note for programmers: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1862 When querying an entry with `org-entry-get', you can control if inheritance |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1863 should be used. By default, `org-entry-get' looks only at the local |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1864 properties. You can request inheritance by setting the inherit argument |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1865 to t (to force inheritance) or to `selective' (to respect the setting |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1866 in this variable)." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1867 :group 'org-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1868 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1869 (const :tag "Not" nil) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1870 (const :tag "Always" t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1871 (repeat :tag "Specific properties" (string :tag "Property")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1872 (regexp :tag "Properties matched by regexp"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1873 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1874 (defun org-property-inherit-p (property) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1875 "Check if PROPERTY is one that should be inherited." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1876 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1877 ((eq org-use-property-inheritance t) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1878 ((not org-use-property-inheritance) nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1879 ((stringp org-use-property-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1880 (string-match org-use-property-inheritance property)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1881 ((listp org-use-property-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1882 (member property org-use-property-inheritance)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1883 (t (error "Invalid setting of `org-use-property-inheritance'")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1884 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1885 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1886 "The default column format, if no other format has been defined. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1887 This variable can be set on the per-file basis by inserting a line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1888 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1889 #+COLUMNS: %25ITEM ....." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1890 :group 'org-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1891 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1892 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1893 (defcustom org-columns-ellipses ".." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1894 "The ellipses to be used when a field in column view is truncated. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1895 When this is the empty string, as many characters as possible are shown, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1896 but then there will be no visual indication that the field has been truncated. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1897 When this is a string of length N, the last N characters of a truncated |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1898 field are replaced by this string. If the column is narrower than the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1899 ellipses string, only part of the ellipses string will be shown." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1900 :group 'org-properties |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1901 :type 'string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1902 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1903 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1904 (defcustom org-effort-property "Effort" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1905 "The property that is being used to keep track of effort estimates. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1906 Effort estimates given in this property need to have the format H:MM." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1907 :group 'org-properties |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1908 :group 'org-progress |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1909 :type '(string :tag "Property")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1910 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1911 (defconst org-global-properties-fixed |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1912 '(("VISIBILITY_ALL" . "folded children content all")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1913 "List of property/value pairs that can be inherited by any entry. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1914 These are fixed values, for the preset properties.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1915 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1916 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1917 (defcustom org-global-properties nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1918 "List of property/value pairs that can be inherited by any entry. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1919 You can set buffer-local values for this by adding lines like |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1920 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1921 #+PROPERTY: NAME VALUE" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1922 :group 'org-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1923 :type '(repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1924 (cons (string :tag "Property") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1925 (string :tag "Value")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1926 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1927 (defvar org-file-properties nil |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1928 "List of property/value pairs that can be inherited by any entry. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1929 Valid for the current buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1930 This variable is populated from #+PROPERTY lines.") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
1931 (make-variable-buffer-local 'org-file-properties) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1932 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1933 (defgroup org-agenda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1934 "Options concerning agenda views in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1935 :tag "Org Agenda" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1936 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1937 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1938 (defvar org-category nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1939 "Variable used by org files to set a category for agenda display. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1940 Such files should use a file variable to set it, for example |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1941 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1942 # -*- mode: org; org-category: \"ELisp\" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1943 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1944 or contain a special line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1945 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1946 #+CATEGORY: ELisp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1947 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1948 If the file does not specify a category, then file's base name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1949 is used instead.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1950 (make-variable-buffer-local 'org-category) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1951 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1952 (defcustom org-agenda-files nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1953 "The files to be used for agenda display. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1954 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1955 \\[org-remove-file]. You can also use customize to edit the list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1956 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1957 If an entry is a directory, all files in that directory that are matched by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1958 `org-agenda-file-regexp' will be part of the file list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1959 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1960 If the value of the variable is not a list but a single file name, then |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1961 the list of agenda files is actually stored and maintained in that file, one |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1962 agenda file per line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1963 :group 'org-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1964 :type '(choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1965 (repeat :tag "List of files and directories" file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1966 (file :tag "Store list in a file\n" :value "~/.agenda_files"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1967 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1968 (defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1969 "Regular expression to match files for `org-agenda-files'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1970 If any element in the list in that variable contains a directory instead |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1971 of a normal file, all files in that directory that are matched by this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1972 regular expression will be included." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1973 :group 'org-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1974 :type 'regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1975 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1976 (defcustom org-agenda-text-search-extra-files nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1977 "List of extra files to be searched by text search commands. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1978 These files will be search in addition to the agenda files by the |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1979 commands `org-search-view' (`C-c a s') and `org-occur-in-agenda-files'. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1980 Note that these files will only be searched for text search commands, |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1981 not for the other agenda views like todo lists, tag searches or the weekly |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1982 agenda. This variable is intended to list notes and possibly archive files |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1983 that should also be searched by these two commands. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1984 In fact, if the first element in the list is the symbol `agenda-archives', |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1985 than all archive files of all agenda files will be added to the search |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1986 scope." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1987 :group 'org-agenda |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1988 :type '(set :greedy t |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1989 (const :tag "Agenda Archives" agenda-archives) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1990 (repeat :inline t (file)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1991 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1992 (if (fboundp 'defvaralias) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1993 (defvaralias 'org-agenda-multi-occur-extra-files |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1994 'org-agenda-text-search-extra-files)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
1995 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1996 (defcustom org-agenda-skip-unavailable-files nil |
96490
2bab01f9c7bb
* org.el (org-agenda-skip-unavailable-files):
Juanma Barranquero <lekktu@gmail.com>
parents:
96059
diff
changeset
|
1997 "Non-nil means to just skip non-reachable files in `org-agenda-files'. |
2bab01f9c7bb
* org.el (org-agenda-skip-unavailable-files):
Juanma Barranquero <lekktu@gmail.com>
parents:
96059
diff
changeset
|
1998 A nil value means to remove them, after a query, from the list." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1999 :group 'org-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2000 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2001 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2002 (defcustom org-calendar-to-agenda-key [?c] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2003 "The key to be installed in `calendar-mode-map' for switching to the agenda. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2004 The command `org-calendar-goto-agenda' will be bound to this key. The |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2005 default is the character `c' because then `c' can be used to switch back and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2006 forth between agenda and calendar." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2007 :group 'org-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2008 :type 'sexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2009 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2010 (defcustom org-calendar-agenda-action-key [?k] |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2011 "The key to be installed in `calendar-mode-map' for agenda-action. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2012 The command `org-agenda-action' will be bound to this key. The |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2013 default is the character `k' because we use the same key in the agenda." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2014 :group 'org-agenda |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2015 :type 'sexp) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2016 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2017 (eval-after-load "calendar" |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2018 '(progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2019 (org-defkey calendar-mode-map org-calendar-to-agenda-key |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2020 'org-calendar-goto-agenda) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2021 (org-defkey calendar-mode-map org-calendar-agenda-action-key |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2022 'org-agenda-action))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2023 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2024 (defgroup org-latex nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2025 "Options for embedding LaTeX code into Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2026 :tag "Org LaTeX" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2027 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2028 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2029 (defcustom org-format-latex-options |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2030 '(:foreground default :background default :scale 1.0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2031 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2032 :matchers ("begin" "$" "$$" "\\(" "\\[")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2033 "Options for creating images from LaTeX fragments. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2034 This is a property list with the following properties: |
94764
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
2035 :foreground the foreground color for images embedded in Emacs, e.g. \"Black\". |
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
2036 `default' means use the foreground of the default face. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2037 :background the background color, or \"Transparent\". |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2038 `default' means use the background of the default face. |
94764
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
2039 :scale a scaling factor for the size of the images. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2040 :html-foreground, :html-background, :html-scale |
94764
b0f118394bb4
(org-modules, org-format-latex-options): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
94749
diff
changeset
|
2041 the same numbers for HTML export. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2042 :matchers a list indicating which matchers should be used to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2043 find LaTeX fragments. Valid members of this list are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2044 \"begin\" find environments |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2045 \"$\" find math expressions surrounded by $...$ |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2046 \"$$\" find math expressions surrounded by $$....$$ |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2047 \"\\(\" find math expressions surrounded by \\(...\\) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2048 \"\\ [\" find math expressions surrounded by \\ [...\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2049 :group 'org-latex |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2050 :type 'plist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2051 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2052 (defcustom org-format-latex-header "\\documentclass{article} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2053 \\usepackage{fullpage} % do not remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2054 \\usepackage{amssymb} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2055 \\usepackage[usenames]{color} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2056 \\usepackage{amsmath} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2057 \\usepackage{latexsym} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2058 \\usepackage[mathscr]{eucal} |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2059 \\pagestyle{empty} % do not remove" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2060 "The document header used for processing LaTeX fragments." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2061 :group 'org-latex |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2062 :type 'string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2063 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2064 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2065 (defgroup org-font-lock nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2066 "Font-lock settings for highlighting in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2067 :tag "Org Font Lock" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2068 :group 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2069 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2070 (defcustom org-level-color-stars-only nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2071 "Non-nil means fontify only the stars in each headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2072 When nil, the entire headline is fontified. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2073 Changing it requires restart of `font-lock-mode' to become effective |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2074 also in regions already fontified." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2075 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2076 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2077 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2078 (defcustom org-hide-leading-stars nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2079 "Non-nil means, hide the first N-1 stars in a headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2080 This works by using the face `org-hide' for these stars. This |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2081 face is white for a light background, and black for a dark |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2082 background. You may have to customize the face `org-hide' to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2083 make this work. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2084 Changing it requires restart of `font-lock-mode' to become effective |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2085 also in regions already fontified. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2086 You may also set this on a per-file basis by adding one of the following |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2087 lines to the buffer: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2088 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2089 #+STARTUP: hidestars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2090 #+STARTUP: showstars" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2091 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2092 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2093 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2094 (defcustom org-fontify-done-headline nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2095 "Non-nil means, change the face of a headline if it is marked DONE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2096 Normally, only the TODO/DONE keyword indicates the state of a headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2097 When this is non-nil, the headline after the keyword is set to the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2098 `org-headline-done' as an additional indication." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2099 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2100 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2101 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2102 (defcustom org-fontify-emphasized-text t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2103 "Non-nil means fontify *bold*, /italic/ and _underlined_ text. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2104 Changing this variable requires a restart of Emacs to take effect." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2105 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2106 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2107 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2108 (defcustom org-highlight-latex-fragments-and-specials nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2109 "Non-nil means, fontify what is treated specially by the exporters." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2110 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2111 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2112 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2113 (defcustom org-hide-emphasis-markers nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2114 "Non-nil mean font-lock should hide the emphasis marker characters." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2115 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2116 :type 'boolean) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2117 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2118 (defvar org-emph-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2119 "Regular expression for matching emphasis.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2120 (defvar org-verbatim-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2121 "Regular expression for matching verbatim text.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2122 (defvar org-emphasis-regexp-components) ; defined just below |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2123 (defvar org-emphasis-alist) ; defined just below |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2124 (defun org-set-emph-re (var val) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2125 "Set variable and compute the emphasis regular expression." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2126 (set var val) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2127 (when (and (boundp 'org-emphasis-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2128 (boundp 'org-emphasis-regexp-components) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2129 org-emphasis-alist org-emphasis-regexp-components) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2130 (let* ((e org-emphasis-regexp-components) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2131 (pre (car e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2132 (post (nth 1 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2133 (border (nth 2 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2134 (body (nth 3 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2135 (nl (nth 4 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2136 (stacked (and nil (nth 5 e))) ; stacked is no longer allowed, forced to nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2137 (body1 (concat body "*?")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2138 (markers (mapconcat 'car org-emphasis-alist "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2139 (vmarkers (mapconcat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2140 (lambda (x) (if (eq (nth 4 x) 'verbatim) (car x) "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2141 org-emphasis-alist ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2142 ;; make sure special characters appear at the right position in the class |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2143 (if (string-match "\\^" markers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2144 (setq markers (concat (replace-match "" t t markers) "^"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2145 (if (string-match "-" markers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2146 (setq markers (concat (replace-match "" t t markers) "-"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2147 (if (string-match "\\^" vmarkers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2148 (setq vmarkers (concat (replace-match "" t t vmarkers) "^"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2149 (if (string-match "-" vmarkers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2150 (setq vmarkers (concat (replace-match "" t t vmarkers) "-"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2151 (if (> nl 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2152 (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0," |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2153 (int-to-string nl) "\\}"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2154 ;; Make the regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2155 (setq org-emph-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2156 (concat "\\([" pre (if (and nil stacked) markers) "]\\|^\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2157 "\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2158 "\\([" markers "]\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2159 "\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2160 "[^" border "]\\|" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2161 "[^" border (if (and nil stacked) markers) "]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2162 body1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2163 "[^" border (if (and nil stacked) markers) "]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2164 "\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2165 "\\3\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2166 "\\([" post (if (and nil stacked) markers) "]\\|$\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2167 (setq org-verbatim-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2168 (concat "\\([" pre "]\\|^\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2169 "\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2170 "\\([" vmarkers "]\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2171 "\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2172 "[^" border "]\\|" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2173 "[^" border "]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2174 body1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2175 "[^" border "]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2176 "\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2177 "\\3\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2178 "\\([" post "]\\|$\\)"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2179 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2180 (defcustom org-emphasis-regexp-components |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2181 '(" \t('\"" "- \t.,:?;'\")" " \t\r\n,\"'" "." 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2182 "Components used to build the regular expression for emphasis. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2183 This is a list with 6 entries. Terminology: In an emphasis string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2184 like \" *strong word* \", we call the initial space PREMATCH, the final |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2185 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2186 and \"trong wor\" is the body. The different components in this variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2187 specify what is allowed/forbidden in each part: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2188 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2189 pre Chars allowed as prematch. Beginning of line will be allowed too. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2190 post Chars allowed as postmatch. End of line will be allowed too. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2191 border The chars *forbidden* as border characters. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2192 body-regexp A regexp like \".\" to match a body character. Don't use |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2193 non-shy groups here, and don't allow newline here. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2194 newline The maximum number of newlines allowed in an emphasis exp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2195 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2196 Use customize to modify this, or restart Emacs after changing it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2197 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2198 :set 'org-set-emph-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2199 :type '(list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2200 (sexp :tag "Allowed chars in pre ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2201 (sexp :tag "Allowed chars in post ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2202 (sexp :tag "Forbidden chars in border ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2203 (sexp :tag "Regexp for body ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2204 (integer :tag "number of newlines allowed") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2205 (option (boolean :tag "Please ignore this button")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2206 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2207 (defcustom org-emphasis-alist |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2208 `(("*" bold "<b>" "</b>") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2209 ("/" italic "<i>" "</i>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2210 ("_" underline "<u>" "</u>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2211 ("=" org-code "<code>" "</code>" verbatim) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2212 ("~" org-verbatim "" "" verbatim) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2213 ("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2214 "<del>" "</del>") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2215 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2216 "Special syntax for emphasized text. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2217 Text starting and ending with a special character will be emphasized, for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2218 example *bold*, _underlined_ and /italic/. This variable sets the marker |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2219 characters, the face to be used by font-lock for highlighting in Org-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2220 Emacs buffers, and the HTML tags to be used for this. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2221 Use customize to modify this, or restart Emacs after changing it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2222 :group 'org-font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2223 :set 'org-set-emph-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2224 :type '(repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2225 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2226 (string :tag "Marker character") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2227 (choice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2228 (face :tag "Font-lock-face") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2229 (plist :tag "Face property list")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2230 (string :tag "HTML start tag") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2231 (string :tag "HTML end tag") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2232 (option (const verbatim))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2233 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2234 ;;; Miscellaneous options |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2235 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2236 (defgroup org-completion nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2237 "Completion in Org-mode." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2238 :tag "Org Completion" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2239 :group 'org) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2240 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2241 (defcustom org-completion-fallback-command 'hippie-expand |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2242 "The expansion command called by \\[org-complete] in normal context. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2243 Normal means, no org-mode-specific context." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2244 :group 'org-completion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2245 :type 'function) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2246 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2247 ;;; Functions and variables from ther packages |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2248 ;; Declared here to avoid compiler warnings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2249 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2250 ;; XEmacs only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2251 (defvar outline-mode-menu-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2252 (defvar outline-mode-menu-show) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2253 (defvar outline-mode-menu-hide) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2254 (defvar zmacs-regions) ; XEmacs regions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2255 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2256 ;; Emacs only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2257 (defvar mark-active) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2258 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2259 ;; Various packages |
94457
79f15639a32a
(calendar-absolute-from-iso, calendar-iso-from-absolute): Fix declarations.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
2260 (declare-function calendar-absolute-from-iso "cal-iso" (date)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2261 (declare-function calendar-forward-day "cal-move" (arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2262 (declare-function calendar-goto-date "cal-move" (date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2263 (declare-function calendar-goto-today "cal-move" ()) |
94457
79f15639a32a
(calendar-absolute-from-iso, calendar-iso-from-absolute): Fix declarations.
Glenn Morris <rgm@gnu.org>
parents:
94414
diff
changeset
|
2264 (declare-function calendar-iso-from-absolute "cal-iso" (date)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2265 (defvar calc-embedded-close-formula) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2266 (defvar calc-embedded-open-formula) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2267 (declare-function cdlatex-tab "ext:cdlatex" ()) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2268 (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2269 (defvar font-lock-unfontify-region-function) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2270 (declare-function iswitchb-mode "iswitchb" (&optional arg)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2271 (declare-function iswitchb-read-buffer (prompt &optional default require-match start matches-set)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2272 (defvar iswitchb-temp-buflist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2273 (declare-function org-gnus-follow-link "org-gnus" (&optional group article)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2274 (declare-function org-agenda-skip "org-agenda" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2275 (declare-function org-format-agenda-item "org-agenda" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2276 (extra txt &optional category tags dotime noprefix remove-re)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2277 (declare-function org-agenda-new-marker "org-agenda" (&optional pos)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2278 (declare-function org-agenda-change-all-lines "org-agenda" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2279 (newhead hdmarker &optional fixface)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2280 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2281 (declare-function org-agenda-maybe-redo "org-agenda" ()) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2282 (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2283 (beg end)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2284 (declare-function parse-time-string "parse-time" (string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2285 (declare-function remember "remember" (&optional initial)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2286 (declare-function remember-buffer-desc "remember" ()) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2287 (declare-function remember-finalize "remember" ()) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2288 (defvar remember-save-after-remembering) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2289 (defvar remember-data-file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2290 (defvar remember-register) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2291 (defvar remember-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2292 (defvar remember-handler-functions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2293 (defvar remember-annotation-functions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2294 (defvar texmathp-why) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2295 (declare-function speedbar-line-directory "speedbar" (&optional depth)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2296 (declare-function table--at-cell-p "table" (position &optional object at-column)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2297 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2298 (defvar w3m-current-url) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2299 (defvar w3m-current-title) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2300 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2301 (defvar org-latex-regexps) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2302 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2303 ;;; Autoload and prepare some org modules |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2304 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2305 ;; Some table stuff that needs to be defined here, because it is used |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2306 ;; by the functions setting up org-mode or checking for table context. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2307 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2308 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2309 "Detects an org-type or table-type table.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2310 (defconst org-table-line-regexp "^[ \t]*|" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2311 "Detects an org-type table line.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2312 (defconst org-table-dataline-regexp "^[ \t]*|[^-]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2313 "Detects an org-type table line.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2314 (defconst org-table-hline-regexp "^[ \t]*|-" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2315 "Detects an org-type table hline.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2316 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2317 "Detects a table-type table hline.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2318 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2319 "Searching from within a table (any type) this finds the first line |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2320 outside the table.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2321 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2322 ;; Autoload the functions in org-table.el that are needed by functions here. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2323 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2324 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2325 (org-autoload "org-table" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2326 '(org-table-align org-table-begin org-table-blank-field |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2327 org-table-convert org-table-convert-region org-table-copy-down |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2328 org-table-copy-region org-table-create |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2329 org-table-create-or-convert-from-region |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2330 org-table-create-with-table.el org-table-current-dline |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2331 org-table-cut-region org-table-delete-column org-table-edit-field |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2332 org-table-edit-formulas org-table-end org-table-eval-formula |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2333 org-table-export org-table-field-info |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2334 org-table-get-stored-formulas org-table-goto-column |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2335 org-table-hline-and-move org-table-import org-table-insert-column |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2336 org-table-insert-hline org-table-insert-row org-table-iterate |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2337 org-table-justify-field-maybe org-table-kill-row |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2338 org-table-maybe-eval-formula org-table-maybe-recalculate-line |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2339 org-table-move-column org-table-move-column-left |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2340 org-table-move-column-right org-table-move-row |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2341 org-table-move-row-down org-table-move-row-up |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2342 org-table-next-field org-table-next-row org-table-paste-rectangle |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2343 org-table-previous-field org-table-recalculate |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2344 org-table-rotate-recalc-marks org-table-sort-lines org-table-sum |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2345 org-table-toggle-coordinate-overlays |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2346 org-table-toggle-formula-debugger org-table-wrap-region |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2347 orgtbl-mode turn-on-orgtbl))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2348 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2349 (defun org-at-table-p (&optional table-type) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2350 "Return t if the cursor is inside an org-type table. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2351 If TABLE-TYPE is non-nil, also check for table.el-type tables." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2352 (if org-enable-table-editor |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2353 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2354 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2355 (looking-at (if table-type org-table-any-line-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2356 org-table-line-regexp))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2357 nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2358 (defsubst org-table-p () (org-at-table-p)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2359 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2360 (defun org-at-table.el-p () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2361 "Return t if and only if we are at a table.el table." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2362 (and (org-at-table-p 'any) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2363 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2364 (goto-char (org-table-begin 'any)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2365 (looking-at org-table1-hline-regexp)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2366 (defun org-table-recognize-table.el () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2367 "If there is a table.el table nearby, recognize it and move into it." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2368 (if org-table-tab-recognizes-table.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2369 (if (org-at-table.el-p) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2370 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2371 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2372 (if (looking-at org-table-dataline-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2373 nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2374 (if (looking-at org-table1-hline-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2375 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2376 (beginning-of-line 2) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2377 (if (looking-at org-table-any-border-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2378 (beginning-of-line -1))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2379 (if (re-search-forward "|" (org-table-end t) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2380 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2381 (require 'table) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2382 (if (table--at-cell-p (point)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2383 t |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2384 (message "recognizing table.el table...") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2385 (table-recognize-table) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2386 (message "recognizing table.el table...done"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2387 (error "This should not happen...")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2388 t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2389 nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2390 nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2391 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2392 (defun org-at-table-hline-p () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2393 "Return t if the cursor is inside a hline in a table." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2394 (if org-enable-table-editor |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2395 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2396 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2397 (looking-at org-table-hline-regexp)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2398 nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2399 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2400 (defvar org-table-clean-did-remove-column nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2401 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2402 (defun org-table-map-tables (function) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2403 "Apply FUNCTION to the start of all tables in the buffer." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2404 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2405 (save-restriction |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2406 (widen) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2407 (goto-char (point-min)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2408 (while (re-search-forward org-table-any-line-regexp nil t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2409 (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2410 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2411 (if (looking-at org-table-line-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2412 (save-excursion (funcall function))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2413 (re-search-forward org-table-any-border-regexp nil 1)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2414 (message "Mapping tables: done")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2415 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2416 ;; Declare and autoload functions from org-exp.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2417 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2418 (declare-function org-default-export-plist "org-exp") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2419 (declare-function org-infile-export-plist "org-exp") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2420 (declare-function org-get-current-options "org-exp") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2421 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2422 (org-autoload "org-exp" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2423 '(org-export org-export-as-ascii org-export-visible |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2424 org-insert-export-options-template org-export-as-html-and-open |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2425 org-export-as-html-batch org-export-as-html-to-buffer |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2426 org-replace-region-by-html org-export-region-as-html |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2427 org-export-as-html org-export-icalendar-this-file |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2428 org-export-icalendar-all-agenda-files |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2429 org-table-clean-before-export |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2430 org-export-icalendar-combine-agenda-files org-export-as-xoxo))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2431 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2432 ;; Declare and autoload functions from org-exp.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2433 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2434 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2435 (org-autoload "org-exp" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2436 '(org-agenda org-agenda-list org-search-view |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2437 org-todo-list org-tags-view org-agenda-list-stuck-projects |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2438 org-diary org-agenda-to-appt))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2439 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2440 ;; Autoload org-remember |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2441 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2442 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2443 (org-autoload "org-remember" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2444 '(org-remember-insinuate org-remember-annotation |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2445 org-remember-apply-template org-remember org-remember-handler))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2446 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2447 ;; Autoload org-clock.el |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2448 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2449 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2450 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2451 (beg end)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2452 (declare-function org-update-mode-line "org-clock" ()) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2453 (defvar org-clock-start-time) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2454 (defvar org-clock-marker (make-marker) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2455 "Marker recording the last clock-in.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2456 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2457 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2458 (org-autoload |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2459 "org-clock" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2460 '(org-clock-in org-clock-out org-clock-cancel |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2461 org-clock-goto org-clock-sum org-clock-display |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2462 org-remove-clock-overlays org-clock-report |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2463 org-clocktable-shift org-dblock-write:clocktable |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2464 org-get-clocktable))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2465 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2466 (defun org-clock-update-time-maybe () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2467 "If this is a CLOCK line, update it and return t. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2468 Otherwise, return nil." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2469 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2470 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2471 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2472 (skip-chars-forward " \t") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2473 (when (looking-at org-clock-string) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2474 (let ((re (concat "[ \t]*" org-clock-string |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2475 " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2476 "\\([ \t]*=>.*\\)?\\)?")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2477 ts te h m s) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2478 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2479 ((not (looking-at re)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2480 nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2481 ((not (match-end 2)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2482 (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2483 (> org-clock-marker (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2484 (<= org-clock-marker (point-at-eol))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2485 ;; The clock is running here |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2486 (setq org-clock-start-time |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2487 (apply 'encode-time |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2488 (org-parse-time-string (match-string 1)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2489 (org-update-mode-line))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2490 (t |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2491 (and (match-end 4) (delete-region (match-beginning 4) (match-end 4))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2492 (end-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2493 (setq ts (match-string 1) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2494 te (match-string 3)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2495 (setq s (- (time-to-seconds |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2496 (apply 'encode-time (org-parse-time-string te))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2497 (time-to-seconds |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2498 (apply 'encode-time (org-parse-time-string ts)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2499 h (floor (/ s 3600)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2500 s (- s (* 3600 h)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2501 m (floor (/ s 60)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2502 s (- s (* 60 s))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2503 (insert " => " (format "%2d:%02d" h m)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2504 t)))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2505 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2506 (defun org-check-running-clock () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2507 "Check if the current buffer contains the running clock. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2508 If yes, offer to stop it and to save the buffer with the changes." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2509 (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2510 (y-or-n-p (format "Clock-out in buffer %s before killing it? " |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2511 (buffer-name)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2512 (org-clock-out) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2513 (when (y-or-n-p "Save changed buffer?") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2514 (save-buffer)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2515 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2516 (defun org-clocktable-try-shift (dir n) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2517 "Check if this line starts a clock table, if yes, shift the time block." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2518 (when (org-match-line "#\\+BEGIN: clocktable\\>") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2519 (org-clocktable-shift dir n))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2520 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2521 ;; Autoload archiving code |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2522 ;; The stuff that is needed for cycling and tags has to be defined here. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2523 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2524 (defgroup org-archive nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2525 "Options concerning archiving in Org-mode." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2526 :tag "Org Archive" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2527 :group 'org-structure) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2528 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2529 (defcustom org-archive-location "%s_archive::" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2530 "The location where subtrees should be archived. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2531 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2532 Otherwise, the value of this variable is a string, consisting of two |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2533 parts, separated by a double-colon. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2534 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2535 The first part is a file name - when omitted, archiving happens in the same |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2536 file. %s will be replaced by the current file name (without directory part). |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2537 Archiving to a different file is useful to keep archived entries from |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2538 contributing to the Org-mode Agenda. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2539 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2540 The part after the double colon is a headline. The archived entries will be |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2541 filed under that headline. When omitted, the subtrees are simply filed away |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2542 at the end of the file, as top-level entries. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2543 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2544 Here are a few examples: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2545 \"%s_archive::\" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2546 If the current file is Projects.org, archive in file |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2547 Projects.org_archive, as top-level trees. This is the default. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2548 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2549 \"::* Archived Tasks\" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2550 Archive in the current file, under the top-level headline |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2551 \"* Archived Tasks\". |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2552 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2553 \"~/org/archive.org::\" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2554 Archive in file ~/org/archive.org (absolute path), as top-level trees. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2555 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2556 \"basement::** Finished Tasks\" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2557 Archive in file ./basement (relative path), as level 3 trees |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2558 below the level 2 heading \"** Finished Tasks\". |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2559 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2560 You may set this option on a per-file basis by adding to the buffer a |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2561 line like |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2562 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2563 #+ARCHIVE: basement::** Finished Tasks |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2564 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2565 You may also define it locally for a subtree by setting an ARCHIVE property |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2566 in the entry. If such a property is found in an entry, or anywhere up |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2567 the hierarchy, it will be used." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2568 :group 'org-archive |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2569 :type 'string) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2570 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2571 (defcustom org-archive-tag "ARCHIVE" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2572 "The tag that marks a subtree as archived. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2573 An archived subtree does not open during visibility cycling, and does |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2574 not contribute to the agenda listings. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2575 After changing this, font-lock must be restarted in the relevant buffers to |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2576 get the proper fontification." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2577 :group 'org-archive |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2578 :group 'org-keywords |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2579 :type 'string) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2580 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2581 (defcustom org-agenda-skip-archived-trees t |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2582 "Non-nil means, the agenda will skip any items located in archived trees. |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
2583 An archived tree is a tree marked with the tag ARCHIVE. The use of this |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
2584 variable is no longer recommended, you should leave it at the value t. |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
2585 Instead, use the key `v' to cycle the archives-mode in the agenda." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2586 :group 'org-archive |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2587 :group 'org-agenda-skip |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2588 :type 'boolean) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2589 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2590 (defcustom org-cycle-open-archived-trees nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2591 "Non-nil means, `org-cycle' will open archived trees. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2592 An archived tree is a tree marked with the tag ARCHIVE. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2593 When nil, archived trees will stay folded. You can still open them with |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2594 normal outline commands like `show-all', but not with the cycling commands." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2595 :group 'org-archive |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2596 :group 'org-cycle |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2597 :type 'boolean) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2598 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2599 (defcustom org-sparse-tree-open-archived-trees nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2600 "Non-nil means sparse tree construction shows matches in archived trees. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2601 When nil, matches in these trees are highlighted, but the trees are kept in |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2602 collapsed state." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2603 :group 'org-archive |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2604 :group 'org-sparse-trees |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2605 :type 'boolean) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2606 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2607 (defun org-cycle-hide-archived-subtrees (state) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2608 "Re-hide all archived subtrees after a visibility state change." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2609 (when (and (not org-cycle-open-archived-trees) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2610 (not (memq state '(overview folded)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2611 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2612 (let* ((globalp (memq state '(contents all))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2613 (beg (if globalp (point-min) (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2614 (end (if globalp (point-max) (org-end-of-subtree t)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2615 (org-hide-archived-subtrees beg end) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2616 (goto-char beg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2617 (if (looking-at (concat ".*:" org-archive-tag ":")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2618 (message "%s" (substitute-command-keys |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2619 "Subtree is archived and stays closed. Use \\[org-force-cycle-archived] to cycle it anyway."))))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2620 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2621 (defun org-force-cycle-archived () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2622 "Cycle subtree even if it is archived." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2623 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2624 (setq this-command 'org-cycle) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2625 (let ((org-cycle-open-archived-trees t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2626 (call-interactively 'org-cycle))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2627 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2628 (defun org-hide-archived-subtrees (beg end) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2629 "Re-hide all archived subtrees after a visibility state change." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2630 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2631 (let* ((re (concat ":" org-archive-tag ":"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2632 (goto-char beg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2633 (while (re-search-forward re end t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2634 (and (org-on-heading-p) (hide-subtree)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2635 (org-end-of-subtree t))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2636 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2637 (defalias 'org-advertized-archive-subtree 'org-archive-subtree) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2638 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2639 (eval-and-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2640 (org-autoload "org-archive" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2641 '(org-add-archive-files org-archive-subtree |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2642 org-archive-to-archive-sibling org-toggle-archive-tag))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2643 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2644 ;; Autoload Column View Code |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2645 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2646 (declare-function org-columns-number-to-string "org-colview") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2647 (declare-function org-columns-get-format-and-top-level "org-colview") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2648 (declare-function org-columns-compute "org-colview") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2649 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2650 (org-autoload (if (featurep 'xemacs) "org-colview-xemacs" "org-colview") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2651 '(org-columns-number-to-string org-columns-get-format-and-top-level |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2652 org-columns-compute org-agenda-columns org-columns-remove-overlays |
97027
adc2dffbdfc3
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96975
diff
changeset
|
2653 org-columns org-insert-columns-dblock org-dblock-write:columnview)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2654 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2655 ;; Autoload ID code |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2656 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2657 (org-autoload "org-id" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2658 '(org-id-get-create org-id-new org-id-copy org-id-get |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2659 org-id-get-with-outline-path-completion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2660 org-id-get-with-outline-drilling |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2661 org-id-goto org-id-find)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2662 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2663 ;;; Variables for pre-computed regular expressions, all buffer local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2664 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2665 (defvar org-drawer-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2666 "Matches first line of a hidden block.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2667 (make-variable-buffer-local 'org-drawer-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2668 (defvar org-todo-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2669 "Matches any of the TODO state keywords.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2670 (make-variable-buffer-local 'org-todo-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2671 (defvar org-not-done-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2672 "Matches any of the TODO state keywords except the last one.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2673 (make-variable-buffer-local 'org-not-done-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2674 (defvar org-todo-line-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2675 "Matches a headline and puts TODO state into group 2 if present.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2676 (make-variable-buffer-local 'org-todo-line-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2677 (defvar org-complex-heading-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2678 "Matches a headline and puts everything into groups: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2679 group 1: the stars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2680 group 2: The todo keyword, maybe |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2681 group 3: Priority cookie |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2682 group 4: True headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2683 group 5: Tags") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2684 (make-variable-buffer-local 'org-complex-heading-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2685 (defvar org-todo-line-tags-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2686 "Matches a headline and puts TODO state into group 2 if present. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2687 Also put tags into group 4 if tags are present.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2688 (make-variable-buffer-local 'org-todo-line-tags-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2689 (defvar org-nl-done-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2690 "Matches newline followed by a headline with the DONE keyword.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2691 (make-variable-buffer-local 'org-nl-done-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2692 (defvar org-looking-at-done-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2693 "Matches the DONE keyword a point.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2694 (make-variable-buffer-local 'org-looking-at-done-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2695 (defvar org-ds-keyword-length 12 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2696 "Maximum length of the Deadline and SCHEDULED keywords.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2697 (make-variable-buffer-local 'org-ds-keyword-length) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2698 (defvar org-deadline-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2699 "Matches the DEADLINE keyword.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2700 (make-variable-buffer-local 'org-deadline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2701 (defvar org-deadline-time-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2702 "Matches the DEADLINE keyword together with a time stamp.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2703 (make-variable-buffer-local 'org-deadline-time-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2704 (defvar org-deadline-line-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2705 "Matches the DEADLINE keyword and the rest of the line.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2706 (make-variable-buffer-local 'org-deadline-line-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2707 (defvar org-scheduled-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2708 "Matches the SCHEDULED keyword.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2709 (make-variable-buffer-local 'org-scheduled-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2710 (defvar org-scheduled-time-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2711 "Matches the SCHEDULED keyword together with a time stamp.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2712 (make-variable-buffer-local 'org-scheduled-time-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2713 (defvar org-closed-time-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2714 "Matches the CLOSED keyword together with a time stamp.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2715 (make-variable-buffer-local 'org-closed-time-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2716 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2717 (defvar org-keyword-time-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2718 "Matches any of the 4 keywords, together with the time stamp.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2719 (make-variable-buffer-local 'org-keyword-time-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2720 (defvar org-keyword-time-not-clock-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2721 "Matches any of the 3 keywords, together with the time stamp.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2722 (make-variable-buffer-local 'org-keyword-time-not-clock-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2723 (defvar org-maybe-keyword-time-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2724 "Matches a timestamp, possibly preceeded by a keyword.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2725 (make-variable-buffer-local 'org-maybe-keyword-time-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2726 (defvar org-planning-or-clock-line-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2727 "Matches a line with planning or clock info.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2728 (make-variable-buffer-local 'org-planning-or-clock-line-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2729 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2730 (defconst org-plain-time-of-day-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2731 (concat |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2732 "\\(\\<[012]?[0-9]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2733 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2734 "\\(--?" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2735 "\\(\\<[012]?[0-9]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2736 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2737 "\\)?") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2738 "Regular expression to match a plain time or time range. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2739 Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2740 groups carry important information: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2741 0 the full match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2742 1 the first time, range or not |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2743 8 the second time, if it is a range.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2744 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2745 (defconst org-plain-time-extension-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2746 (concat |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2747 "\\(\\<[012]?[0-9]" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2748 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2749 "\\+\\([0-9]+\\)\\(:\\([0-5][0-9]\\)\\)?") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2750 "Regular expression to match a time range like 13:30+2:10 = 13:30-15:40. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2751 Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2752 groups carry important information: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2753 0 the full match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2754 7 hours of duration |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2755 9 minutes of duration") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2756 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2757 (defconst org-stamp-time-of-day-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2758 (concat |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2759 "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2760 "\\([012][0-9]:[0-5][0-9]\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?\\)>" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2761 "\\(--?" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2762 "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2763 "Regular expression to match a timestamp time or time range. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2764 After a match, the following groups carry important information: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2765 0 the full match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2766 1 date plus weekday, for backreferencing to make sure both times on same day |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2767 2 the first time, range or not |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2768 4 the second time, if it is a range.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
2769 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2770 (defconst org-startup-options |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2771 '(("fold" org-startup-folded t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2772 ("overview" org-startup-folded t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2773 ("nofold" org-startup-folded nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2774 ("showall" org-startup-folded nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2775 ("content" org-startup-folded content) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2776 ("hidestars" org-hide-leading-stars t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2777 ("showstars" org-hide-leading-stars nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2778 ("odd" org-odd-levels-only t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2779 ("oddeven" org-odd-levels-only nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2780 ("align" org-startup-align-all-tables t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2781 ("noalign" org-startup-align-all-tables nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2782 ("customtime" org-display-custom-times t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2783 ("logdone" org-log-done time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2784 ("lognotedone" org-log-done note) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2785 ("nologdone" org-log-done nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2786 ("lognoteclock-out" org-log-note-clock-out t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2787 ("nolognoteclock-out" org-log-note-clock-out nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2788 ("logrepeat" org-log-repeat state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2789 ("lognoterepeat" org-log-repeat note) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2790 ("nologrepeat" org-log-repeat nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2791 ("constcgs" constants-unit-system cgs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2792 ("constSI" constants-unit-system SI)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2793 "Variable associated with STARTUP options for org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2794 Each element is a list of three items: The startup options as written |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2795 in the #+STARTUP line, the corresponding variable, and the value to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2796 set this variable to if the option is found. An optional forth element PUSH |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2797 means to push this value onto the list in the variable.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2798 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2799 (defun org-set-regexps-and-options () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2800 "Precompute regular expressions for current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2801 (when (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2802 (org-set-local 'org-todo-kwd-alist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2803 (org-set-local 'org-todo-key-alist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2804 (org-set-local 'org-todo-key-trigger nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2805 (org-set-local 'org-todo-keywords-1 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2806 (org-set-local 'org-done-keywords nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2807 (org-set-local 'org-todo-heads nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2808 (org-set-local 'org-todo-sets nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2809 (org-set-local 'org-todo-log-states nil) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2810 (org-set-local 'org-file-properties nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2811 (org-set-local 'org-file-tags nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2812 (let ((re (org-make-options-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2813 '("CATEGORY" "SEQ_TODO" "TYP_TODO" "TODO" "COLUMNS" |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2814 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2815 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE"))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2816 (splitre "[ \t]+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2817 kwds kws0 kwsa key log value cat arch tags const links hw dws |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2818 tail sep kws1 prio props ftags drawers |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2819 ext-setup-or-nil setup-contents (start 0)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2820 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2821 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2822 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2823 (goto-char (point-min)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2824 (while (or (and ext-setup-or-nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2825 (string-match re ext-setup-or-nil start) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2826 (setq start (match-end 0))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2827 (and (setq ext-setup-or-nil nil start 0) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2828 (re-search-forward re nil t))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2829 (setq key (upcase (match-string 1 ext-setup-or-nil)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2830 value (org-match-string-no-properties 2 ext-setup-or-nil)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2831 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2832 ((equal key "CATEGORY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2833 (if (string-match "[ \t]+$" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2834 (setq value (replace-match "" t t value))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2835 (setq cat value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2836 ((member key '("SEQ_TODO" "TODO")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2837 (push (cons 'sequence (org-split-string value splitre)) kwds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2838 ((equal key "TYP_TODO") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2839 (push (cons 'type (org-split-string value splitre)) kwds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2840 ((equal key "TAGS") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2841 (setq tags (append tags (org-split-string value splitre)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2842 ((equal key "COLUMNS") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2843 (org-set-local 'org-columns-default-format value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2844 ((equal key "LINK") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2845 (when (string-match "^\\(\\S-+\\)[ \t]+\\(.+\\)" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2846 (push (cons (match-string 1 value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2847 (org-trim (match-string 2 value))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2848 links))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2849 ((equal key "PRIORITIES") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2850 (setq prio (org-split-string value " +"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2851 ((equal key "PROPERTY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2852 (when (string-match "\\(\\S-+\\)\\s-+\\(.*\\)" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2853 (push (cons (match-string 1 value) (match-string 2 value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2854 props))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2855 ((equal key "FILETAGS") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2856 (when (string-match "\\S-" value) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2857 (setq ftags |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2858 (append |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2859 ftags |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2860 (apply 'append |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2861 (mapcar (lambda (x) (org-split-string x ":")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2862 (org-split-string value))))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2863 ((equal key "DRAWERS") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2864 (setq drawers (org-split-string value splitre))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2865 ((equal key "CONSTANTS") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2866 (setq const (append const (org-split-string value splitre)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2867 ((equal key "STARTUP") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2868 (let ((opts (org-split-string value splitre)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2869 l var val) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2870 (while (setq l (pop opts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2871 (when (setq l (assoc l org-startup-options)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2872 (setq var (nth 1 l) val (nth 2 l)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2873 (if (not (nth 3 l)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2874 (set (make-local-variable var) val) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2875 (if (not (listp (symbol-value var))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2876 (set (make-local-variable var) nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2877 (set (make-local-variable var) (symbol-value var)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2878 (add-to-list var val)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2879 ((equal key "ARCHIVE") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2880 (string-match " *$" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2881 (setq arch (replace-match "" t t value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2882 (remove-text-properties 0 (length arch) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2883 '(face t fontified t) arch)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2884 ((equal key "SETUPFILE") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2885 (setq setup-contents (org-file-contents |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2886 (expand-file-name |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2887 (org-remove-double-quotes value)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2888 'noerror)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2889 (if (not ext-setup-or-nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2890 (setq ext-setup-or-nil setup-contents start 0) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2891 (setq ext-setup-or-nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2892 (concat (substring ext-setup-or-nil 0 start) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2893 "\n" setup-contents "\n" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2894 (substring ext-setup-or-nil start))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2895 )))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2896 (when cat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2897 (org-set-local 'org-category (intern cat)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2898 (push (cons "CATEGORY" cat) props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2899 (when prio |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2900 (if (< (length prio) 3) (setq prio '("A" "C" "B"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2901 (setq prio (mapcar 'string-to-char prio)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2902 (org-set-local 'org-highest-priority (nth 0 prio)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2903 (org-set-local 'org-lowest-priority (nth 1 prio)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2904 (org-set-local 'org-default-priority (nth 2 prio))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2905 (and props (org-set-local 'org-file-properties (nreverse props))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2906 (and ftags (org-set-local 'org-file-tags ftags)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2907 (and drawers (org-set-local 'org-drawers drawers)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2908 (and arch (org-set-local 'org-archive-location arch)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2909 (and links (setq org-link-abbrev-alist-local (nreverse links))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2910 ;; Process the TODO keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2911 (unless kwds |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2912 ;; Use the global values as if they had been given locally. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2913 (setq kwds (default-value 'org-todo-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2914 (if (stringp (car kwds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2915 (setq kwds (list (cons org-todo-interpretation |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2916 (default-value 'org-todo-keywords))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2917 (setq kwds (reverse kwds))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2918 (setq kwds (nreverse kwds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2919 (let (inter kws kw) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2920 (while (setq kws (pop kwds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2921 (setq inter (pop kws) sep (member "|" kws) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2922 kws0 (delete "|" (copy-sequence kws)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2923 kwsa nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2924 kws1 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2925 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2926 ;; 1 2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2927 (if (string-match "^\\(.*?\\)\\(?:(\\([^!@/]\\)?.*?)\\)?$" x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2928 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2929 (setq kw (match-string 1 x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2930 key (and (match-end 2) (match-string 2 x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2931 log (org-extract-log-state-settings x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2932 (push (cons kw (and key (string-to-char key))) kwsa) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2933 (and log (push log org-todo-log-states)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2934 kw) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2935 (error "Invalid TODO keyword %s" x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2936 kws0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2937 kwsa (if kwsa (append '((:startgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2938 (nreverse kwsa) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2939 '((:endgroup)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2940 hw (car kws1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2941 dws (if sep (org-remove-keyword-keys (cdr sep)) (last kws1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2942 tail (list inter hw (car dws) (org-last dws))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2943 (add-to-list 'org-todo-heads hw 'append) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2944 (push kws1 org-todo-sets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2945 (setq org-done-keywords (append org-done-keywords dws nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2946 (setq org-todo-key-alist (append org-todo-key-alist kwsa)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2947 (mapc (lambda (x) (push (cons x tail) org-todo-kwd-alist)) kws1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2948 (setq org-todo-keywords-1 (append org-todo-keywords-1 kws1 nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2949 (setq org-todo-sets (nreverse org-todo-sets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2950 org-todo-kwd-alist (nreverse org-todo-kwd-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2951 org-todo-key-trigger (delq nil (mapcar 'cdr org-todo-key-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2952 org-todo-key-alist (org-assign-fast-keys org-todo-key-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2953 ;; Process the constants |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2954 (when const |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2955 (let (e cst) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2956 (while (setq e (pop const)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2957 (if (string-match "^\\([a-zA-Z0][_a-zA-Z0-9]*\\)=\\(.*\\)" e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2958 (push (cons (match-string 1 e) (match-string 2 e)) cst))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2959 (setq org-table-formula-constants-local cst))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2960 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2961 ;; Process the tags. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2962 (when tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2963 (let (e tgs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2964 (while (setq e (pop tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2965 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2966 ((equal e "{") (push '(:startgroup) tgs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2967 ((equal e "}") (push '(:endgroup) tgs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2968 ((string-match (org-re "^\\([[:alnum:]_@]+\\)(\\(.\\))$") e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2969 (push (cons (match-string 1 e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2970 (string-to-char (match-string 2 e))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2971 tgs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2972 (t (push (list e) tgs)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2973 (org-set-local 'org-tag-alist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2974 (while (setq e (pop tgs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2975 (or (and (stringp (car e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2976 (assoc (car e) org-tag-alist)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2977 (push e org-tag-alist))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2978 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2979 ;; Compute the regular expressions and other local variables |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2980 (if (not org-done-keywords) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2981 (setq org-done-keywords (list (org-last org-todo-keywords-1)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2982 (setq org-ds-keyword-length (+ 2 (max (length org-deadline-string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2983 (length org-scheduled-string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2984 (length org-clock-string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2985 (length org-closed-string))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2986 org-drawer-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2987 (concat "^[ \t]*:\\(" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2988 (mapconcat 'regexp-quote org-drawers "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2989 "\\):[ \t]*$") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2990 org-not-done-keywords |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2991 (org-delete-all org-done-keywords (copy-sequence org-todo-keywords-1)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2992 org-todo-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2993 (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords-1 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2994 "\\|") "\\)\\>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2995 org-not-done-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2996 (concat "\\<\\(" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2997 (mapconcat 'regexp-quote org-not-done-keywords "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2998 "\\)\\>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
2999 org-todo-line-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3000 (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3001 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3002 "\\)\\>\\)?[ \t]*\\(.*\\)") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3003 org-complex-heading-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3004 (concat "^\\(\\*+\\)\\(?:[ \t]+\\(" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3005 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3006 "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3007 "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3008 org-nl-done-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3009 (concat "\n\\*+[ \t]+" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3010 "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3011 "\\)" "\\>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3012 org-todo-line-tags-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3013 (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3014 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3015 (org-re |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3016 "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@]+:[ \t]*\\)?$\\)")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3017 org-looking-at-done-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3018 (concat "^" "\\(?:" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3019 (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3020 "\\>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3021 org-deadline-regexp (concat "\\<" org-deadline-string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3022 org-deadline-time-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3023 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3024 org-deadline-line-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3025 (concat "\\<\\(" org-deadline-string "\\).*") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3026 org-scheduled-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3027 (concat "\\<" org-scheduled-string) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3028 org-scheduled-time-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3029 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3030 org-closed-time-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3031 (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3032 org-keyword-time-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3033 (concat "\\<\\(" org-scheduled-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3034 "\\|" org-deadline-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3035 "\\|" org-closed-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3036 "\\|" org-clock-string "\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3037 " *[[<]\\([^]>]+\\)[]>]") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3038 org-keyword-time-not-clock-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3039 (concat "\\<\\(" org-scheduled-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3040 "\\|" org-deadline-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3041 "\\|" org-closed-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3042 "\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3043 " *[[<]\\([^]>]+\\)[]>]") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3044 org-maybe-keyword-time-regexp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3045 (concat "\\(\\<\\(" org-scheduled-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3046 "\\|" org-deadline-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3047 "\\|" org-closed-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3048 "\\|" org-clock-string "\\)\\)?" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3049 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3050 org-planning-or-clock-line-re |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3051 (concat "\\(?:^[ \t]*\\(" org-scheduled-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3052 "\\|" org-deadline-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3053 "\\|" org-closed-string "\\|" org-clock-string |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3054 "\\)\\>\\)") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3055 ) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3056 (org-compute-latex-and-specials-regexp) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3057 (org-set-font-lock-defaults)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3058 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3059 (defun org-file-contents (file &optional noerror) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3060 "Return the contents of FILE, as a string." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3061 (if (or (not file) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3062 (not (file-readable-p file))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3063 (if noerror |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3064 (progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3065 (message "Cannot read file %s" file) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3066 (ding) (sit-for 2) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3067 "") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3068 (error "Cannot read file %s" file)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3069 (with-temp-buffer |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3070 (insert-file-contents file) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3071 (buffer-string)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3072 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3073 (defun org-extract-log-state-settings (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3074 "Extract the log state setting from a TODO keyword string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3075 This will extract info from a string like \"WAIT(w@/!)\"." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3076 (let (kw key log1 log2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3077 (when (string-match "^\\(.*?\\)\\(?:(\\([^!@/]\\)?\\([!@]\\)?\\(?:/\\([!@]\\)\\)?)\\)?$" x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3078 (setq kw (match-string 1 x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3079 key (and (match-end 2) (match-string 2 x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3080 log1 (and (match-end 3) (match-string 3 x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3081 log2 (and (match-end 4) (match-string 4 x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3082 (and (or log1 log2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3083 (list kw |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3084 (and log1 (if (equal log1 "!") 'time 'note)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3085 (and log2 (if (equal log2 "!") 'time 'note))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3086 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3087 (defun org-remove-keyword-keys (list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3088 "Remove a pair of parenthesis at the end of each string in LIST." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3089 (mapcar (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3090 (if (string-match "(.*)$" x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3091 (substring x 0 (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3092 x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3093 list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3094 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3095 ;; FIXME: this could be done much better, using second characters etc. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3096 (defun org-assign-fast-keys (alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3097 "Assign fast keys to a keyword-key alist. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3098 Respect keys that are already there." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3099 (let (new e k c c1 c2 (char ?a)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3100 (while (setq e (pop alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3101 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3102 ((equal e '(:startgroup)) (push e new)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3103 ((equal e '(:endgroup)) (push e new)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3104 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3105 (setq k (car e) c2 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3106 (if (cdr e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3107 (setq c (cdr e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3108 ;; automatically assign a character. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3109 (setq c1 (string-to-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3110 (downcase (substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3111 k (if (= (string-to-char k) ?@) 1 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3112 (if (or (rassoc c1 new) (rassoc c1 alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3113 (while (or (rassoc char new) (rassoc char alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3114 (setq char (1+ char))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3115 (setq c2 c1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3116 (setq c (or c2 char))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3117 (push (cons k c) new)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3118 (nreverse new))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3119 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3120 ;;; Some variables used in various places |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3121 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3122 (defvar org-window-configuration nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3123 "Used in various places to store a window configuration.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3124 (defvar org-finish-function nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3125 "Function to be called when `C-c C-c' is used. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3126 This is for getting out of special buffers like remember.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3127 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3128 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3129 ;; FIXME: Occasionally check by commenting these, to make sure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3130 ;; no other functions uses these, forgetting to let-bind them. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3131 (defvar entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3132 (defvar state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3133 (defvar last-state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3134 (defvar date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3135 (defvar description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3136 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3137 ;; Defined somewhere in this file, but used before definition. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3138 (defvar org-html-entities) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3139 (defvar org-struct-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3140 (defvar org-org-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3141 (defvar org-tbl-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3142 (defvar org-agenda-keymap) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3143 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3144 ;;;; Define the Org-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3145 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3146 (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3147 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3148 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3149 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3150 ;; We use a before-change function to check if a table might need |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3151 ;; an update. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3152 (defvar org-table-may-need-update t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3153 "Indicates that a table might need an update. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3154 This variable is set by `org-before-change-function'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3155 `org-table-align' sets it back to nil.") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3156 (defun org-before-change-function (beg end) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3157 "Every change indicates that a table might need an update." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3158 (setq org-table-may-need-update t)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3159 (defvar org-mode-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3160 (defvar org-mode-hook nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3161 (defvar org-inhibit-startup nil) ; Dynamically-scoped param. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3162 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3163 (defvar org-table-buffer-is-an nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3164 (defconst org-outline-regexp "\\*+ ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3165 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3166 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3167 (define-derived-mode org-mode outline-mode "Org" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3168 "Outline-based notes management and organizer, alias |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3169 \"Carsten's outline-mode for keeping track of everything.\" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3170 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3171 Org-mode develops organizational tasks around a NOTES file which |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3172 contains information about projects as plain text. Org-mode is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3173 implemented on top of outline-mode, which is ideal to keep the content |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3174 of large files well structured. It supports ToDo items, deadlines and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3175 time stamps, which magically appear in the diary listing of the Emacs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3176 calendar. Tables are easily created with a built-in table editor. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3177 Plain text URL-like links connect to websites, emails (VM), Usenet |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3178 messages (Gnus), BBDB entries, and any files related to the project. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3179 For printing and sharing of notes, an Org-mode file (or a part of it) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3180 can be exported as a structured ASCII or HTML file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3181 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3182 The following commands are available: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3183 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3184 \\{org-mode-map}" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3185 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3186 ;; Get rid of Outline menus, they are not needed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3187 ;; Need to do this here because define-derived-mode sets up |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3188 ;; the keymap so late. Still, it is a waste to call this each time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3189 ;; we switch another buffer into org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3190 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3191 (when (boundp 'outline-mode-menu-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3192 ;; Assume this is Greg's port, it used easymenu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3193 (easy-menu-remove outline-mode-menu-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3194 (easy-menu-remove outline-mode-menu-show) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3195 (easy-menu-remove outline-mode-menu-hide)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3196 (define-key org-mode-map [menu-bar headings] 'undefined) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3197 (define-key org-mode-map [menu-bar hide] 'undefined) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3198 (define-key org-mode-map [menu-bar show] 'undefined)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3199 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3200 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3201 (easy-menu-add org-org-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3202 (easy-menu-add org-tbl-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3203 (org-install-agenda-files-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3204 (if org-descriptive-links (org-add-to-invisibility-spec '(org-link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3205 (org-add-to-invisibility-spec '(org-cwidth)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3206 (when (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3207 (org-set-local 'line-move-ignore-invisible t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3208 (org-set-local 'outline-regexp org-outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3209 (org-set-local 'outline-level 'org-outline-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3210 (when (and org-ellipsis |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3211 (fboundp 'set-display-table-slot) (boundp 'buffer-display-table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3212 (fboundp 'make-glyph-code)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3213 (unless org-display-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3214 (setq org-display-table (make-display-table))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3215 (set-display-table-slot |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3216 org-display-table 4 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3217 (vconcat (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3218 (lambda (c) (make-glyph-code c (and (not (stringp org-ellipsis)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3219 org-ellipsis))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3220 (if (stringp org-ellipsis) org-ellipsis "...")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3221 (setq buffer-display-table org-display-table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3222 (org-set-regexps-and-options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3223 ;; Calc embedded |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3224 (org-set-local 'calc-embedded-open-mode "# ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3225 (modify-syntax-entry ?# "<") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3226 (modify-syntax-entry ?@ "w") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3227 (if org-startup-truncated (setq truncate-lines t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3228 (org-set-local 'font-lock-unfontify-region-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3229 'org-unfontify-region) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3230 ;; Activate before-change-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3231 (org-set-local 'org-table-may-need-update t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3232 (org-add-hook 'before-change-functions 'org-before-change-function nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3233 'local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3234 ;; Check for running clock before killing a buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3235 (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3236 ;; Paragraphs and auto-filling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3237 (org-set-autofill-regexps) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3238 (setq indent-line-function 'org-indent-line-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3239 (org-update-radio-target-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3240 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3241 ;; Comment characters |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3242 ; (org-set-local 'comment-start "#") ;; FIXME: this breaks wrapping |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3243 (org-set-local 'comment-padding " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3244 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3245 ;; Align options lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3246 (org-set-local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3247 'align-mode-rules-list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3248 '((org-in-buffer-settings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3249 (regexp . "^#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3250 (modes . '(org-mode))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3251 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3252 ;; Imenu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3253 (org-set-local 'imenu-create-index-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3254 'org-imenu-get-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3255 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3256 ;; Make isearch reveal context |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3257 (if (or (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3258 (not (boundp 'outline-isearch-open-invisible-function))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3259 ;; Emacs 21 and XEmacs make use of the hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3260 (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3261 ;; Emacs 22 deals with this through a special variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3262 (org-set-local 'outline-isearch-open-invisible-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3263 (lambda (&rest ignore) (org-show-context 'isearch)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3264 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3265 ;; If empty file that did not turn on org-mode automatically, make it to. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3266 (if (and org-insert-mode-line-in-empty-file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3267 (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3268 (= (point-min) (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3269 (insert "# -*- mode: org -*-\n\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3270 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3271 (unless org-inhibit-startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3272 (when org-startup-align-all-tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3273 (let ((bmp (buffer-modified-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3274 (org-table-map-tables 'org-table-align) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3275 (set-buffer-modified-p bmp))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3276 (org-set-startup-visibility))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3277 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3278 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3279 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3280 (defun org-current-time () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3281 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3282 (if (> (car org-time-stamp-rounding-minutes) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3283 (let ((r (car org-time-stamp-rounding-minutes)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3284 (time (decode-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3285 (apply 'encode-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3286 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3287 (nthcdr 2 time)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3288 (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3289 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3290 ;;;; Font-Lock stuff, including the activators |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3291 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3292 (defvar org-mouse-map (make-sparse-keymap)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3293 (org-defkey org-mouse-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3294 (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3295 (org-defkey org-mouse-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3296 (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3297 (when org-mouse-1-follows-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3298 (org-defkey org-mouse-map [follow-link] 'mouse-face)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3299 (when org-tab-follows-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3300 (org-defkey org-mouse-map [(tab)] 'org-open-at-point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3301 (org-defkey org-mouse-map "\C-i" 'org-open-at-point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3302 (when org-return-follows-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3303 (org-defkey org-mouse-map [(return)] 'org-open-at-point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3304 (org-defkey org-mouse-map "\C-m" 'org-open-at-point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3305 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3306 (require 'font-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3307 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3308 (defconst org-non-link-chars "]\t\n\r<>") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3309 (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3310 "shell" "elisp")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3311 (defvar org-link-types-re nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3312 "Matches a link that has a url-like prefix like \"http:\"") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3313 (defvar org-link-re-with-space nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3314 "Matches a link with spaces, optional angular brackets around it.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3315 (defvar org-link-re-with-space2 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3316 "Matches a link with spaces, optional angular brackets around it.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3317 (defvar org-angle-link-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3318 "Matches link with angular brackets, spaces are allowed.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3319 (defvar org-plain-link-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3320 "Matches plain link, without spaces.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3321 (defvar org-bracket-link-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3322 "Matches a link in double brackets.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3323 (defvar org-bracket-link-analytic-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3324 "Regular expression used to analyze links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3325 Here is what the match groups contain after a match: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3326 1: http: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3327 2: http |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3328 3: path |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3329 4: [desc] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3330 5: desc") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3331 (defvar org-any-link-re nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3332 "Regular expression matching any link.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3333 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3334 (defun org-make-link-regexps () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3335 "Update the link regular expressions. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3336 This should be called after the variable `org-link-types' has changed." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3337 (setq org-link-types-re |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3338 (concat |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3339 "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3340 org-link-re-with-space |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3341 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3342 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3343 "\\([^" org-non-link-chars " ]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3344 "[^" org-non-link-chars "]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3345 "[^" org-non-link-chars " ]\\)>?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3346 org-link-re-with-space2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3347 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3348 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3349 "\\([^" org-non-link-chars " ]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3350 "[^]\t\n\r]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3351 "[^" org-non-link-chars " ]\\)>?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3352 org-angle-link-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3353 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3354 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3355 "\\([^" org-non-link-chars " ]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3356 "[^" org-non-link-chars "]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3357 "\\)>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3358 org-plain-link-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3359 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3360 "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3361 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3362 org-bracket-link-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3363 "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3364 org-bracket-link-analytic-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3365 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3366 "\\[\\[" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3367 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3368 "\\([^]]+\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3369 "\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3370 "\\(\\[" "\\([^]]+\\)" "\\]\\)?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3371 "\\]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3372 org-any-link-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3373 (concat "\\(" org-bracket-link-regexp "\\)\\|\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3374 org-angle-link-re "\\)\\|\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3375 org-plain-link-re "\\)"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3376 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3377 (org-make-link-regexps) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3378 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3379 (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3380 "Regular expression for fast time stamp matching.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3381 (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3382 "Regular expression for fast time stamp matching.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3383 (defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]-+0-9>\r\n ]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3384 "Regular expression matching time strings for analysis. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3385 This one does not require the space after the date, so it can be used |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3386 on a string that terminates immediately after the date.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3387 (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) +\\([^]-+0-9>\r\n ]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3388 "Regular expression matching time strings for analysis.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3389 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3390 "Regular expression matching time stamps, with groups.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3391 (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3392 "Regular expression matching time stamps (also [..]), with groups.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3393 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3394 "Regular expression matching a time stamp range.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3395 (defconst org-tr-regexp-both |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3396 (concat org-ts-regexp-both "--?-?" org-ts-regexp-both) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3397 "Regular expression matching a time stamp range.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3398 (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3399 org-ts-regexp "\\)?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3400 "Regular expression matching a time stamp or time stamp range.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3401 (defconst org-tsr-regexp-both (concat org-ts-regexp-both "\\(--?-?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3402 org-ts-regexp-both "\\)?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3403 "Regular expression matching a time stamp or time stamp range. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3404 The time stamps may be either active or inactive.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3405 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3406 (defvar org-emph-face nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3407 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3408 (defun org-do-emphasis-faces (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3409 "Run through the buffer and add overlays to links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3410 (let (rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3411 (while (and (not rtn) (re-search-forward org-emph-re limit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3412 (if (not (= (char-after (match-beginning 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3413 (char-after (match-beginning 4)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3414 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3415 (setq rtn t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3416 (font-lock-prepend-text-property (match-beginning 2) (match-end 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3417 'face |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3418 (nth 1 (assoc (match-string 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3419 org-emphasis-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3420 (add-text-properties (match-beginning 2) (match-end 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3421 '(font-lock-multiline t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3422 (when org-hide-emphasis-markers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3423 (add-text-properties (match-end 4) (match-beginning 5) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3424 '(invisible org-link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3425 (add-text-properties (match-beginning 3) (match-end 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3426 '(invisible org-link))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3427 (backward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3428 rtn)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3429 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3430 (defun org-emphasize (&optional char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3431 "Insert or change an emphasis, i.e. a font like bold or italic. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3432 If there is an active region, change that region to a new emphasis. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3433 If there is no region, just insert the marker characters and position |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3434 the cursor between them. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3435 CHAR should be either the marker character, or the first character of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3436 HTML tag associated with that emphasis. If CHAR is a space, the means |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3437 to remove the emphasis of the selected region. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3438 If char is not given (for example in an interactive call) it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3439 will be prompted for." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3440 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3441 (let ((eal org-emphasis-alist) e det |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3442 (erc org-emphasis-regexp-components) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3443 (prompt "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3444 (string "") beg end move tag c s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3445 (if (org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3446 (setq beg (region-beginning) end (region-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3447 string (buffer-substring beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3448 (setq move t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3449 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3450 (while (setq e (pop eal)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3451 (setq tag (car (org-split-string (nth 2 e) "[ <>/]+")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3452 c (aref tag 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3453 (push (cons c (string-to-char (car e))) det) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3454 (setq prompt (concat prompt (format " [%s%c]%s" (car e) c |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3455 (substring tag 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3456 (unless char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3457 (message "%s" (concat "Emphasis marker or tag:" prompt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3458 (setq char (read-char-exclusive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3459 (setq char (or (cdr (assoc char det)) char)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3460 (if (equal char ?\ ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3461 (setq s "" move nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3462 (unless (assoc (char-to-string char) org-emphasis-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3463 (error "No such emphasis marker: \"%c\"" char)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3464 (setq s (char-to-string char))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3465 (while (and (> (length string) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3466 (equal (substring string 0 1) (substring string -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3467 (assoc (substring string 0 1) org-emphasis-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3468 (setq string (substring string 1 -1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3469 (setq string (concat s string s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3470 (if beg (delete-region beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3471 (unless (or (bolp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3472 (string-match (concat "[" (nth 0 erc) "\n]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3473 (char-to-string (char-before (point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3474 (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3475 (unless (string-match (concat "[" (nth 1 erc) "\n]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3476 (char-to-string (char-after (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3477 (insert " ") (backward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3478 (insert string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3479 (and move (backward-char 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3480 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3481 (defconst org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3482 '(mouse-face highlight keymap invisible intangible help-echo org-linked-text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3483 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3484 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3485 (defun org-activate-plain-links (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3486 "Run through the buffer and add overlays to links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3487 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3488 (let (f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3489 (while (re-search-forward org-plain-link-re limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3490 (setq f (get-text-property (match-beginning 0) 'face)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3491 (if (or (eq f 'org-tag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3492 (and (listp f) (memq 'org-tag f))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3493 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3494 (add-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3495 (list 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3496 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3497 'keymap org-mouse-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3498 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3499 (throw 'exit t)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3500 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3501 (defun org-activate-code (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3502 (if (re-search-forward "^[ \t]*\\(:.*\\)" limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3503 (unless (get-text-property (match-beginning 1) 'face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3504 (remove-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3505 '(display t invisible t intangible t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3506 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3507 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3508 (defun org-activate-angle-links (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3509 "Run through the buffer and add overlays to links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3510 (if (re-search-forward org-angle-link-re limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3511 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3512 (add-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3513 (list 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3514 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3515 'keymap org-mouse-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3516 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3517 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3518 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3519 (defun org-activate-bracket-links (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3520 "Run through the buffer and add overlays to bracketed links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3521 (if (re-search-forward org-bracket-link-regexp limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3522 (let* ((help (concat "LINK: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3523 (org-match-string-no-properties 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3524 ;; FIXME: above we should remove the escapes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3525 ;; but that requires another match, protecting match data, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3526 ;; a lot of overhead for font-lock. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3527 (ip (org-maybe-intangible |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3528 (list 'invisible 'org-link 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3529 'keymap org-mouse-map 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3530 'font-lock-multiline t 'help-echo help))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3531 (vp (list 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3532 'keymap org-mouse-map 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3533 ' font-lock-multiline t 'help-echo help))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3534 ;; We need to remove the invisible property here. Table narrowing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3535 ;; may have made some of this invisible. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3536 (remove-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3537 '(invisible nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3538 (if (match-end 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3539 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3540 (add-text-properties (match-beginning 0) (match-beginning 3) ip) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3541 (add-text-properties (match-beginning 3) (match-end 3) vp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3542 (add-text-properties (match-end 3) (match-end 0) ip)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3543 (add-text-properties (match-beginning 0) (match-beginning 1) ip) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3544 (add-text-properties (match-beginning 1) (match-end 1) vp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3545 (add-text-properties (match-end 1) (match-end 0) ip)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3546 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3547 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3548 (defun org-activate-dates (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3549 "Run through the buffer and add overlays to dates." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3550 (if (re-search-forward org-tsr-regexp-both limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3551 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3552 (add-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3553 (list 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3554 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3555 'keymap org-mouse-map)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3556 (when org-display-custom-times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3557 (if (match-end 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3558 (org-display-custom-time (match-beginning 3) (match-end 3))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3559 (org-display-custom-time (match-beginning 1) (match-end 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3560 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3561 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3562 (defvar org-target-link-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3563 "Regular expression matching radio targets in plain text.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3564 (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3565 "Regular expression matching a link target.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3566 (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3567 "Regular expression matching a radio target.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3568 (defvar org-any-target-regexp "<<<?\\([^<>\n\r]+\\)>>>?" ; FIXME, not exact, would match <<<aaa>> as a radio target. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3569 "Regular expression matching any target.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3570 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3571 (defun org-activate-target-links (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3572 "Run through the buffer and add overlays to target matches." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3573 (when org-target-link-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3574 (let ((case-fold-search t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3575 (if (re-search-forward org-target-link-regexp limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3576 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3577 (add-text-properties (match-beginning 0) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3578 (list 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3579 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3580 'keymap org-mouse-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3581 'help-echo "Radio target link" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3582 'org-linked-text t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3583 t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3584 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3585 (defun org-update-radio-target-regexp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3586 "Find all radio targets in this file and update the regular expression." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3587 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3588 (when (memq 'radio org-activate-links) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3589 (setq org-target-link-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3590 (org-make-target-link-regexp (org-all-targets 'radio))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3591 (org-restart-font-lock))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3592 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3593 (defun org-hide-wide-columns (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3594 (let (s e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3595 (setq s (text-property-any (point) (or limit (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3596 'org-cwidth t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3597 (when s |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3598 (setq e (next-single-property-change s 'org-cwidth)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3599 (add-text-properties s e (org-maybe-intangible '(invisible org-cwidth))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3600 (goto-char e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3601 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3602 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3603 (defvar org-latex-and-specials-regexp nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3604 "Regular expression for highlighting export special stuff.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3605 (defvar org-match-substring-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3606 (defvar org-match-substring-with-braces-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3607 (defvar org-export-html-special-string-regexps) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3608 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3609 (defun org-compute-latex-and-specials-regexp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3610 "Compute regular expression for stuff treated specially by exporters." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3611 (if (not org-highlight-latex-fragments-and-specials) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3612 (org-set-local 'org-latex-and-specials-regexp nil) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3613 (require 'org-exp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3614 (let* |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3615 ((matchers (plist-get org-format-latex-options :matchers)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3616 (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3617 org-latex-regexps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3618 (options (org-combine-plists (org-default-export-plist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3619 (org-infile-export-plist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3620 (org-export-with-sub-superscripts (plist-get options :sub-superscript)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3621 (org-export-with-LaTeX-fragments (plist-get options :LaTeX-fragments)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3622 (org-export-with-TeX-macros (plist-get options :TeX-macros)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3623 (org-export-html-expand (plist-get options :expand-quoted-html)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3624 (org-export-with-special-strings (plist-get options :special-strings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3625 (re-sub |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3626 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3627 ((equal org-export-with-sub-superscripts '{}) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3628 (list org-match-substring-with-braces-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3629 (org-export-with-sub-superscripts |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3630 (list org-match-substring-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3631 (t nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3632 (re-latex |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3633 (if org-export-with-LaTeX-fragments |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3634 (mapcar (lambda (x) (nth 1 x)) latexs))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3635 (re-macros |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3636 (if org-export-with-TeX-macros |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3637 (list (concat "\\\\" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3638 (regexp-opt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3639 (append (mapcar 'car org-html-entities) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3640 (if (boundp 'org-latex-entities) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3641 org-latex-entities nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3642 'words))) ; FIXME |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3643 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3644 ;; (list "\\\\\\(?:[a-zA-Z]+\\)"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3645 (re-special (if org-export-with-special-strings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3646 (mapcar (lambda (x) (car x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3647 org-export-html-special-string-regexps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3648 (re-rest |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3649 (delq nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3650 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3651 (if org-export-html-expand "@<[^>\n]+>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3652 )))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3653 (org-set-local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3654 'org-latex-and-specials-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3655 (mapconcat 'identity (append re-latex re-sub re-macros re-special |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3656 re-rest) "\\|"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3657 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3658 (defun org-do-latex-and-special-faces (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3659 "Run through the buffer and add overlays to links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3660 (when org-latex-and-specials-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3661 (let (rtn d) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3662 (while (and (not rtn) (re-search-forward org-latex-and-specials-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3663 limit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3664 (if (not (memq (car-safe (get-text-property (1+ (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3665 'face)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3666 '(org-code org-verbatim underline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3667 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3668 (setq rtn t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3669 d (cond ((member (char-after (1+ (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3670 '(?_ ?^)) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3671 (t 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3672 (font-lock-prepend-text-property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3673 (+ d (match-beginning 0)) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3674 'face 'org-latex-and-export-specials) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3675 (add-text-properties (+ d (match-beginning 0)) (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3676 '(font-lock-multiline t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3677 rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3678 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3679 (defun org-restart-font-lock () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3680 "Restart font-lock-mode, to force refontification." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3681 (when (and (boundp 'font-lock-mode) font-lock-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3682 (font-lock-mode -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3683 (font-lock-mode 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3684 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3685 (defun org-all-targets (&optional radio) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3686 "Return a list of all targets in this file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3687 With optional argument RADIO, only find radio targets." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3688 (let ((re (if radio org-radio-target-regexp org-target-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3689 rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3690 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3691 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3692 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3693 (add-to-list 'rtn (downcase (org-match-string-no-properties 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3694 rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3695 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3696 (defun org-make-target-link-regexp (targets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3697 "Make regular expression matching all strings in TARGETS. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3698 The regular expression finds the targets also if there is a line break |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3699 between words." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3700 (and targets |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3701 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3702 "\\<\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3703 (mapconcat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3704 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3705 (while (string-match " +" x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3706 (setq x (replace-match "\\s-+" t t x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3707 x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3708 targets |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3709 "\\|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3710 "\\)\\>"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3711 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3712 (defun org-activate-tags (limit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3713 (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3714 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3715 (add-text-properties (match-beginning 1) (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3716 (list 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3717 'rear-nonsticky org-nonsticky-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3718 'keymap org-mouse-map)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3719 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3720 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3721 (defun org-outline-level () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3722 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3723 (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3724 (if (match-beginning 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3725 (+ (org-get-string-indentation (match-string 1)) 1000) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3726 (1- (- (match-end 0) (match-beginning 0)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3727 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3728 (defvar org-font-lock-keywords nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3729 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3730 (defconst org-property-re (org-re "^[ \t]*\\(:\\([-[:alnum:]_]+\\):\\)[ \t]*\\([^ \t\r\n].*\\)") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3731 "Regular expression matching a property line.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3732 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3733 (defvar org-font-lock-hook nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3734 "Functions to be called for special font lock stuff.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3735 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3736 (defun org-font-lock-hook (limit) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3737 (run-hook-with-args 'org-font-lock-hook limit)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3738 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3739 (defun org-set-font-lock-defaults () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3740 (let* ((em org-fontify-emphasized-text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3741 (lk org-activate-links) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3742 (org-font-lock-extra-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3743 (list |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3744 ;; Call the hook |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3745 '(org-font-lock-hook) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3746 ;; Headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3747 '("^\\(\\**\\)\\(\\* \\)\\(.*\\)" (1 (org-get-level-face 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3748 (2 (org-get-level-face 2)) (3 (org-get-level-face 3))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3749 ;; Table lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3750 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3751 (1 'org-table t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3752 ;; Table internals |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3753 '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3754 '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3755 '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3756 ;; Drawers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3757 (list org-drawer-regexp '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3758 (list "^[ \t]*:END:" '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3759 ;; Properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3760 (list org-property-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3761 '(1 'org-special-keyword t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3762 '(3 'org-property-value t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3763 (if org-format-transports-properties-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3764 '("| *\\(<[0-9]+>\\) *" (1 'org-formula t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3765 ;; Links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3766 (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3767 (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3768 (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3769 (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3770 (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3771 (if (memq 'date lk) '(org-activate-dates (0 'org-date t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3772 '("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3773 '(org-hide-wide-columns (0 nil append)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3774 ;; TODO lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3775 (list (concat "^\\*+[ \t]+" org-todo-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3776 '(1 (org-get-todo-face 1) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3777 ;; DONE |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3778 (if org-fontify-done-headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3779 (list (concat "^[*]+ +\\<\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3780 (mapconcat 'regexp-quote org-done-keywords "\\|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3781 "\\)\\(.*\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3782 '(2 'org-headline-done t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3783 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3784 ;; Priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3785 (list (concat "\\[#[A-Z0-9]\\]") '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3786 ;; Special keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3787 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3788 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3789 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3790 (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3791 ;; Emphasis |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3792 (if em |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3793 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3794 '(org-do-emphasis-faces (0 nil append)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3795 '(org-do-emphasis-faces))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3796 ;; Checkboxes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3797 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3798 2 'bold prepend) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3799 (if org-provide-checkbox-statistics |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3800 '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3801 (0 (org-get-checkbox-statistics-face) t))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3802 ;; Description list items |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3803 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(.*? ::\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3804 2 'bold prepend) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3805 (list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3806 '(1 'org-archived prepend)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3807 ;; Specials |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3808 '(org-do-latex-and-special-faces) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3809 ;; Code |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3810 '(org-activate-code (1 'org-code t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3811 ;; COMMENT |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3812 (list (concat "^\\*+[ \t]+\\<\\(" org-comment-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3813 "\\|" org-quote-string "\\)\\>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3814 '(1 'org-special-keyword t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3815 '("^#.*" (0 'font-lock-comment-face t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3816 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3817 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3818 ;; Now set the full font-lock-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3819 (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3820 (org-set-local 'font-lock-defaults |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3821 '(org-font-lock-keywords t nil nil backward-paragraph)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3822 (kill-local-variable 'font-lock-keywords) nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3823 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3824 (defvar org-m nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3825 (defvar org-l nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3826 (defvar org-f nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3827 (defun org-get-level-face (n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3828 "Get the right face for match N in font-lock matching of healdines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3829 (setq org-l (- (match-end 2) (match-beginning 1) 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3830 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3831 (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3832 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3833 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3834 ((eq n 2) org-f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3835 (t (if org-level-color-stars-only nil org-f)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3836 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3837 (defun org-get-todo-face (kwd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3838 "Get the right face for a TODO keyword KWD. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3839 If KWD is a number, get the corresponding match group." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3840 (if (numberp kwd) (setq kwd (match-string kwd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3841 (or (cdr (assoc kwd org-todo-keyword-faces)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3842 (and (member kwd org-done-keywords) 'org-done) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3843 'org-todo)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3844 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3845 (defun org-unfontify-region (beg end &optional maybe_loudly) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3846 "Remove fontification and activation overlays from links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3847 (font-lock-default-unfontify-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3848 (let* ((buffer-undo-list t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3849 (inhibit-read-only t) (inhibit-point-motion-hooks t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3850 (inhibit-modification-hooks t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3851 deactivate-mark buffer-file-name buffer-file-truename) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3852 (remove-text-properties beg end |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3853 '(mouse-face t keymap t org-linked-text t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3854 invisible t intangible t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3855 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3856 ;;;; Visibility cycling, including org-goto and indirect buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3857 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3858 ;;; Cycling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3859 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3860 (defvar org-cycle-global-status nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3861 (make-variable-buffer-local 'org-cycle-global-status) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3862 (defvar org-cycle-subtree-status nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3863 (make-variable-buffer-local 'org-cycle-subtree-status) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3864 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3865 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3866 (defun org-cycle (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3867 "Visibility cycling for Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3868 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3869 - When this function is called with a prefix argument, rotate the entire |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3870 buffer through 3 states (global cycling) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3871 1. OVERVIEW: Show only top-level headlines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3872 2. CONTENTS: Show all headlines of all levels, but no body text. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3873 3. SHOW ALL: Show everything. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3874 When called with two C-c C-u prefixes, switch to the startup visibility, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3875 determined by the variable `org-startup-folded', and by any VISIBILITY |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3876 properties in the buffer. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3877 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3878 - When point is at the beginning of a headline, rotate the subtree started |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3879 by this line through 3 different states (local cycling) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3880 1. FOLDED: Only the main headline is shown. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3881 2. CHILDREN: The main headline and the direct children are shown. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3882 From this state, you can move to one of the children |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3883 and zoom in further. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3884 3. SUBTREE: Show the entire subtree, including body text. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3885 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3886 - When there is a numeric prefix, go up to a heading with level ARG, do |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3887 a `show-subtree' and return to the previous cursor position. If ARG |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3888 is negative, go up that many levels. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3889 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3890 - When point is not at the beginning of a headline, execute the global |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3891 binding for TAB, which is re-indenting the line. See the option |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3892 `org-cycle-emulate-tab' for details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3893 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3894 - Special case: if point is at the beginning of the buffer and there is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3895 no headline in line 1, this function will act as if called with prefix arg. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3896 But only if also the variable `org-cycle-global-at-bob' is t." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3897 (interactive "P") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
3898 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3899 (let* ((outline-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3900 (if (and (org-mode-p) org-cycle-include-plain-lists) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3901 "\\(?:\\*+ \\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3902 outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3903 (bob-special (and org-cycle-global-at-bob (bobp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3904 (not (looking-at outline-regexp)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3905 (org-cycle-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3906 (if bob-special |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3907 (delq 'org-optimize-window-after-visibility-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3908 (copy-sequence org-cycle-hook)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3909 org-cycle-hook)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3910 (pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3911 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3912 (if (or bob-special (equal arg '(4))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3913 ;; special case: use global cycling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3914 (setq arg t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3915 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3916 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3917 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3918 ((equal arg '(16)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3919 (org-set-startup-visibility) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3920 (message "Startup visibility, plus VISIBILITY properties.")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
3921 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3922 ((org-at-table-p 'any) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3923 ;; Enter the table or move to the next field in the table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3924 (or (org-table-recognize-table.el) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3925 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3926 (if arg (org-table-edit-field t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3927 (org-table-justify-field-maybe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3928 (call-interactively 'org-table-next-field))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3929 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3930 ((eq arg t) ;; Global cycling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3931 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3932 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3933 ((and (eq last-command this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3934 (eq org-cycle-global-status 'overview)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3935 ;; We just created the overview - now do table of contents |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3936 ;; This can be slow in very large buffers, so indicate action |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3937 (message "CONTENTS...") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3938 (org-content) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3939 (message "CONTENTS...done") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3940 (setq org-cycle-global-status 'contents) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3941 (run-hook-with-args 'org-cycle-hook 'contents)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3942 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3943 ((and (eq last-command this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3944 (eq org-cycle-global-status 'contents)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3945 ;; We just showed the table of contents - now show everything |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3946 (show-all) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3947 (message "SHOW ALL") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3948 (setq org-cycle-global-status 'all) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3949 (run-hook-with-args 'org-cycle-hook 'all)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3950 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3951 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3952 ;; Default action: go to overview |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3953 (org-overview) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3954 (message "OVERVIEW") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3955 (setq org-cycle-global-status 'overview) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3956 (run-hook-with-args 'org-cycle-hook 'overview)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3957 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3958 ((and org-drawers org-drawer-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3959 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3960 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3961 (looking-at org-drawer-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3962 ;; Toggle block visibility |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3963 (org-flag-drawer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3964 (not (get-char-property (match-end 0) 'invisible)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3965 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3966 ((integerp arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3967 ;; Show-subtree, ARG levels up from here. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3968 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3969 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3970 (outline-up-heading (if (< arg 0) (- arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3971 (- (funcall outline-level) arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3972 (org-show-subtree))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3973 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3974 ((and (save-excursion (beginning-of-line 1) (looking-at outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3975 (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3976 ;; At a heading: rotate between three different views |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3977 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3978 (let ((goal-column 0) eoh eol eos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3979 ;; First, some boundaries |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3980 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3981 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3982 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3983 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3984 (while (and (not (eobp)) ;; this is like `next-line' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3985 (get-char-property (1- (point)) 'invisible)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3986 (beginning-of-line 2)) (setq eol (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3987 (outline-end-of-heading) (setq eoh (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3988 (org-end-of-subtree t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3989 (unless (eobp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3990 (skip-chars-forward " \t\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3991 (beginning-of-line 1) ; in case this is an item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3992 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3993 (setq eos (1- (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3994 ;; Find out what to do next and set `this-command' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3995 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3996 ((= eos eoh) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3997 ;; Nothing is hidden behind this heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3998 (message "EMPTY ENTRY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
3999 (setq org-cycle-subtree-status nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4000 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4001 (goto-char eos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4002 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4003 (if (org-invisible-p) (org-flag-heading nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4004 ((or (>= eol eos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4005 (not (string-match "\\S-" (buffer-substring eol eos)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4006 ;; Entire subtree is hidden in one line: open it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4007 (org-show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4008 (show-children) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4009 (message "CHILDREN") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4010 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4011 (goto-char eos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4012 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4013 (if (org-invisible-p) (org-flag-heading nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4014 (setq org-cycle-subtree-status 'children) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4015 (run-hook-with-args 'org-cycle-hook 'children)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4016 ((and (eq last-command this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4017 (eq org-cycle-subtree-status 'children)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4018 ;; We just showed the children, now show everything. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4019 (org-show-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4020 (message "SUBTREE") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4021 (setq org-cycle-subtree-status 'subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4022 (run-hook-with-args 'org-cycle-hook 'subtree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4023 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4024 ;; Default action: hide the subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4025 (hide-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4026 (message "FOLDED") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4027 (setq org-cycle-subtree-status 'folded) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4028 (run-hook-with-args 'org-cycle-hook 'folded))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4029 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4030 ;; TAB emulation and template completion |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4031 (buffer-read-only (org-back-to-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4032 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4033 ((org-try-structure-completion)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4034 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4035 ((org-try-cdlatex-tab)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4036 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4037 ((and (eq org-cycle-emulate-tab 'exc-hl-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4038 (or (not (bolp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4039 (not (looking-at outline-regexp)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4040 (call-interactively (global-key-binding "\t"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4041 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4042 ((if (and (memq org-cycle-emulate-tab '(white whitestart)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4043 (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4044 (or (and (eq org-cycle-emulate-tab 'white) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4045 (= (match-end 0) (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4046 (and (eq org-cycle-emulate-tab 'whitestart) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4047 (>= (match-end 0) pos)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4048 t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4049 (eq org-cycle-emulate-tab t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4050 (call-interactively (global-key-binding "\t"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4051 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4052 (t (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4053 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4054 (org-cycle)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4055 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4056 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4057 (defun org-global-cycle (&optional arg) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4058 "Cycle the global visibility. For details see `org-cycle'. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4059 With C-u prefix arg, switch to startup visibility. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4060 With a numeric prefix, show all headlines up to that level." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4061 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4062 (let ((org-cycle-include-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4063 (if (org-mode-p) org-cycle-include-plain-lists nil))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4064 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4065 ((integerp arg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4066 (show-all) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4067 (hide-sublevels arg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4068 (setq org-cycle-global-status 'contents)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4069 ((equal arg '(4)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4070 (org-set-startup-visibility) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4071 (message "Startup visibility, plus VISIBILITY properties.")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4072 (t |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4073 (org-cycle '(4)))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4074 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4075 (defun org-set-startup-visibility () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4076 "Set the visibility required by startup options and properties." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4077 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4078 ((eq org-startup-folded t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4079 (org-cycle '(4))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4080 ((eq org-startup-folded 'content) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4081 (let ((this-command 'org-cycle) (last-command 'org-cycle)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4082 (org-cycle '(4)) (org-cycle '(4))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4083 (org-set-visibility-according-to-property 'no-cleanup) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4084 (org-cycle-hide-archived-subtrees 'all) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4085 (org-cycle-hide-drawers 'all) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4086 (org-cycle-show-empty-lines 'all)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4087 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4088 (defun org-set-visibility-according-to-property (&optional no-cleanup) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4089 "Switch subtree visibilities according to :VISIBILITY: property." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4090 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4091 (let (state) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4092 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4093 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4094 (while (re-search-forward |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4095 "^[ \t]*:VISIBILITY:[ \t]+\\([a-z]+\\)" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4096 nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4097 (setq state (match-string 1)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4098 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4099 (org-back-to-heading t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4100 (hide-subtree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4101 (org-reveal) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4102 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4103 ((equal state '("fold" "folded")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4104 (hide-subtree)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4105 ((equal state "children") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4106 (org-show-hidden-entry) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4107 (show-children)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4108 ((equal state "content") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4109 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4110 (save-restriction |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4111 (org-narrow-to-subtree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4112 (org-content)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4113 ((member state '("all" "showall")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4114 (show-subtree))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4115 (unless no-cleanup |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4116 (org-cycle-hide-archived-subtrees 'all) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4117 (org-cycle-hide-drawers 'all) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4118 (org-cycle-show-empty-lines 'all))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4119 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4120 (defun org-overview () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4121 "Switch to overview mode, shoing only top-level headlines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4122 Really, this shows all headlines with level equal or greater than the level |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4123 of the first headline in the buffer. This is important, because if the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4124 first headline is not level one, then (hide-sublevels 1) gives confusing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4125 results." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4126 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4127 (let ((level (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4128 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4129 (if (re-search-forward (concat "^" outline-regexp) nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4130 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4131 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4132 (funcall outline-level)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4133 (and level (hide-sublevels level)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4134 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4135 (defun org-content (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4136 "Show all headlines in the buffer, like a table of contents. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4137 With numerical argument N, show content up to level N." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4138 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4139 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4140 ;; Visit all headings and show their offspring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4141 (and (integerp arg) (org-overview)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4142 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4143 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4144 (while (and (progn (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4145 (outline-previous-visible-heading 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4146 (error (goto-char (point-min)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4147 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4148 (looking-at outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4149 (if (integerp arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4150 (show-children (1- arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4151 (show-branches)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4152 (if (bobp) (throw 'exit nil)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4153 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4154 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4155 (defun org-optimize-window-after-visibility-change (state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4156 "Adjust the window after a change in outline visibility. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4157 This function is the default value of the hook `org-cycle-hook'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4158 (when (get-buffer-window (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4159 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4160 ; ((eq state 'overview) (org-first-headline-recenter 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4161 ; ((eq state 'overview) (org-beginning-of-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4162 ((eq state 'content) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4163 ((eq state 'all) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4164 ((eq state 'folded) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4165 ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4166 ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4167 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4168 (defun org-compact-display-after-subtree-move () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4169 (let (beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4170 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4171 (if (org-up-heading-safe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4172 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4173 (hide-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4174 (show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4175 (show-children) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4176 (org-cycle-show-empty-lines 'children) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4177 (org-cycle-hide-drawers 'children)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4178 (org-overview))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4179 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4180 (defun org-cycle-show-empty-lines (state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4181 "Show empty lines above all visible headlines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4182 The region to be covered depends on STATE when called through |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4183 `org-cycle-hook'. Lisp program can use t for STATE to get the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4184 entire buffer covered. Note that an empty line is only shown if there |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4185 are at least `org-cycle-separator-lines' empty lines before the headeline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4186 (when (> org-cycle-separator-lines 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4187 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4188 (let* ((n org-cycle-separator-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4189 (re (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4190 ((= n 1) "\\(\n[ \t]*\n\\*+\\) ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4191 ((= n 2) "^[ \t]*\\(\n[ \t]*\n\\*+\\) ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4192 (t (let ((ns (number-to-string (- n 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4193 (concat "^\\(?:[ \t]*\n\\)\\{" ns "," ns "\\}" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4194 "[ \t]*\\(\n[ \t]*\n\\*+\\) "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4195 beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4196 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4197 ((memq state '(overview contents t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4198 (setq beg (point-min) end (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4199 ((memq state '(children folded)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4200 (setq beg (point) end (progn (org-end-of-subtree t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4201 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4202 (point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4203 (when beg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4204 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4205 (while (re-search-forward re end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4206 (if (not (get-char-property (match-end 1) 'invisible)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4207 (outline-flag-region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4208 (match-beginning 1) (match-end 1) nil))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4209 ;; Never hide empty lines at the end of the file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4210 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4211 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4212 (outline-previous-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4213 (outline-end-of-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4214 (if (and (looking-at "[ \t\n]+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4215 (= (match-end 0) (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4216 (outline-flag-region (point) (match-end 0) nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4217 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4218 (defun org-show-empty-lines-in-parent () |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4219 "Move to the parent and re-show empty lines before visible headlines." |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4220 (save-excursion |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4221 (let ((context (if (org-up-heading-safe) 'children 'overview))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4222 (org-cycle-show-empty-lines context)))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4223 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4224 (defun org-cycle-hide-drawers (state) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4225 "Re-hide all drawers after a visibility state change." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4226 (when (and (org-mode-p) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4227 (not (memq state '(overview folded)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4228 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4229 (let* ((globalp (memq state '(contents all))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4230 (beg (if globalp (point-min) (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4231 (end (if globalp (point-max) (org-end-of-subtree t)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4232 (goto-char beg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4233 (while (re-search-forward org-drawer-regexp end t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4234 (org-flag-drawer t)))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4235 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4236 (defun org-flag-drawer (flag) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4237 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4238 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4239 (when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4240 (let ((b (match-end 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4241 (outline-regexp org-outline-regexp)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4242 (if (re-search-forward |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4243 "^[ \t]*:END:" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4244 (save-excursion (outline-next-heading) (point)) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4245 (outline-flag-region b (point-at-eol) flag) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4246 (error ":END: line missing")))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4247 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4248 (defun org-subtree-end-visible-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4249 "Is the end of the current subtree visible?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4250 (pos-visible-in-window-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4251 (save-excursion (org-end-of-subtree t) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4252 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4253 (defun org-first-headline-recenter (&optional N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4254 "Move cursor to the first headline and recenter the headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4255 Optional argument N means, put the headline into the Nth line of the window." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4256 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4257 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4258 (beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4259 (recenter (prefix-numeric-value N)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4260 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4261 ;;; Org-goto |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4262 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4263 (defvar org-goto-window-configuration nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4264 (defvar org-goto-marker nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4265 (defvar org-goto-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4266 (let ((map (make-sparse-keymap))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4267 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4268 (while (setq cmd (pop cmds)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4269 (substitute-key-definition cmd cmd map global-map))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4270 (suppress-keymap map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4271 (org-defkey map "\C-m" 'org-goto-ret) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4272 (org-defkey map [(return)] 'org-goto-ret) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4273 (org-defkey map [(left)] 'org-goto-left) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4274 (org-defkey map [(right)] 'org-goto-right) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4275 (org-defkey map [(control ?g)] 'org-goto-quit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4276 (org-defkey map "\C-i" 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4277 (org-defkey map [(tab)] 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4278 (org-defkey map [(down)] 'outline-next-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4279 (org-defkey map [(up)] 'outline-previous-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4280 (if org-goto-auto-isearch |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4281 (if (fboundp 'define-key-after) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4282 (define-key-after map [t] 'org-goto-local-auto-isearch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4283 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4284 (org-defkey map "q" 'org-goto-quit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4285 (org-defkey map "n" 'outline-next-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4286 (org-defkey map "p" 'outline-previous-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4287 (org-defkey map "f" 'outline-forward-same-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4288 (org-defkey map "b" 'outline-backward-same-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4289 (org-defkey map "u" 'outline-up-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4290 (org-defkey map "/" 'org-occur) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4291 (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4292 (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4293 (org-defkey map "\C-c\C-f" 'outline-forward-same-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4294 (org-defkey map "\C-c\C-b" 'outline-backward-same-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4295 (org-defkey map "\C-c\C-u" 'outline-up-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4296 map)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4297 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4298 (defconst org-goto-help |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4299 "Browse buffer copy, to find location or copy text. Just type for auto-isearch. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4300 RET=jump to location [Q]uit and return to previous location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4301 \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4302 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4303 (defvar org-goto-start-pos) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4304 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4305 ;; FIXME: Docstring doe not mention both interfaces |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4306 (defun org-goto (&optional alternative-interface) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4307 "Look up a different location in the current file, keeping current visibility. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4308 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4309 When you want look-up or go to a different location in a document, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4310 fastest way is often to fold the entire buffer and then dive into the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4311 This method has the disadvantage, that the previous location will be folded, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4312 which may not be what you want. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4313 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4314 This command works around this by showing a copy of the current buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4315 in an indirect buffer, in overview mode. You can dive into the tree in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4316 that copy, use org-occur and incremental search to find a location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4317 When pressing RET or `Q', the command returns to the original buffer in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4318 which the visibility is still unchanged. After RET is will also jump to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4319 the location selected in the indirect buffer and expose the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4320 the headline hierarchy above." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4321 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4322 (let* ((org-refile-targets '((nil . (:maxlevel . 10)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4323 (org-refile-use-outline-path t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4324 (interface |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4325 (if (not alternative-interface) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4326 org-goto-interface |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4327 (if (eq org-goto-interface 'outline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4328 'outline-path-completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4329 'outline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4330 (org-goto-start-pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4331 (selected-point |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4332 (if (eq interface 'outline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4333 (car (org-get-location (current-buffer) org-goto-help)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4334 (nth 3 (org-refile-get-location "Goto: "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4335 (if selected-point |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4336 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4337 (org-mark-ring-push org-goto-start-pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4338 (goto-char selected-point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4339 (if (or (org-invisible-p) (org-invisible-p2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4340 (org-show-context 'org-goto))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4341 (message "Quit")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4342 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4343 (defvar org-goto-selected-point nil) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4344 (defvar org-goto-exit-command nil) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4345 (defvar org-goto-local-auto-isearch-map) ; defined below |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4346 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4347 (defun org-get-location (buf help) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4348 "Let the user select a location in the Org-mode buffer BUF. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4349 This function uses a recursive edit. It returns the selected position |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4350 or nil." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4351 (let ((isearch-mode-map org-goto-local-auto-isearch-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4352 (isearch-hide-immediately nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4353 (isearch-search-fun-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4354 (lambda () 'org-goto-local-search-forward-headings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4355 (org-goto-selected-point org-goto-exit-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4356 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4357 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4358 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4359 (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4360 (switch-to-buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4361 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4362 (make-indirect-buffer (current-buffer) "*org-goto*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4363 (error (make-indirect-buffer (current-buffer) "*org-goto*")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4364 (with-output-to-temp-buffer "*Help*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4365 (princ help)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4366 (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4367 (setq buffer-read-only nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4368 (let ((org-startup-truncated t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4369 (org-startup-folded nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4370 (org-startup-align-all-tables nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4371 (org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4372 (org-overview)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4373 (setq buffer-read-only t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4374 (if (and (boundp 'org-goto-start-pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4375 (integer-or-marker-p org-goto-start-pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4376 (let ((org-show-hierarchy-above t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4377 (org-show-siblings t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4378 (org-show-following-heading t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4379 (goto-char org-goto-start-pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4380 (and (org-invisible-p) (org-show-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4381 (goto-char (point-min))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4382 (org-beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4383 (message "Select location and press RET") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4384 (use-local-map org-goto-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4385 (recursive-edit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4386 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4387 (kill-buffer "*org-goto*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4388 (cons org-goto-selected-point org-goto-exit-command))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4389 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4390 (defvar org-goto-local-auto-isearch-map (make-sparse-keymap)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4391 (set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4392 (define-key org-goto-local-auto-isearch-map "\C-i" 'isearch-other-control-char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4393 (define-key org-goto-local-auto-isearch-map "\C-m" 'isearch-other-control-char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4394 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4395 (defun org-goto-local-search-forward-headings (string bound noerror) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4396 "Search and make sure that anu matches are in headlines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4397 (catch 'return |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4398 (while (search-forward string bound noerror) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4399 (when (let ((context (mapcar 'car (save-match-data (org-context))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4400 (and (member :headline context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4401 (not (member :tags context)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4402 (throw 'return (point)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4403 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4404 (defun org-goto-local-auto-isearch () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4405 "Start isearch." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4406 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4407 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4408 (let ((keys (this-command-keys))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4409 (when (eq (lookup-key isearch-mode-map keys) 'isearch-printing-char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4410 (isearch-mode t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4411 (isearch-process-search-char (string-to-char keys))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4412 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4413 (defun org-goto-ret (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4414 "Finish `org-goto' by going to the new location." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4415 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4416 (setq org-goto-selected-point (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4417 org-goto-exit-command 'return) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4418 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4419 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4420 (defun org-goto-left () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4421 "Finish `org-goto' by going to the new location." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4422 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4423 (if (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4424 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4425 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4426 (setq org-goto-selected-point (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4427 org-goto-exit-command 'left) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4428 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4429 (error "Not on a heading"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4430 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4431 (defun org-goto-right () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4432 "Finish `org-goto' by going to the new location." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4433 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4434 (if (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4435 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4436 (setq org-goto-selected-point (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4437 org-goto-exit-command 'right) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4438 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4439 (error "Not on a heading"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4440 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4441 (defun org-goto-quit () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4442 "Finish `org-goto' without cursor motion." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4443 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4444 (setq org-goto-selected-point nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4445 (setq org-goto-exit-command 'quit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4446 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4447 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4448 ;;; Indirect buffer display of subtrees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4449 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4450 (defvar org-indirect-dedicated-frame nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4451 "This is the frame being used for indirect tree display.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4452 (defvar org-last-indirect-buffer nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4453 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4454 (defun org-tree-to-indirect-buffer (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4455 "Create indirect buffer and narrow it to current subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4456 With numerical prefix ARG, go up to this level and then take that tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4457 If ARG is negative, go up that many levels. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4458 If `org-indirect-buffer-display' is not `new-frame', the command removes the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4459 indirect buffer previously made with this command, to avoid proliferation of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4460 indirect buffers. However, when you call the command with a `C-u' prefix, or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4461 when `org-indirect-buffer-display' is `new-frame', the last buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4462 is kept so that you can work with several indirect buffers at the same time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4463 If `org-indirect-buffer-display' is `dedicated-frame', the C-u prefix also |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4464 requests that a new frame be made for the new buffer, so that the dedicated |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4465 frame is not changed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4466 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4467 (let ((cbuf (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4468 (cwin (selected-window)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4469 (pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4470 beg end level heading ibuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4471 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4472 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4473 (when (numberp arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4474 (setq level (org-outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4475 (if (< arg 0) (setq arg (+ level arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4476 (while (> (setq level (org-outline-level)) arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4477 (outline-up-heading 1 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4478 (setq beg (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4479 heading (org-get-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4480 (org-end-of-subtree t) (setq end (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4481 (if (and (buffer-live-p org-last-indirect-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4482 (not (eq org-indirect-buffer-display 'new-frame)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4483 (not arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4484 (kill-buffer org-last-indirect-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4485 (setq ibuf (org-get-indirect-buffer cbuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4486 org-last-indirect-buffer ibuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4487 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4488 ((or (eq org-indirect-buffer-display 'new-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4489 (and arg (eq org-indirect-buffer-display 'dedicated-frame))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4490 (select-frame (make-frame)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4491 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4492 (switch-to-buffer ibuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4493 (org-set-frame-title heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4494 ((eq org-indirect-buffer-display 'dedicated-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4495 (raise-frame |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4496 (select-frame (or (and org-indirect-dedicated-frame |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4497 (frame-live-p org-indirect-dedicated-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4498 org-indirect-dedicated-frame) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4499 (setq org-indirect-dedicated-frame (make-frame))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4500 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4501 (switch-to-buffer ibuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4502 (org-set-frame-title (concat "Indirect: " heading))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4503 ((eq org-indirect-buffer-display 'current-window) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4504 (switch-to-buffer ibuf)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4505 ((eq org-indirect-buffer-display 'other-window) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4506 (pop-to-buffer ibuf)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4507 (t (error "Invalid value."))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4508 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4509 (save-excursion (org-mode) (turn-on-font-lock))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4510 (narrow-to-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4511 (show-all) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4512 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4513 (and (window-live-p cwin) (select-window cwin)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4514 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4515 (defun org-get-indirect-buffer (&optional buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4516 (setq buffer (or buffer (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4517 (let ((n 1) (base (buffer-name buffer)) bname) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4518 (while (buffer-live-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4519 (get-buffer (setq bname (concat base "-" (number-to-string n))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4520 (setq n (1+ n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4521 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4522 (make-indirect-buffer buffer bname 'clone) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4523 (error (make-indirect-buffer buffer bname))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4524 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4525 (defun org-set-frame-title (title) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4526 "Set the title of the current frame to the string TITLE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4527 ;; FIXME: how to name a single frame in XEmacs??? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4528 (unless (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4529 (modify-frame-parameters (selected-frame) (list (cons 'name title))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4530 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4531 ;;;; Structure editing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4532 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4533 ;;; Inserting headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4534 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4535 (defun org-insert-heading (&optional force-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4536 "Insert a new heading or item with same depth at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4537 If point is in a plain list and FORCE-HEADING is nil, create a new list item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4538 If point is at the beginning of a headline, insert a sibling before the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4539 current headline. If point is not at the beginning, do not split the line, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4540 but create the new hedline after the current line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4541 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4542 (if (= (buffer-size) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4543 (insert "\n* ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4544 (when (or force-heading (not (org-insert-item))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4545 (let* ((head (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4546 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4547 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4548 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4549 (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4550 (error "*")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4551 (blank (cdr (assq 'heading org-blank-before-new-entry))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4552 pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4553 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4554 ((and (org-on-heading-p) (bolp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4555 (or (bobp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4556 (save-excursion (backward-char 1) (not (org-invisible-p))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4557 ;; insert before the current line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4558 (open-line (if blank 2 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4559 ((and (bolp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4560 (or (bobp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4561 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4562 (backward-char 1) (not (org-invisible-p))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4563 ;; insert right here |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4564 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4565 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4566 ;; in the middle of the line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4567 (org-show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4568 (let ((split |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4569 (org-get-alist-option org-M-RET-may-split-line 'headline)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4570 tags pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4571 (if (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4572 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4573 (looking-at ".*?\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4574 (setq tags (and (match-end 2) (match-string 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4575 (and (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4576 (delete-region (match-beginning 1) (match-end 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4577 (setq pos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4578 (or split (end-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4579 (delete-horizontal-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4580 (newline (if blank 2 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4581 (when tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4582 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4583 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4584 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4585 (insert " " tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4586 (org-set-tags nil 'align)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4587 (or split (end-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4588 (newline (if blank 2 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4589 (insert head) (just-one-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4590 (setq pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4591 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4592 (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4593 (run-hooks 'org-insert-heading-hook))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4594 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4595 (defun org-get-heading (&optional no-tags) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4596 "Return the heading of the current entry, without the stars." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4597 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4598 (org-back-to-heading t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4599 (if (looking-at |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4600 (if no-tags |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4601 (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4602 "\\*+[ \t]+\\([^\r\n]*\\)")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4603 (match-string 1) ""))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4604 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4605 (defun org-insert-heading-after-current () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4606 "Insert a new heading with same level as current, after current subtree." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4607 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4608 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4609 (org-insert-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4610 (org-move-subtree-down) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4611 (end-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4612 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4613 (defun org-insert-todo-heading (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4614 "Insert a new heading with the same level and TODO state as current heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4615 If the heading has no TODO state, or if the state is DONE, use the first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4616 state (TODO by default). Also with prefix arg, force first state." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4617 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4618 (when (not (org-insert-item 'checkbox)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4619 (org-insert-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4620 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4621 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4622 (outline-previous-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4623 (looking-at org-todo-line-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4624 (if (or arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4625 (not (match-beginning 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4626 (member (match-string 2) org-done-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4627 (insert (car org-todo-keywords-1) " ") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4628 (insert (match-string 2) " ")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4629 (when org-provide-todo-statistics |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4630 (org-update-parent-todo-statistics)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4631 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4632 (defun org-insert-subheading (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4633 "Insert a new subheading and demote it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4634 Works for outline headings and for plain lists alike." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4635 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4636 (org-insert-heading arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4637 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4638 ((org-on-heading-p) (org-do-demote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4639 ((org-at-item-p) (org-indent-item 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4640 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4641 (defun org-insert-todo-subheading (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4642 "Insert a new subheading with TODO keyword or checkbox and demote it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4643 Works for outline headings and for plain lists alike." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4644 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4645 (org-insert-todo-heading arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4646 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4647 ((org-on-heading-p) (org-do-demote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4648 ((org-at-item-p) (org-indent-item 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4649 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4650 ;;; Promotion and Demotion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4651 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4652 (defun org-promote-subtree () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4653 "Promote the entire subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4654 See also `org-promote'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4655 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4656 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4657 (org-map-tree 'org-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4658 (org-fix-position-after-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4659 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4660 (defun org-demote-subtree () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4661 "Demote the entire subtree. See `org-demote'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4662 See also `org-promote'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4663 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4664 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4665 (org-map-tree 'org-demote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4666 (org-fix-position-after-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4667 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4668 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4669 (defun org-do-promote () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4670 "Promote the current heading higher up the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4671 If the region is active in `transient-mark-mode', promote all headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4672 in the region." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4673 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4674 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4675 (if (org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4676 (org-map-region 'org-promote (region-beginning) (region-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4677 (org-promote))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4678 (org-fix-position-after-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4679 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4680 (defun org-do-demote () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4681 "Demote the current heading lower down the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4682 If the region is active in `transient-mark-mode', demote all headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4683 in the region." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4684 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4685 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4686 (if (org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4687 (org-map-region 'org-demote (region-beginning) (region-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4688 (org-demote))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4689 (org-fix-position-after-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4690 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4691 (defun org-fix-position-after-promote () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4692 "Make sure that after pro/demotion cursor position is right." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4693 (let ((pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4694 (when (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4695 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4696 (looking-at org-todo-line-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4697 (or (equal pos (match-end 1)) (equal pos (match-end 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4698 (cond ((eobp) (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4699 ((eolp) (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4700 ((equal (char-after) ?\ ) (forward-char 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4701 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4702 (defun org-reduced-level (l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4703 (if org-odd-levels-only (1+ (floor (/ l 2))) l)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4704 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4705 (defun org-get-valid-level (level &optional change) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4706 "Rectify a level change under the influence of `org-odd-levels-only' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4707 LEVEL is a current level, CHANGE is by how much the level should be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4708 modified. Even if CHANGE is nil, LEVEL may be returned modified because |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4709 even level numbers will become the next higher odd number." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4710 (if org-odd-levels-only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4711 (cond ((or (not change) (= 0 change)) (1+ (* 2 (/ level 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4712 ((> change 0) (1+ (* 2 (/ (+ level (* 2 change)) 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4713 ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4714 (max 1 (+ level change)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4715 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4716 (if (boundp 'define-obsolete-function-alias) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4717 (if (or (featurep 'xemacs) (< emacs-major-version 23)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4718 (define-obsolete-function-alias 'org-get-legal-level |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4719 'org-get-valid-level) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4720 (define-obsolete-function-alias 'org-get-legal-level |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
4721 'org-get-valid-level "23.1"))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4722 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4723 (defun org-promote () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4724 "Promote the current heading higher up the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4725 If the region is active in `transient-mark-mode', promote all headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4726 in the region." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4727 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4728 (let* ((level (save-match-data (funcall outline-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4729 (up-head (concat (make-string (org-get-valid-level level -1) ?*) " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4730 (diff (abs (- level (length up-head) -1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4731 (if (= level 1) (error "Cannot promote to level 0. UNDO to recover if necessary")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4732 (replace-match up-head nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4733 ;; Fixup tag positioning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4734 (and org-auto-align-tags (org-set-tags nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4735 (if org-adapt-indentation (org-fixup-indentation (- diff))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4736 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4737 (defun org-demote () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4738 "Demote the current heading lower down the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4739 If the region is active in `transient-mark-mode', demote all headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4740 in the region." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4741 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4742 (let* ((level (save-match-data (funcall outline-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4743 (down-head (concat (make-string (org-get-valid-level level 1) ?*) " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4744 (diff (abs (- level (length down-head) -1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4745 (replace-match down-head nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4746 ;; Fixup tag positioning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4747 (and org-auto-align-tags (org-set-tags nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4748 (if org-adapt-indentation (org-fixup-indentation diff)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4749 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4750 (defun org-map-tree (fun) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4751 "Call FUN for every heading underneath the current one." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4752 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4753 (let ((level (funcall outline-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4754 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4755 (funcall fun) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4756 (while (and (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4757 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4758 (> (funcall outline-level) level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4759 (not (eobp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4760 (funcall fun))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4761 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4762 (defun org-map-region (fun beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4763 "Call FUN for every heading between BEG and END." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4764 (let ((org-ignore-region t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4765 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4766 (setq end (copy-marker end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4767 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4768 (if (and (re-search-forward (concat "^" outline-regexp) nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4769 (< (point) end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4770 (funcall fun)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4771 (while (and (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4772 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4773 (< (point) end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4774 (not (eobp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4775 (funcall fun))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4776 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4777 (defun org-fixup-indentation (diff) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4778 "Change the indentation in the current entry by DIFF |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4779 However, if any line in the current entry has no indentation, or if it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4780 would end up with no indentation after the change, nothing at all is done." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4781 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4782 (let ((end (save-excursion (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4783 (point-marker))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4784 (prohibit (if (> diff 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4785 "^\\S-" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4786 (concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4787 col) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4788 (unless (save-excursion (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4789 (re-search-forward prohibit end t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4790 (while (and (< (point) end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4791 (re-search-forward "^[ \t]+" end t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4792 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4793 (setq col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4794 (if (< diff 0) (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4795 (indent-to (+ diff col)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4796 (move-marker end nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4797 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4798 (defun org-convert-to-odd-levels () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4799 "Convert an org-mode file with all levels allowed to one with odd levels. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4800 This will leave level 1 alone, convert level 2 to level 3, level 3 to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4801 level 5 etc." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4802 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4803 (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4804 (let ((org-odd-levels-only nil) n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4805 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4806 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4807 (while (re-search-forward "^\\*\\*+ " nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4808 (setq n (- (length (match-string 0)) 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4809 (while (>= (setq n (1- n)) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4810 (org-demote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4811 (end-of-line 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4812 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4813 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4814 (defun org-convert-to-oddeven-levels () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4815 "Convert an org-mode file with only odd levels to one with odd and even levels. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4816 This promotes level 3 to level 2, level 5 to level 3 etc. If the file contains a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4817 section with an even level, conversion would destroy the structure of the file. An error |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4818 is signaled in this case." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4819 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4820 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4821 ;; First check if there are no even levels |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4822 (when (re-search-forward "^\\(\\*\\*\\)+ " nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4823 (org-show-context t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4824 (error "Not all levels are odd in this file. Conversion not possible.")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4825 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4826 (let ((org-odd-levels-only nil) n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4827 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4828 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4829 (while (re-search-forward "^\\*\\*+ " nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4830 (setq n (/ (1- (length (match-string 0))) 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4831 (while (>= (setq n (1- n)) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4832 (org-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4833 (end-of-line 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4834 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4835 (defun org-tr-level (n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4836 "Make N odd if required." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4837 (if org-odd-levels-only (1+ (/ n 2)) n)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4838 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4839 ;;; Vertical tree motion, cutting and pasting of subtrees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4840 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4841 (defun org-move-subtree-up (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4842 "Move the current subtree up past ARG headlines of the same level." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4843 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4844 (org-move-subtree-down (- (prefix-numeric-value arg)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4845 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4846 (defun org-move-subtree-down (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4847 "Move the current subtree down past ARG headlines of the same level." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4848 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4849 (setq arg (prefix-numeric-value arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4850 (let ((movfunc (if (> arg 0) 'outline-get-next-sibling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4851 'outline-get-last-sibling)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4852 (ins-point (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4853 (cnt (abs arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4854 beg beg0 end txt folded ne-beg ne-end ne-ins ins-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4855 ;; Select the tree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4856 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4857 (setq beg0 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4858 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4859 (setq ne-beg (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4860 (setq beg (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4861 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4862 (save-excursion (outline-end-of-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4863 (setq folded (org-invisible-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4864 (outline-end-of-subtree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4865 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4866 (setq ne-end (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4867 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4868 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4869 (when (and (> arg 0) (org-first-sibling-p) (< ne-end ne-beg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4870 ;; include less whitespace |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4871 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4872 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4873 (forward-line (- ne-beg ne-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4874 (setq beg (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4875 ;; Find insertion point, with error handling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4876 (while (> cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4877 (or (and (funcall movfunc) (looking-at outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4878 (progn (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4879 (error "Cannot move past superior level or buffer limit"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4880 (setq cnt (1- cnt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4881 (if (> arg 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4882 ;; Moving forward - still need to move over subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4883 (progn (org-end-of-subtree t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4884 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4885 (org-back-over-empty-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4886 (or (bolp) (newline))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4887 (setq ne-ins (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4888 (move-marker ins-point (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4889 (setq txt (buffer-substring beg end)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4890 (org-save-markers-in-region beg end) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4891 (delete-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4892 (outline-flag-region (1- beg) beg nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4893 (outline-flag-region (1- (point)) (point) nil) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4894 (let ((bbb (point))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4895 (insert-before-markers txt) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4896 (org-reinstall-markers-in-region bbb) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4897 (move-marker ins-point bbb)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4898 (or (bolp) (insert "\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4899 (setq ins-end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4900 (goto-char ins-point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4901 (org-skip-whitespace) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4902 (when (and (< arg 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4903 (org-first-sibling-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4904 (> ne-ins ne-beg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4905 ;; Move whitespace back to beginning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4906 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4907 (goto-char ins-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4908 (let ((kill-whole-line t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4909 (kill-line (- ne-ins ne-beg)) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4910 (insert (make-string (- ne-ins ne-beg) ?\n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4911 (move-marker ins-point nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4912 (org-compact-display-after-subtree-move) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4913 (org-show-empty-lines-in-parent) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4914 (unless folded |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4915 (org-show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4916 (show-children) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4917 (org-cycle-hide-drawers 'children)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4918 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4919 (defvar org-subtree-clip "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4920 "Clipboard for cut and paste of subtrees. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4921 This is actually only a copy of the kill, because we use the normal kill |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4922 ring. We need it to check if the kill was created by `org-copy-subtree'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4923 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4924 (defvar org-subtree-clip-folded nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4925 "Was the last copied subtree folded? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4926 This is used to fold the tree back after pasting.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4927 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4928 (defun org-cut-subtree (&optional n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4929 "Cut the current subtree into the clipboard. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4930 With prefix arg N, cut this many sequential subtrees. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4931 This is a short-hand for marking the subtree and then cutting it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4932 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4933 (org-copy-subtree n 'cut)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4934 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4935 (defun org-copy-subtree (&optional n cut force-store-markers) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4936 "Cut the current subtree into the clipboard. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4937 With prefix arg N, cut this many sequential subtrees. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4938 This is a short-hand for marking the subtree and then copying it. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4939 If CUT is non-nil, actually cut the subtree. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4940 If FORCE-STORE-MARKERS is non-nil, store the relative locations |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4941 of some markers in the region, even if CUT is non-nil. This is |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4942 useful if the caller implements cut-and-paste as copy-then-paste-then-cut." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4943 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4944 (let (beg end folded (beg0 (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4945 (if (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4946 (org-back-to-heading nil) ; take what looks like a subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4947 (org-back-to-heading t)) ; take what is really there |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4948 (org-back-over-empty-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4949 (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4950 (skip-chars-forward " \t\r\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4951 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4952 (save-excursion (outline-end-of-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4953 (setq folded (org-invisible-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4954 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4955 (outline-forward-same-level (1- n)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4956 (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4957 (org-end-of-subtree t t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4958 (org-back-over-empty-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4959 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4960 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4961 (when (> end beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4962 (setq org-subtree-clip-folded folded) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4963 (when (or cut force-store-markers) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
4964 (org-save-markers-in-region beg end)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4965 (if cut (kill-region beg end) (copy-region-as-kill beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4966 (setq org-subtree-clip (current-kill 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4967 (message "%s: Subtree(s) with %d characters" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4968 (if cut "Cut" "Copied") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4969 (length org-subtree-clip))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4970 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4971 (defun org-paste-subtree (&optional level tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4972 "Paste the clipboard as a subtree, with modification of headline level. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4973 The entire subtree is promoted or demoted in order to match a new headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4974 level. By default, the new level is derived from the visible headings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4975 before and after the insertion point, and taken to be the inferior headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4976 level of the two. So if the previous visible heading is level 3 and the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4977 next is level 4 (or vice versa), level 4 will be used for insertion. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4978 This makes sure that the subtree remains an independent subtree and does |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4979 not swallow low level entries. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4980 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4981 You can also force a different level, either by using a numeric prefix |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4982 argument, or by inserting the heading marker by hand. For example, if the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4983 cursor is after \"*****\", then the tree will be shifted to level 5. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4984 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4985 If you want to insert the tree as is, just use \\[yank]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4986 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4987 If optional TREE is given, use this text instead of the kill ring." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4988 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4989 (unless (org-kill-is-subtree-p tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4990 (error "%s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4991 (substitute-command-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4992 "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4993 (let* ((visp (not (org-invisible-p))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
4994 (txt (or tree (and kill-ring (current-kill 0)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4995 (^re (concat "^\\(" outline-regexp "\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4996 (re (concat "\\(" outline-regexp "\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4997 (^re_ (concat "\\(\\*+\\)[ \t]*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4998 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
4999 (old-level (if (string-match ^re txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5000 (- (match-end 0) (match-beginning 0) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5001 -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5002 (force-level (cond (level (prefix-numeric-value level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5003 ((string-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5004 ^re_ (buffer-substring (point-at-bol) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5005 (- (match-end 1) (match-beginning 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5006 (t nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5007 (previous-level (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5008 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5009 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5010 (outline-previous-visible-heading 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5011 (if (looking-at re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5012 (- (match-end 0) (match-beginning 0) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5013 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5014 (error 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5015 (next-level (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5016 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5017 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5018 (or (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5019 (outline-next-visible-heading 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5020 (if (looking-at re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5021 (- (match-end 0) (match-beginning 0) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5022 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5023 (error 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5024 (new-level (or force-level (max previous-level next-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5025 (shift (if (or (= old-level -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5026 (= new-level -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5027 (= old-level new-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5028 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5029 (- new-level old-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5030 (delta (if (> shift 0) -1 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5031 (func (if (> shift 0) 'org-demote 'org-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5032 (org-odd-levels-only nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5033 beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5034 ;; Remove the forced level indicator |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5035 (if force-level |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5036 (delete-region (point-at-bol) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5037 ;; Paste |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5038 (beginning-of-line 1) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5039 (org-back-over-empty-lines) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5040 (setq beg (point)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5041 (insert-before-markers txt) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5042 (unless (string-match "\n\\'" txt) (insert "\n")) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5043 (org-reinstall-markers-in-region beg) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5044 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5045 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5046 (skip-chars-forward " \t\n\r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5047 (setq beg (point)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
5048 (if (and (org-invisible-p) visp) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
5049 (save-excursion (outline-show-heading))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5050 ;; Shift if necessary |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5051 (unless (= shift 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5052 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5053 (narrow-to-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5054 (while (not (= shift 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5055 (org-map-region func (point-min) (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5056 (setq shift (+ delta shift))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5057 (goto-char (point-min)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5058 (when (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5059 (message "Clipboard pasted as level %d subtree" new-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5060 (if (and kill-ring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5061 (eq org-subtree-clip (current-kill 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5062 org-subtree-clip-folded) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5063 ;; The tree was folded before it was killed/copied |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5064 (hide-subtree)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5065 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5066 (defun org-kill-is-subtree-p (&optional txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5067 "Check if the current kill is an outline subtree, or a set of trees. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5068 Returns nil if kill does not start with a headline, or if the first |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5069 headline level is not the largest headline level in the tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5070 So this will actually accept several entries of equal levels as well, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5071 which is OK for `org-paste-subtree'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5072 If optional TXT is given, check this string instead of the current kill." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5073 (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5074 (start-level (and kill |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5075 (string-match (concat "\\`\\([ \t\n\r]*?\n\\)?\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5076 org-outline-regexp "\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5077 kill) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5078 (- (match-end 2) (match-beginning 2) 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5079 (re (concat "^" org-outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5080 (start (1+ (match-beginning 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5081 (if (not start-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5082 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5083 nil) ;; does not even start with a heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5084 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5085 (while (setq start (string-match re kill (1+ start))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5086 (when (< (- (match-end 0) (match-beginning 0) 1) start-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5087 (throw 'exit nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5088 t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5089 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5090 (defvar org-markers-to-move nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5091 "Markers that should be moved with a cut-and-paste operation. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5092 Those markers are stored together with their positions relative to |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5093 the start of the region.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5094 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5095 (defun org-save-markers-in-region (beg end) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5096 "Check markers in region. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5097 If these markers are between BEG and END, record their position relative |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5098 to BEG, so that after moving the block of text, we can put the markers back |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5099 into place. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5100 This function gets called just before an entry or tree gets cut from the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5101 buffer. After re-insertion, `org-reinstall-markers-in-region' must be |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5102 called immediately, to move the markers with the entries." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5103 (setq org-markers-to-move nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5104 (when (featurep 'org-clock) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5105 (org-clock-save-markers-for-cut-and-paste beg end)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5106 (when (featurep 'org-agenda) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5107 (org-agenda-save-markers-for-cut-and-paste beg end))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5108 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5109 (defun org-check-and-save-marker (marker beg end) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5110 "Check if MARKER is between BEG and END. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5111 If yes, remember the marker and the distance to BEG." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5112 (when (and (marker-buffer marker) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5113 (equal (marker-buffer marker) (current-buffer))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5114 (if (and (>= marker beg) (< marker end)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5115 (push (cons marker (- marker beg)) org-markers-to-move)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5116 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5117 (defun org-reinstall-markers-in-region (beg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5118 "Move all remembered markers to their position relative to BEG." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5119 (mapc (lambda (x) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5120 (move-marker (car x) (+ beg (cdr x)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5121 org-markers-to-move) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5122 (setq org-markers-to-move nil)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5123 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5124 (defun org-narrow-to-subtree () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5125 "Narrow buffer to the current subtree." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5126 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5127 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5128 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5129 (narrow-to-region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5130 (progn (org-back-to-heading) (point)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
5131 (progn (org-end-of-subtree t) (point)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5132 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5133 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5134 ;;; Outline Sorting |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5135 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5136 (defun org-sort (with-case) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5137 "Call `org-sort-entries-or-items' or `org-table-sort-lines'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5138 Optional argument WITH-CASE means sort case-sensitively." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5139 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5140 (if (org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5141 (org-call-with-arg 'org-table-sort-lines with-case) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5142 (org-call-with-arg 'org-sort-entries-or-items with-case))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5143 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5144 (defun org-sort-remove-invisible (s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5145 (remove-text-properties 0 (length s) org-rm-props s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5146 (while (string-match org-bracket-link-regexp s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5147 (setq s (replace-match (if (match-end 2) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5148 (match-string 3 s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5149 (match-string 1 s)) t t s))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5150 s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5151 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5152 (defvar org-priority-regexp) ; defined later in the file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5153 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5154 (defun org-sort-entries-or-items (&optional with-case sorting-type getkey-func property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5155 "Sort entries on a certain level of an outline tree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5156 If there is an active region, the entries in the region are sorted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5157 Else, if the cursor is before the first entry, sort the top-level items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5158 Else, the children of the entry at point are sorted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5159 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5160 Sorting can be alphabetically, numerically, and by date/time as given by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5161 the first time stamp in the entry. The command prompts for the sorting |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5162 type unless it has been given to the function through the SORTING-TYPE |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5163 argument, which needs to a character, any of (?n ?N ?a ?A ?t ?T ?p ?P ?f ?F). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5164 If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies a function to be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5165 called with point at the beginning of the record. It must return either |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5166 a string or a number that should serve as the sorting key for that record. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5167 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5168 Comparing entries ignores case by default. However, with an optional argument |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5169 WITH-CASE, the sorting considers case as well." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5170 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5171 (let ((case-func (if with-case 'identity 'downcase)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5172 start beg end stars re re2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5173 txt what tmp plain-list-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5174 ;; Find beginning and end of region to sort |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5175 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5176 ((org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5177 ;; we will sort the region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5178 (setq end (region-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5179 what "region") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5180 (goto-char (region-beginning)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5181 (if (not (org-on-heading-p)) (outline-next-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5182 (setq start (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5183 ((org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5184 ;; we will sort this plain list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5185 (org-beginning-of-item-list) (setq start (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5186 (org-end-of-item-list) (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5187 (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5188 (setq plain-list-p t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5189 what "plain list")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5190 ((or (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5191 (condition-case nil (progn (org-back-to-heading) t) (error nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5192 ;; we will sort the children of the current headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5193 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5194 (setq start (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5195 end (progn (org-end-of-subtree t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5196 (org-back-over-empty-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5197 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5198 what "children") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5199 (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5200 (show-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5201 (outline-next-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5202 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5203 ;; we will sort the top-level entries in this file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5204 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5205 (or (org-on-heading-p) (outline-next-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5206 (setq start (point) end (point-max) what "top-level") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5207 (goto-char start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5208 (show-all))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5209 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5210 (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5211 (if (>= beg end) (error "Nothing to sort")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5212 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5213 (unless plain-list-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5214 (looking-at "\\(\\*+\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5215 (setq stars (match-string 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5216 re (concat "^" (regexp-quote stars) " +") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5217 re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[^*]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5218 txt (buffer-substring beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5219 (if (not (equal (substring txt -1) "\n")) (setq txt (concat txt "\n"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5220 (if (and (not (equal stars "*")) (string-match re2 txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5221 (error "Region to sort contains a level above the first entry"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5222 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5223 (unless sorting-type |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5224 (message |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5225 (if plain-list-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5226 "Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5227 "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty todo[o]rder [f]unc A/N/T/P/O/F means reversed:") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5228 what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5229 (setq sorting-type (read-char-exclusive)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5230 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5231 (and (= (downcase sorting-type) ?f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5232 (setq getkey-func |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5233 (completing-read "Sort using function: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5234 obarray 'fboundp t nil nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5235 (setq getkey-func (intern getkey-func))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5236 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5237 (and (= (downcase sorting-type) ?r) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5238 (setq property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5239 (completing-read "Property: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5240 (mapcar 'list (org-buffer-property-keys t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5241 nil t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5242 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5243 (message "Sorting entries...") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5244 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5245 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5246 (narrow-to-region start end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5247 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5248 (let ((dcst (downcase sorting-type)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5249 (now (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5250 (sort-subr |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5251 (/= dcst sorting-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5252 ;; This function moves to the beginning character of the "record" to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5253 ;; be sorted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5254 (if plain-list-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5255 (lambda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5256 (if (org-at-item-p) t (goto-char (point-max)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5257 (lambda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5258 (if (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5259 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5260 (goto-char (point-max))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5261 ;; This function moves to the last character of the "record" being |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5262 ;; sorted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5263 (if plain-list-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5264 'org-end-of-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5265 (lambda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5266 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5267 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5268 (outline-forward-same-level 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5269 (error |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5270 (goto-char (point-max))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5271 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5272 ;; This function returns the value that gets sorted against. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5273 (if plain-list-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5274 (lambda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5275 (when (looking-at "[ \t]*[-+*0-9.)]+[ \t]+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5276 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5277 ((= dcst ?n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5278 (string-to-number (buffer-substring (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5279 (point-at-eol)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5280 ((= dcst ?a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5281 (buffer-substring (match-end 0) (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5282 ((= dcst ?t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5283 (if (re-search-forward org-ts-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5284 (point-at-eol) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5285 (org-time-string-to-time (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5286 now)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5287 ((= dcst ?f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5288 (if getkey-func |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5289 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5290 (setq tmp (funcall getkey-func)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5291 (if (stringp tmp) (setq tmp (funcall case-func tmp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5292 tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5293 (error "Invalid key function `%s'" getkey-func))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5294 (t (error "Invalid sorting type `%c'" sorting-type))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5295 (lambda nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5296 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5297 ((= dcst ?n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5298 (if (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5299 (string-to-number (buffer-substring (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5300 (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5301 nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5302 ((= dcst ?a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5303 (funcall case-func (buffer-substring (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5304 (point-at-eol)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5305 ((= dcst ?t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5306 (if (re-search-forward org-ts-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5307 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5308 (forward-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5309 (point)) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5310 (org-time-string-to-time (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5311 now)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5312 ((= dcst ?p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5313 (if (re-search-forward org-priority-regexp (point-at-eol) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5314 (string-to-char (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5315 org-default-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5316 ((= dcst ?r) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5317 (or (org-entry-get nil property) "")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5318 ((= dcst ?o) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5319 (if (looking-at org-complex-heading-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5320 (- 9999 (length (member (match-string 2) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5321 org-todo-keywords-1))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5322 ((= dcst ?f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5323 (if getkey-func |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5324 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5325 (setq tmp (funcall getkey-func)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5326 (if (stringp tmp) (setq tmp (funcall case-func tmp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5327 tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5328 (error "Invalid key function `%s'" getkey-func))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5329 (t (error "Invalid sorting type `%c'" sorting-type))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5330 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5331 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5332 ((= dcst ?a) 'string<) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5333 ((= dcst ?t) 'time-less-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5334 (t nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5335 (message "Sorting entries...done"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5336 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5337 (defun org-do-sort (table what &optional with-case sorting-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5338 "Sort TABLE of WHAT according to SORTING-TYPE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5339 The user will be prompted for the SORTING-TYPE if the call to this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5340 function does not specify it. WHAT is only for the prompt, to indicate |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5341 what is being sorted. The sorting key will be extracted from |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5342 the car of the elements of the table. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5343 If WITH-CASE is non-nil, the sorting will be case-sensitive." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5344 (unless sorting-type |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5345 (message |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5346 "Sort %s: [a]lphabetic. [n]umeric. [t]ime. A/N/T means reversed:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5347 what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5348 (setq sorting-type (read-char-exclusive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5349 (let ((dcst (downcase sorting-type)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5350 extractfun comparefun) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5351 ;; Define the appropriate functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5352 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5353 ((= dcst ?n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5354 (setq extractfun 'string-to-number |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5355 comparefun (if (= dcst sorting-type) '< '>))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5356 ((= dcst ?a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5357 (setq extractfun (if with-case (lambda(x) (org-sort-remove-invisible x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5358 (lambda(x) (downcase (org-sort-remove-invisible x)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5359 comparefun (if (= dcst sorting-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5360 'string< |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5361 (lambda (a b) (and (not (string< a b)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5362 (not (string= a b))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5363 ((= dcst ?t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5364 (setq extractfun |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5365 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5366 (if (string-match org-ts-regexp x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5367 (time-to-seconds |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5368 (org-time-string-to-time (match-string 0 x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5369 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5370 comparefun (if (= dcst sorting-type) '< '>))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5371 (t (error "Invalid sorting type `%c'" sorting-type))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5372 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5373 (sort (mapcar (lambda (x) (cons (funcall extractfun (car x)) (cdr x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5374 table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5375 (lambda (a b) (funcall comparefun (car a) (car b)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5376 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5377 ;;; Editing source examples |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5378 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5379 (defvar org-exit-edit-mode-map (make-sparse-keymap)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5380 (define-key org-exit-edit-mode-map "\C-c'" 'org-edit-src-exit) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5381 (defvar org-edit-src-force-single-line nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5382 (defvar org-edit-src-from-org-mode nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5383 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5384 (define-minor-mode org-exit-edit-mode |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5385 "Minor mode installing a single key binding, \"C-c '\" to exit special edit.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5386 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5387 (defun org-edit-src-code () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5388 "Edit the source code example at point. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5389 An indirect buffer is created, and that buffer is then narrowed to the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5390 example at point and switched to the correct language mode. When done, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5391 exit by killing the buffer with \\[org-edit-src-exit]." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5392 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5393 (let ((line (org-current-line)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5394 (case-fold-search t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5395 (msg (substitute-command-keys |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5396 "Edit, then exit with C-c ' (C-c and single quote)")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5397 (info (org-edit-src-find-region-and-lang)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5398 (org-mode-p (eq major-mode 'org-mode)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5399 beg end lang lang-f single) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5400 (if (not info) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5401 nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5402 (setq beg (nth 0 info) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5403 end (nth 1 info) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5404 lang (nth 2 info) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5405 single (nth 3 info) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5406 lang-f (intern (concat lang "-mode"))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5407 (unless (functionp lang-f) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5408 (error "No such language mode: %s" lang-f)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5409 (goto-line line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5410 (if (get-buffer "*Org Edit Src Example*") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5411 (kill-buffer "*Org Edit Src Example*")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5412 (switch-to-buffer (make-indirect-buffer (current-buffer) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5413 "*Org Edit Src Example*")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5414 (narrow-to-region beg end) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5415 (remove-text-properties beg end '(display nil invisible nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5416 intangible nil)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5417 (let ((org-inhibit-startup t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5418 (funcall lang-f)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5419 (set (make-local-variable 'org-edit-src-force-single-line) single) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5420 (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5421 (when org-mode-p |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5422 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5423 (while (re-search-forward "^," nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5424 (replace-match ""))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5425 (goto-line line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5426 (org-exit-edit-mode) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5427 (org-set-local 'header-line-format msg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5428 (message "%s" msg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5429 t))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5430 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5431 (defun org-edit-src-find-region-and-lang () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5432 "Find the region and language for a local edit. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5433 Return a list with beginning and end of the region, a string representing |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5434 the language, a switch telling of the content should be in a single line." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5435 (let ((re-list |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5436 '( |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5437 ("<src\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</src>" lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5438 ("<literal\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</literal>" style) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5439 ("<example>[ \t]*\n?" "\n?[ \t]*</example>" "fundamental") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5440 ("<lisp>[ \t]*\n?" "\n?[ \t]*</lisp>" "emacs-lisp") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5441 ("<perl>[ \t]*\n?" "\n?[ \t]*</perl>" "perl") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5442 ("<python>[ \t]*\n?" "\n?[ \t]*</python>" "python") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5443 ("<ruby>[ \t]*\n?" "\n?[ \t]*</ruby>" "ruby") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5444 ("^#\\+begin_src\\( \\([^ \t\n]+\\)\\)?.*\n" "\n#\\+end_src" 2) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5445 ("^#\\+begin_example.*\n" "^#\\+end_example" "fundamental") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5446 ("^#\\+html:" "\n" "html" single-line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5447 ("^#\\+begin_html.*\n" "\n#\\+end_html" "html") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5448 ("^#\\+begin_latex.*\n" "\n#\\+end_latex" "latex") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5449 ("^#\\+latex:" "\n" "latex" single-line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5450 ("^#\\+begin_ascii.*\n" "\n#\\+end_ascii" "fundamental") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5451 ("^#\\+ascii:" "\n" "ascii" single-line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5452 )) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5453 (pos (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5454 re re1 re2 single beg end lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5455 (catch 'exit |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5456 (while (setq entry (pop re-list)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5457 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5458 single (nth 3 entry)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5459 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5460 (if (or (looking-at re1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5461 (re-search-backward re1 nil t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5462 (progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5463 (setq beg (match-end 0) lang (org-edit-src-get-lang lang)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5464 (if (and (re-search-forward re2 nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5465 (>= (match-end 0) pos)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5466 (throw 'exit (list beg (match-beginning 0) lang single)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5467 (if (or (looking-at re2) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5468 (re-search-forward re2 nil t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5469 (progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5470 (setq end (match-beginning 0)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5471 (if (and (re-search-backward re1 nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5472 (<= (match-beginning 0) pos)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5473 (throw 'exit |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5474 (list (match-end 0) end |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5475 (org-edit-src-get-lang lang) single))))))))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5476 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5477 (defun org-edit-src-get-lang (lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5478 "Extract the src language." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5479 (let ((m (match-string 0))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5480 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5481 ((stringp lang) lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5482 ((integerp lang) (match-string lang)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5483 ((and (eq lang lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5484 (string-match "\\<lang=\"\\([^ \t\n\"]+\\)\"" m)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5485 (match-string 1 m)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5486 ((and (eq lang lang) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5487 (string-match "\\<style=\"\\([^ \t\n\"]+\\)\"" m)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5488 (match-string 1 m)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5489 (t "fundamental")))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5490 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5491 (defun org-edit-src-exit () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5492 "Exit special edit and protect problematic lines." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5493 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5494 (unless (buffer-base-buffer (current-buffer)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5495 (error "This is not an indirect buffer, something is wrong...")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5496 (unless (> (point-min) 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5497 (error "This buffer is not narrowed, something is wrong...")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5498 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5499 (if (looking-at "[ \t\n]*\n") (replace-match "")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5500 (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match "")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5501 (when (org-bound-and-true-p org-edit-src-force-single-line) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5502 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5503 (while (re-search-forward "\n" nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5504 (replace-match " ")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5505 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5506 (if (looking-at "\\s-*") (replace-match " ")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5507 (if (re-search-forward "\\s-+\\'" nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5508 (replace-match ""))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5509 (when (org-bound-and-true-p org-edit-src-from-org-mode) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5510 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5511 (while (re-search-forward (if (org-mode-p) "^\\(.\\)" "^\\([*#]\\)") nil t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5512 (replace-match ",\\1")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5513 (when font-lock-mode |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5514 (font-lock-unfontify-region (point-min) (point-max))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5515 (put-text-property (point-min) (point-max) 'font-lock-fontified t)) |
97027
adc2dffbdfc3
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96975
diff
changeset
|
5516 (kill-buffer (current-buffer)) |
adc2dffbdfc3
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96975
diff
changeset
|
5517 (and (org-mode-p) (org-restart-font-lock))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5518 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5519 ;;;; Plain list items, including checkboxes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5520 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5521 ;;; Plain list items |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5522 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5523 (defun org-at-item-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5524 "Is point in a line starting a hand-formatted item?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5525 (let ((llt org-plain-list-ordered-item-terminator)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5526 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5527 (goto-char (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5528 (looking-at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5529 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5530 ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5531 ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5532 ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5533 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5534 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5535 (defun org-in-item-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5536 "It the cursor inside a plain list item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5537 Does not have to be the first line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5538 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5539 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5540 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5541 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5542 (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5543 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5544 (error nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5545 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5546 (defun org-insert-item (&optional checkbox) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5547 "Insert a new item at the current level. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5548 Return t when things worked, nil when we are not in an item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5549 (when (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5550 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5551 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5552 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5553 (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5554 (if (org-invisible-p) (error "Invisible item")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5555 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5556 (error nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5557 (let* ((bul (match-string 0)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5558 (descp (save-excursion (goto-char (match-beginning 0)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5559 (beginning-of-line 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5560 (save-match-data |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5561 (looking-at "[ \t]*.*? ::")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5562 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5563 (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5564 (blank (cdr (assq 'plain-list-item org-blank-before-new-entry))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5565 pos) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5566 (if descp (setq checkbox nil)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5567 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5568 ((and (org-at-item-p) (<= (point) eow)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5569 ;; before the bullet |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5570 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5571 (open-line (if blank 2 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5572 ((<= (point) eow) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5573 (beginning-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5574 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5575 (unless (org-get-alist-option org-M-RET-may-split-line 'item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5576 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5577 (delete-horizontal-space)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5578 (newline (if blank 2 1)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5579 (insert bul |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5580 (if checkbox "[ ]" "") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5581 (if descp (concat (if checkbox " " "") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
5582 (read-string "Term: ") " :: ") "")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5583 (just-one-space) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5584 (setq pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5585 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5586 (unless (= (point) pos) (just-one-space) (backward-delete-char 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5587 (org-maybe-renumber-ordered-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5588 (and checkbox (org-update-checkbox-count-maybe)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5589 t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5590 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5591 ;;; Checkboxes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5592 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5593 (defun org-at-item-checkbox-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5594 "Is point at a line starting a plain-list item with a checklet?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5595 (and (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5596 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5597 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5598 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5599 (looking-at "\\[[- X]\\]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5600 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5601 (defun org-toggle-checkbox (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5602 "Toggle the checkbox in the current line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5603 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5604 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5605 (let (beg end status (firstnew 'unknown)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5606 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5607 ((org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5608 (setq beg (region-beginning) end (region-end))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5609 ((org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5610 (setq beg (point) end (save-excursion (outline-next-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5611 ((org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5612 (let ((pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5613 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5614 (cond (arg "[-]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5615 ((member (match-string 0) '("[ ]" "[-]")) "[X]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5616 (t "[ ]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5617 t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5618 (goto-char pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5619 (throw 'exit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5620 (t (error "Not at a checkbox or heading, and no active region"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5621 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5622 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5623 (while (< (point) end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5624 (when (org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5625 (setq status (equal (match-string 0) "[X]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5626 (when (eq firstnew 'unknown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5627 (setq firstnew (not status))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5628 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5629 (if (if arg (not status) firstnew) "[X]" "[ ]") t t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5630 (beginning-of-line 2))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5631 (org-update-checkbox-count-maybe)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5632 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5633 (defun org-update-checkbox-count-maybe () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5634 "Update checkbox statistics unless turned off by user." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5635 (when org-provide-checkbox-statistics |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5636 (org-update-checkbox-count))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5637 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5638 (defun org-update-checkbox-count (&optional all) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5639 "Update the checkbox statistics in the current section. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5640 This will find all statistic cookies like [57%] and [6/12] and update them |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5641 with the current numbers. With optional prefix argument ALL, do this for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5642 the whole buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5643 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5644 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5645 (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5646 (beg (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5647 (progn (outline-back-to-heading) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5648 (error (point-min)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5649 (end (move-marker (make-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5650 (progn (outline-next-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5651 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5652 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5653 (re-find (concat re "\\|" re-box)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5654 beg-cookie end-cookie is-percent c-on c-off lim |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5655 eline curr-ind next-ind continue-from startsearch |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5656 (cstat 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5657 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5658 (when all |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5659 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5660 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5661 (setq beg (point) end (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5662 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5663 ;; find each statistic cookie |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5664 (while (re-search-backward re-find beg t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5665 (setq beg-cookie (match-beginning 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5666 end-cookie (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5667 cstat (+ cstat (if end-cookie 1 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5668 startsearch (point-at-eol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5669 continue-from (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5670 is-percent (match-beginning 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5671 lim (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5672 ((org-on-heading-p) (outline-next-heading) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5673 ((org-at-item-p) (org-end-of-item) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5674 (t nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5675 c-on 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5676 c-off 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5677 (when lim |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5678 ;; find first checkbox for this cookie and gather |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5679 ;; statistics from all that are at this indentation level |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5680 (goto-char startsearch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5681 (if (re-search-forward re-box lim t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5682 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5683 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5684 (setq curr-ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5685 (setq next-ind curr-ind) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
5686 (while (and (bolp) (org-at-item-p) (= curr-ind next-ind)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5687 (save-excursion (end-of-line) (setq eline (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5688 (if (re-search-forward re-box eline t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5689 (if (member (match-string 2) '("[ ]" "[-]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5690 (setq c-off (1+ c-off)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5691 (setq c-on (1+ c-on)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5692 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5693 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5694 (org-end-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5695 (setq next-ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5696 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5697 (goto-char continue-from) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5698 ;; update cookie |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5699 (when end-cookie |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5700 (delete-region beg-cookie end-cookie) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5701 (goto-char beg-cookie) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5702 (insert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5703 (if is-percent |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5704 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5705 (format "[%d/%d]" c-on (+ c-on c-off))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5706 ;; update items checkbox if it has one |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5707 (when (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5708 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5709 (when (and (> (+ c-on c-off) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5710 (re-search-forward re-box (point-at-eol) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5711 (setq beg-cookie (match-beginning 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5712 end-cookie (match-end 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5713 (delete-region beg-cookie end-cookie) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5714 (goto-char beg-cookie) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5715 (cond ((= c-off 0) (insert "[X]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5716 ((= c-on 0) (insert "[ ]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5717 (t (insert "[-]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5718 ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5719 (goto-char continue-from)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5720 (when (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5721 (message "Checkbox satistics updated %s (%d places)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5722 (if all "in entire file" "in current outline entry") cstat))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5723 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5724 (defun org-get-checkbox-statistics-face () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5725 "Select the face for checkbox statistics. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5726 The face will be `org-done' when all relevant boxes are checked. Otherwise |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5727 it will be `org-todo'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5728 (if (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5729 (if (equal (match-string 1) "100%") 'org-done 'org-todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5730 (if (and (> (match-end 2) (match-beginning 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5731 (equal (match-string 2) (match-string 3))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5732 'org-done |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5733 'org-todo))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5734 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5735 (defun org-get-indentation (&optional line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5736 "Get the indentation of the current line, interpreting tabs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5737 When LINE is given, assume it represents a line and compute its indentation." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5738 (if line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5739 (if (string-match "^ *" (org-remove-tabs line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5740 (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5741 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5742 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5743 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5744 (current-column)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5745 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5746 (defun org-remove-tabs (s &optional width) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5747 "Replace tabulators in S with spaces. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5748 Assumes that s is a single line, starting in column 0." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5749 (setq width (or width tab-width)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5750 (while (string-match "\t" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5751 (setq s (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5752 (make-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5753 (- (* width (/ (+ (match-beginning 0) width) width)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5754 (match-beginning 0)) ?\ ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5755 t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5756 s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5757 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5758 (defun org-fix-indentation (line ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5759 "Fix indentation in LINE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5760 IND is a cons cell with target and minimum indentation. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5761 If the current indenation in LINE is smaller than the minimum, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5762 leave it alone. If it is larger than ind, set it to the target." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5763 (let* ((l (org-remove-tabs line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5764 (i (org-get-indentation l)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5765 (i1 (car ind)) (i2 (cdr ind))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5766 (if (>= i i2) (setq l (substring line i2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5767 (if (> i1 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5768 (concat (make-string i1 ?\ ) l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5769 l))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5770 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5771 (defun org-beginning-of-item () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5772 "Go to the beginning of the current hand-formatted item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5773 If the cursor is not in an item, throw an error." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5774 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5775 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5776 (limit (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5777 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5778 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5779 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5780 (beginning-of-line 2) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5781 (error (point-min))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5782 (ind-empty (if org-empty-line-terminates-plain-lists 0 10000)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5783 ind ind1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5784 (if (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5785 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5786 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5787 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5788 (setq ind (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5789 (if (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5790 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5791 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5792 (if (or (bobp) (< (point) limit)) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5793 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5794 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5795 (setq ind1 ind-empty) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5796 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5797 (setq ind1 (current-column))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5798 (if (< ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5799 (progn (beginning-of-line 1) (throw 'exit (org-at-item-p)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5800 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5801 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5802 (error "Not in an item"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5803 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5804 (defun org-end-of-item () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5805 "Go to the end of the current hand-formatted item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5806 If the cursor is not in an item, throw an error." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5807 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5808 (let* ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5809 ind1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5810 (ind-empty (if org-empty-line-terminates-plain-lists 0 10000)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5811 (limit (save-excursion (outline-next-heading) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5812 (ind (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5813 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5814 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5815 (current-column))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5816 (end (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5817 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5818 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5819 (if (eobp) (throw 'exit (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5820 (if (>= (point) limit) (throw 'exit (point-at-bol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5821 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5822 (setq ind1 ind-empty) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5823 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5824 (setq ind1 (current-column))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5825 (if (<= ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5826 (throw 'exit (point-at-bol))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5827 (if end |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5828 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5829 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5830 (error "Not in an item")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5831 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5832 (defun org-next-item () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5833 "Move to the beginning of the next item in the current plain list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5834 Error if not at a plain list, or if this is the last item in the list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5835 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5836 (let (ind ind1 (pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5837 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5838 (setq ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5839 (org-end-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5840 (setq ind1 (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5841 (unless (and (org-at-item-p) (= ind ind1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5842 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5843 (error "On last item")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5844 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5845 (defun org-previous-item () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5846 "Move to the beginning of the previous item in the current plain list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5847 Error if not at a plain list, or if this is the first item in the list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5848 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5849 (let (beg ind ind1 (pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5850 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5851 (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5852 (setq ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5853 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5854 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5855 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5856 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5857 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5858 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5859 (if (<= (setq ind1 (org-get-indentation)) ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5860 (throw 'exit t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5861 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5862 (if (or (not (org-at-item-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5863 (< ind1 (1- ind))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5864 (error "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5865 (org-beginning-of-item)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5866 (error (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5867 (error "On first item"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5868 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5869 (defun org-first-list-item-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5870 "Is this heading the item in a plain list?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5871 (unless (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5872 (error "Not at a plain list item")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5873 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5874 (= (point) (save-excursion (org-beginning-of-item-list)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5875 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5876 (defun org-move-item-down () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5877 "Move the plain list item at point down, i.e. swap with following item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5878 Subitems (items with larger indentation) are considered part of the item, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5879 so this really moves item trees." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5880 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5881 (let (beg beg0 end end0 ind ind1 (pos (point)) txt ne-end ne-beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5882 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5883 (setq beg0 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5884 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5885 (setq ne-beg (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5886 (setq beg (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5887 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5888 (setq ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5889 (org-end-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5890 (setq end0 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5891 (setq ind1 (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5892 (setq ne-end (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5893 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5894 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5895 (when (and (org-first-list-item-p) (< ne-end ne-beg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5896 ;; include less whitespace |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5897 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5898 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5899 (forward-line (- ne-beg ne-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5900 (setq beg (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5901 (goto-char end0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5902 (if (and (org-at-item-p) (= ind ind1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5903 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5904 (org-end-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5905 (org-back-over-empty-lines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5906 (setq txt (buffer-substring beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5907 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5908 (delete-region beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5909 (setq pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5910 (insert txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5911 (goto-char pos) (org-skip-whitespace) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5912 (org-maybe-renumber-ordered-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5913 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5914 (error "Cannot move this item further down")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5915 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5916 (defun org-move-item-up (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5917 "Move the plain list item at point up, i.e. swap with previous item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5918 Subitems (items with larger indentation) are considered part of the item, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5919 so this really moves item trees." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5920 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5921 (let (beg beg0 end ind ind1 (pos (point)) txt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5922 ne-beg ne-ins ins-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5923 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5924 (setq beg0 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5925 (setq ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5926 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5927 (setq ne-beg (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5928 (setq beg (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5929 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5930 (org-end-of-item) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
5931 (org-back-over-empty-lines) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5932 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5933 (goto-char beg0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5934 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5935 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5936 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5937 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5938 (if org-empty-line-terminates-plain-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5939 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5940 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5941 (error "Cannot move this item further up")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5942 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5943 (if (<= (setq ind1 (org-get-indentation)) ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5944 (throw 'exit t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5945 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5946 (org-beginning-of-item) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
5947 (error (goto-char beg0) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5948 (error "Cannot move this item further up"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5949 (setq ind1 (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5950 (if (and (org-at-item-p) (= ind ind1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5951 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5952 (setq ne-ins (org-back-over-empty-lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5953 (setq txt (buffer-substring beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5954 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5955 (delete-region beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5956 (setq pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5957 (insert txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5958 (setq ins-end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5959 (goto-char pos) (org-skip-whitespace) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5960 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5961 (when (and (org-first-list-item-p) (> ne-ins ne-beg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5962 ;; Move whitespace back to beginning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5963 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5964 (goto-char ins-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5965 (let ((kill-whole-line t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5966 (kill-line (- ne-ins ne-beg)) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5967 (insert (make-string (- ne-ins ne-beg) ?\n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5968 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5969 (org-maybe-renumber-ordered-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5970 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5971 (error "Cannot move this item further up")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5972 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5973 (defun org-maybe-renumber-ordered-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5974 "Renumber the ordered list at point if setup allows it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5975 This tests the user option `org-auto-renumber-ordered-lists' before |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5976 doing the renumbering." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5977 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5978 (when (and org-auto-renumber-ordered-lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5979 (org-at-item-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5980 (if (match-beginning 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5981 (org-renumber-ordered-list 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5982 (org-fix-bullet-type)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5983 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5984 (defun org-maybe-renumber-ordered-list-safe () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5985 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5986 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5987 (org-maybe-renumber-ordered-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5988 (error nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5989 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5990 (defun org-cycle-list-bullet (&optional which) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5991 "Cycle through the different itemize/enumerate bullets. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5992 This cycle the entire list level through the sequence: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5993 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5994 `-' -> `+' -> `*' -> `1.' -> `1)' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5995 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5996 If WHICH is a string, use that as the new bullet. If WHICH is an integer, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5997 0 meand `-', 1 means `+' etc." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5998 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5999 (org-preserve-lc |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6000 (org-beginning-of-item-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6001 (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6002 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6003 (let ((current (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6004 (prevp (eq which 'previous)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6005 new) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6006 (setq new (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6007 ((and (numberp which) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6008 (nth (1- which) '("-" "+" "*" "1." "1)")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6009 ((string-match "-" current) (if prevp "1)" "+")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6010 ((string-match "\\+" current) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6011 (if prevp "-" (if (looking-at "\\S-") "1." "*"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6012 ((string-match "\\*" current) (if prevp "+" "1.")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6013 ((string-match "\\." current) (if prevp "*" "1)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6014 ((string-match ")" current) (if prevp "1." "-")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6015 (t (error "This should not happen")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6016 (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6017 (org-fix-bullet-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6018 (org-maybe-renumber-ordered-list)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6019 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6020 (defun org-get-string-indentation (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6021 "What indentation has S due to SPACE and TAB at the beginning of the string?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6022 (let ((n -1) (i 0) (w tab-width) c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6023 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6024 (while (< (setq n (1+ n)) (length s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6025 (setq c (aref s n)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6026 (cond ((= c ?\ ) (setq i (1+ i))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6027 ((= c ?\t) (setq i (* (/ (+ w i) w) w))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6028 (t (throw 'exit t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6029 i)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6030 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6031 (defun org-renumber-ordered-list (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6032 "Renumber an ordered plain list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6033 Cursor needs to be in the first line of an item, the line that starts |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6034 with something like \"1.\" or \"2)\"." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6035 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6036 (unless (and (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6037 (match-beginning 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6038 (error "This is not an ordered list")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6039 (let ((line (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6040 (col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6041 (ind (org-get-string-indentation |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6042 (buffer-substring (point-at-bol) (match-beginning 3)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6043 ;; (term (substring (match-string 3) -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6044 ind1 (n (1- arg)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6045 fmt bob) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6046 ;; find where this list begins |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6047 (org-beginning-of-item-list) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6048 (setq bobp (bobp)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6049 (looking-at "[ \t]*[0-9]+\\([.)]\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6050 (setq fmt (concat "%d" (match-string 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6051 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6052 ;; walk forward and replace these numbers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6053 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6054 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6055 (catch 'next |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6056 (if bobp (setq bobp nil) (beginning-of-line 2)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6057 (if (eobp) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6058 (if (looking-at "[ \t]*$") (throw 'next nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6059 (skip-chars-forward " \t") (setq ind1 (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6060 (if (> ind1 ind) (throw 'next t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6061 (if (< ind1 ind) (throw 'exit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6062 (if (not (org-at-item-p)) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6063 (delete-region (match-beginning 2) (match-end 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6064 (goto-char (match-beginning 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6065 (insert (format fmt (setq n (1+ n))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6066 (goto-line line) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6067 (org-move-to-column col))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6068 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6069 (defun org-fix-bullet-type () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6070 "Make sure all items in this list have the same bullet as the firsst item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6071 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6072 (unless (org-at-item-p) (error "This is not a list")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6073 (let ((line (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6074 (col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6075 (ind (current-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6076 ind1 bullet) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6077 ;; find where this list begins |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6078 (org-beginning-of-item-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6079 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6080 ;; find out what the bullet type is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6081 (looking-at "[ \t]*\\(\\S-+\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6082 (setq bullet (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6083 ;; walk forward and replace these numbers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6084 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6085 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6086 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6087 (catch 'next |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6088 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6089 (if (eobp) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6090 (if (looking-at "[ \t]*$") (throw 'next nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6091 (skip-chars-forward " \t") (setq ind1 (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6092 (if (> ind1 ind) (throw 'next t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6093 (if (< ind1 ind) (throw 'exit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6094 (if (not (org-at-item-p)) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6095 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6096 (looking-at "\\S-+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6097 (replace-match bullet)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6098 (goto-line line) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6099 (org-move-to-column col) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6100 (if (string-match "[0-9]" bullet) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6101 (org-renumber-ordered-list 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6102 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6103 (defun org-beginning-of-item-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6104 "Go to the beginning of the current item list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6105 I.e. to the first item in this list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6106 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6107 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6108 (let ((pos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6109 (ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6110 ind1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6111 ;; find where this list begins |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6112 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6113 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6114 (catch 'next |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6115 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6116 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6117 (throw (if (bobp) 'exit 'next) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6118 (skip-chars-forward " \t") (setq ind1 (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6119 (if (or (< ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6120 (and (= ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6121 (not (org-at-item-p))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6122 (and (= (point-at-bol) (point-min)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6123 (setq pos (point-min)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6124 (throw 'exit t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6125 (when (org-at-item-p) (setq pos (point-at-bol))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6126 (goto-char pos))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6127 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6128 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6129 (defun org-end-of-item-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6130 "Go to the end of the current item list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6131 I.e. to the text after the last item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6132 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6133 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6134 (let ((pos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6135 (ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6136 ind1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6137 ;; find where this list begins |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6138 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6139 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6140 (catch 'next |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6141 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6142 (if (looking-at "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6143 (throw (if (eobp) 'exit 'next) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6144 (skip-chars-forward " \t") (setq ind1 (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6145 (if (or (< ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6146 (and (= ind1 ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6147 (not (org-at-item-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6148 (eobp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6149 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6150 (setq pos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6151 (throw 'exit t)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6152 (goto-char pos))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6153 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6154 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6155 (defvar org-last-indent-begin-marker (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6156 (defvar org-last-indent-end-marker (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6157 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6158 (defun org-outdent-item (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6159 "Outdent a local list item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6160 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6161 (org-indent-item (- arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6162 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6163 (defun org-indent-item (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6164 "Indent a local list item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6165 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6166 (unless (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6167 (error "Not on an item")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6168 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6169 (let (beg end ind ind1 tmp delta ind-down ind-up) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6170 (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6171 (setq beg org-last-indent-begin-marker |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6172 end org-last-indent-end-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6173 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6174 (setq beg (move-marker org-last-indent-begin-marker (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6175 (org-end-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6176 (setq end (move-marker org-last-indent-end-marker (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6177 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6178 (setq tmp (org-item-indent-positions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6179 ind (car tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6180 ind-down (nth 2 tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6181 ind-up (nth 1 tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6182 delta (if (> arg 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6183 (if ind-down (- ind-down ind) 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6184 (if ind-up (- ind-up ind) -2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6185 (if (< (+ delta ind) 0) (error "Cannot outdent beyond margin")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6186 (while (< (point) end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6187 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6188 (skip-chars-forward " \t") (setq ind1 (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6189 (delete-region (point-at-bol) (point)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6190 (or (eolp) (org-indent-to-column (+ ind1 delta))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6191 (beginning-of-line 2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6192 (org-fix-bullet-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6193 (org-maybe-renumber-ordered-list-safe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6194 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6195 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6196 (condition-case nil (org-beginning-of-item) (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6197 (org-maybe-renumber-ordered-list-safe))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6198 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6199 (defun org-item-indent-positions () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6200 "Return indentation for plain list items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6201 This returns a list with three values: The current indentation, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6202 parent indentation and the indentation a child should habe. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6203 Assumes cursor in item line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6204 (let* ((bolpos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6205 (ind (org-get-indentation)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6206 ind-down ind-up pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6207 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6208 (org-beginning-of-item-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6209 (skip-chars-backward "\n\r \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6210 (when (org-in-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6211 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6212 (setq ind-up (org-get-indentation)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6213 (setq pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6214 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6215 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6216 ((and (condition-case nil (progn (org-previous-item) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6217 (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6218 (or (forward-char 1) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6219 (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6220 (setq ind-down (org-get-indentation))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6221 ((and (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6222 (org-at-item-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6223 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6224 (skip-chars-forward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6225 (setq ind-down (current-column))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6226 (list ind ind-up ind-down))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6227 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6228 ;;; The orgstruct minor mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6229 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6230 ;; Define a minor mode which can be used in other modes in order to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6231 ;; integrate the org-mode structure editing commands. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6232 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6233 ;; This is really a hack, because the org-mode structure commands use |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6234 ;; keys which normally belong to the major mode. Here is how it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6235 ;; works: The minor mode defines all the keys necessary to operate the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6236 ;; structure commands, but wraps the commands into a function which |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6237 ;; tests if the cursor is currently at a headline or a plain list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6238 ;; item. If that is the case, the structure command is used, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6239 ;; temporarily setting many Org-mode variables like regular |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6240 ;; expressions for filling etc. However, when any of those keys is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6241 ;; used at a different location, function uses `key-binding' to look |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6242 ;; up if the key has an associated command in another currently active |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6243 ;; keymap (minor modes, major mode, global), and executes that |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6244 ;; command. There might be problems if any of the keys is otherwise |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6245 ;; used as a prefix key. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6246 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6247 ;; Another challenge is that the key binding for TAB can be tab or \C-i, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6248 ;; likewise the binding for RET can be return or \C-m. Orgtbl-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6249 ;; addresses this by checking explicitly for both bindings. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6250 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6251 (defvar orgstruct-mode-map (make-sparse-keymap) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6252 "Keymap for the minor `orgstruct-mode'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6253 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6254 (defvar org-local-vars nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6255 "List of local variables, for use by `orgstruct-mode'") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6256 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6257 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6258 (define-minor-mode orgstruct-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6259 "Toggle the minor more `orgstruct-mode'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6260 This mode is for using Org-mode structure commands in other modes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6261 The following key behave as if Org-mode was active, if the cursor |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6262 is on a headline, or on a plain list item (both in the definition |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6263 of Org-mode). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6264 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6265 M-up Move entry/item up |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6266 M-down Move entry/item down |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6267 M-left Promote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6268 M-right Demote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6269 M-S-up Move entry/item up |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6270 M-S-down Move entry/item down |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6271 M-S-left Promote subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6272 M-S-right Demote subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6273 M-q Fill paragraph and items like in Org-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6274 C-c ^ Sort entries |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6275 C-c - Cycle list bullet |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6276 TAB Cycle item visibility |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6277 M-RET Insert new heading/item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6278 S-M-RET Insert new TODO heading / Chekbox item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6279 C-c C-c Set tags / toggle checkbox" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6280 nil " OrgStruct" nil |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6281 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6282 (and (orgstruct-setup) (defun orgstruct-setup () nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6283 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6284 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6285 (defun turn-on-orgstruct () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6286 "Unconditionally turn on `orgstruct-mode'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6287 (orgstruct-mode 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6288 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6289 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6290 (defun turn-on-orgstruct++ () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6291 "Unconditionally turn on `orgstruct-mode', and force org-mode indentations. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6292 In addition to setting orgstruct-mode, this also exports all indentation and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6293 autofilling variables from org-mode into the buffer. Note that turning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6294 off orgstruct-mode will *not* remove these additional settings." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6295 (orgstruct-mode 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6296 (let (var val) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6297 (mapc |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6298 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6299 (when (string-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6300 "^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6301 (symbol-name (car x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6302 (setq var (car x) val (nth 1 x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6303 (org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6304 org-local-vars))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6305 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6306 (defun orgstruct-error () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6307 "Error when there is no default binding for a structure key." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6308 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6309 (error "This key has no function outside structure elements")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6310 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6311 (defun orgstruct-setup () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6312 "Setup orgstruct keymaps." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6313 (let ((nfunc 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6314 (bindings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6315 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6316 '([(meta up)] org-metaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6317 '([(meta down)] org-metadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6318 '([(meta left)] org-metaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6319 '([(meta right)] org-metaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6320 '([(meta shift up)] org-shiftmetaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6321 '([(meta shift down)] org-shiftmetadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6322 '([(meta shift left)] org-shiftmetaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6323 '([(meta shift right)] org-shiftmetaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6324 '([(shift up)] org-shiftup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6325 '([(shift down)] org-shiftdown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6326 '("\C-c\C-c" org-ctrl-c-ctrl-c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6327 '("\M-q" fill-paragraph) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6328 '("\C-c^" org-sort) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6329 '("\C-c-" org-cycle-list-bullet))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6330 elt key fun cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6331 (while (setq elt (pop bindings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6332 (setq nfunc (1+ nfunc)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6333 (setq key (org-key (car elt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6334 fun (nth 1 elt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6335 cmd (orgstruct-make-binding fun nfunc key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6336 (org-defkey orgstruct-mode-map key cmd)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6337 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6338 ;; Special treatment needed for TAB and RET |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6339 (org-defkey orgstruct-mode-map [(tab)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6340 (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6341 (org-defkey orgstruct-mode-map "\C-i" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6342 (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6343 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6344 (org-defkey orgstruct-mode-map "\M-\C-m" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6345 (orgstruct-make-binding 'org-insert-heading 105 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6346 "\M-\C-m" [(meta return)])) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6347 (org-defkey orgstruct-mode-map [(meta return)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6348 (orgstruct-make-binding 'org-insert-heading 106 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6349 [(meta return)] "\M-\C-m")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6350 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6351 (org-defkey orgstruct-mode-map [(shift meta return)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6352 (orgstruct-make-binding 'org-insert-todo-heading 107 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6353 [(meta return)] "\M-\C-m")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6354 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6355 (unless org-local-vars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6356 (setq org-local-vars (org-get-local-variables))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6357 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6358 t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6359 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6360 (defun orgstruct-make-binding (fun n &rest keys) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6361 "Create a function for binding in the structure minor mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6362 FUN is the command to call inside a table. N is used to create a unique |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6363 command name. KEYS are keys that should be checked in for a command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6364 to execute outside of tables." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6365 (eval |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6366 (list 'defun |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6367 (intern (concat "orgstruct-hijacker-command-" (int-to-string n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6368 '(arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6369 (concat "In Structure, run `" (symbol-name fun) "'.\n" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6370 "Outside of structure, run the binding of `" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6371 (mapconcat (lambda (x) (format "%s" x)) keys "' or `") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6372 "'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6373 '(interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6374 (list 'if |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6375 '(org-context-p 'headline 'item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6376 (list 'org-run-like-in-org-mode (list 'quote fun)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6377 (list 'let '(orgstruct-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6378 (list 'call-interactively |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6379 (append '(or) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6380 (mapcar (lambda (k) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6381 (list 'key-binding k)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6382 keys) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6383 '('orgstruct-error)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6384 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6385 (defun org-context-p (&rest contexts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6386 "Check if local context is and of CONTEXTS. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6387 Possible values in the list of contexts are `table', `headline', and `item'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6388 (let ((pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6389 (goto-char (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6390 (prog1 (or (and (memq 'table contexts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6391 (looking-at "[ \t]*|")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6392 (and (memq 'headline contexts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6393 (looking-at "\\*+")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6394 (and (memq 'item contexts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6395 (looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6396 (goto-char pos)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6397 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6398 (defun org-get-local-variables () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6399 "Return a list of all local variables in an org-mode buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6400 (let (varlist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6401 (with-current-buffer (get-buffer-create "*Org tmp*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6402 (erase-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6403 (org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6404 (setq varlist (buffer-local-variables))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6405 (kill-buffer "*Org tmp*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6406 (delq nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6407 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6408 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6409 (setq x |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6410 (if (symbolp x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6411 (list x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6412 (list (car x) (list 'quote (cdr x))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6413 (if (string-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6414 "^\\(org-\\|orgtbl-\\|outline-\\|comment-\\|paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6415 (symbol-name (car x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6416 x nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6417 varlist)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6418 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6419 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6420 (defun org-run-like-in-org-mode (cmd) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6421 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6422 (unless org-local-vars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6423 (setq org-local-vars (org-get-local-variables))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6424 (eval (list 'let org-local-vars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6425 (list 'call-interactively (list 'quote cmd))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6426 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6427 ;;;; Archiving |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6428 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6429 (defun org-get-category (&optional pos) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6430 "Get the category applying to position POS." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6431 (get-text-property (or pos (point)) 'org-category)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6432 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6433 (defun org-refresh-category-properties () |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6434 "Refresh category text properties in the buffer." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6435 (let ((def-cat (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6436 ((null org-category) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6437 (if buffer-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6438 (file-name-sans-extension |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6439 (file-name-nondirectory buffer-file-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6440 "???")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6441 ((symbolp org-category) (symbol-name org-category)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6442 (t org-category))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6443 beg end cat pos optionp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6444 (org-unmodified |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6445 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6446 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6447 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6448 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6449 (put-text-property (point) (point-max) 'org-category def-cat) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6450 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6451 "^\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6452 (setq pos (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6453 optionp (equal (char-after (match-beginning 0)) ?#) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6454 cat (org-trim (match-string 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6455 (if optionp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6456 (setq beg (point-at-bol) end (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6457 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6458 (setq beg (point) end (org-end-of-subtree t t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6459 (put-text-property beg end 'org-category cat) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6460 (goto-char pos))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6461 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6462 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6463 ;;;; Link Stuff |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6464 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6465 ;;; Link abbreviations |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6466 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6467 (defun org-link-expand-abbrev (link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6468 "Apply replacements as defined in `org-link-abbrev-alist." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6469 (if (string-match "^\\([a-zA-Z][-_a-zA-Z0-9]*\\)\\(::?\\(.*\\)\\)?$" link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6470 (let* ((key (match-string 1 link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6471 (as (or (assoc key org-link-abbrev-alist-local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6472 (assoc key org-link-abbrev-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6473 (tag (and (match-end 2) (match-string 3 link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6474 rpl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6475 (if (not as) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6476 link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6477 (setq rpl (cdr as)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6478 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6479 ((symbolp rpl) (funcall rpl tag)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6480 ((string-match "%s" rpl) (replace-match (or tag "") t t rpl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6481 (t (concat rpl tag))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6482 link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6483 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6484 ;;; Storing and inserting links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6485 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6486 (defvar org-insert-link-history nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6487 "Minibuffer history for links inserted with `org-insert-link'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6488 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6489 (defvar org-stored-links nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6490 "Contains the links stored with `org-store-link'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6491 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6492 (defvar org-store-link-plist nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6493 "Plist with info about the most recently link created with `org-store-link'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6494 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6495 (defvar org-link-protocols nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6496 "Link protocols added to Org-mode using `org-add-link-type'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6497 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6498 (defvar org-store-link-functions nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6499 "List of functions that are called to create and store a link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6500 Each function will be called in turn until one returns a non-nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6501 value. Each function should check if it is responsible for creating |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6502 this link (for example by looking at the major mode). |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6503 If not, it must exit and return nil. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6504 If yes, it should return a non-nil value after a calling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6505 `org-store-link-props' with a list of properties and values. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6506 Special properties are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6507 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6508 :type The link prefix. like \"http\". This must be given. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6509 :link The link, like \"http://www.astro.uva.nl/~dominik\". |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6510 This is obligatory as well. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6511 :description Optional default description for the second pair |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6512 of brackets in an Org-mode link. The user can still change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6513 this when inserting this link into an Org-mode buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6514 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6515 In addition to these, any additional properties can be specified |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6516 and then used in remember templates.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6517 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6518 (defun org-add-link-type (type &optional follow export) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6519 "Add TYPE to the list of `org-link-types'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6520 Re-compute all regular expressions depending on `org-link-types' |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6521 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6522 FOLLOW and EXPORT are two functions. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6523 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6524 FOLLOW should take the link path as the single argument and do whatever |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6525 is necessary to follow the link, for example find a file or display |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6526 a mail message. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6527 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6528 EXPORT should format the link path for export to one of the export formats. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6529 It should be a function accepting three arguments: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6530 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6531 path the path of the link, the text after the prefix (like \"http:\") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6532 desc the description of the link, if any, nil if there was no descripton |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6533 format the export format, a symbol like `html' or `latex'. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6534 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6535 The function may use the FORMAT information to return different values |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6536 depending on the format. The return value will be put literally into |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6537 the exported file. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6538 Org-mode has a built-in default for exporting links. If you are happy with |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6539 this default, there is no need to define an export function for the link |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6540 type. For a simple example of an export function, see `org-bbdb.el'." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6541 (add-to-list 'org-link-types type t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6542 (org-make-link-regexps) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6543 (if (assoc type org-link-protocols) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6544 (setcdr (assoc type org-link-protocols) (list follow export)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6545 (push (list type follow export) org-link-protocols))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6546 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6547 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6548 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6549 (defun org-store-link (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6550 "\\<org-mode-map>Store an org-link to the current location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6551 This link is added to `org-stored-links' and can later be inserted |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6552 into an org-buffer with \\[org-insert-link]. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6553 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6554 For some link types, a prefix arg is interpreted: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6555 For links to usenet articles, arg negates `org-usenet-links-prefer-google'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6556 For file links, arg negates `org-context-in-file-links'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6557 (interactive "P") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6558 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6559 (setq org-store-link-plist nil) ; reset |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6560 (let (link cpltxt desc description search txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6561 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6562 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6563 ((run-hook-with-args-until-success 'org-store-link-functions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6564 (setq link (plist-get org-store-link-plist :link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6565 desc (or (plist-get org-store-link-plist :description) link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6566 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6567 ((eq major-mode 'calendar-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6568 (let ((cd (calendar-cursor-to-date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6569 (setq link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6570 (format-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6571 (car org-time-stamp-formats) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6572 (apply 'encode-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6573 (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6574 nil nil nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6575 (org-store-link-props :type "calendar" :date cd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6576 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6577 ((eq major-mode 'w3-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6578 (setq cpltxt (url-view-url t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6579 link (org-make-link cpltxt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6580 (org-store-link-props :type "w3" :url (url-view-url t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6581 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6582 ((eq major-mode 'w3m-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6583 (setq cpltxt (or w3m-current-title w3m-current-url) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6584 link (org-make-link w3m-current-url)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6585 (org-store-link-props :type "w3m" :url (url-view-url t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6586 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6587 ((setq search (run-hook-with-args-until-success |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6588 'org-create-file-search-functions)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6589 (setq link (concat "file:" (abbreviate-file-name buffer-file-name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6590 "::" search)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6591 (setq cpltxt (or description link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6592 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6593 ((eq major-mode 'image-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6594 (setq cpltxt (concat "file:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6595 (abbreviate-file-name buffer-file-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6596 link (org-make-link cpltxt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6597 (org-store-link-props :type "image" :file buffer-file-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6598 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6599 ((eq major-mode 'dired-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6600 ;; link to the file in the current line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6601 (setq cpltxt (concat "file:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6602 (abbreviate-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6603 (expand-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6604 (dired-get-filename nil t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6605 link (org-make-link cpltxt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6606 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6607 ((and buffer-file-name (org-mode-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6608 ;; Just link to current headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6609 (setq cpltxt (concat "file:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6610 (abbreviate-file-name buffer-file-name))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6611 ;; Add a context search string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6612 (when (org-xor org-context-in-file-links arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6613 ;; Check if we are on a target |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6614 (if (org-in-regexp "<<\\(.*?\\)>>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6615 (setq cpltxt (concat cpltxt "::" (match-string 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6616 (setq txt (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6617 ((org-on-heading-p) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6618 ((org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6619 (buffer-substring (region-beginning) (region-end))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6620 (t nil))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6621 (when (or (null txt) (string-match "\\S-" txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6622 (setq cpltxt |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
6623 (concat cpltxt "::" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
6624 (condition-case nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
6625 (org-make-org-heading-search-string txt) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
6626 (error ""))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6627 desc "NONE")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6628 (if (string-match "::\\'" cpltxt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6629 (setq cpltxt (substring cpltxt 0 -2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6630 (setq link (org-make-link cpltxt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6631 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6632 ((buffer-file-name (buffer-base-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6633 ;; Just link to this file here. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6634 (setq cpltxt (concat "file:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6635 (abbreviate-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6636 (buffer-file-name (buffer-base-buffer))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6637 ;; Add a context string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6638 (when (org-xor org-context-in-file-links arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6639 (setq txt (if (org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6640 (buffer-substring (region-beginning) (region-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6641 (buffer-substring (point-at-bol) (point-at-eol)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6642 ;; Only use search option if there is some text. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6643 (when (string-match "\\S-" txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6644 (setq cpltxt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6645 (concat cpltxt "::" (org-make-org-heading-search-string txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6646 desc "NONE"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6647 (setq link (org-make-link cpltxt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6648 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6649 ((interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6650 (error "Cannot link to a buffer which is not visiting a file")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6651 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6652 (t (setq link nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6653 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6654 (if (consp link) (setq cpltxt (car link) link (cdr link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6655 (setq link (or link cpltxt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6656 desc (or desc cpltxt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6657 (if (equal desc "NONE") (setq desc nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6658 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6659 (if (and (interactive-p) link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6660 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6661 (setq org-stored-links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6662 (cons (list link desc) org-stored-links)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6663 (message "Stored: %s" (or desc link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6664 (and link (org-make-link-string link desc))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6665 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6666 (defun org-store-link-props (&rest plist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6667 "Store link properties, extract names and addresses." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6668 (let (x adr) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6669 (when (setq x (plist-get plist :from)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6670 (setq adr (mail-extract-address-components x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6671 (plist-put plist :fromname (car adr)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6672 (plist-put plist :fromaddress (nth 1 adr))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6673 (when (setq x (plist-get plist :to)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6674 (setq adr (mail-extract-address-components x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6675 (plist-put plist :toname (car adr)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6676 (plist-put plist :toaddress (nth 1 adr)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6677 (let ((from (plist-get plist :from)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6678 (to (plist-get plist :to))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6679 (when (and from to org-from-is-user-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6680 (plist-put plist :fromto |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6681 (if (string-match org-from-is-user-regexp from) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6682 (concat "to %t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6683 (concat "from %f"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6684 (setq org-store-link-plist plist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6685 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6686 (defun org-add-link-props (&rest plist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6687 "Add these properties to the link property list." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6688 (let (key value) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6689 (while plist |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6690 (setq key (pop plist) value (pop plist)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6691 (setq org-store-link-plist |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6692 (plist-put org-store-link-plist key value))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6693 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6694 (defun org-email-link-description (&optional fmt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6695 "Return the description part of an email link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6696 This takes information from `org-store-link-plist' and formats it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6697 according to FMT (default from `org-email-link-description-format')." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6698 (setq fmt (or fmt org-email-link-description-format)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6699 (let* ((p org-store-link-plist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6700 (to (plist-get p :toaddress)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6701 (from (plist-get p :fromaddress)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6702 (table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6703 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6704 (cons "%c" (plist-get p :fromto)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6705 (cons "%F" (plist-get p :from)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6706 (cons "%f" (or (plist-get p :fromname) (plist-get p :fromaddress) "?")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6707 (cons "%T" (plist-get p :to)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6708 (cons "%t" (or (plist-get p :toname) (plist-get p :toaddress) "?")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6709 (cons "%s" (plist-get p :subject)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6710 (cons "%m" (plist-get p :message-id))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6711 (when (string-match "%c" fmt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6712 ;; Check if the user wrote this message |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6713 (if (and org-from-is-user-regexp from to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6714 (save-match-data (string-match org-from-is-user-regexp from))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6715 (setq fmt (replace-match "to %t" t t fmt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6716 (setq fmt (replace-match "from %f" t t fmt)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6717 (org-replace-escapes fmt table))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6718 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6719 (defun org-make-org-heading-search-string (&optional string heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6720 "Make search string for STRING or current headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6721 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6722 (let ((s (or string (org-get-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6723 (unless (and string (not heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6724 ;; We are using a headline, clean up garbage in there. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6725 (if (string-match org-todo-regexp s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6726 (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6727 (if (string-match (org-re ":[[:alnum:]_@:]+:[ \t]*$") s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6728 (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6729 (setq s (org-trim s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6730 (if (string-match (concat "^\\(" org-quote-string "\\|" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6731 org-comment-string "\\)") s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6732 (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6733 (while (string-match org-ts-regexp s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6734 (setq s (replace-match "" t t s)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6735 (while (string-match "[^a-zA-Z_0-9 \t]+" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6736 (setq s (replace-match " " t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6737 (or string (setq s (concat "*" s))) ; Add * for headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6738 (mapconcat 'identity (org-split-string s "[ \t]+") " "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6739 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6740 (defun org-make-link (&rest strings) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6741 "Concatenate STRINGS." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6742 (apply 'concat strings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6743 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6744 (defun org-make-link-string (link &optional description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6745 "Make a link with brackets, consisting of LINK and DESCRIPTION." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6746 (unless (string-match "\\S-" link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6747 (error "Empty link")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6748 (when (stringp description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6749 ;; Remove brackets from the description, they are fatal. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6750 (while (string-match "\\[" description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6751 (setq description (replace-match "{" t t description))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6752 (while (string-match "\\]" description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6753 (setq description (replace-match "}" t t description)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6754 (when (equal (org-link-escape link) description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6755 ;; No description needed, it is identical |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6756 (setq description nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6757 (when (and (not description) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6758 (not (equal link (org-link-escape link)))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
6759 (setq description (org-extract-attributes link))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6760 (concat "[[" (org-link-escape link) "]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6761 (if description (concat "[" description "]") "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6762 "]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6763 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6764 (defconst org-link-escape-chars |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6765 '((?\ . "%20") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6766 (?\[ . "%5B") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6767 (?\] . "%5D") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6768 (?\340 . "%E0") ; `a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6769 (?\342 . "%E2") ; ^a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6770 (?\347 . "%E7") ; ,c |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6771 (?\350 . "%E8") ; `e |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6772 (?\351 . "%E9") ; 'e |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6773 (?\352 . "%EA") ; ^e |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6774 (?\356 . "%EE") ; ^i |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6775 (?\364 . "%F4") ; ^o |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6776 (?\371 . "%F9") ; `u |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6777 (?\373 . "%FB") ; ^u |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6778 (?\; . "%3B") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6779 (?? . "%3F") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6780 (?= . "%3D") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6781 (?+ . "%2B") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6782 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6783 "Association list of escapes for some characters problematic in links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6784 This is the list that is used for internal purposes.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6785 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6786 (defconst org-link-escape-chars-browser |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6787 '((?\ . "%20")) ; 32 for the SPC char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6788 "Association list of escapes for some characters problematic in links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6789 This is the list that is used before handing over to the browser.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6790 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6791 (defun org-link-escape (text &optional table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6792 "Escape charaters in TEXT that are problematic for links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6793 (setq table (or table org-link-escape-chars)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6794 (when text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6795 (let ((re (mapconcat (lambda (x) (regexp-quote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6796 (char-to-string (car x)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6797 table "\\|"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6798 (while (string-match re text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6799 (setq text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6800 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6801 (cdr (assoc (string-to-char (match-string 0 text)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6802 table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6803 t t text))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6804 text))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6805 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6806 (defun org-link-unescape (text &optional table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6807 "Reverse the action of `org-link-escape'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6808 (setq table (or table org-link-escape-chars)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6809 (when text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6810 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6811 table "\\|"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6812 (while (string-match re text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6813 (setq text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6814 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6815 (char-to-string (car (rassoc (match-string 0 text) table))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6816 t t text))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6817 text))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6818 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6819 (defun org-xor (a b) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6820 "Exclusive or." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6821 (if a (not b) b)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6822 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6823 (defun org-get-header (header) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6824 "Find a header field in the current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6825 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6826 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6827 (let ((case-fold-search t) s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6828 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6829 ((eq header 'from) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6830 (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6831 (setq s (match-string 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6832 (while (string-match "\"" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6833 (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6834 (if (string-match "[<(].*" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6835 (setq s (replace-match "" t t s)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6836 ((eq header 'message-id) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6837 (if (re-search-forward "^message-id:\\s-+\\(.*\\)" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6838 (setq s (match-string 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6839 ((eq header 'subject) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6840 (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6841 (setq s (match-string 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6842 (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6843 (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6844 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6845 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6846 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6847 (defun org-fixup-message-id-for-http (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6848 "Replace special characters in a message id, so it can be used in an http query." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6849 (while (string-match "<" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6850 (setq s (replace-match "%3C" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6851 (while (string-match ">" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6852 (setq s (replace-match "%3E" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6853 (while (string-match "@" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6854 (setq s (replace-match "%40" t t s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6855 s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6856 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6857 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6858 (defun org-insert-link-global () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6859 "Insert a link like Org-mode does. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6860 This command can be called in any mode to insert a link in Org-mode syntax." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6861 (interactive) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6862 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6863 (org-run-like-in-org-mode 'org-insert-link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6864 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6865 (defun org-insert-link (&optional complete-file link-location) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6866 "Insert a link. At the prompt, enter the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6867 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6868 Completion can be used to select a link previously stored with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6869 `org-store-link'. When the empty string is entered (i.e. if you just |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6870 press RET at the prompt), the link defaults to the most recently |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6871 stored link. As SPC triggers completion in the minibuffer, you need to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6872 use M-SPC or C-q SPC to force the insertion of a space character. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6873 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6874 You will also be prompted for a description, and if one is given, it will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6875 be displayed in the buffer instead of the link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6876 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6877 If there is already a link at point, this command will allow you to edit link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6878 and description parts. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6879 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6880 With a \\[universal-argument] prefix, prompts for a file to link to. The file name can |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6881 be selected using completion. The path to the file will be relative to the |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6882 current directory if the file is in the current directory or a subdirectory. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6883 Otherwise, the link will be the absolute path as completed in the minibuffer |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6884 \(i.e. normally ~/path/to/file). |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6885 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6886 With two \\[universal-argument] prefixes, enforce an absolute path even if the file is in |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6887 the current directory or below. With three \\[universal-argument] prefixes, negate the meaning |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6888 of `org-keep-stored-link-after-insertion'. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6889 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6890 If `org-make-link-description-function' is non-nil, this function will be |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6891 called with the link target, and the result will be the default |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6892 link description. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6893 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6894 If the LINK-LOCATION parameter is non-nil, this value will be |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6895 used as the link location instead of reading one interactively." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6896 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6897 (let* ((wcf (current-window-configuration)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6898 (region (if (org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6899 (buffer-substring (region-beginning) (region-end)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6900 (remove (and region (list (region-beginning) (region-end)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6901 (desc region) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6902 tmphist ; byte-compile incorrectly complains about this |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6903 (link link-location) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6904 entry file) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6905 (cond |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
6906 (link-location) ; specified by arg, just use it. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6907 ((org-in-regexp org-bracket-link-regexp 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6908 ;; We do have a link at point, and we are going to edit it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6909 (setq remove (list (match-beginning 0) (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6910 (setq desc (if (match-end 3) (org-match-string-no-properties 3))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6911 (setq link (read-string "Link: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6912 (org-link-unescape |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6913 (org-match-string-no-properties 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6914 ((or (org-in-regexp org-angle-link-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6915 (org-in-regexp org-plain-link-re)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6916 ;; Convert to bracket link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6917 (setq remove (list (match-beginning 0) (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6918 link (read-string "Link: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6919 (org-remove-angle-brackets (match-string 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6920 ((equal complete-file '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6921 ;; Completing read for file names. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6922 (setq file (read-file-name "File: ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6923 (let ((pwd (file-name-as-directory (expand-file-name "."))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6924 (pwd1 (file-name-as-directory (abbreviate-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6925 (expand-file-name "."))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6926 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6927 ((equal complete-file '(16)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6928 (setq link (org-make-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6929 "file:" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6930 (abbreviate-file-name (expand-file-name file))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6931 ((string-match (concat "^" (regexp-quote pwd1) "\\(.+\\)") file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6932 (setq link (org-make-link "file:" (match-string 1 file)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6933 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6934 (expand-file-name file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6935 (setq link (org-make-link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6936 "file:" (match-string 1 (expand-file-name file))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6937 (t (setq link (org-make-link "file:" file)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6938 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6939 ;; Read link, with completion for stored links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6940 (with-output-to-temp-buffer "*Org Links*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6941 (princ "Insert a link. Use TAB to complete valid link prefixes.\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6942 (when org-stored-links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6943 (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6944 (princ (mapconcat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6945 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6946 (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6947 (reverse org-stored-links) "\n")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6948 (let ((cw (selected-window))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6949 (select-window (get-buffer-window "*Org Links*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6950 (shrink-window-if-larger-than-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6951 (setq truncate-lines t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6952 (select-window cw)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6953 ;; Fake a link history, containing the stored links. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6954 (setq tmphist (append (mapcar 'car org-stored-links) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6955 org-insert-link-history)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6956 (unwind-protect |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6957 (setq link (org-completing-read |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6958 "Link: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6959 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6960 (mapcar (lambda (x) (list (concat (car x) ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6961 (append org-link-abbrev-alist-local org-link-abbrev-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6962 (mapcar (lambda (x) (list (concat x ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6963 org-link-types)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6964 nil nil nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6965 'tmphist |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6966 (or (car (car org-stored-links))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6967 (set-window-configuration wcf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6968 (kill-buffer "*Org Links*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6969 (setq entry (assoc link org-stored-links)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6970 (or entry (push link org-insert-link-history)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6971 (if (funcall (if (equal complete-file '(64)) 'not 'identity) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6972 (not org-keep-stored-link-after-insertion)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6973 (setq org-stored-links (delq (assoc link org-stored-links) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6974 org-stored-links))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6975 (setq desc (or desc (nth 1 entry))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6976 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6977 (if (string-match org-plain-link-re link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6978 ;; URL-like link, normalize the use of angular brackets. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6979 (setq link (org-make-link (org-remove-angle-brackets link)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6980 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6981 ;; Check if we are linking to the current file with a search option |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6982 ;; If yes, simplify the link by using only the search option. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6983 (when (and buffer-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6984 (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6985 (let* ((path (match-string 1 link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6986 (case-fold-search nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6987 (search (match-string 2 link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6988 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6989 (if (equal (file-truename buffer-file-name) (file-truename path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6990 ;; We are linking to this same file, with a search option |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6991 (setq link search))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6992 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6993 ;; Check if we can/should use a relative path. If yes, simplify the link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6994 (when (string-match "\\<file:\\(.*\\)" link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6995 (let* ((path (match-string 1 link)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6996 (origpath path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6997 (case-fold-search nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6998 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6999 ((eq org-link-file-path-type 'absolute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7000 (setq path (abbreviate-file-name (expand-file-name path)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7001 ((eq org-link-file-path-type 'noabbrev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7002 (setq path (expand-file-name path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7003 ((eq org-link-file-path-type 'relative) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7004 (setq path (file-relative-name path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7005 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7006 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7007 (if (string-match (concat "^" (regexp-quote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7008 (file-name-as-directory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7009 (expand-file-name ".")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7010 (expand-file-name path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7011 ;; We are linking a file with relative path name. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7012 (setq path (substring (expand-file-name path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7013 (match-end 0))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7014 (setq link (concat "file:" path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7015 (if (equal desc origpath) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7016 (setq desc path)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7017 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7018 (if org-make-link-description-function |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7019 (setq desc (funcall org-make-link-description-function link desc))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7020 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7021 (setq desc (read-string "Description: " desc)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7022 (unless (string-match "\\S-" desc) (setq desc nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7023 (if remove (apply 'delete-region remove)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7024 (insert (org-make-link-string link desc)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7025 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7026 (defun org-completing-read (&rest args) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7027 (let ((minibuffer-local-completion-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7028 (copy-keymap minibuffer-local-completion-map))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7029 (org-defkey minibuffer-local-completion-map " " 'self-insert-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7030 (apply 'completing-read args))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7031 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7032 (defun org-extract-attributes (s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7033 "Extract the attributes cookie from a string and set as text property." |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7034 (let (a attr (start 0)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7035 (save-match-data |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7036 (when (string-match "{{\\([^}]+\\)}}$" s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7037 (setq a (match-string 1 s) s (substring s 0 (match-beginning 0))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7038 (while (string-match "\\([a-zA-Z]+\\)=\"\\([^\"]*\\)\"" a start) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7039 (setq key (match-string 1 a) value (match-string 2 a) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7040 start (match-end 0) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7041 attr (plist-put attr (intern key) value)))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7042 (org-add-props s nil 'org-attributes attr)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7043 s)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7044 |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7045 (defun org-attributes-to-string (plist) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7046 "Format a property list into an HTML attribute list." |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7047 (let ((s "") key value) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7048 (while plist |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7049 (setq key (pop plist) value (pop plist)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7050 (setq s (concat s " "(symbol-name key) "=\"" value "\""))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7051 s)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7052 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7053 ;;; Opening/following a link |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7054 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7055 (defvar org-link-search-failed nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7056 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7057 (defun org-next-link () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7058 "Move forward to the next link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7059 If the link is in hidden text, expose it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7060 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7061 (when (and org-link-search-failed (eq this-command last-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7062 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7063 (message "Link search wrapped back to beginning of buffer")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7064 (setq org-link-search-failed nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7065 (let* ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7066 (ct (org-context)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7067 (a (assoc :link ct))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7068 (if a (goto-char (nth 2 a))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7069 (if (re-search-forward org-any-link-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7070 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7071 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7072 (if (org-invisible-p) (org-show-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7073 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7074 (setq org-link-search-failed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7075 (error "No further link found")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7076 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7077 (defun org-previous-link () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7078 "Move backward to the previous link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7079 If the link is in hidden text, expose it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7080 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7081 (when (and org-link-search-failed (eq this-command last-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7082 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7083 (message "Link search wrapped back to end of buffer")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7084 (setq org-link-search-failed nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7085 (let* ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7086 (ct (org-context)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7087 (a (assoc :link ct))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7088 (if a (goto-char (nth 1 a))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7089 (if (re-search-backward org-any-link-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7090 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7091 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7092 (if (org-invisible-p) (org-show-context))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7093 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7094 (setq org-link-search-failed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7095 (error "No further link found")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7096 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7097 (defun org-find-file-at-mouse (ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7098 "Open file link or URL at mouse." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7099 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7100 (mouse-set-point ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7101 (org-open-at-point 'in-emacs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7102 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7103 (defun org-open-at-mouse (ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7104 "Open file link or URL at mouse." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7105 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7106 (mouse-set-point ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7107 (org-open-at-point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7108 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7109 (defvar org-window-config-before-follow-link nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7110 "The window configuration before following a link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7111 This is saved in case the need arises to restore it.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7112 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7113 (defvar org-open-link-marker (make-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7114 "Marker pointing to the location where `org-open-at-point; was called.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7115 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7116 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7117 (defun org-open-at-point-global () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7118 "Follow a link like Org-mode does. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7119 This command can be called in any mode to follow a link that has |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7120 Org-mode syntax." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7121 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7122 (org-run-like-in-org-mode 'org-open-at-point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7123 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7124 ;;;###autoload |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7125 (defun org-open-link-from-string (s &optional arg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7126 "Open a link in the string S, as if it was in Org-mode." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7127 (interactive "sLink: \nP") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7128 (with-temp-buffer |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7129 (let ((org-inhibit-startup t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7130 (org-mode) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7131 (insert s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7132 (goto-char (point-min)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7133 (org-open-at-point arg)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7134 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7135 (defun org-open-at-point (&optional in-emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7136 "Open link at or after point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7137 If there is no link at point, this function will search forward up to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7138 the end of the current subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7139 Normally, files will be opened by an appropriate application. If the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7140 optional argument IN-EMACS is non-nil, Emacs will visit the file." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7141 (interactive "P") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7142 (org-load-modules-maybe) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7143 (move-marker org-open-link-marker (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7144 (setq org-window-config-before-follow-link (current-window-configuration)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7145 (org-remove-occur-highlights nil nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7146 (if (org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7147 (org-follow-timestamp-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7148 (let (type path link line search (pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7149 (catch 'match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7150 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7151 (skip-chars-forward "^]\n\r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7152 (when (org-in-regexp org-bracket-link-regexp) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7153 (setq link (org-extract-attributes |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7154 (org-link-unescape (org-match-string-no-properties 1)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7155 (while (string-match " *\n *" link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7156 (setq link (replace-match " " t t link))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7157 (setq link (org-link-expand-abbrev link)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7158 (cond |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7159 ((or (file-name-absolute-p link) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7160 (string-match "^\\.\\.?/" link)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7161 (setq type "file" path link)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7162 ((string-match org-link-re-with-space2 link) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7163 (setq type (match-string 1 link) path (match-string 2 link))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7164 (t (setq type "thisfile" path link))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7165 (throw 'match t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7166 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7167 (when (get-text-property (point) 'org-linked-text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7168 (setq type "thisfile" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7169 pos (if (get-text-property (1+ (point)) 'org-linked-text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7170 (1+ (point)) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7171 path (buffer-substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7172 (previous-single-property-change pos 'org-linked-text) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7173 (next-single-property-change pos 'org-linked-text))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7174 (throw 'match t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7175 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7176 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7177 (when (or (org-in-regexp org-angle-link-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7178 (org-in-regexp org-plain-link-re)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7179 (setq type (match-string 1) path (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7180 (throw 'match t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7181 (when (org-in-regexp "\\<\\([^><\n]+\\)\\>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7182 (setq type "tree-match" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7183 path (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7184 (throw 'match t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7185 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7186 (when (org-in-regexp (org-re "\\(:[[:alnum:]_@:]+\\):[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7187 (setq type "tags" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7188 path (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7189 (while (string-match ":" path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7190 (setq path (replace-match "+" t t path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7191 (throw 'match t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7192 (unless path |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7193 (error "No link found")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7194 ;; Remove any trailing spaces in path |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7195 (if (string-match " +\\'" path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7196 (setq path (replace-match "" t t path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7197 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7198 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7199 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7200 ((assoc type org-link-protocols) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7201 (funcall (nth 1 (assoc type org-link-protocols)) path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7202 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7203 ((equal type "mailto") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7204 (let ((cmd (car org-link-mailto-program)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7205 (args (cdr org-link-mailto-program)) args1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7206 (address path) (subject "") a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7207 (if (string-match "\\(.*\\)::\\(.*\\)" path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7208 (setq address (match-string 1 path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7209 subject (org-link-escape (match-string 2 path)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7210 (while args |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7211 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7212 ((not (stringp (car args))) (push (pop args) args1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7213 (t (setq a (pop args)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7214 (if (string-match "%a" a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7215 (setq a (replace-match address t t a))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7216 (if (string-match "%s" a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7217 (setq a (replace-match subject t t a))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7218 (push a args1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7219 (apply cmd (nreverse args1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7220 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7221 ((member type '("http" "https" "ftp" "news")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7222 (browse-url (concat type ":" (org-link-escape |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7223 path org-link-escape-chars-browser)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7224 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7225 ((member type '("message")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7226 (browse-url (concat type ":" path))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7227 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7228 ((string= type "tags") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7229 (org-tags-view in-emacs path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7230 ((string= type "thisfile") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7231 (if in-emacs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7232 (switch-to-buffer-other-window |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7233 (org-get-buffer-for-internal-link (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7234 (org-mark-ring-push)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7235 (let ((cmd `(org-link-search |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7236 ,path |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7237 ,(cond ((equal in-emacs '(4)) 'occur) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7238 ((equal in-emacs '(16)) 'org-occur) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7239 (t nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7240 ,pos))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7241 (condition-case nil (eval cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7242 (error (progn (widen) (eval cmd)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7243 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7244 ((string= type "tree-match") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7245 (org-occur (concat "\\[" (regexp-quote path) "\\]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7246 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7247 ((string= type "file") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7248 (if (string-match "::\\([0-9]+\\)\\'" path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7249 (setq line (string-to-number (match-string 1 path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7250 path (substring path 0 (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7251 (if (string-match "::\\(.+\\)\\'" path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7252 (setq search (match-string 1 path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7253 path (substring path 0 (match-beginning 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7254 (if (string-match "[*?{]" (file-name-nondirectory path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7255 (dired path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7256 (org-open-file path in-emacs line search))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7257 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7258 ((string= type "news") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7259 (require 'org-gnus) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7260 (org-gnus-follow-link path)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7261 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7262 ((string= type "shell") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7263 (let ((cmd path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7264 (if (or (not org-confirm-shell-link-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7265 (funcall org-confirm-shell-link-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7266 (format "Execute \"%s\" in shell? " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7267 (org-add-props cmd nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7268 'face 'org-warning)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7269 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7270 (message "Executing %s" cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7271 (shell-command cmd)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7272 (error "Abort")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7273 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7274 ((string= type "elisp") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7275 (let ((cmd path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7276 (if (or (not org-confirm-elisp-link-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7277 (funcall org-confirm-elisp-link-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7278 (format "Execute \"%s\" as elisp? " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7279 (org-add-props cmd nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7280 'face 'org-warning)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7281 (message "%s => %s" cmd (eval (read cmd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7282 (error "Abort")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7283 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7284 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7285 (browse-url-at-point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7286 (move-marker org-open-link-marker nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7287 (run-hook-with-args 'org-follow-link-hook)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7288 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7289 ;;;; Time estimates |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7290 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7291 (defun org-get-effort (&optional pom) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7292 "Get the effort estimate for the current entry." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7293 (org-entry-get pom org-effort-property)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7294 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7295 ;;; File search |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7296 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7297 (defvar org-create-file-search-functions nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7298 "List of functions to construct the right search string for a file link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7299 These functions are called in turn with point at the location to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7300 which the link should point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7301 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7302 A function in the hook should first test if it would like to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7303 handle this file type, for example by checking the major-mode or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7304 the file extension. If it decides not to handle this file, it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7305 should just return nil to give other functions a chance. If it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7306 does handle the file, it must return the search string to be used |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7307 when following the link. The search string will be part of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7308 file link, given after a double colon, and `org-open-at-point' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7309 will automatically search for it. If special measures must be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7310 taken to make the search successful, another function should be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7311 added to the companion hook `org-execute-file-search-functions', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7312 which see. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7313 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7314 A function in this hook may also use `setq' to set the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7315 `description' to provide a suggestion for the descriptive text to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7316 be used for this link when it gets inserted into an Org-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7317 buffer with \\[org-insert-link].") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7318 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7319 (defvar org-execute-file-search-functions nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7320 "List of functions to execute a file search triggered by a link. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7321 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7322 Functions added to this hook must accept a single argument, the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7323 search string that was part of the file link, the part after the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7324 double colon. The function must first check if it would like to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7325 handle this search, for example by checking the major-mode or the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7326 file extension. If it decides not to handle this search, it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7327 should just return nil to give other functions a chance. If it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7328 does handle the search, it must return a non-nil value to keep |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7329 other functions from trying. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7330 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7331 Each function can access the current prefix argument through the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7332 variable `current-prefix-argument'. Note that a single prefix is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7333 used to force opening a link in Emacs, so it may be good to only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7334 use a numeric or double prefix to guide the search function. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7335 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7336 In case this is needed, a function in this hook can also restore |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7337 the window configuration before `org-open-at-point' was called using: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7338 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7339 (set-window-configuration org-window-config-before-follow-link)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7340 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7341 (defun org-link-search (s &optional type avoid-pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7342 "Search for a link search option. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7343 If S is surrounded by forward slashes, it is interpreted as a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7344 regular expression. In org-mode files, this will create an `org-occur' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7345 sparse tree. In ordinary files, `occur' will be used to list matches. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7346 If the current buffer is in `dired-mode', grep will be used to search |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7347 in all files. If AVOID-POS is given, ignore matches near that position." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7348 (let ((case-fold-search t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7349 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7350 (markers (concat "\\(?:" (mapconcat (lambda (x) (regexp-quote (car x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7351 (append '(("") (" ") ("\t") ("\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7352 org-emphasis-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7353 "\\|") "\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7354 (pos (point)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7355 (pre nil) (post nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7356 words re0 re1 re2 re3 re4_ re4 re5 re2a re2a_ reall) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7357 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7358 ;; First check if there are any special |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7359 ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7360 ;; Now try the builtin stuff |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7361 ((save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7362 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7363 (and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7364 (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7365 (concat "<<" (regexp-quote s0) ">>") nil t) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7366 (setq type 'dedicated |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7367 pos (match-beginning 0)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7368 ;; There is an exact target for this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7369 (goto-char pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7370 ((string-match "^/\\(.*\\)/$" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7371 ;; A regular expression |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7372 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7373 ((org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7374 (org-occur (match-string 1 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7375 ;;((eq major-mode 'dired-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7376 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7377 (t (org-do-occur (match-string 1 s))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7378 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7379 ;; A normal search strings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7380 (when (equal (string-to-char s) ?*) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7381 ;; Anchor on headlines, post may include tags. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7382 (setq pre "^\\*+[ \t]+\\(?:\\sw+\\)?[ \t]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7383 post (org-re "[ \t]*\\(?:[ \t]+:[[:alnum:]_@:+]:[ \t]*\\)?$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7384 s (substring s 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7385 (remove-text-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7386 0 (length s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7387 '(face nil mouse-face nil keymap nil fontified nil) s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7388 ;; Make a series of regular expressions to find a match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7389 (setq words (org-split-string s "[ \n\r\t]+") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7390 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7391 re0 (concat "\\(<<" (regexp-quote s0) ">>\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7392 re2 (concat markers "\\(" (mapconcat 'downcase words "[ \t]+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7393 "\\)" markers) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7394 re2a_ (concat "\\(" (mapconcat 'downcase words "[ \t\r\n]+") "\\)[ \t\r\n]") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7395 re2a (concat "[ \t\r\n]" re2a_) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7396 re4_ (concat "\\(" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\)[^a-zA-Z_]") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7397 re4 (concat "[^a-zA-Z_]" re4_) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7398 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7399 re1 (concat pre re2 post) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7400 re3 (concat pre (if pre re4_ re4) post) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7401 re5 (concat pre ".*" re4) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7402 re2 (concat pre re2) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7403 re2a (concat pre (if pre re2a_ re2a)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7404 re4 (concat pre (if pre re4_ re4)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7405 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7406 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7407 re5 "\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7408 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7409 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7410 ((eq type 'org-occur) (org-occur reall)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7411 ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7412 (t (goto-char (point-min)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7413 (setq type 'fuzzy) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7414 (if (or (and (org-search-not-self 1 re0 nil t) (setq type 'dedicated)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7415 (org-search-not-self 1 re1 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7416 (org-search-not-self 1 re2 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7417 (org-search-not-self 1 re2a nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7418 (org-search-not-self 1 re3 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7419 (org-search-not-self 1 re4 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7420 (org-search-not-self 1 re5 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7421 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7422 (goto-char (match-beginning 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7423 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7424 (error "No match"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7425 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7426 ;; Normal string-search |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7427 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7428 (if (search-forward s nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7429 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7430 (error "No match")))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7431 (and (org-mode-p) (org-show-context 'link-search)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7432 type)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7433 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7434 (defun org-search-not-self (group &rest args) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7435 "Execute `re-search-forward', but only accept matches that do not |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7436 enclose the position of `org-open-link-marker'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7437 (let ((m org-open-link-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7438 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7439 (while (apply 're-search-forward args) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7440 (unless (get-text-property (match-end group) 'intangible) ; Emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7441 (goto-char (match-end group)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7442 (if (and (or (not (eq (marker-buffer m) (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7443 (> (match-beginning 0) (marker-position m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7444 (< (match-end 0) (marker-position m))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7445 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7446 (or (not (org-in-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7447 org-bracket-link-analytic-regexp 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7448 (not (match-end 4)) ; no description |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7449 (and (<= (match-beginning 4) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7450 (>= (match-end 4) (point)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7451 (throw 'exit (point)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7452 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7453 (defun org-get-buffer-for-internal-link (buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7454 "Return a buffer to be used for displaying the link target of internal links." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7455 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7456 ((not org-display-internal-link-with-indirect-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7457 buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7458 ((string-match "(Clone)$" (buffer-name buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7459 (message "Buffer is already a clone, not making another one") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7460 ;; we also do not modify visibility in this case |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7461 buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7462 (t ; make a new indirect buffer for displaying the link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7463 (let* ((bn (buffer-name buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7464 (ibn (concat bn "(Clone)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7465 (ib (or (get-buffer ibn) (make-indirect-buffer buffer ibn 'clone)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7466 (with-current-buffer ib (org-overview)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7467 ib)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7468 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7469 (defun org-do-occur (regexp &optional cleanup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7470 "Call the Emacs command `occur'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7471 If CLEANUP is non-nil, remove the printout of the regular expression |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7472 in the *Occur* buffer. This is useful if the regex is long and not useful |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7473 to read." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7474 (occur regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7475 (when cleanup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7476 (let ((cwin (selected-window)) win beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7477 (when (setq win (get-buffer-window "*Occur*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7478 (select-window win)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7479 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7480 (when (re-search-forward "match[a-z]+" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7481 (setq beg (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7482 (if (re-search-forward "^[ \t]*[0-9]+" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7483 (setq end (1- (match-beginning 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7484 (and beg end (let ((inhibit-read-only t)) (delete-region beg end))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7485 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7486 (select-window cwin)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7487 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7488 ;;; The mark ring for links jumps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7489 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7490 (defvar org-mark-ring nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7491 "Mark ring for positions before jumps in Org-mode.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7492 (defvar org-mark-ring-last-goto nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7493 "Last position in the mark ring used to go back.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7494 ;; Fill and close the ring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7495 (setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7496 (loop for i from 1 to org-mark-ring-length do |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7497 (push (make-marker) org-mark-ring)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7498 (setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7499 org-mark-ring) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7500 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7501 (defun org-mark-ring-push (&optional pos buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7502 "Put the current position or POS into the mark ring and rotate it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7503 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7504 (setq pos (or pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7505 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7506 (move-marker (car org-mark-ring) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7507 (or pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7508 (or buffer (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7509 (message "%s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7510 (substitute-command-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7511 "Position saved to mark ring, go back with \\[org-mark-ring-goto]."))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7512 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7513 (defun org-mark-ring-goto (&optional n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7514 "Jump to the previous position in the mark ring. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7515 With prefix arg N, jump back that many stored positions. When |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7516 called several times in succession, walk through the entire ring. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7517 Org-mode commands jumping to a different position in the current file, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7518 or to another Org-mode file, automatically push the old position |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7519 onto the ring." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7520 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7521 (let (p m) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7522 (if (eq last-command this-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7523 (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7524 (setq p org-mark-ring)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7525 (setq org-mark-ring-last-goto p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7526 (setq m (car p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7527 (switch-to-buffer (marker-buffer m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7528 (goto-char m) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7529 (if (or (org-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7530 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7531 (defun org-remove-angle-brackets (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7532 (if (equal (substring s 0 1) "<") (setq s (substring s 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7533 (if (equal (substring s -1) ">") (setq s (substring s 0 -1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7534 s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7535 (defun org-add-angle-brackets (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7536 (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7537 (if (equal (substring s -1) ">") nil (setq s (concat s ">"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7538 s) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7539 (defun org-remove-double-quotes (s) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7540 (if (equal (substring s 0 1) "\"") (setq s (substring s 1))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7541 (if (equal (substring s -1) "\"") (setq s (substring s 0 -1))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7542 s) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7543 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7544 ;;; Following specific links |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7545 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7546 (defun org-follow-timestamp-link () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7547 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7548 ((org-at-date-range-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7549 (let ((org-agenda-start-on-weekday) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7550 (t1 (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7551 (t2 (match-string 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7552 (setq t1 (time-to-days (org-time-string-to-time t1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7553 t2 (time-to-days (org-time-string-to-time t2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7554 (org-agenda-list nil t1 (1+ (- t2 t1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7555 ((org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7556 (org-agenda-list nil (time-to-days (org-time-string-to-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7557 (substring (match-string 1) 0 10))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7558 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7559 (t (error "This should not happen")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7560 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7561 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7562 ;;; Following file links |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7563 (defvar org-wait nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7564 (defun org-open-file (path &optional in-emacs line search) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7565 "Open the file at PATH. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7566 First, this expands any special file name abbreviations. Then the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7567 configuration variable `org-file-apps' is checked if it contains an |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7568 entry for this file type, and if yes, the corresponding command is launched. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7569 If no application is found, Emacs simply visits the file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7570 With optional argument IN-EMACS, Emacs will visit the file. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7571 Optional LINE specifies a line to go to, optional SEARCH a string to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7572 search for. If LINE or SEARCH is given, the file will always be |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7573 opened in Emacs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7574 If the file does not exist, an error is thrown." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7575 (setq in-emacs (or in-emacs line search)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7576 (let* ((file (if (equal path "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7577 buffer-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7578 (substitute-in-file-name (expand-file-name path)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7579 (apps (append org-file-apps (org-default-apps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7580 (remp (and (assq 'remote apps) (org-file-remote-p file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7581 (dirp (if remp nil (file-directory-p file))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7582 (file (if (and dirp org-open-directory-means-index-dot-org) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7583 (concat (file-name-as-directory file) "index.org") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
7584 file)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7585 (dfile (downcase file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7586 (old-buffer (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7587 (old-pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7588 (old-mode major-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7589 ext cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7590 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7591 (setq ext (match-string 1 dfile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7592 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7593 (setq ext (match-string 1 dfile)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7594 (if in-emacs |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7595 (setq cmd 'emacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7596 (setq cmd (or (and remp (cdr (assoc 'remote apps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7597 (and dirp (cdr (assoc 'directory apps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7598 (cdr (assoc ext apps)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7599 (cdr (assoc t apps))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7600 (when (eq cmd 'mailcap) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7601 (require 'mailcap) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7602 (mailcap-parse-mailcaps) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7603 (let* ((mime-type (mailcap-extension-to-mime (or ext ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7604 (command (mailcap-mime-info mime-type))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7605 (if (stringp command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7606 (setq cmd command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7607 (setq cmd 'emacs)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7608 (if (and (not (eq cmd 'emacs)) ; Emacs has no problems with non-ex files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7609 (not (file-exists-p file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7610 (not org-open-non-existing-files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7611 (error "No such file: %s" file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7612 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7613 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7614 ;; Remove quotes around the file name - we'll use shell-quote-argument. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7615 (while (string-match "['\"]%s['\"]" cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7616 (setq cmd (replace-match "%s" t t cmd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7617 (while (string-match "%s" cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7618 (setq cmd (replace-match |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7619 (save-match-data |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7620 (shell-quote-argument |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7621 (convert-standard-filename file))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7622 t t cmd))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7623 (save-window-excursion |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7624 (start-process-shell-command cmd nil cmd) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7625 (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7626 )) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7627 ((or (stringp cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7628 (eq cmd 'emacs)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7629 (funcall (cdr (assq 'file org-link-frame-setup)) file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7630 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7631 (if line (goto-line line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7632 (if search (org-link-search search)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7633 ((consp cmd) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7634 (let ((file (convert-standard-filename file))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7635 (eval cmd))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7636 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7637 (and (org-mode-p) (eq old-mode 'org-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7638 (or (not (equal old-buffer (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7639 (not (equal old-pos (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7640 (org-mark-ring-push old-pos old-buffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7641 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7642 (defun org-default-apps () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7643 "Return the default applications for this operating system." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7644 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7645 ((eq system-type 'darwin) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7646 org-file-apps-defaults-macosx) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7647 ((eq system-type 'windows-nt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7648 org-file-apps-defaults-windowsnt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7649 (t org-file-apps-defaults-gnu))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7650 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7651 (defvar ange-ftp-name-format) ; to silence the XEmacs compiler. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7652 (defun org-file-remote-p (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7653 "Test whether FILE specifies a location on a remote system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7654 Return non-nil if the location is indeed remote. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7655 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7656 For example, the filename \"/user@host:/foo\" specifies a location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7657 on the system \"/user@host:\"." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7658 (cond ((fboundp 'file-remote-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7659 (file-remote-p file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7660 ((fboundp 'tramp-handle-file-remote-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7661 (tramp-handle-file-remote-p file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7662 ((and (boundp 'ange-ftp-name-format) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7663 (string-match (car ange-ftp-name-format) file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7664 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7665 (t nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7666 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7667 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7668 ;;;; Refiling |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7669 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7670 (defun org-get-org-file () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7671 "Read a filename, with default directory `org-directory'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7672 (let ((default (or org-default-notes-file remember-data-file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7673 (read-file-name (format "File name [%s]: " default) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7674 (file-name-as-directory org-directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7675 default))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7676 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7677 (defun org-notes-order-reversed-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7678 "Check if the current file should receive notes in reversed order." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7679 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7680 ((not org-reverse-note-order) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7681 ((eq t org-reverse-note-order) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7682 ((not (listp org-reverse-note-order)) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7683 (t (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7684 (let ((all org-reverse-note-order) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7685 entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7686 (while (setq entry (pop all)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7687 (if (string-match (car entry) buffer-file-name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7688 (throw 'exit (cdr entry)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7689 nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7690 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7691 (defvar org-refile-target-table nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7692 "The list of refile targets, created by `org-refile'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7693 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7694 (defvar org-agenda-new-buffers nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7695 "Buffers created to visit agenda files.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7696 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7697 (defun org-get-refile-targets (&optional default-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7698 "Produce a table with refile targets." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7699 (let ((entries (or org-refile-targets '((nil . (:level . 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7700 targets txt re files f desc descre) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7701 (with-current-buffer (or default-buffer (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7702 (while (setq entry (pop entries)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7703 (setq files (car entry) desc (cdr entry)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7704 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7705 ((null files) (setq files (list (current-buffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7706 ((eq files 'org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7707 (setq files (org-agenda-files 'unrestricted))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7708 ((and (symbolp files) (fboundp files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7709 (setq files (funcall files))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7710 ((and (symbolp files) (boundp files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7711 (setq files (symbol-value files)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7712 (if (stringp files) (setq files (list files))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7713 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7714 ((eq (car desc) :tag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7715 (setq descre (concat "^\\*+[ \t]+.*?:" (regexp-quote (cdr desc)) ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7716 ((eq (car desc) :todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7717 (setq descre (concat "^\\*+[ \t]+" (regexp-quote (cdr desc)) "[ \t]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7718 ((eq (car desc) :regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7719 (setq descre (cdr desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7720 ((eq (car desc) :level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7721 (setq descre (concat "^\\*\\{" (number-to-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7722 (if org-odd-levels-only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7723 (1- (* 2 (cdr desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7724 (cdr desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7725 "\\}[ \t]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7726 ((eq (car desc) :maxlevel) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7727 (setq descre (concat "^\\*\\{1," (number-to-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7728 (if org-odd-levels-only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7729 (1- (* 2 (cdr desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7730 (cdr desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7731 "\\}[ \t]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7732 (t (error "Bad refiling target description %s" desc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7733 (while (setq f (pop files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7734 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7735 (set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7736 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7737 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7738 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7739 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7740 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7741 (while (re-search-forward descre nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7742 (goto-char (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7743 (when (looking-at org-complex-heading-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7744 (setq txt (match-string 4) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7745 re (concat "^" (regexp-quote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7746 (buffer-substring (match-beginning 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7747 (match-end 4))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7748 (if (match-end 5) (setq re (concat re "[ \t]+" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7749 (regexp-quote |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7750 (match-string 5))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7751 (setq re (concat re "[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7752 (when org-refile-use-outline-path |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7753 (setq txt (mapconcat 'identity |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7754 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7755 (if (eq org-refile-use-outline-path 'file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7756 (list (file-name-nondirectory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7757 (buffer-file-name (buffer-base-buffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7758 (if (eq org-refile-use-outline-path 'full-file-path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7759 (list (buffer-file-name (buffer-base-buffer))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7760 (org-get-outline-path) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7761 (list txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7762 "/"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7763 (push (list txt f re (point)) targets)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7764 (goto-char (point-at-eol)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7765 (nreverse targets)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7766 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7767 (defun org-get-outline-path () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7768 "Return the outline path to the current entry, as a list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7769 (let (rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7770 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7771 (while (org-up-heading-safe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7772 (when (looking-at org-complex-heading-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7773 (push (org-match-string-no-properties 4) rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7774 rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7775 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7776 (defvar org-refile-history nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7777 "History for refiling operations.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7778 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7779 (defun org-refile (&optional goto default-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7780 "Move the entry at point to another heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7781 The list of target headings is compiled using the information in |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7782 `org-refile-targets', which see. This list is created before each use |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7783 and will therefore always be up-to-date. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7784 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7785 At the target location, the entry is filed as a subitem of the target heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7786 Depending on `org-reverse-note-order', the new subitem will either be the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7787 first of the last subitem. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7788 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7789 With prefix arg GOTO, the command will only visit the target location, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7790 not actually move anything. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7791 With a double prefix `C-c C-c', go to the location where the last refiling |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
7792 operation has put the subtree." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7793 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7794 (let* ((cbuf (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7795 (filename (buffer-file-name (buffer-base-buffer cbuf))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7796 pos it nbuf file re level reversed) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7797 (if (equal goto '(16)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7798 (org-refile-goto-last-stored) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7799 (when (setq it (org-refile-get-location |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7800 (if goto "Goto: " "Refile to: ") default-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7801 (setq file (nth 1 it) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7802 re (nth 2 it) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7803 pos (nth 3 it)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7804 (setq nbuf (or (find-buffer-visiting file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7805 (find-file-noselect file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7806 (if goto |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7807 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7808 (switch-to-buffer nbuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7809 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7810 (org-show-context 'org-goto)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7811 (org-copy-subtree 1 nil t) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7812 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7813 (set-buffer (setq nbuf (or (find-buffer-visiting file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7814 (find-file-noselect file)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7815 (setq reversed (org-notes-order-reversed-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7816 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7817 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7818 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7819 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7820 (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7821 (setq level (org-get-valid-level (funcall outline-level) 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7822 (goto-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7823 (if reversed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7824 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7825 (or (save-excursion (outline-get-next-sibling)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7826 (org-end-of-subtree t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7827 (point-max)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7828 (bookmark-set "org-refile-last-stored") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7829 (org-paste-subtree level)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7830 (org-cut-subtree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7831 (setq org-markers-to-move nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7832 (message "Entry refiled to \"%s\"" (car it))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7833 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7834 (defun org-refile-goto-last-stored () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7835 "Go to the location where the last refile was stored." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7836 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7837 (bookmark-jump "org-refile-last-stored") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7838 (message "This is the location of the last refile")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7839 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7840 (defun org-refile-get-location (&optional prompt default-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7841 "Prompt the user for a refile location, using PROMPT." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7842 (let ((org-refile-targets org-refile-targets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7843 (org-refile-use-outline-path org-refile-use-outline-path)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7844 (setq org-refile-target-table (org-get-refile-targets default-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7845 (unless org-refile-target-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7846 (error "No refile targets")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7847 (let* ((cbuf (current-buffer)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7848 (cfunc (if org-refile-use-outline-path |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7849 'org-olpath-completing-read |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7850 'completing-read)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7851 (extra (if org-refile-use-outline-path "/" "")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7852 (filename (buffer-file-name (buffer-base-buffer cbuf))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7853 (fname (and filename (file-truename filename))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7854 (tbl (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7855 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7856 (if (not (equal fname (file-truename (nth 1 x)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7857 (cons (concat (car x) extra " (" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7858 (file-name-nondirectory (nth 1 x)) ")") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7859 (cdr x)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7860 (cons (concat (car x) extra) (cdr x)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7861 org-refile-target-table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7862 (completion-ignore-case t)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7863 (assoc (funcall cfunc prompt tbl nil t nil 'org-refile-history) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7864 tbl))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7865 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7866 (defun org-olpath-completing-read (prompt collection &rest args) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7867 "Read an outline path like a file name." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7868 (let ((thetable collection)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7869 (apply |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7870 'completing-read prompt |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7871 (lambda (string predicate &optional flag) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7872 (let (rtn r s f (l (length string))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7873 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7874 ((eq flag nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7875 ;; try completion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7876 (try-completion string thetable)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7877 ((eq flag t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7878 ;; all-completions |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7879 (setq rtn (all-completions string thetable predicate)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7880 (mapcar |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7881 (lambda (x) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7882 (setq r (substring x l)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7883 (if (string-match " ([^)]*)$" x) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7884 (setq f (match-string 0 x)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7885 (setq f "")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7886 (if (string-match "/" r) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7887 (concat string (substring r 0 (match-end 0)) f) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7888 x)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7889 rtn)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7890 ((eq flag 'lambda) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7891 ;; exact match? |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7892 (assoc string thetable))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7893 )) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7894 args))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
7895 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7896 ;;;; Dynamic blocks |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7897 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7898 (defun org-find-dblock (name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7899 "Find the first dynamic block with name NAME in the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7900 If not found, stay at current position and return nil." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7901 (let (pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7902 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7903 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7904 (setq pos (and (re-search-forward (concat "^#\\+BEGIN:[ \t]+" name "\\>") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7905 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7906 (match-beginning 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7907 (if pos (goto-char pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7908 pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7909 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7910 (defconst org-dblock-start-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7911 "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7912 "Matches the startline of a dynamic block, with parameters.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7913 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7914 (defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7915 "Matches the end of a dyhamic block.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7916 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7917 (defun org-create-dblock (plist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7918 "Create a dynamic block section, with parameters taken from PLIST. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7919 PLIST must containe a :name entry which is used as name of the block." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7920 (unless (bolp) (newline)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7921 (let ((name (plist-get plist :name))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7922 (insert "#+BEGIN: " name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7923 (while plist |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7924 (if (eq (car plist) :name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7925 (setq plist (cddr plist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7926 (insert " " (prin1-to-string (pop plist))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7927 (insert "\n\n#+END:\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7928 (beginning-of-line -2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7929 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7930 (defun org-prepare-dblock () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7931 "Prepare dynamic block for refresh. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7932 This empties the block, puts the cursor at the insert position and returns |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7933 the property list including an extra property :name with the block name." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7934 (unless (looking-at org-dblock-start-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7935 (error "Not at a dynamic block")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7936 (let* ((begdel (1+ (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7937 (name (org-no-properties (match-string 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7938 (params (append (list :name name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7939 (read (concat "(" (match-string 3) ")"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7940 (unless (re-search-forward org-dblock-end-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7941 (error "Dynamic block not terminated")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7942 (setq params |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7943 (append params |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7944 (list :content (buffer-substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7945 begdel (match-beginning 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7946 (delete-region begdel (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7947 (goto-char begdel) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7948 (open-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7949 params)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7950 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7951 (defun org-map-dblocks (&optional command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7952 "Apply COMMAND to all dynamic blocks in the current buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7953 If COMMAND is not given, use `org-update-dblock'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7954 (let ((cmd (or command 'org-update-dblock)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7955 pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7956 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7957 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7958 (while (re-search-forward org-dblock-start-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7959 (goto-char (setq pos (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7960 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7961 (funcall cmd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7962 (error (message "Error during update of dynamic block"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7963 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7964 (unless (re-search-forward org-dblock-end-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7965 (error "Dynamic block not terminated")))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7966 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7967 (defun org-dblock-update (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7968 "User command for updating dynamic blocks. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7969 Update the dynamic block at point. With prefix ARG, update all dynamic |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7970 blocks in the buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7971 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7972 (if arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7973 (org-update-all-dblocks) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7974 (or (looking-at org-dblock-start-re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7975 (org-beginning-of-dblock)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7976 (org-update-dblock))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7977 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7978 (defun org-update-dblock () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7979 "Update the dynamic block at point |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7980 This means to empty the block, parse for parameters and then call |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7981 the correct writing function." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7982 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7983 (let* ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7984 (line (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7985 (params (org-prepare-dblock)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7986 (name (plist-get params :name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7987 (cmd (intern (concat "org-dblock-write:" name)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7988 (message "Updating dynamic block `%s' at line %d..." name line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7989 (funcall cmd params) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7990 (message "Updating dynamic block `%s' at line %d...done" name line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7991 (goto-char pos)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7992 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7993 (defun org-beginning-of-dblock () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7994 "Find the beginning of the dynamic block at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7995 Error if there is no scuh block at point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7996 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7997 beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7998 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
7999 (if (and (re-search-backward org-dblock-start-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8000 (setq beg (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8001 (re-search-forward org-dblock-end-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8002 (> (match-end 0) pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8003 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8004 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8005 (error "Not in a dynamic block")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8006 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8007 (defun org-update-all-dblocks () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8008 "Update all dynamic blocks in the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8009 This function can be used in a hook." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8010 (when (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8011 (org-map-dblocks 'org-update-dblock))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8012 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8013 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8014 ;;;; Completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8015 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8016 (defconst org-additional-option-like-keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8017 '("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8018 "ORGTBL" "HTML:" "LaTeX:" "BEGIN:" "END:" "TBLFM" |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8019 "BEGIN_EXAMPLE" "END_EXAMPLE")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8020 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8021 (defcustom org-structure-template-alist |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8022 '( |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8023 ("s" "#+begin_src ?\n\n#+end_src" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8024 "<src lang=\"?\">\n\n</src>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8025 ("e" "#+begin_example\n?\n#+end_example" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8026 "<example>\n?\n</example>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8027 ("q" "#+begin_quote\n?\n#+end_quote" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8028 "<quote>\n?\n</quote>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8029 ("v" "#+begin_verse\n?\n#+end_verse" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8030 "<verse>\n?\n/verse>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8031 ("l" "#+begin_latex\n?\n#+end_latex" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8032 "<literal style=\"latex\">\n?\n</literal>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8033 ("L" "#+latex: " |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8034 "<literal style=\"latex\">?</literal>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8035 ("h" "#+begin_html\n?\n#+end_html" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8036 "<literal style=\"html\">\n?\n</literal>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8037 ("H" "#+html: " |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8038 "<literal style=\"html\">?</literal>") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8039 ("a" "#+begin_ascii\n?\n#+end_ascii") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8040 ("A" "#+ascii: ") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8041 ("i" "#+include %file ?" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8042 "<include file=%file markup=\"?\">") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8043 ) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8044 "Structure completion elements. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8045 This is a list of abbreviation keys and values. The value gets inserted |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8046 it you type @samp{.} followed by the key and then the completion key, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8047 usually `M-TAB'. %file will be replaced by a file name after prompting |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8048 for the file uning completion. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8049 There are two templates for each key, the first uses the original Org syntax, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8050 the second uses Emacs Muse-like syntax tags. These Muse-like tags become |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8051 the default when the /org-mtags.el/ module has been loaded. See also the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8052 variable `org-mtags-prefere-muse-templates'. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8053 This is an experimental feature, it is undecided if it is going to stay in." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8054 :group 'org-completion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8055 :type '(repeat |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8056 (string :tag "Key") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8057 (string :tag "Template") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8058 (string :tag "Muse Template"))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8059 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8060 (defun org-try-structure-completion () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8061 "Try to complete a structure template before point. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8062 This looks for strings like \"<e\" on an otherwise empty line and |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8063 expands them." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8064 (let ((l (buffer-substring (point-at-bol) (point))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8065 a) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8066 (when (and (looking-at "[ \t]*$") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8067 (string-match "^[ \t]*<\\([a-z]+\\)$"l) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8068 (setq a (assoc (match-string 1 l) org-structure-template-alist))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8069 (org-complete-expand-structure-template (+ -1 (point-at-bol) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8070 (match-beginning 1)) a) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8071 t))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8072 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8073 (defun org-complete-expand-structure-template (start cell) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8074 "Expand a structure template." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8075 (let* ((musep (org-bound-and-true-p org-mtags-prefere-muse-templates)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8076 (rpl (nth (if musep 2 1) cell))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8077 (delete-region start (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8078 (when (string-match "\\`#\\+" rpl) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8079 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8080 ((bolp)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8081 ((not (string-match "\\S-" (buffer-substring (point-at-bol) (point)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8082 (delete-region (point-at-bol) (point))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8083 (t (newline)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8084 (setq start (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8085 (if (string-match "%file" rpl) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8086 (setq rpl (replace-match |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8087 (concat |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8088 "\"" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8089 (save-match-data |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8090 (abbreviate-file-name (read-file-name "Include file: "))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8091 "\"") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8092 t t rpl))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8093 (insert rpl) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8094 (if (re-search-backward "\\?" start t) (delete-char 1)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8095 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8096 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8097 (defun org-complete (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8098 "Perform completion on word at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8099 At the beginning of a headline, this completes TODO keywords as given in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8100 `org-todo-keywords'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8101 If the current word is preceded by a backslash, completes the TeX symbols |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8102 that are supported for HTML support. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8103 If the current word is preceded by \"#+\", completes special words for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8104 setting file options. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8105 In the line after \"#+STARTUP:, complete valid keywords.\" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8106 At all other locations, this simply calls the value of |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8107 `org-completion-fallback-command'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8108 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8109 (org-without-partial-completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8110 (catch 'exit |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8111 (let* ((a nil) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8112 (end (point)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8113 (beg1 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8114 (skip-chars-backward (org-re "[:alnum:]_@")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8115 (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8116 (beg (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8117 (skip-chars-backward "a-zA-Z0-9_:$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8118 (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8119 (confirm (lambda (x) (stringp (car x)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8120 (searchhead (equal (char-before beg) ?*)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8121 (struct |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8122 (when (and (member (char-before beg1) '(?. ?<)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8123 (setq a (assoc (buffer-substring beg1 (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8124 org-structure-template-alist))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8125 (org-complete-expand-structure-template (1- beg1) a) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8126 (throw 'exit t))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8127 (tag (and (equal (char-before beg1) ?:) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8128 (equal (char-after (point-at-bol)) ?*))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8129 (prop (and (equal (char-before beg1) ?:) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8130 (not (equal (char-after (point-at-bol)) ?*)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8131 (texp (equal (char-before beg) ?\\)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8132 (link (equal (char-before beg) ?\[)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8133 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8134 beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8135 "#+")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8136 (startup (string-match "^#\\+STARTUP:.*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8137 (buffer-substring (point-at-bol) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8138 (completion-ignore-case opt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8139 (type nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8140 (tbl nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8141 (table (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8142 (opt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8143 (setq type :opt) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8144 (require 'org-exp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8145 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8146 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8147 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8148 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8149 (cons (match-string 2 x) (match-string 1 x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8150 (org-split-string (org-get-current-options) "\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8151 (mapcar 'list org-additional-option-like-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8152 (startup |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8153 (setq type :startup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8154 org-startup-options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8155 (link (append org-link-abbrev-alist-local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8156 org-link-abbrev-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8157 (texp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8158 (setq type :tex) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8159 org-html-entities) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8160 ((string-match "\\`\\*+[ \t]+\\'" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8161 (buffer-substring (point-at-bol) beg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8162 (setq type :todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8163 (mapcar 'list org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8164 (searchhead |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8165 (setq type :searchhead) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8166 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8167 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8168 (while (re-search-forward org-todo-line-regexp nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8169 (push (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8170 (org-make-org-heading-search-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8171 (match-string 3) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8172 tbl))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8173 tbl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8174 (tag (setq type :tag beg beg1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8175 (or org-tag-alist (org-get-buffer-tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8176 (prop (setq type :prop beg beg1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8177 (mapcar 'list (org-buffer-property-keys nil t t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8178 (t (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8179 (call-interactively org-completion-fallback-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8180 (throw 'exit nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8181 (pattern (buffer-substring-no-properties beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8182 (completion (try-completion pattern table confirm))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8183 (cond ((eq completion t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8184 (if (not (assoc (upcase pattern) table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8185 (message "Already complete") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8186 (if (and (equal type :opt) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8187 (not (member (car (assoc (upcase pattern) table)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8188 org-additional-option-like-keywords))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8189 (insert (substring (cdr (assoc (upcase pattern) table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8190 (length pattern))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8191 (if (memq type '(:tag :prop)) (insert ":"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8192 ((null completion) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8193 (message "Can't find completion for \"%s\"" pattern) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8194 (ding)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8195 ((not (string= pattern completion)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8196 (delete-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8197 (if (string-match " +$" completion) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8198 (setq completion (replace-match "" t t completion))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8199 (insert completion) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8200 (if (get-buffer-window "*Completions*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8201 (delete-window (get-buffer-window "*Completions*"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8202 (if (assoc completion table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8203 (if (eq type :todo) (insert " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8204 (if (memq type '(:tag :prop)) (insert ":")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8205 (if (and (equal type :opt) (assoc completion table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8206 (message "%s" (substitute-command-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8207 "Press \\[org-complete] again to insert example settings")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8208 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8209 (message "Making completion list...") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8210 (let ((list (sort (all-completions pattern table confirm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8211 'string<))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8212 (with-output-to-temp-buffer "*Completions*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8213 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8214 ;; Protection needed for XEmacs and emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8215 (display-completion-list list pattern) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8216 (error (display-completion-list list))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8217 (message "Making completion list...%s" "done"))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8218 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8219 ;;;; TODO, DEADLINE, Comments |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8220 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8221 (defun org-toggle-comment () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8222 "Change the COMMENT state of an entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8223 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8224 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8225 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8226 (let (case-fold-search) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8227 (if (looking-at (concat outline-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8228 "\\( *\\<" org-comment-string "\\>[ \t]*\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8229 (replace-match "" t t nil 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8230 (if (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8231 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8232 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8233 (insert org-comment-string " "))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8234 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8235 (defvar org-last-todo-state-is-todo nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8236 "This is non-nil when the last TODO state change led to a TODO state. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8237 If the last change removed the TODO tag or switched to DONE, then |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8238 this is nil.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8239 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8240 (defvar org-setting-tags nil) ; dynamically skiped |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8241 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8242 (defun org-parse-local-options (string var) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8243 "Parse STRING for startup setting relevant for variable VAR." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8244 (let ((rtn (symbol-value var)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8245 e opts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8246 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8247 (if (or (not string) (not (string-match "\\S-" string))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8248 rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8249 (setq opts (delq nil (mapcar (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8250 (setq e (assoc x org-startup-options)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8251 (if (eq (nth 1 e) var) e nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8252 (org-split-string string "[ \t]+")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8253 (if (not opts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8254 rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8255 (setq rtn nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8256 (while (setq e (pop opts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8257 (if (not (nth 3 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8258 (setq rtn (nth 2 e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8259 (if (not (listp rtn)) (setq rtn nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8260 (push (nth 2 e) rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8261 rtn))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8262 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8263 (defvar org-blocker-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8264 "Hook for functions that are allowed to block a state change. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8265 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8266 Each function gets as its single argument a property list, see |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8267 `org-trigger-hook' for more information about this list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8268 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8269 If any of the functions in this hook returns nil, the state change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8270 is blocked.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8271 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8272 (defvar org-trigger-hook nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8273 "Hook for functions that are triggered by a state change. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8274 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8275 Each function gets as its single argument a property list with at least |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8276 the following elements: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8277 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8278 (:type type-of-change :position pos-at-entry-start |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8279 :from old-state :to new-state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8280 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8281 Depending on the type, more properties may be present. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8282 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8283 This mechanism is currently implemented for: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8284 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8285 TODO state changes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8286 ------------------ |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8287 :type todo-state-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8288 :from previous state (keyword as a string), or nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8289 :to new state (keyword as a string), or nil") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8290 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8291 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8292 (defun org-todo (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8293 "Change the TODO state of an item. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8294 The state of an item is given by a keyword at the start of the heading, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8295 like |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8296 *** TODO Write paper |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8297 *** DONE Call mom |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8298 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8299 The different keywords are specified in the variable `org-todo-keywords'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8300 By default the available states are \"TODO\" and \"DONE\". |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8301 So for this example: when the item starts with TODO, it is changed to DONE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8302 When it starts with DONE, the DONE is removed. And when neither TODO nor |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8303 DONE are present, add TODO at the beginning of the heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8304 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8305 With C-u prefix arg, use completion to determine the new state. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8306 With numeric prefix arg, switch to that state. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8307 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8308 For calling through lisp, arg is also interpreted in the following way: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8309 'none -> empty state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8310 \"\"(empty string) -> switch to empty state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8311 'done -> switch to DONE |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8312 'nextset -> switch to the next set of keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8313 'previousset -> switch to the previous set of keywords |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8314 \"WAITING\" -> switch to the specified keyword, but only if it |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8315 really is a member of `org-todo-keywords'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8316 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8317 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8318 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8319 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8320 (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8321 (or (looking-at (concat " +" org-todo-regexp " *")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8322 (looking-at " *")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8323 (let* ((match-data (match-data)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8324 (startpos (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8325 (logging (save-match-data (org-entry-get nil "LOGGING" t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8326 (org-log-done org-log-done) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8327 (org-log-repeat org-log-repeat) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8328 (org-todo-log-states org-todo-log-states) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8329 (this (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8330 (hl-pos (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8331 (head (org-get-todo-sequence-head this)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8332 (ass (assoc head org-todo-kwd-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8333 (interpret (nth 1 ass)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8334 (done-word (nth 3 ass)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8335 (final-done-word (nth 4 ass)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8336 (last-state (or this "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8337 (completion-ignore-case t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8338 (member (member this org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8339 (tail (cdr member)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8340 (state (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8341 ((and org-todo-key-trigger |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8342 (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8343 (and (not arg) org-use-fast-todo-selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8344 (not (eq org-use-fast-todo-selection 'prefix))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8345 ;; Use fast selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8346 (org-fast-todo-selection)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8347 ((and (equal arg '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8348 (or (not org-use-fast-todo-selection) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8349 (not org-todo-key-trigger))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8350 ;; Read a state with completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8351 (completing-read "State: " (mapcar (lambda(x) (list x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8352 org-todo-keywords-1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8353 nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8354 ((eq arg 'right) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8355 (if this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8356 (if tail (car tail) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8357 (car org-todo-keywords-1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8358 ((eq arg 'left) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8359 (if (equal member org-todo-keywords-1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8360 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8361 (if this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8362 (nth (- (length org-todo-keywords-1) (length tail) 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8363 org-todo-keywords-1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8364 (org-last org-todo-keywords-1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8365 ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8366 (setq arg nil))) ; hack to fall back to cycling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8367 (arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8368 ;; user or caller requests a specific state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8369 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8370 ((equal arg "") nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8371 ((eq arg 'none) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8372 ((eq arg 'done) (or done-word (car org-done-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8373 ((eq arg 'nextset) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8374 (or (car (cdr (member head org-todo-heads))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8375 (car org-todo-heads))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8376 ((eq arg 'previousset) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8377 (let ((org-todo-heads (reverse org-todo-heads))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8378 (or (car (cdr (member head org-todo-heads))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8379 (car org-todo-heads)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8380 ((car (member arg org-todo-keywords-1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8381 ((nth (1- (prefix-numeric-value arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8382 org-todo-keywords-1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8383 ((null member) (or head (car org-todo-keywords-1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8384 ((equal this final-done-word) nil) ;; -> make empty |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8385 ((null tail) nil) ;; -> first entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8386 ((eq interpret 'sequence) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8387 (car tail)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8388 ((memq interpret '(type priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8389 (if (eq this-command last-command) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8390 (car tail) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8391 (if (> (length tail) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8392 (or done-word (car org-done-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8393 nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8394 (t nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8395 (next (if state (concat " " state " ") " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8396 (change-plist (list :type 'todo-state-change :from this :to state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8397 :position startpos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8398 dolog now-done-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8399 (when org-blocker-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8400 (unless (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8401 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8402 (run-hook-with-args-until-failure |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8403 'org-blocker-hook change-plist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8404 (if (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8405 (error "TODO state change from %s to %s blocked" this state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8406 ;; fail silently |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8407 (message "TODO state change from %s to %s blocked" this state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8408 (throw 'exit nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8409 (store-match-data match-data) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8410 (replace-match next t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8411 (unless (pos-visible-in-window-p hl-pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8412 (message "TODO state changed to %s" (org-trim next))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8413 (unless head |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8414 (setq head (org-get-todo-sequence-head state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8415 ass (assoc head org-todo-kwd-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8416 interpret (nth 1 ass) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8417 done-word (nth 3 ass) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8418 final-done-word (nth 4 ass))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8419 (when (memq arg '(nextset previousset)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8420 (message "Keyword-Set %d/%d: %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8421 (- (length org-todo-sets) -1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8422 (length (memq (assoc state org-todo-sets) org-todo-sets))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8423 (length org-todo-sets) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8424 (mapconcat 'identity (assoc state org-todo-sets) " "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8425 (setq org-last-todo-state-is-todo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8426 (not (member state org-done-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8427 (setq now-done-p (and (member state org-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8428 (not (member this org-done-keywords)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8429 (and logging (org-local-logging logging)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8430 (when (and (or org-todo-log-states org-log-done) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8431 (not (memq arg '(nextset previousset)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8432 ;; we need to look at recording a time and note |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8433 (setq dolog (or (nth 1 (assoc state org-todo-log-states)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8434 (nth 2 (assoc this org-todo-log-states)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8435 (when (and state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8436 (member state org-not-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8437 (not (member this org-not-done-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8438 ;; This is now a todo state and was not one before |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8439 ;; If there was a CLOSED time stamp, get rid of it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8440 (org-add-planning-info nil nil 'closed)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8441 (when (and now-done-p org-log-done) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8442 ;; It is now done, and it was not done before |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8443 (org-add-planning-info 'closed (org-current-time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8444 (if (and (not dolog) (eq 'note org-log-done)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8445 (org-add-log-setup 'done state 'findpos 'note))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8446 (when (and state dolog) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8447 ;; This is a non-nil state, and we need to log it |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8448 (org-add-log-setup 'state state 'findpos dolog))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8449 ;; Fixup tag positioning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8450 (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8451 (when org-provide-todo-statistics |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8452 (org-update-parent-todo-statistics)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8453 (run-hooks 'org-after-todo-state-change-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8454 (if (and arg (not (member state org-done-keywords))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8455 (setq head (org-get-todo-sequence-head state))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8456 (put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8457 ;; Do we need to trigger a repeat? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8458 (when now-done-p (org-auto-repeat-maybe state)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8459 ;; Fixup cursor location if close to the keyword |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8460 (if (and (outline-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8461 (not (bolp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8462 (save-excursion (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8463 (looking-at org-todo-line-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8464 (< (point) (+ 2 (or (match-end 2) (match-end 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8465 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8466 (goto-char (or (match-end 2) (match-end 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8467 (just-one-space))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8468 (when org-trigger-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8469 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8470 (run-hook-with-args 'org-trigger-hook change-plist))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8471 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8472 (defun org-update-parent-todo-statistics () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8473 "Update any statistics cookie in the parent of the current headline." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8474 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8475 (let ((box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8476 level (cnt-all 0) (cnt-done 0) is-percent kwd) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8477 (catch 'exit |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8478 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8479 (setq level (org-up-heading-safe)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8480 (unless (and level |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8481 (re-search-forward box-re (point-at-eol) t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8482 (throw 'exit nil)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8483 (setq is-percent (match-end 2)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8484 (save-match-data |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8485 (unless (outline-next-heading) (throw 'exit nil)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8486 (while (looking-at org-todo-line-regexp) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8487 (setq kwd (match-string 2)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8488 (and kwd (setq cnt-all (1+ cnt-all))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8489 (and (member kwd org-done-keywords) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8490 (setq cnt-done (1+ cnt-done))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8491 (condition-case nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8492 (outline-forward-same-level 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8493 (error (end-of-line 1))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8494 (replace-match |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8495 (if is-percent |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8496 (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8497 (format "[%d/%d]" cnt-done cnt-all))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8498 (run-hook-with-args 'org-after-todo-statistics-hook |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8499 cnt-done (- cnt-all cnt-done)))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8500 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8501 (defvar org-after-todo-statistics-hook nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8502 "Hook that is called after a TODO statistics cookie has been updated. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8503 Each function is called with two arguments: the number of not-done entries |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8504 and the number of done entries. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8505 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8506 For example, the following function, when added to this hook, will switch |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8507 an entry to DONE when all children are done, and back to TODO when new |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8508 entries are set to a TODO status. Note that this hook is only called |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8509 when there is a statistics cookie in the headline! |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8510 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8511 (defun org-summary-todo (n-done n-not-done) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8512 \"Switch entry to DONE when all subentries are done, to TODO otherwise.\" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8513 (let (org-log-done org-log-states) ; turn off logging |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8514 (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\")))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8515 ") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8516 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8517 (defun org-local-logging (value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8518 "Get logging settings from a property VALUE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8519 (let* (words w a) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8520 ;; directly set the variables, they are already local. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8521 (setq org-log-done nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8522 org-log-repeat nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8523 org-todo-log-states nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8524 (setq words (org-split-string value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8525 (while (setq w (pop words)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8526 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8527 ((setq a (assoc w org-startup-options)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8528 (and (member (nth 1 a) '(org-log-done org-log-repeat)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8529 (set (nth 1 a) (nth 2 a)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8530 ((setq a (org-extract-log-state-settings w)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8531 (and (member (car a) org-todo-keywords-1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8532 (push a org-todo-log-states))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8533 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8534 (defun org-get-todo-sequence-head (kwd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8535 "Return the head of the TODO sequence to which KWD belongs. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8536 If KWD is not set, check if there is a text property remembering the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8537 right sequence." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8538 (let (p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8539 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8540 ((not kwd) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8541 (or (get-text-property (point-at-bol) 'org-todo-head) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8542 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8543 (setq p (next-single-property-change (point-at-bol) 'org-todo-head |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8544 nil (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8545 (get-text-property p 'org-todo-head)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8546 ((not (member kwd org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8547 (car org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8548 (t (nth 2 (assoc kwd org-todo-kwd-alist)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8549 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8550 (defun org-fast-todo-selection () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8551 "Fast TODO keyword selection with single keys. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8552 Returns the new TODO keyword, or nil if no state change should occur." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8553 (let* ((fulltable org-todo-key-alist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8554 (done-keywords org-done-keywords) ;; needed for the faces. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8555 (maxlen (apply 'max (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8556 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8557 (if (stringp (car x)) (string-width (car x)) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8558 fulltable))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8559 (expert nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8560 (fwidth (+ maxlen 3 1 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8561 (ncol (/ (- (window-width) 4) fwidth)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8562 tg cnt e c tbl |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8563 groups ingroup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8564 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8565 (if expert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8566 (set-buffer (get-buffer-create " *Org todo*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8567 (org-switch-to-buffer-other-window (get-buffer-create " *Org todo*"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8568 (erase-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8569 (org-set-local 'org-done-keywords done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8570 (setq tbl fulltable cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8571 (while (setq e (pop tbl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8572 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8573 ((equal e '(:startgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8574 (push '() groups) (setq ingroup t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8575 (when (not (= cnt 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8576 (setq cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8577 (insert "\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8578 (insert "{ ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8579 ((equal e '(:endgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8580 (setq ingroup nil cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8581 (insert "}\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8582 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8583 (setq tg (car e) c (cdr e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8584 (if ingroup (push tg (car groups))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8585 (setq tg (org-add-props tg nil 'face |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8586 (org-get-todo-face tg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8587 (if (and (= cnt 0) (not ingroup)) (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8588 (insert "[" c "] " tg (make-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8589 (- fwidth 4 (length tg)) ?\ )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8590 (when (= (setq cnt (1+ cnt)) ncol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8591 (insert "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8592 (if ingroup (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8593 (setq cnt 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8594 (insert "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8595 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8596 (if (and (not expert) (fboundp 'fit-window-to-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8597 (fit-window-to-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8598 (message "[a-z..]:Set [SPC]:clear") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8599 (setq c (let ((inhibit-quit t)) (read-char-exclusive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8600 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8601 ((or (= c ?\C-g) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8602 (and (= c ?q) (not (rassoc c fulltable)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8603 (setq quit-flag t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8604 ((= c ?\ ) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8605 ((setq e (rassoc c fulltable) tg (car e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8606 tg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8607 (t (setq quit-flag t)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8608 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8609 (defun org-entry-is-todo-p () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8610 (member (org-get-todo-state) org-not-done-keywords)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8611 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8612 (defun org-entry-is-done-p () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8613 (member (org-get-todo-state) org-done-keywords)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8614 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8615 (defun org-get-todo-state () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8616 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8617 (org-back-to-heading t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8618 (and (looking-at org-todo-line-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8619 (match-end 2) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8620 (match-string 2)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8621 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8622 (defun org-at-date-range-p (&optional inactive-ok) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8623 "Is the cursor inside a date range?" |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8624 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8625 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8626 (catch 'exit |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8627 (let ((pos (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8628 (skip-chars-backward "^[<\r\n") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8629 (skip-chars-backward "<[") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8630 (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8631 (>= (match-end 0) pos) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8632 (throw 'exit t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8633 (skip-chars-backward "^<[\r\n") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8634 (skip-chars-backward "<[") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8635 (and (looking-at (if inactive-ok org-tr-regexp-both org-tr-regexp)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8636 (>= (match-end 0) pos) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8637 (throw 'exit t))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8638 nil))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8639 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8640 (defun org-get-repeat () |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
8641 "Check if there is a deadline/schedule with repeater in this entry." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8642 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8643 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8644 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8645 (if (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8646 org-repeat-re (save-excursion (outline-next-heading) (point)) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8647 (match-string 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8648 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8649 (defvar org-last-changed-timestamp) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8650 (defvar org-last-inserted-timestamp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8651 (defvar org-log-post-message) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8652 (defvar org-log-note-purpose) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8653 (defvar org-log-note-how) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8654 (defun org-auto-repeat-maybe (done-word) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8655 "Check if the current headline contains a repeated deadline/schedule. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8656 If yes, set TODO state back to what it was and change the base date |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8657 of repeating deadline/scheduled time stamps to new date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8658 This function is run automatically after each state change to a DONE state." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8659 ;; last-state is dynamically scoped into this function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8660 (let* ((repeat (org-get-repeat)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8661 (aa (assoc last-state org-todo-kwd-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8662 (interpret (nth 1 aa)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8663 (head (nth 2 aa)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8664 (whata '(("d" . day) ("m" . month) ("y" . year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8665 (msg "Entry repeats: ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8666 (org-log-done nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8667 (org-todo-log-states nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8668 (nshiftmax 10) (nshift 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8669 re type n what ts mb0 time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8670 (when repeat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8671 (if (eq org-log-repeat t) (setq org-log-repeat 'state)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8672 (org-todo (if (eq interpret 'type) last-state head)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8673 (when org-log-repeat |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8674 (if (or (memq 'org-add-log-note (default-value 'post-command-hook)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8675 (memq 'org-add-log-note post-command-hook)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8676 ;; OK, we are already setup for some record |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8677 (if (eq org-log-repeat 'note) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8678 ;; make sure we take a note, not only a time stamp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8679 (setq org-log-note-how 'note)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8680 ;; Set up for taking a record |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8681 (org-add-log-setup 'state (or done-word (car org-done-keywords)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8682 'findpos org-log-repeat))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8683 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8684 (org-add-planning-info nil nil 'closed) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8685 (setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8686 org-deadline-time-regexp "\\)\\|\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8687 org-ts-regexp "\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8688 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8689 re (save-excursion (outline-next-heading) (point)) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8690 (setq type (if (match-end 1) org-scheduled-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8691 (if (match-end 3) org-deadline-string "Plain:")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8692 ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8693 mb0 (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8694 (when (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\)" ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8695 (setq n (string-to-number (match-string 2 ts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8696 what (match-string 3 ts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8697 (if (equal what "w") (setq n (* n 7) what "d")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8698 ;; Preparation, see if we need to modify the start date for the change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8699 (when (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8700 (setq time (save-match-data (org-time-string-to-time ts))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8701 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8702 ((equal (match-string 1 ts) ".") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8703 ;; Shift starting date to today |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8704 (org-timestamp-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8705 (- (time-to-days (current-time)) (time-to-days time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8706 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8707 ((equal (match-string 1 ts) "+") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8708 (while (or (= nshift 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8709 (<= (time-to-days time) (time-to-days (current-time)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8710 (when (= (incf nshift) nshiftmax) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8711 (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8712 (error "Abort"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8713 (org-timestamp-change n (cdr (assoc what whata))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8714 (org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8715 (setq ts (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8716 (setq time (save-match-data (org-time-string-to-time ts)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8717 (org-timestamp-change (- n) (cdr (assoc what whata))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8718 ;; rematch, so that we have everything in place for the real shift |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8719 (org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8720 (setq ts (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8721 (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([dwmy]\\)" ts)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8722 (org-timestamp-change n (cdr (assoc what whata))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8723 (setq msg (concat msg type org-last-changed-timestamp " ")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8724 (setq org-log-post-message msg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8725 (message "%s" msg)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8726 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8727 (defun org-show-todo-tree (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8728 "Make a compact tree which shows all headlines marked with TODO. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8729 The tree will show the lines where the regexp matches, and all higher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8730 headlines above the match. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8731 With a \\[universal-argument] prefix, also show the DONE entries. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8732 With a numeric prefix N, construct a sparse tree for the Nth element |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8733 of `org-todo-keywords-1'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8734 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8735 (let ((case-fold-search nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8736 (kwd-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8737 (cond ((null arg) org-not-done-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8738 ((equal arg '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8739 (let ((kwd (completing-read "Keyword (or KWD1|KWD2|...): " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8740 (mapcar 'list org-todo-keywords-1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8741 (concat "\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8742 (mapconcat 'identity (org-split-string kwd "|") "\\|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8743 "\\)\\>"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8744 ((<= (prefix-numeric-value arg) (length org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8745 (regexp-quote (nth (1- (prefix-numeric-value arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8746 org-todo-keywords-1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8747 (t (error "Invalid prefix argument: %s" arg))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8748 (message "%d TODO entries found" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8749 (org-occur (concat "^" outline-regexp " *" kwd-re ))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8750 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8751 (defun org-deadline (&optional remove time) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8752 "Insert the \"DEADLINE:\" string with a timestamp to make a deadline. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8753 With argument REMOVE, remove any deadline from the item. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8754 When TIME is set, it should be an internal time specification, and the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8755 scheduling will use the corresponding date." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8756 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8757 (if remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8758 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8759 (org-remove-timestamp-with-keyword org-deadline-string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8760 (message "Item no longer has a deadline.")) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8761 (if (org-get-repeat) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8762 (error "Cannot change deadline on task with repeater, please do that by hand") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8763 (org-add-planning-info 'deadline time 'closed) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8764 (message "Deadline on %s" org-last-inserted-timestamp)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8765 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8766 (defun org-schedule (&optional remove time) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8767 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8768 With argument REMOVE, remove any scheduling date from the item. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8769 When TIME is set, it should be an internal time specification, and the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8770 scheduling will use the corresponding date." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8771 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8772 (if remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8773 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8774 (org-remove-timestamp-with-keyword org-scheduled-string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8775 (message "Item is no longer scheduled.")) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8776 (if (org-get-repeat) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8777 (error "Cannot reschedule task with repeater, please do that by hand") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8778 (org-add-planning-info 'scheduled time 'closed) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8779 (message "Scheduled to %s" org-last-inserted-timestamp)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8780 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8781 (defun org-remove-timestamp-with-keyword (keyword) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8782 "Remove all time stamps with KEYWORD in the current entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8783 (let ((re (concat "\\<" (regexp-quote keyword) " +<[^>\n]+>[ \t]*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8784 beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8785 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8786 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8787 (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8788 (org-end-of-subtree t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8789 (while (re-search-backward re beg t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8790 (replace-match "") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8791 (if (and (string-match "\\S-" (buffer-substring (point-at-bol) (point))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8792 (equal (char-before) ?\ )) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8793 (backward-delete-char 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8794 (if (string-match "^[ \t]*$" (buffer-substring |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8795 (point-at-bol) (point-at-eol))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8796 (delete-region (point-at-bol) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8797 (min (point-max) (1+ (point-at-eol)))))))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8798 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8799 (defun org-add-planning-info (what &optional time &rest remove) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8800 "Insert new timestamp with keyword in the line directly after the headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8801 WHAT indicates what kind of time stamp to add. TIME indicated the time to use. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8802 If non is given, the user is prompted for a date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8803 REMOVE indicates what kind of entries to remove. An old WHAT entry will also |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8804 be removed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8805 (interactive) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8806 (let (org-time-was-given org-end-time-was-given ts |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8807 end default-time default-input) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8808 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8809 (when (and (not time) (memq what '(scheduled deadline))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8810 ;; Try to get a default date/time from existing timestamp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8811 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8812 (org-back-to-heading t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8813 (setq end (save-excursion (outline-next-heading) (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8814 (when (re-search-forward (if (eq what 'scheduled) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8815 org-scheduled-time-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8816 org-deadline-time-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8817 end t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8818 (setq ts (match-string 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8819 default-time |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8820 (apply 'encode-time (org-parse-time-string ts)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8821 default-input (and ts (org-get-compact-tod ts)))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8822 (when what |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8823 ;; If necessary, get the time from the user |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8824 (setq time (or time (org-read-date nil 'to-time nil nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8825 default-time default-input)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8826 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8827 (when (and org-insert-labeled-timestamps-at-point |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8828 (member what '(scheduled deadline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8829 (insert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8830 (if (eq what 'scheduled) org-scheduled-string org-deadline-string) " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8831 (org-insert-time-stamp time org-time-was-given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8832 nil nil nil (list org-end-time-was-given)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8833 (setq what nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8834 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8835 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8836 (let (col list elt ts buffer-invisibility-spec) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8837 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8838 (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8839 (goto-char (match-end 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8840 (setq col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8841 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8842 (if (eobp) (insert "\n") (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8843 (if (and (not (looking-at outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8844 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8845 "[^\r\n]*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8846 (not (equal (match-string 1) org-clock-string))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8847 (narrow-to-region (match-beginning 0) (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8848 (insert-before-markers "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8849 (backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8850 (narrow-to-region (point) (point)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8851 (and org-adapt-indentation (org-indent-to-column col))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8852 ;; Check if we have to remove something. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8853 (setq list (cons what remove)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8854 (while list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8855 (setq elt (pop list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8856 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8857 (when (or (and (eq elt 'scheduled) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8858 (re-search-forward org-scheduled-time-regexp nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8859 (and (eq elt 'deadline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8860 (re-search-forward org-deadline-time-regexp nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8861 (and (eq elt 'closed) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8862 (re-search-forward org-closed-time-regexp nil t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8863 (replace-match "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8864 (if (looking-at "--+<[^>]+>") (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8865 (if (looking-at " +") (replace-match "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8866 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8867 (when what |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8868 (insert |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8869 (if (not (or (bolp) (eq (char-before) ?\ ))) " " "") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8870 (cond ((eq what 'scheduled) org-scheduled-string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8871 ((eq what 'deadline) org-deadline-string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8872 ((eq what 'closed) org-closed-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8873 " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8874 (setq ts (org-insert-time-stamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8875 time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8876 (or org-time-was-given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8877 (and (eq what 'closed) org-log-done-with-time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8878 (eq what 'closed) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8879 nil nil (list org-end-time-was-given))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8880 (end-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8881 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8882 (widen) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8883 (if (and (looking-at "[ \t]+\n") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8884 (equal (char-before) ?\n)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
8885 (delete-region (1- (point)) (point-at-eol))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8886 ts))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8887 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8888 (defvar org-log-note-marker (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8889 (defvar org-log-note-purpose nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8890 (defvar org-log-note-state nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8891 (defvar org-log-note-how nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8892 (defvar org-log-note-window-configuration nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8893 (defvar org-log-note-return-to (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8894 (defvar org-log-post-message nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8895 "Message to be displayed after a log note has been stored. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8896 The auto-repeater uses this.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8897 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8898 (defun org-add-note () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8899 "Add a note to the current entry. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8900 This is done in the same way as adding a state change note." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8901 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8902 (org-add-log-setup 'note nil t nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8903 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8904 (defun org-add-log-setup (&optional purpose state findpos how) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8905 "Set up the post command hook to take a note. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8906 If this is about to TODO state change, the new state is expected in STATE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8907 When FINDPOS is non-nil, find the correct position for the note in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8908 the current entry. If not, assume that it can be inserted at point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8909 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8910 (when findpos |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8911 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8912 (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8913 "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8914 "[^\r\n]*\\)?")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8915 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8916 (unless org-log-states-order-reversed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8917 (and (= (char-after) ?\n) (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8918 (org-skip-over-state-notes) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8919 (skip-chars-backward " \t\n\r"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8920 (move-marker org-log-note-marker (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8921 (setq org-log-note-purpose purpose |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8922 org-log-note-state state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8923 org-log-note-how how) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8924 (add-hook 'post-command-hook 'org-add-log-note 'append))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8925 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8926 (defun org-skip-over-state-notes () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8927 "Skip past the list of State notes in an entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8928 (if (looking-at "\n[ \t]*- State") (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8929 (while (looking-at "[ \t]*- State") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8930 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8931 (org-next-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8932 (error (org-end-of-item))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8933 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8934 (defun org-add-log-note (&optional purpose) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8935 "Pop up a window for taking a note, and add this note later at point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8936 (remove-hook 'post-command-hook 'org-add-log-note) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8937 (setq org-log-note-window-configuration (current-window-configuration)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8938 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8939 (move-marker org-log-note-return-to (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8940 (switch-to-buffer (marker-buffer org-log-note-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8941 (goto-char org-log-note-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8942 (org-switch-to-buffer-other-window "*Org Note*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8943 (erase-buffer) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8944 (if (memq org-log-note-how '(time state)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8945 (org-store-log-note) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8946 (let ((org-inhibit-startup t)) (org-mode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8947 (insert (format "# Insert note for %s. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8948 # Finish with C-c C-c, or cancel with C-c C-k.\n\n" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8949 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8950 ((eq org-log-note-purpose 'clock-out) "stopped clock") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8951 ((eq org-log-note-purpose 'done) "closed todo item") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8952 ((eq org-log-note-purpose 'state) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8953 (format "state change to \"%s\"" org-log-note-state)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8954 ((eq org-log-note-purpose 'note) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8955 "this entry") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8956 (t (error "This should not happen"))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8957 (org-set-local 'org-finish-function 'org-store-log-note))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8958 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
8959 (defvar org-note-abort nil) ; dynamically scoped |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8960 (defun org-store-log-note () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8961 "Finish taking a log note, and insert it to where it belongs." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8962 (let ((txt (buffer-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8963 (note (cdr (assq org-log-note-purpose org-log-note-headings))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8964 lines ind) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8965 (kill-buffer (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8966 (while (string-match "\\`#.*\n[ \t\n]*" txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8967 (setq txt (replace-match "" t t txt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8968 (if (string-match "\\s-+\\'" txt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8969 (setq txt (replace-match "" t t txt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8970 (setq lines (org-split-string txt "\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8971 (when (and note (string-match "\\S-" note)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8972 (setq note |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8973 (org-replace-escapes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8974 note |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8975 (list (cons "%u" (user-login-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8976 (cons "%U" user-full-name) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8977 (cons "%t" (format-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8978 (org-time-stamp-format 'long 'inactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8979 (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8980 (cons "%s" (if org-log-note-state |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8981 (concat "\"" org-log-note-state "\"") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8982 ""))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8983 (if lines (setq note (concat note " \\\\"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8984 (push note lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8985 (when (or current-prefix-arg org-note-abort) (setq lines nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8986 (when lines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8987 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8988 (set-buffer (marker-buffer org-log-note-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8989 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8990 (goto-char org-log-note-marker) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8991 (move-marker org-log-note-marker nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8992 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8993 (if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8994 (indent-relative nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8995 (insert "- " (pop lines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8996 (org-indent-line-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8997 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8998 (looking-at "[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8999 (setq ind (concat (match-string 0) " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9000 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9001 (while lines (insert "\n" ind (pop lines))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9002 (set-window-configuration org-log-note-window-configuration) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9003 (with-current-buffer (marker-buffer org-log-note-return-to) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9004 (goto-char org-log-note-return-to)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9005 (move-marker org-log-note-return-to nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9006 (and org-log-post-message (message "%s" org-log-post-message))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9007 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9008 (defun org-sparse-tree (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9009 "Create a sparse tree, prompt for the details. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9010 This command can create sparse trees. You first need to select the type |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9011 of match used to create the tree: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9012 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9013 t Show entries with a specific TODO keyword. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9014 T Show entries selected by a tags match. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9015 p Enter a property name and its value (both with completion on existing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9016 names/values) and show entries with that property. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9017 r Show entries matching a regular expression |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9018 d Show deadlines due within `org-deadline-warning-days'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9019 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9020 (let (ans kwd value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9021 (message "Sparse tree: [/]regexp [t]odo-kwd [T]ag [p]roperty [d]eadlines [b]efore-date") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9022 (setq ans (read-char-exclusive)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9023 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9024 ((equal ans ?d) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9025 (call-interactively 'org-check-deadlines)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9026 ((equal ans ?b) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9027 (call-interactively 'org-check-before-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9028 ((equal ans ?t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9029 (org-show-todo-tree '(4))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9030 ((equal ans ?T) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9031 (call-interactively 'org-tags-sparse-tree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9032 ((member ans '(?p ?P)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9033 (setq kwd (completing-read "Property: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9034 (mapcar 'list (org-buffer-property-keys)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9035 (setq value (completing-read "Value: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9036 (mapcar 'list (org-property-values kwd)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9037 (unless (string-match "\\`{.*}\\'" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9038 (setq value (concat "\"" value "\""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9039 (org-tags-sparse-tree arg (concat kwd "=" value))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9040 ((member ans '(?r ?R ?/)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9041 (call-interactively 'org-occur)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9042 (t (error "No such sparse tree command \"%c\"" ans))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9043 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9044 (defvar org-occur-highlights nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9045 "List of overlays used for occur matches.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9046 (make-variable-buffer-local 'org-occur-highlights) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9047 (defvar org-occur-parameters nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9048 "Parameters of the active org-occur calls. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9049 This is a list, each call to org-occur pushes as cons cell, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9050 containing the regular expression and the callback, onto the list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9051 The list can contain several entries if `org-occur' has been called |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9052 several time with the KEEP-PREVIOUS argument. Otherwise, this list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9053 will only contain one set of parameters. When the highlights are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9054 removed (for example with `C-c C-c', or with the next edit (depending |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9055 on `org-remove-highlights-with-change'), this variable is emptied |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9056 as well.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9057 (make-variable-buffer-local 'org-occur-parameters) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9058 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9059 (defun org-occur (regexp &optional keep-previous callback) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9060 "Make a compact tree which shows all matches of REGEXP. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9061 The tree will show the lines where the regexp matches, and all higher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9062 headlines above the match. It will also show the heading after the match, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9063 to make sure editing the matching entry is easy. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9064 If KEEP-PREVIOUS is non-nil, highlighting and exposing done by a previous |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9065 call to `org-occur' will be kept, to allow stacking of calls to this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9066 command. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9067 If CALLBACK is non-nil, it is a function which is called to confirm |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9068 that the match should indeed be shown." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9069 (interactive "sRegexp: \nP") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9070 (unless keep-previous |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9071 (org-remove-occur-highlights nil nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9072 (push (cons regexp callback) org-occur-parameters) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9073 (let ((cnt 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9074 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9075 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9076 (if (or (not keep-previous) ; do not want to keep |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9077 (not org-occur-highlights)) ; no previous matches |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9078 ;; hide everything |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9079 (org-overview)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9080 (while (re-search-forward regexp nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9081 (when (or (not callback) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9082 (save-match-data (funcall callback))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9083 (setq cnt (1+ cnt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9084 (when org-highlight-sparse-tree-matches |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9085 (org-highlight-new-match (match-beginning 0) (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9086 (org-show-context 'occur-tree)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9087 (when org-remove-highlights-with-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9088 (org-add-hook 'before-change-functions 'org-remove-occur-highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9089 nil 'local)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9090 (unless org-sparse-tree-open-archived-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9091 (org-hide-archived-subtrees (point-min) (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9092 (run-hooks 'org-occur-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9093 (if (interactive-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9094 (message "%d match(es) for regexp %s" cnt regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9095 cnt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9096 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9097 (defun org-show-context (&optional key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9098 "Make sure point and context and visible. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9099 How much context is shown depends upon the variables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9100 `org-show-hierarchy-above', `org-show-following-heading'. and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9101 `org-show-siblings'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9102 (let ((heading-p (org-on-heading-p t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9103 (hierarchy-p (org-get-alist-option org-show-hierarchy-above key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9104 (following-p (org-get-alist-option org-show-following-heading key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9105 (entry-p (org-get-alist-option org-show-entry-below key)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9106 (siblings-p (org-get-alist-option org-show-siblings key))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9107 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9108 ;; Show heading or entry text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9109 (if (and heading-p (not entry-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9110 (org-flag-heading nil) ; only show the heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9111 (and (or entry-p (org-invisible-p) (org-invisible-p2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9112 (org-show-hidden-entry))) ; show entire entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9113 (when following-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9114 ;; Show next sibling, or heading below text |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9115 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9116 (and (if heading-p (org-goto-sibling) (outline-next-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9117 (org-flag-heading nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9118 (when siblings-p (org-show-siblings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9119 (when hierarchy-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9120 ;; show all higher headings, possibly with siblings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9121 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9122 (while (and (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9123 (progn (org-up-heading-all 1) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9124 (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9125 (not (bobp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9126 (org-flag-heading nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9127 (when siblings-p (org-show-siblings)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9128 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9129 (defun org-reveal (&optional siblings) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9130 "Show current entry, hierarchy above it, and the following headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9131 This can be used to show a consistent set of context around locations |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9132 exposed with `org-show-hierarchy-above' or `org-show-following-heading' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9133 not t for the search context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9134 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9135 With optional argument SIBLINGS, on each level of the hierarchy all |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9136 siblings are shown. This repairs the tree structure to what it would |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9137 look like when opened with hierarchical calls to `org-cycle'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9138 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9139 (let ((org-show-hierarchy-above t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9140 (org-show-following-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9141 (org-show-siblings (if siblings t org-show-siblings))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9142 (org-show-context nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9143 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9144 (defun org-highlight-new-match (beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9145 "Highlight from BEG to END and mark the highlight is an occur headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9146 (let ((ov (org-make-overlay beg end))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9147 (org-overlay-put ov 'face 'secondary-selection) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9148 (push ov org-occur-highlights))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9149 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9150 (defun org-remove-occur-highlights (&optional beg end noremove) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9151 "Remove the occur highlights from the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9152 BEG and END are ignored. If NOREMOVE is nil, remove this function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9153 from the `before-change-functions' in the current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9154 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9155 (unless org-inhibit-highlight-removal |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9156 (mapc 'org-delete-overlay org-occur-highlights) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9157 (setq org-occur-highlights nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9158 (setq org-occur-parameters nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9159 (unless noremove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9160 (remove-hook 'before-change-functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9161 'org-remove-occur-highlights 'local)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9162 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9163 ;;;; Priorities |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9164 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9165 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\] ?\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9166 "Regular expression matching the priority indicator.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9167 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9168 (defvar org-remove-priority-next-time nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9169 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9170 (defun org-priority-up () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9171 "Increase the priority of the current item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9172 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9173 (org-priority 'up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9174 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9175 (defun org-priority-down () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9176 "Decrease the priority of the current item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9177 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9178 (org-priority 'down)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9179 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9180 (defun org-priority (&optional action) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9181 "Change the priority of an item by ARG. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9182 ACTION can be `set', `up', `down', or a character." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9183 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9184 (setq action (or action 'set)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9185 (let (current new news have remove) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9186 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9187 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9188 (if (looking-at org-priority-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9189 (setq current (string-to-char (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9190 have t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9191 (setq current org-default-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9192 (cond |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9193 ((or (eq action 'set) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9194 (if (featurep 'xemacs) (characterp action) (integerp action))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9195 (if (not (eq action 'set)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9196 (setq new action) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9197 (message "Priority %c-%c, SPC to remove: " |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9198 org-highest-priority org-lowest-priority) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9199 (setq new (read-char-exclusive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9200 (if (and (= (upcase org-highest-priority) org-highest-priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9201 (= (upcase org-lowest-priority) org-lowest-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9202 (setq new (upcase new))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9203 (cond ((equal new ?\ ) (setq remove t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9204 ((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9205 (error "Priority must be between `%c' and `%c'" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9206 org-highest-priority org-lowest-priority)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9207 ((eq action 'up) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9208 (if (and (not have) (eq last-command this-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9209 (setq new org-lowest-priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9210 (setq new (if (and org-priority-start-cycle-with-default (not have)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9211 org-default-priority (1- current))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9212 ((eq action 'down) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9213 (if (and (not have) (eq last-command this-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9214 (setq new org-highest-priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9215 (setq new (if (and org-priority-start-cycle-with-default (not have)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9216 org-default-priority (1+ current))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9217 (t (error "Invalid action"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9218 (if (or (< (upcase new) org-highest-priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9219 (> (upcase new) org-lowest-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9220 (setq remove t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9221 (setq news (format "%c" new)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9222 (if have |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9223 (if remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9224 (replace-match "" t t nil 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9225 (replace-match news t t nil 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9226 (if remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9227 (error "No priority cookie found in line") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9228 (looking-at org-todo-line-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9229 (if (match-end 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9230 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9231 (goto-char (match-end 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9232 (insert " [#" news "]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9233 (goto-char (match-beginning 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9234 (insert "[#" news "] "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9235 (org-preserve-lc (org-set-tags nil 'align)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9236 (if remove |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9237 (message "Priority removed") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9238 (message "Priority of current item set to %s" news)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9239 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9240 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9241 (defun org-get-priority (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9242 "Find priority cookie and return priority." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9243 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9244 (if (not (string-match org-priority-regexp s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9245 (* 1000 (- org-lowest-priority org-default-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9246 (* 1000 (- org-lowest-priority |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9247 (string-to-char (match-string 2 s))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9248 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9249 ;;;; Tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9250 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9251 (defvar org-agenda-archives-mode) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9252 (defun org-scan-tags (action matcher &optional todo-only) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9253 "Scan headline tags with inheritance and produce output ACTION. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9254 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9255 ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9256 or `agenda' to produce an entry list for an agenda view. It can also be |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9257 a Lisp form or a function that should be called at each matched headline, in |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9258 this case the return value is a list of all return values from these calls. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9259 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9260 MATCHER is a Lisp form to be evaluated, testing if a given set of tags |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9261 qualifies a headline for inclusion. When TODO-ONLY is non-nil, |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9262 only lines with a TODO keyword are included in the output." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9263 (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9264 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9265 (org-re |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9266 "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$"))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9267 (props (list 'face 'default |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9268 'done-face 'org-done |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9269 'undone-face 'default |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9270 'mouse-face 'highlight |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9271 'org-not-done-regexp org-not-done-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9272 'org-todo-regexp org-todo-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9273 'keymap org-agenda-keymap |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9274 'help-echo |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9275 (format "mouse-2 or RET jump to org file %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9276 (abbreviate-file-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9277 (or (buffer-file-name (buffer-base-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9278 (buffer-name (buffer-base-buffer))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9279 (case-fold-search nil) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9280 lspos tags tags-list |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9281 (tags-alist (list (cons 0 (mapcar 'downcase org-file-tags)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9282 (llast 0) rtn rtn1 level category i txt |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9283 todo marker entry priority) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9284 (when (not (member action '(agenda sparse-tree))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9285 (setq action (list 'lambda nil action))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9286 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9287 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9288 (when (eq action 'sparse-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9289 (org-overview) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9290 (org-remove-occur-highlights)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9291 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9292 (catch :skip |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9293 (setq todo (if (match-end 1) (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9294 tags (if (match-end 4) (match-string 4))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9295 (goto-char (setq lspos (1+ (match-beginning 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9296 (setq level (org-reduced-level (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9297 category (org-get-category)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9298 (setq i llast llast level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9299 ;; remove tag lists from same and sublevels |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9300 (while (>= i level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9301 (when (setq entry (assoc i tags-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9302 (setq tags-alist (delete entry tags-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9303 (setq i (1- i))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9304 ;; add the next tags |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9305 (when tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9306 (setq tags (mapcar 'downcase (org-split-string tags ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9307 tags-alist |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9308 (cons (cons level tags) tags-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9309 ;; compile tags for current headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9310 (setq tags-list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9311 (if org-use-tag-inheritance |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9312 (apply 'append (mapcar 'cdr tags-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9313 tags)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9314 (when (and tags org-use-tag-inheritance |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9315 (not (eq t org-use-tag-inheritance))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9316 ;; selective inheritance, remove uninherited ones |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9317 (setcdr (car tags-alist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9318 (org-remove-uniherited-tags (cdar tags-alist)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9319 (when (and (or (not todo-only) (member todo org-not-done-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9320 (eval matcher) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9321 (or |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9322 (not (member org-archive-tag tags-list)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9323 ;; we have an archive tag, should we use this anyway? |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9324 (or (not org-agenda-skip-archived-trees) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9325 (and (eq action 'agenda) org-agenda-archives-mode)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9326 (unless (eq action 'sparse-tree) (org-agenda-skip)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9327 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9328 ;; select this headline |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9329 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9330 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9331 ((eq action 'sparse-tree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9332 (and org-highlight-sparse-tree-matches |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9333 (org-get-heading) (match-end 0) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9334 (org-highlight-new-match |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9335 (match-beginning 0) (match-beginning 1))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9336 (org-show-context 'tags-tree)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9337 ((eq action 'agenda) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9338 (setq txt (org-format-agenda-item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9339 "" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9340 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9341 (if org-tags-match-list-sublevels |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9342 (make-string (1- level) ?.) "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9343 (org-get-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9344 category tags-list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9345 priority (org-get-priority txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9346 (goto-char lspos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9347 (setq marker (org-agenda-new-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9348 (org-add-props txt props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9349 'org-marker marker 'org-hd-marker marker 'org-category category |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9350 'priority priority 'type "tagsmatch") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9351 (push txt rtn)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9352 ((functionp action) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9353 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9354 (setq rtn1 (funcall action)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9355 (push rtn1 rtn)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9356 (goto-char (point-at-eol))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9357 (t (error "Invalid action"))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9358 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9359 ;; if we are to skip sublevels, jump to end of subtree |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9360 (or org-tags-match-list-sublevels (org-end-of-subtree t)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9361 (when (and (eq action 'sparse-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9362 (not org-sparse-tree-open-archived-trees)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9363 (org-hide-archived-subtrees (point-min) (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9364 (nreverse rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9365 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9366 (defun org-remove-uniherited-tags (tags) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9367 "Remove all tags that are not inherited from the list TAGS." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9368 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9369 ((eq org-use-tag-inheritance t) tags) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9370 ((not org-use-tag-inheritance) nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9371 ((stringp org-use-tag-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9372 (delq nil (mapcar |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9373 (lambda (x) (if (string-match org-use-tag-inheritance x) x nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9374 tags))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9375 ((listp org-use-tag-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9376 (org-delete-all org-use-tag-inheritance tags)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9377 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9378 (defvar todo-only) ;; dynamically scoped |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9379 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9380 (defun org-tags-sparse-tree (&optional todo-only match) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9381 "Create a sparse tree according to tags string MATCH. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9382 MATCH can contain positive and negative selection of tags, like |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9383 \"+WORK+URGENT-WITHBOSS\". |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9384 If optional argument TODO_ONLY is non-nil, only select lines that are |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9385 also TODO lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9386 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9387 (org-prepare-agenda-buffers (list (current-buffer))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9388 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)) todo-only)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9389 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9390 (defvar org-cached-props nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9391 (defun org-cached-entry-get (pom property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9392 (if (or (eq t org-use-property-inheritance) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9393 (and (stringp org-use-property-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9394 (string-match org-use-property-inheritance property)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9395 (and (listp org-use-property-inheritance) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9396 (member property org-use-property-inheritance))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9397 ;; Caching is not possible, check it directly |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9398 (org-entry-get pom property 'inherit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9399 ;; Get all properties, so that we can do complicated checks easily |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9400 (cdr (assoc property (or org-cached-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9401 (setq org-cached-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9402 (org-entry-properties pom))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9403 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9404 (defun org-global-tags-completion-table (&optional files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9405 "Return the list of all tags in all agenda buffer/files." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9406 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9407 (org-uniquify |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9408 (delq nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9409 (apply 'append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9410 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9411 (lambda (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9412 (set-buffer (find-file-noselect file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9413 (append (org-get-buffer-tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9414 (mapcar (lambda (x) (if (stringp (car-safe x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9415 (list (car-safe x)) nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9416 org-tag-alist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9417 (if (and files (car files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9418 files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9419 (org-agenda-files)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9420 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9421 (defun org-make-tags-matcher (match) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9422 "Create the TAGS//TODO matcher form for the selection string MATCH." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9423 ;; todo-only is scoped dynamically into this function, and the function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9424 ;; may change it it the matcher asksk for it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9425 (unless match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9426 ;; Get a new match request, with completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9427 (let ((org-last-tags-completion-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9428 (org-global-tags-completion-table))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9429 (setq match (completing-read |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9430 "Match: " 'org-tags-completion-function nil nil nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9431 'org-tags-history)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9432 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9433 ;; Parse the string and create a lisp form |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9434 (let ((match0 match) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9435 (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\([[:alnum:]_]+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@]+\\)")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9436 minus tag mm |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9437 tagsmatch todomatch tagsmatcher todomatcher kwd matcher |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9438 orterms term orlist re-p str-p level-p level-op |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9439 prop-p pn pv po cat-p gv) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9440 (if (string-match "/+" match) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9441 ;; match contains also a todo-matching request |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9442 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9443 (setq tagsmatch (substring match 0 (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9444 todomatch (substring match (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9445 (if (string-match "^!" todomatch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9446 (setq todo-only t todomatch (substring todomatch 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9447 (if (string-match "^\\s-*$" todomatch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9448 (setq todomatch nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9449 ;; only matching tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9450 (setq tagsmatch match todomatch nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9451 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9452 ;; Make the tags matcher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9453 (if (or (not tagsmatch) (not (string-match "\\S-" tagsmatch))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9454 (setq tagsmatcher t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9455 (setq orterms (org-split-string tagsmatch "|") orlist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9456 (while (setq term (pop orterms)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9457 (while (and (equal (substring term -1) "\\") orterms) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9458 (setq term (concat term "|" (pop orterms)))) ; repair bad split |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9459 (while (string-match re term) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9460 (setq minus (and (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9461 (equal (match-string 1 term) "-")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9462 tag (match-string 2 term) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9463 re-p (equal (string-to-char tag) ?{) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9464 level-p (match-end 4) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9465 prop-p (match-end 5) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9466 mm (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9467 (re-p `(org-match-any-p ,(substring tag 1 -1) tags-list)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9468 (level-p |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9469 (setq level-op (org-op-to-function (match-string 3 term))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9470 `(,level-op level ,(string-to-number |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9471 (match-string 4 term)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9472 (prop-p |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9473 (setq pn (match-string 5 term) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9474 po (match-string 6 term) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9475 pv (match-string 7 term) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9476 cat-p (equal pn "CATEGORY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9477 re-p (equal (string-to-char pv) ?{) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9478 str-p (equal (string-to-char pv) ?\") |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9479 time-p (save-match-data (string-match "^\"<.*>\"$" pv)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9480 pv (if (or re-p str-p) (substring pv 1 -1) pv)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9481 (if time-p (setq pv (org-matcher-time pv))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9482 (setq po (org-op-to-function po (if time-p 'time str-p))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9483 (if (equal pn "CATEGORY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9484 (setq gv '(get-text-property (point) 'org-category)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9485 (setq gv `(org-cached-entry-get nil ,pn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9486 (if re-p |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9487 (if (eq po 'org<>) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9488 `(not (string-match ,pv (or ,gv ""))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9489 `(string-match ,pv (or ,gv ""))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9490 (if str-p |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9491 `(,po (or ,gv "") ,pv) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9492 `(,po (string-to-number (or ,gv "")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9493 ,(string-to-number pv) )))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9494 (t `(member ,(downcase tag) tags-list))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9495 mm (if minus (list 'not mm) mm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9496 term (substring term (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9497 (push mm tagsmatcher)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9498 (push (if (> (length tagsmatcher) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9499 (cons 'and tagsmatcher) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9500 (car tagsmatcher)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9501 orlist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9502 (setq tagsmatcher nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9503 (setq tagsmatcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9504 (setq tagsmatcher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9505 (list 'progn '(setq org-cached-props nil) tagsmatcher))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9506 ;; Make the todo matcher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9507 (if (or (not todomatch) (not (string-match "\\S-" todomatch))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9508 (setq todomatcher t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9509 (setq orterms (org-split-string todomatch "|") orlist nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9510 (while (setq term (pop orterms)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9511 (while (string-match re term) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9512 (setq minus (and (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9513 (equal (match-string 1 term) "-")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9514 kwd (match-string 2 term) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9515 re-p (equal (string-to-char kwd) ?{) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9516 term (substring term (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9517 mm (if re-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9518 `(string-match ,(substring kwd 1 -1) todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9519 (list 'equal 'todo kwd)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9520 mm (if minus (list 'not mm) mm)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9521 (push mm todomatcher)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9522 (push (if (> (length todomatcher) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9523 (cons 'and todomatcher) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9524 (car todomatcher)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9525 orlist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9526 (setq todomatcher nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9527 (setq todomatcher (if (> (length orlist) 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9528 (cons 'or orlist) (car orlist)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9529 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9530 ;; Return the string and lisp forms of the matcher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9531 (setq matcher (if todomatcher |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9532 (list 'and tagsmatcher todomatcher) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9533 tagsmatcher)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9534 (cons match0 matcher))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9535 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9536 (defun org-op-to-function (op &optional stringp) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9537 "Turn an operator into the appropriate function." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9538 (setq op |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9539 (cond |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9540 ((equal op "<" ) '(< string< org-time<)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9541 ((equal op ">" ) '(> org-string> org-time>)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9542 ((member op '("<=" "=<")) '(<= org-string<= org-time<=)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9543 ((member op '(">=" "=>")) '(>= org-string>= org-time>=)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9544 ((member op '("=" "==")) '(= string= org-time=)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9545 ((member op '("<>" "!=")) '(org<> org-string<> org-time<>)))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9546 (nth (if (eq stringp 'time) 2 (if stringp 1 0)) op)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9547 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9548 (defun org<> (a b) (not (= a b))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9549 (defun org-string<= (a b) (or (string= a b) (string< a b))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9550 (defun org-string>= (a b) (not (string< a b))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9551 (defun org-string> (a b) (and (not (string= a b)) (not (string< a b)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9552 (defun org-string<> (a b) (not (string= a b))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9553 (defun org-time= (a b) (= (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9554 (defun org-time< (a b) (< (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9555 (defun org-time<= (a b) (<= (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9556 (defun org-time> (a b) (> (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9557 (defun org-time>= (a b) (>= (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9558 (defun org-time<> (a b) (org<> (org-2ft a) (org-2ft b))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9559 (defun org-2ft (s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9560 "Convert S to a floating point time. |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9561 If S is already a number, just return it. If it is a string, parse |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9562 it as a time string and apply `float-time' to it. f S is nil, just return 0." |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9563 (cond |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9564 ((numberp s) s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9565 ((stringp s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9566 (condition-case nil |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9567 (float-time (apply 'encode-time (org-parse-time-string s))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9568 (error 0.))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9569 (t 0.))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9570 |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9571 (defun org-matcher-time (s) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9572 (cond |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9573 ((equal s "<now>") (float-time)) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9574 ((equal s "<today>") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9575 (float-time (append '(0 0 0) (nthcdr 3 (decode-time))))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
9576 (t (org-2ft s)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9577 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9578 (defun org-match-any-p (re list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9579 "Does re match any element of list?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9580 (setq list (mapcar (lambda (x) (string-match re x)) list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9581 (delq nil list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9582 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9583 (defvar org-add-colon-after-tag-completion nil) ;; dynamically skoped param |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9584 (defvar org-tags-overlay (org-make-overlay 1 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9585 (org-detach-overlay org-tags-overlay) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9586 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9587 (defun org-get-tags-at (&optional pos) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9588 "Get a list of all headline tags applicable at POS. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9589 POS defaults to point. If tags are inherited, the list contains |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9590 the targets in the same sequence as the headlines appear, i.e. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9591 the tags of the current headline come last." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9592 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9593 (let (tags ltags lastpos parent) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9594 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9595 (save-restriction |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9596 (widen) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9597 (goto-char (or pos (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9598 (save-match-data |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9599 (condition-case nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9600 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9601 (org-back-to-heading t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9602 (while (not (equal lastpos (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9603 (setq lastpos (point)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9604 (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9605 (setq ltags (org-split-string |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9606 (org-match-string-no-properties 1) ":")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9607 (setq tags (append (org-remove-uniherited-tags ltags) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9608 tags))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9609 (or org-use-tag-inheritance (error "")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9610 (org-up-heading-all 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9611 (setq parent t))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9612 (error nil)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9613 (append (org-remove-uniherited-tags org-file-tags) tags)))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9614 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9615 (defun org-toggle-tag (tag &optional onoff) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9616 "Toggle the tag TAG for the current line. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9617 If ONOFF is `on' or `off', don't toggle but set to this state." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9618 (unless (org-on-heading-p t) (error "Not on headling")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9619 (let (res current) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9620 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9621 (beginning-of-line) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9622 (if (re-search-forward (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t]*$") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9623 (point-at-eol) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9624 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9625 (setq current (match-string 1)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9626 (replace-match "")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9627 (setq current "")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9628 (setq current (nreverse (org-split-string current ":"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9629 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9630 ((eq onoff 'on) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9631 (setq res t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9632 (or (member tag current) (push tag current))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9633 ((eq onoff 'off) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9634 (or (not (member tag current)) (setq current (delete tag current)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9635 (t (if (member tag current) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9636 (setq current (delete tag current)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9637 (setq res t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9638 (push tag current)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9639 (end-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9640 (if current |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9641 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9642 (insert " :" (mapconcat 'identity (nreverse current) ":") ":") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9643 (org-set-tags nil t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9644 (delete-horizontal-space)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9645 (run-hooks 'org-after-tags-change-hook)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9646 res)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9647 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9648 (defun org-align-tags-here (to-col) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9649 ;; Assumes that this is a headline |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9650 (let ((pos (point)) (col (current-column)) ncol tags-l p) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9651 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9652 (if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9653 (< pos (match-beginning 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9654 (progn |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9655 (setq tags-l (- (match-end 2) (match-beginning 2))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9656 (goto-char (match-beginning 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9657 (insert " ") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9658 (delete-region (point) (1+ (match-beginning 2))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9659 (setq ncol (max (1+ (current-column)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9660 (1+ col) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9661 (if (> to-col 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9662 to-col |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9663 (- (abs to-col) tags-l)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9664 (setq p (point)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9665 (insert (make-string (- ncol (current-column)) ?\ )) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9666 (setq ncol (current-column)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
9667 (when indent-tabs-mode (tabify p (point-at-eol))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9668 (org-move-to-column (min ncol col) t)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9669 (goto-char pos)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9670 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9671 (defun org-set-tags (&optional arg just-align) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9672 "Set the tags for the current headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9673 With prefix ARG, realign all tags in headings in the current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9674 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9675 (let* ((re (concat "^" outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9676 (current (org-get-tags-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9677 (col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9678 (org-setting-tags t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9679 table current-tags inherited-tags ; computed below when needed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9680 tags p0 c0 c1 rpl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9681 (if arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9682 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9683 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9684 (let ((buffer-invisibility-spec (org-inhibit-invisibility))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9685 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9686 (org-set-tags nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9687 (end-of-line 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9688 (message "All tags realigned to column %d" org-tags-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9689 (if just-align |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9690 (setq tags current) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9691 ;; Get a new set of tags from the user |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9692 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9693 (setq table (or org-tag-alist (org-get-buffer-tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9694 org-last-tags-completion-table table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9695 current-tags (org-split-string current ":") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9696 inherited-tags (nreverse |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9697 (nthcdr (length current-tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9698 (nreverse (org-get-tags-at)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9699 tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9700 (if (or (eq t org-use-fast-tag-selection) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9701 (and org-use-fast-tag-selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9702 (delq nil (mapcar 'cdr table)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9703 (org-fast-tag-selection |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9704 current-tags inherited-tags table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9705 (if org-fast-tag-selection-include-todo org-todo-key-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9706 (let ((org-add-colon-after-tag-completion t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9707 (org-trim |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9708 (org-without-partial-completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9709 (completing-read "Tags: " 'org-tags-completion-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9710 nil nil current 'org-tags-history))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9711 (while (string-match "[-+&]+" tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9712 ;; No boolean logic, just a list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9713 (setq tags (replace-match ":" t t tags)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9714 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9715 (if (string-match "\\`[\t ]*\\'" tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9716 (setq tags "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9717 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9718 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9719 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9720 ;; Insert new tags at the correct column |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9721 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9722 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9723 ((and (equal current "") (equal tags ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9724 ((re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9725 (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9726 (point-at-eol) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9727 (if (equal tags "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9728 (setq rpl "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9729 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9730 (setq c0 (current-column) p0 (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9731 c1 (max (1+ c0) (if (> org-tags-column 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9732 org-tags-column |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9733 (- (- org-tags-column) (length tags)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9734 rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9735 (replace-match rpl t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9736 (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9737 tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9738 (t (error "Tags alignment failed"))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9739 (org-move-to-column col) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9740 (unless just-align |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9741 (run-hooks 'org-after-tags-change-hook))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9742 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9743 (defun org-change-tag-in-region (beg end tag off) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9744 "Add or remove TAG for each entry in the region. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9745 This works in the agenda, and also in an org-mode buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9746 (interactive |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9747 (list (region-beginning) (region-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9748 (let ((org-last-tags-completion-table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9749 (if (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9750 (org-get-buffer-tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9751 (org-global-tags-completion-table)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9752 (completing-read |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9753 "Tag: " 'org-tags-completion-function nil nil nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9754 'org-tags-history)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9755 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9756 (message "[s]et or [r]emove? ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9757 (equal (read-char-exclusive) ?r)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9758 (if (fboundp 'deactivate-mark) (deactivate-mark)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9759 (let ((agendap (equal major-mode 'org-agenda-mode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9760 l1 l2 m buf pos newhead (cnt 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9761 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9762 (setq l2 (1- (org-current-line))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9763 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9764 (setq l1 (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9765 (loop for l from l1 to l2 do |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9766 (goto-line l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9767 (setq m (get-text-property (point) 'org-hd-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9768 (when (or (and (org-mode-p) (org-on-heading-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9769 (and agendap m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9770 (setq buf (if agendap (marker-buffer m) (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9771 pos (if agendap m (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9772 (with-current-buffer buf |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9773 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9774 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9775 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9776 (setq cnt (1+ cnt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9777 (org-toggle-tag tag (if off 'off 'on)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9778 (setq newhead (org-get-heading))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9779 (and agendap (org-agenda-change-all-lines newhead m)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9780 (message "Tag :%s: %s in %d headings" tag (if off "removed" "set") cnt))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9781 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9782 (defun org-tags-completion-function (string predicate &optional flag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9783 (let (s1 s2 rtn (ctable org-last-tags-completion-table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9784 (confirm (lambda (x) (stringp (car x))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9785 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9786 (setq s1 (match-string 1 string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9787 s2 (match-string 2 string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9788 (setq s1 "" s2 string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9789 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9790 ((eq flag nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9791 ;; try completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9792 (setq rtn (try-completion s2 ctable confirm)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9793 (if (stringp rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9794 (setq rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9795 (concat s1 s2 (substring rtn (length s2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9796 (if (and org-add-colon-after-tag-completion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9797 (assoc rtn ctable)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9798 ":" "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9799 rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9800 ((eq flag t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9801 ;; all-completions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9802 (all-completions s2 ctable confirm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9803 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9804 ((eq flag 'lambda) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9805 ;; exact match? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9806 (assoc s2 ctable))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9807 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9808 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9809 (defun org-fast-tag-insert (kwd tags face &optional end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9810 "Insert KDW, and the TAGS, the latter with face FACE. Also inser END." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9811 (insert (format "%-12s" (concat kwd ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9812 (org-add-props (mapconcat 'identity tags " ") nil 'face face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9813 (or end ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9814 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9815 (defun org-fast-tag-show-exit (flag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9816 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9817 (goto-line 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9818 (if (re-search-forward "[ \t]+Next change exits" (point-at-eol) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9819 (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9820 (when flag |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9821 (end-of-line 1) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
9822 (org-move-to-column (- (window-width) 19) t) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9823 (insert (org-add-props " Next change exits" nil 'face 'org-warning))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9824 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9825 (defun org-set-current-tags-overlay (current prefix) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9826 (let ((s (concat ":" (mapconcat 'identity current ":") ":"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9827 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9828 (org-overlay-display org-tags-overlay (concat prefix s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9829 'secondary-selection) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9830 (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9831 (org-overlay-display org-tags-overlay (concat prefix s))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9832 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9833 (defun org-fast-tag-selection (current inherited table &optional todo-table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9834 "Fast tag selection with single keys. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9835 CURRENT is the current list of tags in the headline, INHERITED is the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9836 list of inherited tags, and TABLE is an alist of tags and corresponding keys, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9837 possibly with grouping information. TODO-TABLE is a similar table with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9838 TODO keywords, should these have keys assigned to them. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9839 If the keys are nil, a-z are automatically assigned. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9840 Returns the new tags string, or nil to not change the current settings." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9841 (let* ((fulltable (append table todo-table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9842 (maxlen (apply 'max (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9843 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9844 (if (stringp (car x)) (string-width (car x)) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9845 fulltable))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9846 (buf (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9847 (expert (eq org-fast-tag-selection-single-key 'expert)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9848 (buffer-tags nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9849 (fwidth (+ maxlen 3 1 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9850 (ncol (/ (- (window-width) 4) fwidth)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9851 (i-face 'org-done) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9852 (c-face 'org-todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9853 tg cnt e c char c1 c2 ntable tbl rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9854 ov-start ov-end ov-prefix |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9855 (exit-after-next org-fast-tag-selection-single-key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9856 (done-keywords org-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9857 groups ingroup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9858 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9859 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9860 (if (looking-at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9861 (org-re ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9862 (setq ov-start (match-beginning 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9863 ov-end (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9864 ov-prefix "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9865 (setq ov-start (1- (point-at-eol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9866 ov-end (1+ ov-start)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9867 (skip-chars-forward "^\n\r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9868 (setq ov-prefix |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9869 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9870 (buffer-substring (1- (point)) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9871 (if (> (current-column) org-tags-column) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9872 " " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9873 (make-string (- org-tags-column (current-column)) ?\ )))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9874 (org-move-overlay org-tags-overlay ov-start ov-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9875 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9876 (if expert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9877 (set-buffer (get-buffer-create " *Org tags*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9878 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9879 (split-window-vertically) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9880 (org-switch-to-buffer-other-window (get-buffer-create " *Org tags*"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9881 (erase-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9882 (org-set-local 'org-done-keywords done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9883 (org-fast-tag-insert "Inherited" inherited i-face "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9884 (org-fast-tag-insert "Current" current c-face "\n\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9885 (org-fast-tag-show-exit exit-after-next) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9886 (org-set-current-tags-overlay current ov-prefix) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9887 (setq tbl fulltable char ?a cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9888 (while (setq e (pop tbl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9889 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9890 ((equal e '(:startgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9891 (push '() groups) (setq ingroup t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9892 (when (not (= cnt 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9893 (setq cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9894 (insert "\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9895 (insert "{ ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9896 ((equal e '(:endgroup)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9897 (setq ingroup nil cnt 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9898 (insert "}\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9899 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9900 (setq tg (car e) c2 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9901 (if (cdr e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9902 (setq c (cdr e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9903 ;; automatically assign a character. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9904 (setq c1 (string-to-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9905 (downcase (substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9906 tg (if (= (string-to-char tg) ?@) 1 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9907 (if (or (rassoc c1 ntable) (rassoc c1 table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9908 (while (or (rassoc char ntable) (rassoc char table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9909 (setq char (1+ char))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9910 (setq c2 c1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9911 (setq c (or c2 char))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9912 (if ingroup (push tg (car groups))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9913 (setq tg (org-add-props tg nil 'face |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9914 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9915 ((not (assoc tg table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9916 (org-get-todo-face tg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9917 ((member tg current) c-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9918 ((member tg inherited) i-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9919 (t nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9920 (if (and (= cnt 0) (not ingroup)) (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9921 (insert "[" c "] " tg (make-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9922 (- fwidth 4 (length tg)) ?\ )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9923 (push (cons tg c) ntable) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9924 (when (= (setq cnt (1+ cnt)) ncol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9925 (insert "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9926 (if ingroup (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9927 (setq cnt 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9928 (setq ntable (nreverse ntable)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9929 (insert "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9930 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9931 (if (and (not expert) (fboundp 'fit-window-to-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9932 (fit-window-to-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9933 (setq rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9934 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9935 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9936 (message "[a-z..]:Toggle [SPC]:clear [RET]:accept [TAB]:free%s%s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9937 (if groups " [!] no groups" " [!]groups") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9938 (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9939 (setq c (let ((inhibit-quit t)) (read-char-exclusive))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9940 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9941 ((= c ?\r) (throw 'exit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9942 ((= c ?!) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9943 (setq groups (not groups)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9944 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9945 (while (re-search-forward "[{}]" nil t) (replace-match " "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9946 ((= c ?\C-c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9947 (if (not expert) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9948 (org-fast-tag-show-exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9949 (setq exit-after-next (not exit-after-next))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9950 (setq expert nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9951 (delete-other-windows) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9952 (split-window-vertically) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9953 (org-switch-to-buffer-other-window " *Org tags*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9954 (and (fboundp 'fit-window-to-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9955 (fit-window-to-buffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9956 ((or (= c ?\C-g) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9957 (and (= c ?q) (not (rassoc c ntable)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9958 (org-detach-overlay org-tags-overlay) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9959 (setq quit-flag t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9960 ((= c ?\ ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9961 (setq current nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9962 (if exit-after-next (setq exit-after-next 'now))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9963 ((= c ?\t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9964 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9965 (setq tg (completing-read |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9966 "Tag: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9967 (or buffer-tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9968 (with-current-buffer buf |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9969 (org-get-buffer-tags))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9970 (quit (setq tg ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9971 (when (string-match "\\S-" tg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9972 (add-to-list 'buffer-tags (list tg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9973 (if (member tg current) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9974 (setq current (delete tg current)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9975 (push tg current))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9976 (if exit-after-next (setq exit-after-next 'now))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9977 ((setq e (rassoc c todo-table) tg (car e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9978 (with-current-buffer buf |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9979 (save-excursion (org-todo tg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9980 (if exit-after-next (setq exit-after-next 'now))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9981 ((setq e (rassoc c ntable) tg (car e)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9982 (if (member tg current) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9983 (setq current (delete tg current)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9984 (loop for g in groups do |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9985 (if (member tg g) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9986 (mapc (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9987 (setq current (delete x current))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9988 g))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9989 (push tg current)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9990 (if exit-after-next (setq exit-after-next 'now)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9991 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9992 ;; Create a sorted list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9993 (setq current |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9994 (sort current |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9995 (lambda (a b) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9996 (assoc b (cdr (memq (assoc a ntable) ntable)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9997 (if (eq exit-after-next 'now) (throw 'exit t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9998 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9999 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10000 (delete-region (point) (point-at-eol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10001 (org-fast-tag-insert "Current" current c-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10002 (org-set-current-tags-overlay current ov-prefix) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10003 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10004 (org-re "\\[.\\] \\([[:alnum:]_@]+\\)") nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10005 (setq tg (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10006 (add-text-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10007 (match-beginning 1) (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10008 (list 'face |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10009 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10010 ((member tg current) c-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10011 ((member tg inherited) i-face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10012 (t (get-text-property (match-beginning 1) 'face)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10013 (goto-char (point-min))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10014 (org-detach-overlay org-tags-overlay) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10015 (if rtn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10016 (mapconcat 'identity current ":") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10017 nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10018 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10019 (defun org-get-tags-string () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10020 "Get the TAGS string in the current headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10021 (unless (org-on-heading-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10022 (error "Not on a heading")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10023 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10024 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10025 (if (looking-at (org-re ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10026 (org-match-string-no-properties 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10027 ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10028 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10029 (defun org-get-tags () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10030 "Get the list of tags specified in the current headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10031 (org-split-string (org-get-tags-string) ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10032 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10033 (defun org-get-buffer-tags () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10034 "Get a table of all tags used in the buffer, for completion." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10035 (let (tags) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10036 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10037 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10038 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10039 (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10040 (when (equal (char-after (point-at-bol 0)) ?*) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10041 (mapc (lambda (x) (add-to-list 'tags x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10042 (org-split-string (org-match-string-no-properties 1) ":"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10043 (mapcar 'list tags))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10044 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10045 ;;;; The mapping API |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10046 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10047 ;;;###autoload |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10048 (defun org-map-entries (func &optional match scope &rest skip) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10049 "Call FUNC at each headline selected by MATCH in SCOPE. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10050 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10051 FUNC is a function or a lisp form. The function will be called without |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10052 arguments, with the cursor positioned at the beginning of the headline. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10053 The return values of all calls to the function will be collected and |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10054 returned as a list. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10055 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10056 MATCH is a tags/property/todo match as it is used in the agenda tags view. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10057 Only headlines that are matched by this query will be considered during |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10058 the iteration. When MATCH is nil or t, all headlines will be |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10059 visited by the iteration. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10060 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10061 SCOPE determines the scope of this command. It can be any of: |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10062 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10063 nil The current buffer, respecting the restriction if any |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10064 tree The subtree started with the entry at point |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10065 file The current buffer, without restriction |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10066 file-with-archives |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10067 The current buffer, and any archives associated with it |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10068 agenda All agenda files |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10069 agenda-with-archives |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10070 All agenda files with any archive files associated with them |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10071 \(file1 file2 ...) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10072 If this is a list, all files in the list will be scanned |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10073 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10074 The remaining args are treated as settings for the skipping facilities of |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10075 the scanner. The following items can be given here: |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10076 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10077 archive skip trees with the archive tag. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10078 comment skip trees with the COMMENT keyword |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10079 function or Emacs Lisp form: |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10080 will be used as value for `org-agenda-skip-function', so whenever |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10081 the the function returns t, FUNC will not be called for that |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10082 entry and search will continue from the point where the |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10083 function leaves it." |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10084 (let* ((org-agenda-archives-mode nil) ; just to make sure |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10085 (org-agenda-skip-archived-trees (memq 'archive skip)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10086 (org-agenda-skip-comment-trees (memq 'comment skip)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10087 (org-agenda-skip-function |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10088 (car (org-delete-all '(comment archive) skip))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10089 (org-tags-match-list-sublevels t) |
96059
d778538bae7f
(org-map-entries): Let-bind `file'.
Glenn Morris <rgm@gnu.org>
parents:
96044
diff
changeset
|
10090 matcher pos file) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10091 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10092 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10093 ((eq match t) (setq matcher t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10094 ((eq match nil) (setq matcher t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10095 (t (setq matcher (if match (org-make-tags-matcher match) t)))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10096 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10097 (when (eq scope 'tree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10098 (org-back-to-heading t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10099 (org-narrow-to-subtree) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10100 (setq scope nil)) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10101 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10102 (if (not scope) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10103 (progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10104 (org-prepare-agenda-buffers |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10105 (list (buffer-file-name (current-buffer)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10106 (org-scan-tags func matcher)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10107 ;; Get the right scope |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10108 (setq pos (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10109 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10110 ((and scope (listp scope) (symbolp (car scope))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10111 (setq scope (eval scope))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10112 ((eq scope 'agenda) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10113 (setq scope (org-agenda-files t))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10114 ((eq scope 'agenda-with-archives) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10115 (setq scope (org-agenda-files t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10116 (setq scope (org-add-archive-files scope))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10117 ((eq scope 'file) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10118 (setq scope (list (buffer-file-name)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10119 ((eq scope 'file-with-archives) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10120 (setq scope (org-add-archive-files (list (buffer-file-name)))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10121 (org-prepare-agenda-buffers scope) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10122 (while (setq file (pop scope)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10123 (with-current-buffer (org-find-base-buffer-visiting file) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10124 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10125 (save-restriction |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10126 (widen) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10127 (goto-char (point-min)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10128 (org-scan-tags func matcher)))))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10129 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10130 ;;;; Properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10131 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10132 ;;; Setting and retrieving properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10133 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10134 (defconst org-special-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10135 '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "PRIORITY" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10136 "TIMESTAMP" "TIMESTAMP_IA") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10137 "The special properties valid in Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10138 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10139 These are properties that are not defined in the property drawer, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10140 but in some other way.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10141 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10142 (defconst org-default-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10143 '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10144 "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10145 "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10146 "EXPORT_FILE_NAME" "EXPORT_TITLE") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10147 "Some properties that are used by Org-mode for various purposes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10148 Being in this list makes sure that they are offered for completion.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10149 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10150 (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10151 "Regular expression matching the first line of a property drawer.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10152 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10153 (defconst org-property-end-re "^[ \t]*:END:[ \t]*$" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10154 "Regular expression matching the first line of a property drawer.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10155 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10156 (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10157 "Regular expression matching the first line of a property drawer.") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10158 |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10159 (defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$" |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10160 "Regular expression matching the first line of a property drawer.") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10161 |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10162 (defconst org-property-drawer-re |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10163 (concat "\\(" org-property-start-re "\\)[^\000]*\\(" |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10164 org-property-end-re "\\)\n?") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10165 "Matches an entire property drawer.") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10166 |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10167 (defconst org-clock-drawer-re |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10168 (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*\\(" |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10169 org-property-end-re "\\)\n?") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10170 "Matches an entire clock drawer.") |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
10171 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10172 (defun org-property-action () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10173 "Do an action on properties." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10174 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10175 (let (c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10176 (org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10177 (message "Property Action: [s]et [d]elete [D]elete globally [c]ompute") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10178 (setq c (read-char-exclusive)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10179 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10180 ((equal c ?s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10181 (call-interactively 'org-set-property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10182 ((equal c ?d) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10183 (call-interactively 'org-delete-property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10184 ((equal c ?D) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10185 (call-interactively 'org-delete-property-globally)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10186 ((equal c ?c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10187 (call-interactively 'org-compute-property-at-point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10188 (t (error "No such property action %c" c))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10189 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10190 (defun org-at-property-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10191 "Is the cursor in a property line?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10192 ;; FIXME: Does not check if we are actually in the drawer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10193 ;; FIXME: also returns true on any drawers..... |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10194 ;; This is used by C-c C-c for property action. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10195 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10196 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10197 (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10198 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10199 (defun org-get-property-block (&optional beg end force) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10200 "Return the (beg . end) range of the body of the property drawer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10201 BEG and END can be beginning and end of subtree, if not given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10202 they will be found. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10203 If the drawer does not exist and FORCE is non-nil, create the drawer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10204 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10205 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10206 (let* ((beg (or beg (progn (org-back-to-heading t) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10207 (end (or end (progn (outline-next-heading) (point))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10208 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10209 (if (re-search-forward org-property-start-re end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10210 (setq beg (1+ (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10211 (if force |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10212 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10213 (org-insert-property-drawer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10214 (setq end (progn (outline-next-heading) (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10215 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10216 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10217 (if (re-search-forward org-property-start-re end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10218 (setq beg (1+ (match-end 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10219 (if (re-search-forward org-property-end-re end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10220 (setq end (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10221 (or force (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10222 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10223 (setq end beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10224 (org-indent-line-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10225 (insert ":END:\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10226 (cons beg end))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10227 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10228 (defun org-entry-properties (&optional pom which) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10229 "Get all properties of the entry at point-or-marker POM. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10230 This includes the TODO keyword, the tags, time strings for deadline, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10231 scheduled, and clocking, and any additional properties defined in the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10232 entry. The return value is an alist, keys may occur multiple times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10233 if the property key was used several times. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10234 POM may also be nil, in which case the current entry is used. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10235 If WHICH is nil or `all', get all properties. If WHICH is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10236 `special' or `standard', only get that subclass." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10237 (setq which (or which 'all)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10238 (org-with-point-at pom |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10239 (let ((clockstr (substring org-clock-string 0 -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10240 (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10241 beg end range props sum-props key value string clocksum) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10242 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10243 (when (condition-case nil (org-back-to-heading t) (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10244 (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10245 (setq sum-props (get-text-property (point) 'org-summaries)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10246 (setq clocksum (get-text-property (point) :org-clock-minutes)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10247 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10248 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10249 (when (memq which '(all special)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10250 ;; Get the special properties, like TODO and tags |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10251 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10252 (when (and (looking-at org-todo-line-regexp) (match-end 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10253 (push (cons "TODO" (org-match-string-no-properties 2)) props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10254 (when (looking-at org-priority-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10255 (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10256 (when (and (setq value (org-get-tags-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10257 (string-match "\\S-" value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10258 (push (cons "TAGS" value) props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10259 (when (setq value (org-get-tags-at)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10260 (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10261 props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10262 (while (re-search-forward org-maybe-keyword-time-regexp end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10263 (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10264 string (if (equal key clockstr) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10265 (org-no-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10266 (org-trim |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10267 (buffer-substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10268 (match-beginning 3) (goto-char (point-at-eol))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10269 (substring (org-match-string-no-properties 3) 1 -1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10270 (unless key |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10271 (if (= (char-after (match-beginning 3)) ?\[) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10272 (setq key "TIMESTAMP_IA") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10273 (setq key "TIMESTAMP"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10274 (when (or (equal key clockstr) (not (assoc key props))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10275 (push (cons key string) props))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10276 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10277 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10278 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10279 (when (memq which '(all standard)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10280 ;; Get the standard properties, like :PORP: ... |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10281 (setq range (org-get-property-block beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10282 (when range |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10283 (goto-char (car range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10284 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10285 (org-re "^[ \t]*:\\([[:alpha:]][[:alnum:]_-]*\\):[ \t]*\\(\\S-.*\\)?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10286 (cdr range) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10287 (setq key (org-match-string-no-properties 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10288 value (org-trim (or (org-match-string-no-properties 2) ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10289 (unless (member key excluded) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10290 (push (cons key (or value "")) props))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10291 (if clocksum |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10292 (push (cons "CLOCKSUM" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10293 (org-columns-number-to-string (/ (float clocksum) 60.) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10294 'add_times)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10295 props)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10296 (append sum-props (nreverse props))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10297 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10298 (defun org-entry-get (pom property &optional inherit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10299 "Get value of PROPERTY for entry at point-or-marker POM. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10300 If INHERIT is non-nil and the entry does not have the property, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10301 then also check higher levels of the hierarchy. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10302 If INHERIT is the symbol `selective', use inheritance only if the setting |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10303 in `org-use-property-inheritance' selects PROPERTY for inheritance. |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10304 If the property is present but empty, the return value is the empty string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10305 If the property is not present at all, nil is returned." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10306 (org-with-point-at pom |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10307 (if (and inherit (if (eq inherit 'selective) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10308 (org-property-inherit-p property) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10309 t)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10310 (org-entry-get-with-inheritance property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10311 (if (member property org-special-properties) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10312 ;; We need a special property. Use brute force, get all properties. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10313 (cdr (assoc property (org-entry-properties nil 'special))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10314 (let ((range (org-get-property-block))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10315 (if (and range |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10316 (goto-char (car range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10317 (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10318 (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10319 (cdr range) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10320 ;; Found the property, return it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10321 (if (match-end 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10322 (org-match-string-no-properties 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10323 ""))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10324 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10325 (defun org-property-or-variable-value (var &optional inherit) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10326 "Check if there is a property fixing the value of VAR. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10327 If yes, return this value. If not, return the current value of the variable." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10328 (let ((prop (org-entry-get nil (symbol-name var) inherit))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10329 (if (and prop (stringp prop) (string-match "\\S-" prop)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10330 (read prop) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10331 (symbol-value var)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10332 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10333 (defun org-entry-delete (pom property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10334 "Delete the property PROPERTY from entry at point-or-marker POM." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10335 (org-with-point-at pom |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10336 (if (member property org-special-properties) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10337 nil ; cannot delete these properties. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10338 (let ((range (org-get-property-block))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10339 (if (and range |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10340 (goto-char (car range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10341 (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10342 (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10343 (cdr range) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10344 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10345 (delete-region (match-beginning 0) (1+ (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10346 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10347 nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10348 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10349 ;; Multi-values properties are properties that contain multiple values |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10350 ;; These values are assumed to be single words, separated by whitespace. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10351 (defun org-entry-add-to-multivalued-property (pom property value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10352 "Add VALUE to the words in the PROPERTY in entry at point-or-marker POM." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10353 (let* ((old (org-entry-get pom property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10354 (values (and old (org-split-string old "[ \t]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10355 (unless (member value values) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10356 (setq values (cons value values)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10357 (org-entry-put pom property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10358 (mapconcat 'identity values " "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10359 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10360 (defun org-entry-remove-from-multivalued-property (pom property value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10361 "Remove VALUE from words in the PROPERTY in entry at point-or-marker POM." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10362 (let* ((old (org-entry-get pom property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10363 (values (and old (org-split-string old "[ \t]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10364 (when (member value values) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10365 (setq values (delete value values)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10366 (org-entry-put pom property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10367 (mapconcat 'identity values " "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10368 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10369 (defun org-entry-member-in-multivalued-property (pom property value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10370 "Is VALUE one of the words in the PROPERTY in entry at point-or-marker POM?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10371 (let* ((old (org-entry-get pom property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10372 (values (and old (org-split-string old "[ \t]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10373 (member value values))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10374 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10375 (defvar org-entry-property-inherited-from (make-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10376 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10377 (defun org-entry-get-with-inheritance (property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10378 "Get entry property, and search higher levels if not present." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10379 (let (tmp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10380 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10381 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10382 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10383 (catch 'ex |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10384 (while t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10385 (when (setq tmp (org-entry-get nil property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10386 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10387 (move-marker org-entry-property-inherited-from (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10388 (throw 'ex tmp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10389 (or (org-up-heading-safe) (throw 'ex nil))))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10390 (or tmp |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10391 (cdr (assoc property org-file-properties)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10392 (cdr (assoc property org-global-properties)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10393 (cdr (assoc property org-global-properties-fixed)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10394 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10395 (defun org-entry-put (pom property value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10396 "Set PROPERTY to VALUE for entry at point-or-marker POM." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10397 (org-with-point-at pom |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10398 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10399 (let ((beg (point)) (end (save-excursion (outline-next-heading) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10400 range) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10401 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10402 ((equal property "TODO") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10403 (when (and (stringp value) (string-match "\\S-" value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10404 (not (member value org-todo-keywords-1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10405 (error "\"%s\" is not a valid TODO state" value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10406 (if (or (not value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10407 (not (string-match "\\S-" value))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10408 (setq value 'none)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10409 (org-todo value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10410 (org-set-tags nil 'align)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10411 ((equal property "PRIORITY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10412 (org-priority (if (and value (stringp value) (string-match "\\S-" value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10413 (string-to-char value) ?\ )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10414 (org-set-tags nil 'align)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10415 ((equal property "SCHEDULED") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10416 (if (re-search-forward org-scheduled-time-regexp end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10417 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10418 ((eq value 'earlier) (org-timestamp-change -1 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10419 ((eq value 'later) (org-timestamp-change 1 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10420 (t (call-interactively 'org-schedule))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10421 (call-interactively 'org-schedule))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10422 ((equal property "DEADLINE") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10423 (if (re-search-forward org-deadline-time-regexp end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10424 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10425 ((eq value 'earlier) (org-timestamp-change -1 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10426 ((eq value 'later) (org-timestamp-change 1 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10427 (t (call-interactively 'org-deadline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10428 (call-interactively 'org-deadline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10429 ((member property org-special-properties) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10430 (error "The %s property can not yet be set with `org-entry-put'" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10431 property)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10432 (t ; a non-special property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10433 (let ((buffer-invisibility-spec (org-inhibit-invisibility))) ; Emacs 21 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10434 (setq range (org-get-property-block beg end 'force)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10435 (goto-char (car range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10436 (if (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10437 (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10438 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10439 (delete-region (match-beginning 1) (match-end 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10440 (goto-char (match-beginning 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10441 (goto-char (cdr range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10442 (insert "\n") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10443 (backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10444 (org-indent-line-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10445 (insert ":" property ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10446 (and value (insert " " value)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10447 (org-indent-line-function))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10448 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10449 (defun org-buffer-property-keys (&optional include-specials include-defaults include-columns) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10450 "Get all property keys in the current buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10451 With INCLUDE-SPECIALS, also list the special properties that relect things |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10452 like tags and TODO state. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10453 With INCLUDE-DEFAULTS, also include properties that has special meaning |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10454 internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10455 With INCLUDE-COLUMNS, also include property names given in COLUMN |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10456 formats in the current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10457 (let (rtn range cfmt cols s p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10458 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10459 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10460 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10461 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10462 (while (re-search-forward org-property-start-re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10463 (setq range (org-get-property-block)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10464 (goto-char (car range)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10465 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10466 (org-re "^[ \t]*:\\([-[:alnum:]_]+\\):") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10467 (cdr range) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10468 (add-to-list 'rtn (org-match-string-no-properties 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10469 (outline-next-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10470 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10471 (when include-specials |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10472 (setq rtn (append org-special-properties rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10473 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10474 (when include-defaults |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10475 (mapc (lambda (x) (add-to-list 'rtn x)) org-default-properties)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10476 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10477 (when include-columns |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10478 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10479 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10480 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10481 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10482 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10483 "^\\(#\\+COLUMNS:\\|[ \t]*:COLUMNS:\\)[ \t]*\\(.*\\)" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10484 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10485 (setq cfmt (match-string 2) s 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10486 (while (string-match (org-re "%[0-9]*\\([-[:alnum:]_]+\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10487 cfmt s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10488 (setq s (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10489 p (match-string 1 cfmt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10490 (unless (or (equal p "ITEM") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10491 (member p org-special-properties)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10492 (add-to-list 'rtn (match-string 1 cfmt)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10493 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10494 (sort rtn (lambda (a b) (string< (upcase a) (upcase b)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10495 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10496 (defun org-property-values (key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10497 "Return a list of all values of property KEY." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10498 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10499 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10500 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10501 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10502 (let ((re (concat "^[ \t]*:" key ":[ \t]*\\(\\S-.*\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10503 values) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10504 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10505 (add-to-list 'values (org-trim (match-string 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10506 (delete "" values))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10507 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10508 (defun org-insert-property-drawer () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10509 "Insert a property drawer into the current entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10510 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10511 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10512 (looking-at outline-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10513 (let ((indent (- (match-end 0)(match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10514 (beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10515 (re (concat "^[ \t]*" org-keyword-time-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10516 end hiddenp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10517 (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10518 (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10519 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10520 (while (re-search-forward re end t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10521 (setq hiddenp (org-invisible-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10522 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10523 (and (equal (char-after) ?\n) (forward-char 1)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10524 (while (looking-at "^[ \t]*\\(:CLOCK:\\|CLOCK\\|:END:\\)") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10525 (beginning-of-line 2)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10526 (org-skip-over-state-notes) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10527 (skip-chars-backward " \t\n\r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10528 (if (eq (char-before) ?*) (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10529 (let ((inhibit-read-only t)) (insert "\n:PROPERTIES:\n:END:")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10530 (beginning-of-line 0) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10531 (org-indent-to-column indent) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10532 (beginning-of-line 2) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10533 (org-indent-to-column indent) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10534 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10535 (if hiddenp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10536 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10537 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10538 (hide-entry)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10539 (org-flag-drawer t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10540 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10541 (defun org-set-property (property value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10542 "In the current entry, set PROPERTY to VALUE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10543 When called interactively, this will prompt for a property name, offering |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10544 completion on existing and default properties. And then it will prompt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10545 for a value, offering competion either on allowed values (via an inherited |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10546 xxx_ALL property) or on existing values in other instances of this property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10547 in the current file." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10548 (interactive |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10549 (let* ((completion-ignore-case t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10550 (keys (org-buffer-property-keys nil t t)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10551 (prop0 (completing-read "Property: " (mapcar 'list keys))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10552 (prop (if (member prop0 keys) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10553 prop0 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10554 (or (cdr (assoc (downcase prop0) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10555 (mapcar (lambda (x) (cons (downcase x) x)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10556 keys))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10557 prop0))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10558 (cur (org-entry-get nil prop)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10559 (allowed (org-property-get-allowed-values nil prop 'table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10560 (existing (mapcar 'list (org-property-values prop))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10561 (val (if allowed |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10562 (org-completing-read "Value: " allowed nil 'req-match) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10563 (org-completing-read |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10564 (concat "Value" (if (and cur (string-match "\\S-" cur)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10565 (concat "[" cur "]") "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10566 ": ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10567 existing nil nil "" nil cur)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10568 (list prop (if (equal val "") cur val)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10569 (unless (equal (org-entry-get nil property) value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10570 (org-entry-put nil property value))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10571 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10572 (defun org-delete-property (property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10573 "In the current entry, delete PROPERTY." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10574 (interactive |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10575 (let* ((completion-ignore-case t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10576 (prop (completing-read |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10577 "Property: " (org-entry-properties nil 'standard)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10578 (list prop))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10579 (message "Property %s %s" property |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10580 (if (org-entry-delete nil property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10581 "deleted" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10582 "was not present in the entry"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10583 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10584 (defun org-delete-property-globally (property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10585 "Remove PROPERTY globally, from all entries." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10586 (interactive |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10587 (let* ((completion-ignore-case t) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10588 (prop (completing-read |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10589 "Globally remove property: " |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10590 (mapcar 'list (org-buffer-property-keys))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10591 (list prop))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10592 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10593 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10594 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10595 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10596 (let ((cnt 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10597 (while (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10598 (concat "^[ \t]*:" (regexp-quote property) ":.*\n?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10599 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10600 (setq cnt (1+ cnt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10601 (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10602 (message "Property \"%s\" removed from %d entries" property cnt))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10603 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10604 (defvar org-columns-current-fmt-compiled) ; defined in org-colview.el |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10605 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10606 (defun org-compute-property-at-point () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10607 "Compute the property at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10608 This looks for an enclosing column format, extracts the operator and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10609 then applies it to the proerty in the column format's scope." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10610 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10611 (unless (org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10612 (error "Not at a property")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10613 (let ((prop (org-match-string-no-properties 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10614 (org-columns-get-format-and-top-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10615 (unless (nth 3 (assoc prop org-columns-current-fmt-compiled)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10616 (error "No operator defined for property %s" prop)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10617 (org-columns-compute prop))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10618 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10619 (defun org-property-get-allowed-values (pom property &optional table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10620 "Get allowed values for the property PROPERTY. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10621 When TABLE is non-nil, return an alist that can directly be used for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10622 completion." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10623 (let (vals) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10624 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10625 ((equal property "TODO") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10626 (setq vals (org-with-point-at pom |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10627 (append org-todo-keywords-1 '(""))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10628 ((equal property "PRIORITY") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10629 (let ((n org-lowest-priority)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10630 (while (>= n org-highest-priority) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10631 (push (char-to-string n) vals) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10632 (setq n (1- n))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10633 ((member property org-special-properties)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10634 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10635 (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10636 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10637 (when (and vals (string-match "\\S-" vals)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10638 (setq vals (car (read-from-string (concat "(" vals ")")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10639 (setq vals (mapcar (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10640 (cond ((stringp x) x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10641 ((numberp x) (number-to-string x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10642 ((symbolp x) (symbol-name x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10643 (t "???"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10644 vals))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10645 (if table (mapcar 'list vals) vals))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10646 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10647 (defun org-property-previous-allowed-value (&optional previous) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10648 "Switch to the next allowed value for this property." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10649 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10650 (org-property-next-allowed-value t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10651 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10652 (defun org-property-next-allowed-value (&optional previous) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10653 "Switch to the next allowed value for this property." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10654 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10655 (unless (org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10656 (error "Not at a property")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10657 (let* ((key (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10658 (value (match-string 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10659 (allowed (or (org-property-get-allowed-values (point) key) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10660 (and (member value '("[ ]" "[-]" "[X]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10661 '("[ ]" "[X]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10662 nval) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10663 (unless allowed |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10664 (error "Allowed values for this property have not been defined")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10665 (if previous (setq allowed (reverse allowed))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10666 (if (member value allowed) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10667 (setq nval (car (cdr (member value allowed))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10668 (setq nval (or nval (car allowed))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10669 (if (equal nval value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10670 (error "Only one allowed value for this property")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10671 (org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10672 (replace-match (concat " :" key ": " nval) t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10673 (org-indent-line-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10674 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10675 (skip-chars-forward " \t"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10676 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10677 (defun org-find-entry-with-id (ident) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10678 "Locate the entry that contains the ID property with exact value IDENT. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10679 IDENT can be a string, a symbol or a number, this function will search for |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10680 the string representation of it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10681 Return the position where this entry starts, or nil if there is no such entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10682 (let ((id (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10683 ((stringp ident) ident) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10684 ((symbol-name ident) (symbol-name ident)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10685 ((numberp ident) (number-to-string ident)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10686 (t (error "IDENT %s must be a string, symbol or number" ident)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10687 (case-fold-search nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10688 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10689 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10690 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10691 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10692 (when (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10693 (concat "^[ \t]*:ID:[ \t]+" (regexp-quote id) "[ \t]*$") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10694 nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10695 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10696 (point)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10697 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10698 ;;;; Timestamps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10699 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10700 (defvar org-last-changed-timestamp nil) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10701 (defvar org-last-inserted-timestamp nil |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10702 "The last time stamp inserted with `org-insert-time-stamp'.") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10703 (defvar org-time-was-given) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10704 (defvar org-end-time-was-given) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10705 (defvar org-ts-what) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10706 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10707 (defun org-time-stamp (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10708 "Prompt for a date/time and insert a time stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10709 If the user specifies a time like HH:MM, or if this command is called |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10710 with a prefix argument, the time stamp will contain date and time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10711 Otherwise, only the date will be included. All parts of a date not |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10712 specified by the user will be filled in from the current date/time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10713 So if you press just return without typing anything, the time stamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10714 will represent the current date/time. If there is already a timestamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10715 at the cursor, it will be modified." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10716 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10717 (let* ((ts nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10718 (default-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10719 ;; Default time is either today, or, when entering a range, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10720 ;; the range start. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10721 (if (or (and (org-at-timestamp-p t) (setq ts (match-string 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10722 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10723 (re-search-backward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10724 (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10725 (- (point) 20) t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10726 (apply 'encode-time (org-parse-time-string (match-string 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10727 (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10728 (default-input (and ts (org-get-compact-tod ts))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10729 org-time-was-given org-end-time-was-given time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10730 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10731 ((and (org-at-timestamp-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10732 (eq last-command 'org-time-stamp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10733 (eq this-command 'org-time-stamp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10734 (insert "--") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10735 (setq time (let ((this-command this-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10736 (org-read-date arg 'totime nil nil default-time default-input))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10737 (org-insert-time-stamp time (or org-time-was-given arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10738 ((org-at-timestamp-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10739 (setq time (let ((this-command this-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10740 (org-read-date arg 'totime nil nil default-time default-input))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10741 (when (org-at-timestamp-p) ; just to get the match data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10742 (replace-match "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10743 (setq org-last-changed-timestamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10744 (org-insert-time-stamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10745 time (or org-time-was-given arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10746 nil nil nil (list org-end-time-was-given)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10747 (message "Timestamp updated")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10748 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10749 (setq time (let ((this-command this-command)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10750 (org-read-date arg 'totime nil nil default-time default-input))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10751 (org-insert-time-stamp time (or org-time-was-given arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10752 nil nil nil (list org-end-time-was-given)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10753 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10754 ;; FIXME: can we use this for something else, like computing time differences? |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10755 (defun org-get-compact-tod (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10756 (when (string-match "\\(\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)\\(-\\(\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)\\)?" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10757 (let* ((t1 (match-string 1 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10758 (h1 (string-to-number (match-string 2 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10759 (m1 (string-to-number (match-string 3 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10760 (t2 (and (match-end 4) (match-string 5 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10761 (h2 (and t2 (string-to-number (match-string 6 s)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10762 (m2 (and t2 (string-to-number (match-string 7 s)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10763 dh dm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10764 (if (not t2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10765 t1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10766 (setq dh (- h2 h1) dm (- m2 m1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10767 (if (< dm 0) (setq dm (+ dm 60) dh (1- dh))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10768 (concat t1 "+" (number-to-string dh) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10769 (if (/= 0 dm) (concat ":" (number-to-string dm)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10770 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10771 (defun org-time-stamp-inactive (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10772 "Insert an inactive time stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10773 An inactive time stamp is enclosed in square brackets instead of angle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10774 brackets. It is inactive in the sense that it does not trigger agenda entries, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10775 does not link to the calendar and cannot be changed with the S-cursor keys. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10776 So these are more for recording a certain time/date." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10777 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10778 (let (org-time-was-given org-end-time-was-given time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10779 (setq time (org-read-date arg 'totime)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10780 (org-insert-time-stamp time (or org-time-was-given arg) 'inactive |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10781 nil nil (list org-end-time-was-given)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10782 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10783 (defvar org-date-ovl (org-make-overlay 1 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10784 (org-overlay-put org-date-ovl 'face 'org-warning) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10785 (org-detach-overlay org-date-ovl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10786 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10787 (defvar org-ans1) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10788 (defvar org-ans2) ; dynamically scoped parameter |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10789 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10790 (defvar org-plain-time-of-day-regexp) ; defined below |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10791 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10792 (defvar org-overriding-default-time nil) ; dynamically scoped |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10793 (defvar org-read-date-overlay nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10794 (defvar org-dcst nil) ; dynamically scoped |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10795 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10796 (defun org-read-date (&optional with-time to-time from-string prompt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10797 default-time default-input) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10798 "Read a date, possibly a time, and make things smooth for the user. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10799 The prompt will suggest to enter an ISO date, but you can also enter anything |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10800 which will at least partially be understood by `parse-time-string'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10801 Unrecognized parts of the date will default to the current day, month, year, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10802 hour and minute. If this command is called to replace a timestamp at point, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10803 of to enter the second timestamp of a range, the default time is taken from the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10804 existing stamp. For example, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10805 3-2-5 --> 2003-02-05 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10806 feb 15 --> currentyear-02-15 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10807 sep 12 9 --> 2009-09-12 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10808 12:45 --> today 12:45 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10809 22 sept 0:34 --> currentyear-09-22 0:34 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10810 12 --> currentyear-currentmonth-12 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10811 Fri --> nearest Friday (today or later) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10812 etc. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10813 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10814 Furthermore you can specify a relative date by giving, as the *first* thing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10815 in the input: a plus/minus sign, a number and a letter [dwmy] to indicate |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10816 change in days weeks, months, years. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10817 With a single plus or minus, the date is relative to today. With a double |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10818 plus or minus, it is relative to the date in DEFAULT-TIME. E.g. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10819 +4d --> four days from today |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10820 +4 --> same as above |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10821 +2w --> two weeks from today |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10822 ++5 --> five days from default date |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10823 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10824 The function understands only English month and weekday abbreviations, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10825 but this can be configured with the variables `parse-time-months' and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10826 `parse-time-weekdays'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10827 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10828 While prompting, a calendar is popped up - you can also select the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10829 date with the mouse (button 1). The calendar shows a period of three |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10830 months. To scroll it to other months, use the keys `>' and `<'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10831 If you don't like the calendar, turn it off with |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10832 \(setq org-read-date-popup-calendar nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10833 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10834 With optional argument TO-TIME, the date will immediately be converted |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10835 to an internal time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10836 With an optional argument WITH-TIME, the prompt will suggest to also |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10837 insert a time. Note that when WITH-TIME is not set, you can still |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10838 enter a time, and this function will inform the calling routine about |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10839 this change. The calling routine may then choose to change the format |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10840 used to insert the time stamp into the buffer to include the time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10841 With optional argument FROM-STRING, read from this string instead from |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10842 the user. PROMPT can overwrite the default prompt. DEFAULT-TIME is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10843 the time/date that is used for everything that is not specified by the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10844 user." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10845 (require 'parse-time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10846 (let* ((org-time-stamp-rounding-minutes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10847 (if (equal with-time '(16)) '(0 0) org-time-stamp-rounding-minutes)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10848 (org-dcst org-display-custom-times) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10849 (ct (org-current-time)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10850 (def (or org-overriding-default-time default-time ct)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10851 (defdecode (decode-time def)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10852 (dummy (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10853 (when (< (nth 2 defdecode) org-extend-today-until) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10854 (setcar (nthcdr 2 defdecode) -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10855 (setcar (nthcdr 1 defdecode) 59) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10856 (setq def (apply 'encode-time defdecode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10857 defdecode (decode-time def))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10858 (calendar-move-hook nil) |
93810
ba0874919ac4
(org-agenda-format-date-aligned, org-agenda-execute-calendar-command):
Glenn Morris <rgm@gnu.org>
parents:
93141
diff
changeset
|
10859 (calendar-view-diary-initially-flag nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10860 (view-diary-entries-initially nil) |
93810
ba0874919ac4
(org-agenda-format-date-aligned, org-agenda-execute-calendar-command):
Glenn Morris <rgm@gnu.org>
parents:
93141
diff
changeset
|
10861 (calendar-view-holidays-initially-flag nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10862 (view-calendar-holidays-initially nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10863 (timestr (format-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10864 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10865 (prompt (concat (if prompt (concat prompt " ") "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10866 (format "Date+time [%s]: " timestr))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10867 ans (org-ans0 "") org-ans1 org-ans2 final) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10868 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10869 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10870 (from-string (setq ans from-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10871 (org-read-date-popup-calendar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10872 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10873 (save-window-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10874 (calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10875 (calendar-forward-day (- (time-to-days def) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10876 (calendar-absolute-from-gregorian |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10877 (calendar-current-date)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10878 (org-eval-in-calendar nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10879 (let* ((old-map (current-local-map)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10880 (map (copy-keymap calendar-mode-map)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10881 (minibuffer-local-map (copy-keymap minibuffer-local-map))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10882 (org-defkey map (kbd "RET") 'org-calendar-select) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10883 (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10884 'org-calendar-select-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10885 (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10886 'org-calendar-select-mouse) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10887 (org-defkey minibuffer-local-map [(meta shift left)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10888 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10889 (org-eval-in-calendar '(calendar-backward-month 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10890 (org-defkey minibuffer-local-map [(meta shift right)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10891 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10892 (org-eval-in-calendar '(calendar-forward-month 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10893 (org-defkey minibuffer-local-map [(meta shift up)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10894 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10895 (org-eval-in-calendar '(calendar-backward-year 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10896 (org-defkey minibuffer-local-map [(meta shift down)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10897 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10898 (org-eval-in-calendar '(calendar-forward-year 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10899 (org-defkey minibuffer-local-map [(shift up)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10900 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10901 (org-eval-in-calendar '(calendar-backward-week 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10902 (org-defkey minibuffer-local-map [(shift down)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10903 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10904 (org-eval-in-calendar '(calendar-forward-week 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10905 (org-defkey minibuffer-local-map [(shift left)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10906 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10907 (org-eval-in-calendar '(calendar-backward-day 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10908 (org-defkey minibuffer-local-map [(shift right)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10909 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10910 (org-eval-in-calendar '(calendar-forward-day 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10911 (org-defkey minibuffer-local-map ">" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10912 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10913 (org-eval-in-calendar '(scroll-calendar-left 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10914 (org-defkey minibuffer-local-map "<" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10915 (lambda () (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10916 (org-eval-in-calendar '(scroll-calendar-right 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10917 (unwind-protect |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10918 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10919 (use-local-map map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10920 (add-hook 'post-command-hook 'org-read-date-display) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10921 (setq org-ans0 (read-string prompt default-input nil nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10922 ;; org-ans0: from prompt |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10923 ;; org-ans1: from mouse click |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10924 ;; org-ans2: from calendar motion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10925 (setq ans (concat org-ans0 " " (or org-ans1 org-ans2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10926 (remove-hook 'post-command-hook 'org-read-date-display) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10927 (use-local-map old-map) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10928 (when org-read-date-overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10929 (org-delete-overlay org-read-date-overlay) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10930 (setq org-read-date-overlay nil))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10931 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10932 (t ; Naked prompt only |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10933 (unwind-protect |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10934 (setq ans (read-string prompt default-input nil timestr)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10935 (when org-read-date-overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10936 (org-delete-overlay org-read-date-overlay) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10937 (setq org-read-date-overlay nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10938 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10939 (setq final (org-read-date-analyze ans def defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10940 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10941 (if to-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10942 (apply 'encode-time final) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10943 (if (and (boundp 'org-time-was-given) org-time-was-given) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10944 (format "%04d-%02d-%02d %02d:%02d" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10945 (nth 5 final) (nth 4 final) (nth 3 final) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10946 (nth 2 final) (nth 1 final)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10947 (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10948 (defvar def) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10949 (defvar defdecode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10950 (defvar with-time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10951 (defun org-read-date-display () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10952 "Display the currrent date prompt interpretation in the minibuffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10953 (when org-read-date-display-live |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10954 (when org-read-date-overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10955 (org-delete-overlay org-read-date-overlay)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10956 (let ((p (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10957 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10958 (while (not (equal (buffer-substring |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10959 (max (point-min) (- (point) 4)) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10960 " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10961 (insert " ")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10962 (goto-char p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10963 (let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10964 " " (or org-ans1 org-ans2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10965 (org-end-time-was-given nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10966 (f (org-read-date-analyze ans def defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10967 (fmts (if org-dcst |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10968 org-time-stamp-custom-formats |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10969 org-time-stamp-formats)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10970 (fmt (if (or with-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10971 (and (boundp 'org-time-was-given) org-time-was-given)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10972 (cdr fmts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10973 (car fmts))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10974 (txt (concat "=> " (format-time-string fmt (apply 'encode-time f))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10975 (when (and org-end-time-was-given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10976 (string-match org-plain-time-of-day-regexp txt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10977 (setq txt (concat (substring txt 0 (match-end 0)) "-" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10978 org-end-time-was-given |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10979 (substring txt (match-end 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10980 (setq org-read-date-overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10981 (make-overlay (1- (point-at-eol)) (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10982 (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10983 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10984 (defun org-read-date-analyze (ans def defdecode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10985 "Analyze the combined answer of the date prompt." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10986 ;; FIXME: cleanup and comment |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10987 (let (delta deltan deltaw deltadef year month day |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10988 hour minute second wday pm h2 m2 tl wday1 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
10989 iso-year iso-weekday iso-week iso-year iso-date) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10990 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10991 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10992 (setq ans "+0")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
10993 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10994 (when (setq delta (org-read-date-get-relative ans (current-time) def)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10995 (setq ans (replace-match "" t t ans) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10996 deltan (car delta) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10997 deltaw (nth 1 delta) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10998 deltadef (nth 2 delta))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
10999 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11000 ;; Check if there is an iso week date in there |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11001 ;; If yes, sore the info and ostpone interpreting it until the rest |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11002 ;; of the parsing is done |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11003 (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11004 (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11005 iso-weekday (if (match-end 3) (string-to-number (match-string 3 ans))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11006 iso-week (string-to-number (match-string 2 ans))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11007 (setq ans (replace-match "" t t ans))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11008 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11009 ;; Help matching ISO dates with single digit month ot day, like 2006-8-11. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11010 (when (string-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11011 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11012 (setq year (if (match-end 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11013 (string-to-number (match-string 2 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11014 (string-to-number (format-time-string "%Y"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11015 month (string-to-number (match-string 3 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11016 day (string-to-number (match-string 4 ans))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11017 (if (< year 100) (setq year (+ 2000 year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11018 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11019 t nil ans))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11020 ;; Help matching am/pm times, because `parse-time-string' does not do that. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11021 ;; If there is a time with am/pm, and *no* time without it, we convert |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11022 ;; so that matching will be successful. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11023 (loop for i from 1 to 2 do ; twice, for end time as well |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11024 (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11025 (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11026 (setq hour (string-to-number (match-string 1 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11027 minute (if (match-end 3) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11028 (string-to-number (match-string 3 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11029 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11030 pm (equal ?p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11031 (string-to-char (downcase (match-string 4 ans))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11032 (if (and (= hour 12) (not pm)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11033 (setq hour 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11034 (if (and pm (< hour 12)) (setq hour (+ 12 hour)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11035 (setq ans (replace-match (format "%02d:%02d" hour minute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11036 t t ans)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11037 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11038 ;; Check if a time range is given as a duration |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11039 (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11040 (setq hour (string-to-number (match-string 1 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11041 h2 (+ hour (string-to-number (match-string 3 ans))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11042 minute (string-to-number (match-string 2 ans)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11043 m2 (+ minute (if (match-end 5) (string-to-number |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11044 (match-string 5 ans))0))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11045 (if (>= m2 60) (setq h2 (1+ h2) m2 (- m2 60))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11046 (setq ans (replace-match (format "%02d:%02d-%02d:%02d" hour minute h2 m2) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11047 t t ans))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11048 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11049 ;; Check if there is a time range |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11050 (when (boundp 'org-end-time-was-given) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11051 (setq org-time-was-given nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11052 (when (and (string-match org-plain-time-of-day-regexp ans) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11053 (match-end 8)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11054 (setq org-end-time-was-given (match-string 8 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11055 (setq ans (concat (substring ans 0 (match-beginning 7)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11056 (substring ans (match-end 7)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11057 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11058 (setq tl (parse-time-string ans) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11059 day (or (nth 3 tl) (nth 3 defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11060 month (or (nth 4 tl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11061 (if (and org-read-date-prefer-future |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11062 (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11063 (1+ (nth 4 defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11064 (nth 4 defdecode))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11065 year (or (nth 5 tl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11066 (if (and org-read-date-prefer-future |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11067 (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11068 (1+ (nth 5 defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11069 (nth 5 defdecode))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11070 hour (or (nth 2 tl) (nth 2 defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11071 minute (or (nth 1 tl) (nth 1 defdecode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11072 second (or (nth 0 tl) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11073 wday (nth 6 tl)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11074 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11075 ;; Special date definitions below |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11076 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11077 (iso-week |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11078 ;; There was an iso week |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11079 (setq year (or iso-year year) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11080 day (or iso-weekday wday 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11081 wday nil ; to make sure that the trigger below does not match |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11082 iso-date (calendar-gregorian-from-absolute |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11083 (calendar-absolute-from-iso |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11084 (list iso-week day year)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11085 ; FIXME: Should we also push ISO weeks into the future? |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11086 ; (when (and org-read-date-prefer-future |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11087 ; (not iso-year) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11088 ; (< (calendar-absolute-from-gregorian iso-date) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11089 ; (time-to-days (current-time)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11090 ; (setq year (1+ year) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11091 ; iso-date (calendar-gregorian-from-absolute |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11092 ; (calendar-absolute-from-iso |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11093 ; (list iso-week day year))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11094 (setq month (car iso-date) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11095 year (nth 2 iso-date) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11096 day (nth 1 iso-date))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11097 (deltan |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11098 (unless deltadef |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11099 (let ((now (decode-time (current-time)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11100 (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11101 (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11102 ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11103 ((equal deltaw "m") (setq month (+ month deltan))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11104 ((equal deltaw "y") (setq year (+ year deltan))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11105 ((and wday (not (nth 3 tl))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11106 ;; Weekday was given, but no day, so pick that day in the week |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11107 ;; on or after the derived date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11108 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11109 (unless (equal wday wday1) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11110 (setq day (+ day (% (- wday wday1 -7) 7)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11111 (if (and (boundp 'org-time-was-given) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11112 (nth 2 tl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11113 (setq org-time-was-given t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11114 (if (< year 100) (setq year (+ 2000 year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11115 (if (< year 1970) (setq year (nth 5 defdecode))) ; not representable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11116 (list second minute hour day month year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11117 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11118 (defvar parse-time-weekdays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11119 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11120 (defun org-read-date-get-relative (s today default) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11121 "Check string S for special relative date string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11122 TODAY and DEFAULT are internal times, for today and for a default. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11123 Return shift list (N what def-flag) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11124 WHAT is \"d\", \"w\", \"m\", or \"y\" for day, week, month, year. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11125 N is the number of WHATs to shift. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11126 DEF-FLAG is t when a double ++ or -- indicates shift relative to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11127 the DEFAULT date rather than TODAY." |
94749 | 11128 (when (and |
11129 (string-match | |
11130 (concat | |
11131 "\\`[ \t]*\\([-+]\\{0,2\\}\\)" | |
11132 "\\([0-9]+\\)?" | |
11133 "\\([dwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") "\\)\\)?" | |
11134 "\\([ \t]\\|$\\)") s) | |
11135 (or (> (match-end 1) (match-beginning 1)) (match-end 4))) | |
11136 (let* ((dir (if (> (match-end 1) (match-beginning 1)) | |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11137 (string-to-char (substring (match-string 1 s) -1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11138 ?+)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11139 (rel (and (match-end 1) (= 2 (- (match-end 1) (match-beginning 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11140 (n (if (match-end 2) (string-to-number (match-string 2 s)) 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11141 (what (if (match-end 3) (match-string 3 s) "d")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11142 (wday1 (cdr (assoc (downcase what) parse-time-weekdays))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11143 (date (if rel default today)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11144 (wday (nth 6 (decode-time date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11145 delta) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11146 (if wday1 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11147 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11148 (setq delta (mod (+ 7 (- wday1 wday)) 7)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11149 (if (= dir ?-) (setq delta (- delta 7))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11150 (if (> n 1) (setq delta (+ delta (* (1- n) (if (= dir ?-) -7 7))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11151 (list delta "d" rel)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11152 (list (* n (if (= dir ?-) -1 1)) what rel))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11153 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11154 (defun org-eval-in-calendar (form &optional keepdate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11155 "Eval FORM in the calendar window and return to current window. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11156 Also, store the cursor date in variable org-ans2." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11157 (let ((sw (selected-window))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11158 (select-window (get-buffer-window "*Calendar*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11159 (eval form) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11160 (when (and (not keepdate) (calendar-cursor-to-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11161 (let* ((date (calendar-cursor-to-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11162 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11163 (setq org-ans2 (format-time-string "%Y-%m-%d" time)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11164 (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11165 (select-window sw))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11166 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11167 ; ;; Update the prompt to show new default date |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11168 ; (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11169 ; (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11170 ; (when (and org-ans2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11171 ; (re-search-forward "\\[[-0-9]+\\]" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11172 ; (get-text-property (match-end 0) 'field)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11173 ; (let ((inhibit-read-only t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11174 ; (replace-match (concat "[" org-ans2 "]") t t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11175 ; (add-text-properties (point-min) (1+ (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11176 ; (text-properties-at (1+ (point-min))))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11177 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11178 (defun org-calendar-select () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11179 "Return to `org-read-date' with the date currently selected. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11180 This is used by `org-read-date' in a temporary keymap for the calendar buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11181 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11182 (when (calendar-cursor-to-date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11183 (let* ((date (calendar-cursor-to-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11184 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11185 (setq org-ans1 (format-time-string "%Y-%m-%d" time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11186 (if (active-minibuffer-window) (exit-minibuffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11187 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11188 (defun org-insert-time-stamp (time &optional with-hm inactive pre post extra) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11189 "Insert a date stamp for the date given by the internal TIME. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11190 WITH-HM means, use the stamp format that includes the time of the day. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11191 INACTIVE means use square brackets instead of angular ones, so that the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11192 stamp will not contribute to the agenda. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11193 PRE and POST are optional strings to be inserted before and after the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11194 stamp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11195 The command returns the inserted time stamp." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11196 (let ((fmt (funcall (if with-hm 'cdr 'car) org-time-stamp-formats)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11197 stamp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11198 (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11199 (insert-before-markers (or pre "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11200 (insert-before-markers (setq stamp (format-time-string fmt time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11201 (when (listp extra) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11202 (setq extra (car extra)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11203 (if (and (stringp extra) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11204 (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11205 (setq extra (format "-%02d:%02d" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11206 (string-to-number (match-string 1 extra)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11207 (string-to-number (match-string 2 extra)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11208 (setq extra nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11209 (when extra |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11210 (backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11211 (insert-before-markers extra) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11212 (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11213 (insert-before-markers (or post "")) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
11214 (setq org-last-inserted-timestamp stamp))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11215 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11216 (defun org-toggle-time-stamp-overlays () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11217 "Toggle the use of custom time stamp formats." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11218 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11219 (setq org-display-custom-times (not org-display-custom-times)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11220 (unless org-display-custom-times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11221 (let ((p (point-min)) (bmp (buffer-modified-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11222 (while (setq p (next-single-property-change p 'display)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11223 (if (and (get-text-property p 'display) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11224 (eq (get-text-property p 'face) 'org-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11225 (remove-text-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11226 p (setq p (next-single-property-change p 'display)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11227 '(display t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11228 (set-buffer-modified-p bmp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11229 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11230 (remove-text-properties (point-min) (point-max) '(end-glyph t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11231 (org-restart-font-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11232 (setq org-table-may-need-update t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11233 (if org-display-custom-times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11234 (message "Time stamps are overlayed with custom format") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11235 (message "Time stamp overlays removed"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11236 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11237 (defun org-display-custom-time (beg end) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
11238 "Overlay modified time stamp format over timestamp between BEG and END." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11239 (let* ((ts (buffer-substring beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11240 t1 w1 with-hm tf time str w2 (off 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11241 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11242 (setq t1 (org-parse-time-string ts t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11243 (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( [.+]?\\+[0-9]+[dwmy]\\)?\\'" ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11244 (setq off (- (match-end 0) (match-beginning 0))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11245 (setq end (- end off)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11246 (setq w1 (- end beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11247 with-hm (and (nth 1 t1) (nth 2 t1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11248 tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11249 time (org-fix-decoded-time t1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11250 str (org-add-props |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11251 (format-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11252 (substring tf 1 -1) (apply 'encode-time time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11253 nil 'mouse-face 'highlight) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11254 w2 (length str)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11255 (if (not (= w2 w1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11256 (add-text-properties (1+ beg) (+ 2 beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11257 (list 'org-dwidth t 'org-dwidth-n (- w1 w2)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11258 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11259 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11260 (put-text-property beg end 'invisible t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11261 (put-text-property beg end 'end-glyph (make-glyph str))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11262 (put-text-property beg end 'display str)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11263 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11264 (defun org-translate-time (string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11265 "Translate all timestamps in STRING to custom format. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11266 But do this only if the variable `org-display-custom-times' is set." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11267 (when org-display-custom-times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11268 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11269 (let* ((start 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11270 (re org-ts-regexp-both) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11271 t1 with-hm inactive tf time str beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11272 (while (setq start (string-match re string start)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11273 (setq beg (match-beginning 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11274 end (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11275 t1 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11276 (org-parse-time-string (substring string beg end) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11277 with-hm (and (nth 1 t1) (nth 2 t1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11278 inactive (equal (substring string beg (1+ beg)) "[") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11279 tf (funcall (if with-hm 'cdr 'car) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11280 org-time-stamp-custom-formats) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11281 time (org-fix-decoded-time t1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11282 str (format-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11283 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11284 (if inactive "[" "<") (substring tf 1 -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11285 (if inactive "]" ">")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11286 (apply 'encode-time time)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11287 string (replace-match str t t string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11288 start (+ start (length str))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11289 string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11290 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11291 (defun org-fix-decoded-time (time) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11292 "Set 0 instead of nil for the first 6 elements of time. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11293 Don't touch the rest." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11294 (let ((n 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11295 (mapcar (lambda (x) (if (< (setq n (1+ n)) 7) (or x 0) x)) time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11296 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11297 (defun org-days-to-time (timestamp-string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11298 "Difference between TIMESTAMP-STRING and now in days." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11299 (- (time-to-days (org-time-string-to-time timestamp-string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11300 (time-to-days (current-time)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11301 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11302 (defun org-deadline-close (timestamp-string &optional ndays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11303 "Is the time in TIMESTAMP-STRING close to the current date?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11304 (setq ndays (or ndays (org-get-wdays timestamp-string))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11305 (and (< (org-days-to-time timestamp-string) ndays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11306 (not (org-entry-is-done-p)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11307 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11308 (defun org-get-wdays (ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11309 "Get the deadline lead time appropriate for timestring TS." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11310 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11311 ((<= org-deadline-warning-days 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11312 ;; 0 or negative, enforce this value no matter what |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11313 (- org-deadline-warning-days)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11314 ((string-match "-\\([0-9]+\\)\\([dwmy]\\)\\(\\'\\|>\\)" ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11315 ;; lead time is specified. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11316 (floor (* (string-to-number (match-string 1 ts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11317 (cdr (assoc (match-string 2 ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11318 '(("d" . 1) ("w" . 7) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11319 ("m" . 30.4) ("y" . 365.25))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11320 ;; go for the default. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11321 (t org-deadline-warning-days))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11322 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11323 (defun org-calendar-select-mouse (ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11324 "Return to `org-read-date' with the date currently selected. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11325 This is used by `org-read-date' in a temporary keymap for the calendar buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11326 (interactive "e") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11327 (mouse-set-point ev) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11328 (when (calendar-cursor-to-date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11329 (let* ((date (calendar-cursor-to-date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11330 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11331 (setq org-ans1 (format-time-string "%Y-%m-%d" time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11332 (if (active-minibuffer-window) (exit-minibuffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11333 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11334 (defun org-check-deadlines (ndays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11335 "Check if there are any deadlines due or past due. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11336 A deadline is considered due if it happens within `org-deadline-warning-days' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11337 days from today's date. If the deadline appears in an entry marked DONE, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11338 it is not shown. The prefix arg NDAYS can be used to test that many |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11339 days. If the prefix is a raw \\[universal-argument] prefix, all deadlines are shown." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11340 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11341 (let* ((org-warn-days |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11342 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11343 ((equal ndays '(4)) 100000) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11344 (ndays (prefix-numeric-value ndays)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11345 (t (abs org-deadline-warning-days)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11346 (case-fold-search nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11347 (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11348 (callback |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11349 (lambda () (org-deadline-close (match-string 1) org-warn-days)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11350 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11351 (message "%d deadlines past-due or due within %d days" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11352 (org-occur regexp nil callback) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11353 org-warn-days))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11354 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11355 (defun org-check-before-date (date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11356 "Check if there are deadlines or scheduled entries before DATE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11357 (interactive (list (org-read-date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11358 (let ((case-fold-search nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11359 (regexp (concat "\\<\\(" org-deadline-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11360 "\\|" org-scheduled-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11361 "\\) *<\\([^>]+\\)>")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11362 (callback |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11363 (lambda () (time-less-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11364 (org-time-string-to-time (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11365 (org-time-string-to-time date))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11366 (message "%d entries before %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11367 (org-occur regexp nil callback) date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11368 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11369 (defun org-evaluate-time-range (&optional to-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11370 "Evaluate a time range by computing the difference between start and end. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11371 Normally the result is just printed in the echo area, but with prefix arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11372 TO-BUFFER, the result is inserted just after the date stamp into the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11373 If the time range is actually in a table, the result is inserted into the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11374 next column. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11375 For time difference computation, a year is assumed to be exactly 365 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11376 days in order to avoid rounding problems." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11377 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11378 (or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11379 (org-clock-update-time-maybe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11380 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11381 (unless (org-at-date-range-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11382 (goto-char (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11383 (re-search-forward org-tr-regexp-both (point-at-eol) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11384 (if (not (org-at-date-range-p t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11385 (error "Not at a time-stamp range, and none found in current line"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11386 (let* ((ts1 (match-string 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11387 (ts2 (match-string 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11388 (havetime (or (> (length ts1) 15) (> (length ts2) 15))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11389 (match-end (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11390 (time1 (org-time-string-to-time ts1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11391 (time2 (org-time-string-to-time ts2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11392 (t1 (time-to-seconds time1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11393 (t2 (time-to-seconds time2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11394 (diff (abs (- t2 t1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11395 (negative (< (- t2 t1) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11396 ;; (ys (floor (* 365 24 60 60))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11397 (ds (* 24 60 60)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11398 (hs (* 60 60)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11399 (fy "%dy %dd %02d:%02d") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11400 (fy1 "%dy %dd") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11401 (fd "%dd %02d:%02d") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11402 (fd1 "%dd") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11403 (fh "%02d:%02d") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11404 y d h m align) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11405 (if havetime |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11406 (setq ; y (floor (/ diff ys)) diff (mod diff ys) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11407 y 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11408 d (floor (/ diff ds)) diff (mod diff ds) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11409 h (floor (/ diff hs)) diff (mod diff hs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11410 m (floor (/ diff 60))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11411 (setq ; y (floor (/ diff ys)) diff (mod diff ys) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11412 y 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11413 d (floor (+ (/ diff ds) 0.5)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11414 h 0 m 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11415 (if (not to-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11416 (message "%s" (org-make-tdiff-string y d h m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11417 (if (org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11418 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11419 (goto-char match-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11420 (setq align t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11421 (and (looking-at " *|") (goto-char (match-end 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11422 (goto-char match-end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11423 (if (looking-at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11424 "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11425 (replace-match "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11426 (if negative (insert " -")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11427 (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11428 (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11429 (insert " " (format fh h m)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11430 (if align (org-table-align)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11431 (message "Time difference inserted"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11432 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11433 (defun org-make-tdiff-string (y d h m) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11434 (let ((fmt "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11435 (l nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11436 (if (> y 0) (setq fmt (concat fmt "%d year" (if (> y 1) "s" "") " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11437 l (push y l))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11438 (if (> d 0) (setq fmt (concat fmt "%d day" (if (> d 1) "s" "") " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11439 l (push d l))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11440 (if (> h 0) (setq fmt (concat fmt "%d hour" (if (> h 1) "s" "") " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11441 l (push h l))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11442 (if (> m 0) (setq fmt (concat fmt "%d minute" (if (> m 1) "s" "") " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11443 l (push m l))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11444 (apply 'format fmt (nreverse l)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11445 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11446 (defun org-time-string-to-time (s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11447 (apply 'encode-time (org-parse-time-string s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11448 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11449 (defun org-time-string-to-absolute (s &optional daynr prefer show-all) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11450 "Convert a time stamp to an absolute day number. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11451 If there is a specifyer for a cyclic time stamp, get the closest date to |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11452 DAYNR. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11453 PREFER and SHOW_ALL are passed through to `org-closest-date'." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11454 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11455 ((and daynr (string-match "\\`%%\\((.*)\\)" s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11456 (if (org-diary-sexp-entry (match-string 1 s) "" date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11457 daynr |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11458 (+ daynr 1000))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11459 ((and daynr (string-match "\\+[0-9]+[dwmy]" s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11460 (org-closest-date s (if (and (boundp 'daynr) (integerp daynr)) daynr |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11461 (time-to-days (current-time))) (match-string 0 s) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11462 prefer show-all)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11463 (t (time-to-days (apply 'encode-time (org-parse-time-string s)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11464 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11465 (defun org-days-to-iso-week (days) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11466 "Return the iso week number." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11467 (require 'cal-iso) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11468 (car (calendar-iso-from-absolute days))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11469 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11470 (defun org-small-year-to-year (year) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11471 "Convert 2-digit years into 4-digit years. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11472 38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2007. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11473 The year 2000 cannot be abbreviated. Any year lager than 99 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11474 is retrned unchanged." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11475 (if (< year 38) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11476 (setq year (+ 2000 year)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11477 (if (< year 100) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11478 (setq year (+ 1900 year)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11479 year) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11480 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11481 (defun org-time-from-absolute (d) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11482 "Return the time corresponding to date D. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11483 D may be an absolute day number, or a calendar-type list (month day year)." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11484 (if (numberp d) (setq d (calendar-gregorian-from-absolute d))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11485 (encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11486 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11487 (defun org-calendar-holiday () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11488 "List of holidays, for Diary display in Org-mode." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11489 (require 'holidays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11490 (let ((hl (funcall |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11491 (if (fboundp 'calendar-check-holidays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11492 'calendar-check-holidays 'check-calendar-holidays) date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11493 (if hl (mapconcat 'identity hl "; ")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11494 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11495 (defun org-diary-sexp-entry (sexp entry date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11496 "Process a SEXP diary ENTRY for DATE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11497 (require 'diary-lib) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11498 (let ((result (if calendar-debug-sexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11499 (let ((stack-trace-on-error t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11500 (eval (car (read-from-string sexp)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11501 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11502 (eval (car (read-from-string sexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11503 (error |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11504 (beep) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11505 (message "Bad sexp at line %d in %s: %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11506 (org-current-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11507 (buffer-file-name) sexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11508 (sleep-for 2)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11509 (cond ((stringp result) result) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11510 ((and (consp result) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11511 (stringp (cdr result))) (cdr result)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11512 (result entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11513 (t nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11514 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11515 (defun org-diary-to-ical-string (frombuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11516 "Get iCalendar entries from diary entries in buffer FROMBUF. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11517 This uses the icalendar.el library." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11518 (let* ((tmpdir (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11519 (temp-directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11520 temporary-file-directory)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11521 (tmpfile (make-temp-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11522 (expand-file-name "orgics" tmpdir))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11523 buf rtn b e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11524 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11525 (set-buffer frombuf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11526 (icalendar-export-region (point-min) (point-max) tmpfile) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11527 (setq buf (find-buffer-visiting tmpfile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11528 (set-buffer buf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11529 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11530 (if (re-search-forward "^BEGIN:VEVENT" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11531 (setq b (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11532 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11533 (if (re-search-backward "^END:VEVENT" nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11534 (setq e (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11535 (setq rtn (if (and b e) (concat (buffer-substring b e) "\n") ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11536 (kill-buffer buf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11537 (delete-file tmpfile) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11538 rtn)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11539 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11540 (defun org-closest-date (start current change prefer show-all) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11541 "Find the date closest to CURRENT that is consistent with START and CHANGE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11542 When PREFER is `past' return a date that is either CURRENT or past. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11543 When PREFER is `future', return a date that is either CURRENT or future. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11544 When SHOW-ALL is nil, only return the current occurence of a time stamp." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11545 ;; Make the proper lists from the dates |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11546 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11547 (let ((a1 '(("d" . day) ("w" . week) ("m" . month) ("y" . year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11548 dn dw sday cday n1 n2 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11549 d m y y1 y2 date1 date2 nmonths nm ny m2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11550 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11551 (setq start (org-date-to-gregorian start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11552 current (org-date-to-gregorian |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11553 (if show-all |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11554 current |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11555 (time-to-days (current-time)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11556 sday (calendar-absolute-from-gregorian start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11557 cday (calendar-absolute-from-gregorian current)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11558 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11559 (if (<= cday sday) (throw 'exit sday)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11560 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11561 (if (string-match "\\(\\+[0-9]+\\)\\([dwmy]\\)" change) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11562 (setq dn (string-to-number (match-string 1 change)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11563 dw (cdr (assoc (match-string 2 change) a1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11564 (error "Invalid change specifyer: %s" change)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11565 (if (eq dw 'week) (setq dw 'day dn (* 7 dn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11566 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11567 ((eq dw 'day) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11568 (setq n1 (+ sday (* dn (floor (/ (- cday sday) dn)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11569 n2 (+ n1 dn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11570 ((eq dw 'year) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11571 (setq d (nth 1 start) m (car start) y1 (nth 2 start) y2 (nth 2 current)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11572 (setq y1 (+ (* (floor (/ (- y2 y1) dn)) dn) y1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11573 (setq date1 (list m d y1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11574 n1 (calendar-absolute-from-gregorian date1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11575 date2 (list m d (+ y1 (* (if (< n1 cday) 1 -1) dn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11576 n2 (calendar-absolute-from-gregorian date2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11577 ((eq dw 'month) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11578 ;; approx number of month between the two dates |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11579 (setq nmonths (floor (/ (- cday sday) 30.436875))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11580 ;; How often does dn fit in there? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11581 (setq d (nth 1 start) m (car start) y (nth 2 start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11582 nm (* dn (max 0 (1- (floor (/ nmonths dn))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11583 m (+ m nm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11584 ny (floor (/ m 12)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11585 y (+ y ny) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11586 m (- m (* ny 12))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11587 (while (> m 12) (setq m (- m 12) y (1+ y))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11588 (setq n1 (calendar-absolute-from-gregorian (list m d y))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11589 (setq m2 (+ m dn) y2 y) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11590 (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11591 (setq n2 (calendar-absolute-from-gregorian (list m2 d y2))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11592 (while (<= n2 cday) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11593 (setq n1 n2 m m2 y y2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11594 (setq m2 (+ m dn) y2 y) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11595 (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11596 (setq n2 (calendar-absolute-from-gregorian (list m2 d y2)))))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11597 (if show-all |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11598 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11599 ((eq prefer 'past) n1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11600 ((eq prefer 'future) (if (= cday n1) n1 n2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11601 (t (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11602 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11603 ((eq prefer 'past) n1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11604 ((eq prefer 'future) (if (= cday n1) n1 n2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11605 (t (if (= cday n1) n1 n2))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11606 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11607 (defun org-date-to-gregorian (date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11608 "Turn any specification of DATE into a gregorian date for the calendar." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11609 (cond ((integerp date) (calendar-gregorian-from-absolute date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11610 ((and (listp date) (= (length date) 3)) date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11611 ((stringp date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11612 (setq date (org-parse-time-string date)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11613 (list (nth 4 date) (nth 3 date) (nth 5 date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11614 ((listp date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11615 (list (nth 4 date) (nth 3 date) (nth 5 date))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11616 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11617 (defun org-parse-time-string (s &optional nodefault) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11618 "Parse the standard Org-mode time string. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11619 This should be a lot faster than the normal `parse-time-string'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11620 If time is not given, defaults to 0:00. However, with optional NODEFAULT, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11621 hour and minute fields will be nil if not given." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11622 (if (string-match org-ts-regexp0 s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11623 (list 0 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11624 (if (or (match-beginning 8) (not nodefault)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11625 (string-to-number (or (match-string 8 s) "0"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11626 (if (or (match-beginning 7) (not nodefault)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11627 (string-to-number (or (match-string 7 s) "0"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11628 (string-to-number (match-string 4 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11629 (string-to-number (match-string 3 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11630 (string-to-number (match-string 2 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11631 nil nil nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11632 (make-list 9 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11633 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11634 (defun org-timestamp-up (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11635 "Increase the date item at the cursor by one. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11636 If the cursor is on the year, change the year. If it is on the month or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11637 the day, change that. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11638 With prefix ARG, change by that many units." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11639 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11640 (org-timestamp-change (prefix-numeric-value arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11641 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11642 (defun org-timestamp-down (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11643 "Decrease the date item at the cursor by one. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11644 If the cursor is on the year, change the year. If it is on the month or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11645 the day, change that. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11646 With prefix ARG, change by that many units." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11647 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11648 (org-timestamp-change (- (prefix-numeric-value arg)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11649 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11650 (defun org-timestamp-up-day (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11651 "Increase the date in the time stamp by one day. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11652 With prefix ARG, change that many days." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11653 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11654 (if (and (not (org-at-timestamp-p t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11655 (org-on-heading-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11656 (org-todo 'up) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11657 (org-timestamp-change (prefix-numeric-value arg) 'day))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11658 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11659 (defun org-timestamp-down-day (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11660 "Decrease the date in the time stamp by one day. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11661 With prefix ARG, change that many days." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11662 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11663 (if (and (not (org-at-timestamp-p t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11664 (org-on-heading-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11665 (org-todo 'down) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11666 (org-timestamp-change (- (prefix-numeric-value arg)) 'day))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11667 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11668 (defun org-at-timestamp-p (&optional inactive-ok) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11669 "Determine if the cursor is in or at a timestamp." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11670 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11671 (let* ((tsr (if inactive-ok org-ts-regexp3 org-ts-regexp2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11672 (pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11673 (ans (or (looking-at tsr) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11674 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11675 (skip-chars-backward "^[<\n\r\t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11676 (if (> (point) (point-min)) (backward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11677 (and (looking-at tsr) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11678 (> (- (match-end 0) pos) -1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11679 (and ans |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11680 (boundp 'org-ts-what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11681 (setq org-ts-what |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11682 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11683 ((= pos (match-beginning 0)) 'bracket) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11684 ((= pos (1- (match-end 0))) 'bracket) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11685 ((org-pos-in-match-range pos 2) 'year) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11686 ((org-pos-in-match-range pos 3) 'month) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11687 ((org-pos-in-match-range pos 7) 'hour) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11688 ((org-pos-in-match-range pos 8) 'minute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11689 ((or (org-pos-in-match-range pos 4) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11690 (org-pos-in-match-range pos 5)) 'day) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11691 ((and (> pos (or (match-end 8) (match-end 5))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11692 (< pos (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11693 (- pos (or (match-end 8) (match-end 5)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11694 (t 'day)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11695 ans)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11696 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11697 (defun org-toggle-timestamp-type () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11698 "Toggle the type (<active> or [inactive]) of a time stamp." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11699 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11700 (when (org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11701 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11702 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11703 (insert (if (equal (char-after) ?<) "[" "<")) (delete-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11704 (goto-char (1- (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11705 (insert (if (equal (char-after) ?>) "]" ">")) (delete-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11706 (message "Timestamp is now %sactive" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11707 (if (equal (char-before) ?>) "in" "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11708 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11709 (defun org-timestamp-change (n &optional what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11710 "Change the date in the time stamp at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11711 The date will be changed by N times WHAT. WHAT can be `day', `month', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11712 `year', `minute', `second'. If WHAT is not given, the cursor position |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11713 in the timestamp determines what will be changed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11714 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11715 with-hm inactive |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11716 (dm (max (nth 1 org-time-stamp-rounding-minutes) 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11717 org-ts-what |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11718 extra rem |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11719 ts time time0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11720 (if (not (org-at-timestamp-p t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11721 (error "Not at a timestamp")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11722 (if (and (not what) (eq org-ts-what 'bracket)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11723 (org-toggle-timestamp-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11724 (if (and (not what) (not (eq org-ts-what 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11725 org-display-custom-times |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11726 (get-text-property (point) 'display) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11727 (not (get-text-property (1- (point)) 'display))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11728 (setq org-ts-what 'day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11729 (setq org-ts-what (or what org-ts-what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11730 inactive (= (char-after (match-beginning 0)) ?\[) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11731 ts (match-string 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11732 (replace-match "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11733 (if (string-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11734 "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( +[.+]?[-+][0-9]+[dwmy]\\)*\\)[]>]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11735 ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11736 (setq extra (match-string 1 ts))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11737 (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11738 (setq with-hm t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11739 (setq time0 (org-parse-time-string ts)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11740 (when (and (eq org-ts-what 'minute) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11741 (eq current-prefix-arg nil)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11742 (setq n (* dm (cond ((> n 0) 1) ((< n 0) -1) (t 0)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11743 (when (not (= 0 (setq rem (% (nth 1 time0) dm)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11744 (setcar (cdr time0) (+ (nth 1 time0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11745 (if (> n 0) (- rem) (- dm rem)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11746 (setq time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11747 (encode-time (or (car time0) 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11748 (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11749 (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11750 (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11751 (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11752 (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11753 (nthcdr 6 time0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11754 (when (integerp org-ts-what) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11755 (setq extra (org-modify-ts-extra extra org-ts-what n dm))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11756 (if (eq what 'calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11757 (let ((cal-date (org-get-date-from-calendar))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11758 (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11759 (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11760 (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11761 (setcar time0 (or (car time0) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11762 (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11763 (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11764 (setq time (apply 'encode-time time0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11765 (setq org-last-changed-timestamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11766 (org-insert-time-stamp time with-hm inactive nil nil extra)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11767 (org-clock-update-time-maybe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11768 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11769 ;; Try to recenter the calendar window, if any |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11770 (if (and org-calendar-follow-timestamp-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11771 (get-buffer-window "*Calendar*" t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11772 (memq org-ts-what '(day month year))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11773 (org-recenter-calendar (time-to-days time)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11774 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11775 (defun org-modify-ts-extra (s pos n dm) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11776 "Change the different parts of the lead-time and repeat fields in timestamp." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11777 (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11778 ng h m new rem) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11779 (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( +\\+\\([0-9]+\\)\\([dmwy]\\)\\)?\\( +-\\([0-9]+\\)\\([dmwy]\\)\\)?" s) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11780 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11781 ((or (org-pos-in-match-range pos 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11782 (org-pos-in-match-range pos 3)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11783 (setq m (string-to-number (match-string 3 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11784 h (string-to-number (match-string 2 s))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11785 (if (org-pos-in-match-range pos 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11786 (setq h (+ h n)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11787 (setq n (* dm (org-no-warnings (signum n)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11788 (when (not (= 0 (setq rem (% m dm)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11789 (setq m (+ m (if (> n 0) (- rem) (- dm rem))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11790 (setq m (+ m n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11791 (if (< m 0) (setq m (+ m 60) h (1- h))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11792 (if (> m 59) (setq m (- m 60) h (1+ h))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11793 (setq h (min 24 (max 0 h))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11794 (setq ng 1 new (format "-%02d:%02d" h m))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11795 ((org-pos-in-match-range pos 6) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11796 (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11797 ((org-pos-in-match-range pos 5) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11798 (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11799 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11800 ((org-pos-in-match-range pos 9) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11801 (setq ng 9 new (car (rassoc (+ n (cdr (assoc (match-string 9 s) idx))) idx)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11802 ((org-pos-in-match-range pos 8) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11803 (setq ng 8 new (format "%d" (max 0 (+ n (string-to-number (match-string 8 s)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11804 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11805 (when ng |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11806 (setq s (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11807 (substring s 0 (match-beginning ng)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11808 new |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11809 (substring s (match-end ng)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11810 s)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11811 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11812 (defun org-recenter-calendar (date) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11813 "If the calendar is visible, recenter it to DATE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11814 (let* ((win (selected-window)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11815 (cwin (get-buffer-window "*Calendar*" t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11816 (calendar-move-hook nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11817 (when cwin |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11818 (select-window cwin) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11819 (calendar-goto-date (if (listp date) date |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11820 (calendar-gregorian-from-absolute date))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11821 (select-window win)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11822 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11823 (defun org-goto-calendar (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11824 "Go to the Emacs calendar at the current date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11825 If there is a time stamp in the current line, go to that date. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11826 A prefix ARG can be used to force the current date." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11827 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11828 (let ((tsr org-ts-regexp) diff |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11829 (calendar-move-hook nil) |
93810
ba0874919ac4
(org-agenda-format-date-aligned, org-agenda-execute-calendar-command):
Glenn Morris <rgm@gnu.org>
parents:
93141
diff
changeset
|
11830 (calendar-view-holidays-initially-flag nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11831 (view-calendar-holidays-initially nil) |
93810
ba0874919ac4
(org-agenda-format-date-aligned, org-agenda-execute-calendar-command):
Glenn Morris <rgm@gnu.org>
parents:
93141
diff
changeset
|
11832 (calendar-view-diary-initially-flag nil) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11833 (view-diary-entries-initially nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11834 (if (or (org-at-timestamp-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11835 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11836 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11837 (looking-at (concat ".*" tsr)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11838 (let ((d1 (time-to-days (current-time))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11839 (d2 (time-to-days |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11840 (org-time-string-to-time (match-string 1))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11841 (setq diff (- d2 d1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11842 (calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11843 (calendar-goto-today) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11844 (if (and diff (not arg)) (calendar-forward-day diff)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11845 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11846 (defun org-get-date-from-calendar () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11847 "Return a list (month day year) of date at point in calendar." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11848 (with-current-buffer "*Calendar*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11849 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11850 (calendar-cursor-to-date)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11851 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11852 (defun org-date-from-calendar () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11853 "Insert time stamp corresponding to cursor date in *Calendar* buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11854 If there is already a time stamp at the cursor position, update it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11855 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11856 (if (org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11857 (org-timestamp-change 0 'calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11858 (let ((cal-date (org-get-date-from-calendar))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11859 (org-insert-time-stamp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11860 (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11861 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11862 (defun org-minutes-to-hh:mm-string (m) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11863 "Compute H:MM from a number of minutes." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11864 (let ((h (/ m 60))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11865 (setq m (- m (* 60 h))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
11866 (format org-time-clocksum-format h m))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11867 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11868 (defun org-hh:mm-string-to-minutes (s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11869 "Convert a string H:MM to a number of minutes." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11870 (if (string-match "\\([0-9]+\\):\\([0-9]+\\)" s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11871 (+ (* (string-to-number (match-string 1 s)) 60) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11872 (string-to-number (match-string 2 s))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11873 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11874 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11875 ;;;; Agenda files |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11876 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11877 ;;;###autoload |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11878 (defun org-iswitchb (&optional arg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11879 "Use `iswitchb-read-buffer' to prompt for an Org buffer to switch to. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11880 With a prefix argument, restrict available to files. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11881 With two prefix arguments, restrict available buffers to agenda files. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11882 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11883 Due to some yet unresolved reason, global function |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11884 `iswitchb-mode' needs to be active for this function to work." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11885 (interactive "P") |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11886 (require 'iswitchb) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11887 (let ((enabled iswitchb-mode) blist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11888 (or enabled (iswitchb-mode 1)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11889 (setq blist (cond ((equal arg '(4)) (org-buffer-list 'files)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11890 ((equal arg '(16)) (org-buffer-list 'agenda)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11891 (t (org-buffer-list)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11892 (unwind-protect |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11893 (let ((iswitchb-make-buflist-hook |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11894 (lambda () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11895 (setq iswitchb-temp-buflist |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11896 (mapcar 'buffer-name blist))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11897 (switch-to-buffer |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11898 (iswitchb-read-buffer |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11899 "Switch-to: " nil t)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11900 (or enabled (iswitchb-mode -1)))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11901 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11902 (defun org-buffer-list (&optional predicate tmp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11903 "Return a list of Org buffers. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11904 PREDICATE can be either 'export, 'files or 'agenda. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11905 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11906 'export restrict the list to Export buffers. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11907 'files restrict the list to buffers visiting Org files. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11908 'agenda restrict the list to buffers visiting agenda files. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11909 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11910 If TMP is non-nil, don't include temporary buffers." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11911 (let (filter blist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11912 (setq filter |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11913 (cond ((eq predicate 'files) "\.org$") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11914 ((eq predicate 'export) "\*Org .*Export") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11915 (t "\*Org \\|\.org$"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11916 (setq blist |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11917 (mapcar |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11918 (lambda(b) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11919 (let ((bname (buffer-name b)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11920 (bfile (buffer-file-name b))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11921 (if (and (string-match filter bname) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11922 (if (eq predicate 'agenda) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11923 (member bfile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11924 (mapcar (lambda(f) (file-truename f)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11925 org-agenda-files)) t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11926 (if tmp (not (string-match "tmp" bname)) t)) b))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11927 (buffer-list))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11928 (delete nil blist))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11929 |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11930 (defun org-agenda-files (&optional unrestricted archives) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11931 "Get the list of agenda files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11932 Optional UNRESTRICTED means return the full list even if a restriction |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11933 is currently in place. |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11934 When ARCHIVES is t, include all archive files hat are really being |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11935 used by the agenda files. If ARCHIVE is `ifmode', do this only if |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11936 `org-agenda-archives-mode' is t." |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11937 (let ((files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11938 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11939 ((and (not unrestricted) (get 'org-agenda-files 'org-restrict))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11940 ((stringp org-agenda-files) (org-read-agenda-file-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11941 ((listp org-agenda-files) org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11942 (t (error "Invalid value of `org-agenda-files'"))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11943 (setq files (apply 'append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11944 (mapcar (lambda (f) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11945 (if (file-directory-p f) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11946 (directory-files |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11947 f t org-agenda-file-regexp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11948 (list f))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11949 files))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11950 (when org-agenda-skip-unavailable-files |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11951 (setq files (delq nil |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11952 (mapcar (function |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11953 (lambda (file) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11954 (and (file-readable-p file) file))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11955 files)))) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11956 (when (or (eq archives t) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11957 (and (eq archives 'ifmode) (eq org-agenda-archives-mode t))) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
11958 (setq files (org-add-archive-files files))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11959 files)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11960 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11961 (defun org-edit-agenda-file-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11962 "Edit the list of agenda files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11963 Depending on setup, this either uses customize to edit the variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11964 `org-agenda-files', or it visits the file that is holding the list. In the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11965 latter case, the buffer is set up in a way that saving it automatically kills |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11966 the buffer and restores the previous window configuration." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11967 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11968 (if (stringp org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11969 (let ((cw (current-window-configuration))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11970 (find-file org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11971 (org-set-local 'org-window-configuration cw) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11972 (org-add-hook 'after-save-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11973 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11974 (set-window-configuration |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11975 (prog1 org-window-configuration |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11976 (kill-buffer (current-buffer)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11977 (org-install-agenda-files-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11978 (message "New agenda file list installed")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11979 nil 'local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11980 (message "%s" (substitute-command-keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11981 "Edit list and finish with \\[save-buffer]"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11982 (customize-variable 'org-agenda-files))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11983 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11984 (defun org-store-new-agenda-file-list (list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11985 "Set new value for the agenda file list and save it correcly." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11986 (if (stringp org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11987 (let ((f org-agenda-files) b) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11988 (while (setq b (find-buffer-visiting f)) (kill-buffer b)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11989 (with-temp-file f |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11990 (insert (mapconcat 'identity list "\n") "\n"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11991 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11992 (setq org-agenda-files list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11993 (customize-save-variable 'org-agenda-files org-agenda-files)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11994 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11995 (defun org-read-agenda-file-list () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11996 "Read the list of agenda files from a file." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11997 (when (file-directory-p org-agenda-files) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
11998 (error "`org-agenda-files' cannot be a single directory")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11999 (when (stringp org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12000 (with-temp-buffer |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12001 (insert-file-contents org-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12002 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12003 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12004 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12005 ;;;###autoload |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12006 (defun org-cycle-agenda-files () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12007 "Cycle through the files in `org-agenda-files'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12008 If the current buffer visits an agenda file, find the next one in the list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12009 If the current buffer does not, find the first agenda file." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12010 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12011 (let* ((fs (org-agenda-files t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12012 (files (append fs (list (car fs)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12013 (tcf (if buffer-file-name (file-truename buffer-file-name))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12014 file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12015 (unless files (error "No agenda files")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12016 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12017 (while (setq file (pop files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12018 (if (equal (file-truename file) tcf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12019 (when (car files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12020 (find-file (car files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12021 (throw 'exit t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12022 (find-file (car fs))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12023 (if (buffer-base-buffer) (switch-to-buffer (buffer-base-buffer))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12024 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12025 (defun org-agenda-file-to-front (&optional to-end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12026 "Move/add the current file to the top of the agenda file list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12027 If the file is not present in the list, it is added to the front. If it is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12028 present, it is moved there. With optional argument TO-END, add/move to the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12029 end of the list." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12030 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12031 (let ((org-agenda-skip-unavailable-files nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12032 (file-alist (mapcar (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12033 (cons (file-truename x) x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12034 (org-agenda-files t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12035 (ctf (file-truename buffer-file-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12036 x had) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12037 (setq x (assoc ctf file-alist) had x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12038 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12039 (if (not x) (setq x (cons ctf (abbreviate-file-name buffer-file-name)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12040 (if to-end |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12041 (setq file-alist (append (delq x file-alist) (list x))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12042 (setq file-alist (cons x (delq x file-alist)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12043 (org-store-new-agenda-file-list (mapcar 'cdr file-alist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12044 (org-install-agenda-files-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12045 (message "File %s to %s of agenda file list" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12046 (if had "moved" "added") (if to-end "end" "front")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12047 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12048 (defun org-remove-file (&optional file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12049 "Remove current file from the list of files in variable `org-agenda-files'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12050 These are the files which are being checked for agenda entries. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12051 Optional argument FILE means, use this file instead of the current." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12052 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12053 (let* ((org-agenda-skip-unavailable-files nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12054 (file (or file buffer-file-name)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12055 (true-file (file-truename file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12056 (afile (abbreviate-file-name file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12057 (files (delq nil (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12058 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12059 (if (equal true-file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12060 (file-truename x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12061 nil x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12062 (org-agenda-files t))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12063 (if (not (= (length files) (length (org-agenda-files t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12064 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12065 (org-store-new-agenda-file-list files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12066 (org-install-agenda-files-menu) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12067 (message "Removed file: %s" afile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12068 (message "File was not in list: %s (not removed)" afile)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12069 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12070 (defun org-file-menu-entry (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12071 (vector file (list 'find-file file) t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12072 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12073 (defun org-check-agenda-file (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12074 "Make sure FILE exists. If not, ask user what to do." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12075 (when (not (file-exists-p file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12076 (message "non-existent file %s. [R]emove from list or [A]bort?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12077 (abbreviate-file-name file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12078 (let ((r (downcase (read-char-exclusive)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12079 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12080 ((equal r ?r) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12081 (org-remove-file file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12082 (throw 'nextfile t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12083 (t (error "Abort")))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12084 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12085 (defun org-get-agenda-file-buffer (file) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12086 "Get a buffer visiting FILE. If the buffer needs to be created, add |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12087 it to the list of buffers which might be released later." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12088 (let ((buf (org-find-base-buffer-visiting file))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12089 (if buf |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12090 buf ; just return it |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12091 ;; Make a new buffer and remember it |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12092 (setq buf (find-file-noselect file)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12093 (if buf (push buf org-agenda-new-buffers)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12094 buf))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12095 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12096 (defun org-release-buffers (blist) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12097 "Release all buffers in list, asking the user for confirmation when needed. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12098 When a buffer is unmodified, it is just killed. When modified, it is saved |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12099 \(if the user agrees) and then killed." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12100 (let (buf file) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12101 (while (setq buf (pop blist)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12102 (setq file (buffer-file-name buf)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12103 (when (and (buffer-modified-p buf) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12104 file |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12105 (y-or-n-p (format "Save file %s? " file))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12106 (with-current-buffer buf (save-buffer))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12107 (kill-buffer buf)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12108 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12109 (defun org-prepare-agenda-buffers (files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12110 "Create buffers for all agenda files, protect archived trees and comments." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12111 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12112 (let ((pa '(:org-archived t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12113 (pc '(:org-comment t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12114 (pall '(:org-archived t :org-comment t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12115 (inhibit-read-only t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12116 (rea (concat ":" org-archive-tag ":")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12117 bmp file re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12118 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12119 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12120 (while (setq file (pop files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12121 (if (bufferp file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12122 (set-buffer file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12123 (org-check-agenda-file file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12124 (set-buffer (org-get-agenda-file-buffer file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12125 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12126 (setq bmp (buffer-modified-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12127 (org-refresh-category-properties) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12128 (setq org-todo-keywords-for-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12129 (append org-todo-keywords-for-agenda org-todo-keywords-1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12130 (setq org-done-keywords-for-agenda |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12131 (append org-done-keywords-for-agenda org-done-keywords)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12132 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12133 (remove-text-properties (point-min) (point-max) pall) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12134 (when org-agenda-skip-archived-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12135 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12136 (while (re-search-forward rea nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12137 (if (org-on-heading-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12138 (add-text-properties (point-at-bol) (org-end-of-subtree t) pa)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12139 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12140 (setq re (concat "^\\*+ +" org-comment-string "\\>")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12141 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12142 (add-text-properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12143 (match-beginning 0) (org-end-of-subtree t) pc))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12144 (set-buffer-modified-p bmp)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12145 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12146 ;;;; Embedded LaTeX |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12147 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12148 (defvar org-cdlatex-mode-map (make-sparse-keymap) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12149 "Keymap for the minor `org-cdlatex-mode'.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12150 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12151 (org-defkey org-cdlatex-mode-map "_" 'org-cdlatex-underscore-caret) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12152 (org-defkey org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12153 (org-defkey org-cdlatex-mode-map "`" 'cdlatex-math-symbol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12154 (org-defkey org-cdlatex-mode-map "'" 'org-cdlatex-math-modify) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12155 (org-defkey org-cdlatex-mode-map "\C-c{" 'cdlatex-environment) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12156 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12157 (defvar org-cdlatex-texmathp-advice-is-done nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12158 "Flag remembering if we have applied the advice to texmathp already.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12159 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12160 (define-minor-mode org-cdlatex-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12161 "Toggle the minor `org-cdlatex-mode'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12162 This mode supports entering LaTeX environment and math in LaTeX fragments |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12163 in Org-mode. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12164 \\{org-cdlatex-mode-map}" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12165 nil " OCDL" nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12166 (when org-cdlatex-mode (require 'cdlatex)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12167 (unless org-cdlatex-texmathp-advice-is-done |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12168 (setq org-cdlatex-texmathp-advice-is-done t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12169 (defadvice texmathp (around org-math-always-on activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12170 "Always return t in org-mode buffers. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12171 This is because we want to insert math symbols without dollars even outside |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12172 the LaTeX math segments. If Orgmode thinks that point is actually inside |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12173 en embedded LaTeX fragement, let texmathp do its job. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12174 \\[org-cdlatex-mode-map]" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12175 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12176 (let (p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12177 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12178 ((not (org-mode-p)) ad-do-it) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12179 ((eq this-command 'cdlatex-math-symbol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12180 (setq ad-return-value t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12181 texmathp-why '("cdlatex-math-symbol in org-mode" . 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12182 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12183 (let ((p (org-inside-LaTeX-fragment-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12184 (if (and p (member (car p) (plist-get org-format-latex-options :matchers))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12185 (setq ad-return-value t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12186 texmathp-why '("Org-mode embedded math" . 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12187 (if p ad-do-it))))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12188 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12189 (defun turn-on-org-cdlatex () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12190 "Unconditionally turn on `org-cdlatex-mode'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12191 (org-cdlatex-mode 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12192 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12193 (defun org-inside-LaTeX-fragment-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12194 "Test if point is inside a LaTeX fragment. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12195 I.e. after a \\begin, \\(, \\[, $, or $$, without the corresponding closing |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12196 sequence appearing also before point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12197 Even though the matchers for math are configurable, this function assumes |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12198 that \\begin, \\(, \\[, and $$ are always used. Only the single dollar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12199 delimiters are skipped when they have been removed by customization. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12200 The return value is nil, or a cons cell with the delimiter and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12201 and the position of this delimiter. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12202 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12203 This function does a reasonably good job, but can locally be fooled by |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12204 for example currency specifications. For example it will assume being in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12205 inline math after \"$22.34\". The LaTeX fragment formatter will only format |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12206 fragments that are properly closed, but during editing, we have to live |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12207 with the uncertainty caused by missing closing delimiters. This function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12208 looks only before point, not after." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12209 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12210 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12211 (dodollar (member "$" (plist-get org-format-latex-options :matchers))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12212 (lim (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12213 (re-search-backward (concat "^\\(" paragraph-start "\\)") nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12214 (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12215 dd-on str (start 0) m re) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12216 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12217 (when dodollar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12218 (setq str (concat (buffer-substring lim (point)) "\000 X$.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12219 re (nth 1 (assoc "$" org-latex-regexps))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12220 (while (string-match re str start) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12221 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12222 ((= (match-end 0) (length str)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12223 (throw 'exit (cons "$" (+ lim (match-beginning 0) 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12224 ((= (match-end 0) (- (length str) 5)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12225 (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12226 (t (setq start (match-end 0)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12227 (when (setq m (re-search-backward "\\(\\\\begin{[^}]*}\\|\\\\(\\|\\\\\\[\\)\\|\\(\\\\end{[^}]*}\\|\\\\)\\|\\\\\\]\\)\\|\\(\\$\\$\\)" lim t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12228 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12229 (and (match-beginning 1) (throw 'exit (cons (match-string 1) m))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12230 (and (match-beginning 2) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12231 ;; count $$ |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12232 (while (re-search-backward "\\$\\$" lim t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12233 (setq dd-on (not dd-on))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12234 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12235 (if dd-on (cons "$$" m)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12236 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12237 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12238 (defun org-try-cdlatex-tab () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12239 "Check if it makes sense to execute `cdlatex-tab', and do it if yes. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12240 It makes sense to do so if `org-cdlatex-mode' is active and if the cursor is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12241 - inside a LaTeX fragment, or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12242 - after the first word in a line, where an abbreviation expansion could |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12243 insert a LaTeX environment." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12244 (when org-cdlatex-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12245 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12246 ((save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12247 (skip-chars-backward "a-zA-Z0-9*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12248 (skip-chars-backward " \t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12249 (bolp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12250 (cdlatex-tab) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12251 ((org-inside-LaTeX-fragment-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12252 (cdlatex-tab) t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12253 (t nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12254 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12255 (defun org-cdlatex-underscore-caret (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12256 "Execute `cdlatex-sub-superscript' in LaTeX fragments. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12257 Revert to the normal definition outside of these fragments." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12258 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12259 (if (org-inside-LaTeX-fragment-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12260 (call-interactively 'cdlatex-sub-superscript) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12261 (let (org-cdlatex-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12262 (call-interactively (key-binding (vector last-input-event)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12263 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12264 (defun org-cdlatex-math-modify (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12265 "Execute `cdlatex-math-modify' in LaTeX fragments. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12266 Revert to the normal definition outside of these fragments." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12267 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12268 (if (org-inside-LaTeX-fragment-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12269 (call-interactively 'cdlatex-math-modify) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12270 (let (org-cdlatex-mode) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12271 (call-interactively (key-binding (vector last-input-event)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12272 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12273 (defvar org-latex-fragment-image-overlays nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12274 "List of overlays carrying the images of latex fragments.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12275 (make-variable-buffer-local 'org-latex-fragment-image-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12276 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12277 (defun org-remove-latex-fragment-image-overlays () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12278 "Remove all overlays with LaTeX fragment images in current buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12279 (mapc 'org-delete-overlay org-latex-fragment-image-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12280 (setq org-latex-fragment-image-overlays nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12281 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12282 (defun org-preview-latex-fragment (&optional subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12283 "Preview the LaTeX fragment at point, or all locally or globally. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12284 If the cursor is in a LaTeX fragment, create the image and overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12285 it over the source code. If there is no fragment at point, display |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12286 all fragments in the current text, from one headline to the next. With |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12287 prefix SUBTREE, display all fragments in the current subtree. With a |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12288 double prefix `C-u C-u', or when the cursor is before the first headline, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12289 display all fragments in the buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12290 The images can be removed again with \\[org-ctrl-c-ctrl-c]." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12291 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12292 (org-remove-latex-fragment-image-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12293 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12294 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12295 (let (beg end at msg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12296 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12297 ((or (equal subtree '(16)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12298 (not (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12299 (re-search-backward (concat "^" outline-regexp) nil t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12300 (setq beg (point-min) end (point-max) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12301 msg "Creating images for buffer...%s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12302 ((equal subtree '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12303 (org-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12304 (setq beg (point) end (org-end-of-subtree t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12305 msg "Creating images for subtree...%s")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12306 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12307 (if (setq at (org-inside-LaTeX-fragment-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12308 (goto-char (max (point-min) (- (cdr at) 2))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12309 (org-back-to-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12310 (setq beg (point) end (progn (outline-next-heading) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12311 msg (if at "Creating image...%s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12312 "Creating images for entry...%s")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12313 (message msg "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12314 (narrow-to-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12315 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12316 (org-format-latex |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12317 (concat "ltxpng/" (file-name-sans-extension |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12318 (file-name-nondirectory |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12319 buffer-file-name))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12320 default-directory 'overlays msg at 'forbuffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12321 (message msg "done. Use `C-c C-c' to remove images."))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12322 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12323 (defvar org-latex-regexps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12324 '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12325 ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12326 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12327 ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([ .,?;:'\")\000]\\|$\\)" 2 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12328 ("\\(" "\\\\([^\000]*?\\\\)" 0 nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12329 ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12330 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12331 "Regular expressions for matching embedded LaTeX.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12332 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12333 (defun org-format-latex (prefix &optional dir overlays msg at forbuffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12334 "Replace LaTeX fragments with links to an image, and produce images." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12335 (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12336 (let* ((prefixnodir (file-name-nondirectory prefix)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12337 (absprefix (expand-file-name prefix dir)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12338 (todir (file-name-directory absprefix)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12339 (opt org-format-latex-options) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12340 (matchers (plist-get opt :matchers)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12341 (re-list org-latex-regexps) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12342 (cnt 0) txt link beg end re e checkdir |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12343 m n block linkfile movefile ov) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12344 ;; Check if there are old images files with this prefix, and remove them |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12345 (when (file-directory-p todir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12346 (mapc 'delete-file |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12347 (directory-files |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12348 todir 'full |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12349 (concat (regexp-quote prefixnodir) "_[0-9]+\\.png$")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12350 ;; Check the different regular expressions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12351 (while (setq e (pop re-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12352 (setq m (car e) re (nth 1 e) n (nth 2 e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12353 block (if (nth 3 e) "\n\n" "")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12354 (when (member m matchers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12355 (goto-char (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12356 (while (re-search-forward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12357 (when (or (not at) (equal (cdr at) (match-beginning n))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12358 (setq txt (match-string n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12359 beg (match-beginning n) end (match-end n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12360 cnt (1+ cnt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12361 linkfile (format "%s_%04d.png" prefix cnt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12362 movefile (format "%s_%04d.png" absprefix cnt) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12363 link (concat block "[[file:" linkfile "]]" block)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12364 (if msg (message msg cnt)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12365 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12366 (unless checkdir ; make sure the directory exists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12367 (setq checkdir t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12368 (or (file-directory-p todir) (make-directory todir))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12369 (org-create-formula-image |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12370 txt movefile opt forbuffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12371 (if overlays |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12372 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12373 (setq ov (org-make-overlay beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12374 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12375 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12376 (org-overlay-put ov 'invisible t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12377 (org-overlay-put |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12378 ov 'end-glyph |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12379 (make-glyph (vector 'png :file movefile)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12380 (org-overlay-put |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12381 ov 'display |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12382 (list 'image :type 'png :file movefile :ascent 'center))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12383 (push ov org-latex-fragment-image-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12384 (goto-char end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12385 (delete-region beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12386 (insert link)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12387 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12388 ;; This function borrows from Ganesh Swami's latex2png.el |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12389 (defun org-create-formula-image (string tofile options buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12390 (let* ((tmpdir (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12391 (temp-directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12392 temporary-file-directory)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12393 (texfilebase (make-temp-name |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12394 (expand-file-name "orgtex" tmpdir))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12395 (texfile (concat texfilebase ".tex")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12396 (dvifile (concat texfilebase ".dvi")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12397 (pngfile (concat texfilebase ".png")) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12398 (fnh (if (featurep 'xemacs) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12399 (font-height (get-face-font 'default)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12400 (face-attribute 'default :height nil))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12401 (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12402 (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12403 (fg (or (plist-get options (if buffer :foreground :html-foreground)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12404 "Black")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12405 (bg (or (plist-get options (if buffer :background :html-background)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12406 "Transparent"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12407 (if (eq fg 'default) (setq fg (org-dvipng-color :foreground))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12408 (if (eq bg 'default) (setq bg (org-dvipng-color :background))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12409 (with-temp-file texfile |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12410 (insert org-format-latex-header |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12411 "\n\\begin{document}\n" string "\n\\end{document}\n")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12412 (let ((dir default-directory)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12413 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12414 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12415 (cd tmpdir) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12416 (call-process "latex" nil nil nil texfile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12417 (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12418 (cd dir)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12419 (if (not (file-exists-p dvifile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12420 (progn (message "Failed to create dvi file from %s" texfile) nil) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12421 (condition-case nil |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12422 (call-process "dvipng" nil nil nil |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12423 "-E" "-fg" fg "-bg" bg |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12424 "-D" dpi |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12425 ;;"-x" scale "-y" scale |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12426 "-T" "tight" |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12427 "-o" pngfile |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12428 dvifile) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12429 (error nil)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12430 (if (not (file-exists-p pngfile)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12431 (progn (message "Failed to create png file from %s" texfile) nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12432 ;; Use the requested file name and clean up |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12433 (copy-file pngfile tofile 'replace) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12434 (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12435 (delete-file (concat texfilebase e))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12436 pngfile)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12437 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12438 (defun org-dvipng-color (attr) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12439 "Return an rgb color specification for dvipng." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12440 (apply 'format "rgb %s %s %s" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12441 (mapcar 'org-normalize-color |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12442 (color-values (face-attribute 'default attr nil))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12443 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12444 (defun org-normalize-color (value) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12445 "Return string to be used as color value for an RGB component." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12446 (format "%g" (/ value 65535.0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12447 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12448 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12449 ;;;; Key bindings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12450 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12451 ;; Make `C-c C-x' a prefix key |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12452 (org-defkey org-mode-map "\C-c\C-x" (make-sparse-keymap)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12453 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12454 ;; TAB key with modifiers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12455 (org-defkey org-mode-map "\C-i" 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12456 (org-defkey org-mode-map [(tab)] 'org-cycle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12457 (org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12458 (org-defkey org-mode-map [(meta tab)] 'org-complete) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12459 (org-defkey org-mode-map "\M-\t" 'org-complete) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12460 (org-defkey org-mode-map "\M-\C-i" 'org-complete) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12461 ;; The following line is necessary under Suse GNU/Linux |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12462 (unless (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12463 (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12464 (org-defkey org-mode-map [(shift tab)] 'org-shifttab) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12465 (define-key org-mode-map [backtab] 'org-shifttab) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12466 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12467 (org-defkey org-mode-map [(shift return)] 'org-table-copy-down) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12468 (org-defkey org-mode-map [(meta shift return)] 'org-insert-todo-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12469 (org-defkey org-mode-map [(meta return)] 'org-meta-return) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12470 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12471 ;; Cursor keys with modifiers |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12472 (org-defkey org-mode-map [(meta left)] 'org-metaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12473 (org-defkey org-mode-map [(meta right)] 'org-metaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12474 (org-defkey org-mode-map [(meta up)] 'org-metaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12475 (org-defkey org-mode-map [(meta down)] 'org-metadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12476 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12477 (org-defkey org-mode-map [(meta shift left)] 'org-shiftmetaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12478 (org-defkey org-mode-map [(meta shift right)] 'org-shiftmetaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12479 (org-defkey org-mode-map [(meta shift up)] 'org-shiftmetaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12480 (org-defkey org-mode-map [(meta shift down)] 'org-shiftmetadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12481 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12482 (org-defkey org-mode-map [(shift up)] 'org-shiftup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12483 (org-defkey org-mode-map [(shift down)] 'org-shiftdown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12484 (org-defkey org-mode-map [(shift left)] 'org-shiftleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12485 (org-defkey org-mode-map [(shift right)] 'org-shiftright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12486 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12487 (org-defkey org-mode-map [(control shift right)] 'org-shiftcontrolright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12488 (org-defkey org-mode-map [(control shift left)] 'org-shiftcontrolleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12489 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12490 ;;; Extra keys for tty access. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12491 ;; We only set them when really needed because otherwise the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12492 ;; menus don't show the simple keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12493 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12494 (when (or (featurep 'xemacs) ;; because XEmacs supports multi-device stuff |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12495 (not window-system)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12496 (org-defkey org-mode-map "\C-c\C-xc" 'org-table-copy-down) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12497 (org-defkey org-mode-map "\C-c\C-xM" 'org-insert-todo-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12498 (org-defkey org-mode-map "\C-c\C-xm" 'org-meta-return) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12499 (org-defkey org-mode-map [?\e (return)] 'org-meta-return) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12500 (org-defkey org-mode-map [?\e (left)] 'org-metaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12501 (org-defkey org-mode-map "\C-c\C-xl" 'org-metaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12502 (org-defkey org-mode-map [?\e (right)] 'org-metaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12503 (org-defkey org-mode-map "\C-c\C-xr" 'org-metaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12504 (org-defkey org-mode-map [?\e (up)] 'org-metaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12505 (org-defkey org-mode-map "\C-c\C-xu" 'org-metaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12506 (org-defkey org-mode-map [?\e (down)] 'org-metadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12507 (org-defkey org-mode-map "\C-c\C-xd" 'org-metadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12508 (org-defkey org-mode-map "\C-c\C-xL" 'org-shiftmetaleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12509 (org-defkey org-mode-map "\C-c\C-xR" 'org-shiftmetaright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12510 (org-defkey org-mode-map "\C-c\C-xU" 'org-shiftmetaup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12511 (org-defkey org-mode-map "\C-c\C-xD" 'org-shiftmetadown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12512 (org-defkey org-mode-map [?\C-c (up)] 'org-shiftup) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12513 (org-defkey org-mode-map [?\C-c (down)] 'org-shiftdown) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12514 (org-defkey org-mode-map [?\C-c (left)] 'org-shiftleft) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12515 (org-defkey org-mode-map [?\C-c (right)] 'org-shiftright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12516 (org-defkey org-mode-map [?\C-c ?\C-x (right)] 'org-shiftcontrolright) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12517 (org-defkey org-mode-map [?\C-c ?\C-x (left)] 'org-shiftcontrolleft)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12518 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12519 ;; All the other keys |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12520 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12521 (org-defkey org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12522 (org-defkey org-mode-map "\C-c\C-r" 'org-reveal) |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12523 (if (boundp 'narrow-map) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12524 (org-defkey narrow-map "s" 'org-narrow-to-subtree) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
12525 (org-defkey org-mode-map "\C-xns" 'org-narrow-to-subtree)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12526 (org-defkey org-mode-map "\C-c$" 'org-archive-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12527 (org-defkey org-mode-map "\C-c\C-x\C-s" 'org-advertized-archive-subtree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12528 (org-defkey org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12529 (org-defkey org-mode-map "\C-c\C-xa" 'org-toggle-archive-tag) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12530 (org-defkey org-mode-map "\C-c\C-xA" 'org-archive-to-archive-sibling) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12531 (org-defkey org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12532 (org-defkey org-mode-map "\C-c\C-j" 'org-goto) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12533 (org-defkey org-mode-map "\C-c\C-t" 'org-todo) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12534 (org-defkey org-mode-map "\C-c\C-s" 'org-schedule) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12535 (org-defkey org-mode-map "\C-c\C-d" 'org-deadline) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12536 (org-defkey org-mode-map "\C-c;" 'org-toggle-comment) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12537 (org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12538 (org-defkey org-mode-map "\C-c\C-w" 'org-refile) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12539 (org-defkey org-mode-map "\C-c/" 'org-sparse-tree) ; Minor-mode reserved |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12540 (org-defkey org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12541 (org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12542 (org-defkey org-mode-map "\M-\C-m" 'org-insert-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12543 (org-defkey org-mode-map [(control return)] 'org-insert-heading-after-current) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12544 (org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12545 (org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12546 (org-defkey org-mode-map "\C-c\C-l" 'org-insert-link) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12547 (org-defkey org-mode-map "\C-c\C-o" 'org-open-at-point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12548 (org-defkey org-mode-map "\C-c%" 'org-mark-ring-push) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12549 (org-defkey org-mode-map "\C-c&" 'org-mark-ring-goto) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12550 (org-defkey org-mode-map "\C-c\C-z" 'org-add-note) ; Alternative binding |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12551 (org-defkey org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12552 (org-defkey org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12553 (org-defkey org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12554 (org-defkey org-mode-map "\C-c\C-y" 'org-evaluate-time-range) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12555 (org-defkey org-mode-map "\C-c>" 'org-goto-calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12556 (org-defkey org-mode-map "\C-c<" 'org-date-from-calendar) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12557 (org-defkey org-mode-map [(control ?,)] 'org-cycle-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12558 (org-defkey org-mode-map [(control ?\')] 'org-cycle-agenda-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12559 (org-defkey org-mode-map "\C-c[" 'org-agenda-file-to-front) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12560 (org-defkey org-mode-map "\C-c]" 'org-remove-file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12561 (org-defkey org-mode-map "\C-c\C-x<" 'org-agenda-set-restriction-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12562 (org-defkey org-mode-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12563 (org-defkey org-mode-map "\C-c-" 'org-ctrl-c-minus) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12564 (org-defkey org-mode-map "\C-c*" 'org-ctrl-c-star) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12565 (org-defkey org-mode-map "\C-c^" 'org-sort) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12566 (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12567 (org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12568 (org-defkey org-mode-map "\C-c#" 'org-update-checkbox-count) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12569 (org-defkey org-mode-map "\C-m" 'org-return) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12570 (org-defkey org-mode-map "\C-j" 'org-return-indent) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12571 (org-defkey org-mode-map "\C-c?" 'org-table-field-info) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12572 (org-defkey org-mode-map "\C-c " 'org-table-blank-field) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12573 (org-defkey org-mode-map "\C-c+" 'org-table-sum) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12574 (org-defkey org-mode-map "\C-c=" 'org-table-eval-formula) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12575 (org-defkey org-mode-map "\C-c'" 'org-edit-special) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12576 (org-defkey org-mode-map "\C-c`" 'org-table-edit-field) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12577 (org-defkey org-mode-map "\C-c|" 'org-table-create-or-convert-from-region) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12578 (org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12579 (org-defkey org-mode-map "\C-c~" 'org-table-create-with-table.el) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12580 (org-defkey org-mode-map "\C-c\C-q" 'org-table-wrap-region) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12581 (org-defkey org-mode-map "\C-c}" 'org-table-toggle-coordinate-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12582 (org-defkey org-mode-map "\C-c{" 'org-table-toggle-formula-debugger) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12583 (org-defkey org-mode-map "\C-c\C-e" 'org-export) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12584 (org-defkey org-mode-map "\C-c:" 'org-toggle-fixed-width-section) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12585 (org-defkey org-mode-map "\C-c\C-x\C-f" 'org-emphasize) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12586 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12587 (org-defkey org-mode-map "\C-c\C-x\C-k" 'org-mark-entry-for-agenda-action) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12588 (org-defkey org-mode-map "\C-c\C-x\C-w" 'org-cut-special) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12589 (org-defkey org-mode-map "\C-c\C-x\M-w" 'org-copy-special) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12590 (org-defkey org-mode-map "\C-c\C-x\C-y" 'org-paste-special) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12591 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12592 (org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12593 (org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12594 (org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12595 (org-defkey org-mode-map "\C-c\C-x\C-j" 'org-clock-goto) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12596 (org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12597 (org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12598 (org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12599 (org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12600 (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12601 (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12602 (org-defkey org-mode-map "\C-c\C-xp" 'org-set-property) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12603 (org-defkey org-mode-map "\C-c\C-xr" 'org-insert-columns-dblock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12604 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12605 (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12606 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12607 (when (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12608 (org-defkey org-mode-map 'button3 'popup-mode-menu)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12609 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12610 (defvar org-table-auto-blank-field) ; defined in org-table.el |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12611 (defun org-self-insert-command (N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12612 "Like `self-insert-command', use overwrite-mode for whitespace in tables. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12613 If the cursor is in a table looking at whitespace, the whitespace is |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12614 overwritten, and the table is not marked as requiring realignment." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12615 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12616 (if (and (org-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12617 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12618 ;; check if we blank the field, and if that triggers align |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12619 (and (featurep 'org-table) org-table-auto-blank-field |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12620 (member last-command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12621 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12622 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12623 ;; got extra space, this field does not determine column width |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12624 (let (org-table-may-need-update) (org-table-blank-field)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12625 ;; no extra space, this field may determine column width |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12626 (org-table-blank-field))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12627 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12628 (eq N 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12629 (looking-at "[^|\n]* |")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12630 (let (org-table-may-need-update) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12631 (goto-char (1- (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12632 (delete-backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12633 (goto-char (match-beginning 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12634 (self-insert-command N)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12635 (setq org-table-may-need-update t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12636 (self-insert-command N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12637 (org-fix-tags-on-the-fly))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12638 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12639 (defun org-fix-tags-on-the-fly () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12640 (when (and (equal (char-after (point-at-bol)) ?*) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12641 (org-on-heading-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12642 (org-align-tags-here org-tags-column))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12643 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12644 (defun org-delete-backward-char (N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12645 "Like `delete-backward-char', insert whitespace at field end in tables. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12646 When deleting backwards, in tables this function will insert whitespace in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12647 front of the next \"|\" separator, to keep the table aligned. The table will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12648 still be marked for re-alignment if the field did fill the entire column, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12649 because, in this case the deletion might narrow the column." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12650 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12651 (if (and (org-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12652 (eq N 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12653 (string-match "|" (buffer-substring (point-at-bol) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12654 (looking-at ".*?|")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12655 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12656 (noalign (looking-at "[^|\n\r]* |")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12657 (c org-table-may-need-update)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12658 (backward-delete-char N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12659 (skip-chars-forward "^|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12660 (insert " ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12661 (goto-char (1- pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12662 ;; noalign: if there were two spaces at the end, this field |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12663 ;; does not determine the width of the column. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12664 (if noalign (setq org-table-may-need-update c))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12665 (backward-delete-char N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12666 (org-fix-tags-on-the-fly))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12667 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12668 (defun org-delete-char (N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12669 "Like `delete-char', but insert whitespace at field end in tables. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12670 When deleting characters, in tables this function will insert whitespace in |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12671 front of the next \"|\" separator, to keep the table aligned. The table will |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12672 still be marked for re-alignment if the field did fill the entire column, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12673 because, in this case the deletion might narrow the column." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12674 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12675 (if (and (org-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12676 (not (bolp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12677 (not (= (char-after) ?|)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12678 (eq N 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12679 (if (looking-at ".*?|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12680 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12681 (noalign (looking-at "[^|\n\r]* |")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12682 (c org-table-may-need-update)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12683 (replace-match (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12684 (substring (match-string 0) 1 -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12685 " |")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12686 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12687 ;; noalign: if there were two spaces at the end, this field |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12688 ;; does not determine the width of the column. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12689 (if noalign (setq org-table-may-need-update c))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12690 (delete-char N)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12691 (delete-char N) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12692 (org-fix-tags-on-the-fly))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12693 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12694 ;; Make `delete-selection-mode' work with org-mode and orgtbl-mode |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12695 (put 'org-self-insert-command 'delete-selection t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12696 (put 'orgtbl-self-insert-command 'delete-selection t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12697 (put 'org-delete-char 'delete-selection 'supersede) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12698 (put 'org-delete-backward-char 'delete-selection 'supersede) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12699 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12700 ;; Make `flyspell-mode' delay after some commands |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12701 (put 'org-self-insert-command 'flyspell-delayed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12702 (put 'orgtbl-self-insert-command 'flyspell-delayed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12703 (put 'org-delete-char 'flyspell-delayed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12704 (put 'org-delete-backward-char 'flyspell-delayed t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12705 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12706 ;; Make pabbrev-mode expand after org-mode commands |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12707 (put 'org-self-insert-command 'pabbrev-expand-after-command t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12708 (put 'orgybl-self-insert-command 'pabbrev-expand-after-command t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12709 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12710 ;; How to do this: Measure non-white length of current string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12711 ;; If equal to column width, we should realign. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12712 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12713 (defun org-remap (map &rest commands) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12714 "In MAP, remap the functions given in COMMANDS. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12715 COMMANDS is a list of alternating OLDDEF NEWDEF command names." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12716 (let (new old) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12717 (while commands |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12718 (setq old (pop commands) new (pop commands)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12719 (if (fboundp 'command-remapping) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12720 (org-defkey map (vector 'remap old) new) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12721 (substitute-key-definition old new map global-map))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12722 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12723 (when (eq org-enable-table-editor 'optimized) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12724 ;; If the user wants maximum table support, we need to hijack |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12725 ;; some standard editing functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12726 (org-remap org-mode-map |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12727 'self-insert-command 'org-self-insert-command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12728 'delete-char 'org-delete-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12729 'delete-backward-char 'org-delete-backward-char) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12730 (org-defkey org-mode-map "|" 'org-force-self-insert)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12731 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12732 (defun org-shiftcursor-error () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12733 "Throw an error because Shift-Cursor command was applied in wrong context." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12734 (error "This command is active in special context like tables, headlines or timestamps")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12735 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12736 (defun org-shifttab (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12737 "Global visibility cycling or move to previous table field. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12738 Calls `org-cycle' with argument t, or `org-table-previous-field', depending |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12739 on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12740 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12741 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12742 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12743 ((org-at-table-p) (call-interactively 'org-table-previous-field)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12744 ((integerp arg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12745 (message "Content view to level: %d" arg) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12746 (org-content (prefix-numeric-value arg)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12747 (setq org-cycle-global-status 'overview)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12748 (t (call-interactively 'org-global-cycle)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12749 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12750 (defun org-shiftmetaleft () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12751 "Promote subtree or delete table column. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12752 Calls `org-promote-subtree', `org-outdent-item', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12753 or `org-table-delete-column', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12754 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12755 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12756 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12757 ((org-at-table-p) (call-interactively 'org-table-delete-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12758 ((org-on-heading-p) (call-interactively 'org-promote-subtree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12759 ((org-at-item-p) (call-interactively 'org-outdent-item)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12760 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12761 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12762 (defun org-shiftmetaright () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12763 "Demote subtree or insert table column. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12764 Calls `org-demote-subtree', `org-indent-item', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12765 or `org-table-insert-column', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12766 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12767 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12768 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12769 ((org-at-table-p) (call-interactively 'org-table-insert-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12770 ((org-on-heading-p) (call-interactively 'org-demote-subtree)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12771 ((org-at-item-p) (call-interactively 'org-indent-item)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12772 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12773 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12774 (defun org-shiftmetaup (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12775 "Move subtree up or kill table row. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12776 Calls `org-move-subtree-up' or `org-table-kill-row' or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12777 `org-move-item-up' depending on context. See the individual commands |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12778 for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12779 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12780 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12781 ((org-at-table-p) (call-interactively 'org-table-kill-row)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12782 ((org-on-heading-p) (call-interactively 'org-move-subtree-up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12783 ((org-at-item-p) (call-interactively 'org-move-item-up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12784 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12785 (defun org-shiftmetadown (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12786 "Move subtree down or insert table row. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12787 Calls `org-move-subtree-down' or `org-table-insert-row' or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12788 `org-move-item-down', depending on context. See the individual |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12789 commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12790 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12791 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12792 ((org-at-table-p) (call-interactively 'org-table-insert-row)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12793 ((org-on-heading-p) (call-interactively 'org-move-subtree-down)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12794 ((org-at-item-p) (call-interactively 'org-move-item-down)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12795 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12796 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12797 (defun org-metaleft (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12798 "Promote heading or move table column to left. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12799 Calls `org-do-promote' or `org-table-move-column', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12800 With no specific context, calls the Emacs default `backward-word'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12801 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12802 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12803 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12804 ((org-at-table-p) (org-call-with-arg 'org-table-move-column 'left)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12805 ((or (org-on-heading-p) (org-region-active-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12806 (call-interactively 'org-do-promote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12807 ((org-at-item-p) (call-interactively 'org-outdent-item)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12808 (t (call-interactively 'backward-word)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12809 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12810 (defun org-metaright (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12811 "Demote subtree or move table column to right. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12812 Calls `org-do-demote' or `org-table-move-column', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12813 With no specific context, calls the Emacs default `forward-word'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12814 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12815 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12816 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12817 ((org-at-table-p) (call-interactively 'org-table-move-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12818 ((or (org-on-heading-p) (org-region-active-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12819 (call-interactively 'org-do-demote)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12820 ((org-at-item-p) (call-interactively 'org-indent-item)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12821 (t (call-interactively 'forward-word)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12822 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12823 (defun org-metaup (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12824 "Move subtree up or move table row up. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12825 Calls `org-move-subtree-up' or `org-table-move-row' or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12826 `org-move-item-up', depending on context. See the individual commands |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12827 for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12828 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12829 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12830 ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12831 ((org-on-heading-p) (call-interactively 'org-move-subtree-up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12832 ((org-at-item-p) (call-interactively 'org-move-item-up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12833 (t (transpose-lines 1) (beginning-of-line -1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12834 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12835 (defun org-metadown (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12836 "Move subtree down or move table row down. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12837 Calls `org-move-subtree-down' or `org-table-move-row' or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12838 `org-move-item-down', depending on context. See the individual |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12839 commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12840 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12841 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12842 ((org-at-table-p) (call-interactively 'org-table-move-row)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12843 ((org-on-heading-p) (call-interactively 'org-move-subtree-down)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12844 ((org-at-item-p) (call-interactively 'org-move-item-down)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12845 (t (beginning-of-line 2) (transpose-lines 1) (beginning-of-line 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12846 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12847 (defun org-shiftup (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12848 "Increase item in timestamp or increase priority of current headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12849 Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item', |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12850 depending on context. See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12851 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12852 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12853 ((org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12854 (call-interactively (if org-edit-timestamp-down-means-later |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12855 'org-timestamp-down 'org-timestamp-up))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12856 ((org-on-heading-p) (call-interactively 'org-priority-up)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12857 ((org-at-item-p) (call-interactively 'org-previous-item)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12858 ((org-clocktable-try-shift 'up arg)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12859 (t (call-interactively 'org-beginning-of-item) (beginning-of-line 1)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12860 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12861 (defun org-shiftdown (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12862 "Decrease item in timestamp or decrease priority of current headline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12863 Calls `org-timestamp-down' or `org-priority-down', or `org-next-item' |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12864 depending on context. See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12865 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12866 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12867 ((org-at-timestamp-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12868 (call-interactively (if org-edit-timestamp-down-means-later |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12869 'org-timestamp-up 'org-timestamp-down))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12870 ((org-on-heading-p) (call-interactively 'org-priority-down)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12871 ((org-clocktable-try-shift 'down arg)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12872 (t (call-interactively 'org-next-item)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12873 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12874 (defun org-shiftright (&optional arg) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12875 "Next TODO keyword or timestamp one day later, depending on context." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12876 (interactive "P") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12877 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12878 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12879 ((org-on-heading-p) (org-call-with-arg 'org-todo 'right)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12880 ((org-at-item-p) (org-call-with-arg 'org-cycle-list-bullet nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12881 ((org-at-property-p) (call-interactively 'org-property-next-allowed-value)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12882 ((org-clocktable-try-shift 'right arg)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12883 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12884 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12885 (defun org-shiftleft (&optional arg) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12886 "Previous TODO keyword or timestamp one day earlier, depending on context." |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12887 (interactive "P") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12888 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12889 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12890 ((org-on-heading-p) (org-call-with-arg 'org-todo 'left)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12891 ((org-at-item-p) (org-call-with-arg 'org-cycle-list-bullet 'previous)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12892 ((org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12893 (call-interactively 'org-property-previous-allowed-value)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12894 ((org-clocktable-try-shift 'left arg)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12895 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12896 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12897 (defun org-shiftcontrolright () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12898 "Switch to next TODO set." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12899 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12900 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12901 ((org-on-heading-p) (org-call-with-arg 'org-todo 'nextset)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12902 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12903 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12904 (defun org-shiftcontrolleft () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12905 "Switch to previous TODO set." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12906 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12907 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12908 ((org-on-heading-p) (org-call-with-arg 'org-todo 'previousset)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12909 (t (org-shiftcursor-error)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12910 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12911 (defun org-ctrl-c-ret () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12912 "Call `org-table-hline-and-move' or `org-insert-heading' dep. on context." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12913 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12914 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12915 ((org-at-table-p) (call-interactively 'org-table-hline-and-move)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12916 (t (call-interactively 'org-insert-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12917 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12918 (defun org-copy-special () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12919 "Copy region in table or copy current subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12920 Calls `org-table-copy' or `org-copy-subtree', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12921 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12922 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12923 (call-interactively |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12924 (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12925 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12926 (defun org-cut-special () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12927 "Cut region in table or cut current subtree. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12928 Calls `org-table-copy' or `org-cut-subtree', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12929 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12930 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12931 (call-interactively |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12932 (if (org-at-table-p) 'org-table-cut-region 'org-cut-subtree))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12933 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12934 (defun org-paste-special (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12935 "Paste rectangular region into table, or past subtree relative to level. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12936 Calls `org-table-paste-rectangle' or `org-paste-subtree', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12937 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12938 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12939 (if (org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12940 (org-table-paste-rectangle) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12941 (org-paste-subtree arg))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12942 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12943 (defun org-edit-special () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12944 "Call a special editor for the stuff at point. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12945 When at a table, call the formula editor with `org-table-edit-formulas'. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12946 When at the first line of an src example, call `org-edit-src-code'. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12947 When in an #+include line, visit the include file. Otherwise call |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12948 `ffap' to visit the file at point." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12949 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12950 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12951 ((org-at-table-p) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12952 (call-interactively 'org-table-edit-formulas)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12953 ((save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12954 (beginning-of-line 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12955 (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12956 (find-file (org-trim (match-string 1)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12957 ((org-edit-src-code)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12958 (t (call-interactively 'ffap)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
12959 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12960 (defun org-ctrl-c-ctrl-c (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12961 "Set tags in headline, or update according to changed information at point. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12962 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12963 This command does many different things, depending on context: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12964 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12965 - If the cursor is in a headline, prompt for tags and insert them |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12966 into the current line, aligned to `org-tags-column'. When called |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12967 with prefix arg, realign all tags in the current buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12968 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12969 - If the cursor is in one of the special #+KEYWORD lines, this |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12970 triggers scanning the buffer for these lines and updating the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12971 information. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12972 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12973 - If the cursor is inside a table, realign the table. This command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12974 works even if the automatic table editor has been turned off. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12975 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12976 - If the cursor is on a #+TBLFM line, re-apply the formulas to |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12977 the entire table. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12978 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12979 - If the cursor is a the beginning of a dynamic block, update it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12980 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12981 - If the cursor is inside a table created by the table.el package, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12982 activate that table. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12983 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12984 - If the current buffer is a remember buffer, close note and file it. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12985 with a prefix argument, file it without further interaction to the default |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12986 location. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12987 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12988 - If the cursor is on a <<<target>>>, update radio targets and corresponding |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12989 links in this buffer. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12990 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12991 - If the cursor is on a numbered item in a plain list, renumber the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12992 ordered list. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12993 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12994 - If the cursor is on a checkbox, toggle it." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12995 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12996 (let ((org-enable-table-editor t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12997 (cond |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
12998 ((or (and (boundp 'org-clock-overlays) org-clock-overlays) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12999 org-occur-highlights |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13000 org-latex-fragment-image-overlays) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13001 (and (boundp 'org-clock-overlays) (org-remove-clock-overlays)) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13002 (org-remove-occur-highlights) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13003 (org-remove-latex-fragment-image-overlays) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13004 (message "Temporary highlights/overlays removed from current buffer")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13005 ((and (local-variable-p 'org-finish-function (current-buffer)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13006 (fboundp org-finish-function)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13007 (funcall org-finish-function)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13008 ((org-at-property-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13009 (call-interactively 'org-property-action)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13010 ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13011 ((org-on-heading-p) (call-interactively 'org-set-tags)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13012 ((org-at-table.el-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13013 (require 'table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13014 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13015 (re-search-forward "|" (save-excursion (end-of-line 2) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13016 (call-interactively 'table-recognize-table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13017 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13018 (org-table-maybe-eval-formula) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13019 (if arg |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13020 (call-interactively 'org-table-recalculate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13021 (org-table-maybe-recalculate-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13022 (call-interactively 'org-table-align)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13023 ((org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13024 (call-interactively 'org-toggle-checkbox)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13025 ((org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13026 (call-interactively 'org-maybe-renumber-ordered-list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13027 ((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13028 ;; Dynamic block |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13029 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13030 (org-update-dblock)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13031 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13032 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13033 ((equal (match-string 1) "TBLFM") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13034 ;; Recalculate the table before this line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13035 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13036 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13037 (skip-chars-backward " \r\n\t") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13038 (if (org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13039 (org-call-with-arg 'org-table-recalculate t)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13040 (t |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13041 ; (org-set-regexps-and-options) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13042 ; (org-restart-font-lock) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13043 (let ((org-inhibit-startup t)) (org-mode-restart)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13044 (message "Local setup has been refreshed")))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13045 (t (error "C-c C-c can do nothing useful at this location."))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13046 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13047 (defun org-mode-restart () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13048 "Restart Org-mode, to scan again for special lines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13049 Also updates the keyword regular expressions." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13050 (interactive) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13051 (org-mode) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13052 (message "Org-mode restarted")) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13053 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13054 (defun org-kill-note-or-show-branches () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13055 "If this is a Note buffer, abort storing the note. Else call `show-branches'." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13056 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13057 (if (not org-finish-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13058 (call-interactively 'show-branches) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13059 (let ((org-note-abort t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13060 (funcall org-finish-function)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13061 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13062 (defun org-return (&optional indent) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13063 "Goto next table row or insert a newline. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13064 Calls `org-table-next-row' or `newline', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13065 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13066 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13067 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13068 ((bobp) (if indent (newline-and-indent) (newline))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13069 ((and (org-at-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13070 (looking-at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13071 (org-re "\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13072 (org-show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13073 (end-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13074 (newline)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13075 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13076 (org-table-justify-field-maybe) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13077 (call-interactively 'org-table-next-row)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13078 (t (if indent (newline-and-indent) (newline))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13079 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13080 (defun org-return-indent () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13081 "Goto next table row or insert a newline and indent. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13082 Calls `org-table-next-row' or `newline-and-indent', depending on |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13083 context. See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13084 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13085 (org-return t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13086 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13087 (defun org-ctrl-c-star () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13088 "Compute table, or change heading status of lines. |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13089 Calls `org-table-recalculate' or `org-toggle-region-headings', |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13090 depending on context. This will also turn a plain list item or a normal |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13091 line into a subheading." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13092 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13093 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13094 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13095 (call-interactively 'org-table-recalculate)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13096 ((org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13097 ;; Convert all lines in region to list items |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13098 (call-interactively 'org-toggle-region-headings)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13099 ((org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13100 (org-toggle-region-headings (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13101 (min (1+ (point-at-eol)) (point-max)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13102 ((org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13103 ;; Convert to heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13104 (let ((level (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13105 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13106 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13107 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13108 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13109 (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13110 (error 0)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13111 (replace-match |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13112 (concat (make-string (org-get-valid-level level 1) ?*) " ") t t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13113 (t (org-toggle-region-headings (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13114 (min (1+ (point-at-eol)) (point-max)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13115 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13116 (defun org-ctrl-c-minus () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13117 "Insert separator line in table or modify bullet status of line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13118 Also turns a plain line or a region of lines into list items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13119 Calls `org-table-insert-hline', `org-toggle-region-items', or |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13120 `org-cycle-list-bullet', depending on context." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13121 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13122 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13123 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13124 (call-interactively 'org-table-insert-hline)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13125 ((org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13126 ;; Convert to item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13127 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13128 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13129 (if (looking-at "\\*+ ") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13130 (replace-match (concat (make-string (- (match-end 0) (point) 1) ?\ ) "- "))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13131 ((org-region-active-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13132 ;; Convert all lines in region to list items |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13133 (call-interactively 'org-toggle-region-items)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13134 ((org-in-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13135 (call-interactively 'org-cycle-list-bullet)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13136 (t (org-toggle-region-items (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13137 (min (1+ (point-at-eol)) (point-max)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13138 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13139 (defun org-toggle-region-items (beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13140 "Convert all lines in region to list items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13141 If the first line is already an item, convert all list items in the region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13142 to normal lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13143 (interactive "r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13144 (let (l2 l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13145 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13146 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13147 (setq l2 (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13148 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13149 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13150 (setq l (1- (org-current-line))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13151 (if (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13152 ;; We already have items, de-itemize |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13153 (while (< (setq l (1+ l)) l2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13154 (when (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13155 (goto-char (match-beginning 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13156 (delete-region (match-beginning 2) (match-end 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13157 (and (looking-at "[ \t]+") (replace-match ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13158 (beginning-of-line 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13159 (while (< (setq l (1+ l)) l2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13160 (unless (org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13161 (if (looking-at "\\([ \t]*\\)\\(\\S-\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13162 (replace-match "\\1- \\2"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13163 (beginning-of-line 2)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13164 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13165 (defun org-toggle-region-headings (beg end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13166 "Convert all lines in region to list items. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13167 If the first line is already an item, convert all list items in the region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13168 to normal lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13169 (interactive "r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13170 (let (l2 l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13171 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13172 (goto-char end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13173 (setq l2 (org-current-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13174 (goto-char beg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13175 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13176 (setq l (1- (org-current-line))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13177 (if (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13178 ;; We already have headlines, de-star them |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13179 (while (< (setq l (1+ l)) l2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13180 (when (org-on-heading-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13181 (and (looking-at outline-regexp) (replace-match ""))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13182 (beginning-of-line 2)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13183 (let* ((stars (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13184 (re-search-backward org-complex-heading-regexp nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13185 (or (match-string 1) "*"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13186 (add-stars (if org-odd-levels-only "**" "*")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13187 (rpl (concat stars add-stars " \\2"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13188 (while (< (setq l (1+ l)) l2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13189 (unless (org-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13190 (if (looking-at "\\([ \t]*\\)\\(\\S-\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13191 (replace-match rpl))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13192 (beginning-of-line 2))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13193 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13194 (defun org-meta-return (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13195 "Insert a new heading or wrap a region in a table. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13196 Calls `org-insert-heading' or `org-table-wrap-region', depending on context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13197 See the individual commands for more information." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13198 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13199 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13200 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13201 (call-interactively 'org-table-wrap-region)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13202 (t (call-interactively 'org-insert-heading)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13203 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13204 ;;; Menu entries |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13205 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13206 ;; Define the Org-mode menus |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13207 (easy-menu-define org-tbl-menu org-mode-map "Tbl menu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13208 '("Tbl" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13209 ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p)] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13210 ["Next Field" org-cycle (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13211 ["Previous Field" org-shifttab (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13212 ["Next Row" org-return (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13213 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13214 ["Blank Field" org-table-blank-field (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13215 ["Edit Field" org-table-edit-field (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13216 ["Copy Field from Above" org-table-copy-down (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13217 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13218 ("Column" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13219 ["Move Column Left" org-metaleft (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13220 ["Move Column Right" org-metaright (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13221 ["Delete Column" org-shiftmetaleft (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13222 ["Insert Column" org-shiftmetaright (org-at-table-p)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13223 ("Row" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13224 ["Move Row Up" org-metaup (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13225 ["Move Row Down" org-metadown (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13226 ["Delete Row" org-shiftmetaup (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13227 ["Insert Row" org-shiftmetadown (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13228 ["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
|
13229 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13230 ["Insert Hline" org-ctrl-c-minus (org-at-table-p)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13231 ("Rectangle" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13232 ["Copy Rectangle" org-copy-special (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13233 ["Cut Rectangle" org-cut-special (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13234 ["Paste Rectangle" org-paste-special (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13235 ["Fill Rectangle" org-table-wrap-region (org-at-table-p)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13236 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13237 ("Calculate" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13238 ["Set Column Formula" org-table-eval-formula (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13239 ["Set Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="] |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13240 ["Edit Formulas" org-edit-special (org-at-table-p)] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13241 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13242 ["Recalculate line" org-table-recalculate (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13243 ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13244 ["Iterate all" (lambda () (interactive) (org-table-recalculate '(16))) :active (org-at-table-p) :keys "C-u C-u C-c *"] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13245 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13246 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13247 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13248 ["Sum Column/Rectangle" org-table-sum |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13249 (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
|
13250 ["Which Column?" org-table-current-column (org-at-table-p)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13251 ["Debug Formulas" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13252 org-table-toggle-formula-debugger |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13253 :style toggle :selected (org-bound-and-true-p org-table-formula-debug)] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13254 ["Show Col/Row Numbers" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13255 org-table-toggle-coordinate-overlays |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13256 :style toggle |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13257 :selected (org-bound-and-true-p org-table-overlay-coordinates)] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13258 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13259 ["Create" org-table-create (and (not (org-at-table-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13260 org-enable-table-editor)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13261 ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13262 ["Import from File" org-table-import (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13263 ["Export to File" org-table-export (org-at-table-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13264 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13265 ["Create/Convert from/to table.el" org-table-create-with-table.el t])) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13266 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13267 (easy-menu-define org-org-menu org-mode-map "Org menu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13268 '("Org" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13269 ("Show/Hide" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13270 ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))] |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13271 ["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))] |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13272 ["Sparse Tree..." org-sparse-tree t] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13273 ["Reveal Context" org-reveal t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13274 ["Show All" show-all t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13275 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13276 ["Subtree to indirect buffer" org-tree-to-indirect-buffer t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13277 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13278 ["New Heading" org-insert-heading t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13279 ("Navigate Headings" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13280 ["Up" outline-up-heading t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13281 ["Next" outline-next-visible-heading t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13282 ["Previous" outline-previous-visible-heading t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13283 ["Next Same Level" outline-forward-same-level t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13284 ["Previous Same Level" outline-backward-same-level t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13285 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13286 ["Jump" org-goto t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13287 ("Edit Structure" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13288 ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13289 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13290 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13291 ["Copy Subtree" org-copy-special (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13292 ["Cut Subtree" org-cut-special (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13293 ["Paste Subtree" org-paste-special (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13294 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13295 ["Promote Heading" org-metaleft (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13296 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13297 ["Demote Heading" org-metaright (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13298 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13299 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13300 ["Sort Region/Children" org-sort (not (org-at-table-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13301 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13302 ["Convert to odd levels" org-convert-to-odd-levels t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13303 ["Convert to odd/even levels" org-convert-to-oddeven-levels t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13304 ("Editing" |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13305 ["Emphasis..." org-emphasize t] |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13306 ["Edit Source Example" org-edit-special t]) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13307 ("Archive" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13308 ["Toggle ARCHIVE tag" org-toggle-archive-tag t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13309 ; ["Check and Tag Children" (org-toggle-archive-tag (4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13310 ; :active t :keys "C-u C-c C-x C-a"] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13311 ["Sparse trees open ARCHIVE trees" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13312 (setq org-sparse-tree-open-archived-trees |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13313 (not org-sparse-tree-open-archived-trees)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13314 :style toggle :selected org-sparse-tree-open-archived-trees] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13315 ["Cycling opens ARCHIVE trees" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13316 (setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13317 :style toggle :selected org-cycle-open-archived-trees] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13318 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13319 ["Move Subtree to Archive" org-advertized-archive-subtree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13320 ; ["Check and Move Children" (org-archive-subtree '(4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13321 ; :active t :keys "C-u C-c C-x C-s"] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13322 ) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13323 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13324 ("TODO Lists" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13325 ["TODO/DONE/-" org-todo t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13326 ("Select keyword" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13327 ["Next keyword" org-shiftright (org-on-heading-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13328 ["Previous keyword" org-shiftleft (org-on-heading-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13329 ["Complete Keyword" org-complete (assq :todo-keyword (org-context))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13330 ["Next keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13331 ["Previous keyword set" org-shiftcontrolright (and (> (length org-todo-sets) 1) (org-on-heading-p))]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13332 ["Show TODO Tree" org-show-todo-tree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13333 ["Global TODO list" org-todo-list t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13334 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13335 ["Set Priority" org-priority t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13336 ["Priority Up" org-shiftup t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13337 ["Priority Down" org-shiftdown t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13338 ("TAGS and Properties" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13339 ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13340 ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13341 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13342 ["Set property" 'org-set-property t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13343 ["Column view of properties" org-columns t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13344 ["Insert Column View DBlock" org-insert-columns-dblock t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13345 ("Dates and Scheduling" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13346 ["Timestamp" org-time-stamp t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13347 ["Timestamp (inactive)" org-time-stamp-inactive t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13348 ("Change Date" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13349 ["1 Day Later" org-shiftright t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13350 ["1 Day Earlier" org-shiftleft t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13351 ["1 ... Later" org-shiftup t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13352 ["1 ... Earlier" org-shiftdown t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13353 ["Compute Time Range" org-evaluate-time-range t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13354 ["Schedule Item" org-schedule t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13355 ["Deadline" org-deadline t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13356 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13357 ["Custom time format" org-toggle-time-stamp-overlays |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13358 :style radio :selected org-display-custom-times] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13359 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13360 ["Goto Calendar" org-goto-calendar t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13361 ["Date from Calendar" org-date-from-calendar t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13362 ("Logging work" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13363 ["Clock in" org-clock-in t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13364 ["Clock out" org-clock-out t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13365 ["Clock cancel" org-clock-cancel t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13366 ["Goto running clock" org-clock-goto t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13367 ["Display times" org-clock-display t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13368 ["Create clock table" org-clock-report t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13369 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13370 ["Record DONE time" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13371 (progn (setq org-log-done (not org-log-done)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13372 (message "Switching to %s will %s record a timestamp" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13373 (car org-done-keywords) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13374 (if org-log-done "automatically" "not"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13375 :style toggle :selected org-log-done]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13376 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13377 ["Agenda Command..." org-agenda t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13378 ["Set Restriction Lock" org-agenda-set-restriction-lock t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13379 ("File List for Agenda") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13380 ("Special views current file" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13381 ["TODO Tree" org-show-todo-tree t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13382 ["Check Deadlines" org-check-deadlines t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13383 ["Timeline" org-timeline t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13384 ["Tags Tree" org-tags-sparse-tree t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13385 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13386 ("Hyperlinks" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13387 ["Store Link (Global)" org-store-link t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13388 ["Insert Link" org-insert-link t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13389 ["Follow Link" org-open-at-point t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13390 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13391 ["Next link" org-next-link t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13392 ["Previous link" org-previous-link t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13393 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13394 ["Descriptive Links" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13395 (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13396 :style radio |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13397 :selected (member '(org-link) buffer-invisibility-spec)] |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13398 ["Literal Links" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13399 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13400 (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13401 :style radio |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13402 :selected (not (member '(org-link) buffer-invisibility-spec))]) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13403 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13404 ["Export/Publish..." org-export t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13405 ("LaTeX" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13406 ["Org CDLaTeX mode" org-cdlatex-mode :style toggle |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13407 :selected org-cdlatex-mode] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13408 ["Insert Environment" cdlatex-environment (fboundp 'cdlatex-environment)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13409 ["Insert math symbol" cdlatex-math-symbol (fboundp 'cdlatex-math-symbol)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13410 ["Modify math symbol" org-cdlatex-math-modify |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13411 (org-inside-LaTeX-fragment-p)] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13412 ["Export LaTeX fragments as images" |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13413 (if (featurep 'org-exp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13414 (setq org-export-with-LaTeX-fragments |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13415 (not org-export-with-LaTeX-fragments)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13416 (require 'org-exp)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13417 :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13418 org-export-with-LaTeX-fragments)]) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13419 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13420 ("Documentation" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13421 ["Show Version" org-version t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13422 ["Info Documentation" org-info t]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13423 ("Customize" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13424 ["Browse Org Group" org-customize t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13425 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13426 ["Expand This Menu" org-create-customize-menu |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13427 (fboundp 'customize-menu-create)]) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13428 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13429 ["Refresh setup" org-mode-restart t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13430 )) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13431 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13432 (defun org-info (&optional node) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13433 "Read documentation for Org-mode in the info system. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13434 With optional NODE, go directly to that node." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13435 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13436 (info (format "(org)%s" (or node "")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13437 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13438 (defun org-install-agenda-files-menu () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13439 (let ((bl (buffer-list))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13440 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13441 (while bl |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13442 (set-buffer (pop bl)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13443 (if (org-mode-p) (setq bl nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13444 (when (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13445 (easy-menu-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13446 '("Org") "File List for Agenda" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13447 (append |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13448 (list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13449 ["Edit File List" (org-edit-agenda-file-list) t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13450 ["Add/Move Current File to Front of List" org-agenda-file-to-front t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13451 ["Remove Current File from List" org-remove-file t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13452 ["Cycle through agenda files" org-cycle-agenda-files t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13453 ["Occur in all agenda files" org-occur-in-agenda-files t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13454 "--") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13455 (mapcar 'org-file-menu-entry (org-agenda-files t)))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13456 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13457 ;;;; Documentation |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13458 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13459 ;;;###autoload |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13460 (defun org-require-autoloaded-modules () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13461 (interactive) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13462 (mapc 'require |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13463 '(org-agenda org-archive org-clock org-colview |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13464 org-exp org-id org-export-latex org-publish |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13465 org-remember org-table))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13466 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13467 ;;;###autoload |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13468 (defun org-customize () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13469 "Call the customize function with org as argument." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13470 (interactive) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13471 (org-load-modules-maybe) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13472 (org-require-autoloaded-modules) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13473 (customize-browse 'org)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13474 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13475 (defun org-create-customize-menu () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13476 "Create a full customization menu for Org-mode, insert it into the menu." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13477 (interactive) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13478 (org-load-modules-maybe) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13479 (org-require-autoloaded-modules) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13480 (if (fboundp 'customize-menu-create) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13481 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13482 (easy-menu-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13483 '("Org") "Customize" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13484 `(["Browse Org group" org-customize t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13485 "--" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13486 ,(customize-menu-create 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13487 ["Set" Custom-set t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13488 ["Save" Custom-save t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13489 ["Reset to Current" Custom-reset-current t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13490 ["Reset to Saved" Custom-reset-saved t] |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13491 ["Reset to Standard Settings" Custom-reset-standard t])) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13492 (message "\"Org\"-menu now contains full customization menu")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13493 (error "Cannot expand menu (outdated version of cus-edit.el)"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13494 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13495 ;;;; Miscellaneous stuff |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13496 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13497 ;;; Generally useful functions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13498 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13499 (defun org-display-warning (message) ;; Copied from Emacs-Muse |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13500 "Display the given MESSAGE as a warning." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13501 (if (fboundp 'display-warning) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13502 (display-warning 'org message |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13503 (if (featurep 'xemacs) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13504 'warning |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13505 :warning)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13506 (let ((buf (get-buffer-create "*Org warnings*"))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13507 (with-current-buffer buf |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13508 (goto-char (point-max)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13509 (insert "Warning (Org): " message) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13510 (unless (bolp) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13511 (newline))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13512 (display-buffer buf) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13513 (sit-for 0)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13514 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13515 (defun org-goto-marker-or-bmk (marker &optional bookmark) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13516 "Go to MARKER, widen if necesary. When marker is not live, try BOOKMARK." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13517 (if (and marker (marker-buffer marker) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13518 (buffer-live-p (marker-buffer marker))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13519 (progn |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13520 (switch-to-buffer (marker-buffer marker)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13521 (if (or (> marker (point-max)) (< marker (point-min))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13522 (widen)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13523 (goto-char marker)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13524 (if bookmark |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13525 (bookmark-jump bookmark) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13526 (error "Cannot find location")))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13527 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13528 (defun org-quote-csv-field (s) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13529 "Quote field for inclusion in CSV material." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13530 (if (string-match "[\",]" s) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13531 (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13532 s)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13533 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13534 (defun org-plist-delete (plist property) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13535 "Delete PROPERTY from PLIST. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13536 This is in contrast to merely setting it to 0." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13537 (let (p) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13538 (while plist |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13539 (if (not (eq property (car plist))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13540 (setq p (plist-put p (car plist) (nth 1 plist)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13541 (setq plist (cddr plist))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13542 p)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13543 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13544 (defun org-force-self-insert (N) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13545 "Needed to enforce self-insert under remapping." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13546 (interactive "p") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13547 (self-insert-command N)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13548 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13549 (defun org-string-width (s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13550 "Compute width of string, ignoring invisible characters. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13551 This ignores character with invisibility property `org-link', and also |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13552 characters with property `org-cwidth', because these will become invisible |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13553 upon the next fontification round." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13554 (let (b l) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13555 (when (or (eq t buffer-invisibility-spec) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13556 (assq 'org-link buffer-invisibility-spec)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13557 (while (setq b (text-property-any 0 (length s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13558 'invisible 'org-link s)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13559 (setq s (concat (substring s 0 b) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13560 (substring s (or (next-single-property-change |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13561 b 'invisible s) (length s))))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13562 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13563 (setq s (concat (substring s 0 b) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13564 (substring s (or (next-single-property-change |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13565 b 'org-cwidth s) (length s)))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13566 (setq l (string-width s) b -1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13567 (while (setq b (text-property-any (1+ b) (length s) 'org-dwidth t s)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13568 (setq l (- l (get-text-property b 'org-dwidth-n s)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13569 l)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13570 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13571 (defun org-base-buffer (buffer) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13572 "Return the base buffer of BUFFER, if it has one. Else return the buffer." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13573 (if (not buffer) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13574 buffer |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13575 (or (buffer-base-buffer buffer) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13576 buffer))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13577 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13578 (defun org-trim (s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13579 "Remove whitespace at beginning and end of string." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13580 (if (string-match "\\`[ \t\n\r]+" s) (setq s (replace-match "" t t s))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13581 (if (string-match "[ \t\n\r]+\\'" s) (setq s (replace-match "" t t s))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13582 s) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13583 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13584 (defun org-wrap (string &optional width lines) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13585 "Wrap string to either a number of lines, or a width in characters. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13586 If WIDTH is non-nil, the string is wrapped to that width, however many lines |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13587 that costs. If there is a word longer than WIDTH, the text is actually |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13588 wrapped to the length of that word. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13589 IF WIDTH is nil and LINES is non-nil, the string is forced into at most that |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13590 many lines, whatever width that takes. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13591 The return value is a list of lines, without newlines at the end." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13592 (let* ((words (org-split-string string "[ \t\n]+")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13593 (maxword (apply 'max (mapcar 'org-string-width words))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13594 w ll) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13595 (cond (width |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13596 (org-do-wrap words (max maxword width))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13597 (lines |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13598 (setq w maxword) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13599 (setq ll (org-do-wrap words maxword)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13600 (if (<= (length ll) lines) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13601 ll |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13602 (setq ll words) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13603 (while (> (length ll) lines) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13604 (setq w (1+ w)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13605 (setq ll (org-do-wrap words w))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13606 ll)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13607 (t (error "Cannot wrap this"))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13608 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13609 (defun org-do-wrap (words width) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13610 "Create lines of maximum width WIDTH (in characters) from word list WORDS." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13611 (let (lines line) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13612 (while words |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13613 (setq line (pop words)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13614 (while (and words (< (+ (length line) (length (car words))) width)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13615 (setq line (concat line " " (pop words)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13616 (setq lines (push line lines))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13617 (nreverse lines))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13618 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13619 (defun org-split-string (string &optional separators) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13620 "Splits STRING into substrings at SEPARATORS. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13621 No empty strings are returned if there are matches at the beginning |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13622 and end of string." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13623 (let ((rexp (or separators "[ \f\t\n\r\v]+")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13624 (start 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13625 notfirst |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13626 (list nil)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13627 (while (and (string-match rexp string |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13628 (if (and notfirst |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13629 (= start (match-beginning 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13630 (< start (length string))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13631 (1+ start) start)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13632 (< (match-beginning 0) (length string))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13633 (setq notfirst t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13634 (or (eq (match-beginning 0) 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13635 (and (eq (match-beginning 0) (match-end 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13636 (eq (match-beginning 0) start)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13637 (setq list |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13638 (cons (substring string start (match-beginning 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13639 list))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13640 (setq start (match-end 0))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13641 (or (eq start (length string)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13642 (setq list |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13643 (cons (substring string start) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13644 list))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13645 (nreverse list))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13646 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13647 (defun org-context () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13648 "Return a list of contexts of the current cursor position. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13649 If several contexts apply, all are returned. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13650 Each context entry is a list with a symbol naming the context, and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13651 two positions indicating start and end of the context. Possible |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13652 contexts are: |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13653 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13654 :headline anywhere in a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13655 :headline-stars on the leading stars in a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13656 :todo-keyword on a TODO keyword (including DONE) in a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13657 :tags on the TAGS in a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13658 :priority on the priority cookie in a headline |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13659 :item on the first line of a plain list item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13660 :item-bullet on the bullet/number of a plain list item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13661 :checkbox on the checkbox in a plain list item |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13662 :table in an org-mode table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13663 :table-special on a special filed in a table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13664 :table-table in a table.el table |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13665 :link on a hyperlink |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13666 :keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13667 :target on a <<target>> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13668 :radio-target on a <<<radio-target>>> |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13669 :latex-fragment on a LaTeX fragment |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13670 :latex-preview on a LaTeX fragment with overlayed preview image |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13671 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13672 This function expects the position to be visible because it uses font-lock |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13673 faces as a help to recognize the following contexts: :table-special, :link, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13674 and :keyword." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13675 (let* ((f (get-text-property (point) 'face)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13676 (faces (if (listp f) f (list f))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13677 (p (point)) clist o) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13678 ;; First the large context |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13679 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13680 ((org-on-heading-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13681 (push (list :headline (point-at-bol) (point-at-eol)) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13682 (when (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13683 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13684 (looking-at org-todo-line-tags-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13685 (push (org-point-in-group p 1 :headline-stars) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13686 (push (org-point-in-group p 2 :todo-keyword) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13687 (push (org-point-in-group p 4 :tags) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13688 (goto-char p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13689 (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13690 (if (looking-at "\\[#[A-Z0-9]\\]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13691 (push (org-point-in-group p 0 :priority) clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13692 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13693 ((org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13694 (push (org-point-in-group p 2 :item-bullet) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13695 (push (list :item (point-at-bol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13696 (save-excursion (org-end-of-item) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13697 clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13698 (and (org-at-item-checkbox-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13699 (push (org-point-in-group p 0 :checkbox) clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13700 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13701 ((org-at-table-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13702 (push (list :table (org-table-begin) (org-table-end)) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13703 (if (memq 'org-formula faces) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13704 (push (list :table-special |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13705 (previous-single-property-change p 'face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13706 (next-single-property-change p 'face)) clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13707 ((org-at-table-p 'any) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13708 (push (list :table-table) clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13709 (goto-char p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13710 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13711 ;; Now the small context |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13712 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13713 ((org-at-timestamp-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13714 (push (org-point-in-group p 0 :timestamp) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13715 ((memq 'org-link faces) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13716 (push (list :link |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13717 (previous-single-property-change p 'face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13718 (next-single-property-change p 'face)) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13719 ((memq 'org-special-keyword faces) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13720 (push (list :keyword |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13721 (previous-single-property-change p 'face) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13722 (next-single-property-change p 'face)) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13723 ((org-on-target-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13724 (push (org-point-in-group p 0 :target) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13725 (goto-char (1- (match-beginning 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13726 (if (looking-at org-radio-target-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13727 (push (org-point-in-group p 0 :radio-target) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13728 (goto-char p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13729 ((setq o (car (delq nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13730 (mapcar |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13731 (lambda (x) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13732 (if (memq x org-latex-fragment-image-overlays) x)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13733 (org-overlays-at (point)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13734 (push (list :latex-fragment |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13735 (org-overlay-start o) (org-overlay-end o)) clist) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13736 (push (list :latex-preview |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13737 (org-overlay-start o) (org-overlay-end o)) clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13738 ((org-inside-LaTeX-fragment-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13739 ;; FIXME: positions wrong. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13740 (push (list :latex-fragment (point) (point)) clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13741 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13742 (setq clist (nreverse (delq nil clist))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13743 clist)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13744 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13745 ;; FIXME: Compare with at-regexp-p Do we need both? |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13746 (defun org-in-regexp (re &optional nlines visually) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13747 "Check if point is inside a match of regexp. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13748 Normally only the current line is checked, but you can include NLINES extra |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13749 lines both before and after point into the search. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13750 If VISUALLY is set, require that the cursor is not after the match but |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13751 really on, so that the block visually is on the match." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13752 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13753 (let ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13754 (eol (point-at-eol (+ 1 (or nlines 0)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13755 (inc (if visually 1 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13756 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13757 (beginning-of-line (- 1 (or nlines 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13758 (while (re-search-forward re eol t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13759 (if (and (<= (match-beginning 0) pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13760 (>= (+ inc (match-end 0)) pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13761 (throw 'exit (cons (match-beginning 0) (match-end 0))))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13762 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13763 (defun org-at-regexp-p (regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13764 "Is point inside a match of REGEXP in the current line?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13765 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13766 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13767 (let ((pos (point)) (end (point-at-eol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13768 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13769 (while (re-search-forward regexp end t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13770 (if (and (<= (match-beginning 0) pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13771 (>= (match-end 0) pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13772 (throw 'exit t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13773 nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13774 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13775 (defun org-occur-in-agenda-files (regexp &optional nlines) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13776 "Call `multi-occur' with buffers for all agenda files." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13777 (interactive "sOrg-files matching: \np") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13778 (let* ((files (org-agenda-files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13779 (tnames (mapcar 'file-truename files)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13780 (extra org-agenda-text-search-extra-files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13781 f) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13782 (when (eq (car extra) 'agenda-archives) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13783 (setq extra (cdr extra)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13784 (setq files (org-add-archive-files files))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13785 (while (setq f (pop extra)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13786 (unless (member (file-truename f) tnames) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13787 (add-to-list 'files f 'append) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13788 (add-to-list 'tnames (file-truename f) 'append))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13789 (multi-occur |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13790 (mapcar (lambda (x) (or (get-file-buffer x) (find-file-noselect x))) files) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13791 regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13792 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13793 (if (boundp 'occur-mode-find-occurrence-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13794 ;; Emacs 23 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13795 (add-hook 'occur-mode-find-occurrence-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13796 (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13797 (when (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13798 (org-reveal)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13799 ;; Emacs 22 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13800 (defadvice occur-mode-goto-occurrence |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13801 (after org-occur-reveal activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13802 (and (org-mode-p) (org-reveal))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13803 (defadvice occur-mode-goto-occurrence-other-window |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13804 (after org-occur-reveal activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13805 (and (org-mode-p) (org-reveal))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13806 (defadvice occur-mode-display-occurrence |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13807 (after org-occur-reveal activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13808 (when (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13809 (let ((pos (occur-mode-find-occurrence))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13810 (with-current-buffer (marker-buffer pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13811 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13812 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13813 (org-reveal))))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13814 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13815 (defun org-uniquify (list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13816 "Remove duplicate elements from LIST." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13817 (let (res) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13818 (mapc (lambda (x) (add-to-list 'res x 'append)) list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13819 res)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13820 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13821 (defun org-delete-all (elts list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13822 "Remove all elements in ELTS from LIST." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13823 (while elts |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13824 (setq list (delete (pop elts) list))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13825 list) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13826 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13827 (defun org-back-over-empty-lines () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13828 "Move backwards over witespace, to the beginning of the first empty line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13829 Returns the number of empty lines passed." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13830 (let ((pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13831 (skip-chars-backward " \t\n\r") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13832 (beginning-of-line 2) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13833 (goto-char (min (point) pos)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13834 (count-lines (point) pos))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13835 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13836 (defun org-skip-whitespace () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13837 (skip-chars-forward " \t\n\r")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13838 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13839 (defun org-point-in-group (point group &optional context) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13840 "Check if POINT is in match-group GROUP. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13841 If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13842 match. If the match group does ot exist or point is not inside it, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13843 return nil." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13844 (and (match-beginning group) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13845 (>= point (match-beginning group)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13846 (<= point (match-end group)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13847 (if context |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13848 (list context (match-beginning group) (match-end group)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13849 t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13850 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13851 (defun org-switch-to-buffer-other-window (&rest args) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13852 "Switch to buffer in a second window on the current frame. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13853 In particular, do not allow pop-up frames." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13854 (let (pop-up-frames special-display-buffer-names special-display-regexps |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13855 special-display-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13856 (apply 'switch-to-buffer-other-window args))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13857 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13858 (defun org-combine-plists (&rest plists) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13859 "Create a single property list from all plists in PLISTS. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13860 The process starts by copying the first list, and then setting properties |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13861 from the other lists. Settings in the last list are the most significant |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13862 ones and overrule settings in the other lists." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13863 (let ((rtn (copy-sequence (pop plists))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13864 p v ls) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13865 (while plists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13866 (setq ls (pop plists)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13867 (while ls |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13868 (setq p (pop ls) v (pop ls)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13869 (setq rtn (plist-put rtn p v)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13870 rtn)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13871 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13872 (defun org-move-line-down (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13873 "Move the current line down. With prefix argument, move it past ARG lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13874 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13875 (let ((col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13876 beg end pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13877 (beginning-of-line 1) (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13878 (beginning-of-line 2) (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13879 (beginning-of-line (+ 1 arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13880 (setq pos (move-marker (make-marker) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13881 (insert (delete-and-extract-region beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13882 (goto-char pos) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13883 (org-move-to-column col))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13884 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13885 (defun org-move-line-up (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13886 "Move the current line up. With prefix argument, move it past ARG lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13887 (interactive "p") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13888 (let ((col (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13889 beg end pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13890 (beginning-of-line 1) (setq beg (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13891 (beginning-of-line 2) (setq end (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13892 (beginning-of-line (- arg)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13893 (setq pos (move-marker (make-marker) (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13894 (insert (delete-and-extract-region beg end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13895 (goto-char pos) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
13896 (org-move-to-column col))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13897 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13898 (defun org-replace-escapes (string table) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13899 "Replace %-escapes in STRING with values in TABLE. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13900 TABLE is an association list with keys like \"%a\" and string values. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13901 The sequences in STRING may contain normal field width and padding information, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13902 for example \"%-5s\". Replacements happen in the sequence given by TABLE, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13903 so values can contain further %-escapes if they are define later in TABLE." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13904 (let ((case-fold-search nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13905 e re rpl) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13906 (while (setq e (pop table)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13907 (setq re (concat "%-?[0-9.]*" (substring (car e) 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13908 (while (string-match re string) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13909 (setq rpl (format (concat (substring (match-string 0 string) 0 -1) "s") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13910 (cdr e))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13911 (setq string (replace-match rpl t t string)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13912 string)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13913 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13914 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13915 (defun org-sublist (list start end) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13916 "Return a section of LIST, from START to END. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13917 Counting starts at 1." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13918 (let (rtn (c start)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13919 (setq list (nthcdr (1- start) list)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13920 (while (and list (<= c end)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13921 (push (pop list) rtn) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13922 (setq c (1+ c))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13923 (nreverse rtn))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13924 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13925 (defun org-find-base-buffer-visiting (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13926 "Like `find-buffer-visiting' but alway return the base buffer and |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13927 not an indirect buffer." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13928 (let ((buf (find-buffer-visiting file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13929 (if buf |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13930 (or (buffer-base-buffer buf) buf) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13931 nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13932 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13933 (defun org-image-file-name-regexp () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13934 "Return regexp matching the file names of images." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13935 (if (fboundp 'image-file-name-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13936 (image-file-name-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13937 (let ((image-file-name-extensions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13938 '("png" "jpeg" "jpg" "gif" "tiff" "tif" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13939 "xbm" "xpm" "pbm" "pgm" "ppm"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13940 (concat "\\." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13941 (regexp-opt (nconc (mapcar 'upcase |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13942 image-file-name-extensions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13943 image-file-name-extensions) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13944 t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13945 "\\'")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13946 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13947 (defun org-file-image-p (file) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13948 "Return non-nil if FILE is an image." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13949 (save-match-data |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13950 (string-match (org-image-file-name-regexp) file))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13951 |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13952 (defun org-get-cursor-date () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13953 "Return the date at cursor in as a time. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13954 This works in the calendar and in the agenda, anywhere else it just |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13955 returns the current time." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13956 (let (date day defd) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13957 (cond |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13958 ((eq major-mode 'calendar-mode) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13959 (setq date (calendar-cursor-to-date) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13960 defd (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13961 ((eq major-mode 'org-agenda-mode) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13962 (setq day (get-text-property (point) 'day)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13963 (if day |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13964 (setq date (calendar-gregorian-from-absolute day) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13965 defd (encode-time 0 0 0 (nth 1 date) (nth 0 date) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13966 (nth 2 date)))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13967 (or defd (current-time)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13968 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13969 (defvar org-agenda-action-marker (make-marker) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13970 "Marker pointing to the entry for the next agenda action.") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13971 |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13972 (defun org-mark-entry-for-agenda-action () |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13973 "Mark the current entry as target of an agenda action. |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13974 Agenda actions are actions executed from the agenda with the key `k', |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13975 which make use of the date at the cursor." |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13976 (interactive) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13977 (move-marker org-agenda-action-marker |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13978 (save-excursion (org-back-to-heading t) (point)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13979 (current-buffer)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13980 (message |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13981 "Entry marked for action; press `k' at desired date in agenda or calendar")) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
13982 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13983 ;;; Paragraph filling stuff. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13984 ;; We want this to be just right, so use the full arsenal. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13985 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13986 (defun org-indent-line-function () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13987 "Indent line like previous, but further if previous was headline or item." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13988 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13989 (let* ((pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13990 (itemp (org-at-item-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13991 column bpos bcol tpos tcol bullet btype bullet-type) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13992 ;; Find the previous relevant line |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13993 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13994 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13995 ((looking-at "#") (setq column 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13996 ((looking-at "\\*+ ") (setq column 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13997 (t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13998 (beginning-of-line 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13999 (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14000 (beginning-of-line 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14001 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14002 ((looking-at "\\*+[ \t]+") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14003 (if (not org-adapt-indentation) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14004 (setq column 0) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14005 (goto-char (match-end 0)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14006 (setq column (current-column)))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14007 ((org-in-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14008 (org-beginning-of-item) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14009 ; (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14010 (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?") |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14011 (setq bpos (match-beginning 1) tpos (match-end 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14012 bcol (progn (goto-char bpos) (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14013 tcol (progn (goto-char tpos) (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14014 bullet (match-string 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14015 bullet-type (if (string-match "[0-9]" bullet) "n" bullet)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14016 (if (> tcol (+ bcol org-description-max-indent)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14017 (setq tcol (+ bcol 5))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14018 (if (not itemp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14019 (setq column tcol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14020 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14021 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14022 (if (looking-at "\\S-") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14023 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14024 (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14025 (setq bullet (match-string 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14026 btype (if (string-match "[0-9]" bullet) "n" bullet)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14027 (setq column (if (equal btype bullet-type) bcol tcol))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14028 (setq column (org-get-indentation))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14029 (t (setq column (org-get-indentation)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14030 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14031 (if (<= (current-column) (current-indentation)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14032 (org-indent-line-to column) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14033 (save-excursion (org-indent-line-to column))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14034 (setq column (current-column)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14035 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14036 (if (looking-at |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14037 "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14038 (replace-match (concat "\\1" (format org-property-format |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14039 (match-string 2) (match-string 3))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14040 t nil)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14041 (org-move-to-column column))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14042 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14043 (defun org-set-autofill-regexps () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14044 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14045 ;; In the paragraph separator we include headlines, because filling |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14046 ;; text in a line directly attached to a headline would otherwise |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14047 ;; fill the headline as well. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14048 (org-set-local 'comment-start-skip "^#+[ \t]*") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14049 (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14050 ;; The paragraph starter includes hand-formatted lists. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14051 (org-set-local 'paragraph-start |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14052 "\f\\|[ ]*$\\|\\*+ \\|\f\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14053 ;; Inhibit auto-fill for headers, tables and fixed-width lines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14054 ;; But only if the user has not turned off tables or fixed-width regions |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14055 (org-set-local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14056 'auto-fill-inhibit-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14057 (concat "\\*+ \\|#\\+" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14058 "\\|[ \t]*" org-keyword-time-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14059 (if (or org-enable-table-editor org-enable-fixed-width-editor) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14060 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14061 "\\|[ \t]*[" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14062 (if org-enable-table-editor "|" "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14063 (if org-enable-fixed-width-editor ":" "") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14064 "]")))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14065 ;; We use our own fill-paragraph function, to make sure that tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14066 ;; and fixed-width regions are not wrapped. That function will pass |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14067 ;; through to `fill-paragraph' when appropriate. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14068 (org-set-local 'fill-paragraph-function 'org-fill-paragraph) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14069 ; Adaptive filling: To get full control, first make sure that |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14070 ;; `adaptive-fill-regexp' never matches. Then install our own matcher. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14071 (org-set-local 'adaptive-fill-regexp "\000") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14072 (org-set-local 'adaptive-fill-function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14073 'org-adaptive-fill-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14074 (org-set-local |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14075 'align-mode-rules-list |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14076 '((org-in-buffer-settings |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14077 (regexp . "^#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14078 (modes . '(org-mode)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14079 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14080 (defun org-fill-paragraph (&optional justify) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14081 "Re-align a table, pass through to fill-paragraph if no table." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14082 (let ((table-p (org-at-table-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14083 (table.el-p (org-at-table.el-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14084 (cond ((and (equal (char-after (point-at-bol)) ?*) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14085 (save-excursion (goto-char (point-at-bol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14086 (looking-at outline-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14087 t) ; skip headlines |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14088 (table.el-p t) ; skip table.el tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14089 (table-p (org-table-align) t) ; align org-mode tables |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14090 (t nil)))) ; call paragraph-fill |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14091 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14092 ;; For reference, this is the default value of adaptive-fill-regexp |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14093 ;; "[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14094 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14095 (defun org-adaptive-fill-function () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14096 "Return a fill prefix for org-mode files. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14097 In particular, this makes sure hanging paragraphs for hand-formatted lists |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14098 work correctly." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14099 (cond ((looking-at "#[ \t]+") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14100 (match-string 0)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14101 ((looking-at "[ \t]*\\([-*+] .*? :: \\)") |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14102 (save-excursion |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14103 (if (> (match-end 1) (+ (match-beginning 1) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14104 org-description-max-indent)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14105 (goto-char (+ (match-beginning 1) 5)) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14106 (goto-char (match-end 0))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14107 (make-string (current-column) ?\ ))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14108 ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] \\)?") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14109 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14110 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14111 (make-string (current-column) ?\ ))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14112 (t nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14113 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14114 ;;; Other stuff. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14115 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14116 (defun org-toggle-fixed-width-section (arg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14117 "Toggle the fixed-width export. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14118 If there is no active region, the QUOTE keyword at the current headline is |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14119 inserted or removed. When present, it causes the text between this headline |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14120 and the next to be exported as fixed-width text, and unmodified. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14121 If there is an active region, this command adds or removes a colon as the |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14122 first character of this line. If the first character of a line is a colon, |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14123 this line is also exported in fixed-width font." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14124 (interactive "P") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14125 (let* ((cc 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14126 (regionp (org-region-active-p)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14127 (beg (if regionp (region-beginning) (point))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14128 (end (if regionp (region-end))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14129 (nlines (or arg (if (and beg end) (count-lines beg end) 1))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14130 (case-fold-search nil) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14131 (re "[ \t]*\\(:\\)") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14132 off) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14133 (if regionp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14134 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14135 (goto-char beg) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14136 (setq cc (current-column)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14137 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14138 (setq off (looking-at re)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14139 (while (> nlines 0) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14140 (setq nlines (1- nlines)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14141 (beginning-of-line 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14142 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14143 (arg |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14144 (org-move-to-column cc t) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14145 (insert ":\n") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14146 (forward-line -1)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14147 ((and off (looking-at re)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14148 (replace-match "" t t nil 1)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14149 ((not off) (org-move-to-column cc t) (insert ":"))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14150 (forward-line 1))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14151 (save-excursion |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14152 (org-back-to-heading) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14153 (if (looking-at (concat outline-regexp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14154 "\\( *\\<" org-quote-string "\\>[ \t]*\\)")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14155 (replace-match "" t t nil 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14156 (if (looking-at outline-regexp) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14157 (progn |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14158 (goto-char (match-end 0)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14159 (insert org-quote-string " ")))))))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14160 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14161 ;;;; Functions extending outline functionality |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14162 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14163 (defun org-beginning-of-line (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14164 "Go to the beginning of the current line. If that is invisible, continue |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14165 to a visible line beginning. This makes the function of C-a more intuitive. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14166 If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14167 first attempt, and only move to after the tags when the cursor is already |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14168 beyond the end of the headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14169 (interactive "P") |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14170 (let ((pos (point)) refpos) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14171 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14172 (if (bobp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14173 nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14174 (backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14175 (if (org-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14176 (while (and (not (bobp)) (org-invisible-p)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14177 (backward-char 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14178 (beginning-of-line 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14179 (forward-char 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14180 (when org-special-ctrl-a/e |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14181 (cond |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14182 ((and (looking-at org-complex-heading-regexp) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14183 (= (char-after (match-end 1)) ?\ )) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14184 (setq refpos (min (1+ (or (match-end 3) (match-end 2) (match-end 1))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14185 (point-at-eol))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14186 (goto-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14187 (if (eq org-special-ctrl-a/e t) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14188 (cond ((> pos refpos) refpos) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14189 ((= pos (point)) refpos) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14190 (t (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14191 (cond ((> pos (point)) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14192 ((not (eq last-command this-command)) (point)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14193 (t refpos))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14194 ((org-at-item-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14195 (goto-char |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14196 (if (eq org-special-ctrl-a/e t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14197 (cond ((> pos (match-end 4)) (match-end 4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14198 ((= pos (point)) (match-end 4)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14199 (t (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14200 (cond ((> pos (point)) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14201 ((not (eq last-command this-command)) (point)) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14202 (t (match-end 4)))))))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14203 (org-no-warnings |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14204 (and (featurep 'xemacs) (setq zmacs-region-stays t))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14205 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14206 (defun org-end-of-line (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14207 "Go to the end of the line. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14208 If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14209 first attempt, and only move to after the tags when the cursor is already |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14210 beyond the end of the headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14211 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14212 (if (or (not org-special-ctrl-a/e) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14213 (not (org-on-heading-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14214 (end-of-line arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14215 (let ((pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14216 (beginning-of-line 1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14217 (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14218 (if (eq org-special-ctrl-a/e t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14219 (if (or (< pos (match-beginning 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14220 (= pos (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14221 (goto-char (match-beginning 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14222 (goto-char (match-end 0))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14223 (if (or (< pos (match-end 0)) (not (eq this-command last-command))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14224 (goto-char (match-end 0)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14225 (goto-char (match-beginning 1)))) |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14226 (end-of-line arg)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14227 (org-no-warnings |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14228 (and (featurep 'xemacs) (setq zmacs-region-stays t)))) |
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14229 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14230 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14231 (define-key org-mode-map "\C-a" 'org-beginning-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14232 (define-key org-mode-map "\C-e" 'org-end-of-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14233 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14234 (defun org-kill-line (&optional arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14235 "Kill line, to tags or end of line." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14236 (interactive "P") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14237 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14238 ((or (not org-special-ctrl-k) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14239 (bolp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14240 (not (org-on-heading-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14241 (call-interactively 'kill-line)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14242 ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14243 (kill-region (point) (match-beginning 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14244 (org-set-tags nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14245 (t (kill-region (point) (point-at-eol))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14246 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14247 (define-key org-mode-map "\C-k" 'org-kill-line) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14248 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14249 (defun org-invisible-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14250 "Check if point is at a character currently not visible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14251 ;; Early versions of noutline don't have `outline-invisible-p'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14252 (if (fboundp 'outline-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14253 (outline-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14254 (get-char-property (point) 'invisible))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14255 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14256 (defun org-invisible-p2 () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14257 "Check if point is at a character currently not visible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14258 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14259 (if (and (eolp) (not (bobp))) (backward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14260 ;; Early versions of noutline don't have `outline-invisible-p'. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14261 (if (fboundp 'outline-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14262 (outline-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14263 (get-char-property (point) 'invisible)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14264 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14265 (defalias 'org-back-to-heading 'outline-back-to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14266 (defalias 'org-on-heading-p 'outline-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14267 (defalias 'org-at-heading-p 'outline-on-heading-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14268 (defun org-at-heading-or-item-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14269 (or (org-on-heading-p) (org-at-item-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14270 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14271 (defun org-on-target-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14272 (or (org-in-regexp org-radio-target-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14273 (org-in-regexp org-target-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14274 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14275 (defun org-up-heading-all (arg) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14276 "Move to the heading line of which the present line is a subheading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14277 This function considers both visible and invisible heading lines. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14278 With argument, move up ARG levels." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14279 (if (fboundp 'outline-up-heading-all) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14280 (outline-up-heading-all arg) ; emacs 21 version of outline.el |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14281 (outline-up-heading arg t))) ; emacs 22 version of outline.el |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14282 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14283 (defun org-up-heading-safe () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14284 "Move to the heading line of which the present line is a subheading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14285 This version will not throw an error. It will return the level of the |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14286 headline found, or nil if no higher level is found." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14287 (let ((pos (point)) start-level level |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14288 (re (concat "^" outline-regexp))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14289 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14290 (outline-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14291 (setq start-level (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14292 (if (equal start-level 1) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14293 (while (re-search-backward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14294 (setq level (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14295 (if (< level start-level) (throw 'exit level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14296 nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14297 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14298 (defun org-first-sibling-p () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14299 "Is this heading the first child of its parents?" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14300 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14301 (let ((re (concat "^" outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14302 level l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14303 (unless (org-at-heading-p t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14304 (error "Not at a heading")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14305 (setq level (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14306 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14307 (if (not (re-search-backward re nil t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14308 t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14309 (setq l (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14310 (< l level))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14311 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14312 (defun org-goto-sibling (&optional previous) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14313 "Goto the next sibling, even if it is invisible. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14314 When PREVIOUS is set, go to the previous sibling instead. Returns t |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14315 when a sibling was found. When none is found, return nil and don't |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14316 move point." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14317 (let ((fun (if previous 're-search-backward 're-search-forward)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14318 (pos (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14319 (re (concat "^" outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14320 level l) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14321 (when (condition-case nil (org-back-to-heading t) (error nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14322 (setq level (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14323 (catch 'exit |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14324 (or previous (forward-char 1)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14325 (while (funcall fun re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14326 (setq l (funcall outline-level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14327 (when (< l level) (goto-char pos) (throw 'exit nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14328 (when (= l level) (goto-char (match-beginning 0)) (throw 'exit t))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14329 (goto-char pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14330 nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14331 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14332 (defun org-show-siblings () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14333 "Show all siblings of the current headline." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14334 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14335 (while (org-goto-sibling) (org-flag-heading nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14336 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14337 (while (org-goto-sibling 'previous) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14338 (org-flag-heading nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14339 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14340 (defun org-show-hidden-entry () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14341 "Show an entry where even the heading is hidden." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14342 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14343 (org-show-entry))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14344 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14345 (defun org-flag-heading (flag &optional entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14346 "Flag the current heading. FLAG non-nil means make invisible. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14347 When ENTRY is non-nil, show the entire entry." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14348 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14349 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14350 ;; Check if we should show the entire entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14351 (if entry |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14352 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14353 (org-show-entry) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14354 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14355 (and (outline-next-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14356 (org-flag-heading nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14357 (outline-flag-region (max (point-min) (1- (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14358 (save-excursion (outline-end-of-heading) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14359 flag)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14360 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14361 (defun org-end-of-subtree (&optional invisible-OK to-heading) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14362 ;; This is an exact copy of the original function, but it uses |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14363 ;; `org-back-to-heading', to make it work also in invisible |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14364 ;; trees. And is uses an invisible-OK argument. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14365 ;; Under Emacs this is not needed, but the old outline.el needs this fix. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14366 (org-back-to-heading invisible-OK) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14367 (let ((first t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14368 (level (funcall outline-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14369 (while (and (not (eobp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14370 (or first (> (funcall outline-level) level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14371 (setq first nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14372 (outline-next-heading)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14373 (unless to-heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14374 (if (memq (preceding-char) '(?\n ?\^M)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14375 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14376 ;; Go to end of line before heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14377 (forward-char -1) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14378 (if (memq (preceding-char) '(?\n ?\^M)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14379 ;; leave blank line before heading |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14380 (forward-char -1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14381 (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14382 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14383 (defun org-show-subtree () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14384 "Show everything after this heading at deeper levels." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14385 (outline-flag-region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14386 (point) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14387 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14388 (outline-end-of-subtree) (outline-next-heading) (point)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14389 nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14390 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14391 (defun org-show-entry () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14392 "Show the body directly following this heading. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14393 Show the heading too, if it is currently invisible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14394 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14395 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14396 (condition-case nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14397 (progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14398 (org-back-to-heading t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14399 (outline-flag-region |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14400 (max (point-min) (1- (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14401 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14402 (re-search-forward |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14403 (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14404 (or (match-beginning 1) (point-max))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14405 nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14406 (error nil)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14407 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14408 (defun org-make-options-regexp (kwds) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14409 "Make a regular expression for keyword lines." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14410 (concat |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14411 "^" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14412 "#?[ \t]*\\+\\(" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14413 (mapconcat 'regexp-quote kwds "\\|") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14414 "\\):[ \t]*" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14415 "\\(.+\\)")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14416 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14417 ;; Make isearch reveal the necessary context |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14418 (defun org-isearch-end () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14419 "Reveal context after isearch exits." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14420 (when isearch-success ; only if search was successful |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14421 (if (featurep 'xemacs) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14422 ;; Under XEmacs, the hook is run in the correct place, |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14423 ;; we directly show the context. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14424 (org-show-context 'isearch) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14425 ;; In Emacs the hook runs *before* restoring the overlays. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14426 ;; So we have to use a one-time post-command-hook to do this. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14427 ;; (Emacs 22 has a special variable, see function `org-mode') |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14428 (unless (and (boundp 'isearch-mode-end-hook-quit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14429 isearch-mode-end-hook-quit) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14430 ;; Only when the isearch was not quitted. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14431 (org-add-hook 'post-command-hook 'org-isearch-post-command |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14432 'append 'local))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14433 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14434 (defun org-isearch-post-command () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14435 "Remove self from hook, and show context." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14436 (remove-hook 'post-command-hook 'org-isearch-post-command 'local) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14437 (org-show-context 'isearch)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14438 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14439 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14440 ;;;; Integration with and fixes for other packages |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14441 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14442 ;;; Imenu support |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14443 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14444 (defvar org-imenu-markers nil |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14445 "All markers currently used by Imenu.") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14446 (make-variable-buffer-local 'org-imenu-markers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14447 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14448 (defun org-imenu-new-marker (&optional pos) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14449 "Return a new marker for use by Imenu, and remember the marker." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14450 (let ((m (make-marker))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14451 (move-marker m (or pos (point))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14452 (push m org-imenu-markers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14453 m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14454 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14455 (defun org-imenu-get-tree () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14456 "Produce the index for Imenu." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14457 (mapc (lambda (x) (move-marker x nil)) org-imenu-markers) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14458 (setq org-imenu-markers nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14459 (let* ((n org-imenu-depth) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14460 (re (concat "^" outline-regexp)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14461 (subs (make-vector (1+ n) nil)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14462 (last-level 0) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14463 m tree level head) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14464 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14465 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14466 (widen) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14467 (goto-char (point-max)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14468 (while (re-search-backward re nil t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14469 (setq level (org-reduced-level (funcall outline-level))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14470 (when (<= level n) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14471 (looking-at org-complex-heading-regexp) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14472 (setq head (org-match-string-no-properties 4) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14473 m (org-imenu-new-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14474 (org-add-props head nil 'org-imenu-marker m 'org-imenu t) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14475 (if (>= level last-level) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14476 (push (cons head m) (aref subs level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14477 (push (cons head (aref subs (1+ level))) (aref subs level)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14478 (loop for i from (1+ level) to n do (aset subs i nil))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14479 (setq last-level level))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14480 (aref subs 1))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14481 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14482 (eval-after-load "imenu" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14483 '(progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14484 (add-hook 'imenu-after-jump-hook |
96975
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
14485 (lambda () |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
14486 (if (eq major-mode 'org-mode) |
60149c696033
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
96826
diff
changeset
|
14487 (org-show-context 'org-goto)))))) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14488 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14489 ;; Speedbar support |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14490 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14491 (defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14492 "Overlay marking the agenda restriction line in speedbar.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14493 (org-overlay-put org-speedbar-restriction-lock-overlay |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14494 'face 'org-agenda-restriction-lock) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14495 (org-overlay-put org-speedbar-restriction-lock-overlay |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14496 'help-echo "Agendas are currently limited to this item.") |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14497 (org-detach-overlay org-speedbar-restriction-lock-overlay) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14498 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14499 (defun org-speedbar-set-agenda-restriction () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14500 "Restrict future agenda commands to the location at point in speedbar. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14501 To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14502 (interactive) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14503 (require 'org-agenda) |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14504 (let (p m tp np dir txt w) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14505 (cond |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14506 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14507 'org-imenu t)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14508 (setq m (get-text-property p 'org-imenu-marker)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14509 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14510 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14511 (set-buffer (marker-buffer m)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14512 (goto-char m) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14513 (org-agenda-set-restriction-lock 'subtree)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14514 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14515 'speedbar-function 'speedbar-find-file)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14516 (setq tp (previous-single-property-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14517 (1+ p) 'speedbar-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14518 np (next-single-property-change |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14519 tp 'speedbar-function) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14520 dir (speedbar-line-directory) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14521 txt (buffer-substring-no-properties (or tp (point-min)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14522 (or np (point-max)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14523 (save-excursion |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14524 (save-restriction |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14525 (set-buffer (find-file-noselect |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14526 (let ((default-directory dir)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14527 (expand-file-name txt)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14528 (unless (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14529 (error "Cannot restrict to non-Org-mode file")) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14530 (org-agenda-set-restriction-lock 'file)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14531 (t (error "Don't know how to restrict Org-mode's agenda"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14532 (org-move-overlay org-speedbar-restriction-lock-overlay |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14533 (point-at-bol) (point-at-eol)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14534 (setq current-prefix-arg nil) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14535 (org-agenda-maybe-redo))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14536 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14537 (eval-after-load "speedbar" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14538 '(progn |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14539 (speedbar-add-supported-extension ".org") |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14540 (define-key speedbar-file-key-map "<" 'org-speedbar-set-agenda-restriction) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14541 (define-key speedbar-file-key-map "\C-c\C-x<" 'org-speedbar-set-agenda-restriction) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14542 (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14543 (define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14544 (add-hook 'speedbar-visiting-tag-hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14545 (lambda () (org-show-context 'org-goto))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14546 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14547 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
93810
diff
changeset
|
14548 ;;; Fixes and Hacks for problems with other packages |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14549 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14550 ;; Make flyspell not check words in links, to not mess up our keymap |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14551 (defun org-mode-flyspell-verify () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14552 "Don't let flyspell put overlays at active buttons." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14553 (not (get-text-property (point) 'keymap))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14554 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14555 ;; Make `bookmark-jump' show the jump location if it was hidden. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14556 (eval-after-load "bookmark" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14557 '(if (boundp 'bookmark-after-jump-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14558 ;; We can use the hook |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14559 (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14560 ;; Hook not available, use advice |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14561 (defadvice bookmark-jump (after org-make-visible activate) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14562 "Make the position visible." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14563 (org-bookmark-jump-unhide)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14564 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14565 (defun org-bookmark-jump-unhide () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14566 "Unhide the current position, to show the bookmark location." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14567 (and (org-mode-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14568 (or (org-invisible-p) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14569 (save-excursion (goto-char (max (point-min) (1- (point)))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14570 (org-invisible-p))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14571 (org-show-context 'bookmark-jump))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14572 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14573 ;; Make session.el ignore our circular variable |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14574 (eval-after-load "session" |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14575 '(add-to-list 'session-globals-exclude 'org-mark-ring)) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14576 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14577 ;;;; Experimental code |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14578 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14579 (defun org-closed-in-range () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14580 "Sparse tree of items closed in a certain time range. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14581 Still experimental, may disappear in the future." |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14582 (interactive) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14583 ;; Get the time interval from the user. |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14584 (let* ((time1 (time-to-seconds |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14585 (org-read-date nil 'to-time nil "Starting date: "))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14586 (time2 (time-to-seconds |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14587 (org-read-date nil 'to-time nil "End date:"))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14588 ;; callback function |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14589 (callback (lambda () |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14590 (let ((time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14591 (time-to-seconds |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14592 (apply 'encode-time |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14593 (org-parse-time-string |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14594 (match-string 1)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14595 ;; check if time in interval |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14596 (and (>= time time1) (<= time time2)))))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14597 ;; make tree, check each match with the callback |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14598 (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback))) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14599 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14600 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14601 ;;;; Finish up |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14602 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14603 (provide 'org) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14604 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14605 (run-hooks 'org-load-hook) |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14606 |
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14607 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94876
diff
changeset
|
14608 |
93141
dda2c82177dc
Move org files to their own directory
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
14609 ;;; org.el ends here |